New: Support import list lookup by TMDb ID

This commit is contained in:
Mark McDowall 2023-11-16 16:34:44 -08:00
parent 71fd09f162
commit c028222617
4 changed files with 28 additions and 2 deletions

View File

@ -90,7 +90,7 @@ namespace NzbDrone.Core.ImportLists
var importList = importLists.Single(x => x.Id == item.ImportListId); var importList = importLists.Single(x => x.Id == item.ImportListId);
// Map by IMDbId if we have it // Map by IMDb ID if we have it
if (item.TvdbId <= 0 && item.ImdbId.IsNotNullOrWhiteSpace()) if (item.TvdbId <= 0 && item.ImdbId.IsNotNullOrWhiteSpace())
{ {
var mappedSeries = _seriesSearchService.SearchForNewSeriesByImdbId(item.ImdbId) var mappedSeries = _seriesSearchService.SearchForNewSeriesByImdbId(item.ImdbId)
@ -103,7 +103,20 @@ namespace NzbDrone.Core.ImportLists
} }
} }
// Map by AniListId if we have it // Map by TMDb ID if we have it
if (item.TvdbId <= 0 && item.TmdbId > 0)
{
var mappedSeries = _seriesSearchService.SearchForNewSeriesByTmdbId(item.TmdbId)
.FirstOrDefault();
if (mappedSeries != null)
{
item.TvdbId = mappedSeries.TvdbId;
item.Title = mappedSeries?.Title;
}
}
// Map by AniList ID if we have it
if (item.TvdbId <= 0 && item.AniListId > 0) if (item.TvdbId <= 0 && item.AniListId > 0)
{ {
var mappedSeries = _seriesSearchService.SearchForNewSeriesByAniListId(item.AniListId) var mappedSeries = _seriesSearchService.SearchForNewSeriesByAniListId(item.AniListId)

View File

@ -44,6 +44,11 @@ namespace NzbDrone.Core.ImportLists.Rss.Plex
{ {
info.TvdbId = tvdbId; info.TvdbId = tvdbId;
} }
if (int.TryParse(guid.Replace("tmdb://", ""), out var tmdbId))
{
info.TmdbId = tvdbId;
}
} }
if (info.ImdbId.IsNullOrWhiteSpace() && info.TvdbId == 0) if (info.ImdbId.IsNullOrWhiteSpace() && info.TvdbId == 0)

View File

@ -8,5 +8,6 @@ namespace NzbDrone.Core.MetadataSource
List<Series> SearchForNewSeries(string title); List<Series> SearchForNewSeries(string title);
List<Series> SearchForNewSeriesByImdbId(string imdbId); List<Series> SearchForNewSeriesByImdbId(string imdbId);
List<Series> SearchForNewSeriesByAniListId(int aniListId); List<Series> SearchForNewSeriesByAniListId(int aniListId);
List<Series> SearchForNewSeriesByTmdbId(int tmdbId);
} }
} }

View File

@ -90,6 +90,13 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
return results; return results;
} }
public List<Series> SearchForNewSeriesByTmdbId(int tmdbId)
{
var results = SearchForNewSeries($"tmdb:{tmdbId}");
return results;
}
public List<Series> SearchForNewSeries(string title) public List<Series> SearchForNewSeries(string title)
{ {
try try