mirror of
https://github.com/Jackett/Jackett
synced 2025-02-07 23:32:37 +00:00
Strip parenthesis from show titles - fix for morethantv
This commit is contained in:
parent
b68e4c0553
commit
010135da85
1 changed files with 11 additions and 5 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue