From 0dc7644e15e5108c5ebd88f36ce1ec41a95ce881 Mon Sep 17 00:00:00 2001 From: Elwador <75888166+Elwador@users.noreply.github.com> Date: Wed, 29 May 2024 17:01:21 +0200 Subject: [PATCH] Chg - Improved sonarr matching Fix - DRM url --- CRD/Downloader/Crunchyroll.cs | 4 +++- CRD/Downloader/History.cs | 2 +- CRD/Utils/Http/HttpClientReq.cs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CRD/Downloader/Crunchyroll.cs b/CRD/Downloader/Crunchyroll.cs index 3e9fdd7..10ccb7d 100644 --- a/CRD/Downloader/Crunchyroll.cs +++ b/CRD/Downloader/Crunchyroll.cs @@ -963,13 +963,14 @@ public class Crunchyroll{ var json = JsonConvert.SerializeObject(reqBodyData); var reqBody = new StringContent(json, Encoding.UTF8, "application/json"); - var decRequest = HttpClientReq.CreateRequestMessage("https://pl.crunchyroll.com/drm/v1/auth", HttpMethod.Post, false, false, null); + var decRequest = HttpClientReq.CreateRequestMessage($"{Api.DRM}", HttpMethod.Post, false, false, null); decRequest.Content = reqBody; var decRequestResponse = await HttpClientReq.Instance.SendHttpRequest(decRequest); if (!decRequestResponse.IsOk){ Console.WriteLine("Request to DRM Authentication failed: "); + MainWindow.Instance.ShowError("Request to DRM Authentication failed"); return new DownloadResponse{ Data = files, Error = dlFailed, @@ -1007,6 +1008,7 @@ public class Crunchyroll{ if (!decryptVideo.IsOk){ Console.Error.WriteLine($"Decryption failed with exit code {decryptVideo.ErrorCode}"); + MainWindow.Instance.ShowError($"Decryption failed with exit code {decryptVideo.ErrorCode}"); try{ File.Move($"{tempTsFile}.video.enc.m4s", $"{tsFile}.video.enc.m4s"); } catch (IOException ex){ diff --git a/CRD/Downloader/History.cs b/CRD/Downloader/History.cs index e7d251b..8bad1f6 100644 --- a/CRD/Downloader/History.cs +++ b/CRD/Downloader/History.cs @@ -408,7 +408,7 @@ public class History(){ double highestSimilarity = 0.0; Parallel.ForEach(crunInstance.SonarrSeries, series => { - double similarity = CalculateSimilarity(series.Title, title); + double similarity = CalculateSimilarity(series.Title.ToLower(), title.ToLower()); if (similarity > highestSimilarity){ highestSimilarity = similarity; closestMatch = series; diff --git a/CRD/Utils/Http/HttpClientReq.cs b/CRD/Utils/Http/HttpClientReq.cs index bf1b4d5..6eb46cd 100644 --- a/CRD/Utils/Http/HttpClientReq.cs +++ b/CRD/Utils/Http/HttpClientReq.cs @@ -136,6 +136,7 @@ public static class Api{ public static readonly string Cms = ApiBeta + "/content/v2/cms"; public static readonly string BetaBrowse = ApiBeta + "/content/v1/browse"; public static readonly string BetaCms = ApiBeta + "/cms/v2"; + public static readonly string DRM = ApiBeta + "/drm/v1/auth"; public static readonly string CmsN = ApiN + "/content/v2/cms";