mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
Treat XEM aliases as SceneSeasonNumber
Fixed: Aliases used incorrectly when TVDB season number matched the seaon number of the alias Closes #1140
This commit is contained in:
@@ -14,10 +14,11 @@ namespace NzbDrone.Core.DataAugmentation.Scene
|
||||
{
|
||||
public interface ISceneMappingService
|
||||
{
|
||||
List<string> GetSceneNames(int tvdbId, IEnumerable<int> seasonNumbers);
|
||||
List<string> GetSceneNamesBySeasonNumbers(int tvdbId, IEnumerable<int> seasonNumbers);
|
||||
List<string> GetSceneNamesBySceneSeasonNumbers(int tvdbId, IEnumerable<int> sceneSeasonNumbers);
|
||||
int? FindTvdbId(string title);
|
||||
List<SceneMapping> FindByTvdbId(int tvdbId);
|
||||
int? GetSeasonNumber(string title);
|
||||
int? GetSceneSeasonNumber(string title);
|
||||
}
|
||||
|
||||
public class SceneMappingService : ISceneMappingService,
|
||||
@@ -46,7 +47,7 @@ namespace NzbDrone.Core.DataAugmentation.Scene
|
||||
_findByTvdbIdCache = cacheManager.GetCacheDictionary<List<SceneMapping>>(GetType(), "find_tvdb_id");
|
||||
}
|
||||
|
||||
public List<string> GetSceneNames(int tvdbId, IEnumerable<int> seasonNumbers)
|
||||
public List<string> GetSceneNamesBySeasonNumbers(int tvdbId, IEnumerable<int> seasonNumbers)
|
||||
{
|
||||
var names = _findByTvdbIdCache.Find(tvdbId.ToString());
|
||||
|
||||
@@ -55,11 +56,25 @@ namespace NzbDrone.Core.DataAugmentation.Scene
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return FilterNonEnglish(names.Where(s => seasonNumbers.Contains(s.SeasonNumber) ||
|
||||
return FilterNonEnglish(names.Where(s => s.SeasonNumber.HasValue && seasonNumbers.Contains(s.SeasonNumber.Value) ||
|
||||
s.SeasonNumber == -1)
|
||||
.Select(m => m.SearchTerm).Distinct().ToList());
|
||||
}
|
||||
|
||||
public List<string> GetSceneNamesBySceneSeasonNumbers(int tvdbId, IEnumerable<int> sceneSeasonNumbers)
|
||||
{
|
||||
var names = _findByTvdbIdCache.Find(tvdbId.ToString());
|
||||
|
||||
if (names == null)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return FilterNonEnglish(names.Where(s => s.SceneSeasonNumber.HasValue && sceneSeasonNumbers.Contains(s.SceneSeasonNumber.Value) ||
|
||||
s.SceneSeasonNumber == -1)
|
||||
.Select(m => m.SearchTerm).Distinct().ToList());
|
||||
}
|
||||
|
||||
public int? FindTvdbId(string title)
|
||||
{
|
||||
var mapping = FindMapping(title);
|
||||
@@ -87,14 +102,16 @@ namespace NzbDrone.Core.DataAugmentation.Scene
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public int? GetSeasonNumber(string title)
|
||||
public int? GetSceneSeasonNumber(string title)
|
||||
{
|
||||
var mapping = FindMapping(title);
|
||||
|
||||
if (mapping == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return mapping.SeasonNumber;
|
||||
return mapping.SceneSeasonNumber;
|
||||
}
|
||||
|
||||
private void UpdateMappings()
|
||||
|
||||
Reference in New Issue
Block a user