From fbd16274a6f92f639f2a34b41e04e94b6324ec7a Mon Sep 17 00:00:00 2001 From: Elwador <75888166+Elwador@users.noreply.github.com> Date: Wed, 22 May 2024 16:10:29 +0200 Subject: [PATCH] Fix - No drm streams Fix - History missing episodes not counted correctly --- CRD/Downloader/Crunchyroll.cs | 1 + CRD/Downloader/History.cs | 14 ++++++- CRD/Utils/Structs/CrDownloadOptions.cs | 52 +++++++++++++------------- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/CRD/Downloader/Crunchyroll.cs b/CRD/Downloader/Crunchyroll.cs index bf6aa1b..fd0c531 100644 --- a/CRD/Downloader/Crunchyroll.cs +++ b/CRD/Downloader/Crunchyroll.cs @@ -1397,6 +1397,7 @@ public class Crunchyroll{ private async Task FetchNoDrmPlaybackData(string currentMediaId, PlaybackData pbData){ var playbackRequestNonDrm = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{currentMediaId}/console/switch/play", HttpMethod.Get, true, true, null); + playbackRequestNonDrm.Headers.UserAgent.ParseAdd("Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27"); var playbackRequestNonDrmResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequestNonDrm); diff --git a/CRD/Downloader/History.cs b/CRD/Downloader/History.cs index 96eec47..fbf91a3 100644 --- a/CRD/Downloader/History.cs +++ b/CRD/Downloader/History.cs @@ -353,7 +353,12 @@ public class HistorySeries : INotifyPropertyChanged{ // Iterate over the Episodes from the end to the beginning for (int j = Seasons[i].EpisodesList.Count - 1; j >= 0 && !foundWatched; j--){ - if (!Seasons[i].EpisodesList[j].WasDownloaded && !Seasons[i].EpisodesList[j].SpecialEpisode){ + + if (Seasons[i].EpisodesList[j].SpecialEpisode){ + continue; + } + + if (!Seasons[i].EpisodesList[j].WasDownloaded){ count++; } else{ foundWatched = true; @@ -376,7 +381,12 @@ public class HistorySeries : INotifyPropertyChanged{ // Iterate over the Episodes from the end to the beginning for (int j = Seasons[i].EpisodesList.Count - 1; j >= 0 && !foundWatched; j--){ - if (!Seasons[i].EpisodesList[j].WasDownloaded && !Seasons[i].EpisodesList[j].SpecialEpisode){ + + if (Seasons[i].EpisodesList[j].SpecialEpisode){ + continue; + } + + if (!Seasons[i].EpisodesList[j].WasDownloaded){ //ADD to download queue await Seasons[i].EpisodesList[j].DownloadEpisode(); } else{ diff --git a/CRD/Utils/Structs/CrDownloadOptions.cs b/CRD/Utils/Structs/CrDownloadOptions.cs index 7836b3d..f00fbe5 100644 --- a/CRD/Utils/Structs/CrDownloadOptions.cs +++ b/CRD/Utils/Structs/CrDownloadOptions.cs @@ -5,34 +5,34 @@ namespace CRD.Utils.Structs; public class CrDownloadOptions{ [YamlMember(Alias = "hard_sub_lang", ApplyNamingConventions = false)] - public string Hslang{ get; set; } + public string Hslang{ get; set; } [YamlIgnore] public int Kstream{ get; set; } [YamlMember(Alias = "no_video", ApplyNamingConventions = false)] - public bool Novids{ get; set; } + public bool Novids{ get; set; } [YamlMember(Alias = "no_audio", ApplyNamingConventions = false)] - public bool Noaudio{ get; set; } + public bool Noaudio{ get; set; } [YamlIgnore] - public int StreamServer{ get; set; } + public int StreamServer{ get; set; } [YamlMember(Alias = "quality_video", ApplyNamingConventions = false)] - public string QualityVideo{ get; set; } + public string QualityVideo{ get; set; } [YamlMember(Alias = "quality_audio", ApplyNamingConventions = false)] - public string QualityAudio{ get; set; } + public string QualityAudio{ get; set; } [YamlMember(Alias = "file_name", ApplyNamingConventions = false)] - public string FileName{ get; set; } + public string FileName{ get; set; } [YamlMember(Alias = "leading_numbers", ApplyNamingConventions = false)] - public int Numbers{ get; set; } + public int Numbers{ get; set; } [YamlIgnore] - public int Partsize{ get; set; } + public int Partsize{ get; set; } [YamlIgnore] public int Timeout{ get; set; } @@ -44,58 +44,58 @@ public class CrDownloadOptions{ public int FsRetryTime{ get; set; } [YamlMember(Alias = "soft_subs", ApplyNamingConventions = false)] - public List DlSubs{ get; set; } + public List DlSubs{ get; set; } [YamlIgnore] - public bool SkipSubs{ get; set; } + public bool SkipSubs{ get; set; } [YamlIgnore] - public bool NoSubs{ get; set; } + public bool NoSubs{ get; set; } [YamlMember(Alias = "mux_mp4", ApplyNamingConventions = false)] - public bool Mp4{ get; set; } + public bool Mp4{ get; set; } [YamlIgnore] public List Override{ get; set; } [YamlIgnore] - public string VideoTitle{ get; set; } + public string VideoTitle{ get; set; } [YamlIgnore] - public string Force{ get; set; } + public string Force{ get; set; } [YamlMember(Alias = "mux_ffmpeg", ApplyNamingConventions = false)] - public List FfmpegOptions{ get; set; } + public List FfmpegOptions{ get; set; } [YamlMember(Alias = "mux_mkvmerge", ApplyNamingConventions = false)] - public List MkvmergeOptions{ get; set; } + public List MkvmergeOptions{ get; set; } [YamlIgnore] - public LanguageItem DefaultSub{ get; set; } + public LanguageItem DefaultSub{ get; set; } [YamlIgnore] - public LanguageItem DefaultAudio{ get; set; } + public LanguageItem DefaultAudio{ get; set; } [YamlIgnore] - public string CcTag{ get; set; } + public string CcTag{ get; set; } [YamlIgnore] - public bool DlVideoOnce{ get; set; } + public bool DlVideoOnce{ get; set; } [YamlIgnore] - public bool? Skipmux{ get; set; } + public bool? Skipmux{ get; set; } [YamlIgnore] - public bool SyncTiming{ get; set; } + public bool SyncTiming{ get; set; } [YamlIgnore] - public bool Nocleanup{ get; set; } + public bool Nocleanup{ get; set; } [YamlMember(Alias = "chapters", ApplyNamingConventions = false)] - public bool Chapters{ get; set; } + public bool Chapters{ get; set; } [YamlMember(Alias = "dub_lang", ApplyNamingConventions = false)] - public List DubLang{ get; set; } + public List DubLang{ get; set; } [YamlMember(Alias = "simultaneous_downloads", ApplyNamingConventions = false)] public int SimultaneousDownloads{ get; set; }