Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6932c4b2f8 | ||
|
|
ff051569ca | ||
|
|
dbac09bf36 | ||
|
|
0bde5d5d24 | ||
|
|
99af842fc6 | ||
|
|
fbfbeadb3e |
@@ -87,6 +87,12 @@ Sonarr erwartet immer den Englischen Namen, der hier natürlich nicht gegeben is
|
|||||||
- [Telegram](https://t.me/pc_jones)
|
- [Telegram](https://t.me/pc_jones)
|
||||||
- Discord: pcjones1 - oder komm in den UsenetDE Discord Server: [https://discord.gg/pZrrMcJMQM](https://discord.gg/pZrrMcJMQM)
|
- Discord: pcjones1 - oder komm in den UsenetDE Discord Server: [https://discord.gg/pZrrMcJMQM](https://discord.gg/pZrrMcJMQM)
|
||||||
|
|
||||||
|
## Spenden
|
||||||
|
Über eine Spende freue ich mich natürlich immer :D
|
||||||
|
PayPal: https://paypal.me/pcjones1
|
||||||
|
|
||||||
|
Für andere Spendenmöglichkeiten gerne auf Discord oder Telegram melden - danke!
|
||||||
|
|
||||||
### Licenses & Metadata source
|
### Licenses & Metadata source
|
||||||
- TV Metadata source: https://thetvdb.com
|
- TV Metadata source: https://thetvdb.com
|
||||||
- Movie Metadata source: https://themoviedb.org
|
- Movie Metadata source: https://themoviedb.org
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ namespace UmlautAdaptarr.Controllers
|
|||||||
{
|
{
|
||||||
public abstract class SearchControllerBase(ProxyService proxyService, TitleMatchingService titleMatchingService) : ControllerBase
|
public abstract class SearchControllerBase(ProxyService proxyService, TitleMatchingService titleMatchingService) : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly bool TODO_FORCE_TEXT_SEARCH_ORIGINAL_TITLE = false;
|
// TODO evaluate if this should be set to true by default
|
||||||
|
private readonly bool TODO_FORCE_TEXT_SEARCH_ORIGINAL_TITLE = true;
|
||||||
private readonly bool TODO_FORCE_TEXT_SEARCH_GERMAN_TITLE = false;
|
private readonly bool TODO_FORCE_TEXT_SEARCH_GERMAN_TITLE = false;
|
||||||
protected async Task<IActionResult> BaseSearch(string options,
|
protected async Task<IActionResult> BaseSearch(string options,
|
||||||
string domain,
|
string domain,
|
||||||
@@ -52,7 +53,7 @@ namespace UmlautAdaptarr.Controllers
|
|||||||
|
|
||||||
var titleSearchVariations = new List<string>(searchItem?.TitleSearchVariations);
|
var titleSearchVariations = new List<string>(searchItem?.TitleSearchVariations);
|
||||||
|
|
||||||
string searchQuery = string.Empty;
|
var searchQuery = string.Empty;
|
||||||
if (queryParameters.TryGetValue("q", out string? q))
|
if (queryParameters.TryGetValue("q", out string? q))
|
||||||
{
|
{
|
||||||
searchQuery = q ?? string.Empty;
|
searchQuery = q ?? string.Empty;
|
||||||
|
|||||||
@@ -43,7 +43,30 @@ namespace UmlautAdaptarr.Models
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GenerateVariationsForTV(germanTitle, mediaType, aliases);
|
// if mediatype is movie/tv and the Expected Title ends with a year but the german title doesn't then append the year to the german title and to aliases
|
||||||
|
// example: https://thetvdb.com/series/385925-avatar-the-last-airbender -> german Title is without 2024
|
||||||
|
var yearAtEndOfTitleMatch = YearAtEndOfTitleRegex().Match(expectedTitle);
|
||||||
|
if (yearAtEndOfTitleMatch.Success)
|
||||||
|
{
|
||||||
|
string year = yearAtEndOfTitleMatch.Value[1..^1];
|
||||||
|
if (GermanTitle != null && !GermanTitle.Contains(year))
|
||||||
|
{
|
||||||
|
GermanTitle = $"{germanTitle} {year}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aliases != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < aliases.Length; i++)
|
||||||
|
{
|
||||||
|
if (!aliases[i].Contains(year))
|
||||||
|
{
|
||||||
|
aliases[i] = $"{aliases[i]} {year}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GenerateVariationsForTV(GermanTitle, mediaType, aliases);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +83,12 @@ namespace UmlautAdaptarr.Models
|
|||||||
foreach (var alias in aliases)
|
foreach (var alias in aliases)
|
||||||
{
|
{
|
||||||
allTitleVariations.AddRange(GenerateVariations(alias, mediaType));
|
allTitleVariations.AddRange(GenerateVariations(alias, mediaType));
|
||||||
|
|
||||||
|
// If title contains ":" also match for "-"
|
||||||
|
if (alias.Contains(':'))
|
||||||
|
{
|
||||||
|
allTitleVariations.Add(alias.Replace(":", " -"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +108,12 @@ namespace UmlautAdaptarr.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If title contains ":" also match for "-"
|
||||||
|
if (germanTitle?.Contains(':') ?? false)
|
||||||
|
{
|
||||||
|
allTitleVariations.Add(germanTitle.Replace(":", " -"));
|
||||||
|
}
|
||||||
|
|
||||||
TitleMatchVariations = allTitleVariations.Distinct(StringComparer.InvariantCultureIgnoreCase).ToArray();
|
TitleMatchVariations = allTitleVariations.Distinct(StringComparer.InvariantCultureIgnoreCase).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,6 +158,7 @@ namespace UmlautAdaptarr.Models
|
|||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var cleanTitle = title.GetCleanTitle();
|
var cleanTitle = title.GetCleanTitle();
|
||||||
|
|
||||||
if (cleanTitle?.Length == 0)
|
if (cleanTitle?.Length == 0)
|
||||||
@@ -180,5 +216,8 @@ namespace UmlautAdaptarr.Models
|
|||||||
|
|
||||||
return cleanedVariations.Distinct();
|
return cleanedVariations.Distinct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GeneratedRegex(@"\(\d{4}\)$")]
|
||||||
|
private static partial Regex YearAtEndOfTitleRegex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,15 +64,18 @@ namespace UmlautAdaptarr.Services
|
|||||||
var success = true;
|
var success = true;
|
||||||
if (_readarrEnabled)
|
if (_readarrEnabled)
|
||||||
{
|
{
|
||||||
success = success && await FetchItemsFromReadarrAsync();
|
var syncSuccess = await FetchItemsFromReadarrAsync();
|
||||||
|
success = success && syncSuccess;
|
||||||
}
|
}
|
||||||
if (_sonarrEnabled)
|
if (_sonarrEnabled)
|
||||||
{
|
{
|
||||||
success = success && await FetchItemsFromSonarrAsync();
|
var syncSuccess = await FetchItemsFromSonarrAsync();
|
||||||
|
success = success && syncSuccess;
|
||||||
}
|
}
|
||||||
if (_lidarrEnabled)
|
if (_lidarrEnabled)
|
||||||
{
|
{
|
||||||
success = success && await FetchItemsFromLidarrAsync();
|
var syncSuccess = await FetchItemsFromLidarrAsync();
|
||||||
|
success = success && syncSuccess;
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ namespace UmlautAdaptarr.Services
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Construct the new title with the original suffix
|
// Construct the new title with the original suffix
|
||||||
var newTitle = newTitlePrefix + (string.IsNullOrEmpty(suffix) ? "" : separator + suffix);
|
var newTitle = newTitlePrefix + (string.IsNullOrEmpty(suffix) ? "" : suffix.StartsWith(separator) ? suffix : $"{separator}{suffix}");
|
||||||
|
|
||||||
// Update the title element's value with the new title
|
// Update the title element's value with the new title
|
||||||
//titleElement.Value = newTitle + $"({originalTitle.Substring(0, variationLength)})";
|
//titleElement.Value = newTitle + $"({originalTitle.Substring(0, variationLength)})";
|
||||||
|
|||||||
Reference in New Issue
Block a user