mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Strip parenthesis from show titles - fix for morethantv
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -45,7 +46,7 @@ namespace Jackett
|
|||||||
HttpClientHandler handler;
|
HttpClientHandler handler;
|
||||||
HttpClient client;
|
HttpClient client;
|
||||||
|
|
||||||
Dictionary<int, string[]> IdNameMappings;
|
ConcurrentDictionary<int, string[]> IdNameMappings;
|
||||||
|
|
||||||
public SonarrApi()
|
public SonarrApi()
|
||||||
{
|
{
|
||||||
@@ -60,7 +61,7 @@ namespace Jackett
|
|||||||
};
|
};
|
||||||
client = new HttpClient(handler);
|
client = new HttpClient(handler);
|
||||||
|
|
||||||
IdNameMappings = new Dictionary<int, string[]>();
|
IdNameMappings = new ConcurrentDictionary<int, string[]>();
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task ReloadNameMappings(string host, int port, string apiKey)
|
async Task ReloadNameMappings(string host, int port, string apiKey)
|
||||||
@@ -74,15 +75,20 @@ namespace Jackett
|
|||||||
foreach (var item in json)
|
foreach (var item in json)
|
||||||
{
|
{
|
||||||
var titles = new List<string>();
|
var titles = new List<string>();
|
||||||
titles.Add((string)item["title"]);
|
titles.Add(SanitizeTitle((string)item["title"]));
|
||||||
foreach (var t in item["alternateTitles"])
|
foreach (var t in item["alternateTitles"])
|
||||||
{
|
{
|
||||||
titles.Add((string)t["title"]);
|
titles.Add(SanitizeTitle((string)t["title"]));
|
||||||
}
|
}
|
||||||
IdNameMappings.Add((int)item["tvRageId"], titles.ToArray());
|
IdNameMappings.TryAdd((int)item["tvRageId"], titles.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string SanitizeTitle(string title)
|
||||||
|
{
|
||||||
|
return title.Replace("(", "").Replace(")", "");
|
||||||
|
}
|
||||||
|
|
||||||
void LoadSettings()
|
void LoadSettings()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Reference in New Issue
Block a user