mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-14 14:16:35 +00:00
Merge pull request #11647 from Shadowghost/fix-season-names
Fix season names
This commit is contained in:
@@ -25,19 +25,18 @@ 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>();
|
||||
_seasonNames = new Dictionary<int, string>();
|
||||
}
|
||||
|
||||
public DayOfWeek[] AirDays { get; set; }
|
||||
|
||||
public string AirTime { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public Dictionary<int, string> SeasonNames { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public override bool SupportsAddingToPlaylist => true;
|
||||
|
||||
@@ -213,6 +212,26 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user