Merge pull request #11719 from Shadowghost/fix-season-names

Move NFO series season name parsing to own local provider
This commit is contained in:
Joshua M. Boniface
2024-06-01 18:31:55 -04:00
committed by GitHub
8 changed files with 176 additions and 91 deletions

View File

@@ -25,12 +25,9 @@ namespace MediaBrowser.Controller.Entities.TV
/// </summary>
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer
{
private readonly Dictionary<int, string> _seasonNames;
public Series()
{
AirDays = Array.Empty<DayOfWeek>();
_seasonNames = new Dictionary<int, string>();
}
public DayOfWeek[] AirDays { get; set; }
@@ -212,26 +209,6 @@ namespace MediaBrowser.Controller.Entities.TV
return LibraryManager.GetItemList(query);
}
public Dictionary<int, string> GetSeasonNames()
{
var newSeasons = Children.OfType<Season>()
.Where(s => s.IndexNumber.HasValue)
.Where(s => !_seasonNames.ContainsKey(s.IndexNumber.Value))
.DistinctBy(s => s.IndexNumber);
foreach (var season in newSeasons)
{
SetSeasonName(season.IndexNumber.Value, season.Name);
}
return _seasonNames;
}
public void SetSeasonName(int index, string name)
{
_seasonNames[index] = name;
}
private void SetSeasonQueryOptions(InternalItemsQuery query, User user)
{
var seriesKey = GetUniqueSeriesKey(this);

View File

@@ -11,6 +11,8 @@ namespace MediaBrowser.Controller.Providers
public ItemInfo(BaseItem item)
{
Path = item.Path;
ParentId = item.ParentId;
IndexNumber = item.IndexNumber;
ContainingFolderPath = item.ContainingFolderPath;
IsInMixedFolder = item.IsInMixedFolder;
@@ -27,6 +29,10 @@ namespace MediaBrowser.Controller.Providers
public string Path { get; set; }
public Guid ParentId { get; set; }
public int? IndexNumber { get; set; }
public string ContainingFolderPath { get; set; }
public VideoType VideoType { get; set; }