mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-17 23:56:44 +00:00
Backport pull request #11647 from jellyfin/release-10.9.z
Fix season names
Original-merge: 2da06bc0b1
Merged-by: joshuaboniface <joshua@boniface.me>
Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
committed by
Joshua M. Boniface
parent
77c3ddc7ca
commit
29a293f9e7
@@ -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