Chg - Improved sonarr matching

Fix - DRM url
This commit is contained in:
Elwador 2024-05-29 17:01:21 +02:00
parent 1125a55ab5
commit 0dc7644e15
3 changed files with 5 additions and 2 deletions

View File

@ -963,13 +963,14 @@ public class Crunchyroll{
var json = JsonConvert.SerializeObject(reqBodyData); var json = JsonConvert.SerializeObject(reqBodyData);
var reqBody = new StringContent(json, Encoding.UTF8, "application/json"); 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; decRequest.Content = reqBody;
var decRequestResponse = await HttpClientReq.Instance.SendHttpRequest(decRequest); var decRequestResponse = await HttpClientReq.Instance.SendHttpRequest(decRequest);
if (!decRequestResponse.IsOk){ if (!decRequestResponse.IsOk){
Console.WriteLine("Request to DRM Authentication failed: "); Console.WriteLine("Request to DRM Authentication failed: ");
MainWindow.Instance.ShowError("Request to DRM Authentication failed");
return new DownloadResponse{ return new DownloadResponse{
Data = files, Data = files,
Error = dlFailed, Error = dlFailed,
@ -1007,6 +1008,7 @@ public class Crunchyroll{
if (!decryptVideo.IsOk){ if (!decryptVideo.IsOk){
Console.Error.WriteLine($"Decryption failed with exit code {decryptVideo.ErrorCode}"); Console.Error.WriteLine($"Decryption failed with exit code {decryptVideo.ErrorCode}");
MainWindow.Instance.ShowError($"Decryption failed with exit code {decryptVideo.ErrorCode}");
try{ try{
File.Move($"{tempTsFile}.video.enc.m4s", $"{tsFile}.video.enc.m4s"); File.Move($"{tempTsFile}.video.enc.m4s", $"{tsFile}.video.enc.m4s");
} catch (IOException ex){ } catch (IOException ex){

View File

@ -408,7 +408,7 @@ public class History(){
double highestSimilarity = 0.0; double highestSimilarity = 0.0;
Parallel.ForEach(crunInstance.SonarrSeries, series => { Parallel.ForEach(crunInstance.SonarrSeries, series => {
double similarity = CalculateSimilarity(series.Title, title); double similarity = CalculateSimilarity(series.Title.ToLower(), title.ToLower());
if (similarity > highestSimilarity){ if (similarity > highestSimilarity){
highestSimilarity = similarity; highestSimilarity = similarity;
closestMatch = series; closestMatch = series;

View File

@ -136,6 +136,7 @@ public static class Api{
public static readonly string Cms = ApiBeta + "/content/v2/cms"; public static readonly string Cms = ApiBeta + "/content/v2/cms";
public static readonly string BetaBrowse = ApiBeta + "/content/v1/browse"; public static readonly string BetaBrowse = ApiBeta + "/content/v1/browse";
public static readonly string BetaCms = ApiBeta + "/cms/v2"; 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"; public static readonly string CmsN = ApiN + "/content/v2/cms";