handle TagLib exception

This commit is contained in:
Paddy Xu
2018-01-21 16:11:20 +02:00
parent 35c22db10c
commit 5667f98a01

View File

@@ -146,9 +146,11 @@ namespace QuickLook.Plugin.VideoViewer
if (ShowVideo) if (ShowVideo)
return; return;
try
{
using (var h = File.Create(path)) using (var h = File.Create(path))
{ {
metaTitle.Text = h.Tag.Title; metaTitle.Text = !string.IsNullOrWhiteSpace(h.Tag.Title) ? h.Tag.Title : Path.GetFileName(path);
metaArtists.Text = h.Tag.FirstPerformer; metaArtists.Text = h.Tag.FirstPerformer;
metaAlbum.Text = h.Tag.Album; metaAlbum.Text = h.Tag.Album;
@@ -161,6 +163,13 @@ namespace QuickLook.Plugin.VideoViewer
DetermineTheme(); DetermineTheme();
} }
} }
}
catch (Exception e)
{
metaTitle.Text = Path.GetFileName(path);
metaArtists.Text = metaAlbum.Text = string.Empty;
}
metaArtists.Visibility = string.IsNullOrEmpty(metaArtists.Text) metaArtists.Visibility = string.IsNullOrEmpty(metaArtists.Text)
? Visibility.Collapsed ? Visibility.Collapsed
: Visibility.Visible; : Visibility.Visible;