mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
handle TagLib exception
This commit is contained in:
@@ -146,21 +146,30 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
if (ShowVideo)
|
||||
return;
|
||||
|
||||
using (var h = File.Create(path))
|
||||
try
|
||||
{
|
||||
metaTitle.Text = h.Tag.Title;
|
||||
metaArtists.Text = h.Tag.FirstPerformer;
|
||||
metaAlbum.Text = h.Tag.Album;
|
||||
using (var h = File.Create(path))
|
||||
{
|
||||
metaTitle.Text = !string.IsNullOrWhiteSpace(h.Tag.Title) ? h.Tag.Title : Path.GetFileName(path);
|
||||
metaArtists.Text = h.Tag.FirstPerformer;
|
||||
metaAlbum.Text = h.Tag.Album;
|
||||
|
||||
//var cs = h.Tag.Pictures.FirstOrDefault(p => p.Type == TagLib.PictureType.FrontCover);
|
||||
var cs = h.Tag.Pictures.FirstOrDefault();
|
||||
if (cs != default(IPicture))
|
||||
using (var ms = new MemoryStream(cs.Data.Data))
|
||||
{
|
||||
CoverArt = BitmapFrame.Create(ms, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
DetermineTheme();
|
||||
}
|
||||
//var cs = h.Tag.Pictures.FirstOrDefault(p => p.Type == TagLib.PictureType.FrontCover);
|
||||
var cs = h.Tag.Pictures.FirstOrDefault();
|
||||
if (cs != default(IPicture))
|
||||
using (var ms = new MemoryStream(cs.Data.Data))
|
||||
{
|
||||
CoverArt = BitmapFrame.Create(ms, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
DetermineTheme();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
metaTitle.Text = Path.GetFileName(path);
|
||||
metaArtists.Text = metaAlbum.Text = string.Empty;
|
||||
}
|
||||
|
||||
metaArtists.Visibility = string.IsNullOrEmpty(metaArtists.Text)
|
||||
? Visibility.Collapsed
|
||||
: Visibility.Visible;
|
||||
|
Reference in New Issue
Block a user