Update SkyHookProxy.cs to add OriginalTitle to AlternativeTitles

The OriginalTitle property is not being used by Radarr, which limits its search results. It only uses "Title" and "AlternativeTitles", when usually in the case of non-english movies, the OriginalTitle is the one likely to get the most search results. So with this modification, OriginalTitle will also be appended the the AlternativeTitles list.
This commit is contained in:
rmichelena 2024-02-21 00:31:19 -05:00 committed by GitHub
parent 145cd74969
commit 9df3f1f976
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 0 deletions

View File

@ -236,6 +236,21 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
movie.CleanOriginalTitle = resource.OriginalTitle.CleanMovieTitle();
movie.Overview = resource.Overview;
// Modification starts here
// Check if OriginalTitle is different from Title and not already in AlternativeTitles
if (!string.IsNullOrWhiteSpace(movie.OriginalTitle) && movie.OriginalTitle != movie.Title &&
!resource.AlternativeTitles.Any(alt => alt.Title == movie.OriginalTitle))
{
var originalTitleAlt = new AlternativeTitle
{
Title = movie.OriginalTitle,
SourceType = SourceType.TMDB, // Assuming the source is TMDB, adjust if necessary
CleanTitle = movie.OriginalTitle.CleanMovieTitle() // Clean the title if required
};
movie.AlternativeTitles.Add(originalTitleAlt);
}
// Modification ends here
movie.AlternativeTitles.AddRange(resource.AlternativeTitles.Select(MapAlternativeTitle));
movie.Translations.AddRange(resource.Translations.Select(MapTranslation));