From 74273add4f971f0a855ddd5e72c94bffe8fb6139 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:21:15 -0400 Subject: [PATCH 1/3] Fix app crash when fetching videos in vod/clip mass downloaders --- .../WindowMassDownload.xaml.cs | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/TwitchDownloaderWPF/WindowMassDownload.xaml.cs b/TwitchDownloaderWPF/WindowMassDownload.xaml.cs index a220d6d8..5363c2f7 100644 --- a/TwitchDownloaderWPF/WindowMassDownload.xaml.cs +++ b/TwitchDownloaderWPF/WindowMassDownload.xaml.cs @@ -83,7 +83,22 @@ private async Task UpdateList() { currentCursor = cursorList[cursorIndex]; } - GqlVideoSearchResponse res = await TwitchHelper.GetGqlVideos(currentChannel, currentCursor, videoCount); + + GqlVideoSearchResponse res; + try + { + res = await TwitchHelper.GetGqlVideos(currentChannel, currentCursor, videoCount); + } + catch (Exception ex) + { + if (Settings.Default.VerboseErrors) + { + MessageBox.Show(this, ex.ToString(), Translations.Strings.VerboseErrorOutput, MessageBoxButton.OK, MessageBoxImage.Error); + } + + return; + } + videoList.Clear(); if (res.data.user != null) { @@ -125,7 +140,22 @@ private async Task UpdateList() { currentCursor = cursorList[cursorIndex]; } - GqlClipSearchResponse res = await TwitchHelper.GetGqlClips(currentChannel, period, currentCursor, videoCount); + + GqlClipSearchResponse res; + try + { + res = await TwitchHelper.GetGqlClips(currentChannel, period, currentCursor, videoCount); + } + catch (Exception ex) + { + if (Settings.Default.VerboseErrors) + { + MessageBox.Show(this, ex.ToString(), Translations.Strings.VerboseErrorOutput, MessageBoxButton.OK, MessageBoxImage.Error); + } + + return; + } + videoList.Clear(); if (res.data.user != null) { From 452955e8032fa42cec75c1692b8e2ab549268e9b Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:57:09 -0400 Subject: [PATCH 2/3] Do not fail silently when verbose errors are disabled --- TwitchDownloaderWPF/WindowMassDownload.xaml.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TwitchDownloaderWPF/WindowMassDownload.xaml.cs b/TwitchDownloaderWPF/WindowMassDownload.xaml.cs index 5363c2f7..1bda5170 100644 --- a/TwitchDownloaderWPF/WindowMassDownload.xaml.cs +++ b/TwitchDownloaderWPF/WindowMassDownload.xaml.cs @@ -91,6 +91,8 @@ private async Task UpdateList() } catch (Exception ex) { + MessageBox.Show(this, ex.Message, Translations.Strings.UnknownErrorOccurred, MessageBoxButton.OK, MessageBoxImage.Error); + if (Settings.Default.VerboseErrors) { MessageBox.Show(this, ex.ToString(), Translations.Strings.VerboseErrorOutput, MessageBoxButton.OK, MessageBoxImage.Error); @@ -148,6 +150,8 @@ private async Task UpdateList() } catch (Exception ex) { + MessageBox.Show(this, ex.Message, Translations.Strings.UnknownErrorOccurred, MessageBoxButton.OK, MessageBoxImage.Error); + if (Settings.Default.VerboseErrors) { MessageBox.Show(this, ex.ToString(), Translations.Strings.VerboseErrorOutput, MessageBoxButton.OK, MessageBoxImage.Error); From fc3a6333f902a06307fa3e6ba177f70bba62838e Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:47:54 -0400 Subject: [PATCH 3/3] Add custom translations --- .../Translations/Strings.Designer.cs | 37 ++++++++++++++++++- .../Translations/Strings.es.resx | 12 ++++++ .../Translations/Strings.fr.resx | 12 ++++++ .../Translations/Strings.it.resx | 12 ++++++ .../Translations/Strings.ja.resx | 12 ++++++ .../Translations/Strings.pl.resx | 12 ++++++ .../Translations/Strings.pt-br.resx | 12 ++++++ TwitchDownloaderWPF/Translations/Strings.resx | 12 ++++++ .../Translations/Strings.ru.resx | 12 ++++++ .../Translations/Strings.tr.resx | 12 ++++++ .../Translations/Strings.uk.resx | 12 ++++++ .../Translations/Strings.zh-cn.resx | 12 ++++++ .../WindowMassDownload.xaml.cs | 4 +- 13 files changed, 170 insertions(+), 3 deletions(-) diff --git a/TwitchDownloaderWPF/Translations/Strings.Designer.cs b/TwitchDownloaderWPF/Translations/Strings.Designer.cs index cecdf3ed..636cddb2 100644 --- a/TwitchDownloaderWPF/Translations/Strings.Designer.cs +++ b/TwitchDownloaderWPF/Translations/Strings.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -2166,6 +2165,42 @@ public static string UnableToFindThumbnail { } } + /// + /// Looks up a localized string similar to Unable to Get Clips. + /// + public static string UnableToGetChannelClips { + get { + return ResourceManager.GetString("UnableToGetChannelClips", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to get channel clips: {0}. + /// + public static string UnableToGetChannelClipsMessage { + get { + return ResourceManager.GetString("UnableToGetChannelClipsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to Get Videos. + /// + public static string UnableToGetChannelVideos { + get { + return ResourceManager.GetString("UnableToGetChannelVideos", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to get channel videos: {0}. + /// + public static string UnableToGetChannelVideosMessage { + get { + return ResourceManager.GetString("UnableToGetChannelVideosMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unable to get Clip information. Please double check Clip ID and try again.. /// diff --git a/TwitchDownloaderWPF/Translations/Strings.es.resx b/TwitchDownloaderWPF/Translations/Strings.es.resx index ce8de5be..b3fa70f2 100644 --- a/TwitchDownloaderWPF/Translations/Strings.es.resx +++ b/TwitchDownloaderWPF/Translations/Strings.es.resx @@ -937,4 +937,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + diff --git a/TwitchDownloaderWPF/Translations/Strings.fr.resx b/TwitchDownloaderWPF/Translations/Strings.fr.resx index f93bcc99..756abdc0 100644 --- a/TwitchDownloaderWPF/Translations/Strings.fr.resx +++ b/TwitchDownloaderWPF/Translations/Strings.fr.resx @@ -936,4 +936,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.it.resx b/TwitchDownloaderWPF/Translations/Strings.it.resx index 93c5091c..6895f1ff 100644 --- a/TwitchDownloaderWPF/Translations/Strings.it.resx +++ b/TwitchDownloaderWPF/Translations/Strings.it.resx @@ -937,4 +937,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + diff --git a/TwitchDownloaderWPF/Translations/Strings.ja.resx b/TwitchDownloaderWPF/Translations/Strings.ja.resx index e9bfd324..56df0a40 100644 --- a/TwitchDownloaderWPF/Translations/Strings.ja.resx +++ b/TwitchDownloaderWPF/Translations/Strings.ja.resx @@ -935,4 +935,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.pl.resx b/TwitchDownloaderWPF/Translations/Strings.pl.resx index 8dfb475b..4de9dfa3 100644 --- a/TwitchDownloaderWPF/Translations/Strings.pl.resx +++ b/TwitchDownloaderWPF/Translations/Strings.pl.resx @@ -936,4 +936,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.pt-br.resx b/TwitchDownloaderWPF/Translations/Strings.pt-br.resx index 21fe7c01..e13a9000 100644 --- a/TwitchDownloaderWPF/Translations/Strings.pt-br.resx +++ b/TwitchDownloaderWPF/Translations/Strings.pt-br.resx @@ -935,4 +935,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.resx b/TwitchDownloaderWPF/Translations/Strings.resx index ba03b2dd..765e5982 100644 --- a/TwitchDownloaderWPF/Translations/Strings.resx +++ b/TwitchDownloaderWPF/Translations/Strings.resx @@ -935,4 +935,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.ru.resx b/TwitchDownloaderWPF/Translations/Strings.ru.resx index 5dad8ca0..d5e04d12 100644 --- a/TwitchDownloaderWPF/Translations/Strings.ru.resx +++ b/TwitchDownloaderWPF/Translations/Strings.ru.resx @@ -936,4 +936,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.tr.resx b/TwitchDownloaderWPF/Translations/Strings.tr.resx index 3a2bd085..9bdb7792 100644 --- a/TwitchDownloaderWPF/Translations/Strings.tr.resx +++ b/TwitchDownloaderWPF/Translations/Strings.tr.resx @@ -937,4 +937,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.uk.resx b/TwitchDownloaderWPF/Translations/Strings.uk.resx index 748bd419..e9572367 100644 --- a/TwitchDownloaderWPF/Translations/Strings.uk.resx +++ b/TwitchDownloaderWPF/Translations/Strings.uk.resx @@ -936,4 +936,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + diff --git a/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx b/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx index 6cafa7b8..5d6530d1 100644 --- a/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx +++ b/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx @@ -938,4 +938,16 @@ Retry + + Unable to Get Videos + + + Unable to get channel videos: {0} + + + Unable to Get Clips + + + Unable to get channel clips: {0} + diff --git a/TwitchDownloaderWPF/WindowMassDownload.xaml.cs b/TwitchDownloaderWPF/WindowMassDownload.xaml.cs index 1bda5170..18cf974a 100644 --- a/TwitchDownloaderWPF/WindowMassDownload.xaml.cs +++ b/TwitchDownloaderWPF/WindowMassDownload.xaml.cs @@ -91,7 +91,7 @@ private async Task UpdateList() } catch (Exception ex) { - MessageBox.Show(this, ex.Message, Translations.Strings.UnknownErrorOccurred, MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show(this, string.Format(Translations.Strings.UnableToGetChannelVideosMessage, ex.Message), Translations.Strings.UnableToGetChannelVideos, MessageBoxButton.OK, MessageBoxImage.Error); if (Settings.Default.VerboseErrors) { @@ -150,7 +150,7 @@ private async Task UpdateList() } catch (Exception ex) { - MessageBox.Show(this, ex.Message, Translations.Strings.UnknownErrorOccurred, MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show(this, string.Format(Translations.Strings.UnableToGetChannelClipsMessage, ex.Message), Translations.Strings.UnableToGetChannelClips, MessageBoxButton.OK, MessageBoxImage.Error); if (Settings.Default.VerboseErrors) {