From f797b4f851615cf7c0dce241f2c6aef03b63e977 Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Sun, 30 Dec 2018 12:44:39 +0300 Subject: [PATCH] Improving thumbnails quality --- FoxTube/Controls/ChannelCard.xaml.cs | 2 +- FoxTube/Controls/PlaylistCard.xaml.cs | 2 +- FoxTube/Controls/VideoCard.xaml.cs | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/FoxTube/Controls/ChannelCard.xaml.cs b/FoxTube/Controls/ChannelCard.xaml.cs index 327417d..1c9bea6 100644 --- a/FoxTube/Controls/ChannelCard.xaml.cs +++ b/FoxTube/Controls/ChannelCard.xaml.cs @@ -74,7 +74,7 @@ namespace FoxTube.Controls { if (item.BrandingSettings.Image.BannerImageUrl.Contains("default")) throw new Exception("Default channel cover detected"); - cover.Source = new BitmapImage(new Uri(item.BrandingSettings.Image.BannerTvLowImageUrl)); + cover.Source = new BitmapImage((item.BrandingSettings.Image.BannerTvHighImageUrl ?? item.BrandingSettings.Image.BannerTvImageUrl).ToUri()); } catch { } } diff --git a/FoxTube/Controls/PlaylistCard.xaml.cs b/FoxTube/Controls/PlaylistCard.xaml.cs index a59f08c..2064916 100644 --- a/FoxTube/Controls/PlaylistCard.xaml.cs +++ b/FoxTube/Controls/PlaylistCard.xaml.cs @@ -40,7 +40,7 @@ namespace FoxTube.Controls try { - thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url)); + thumbnail.Source = new BitmapImage((item.Snippet.Thumbnails.Maxres ?? item.Snippet.Thumbnails.Medium).Url.ToUri()); avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)); } catch { } } diff --git a/FoxTube/Controls/VideoCard.xaml.cs b/FoxTube/Controls/VideoCard.xaml.cs index 3ca5301..092c312 100644 --- a/FoxTube/Controls/VideoCard.xaml.cs +++ b/FoxTube/Controls/VideoCard.xaml.cs @@ -65,7 +65,10 @@ namespace FoxTube.Controls else { views.Text = $"{item.Statistics.ViewCount:0,0} views"; - info.Text = $"{XmlConvert.ToTimeSpan(item.ContentDetails.Duration)} | {Methods.GetAgo(item.Snippet.PublishedAt.Value)}"; + string dur = string.Empty; + try { XmlConvert.ToTimeSpan(item.ContentDetails.Duration); } + catch { } + info.Text = $"{dur} | {Methods.GetAgo(item.Snippet.PublishedAt.Value)}"; embed = false; } @@ -76,7 +79,7 @@ namespace FoxTube.Controls try { avatar.ProfilePicture = new BitmapImage(new Uri(response1.Items[0].Snippet.Thumbnails.Medium.Url)); - thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url)); + thumbnail.Source = new BitmapImage(new Uri((item.Snippet.Thumbnails.Maxres ?? item.Snippet.Thumbnails.Medium).Url)); } catch { }