mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #3879 from cvium/fix_theme_songs
Populate ThemeVideoIds and ThemeSongIds
This commit is contained in:
commit
5e76d5fd56
@ -60,8 +60,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
protected BaseItem()
|
protected BaseItem()
|
||||||
{
|
{
|
||||||
ThemeSongIds = Array.Empty<Guid>();
|
|
||||||
ThemeVideoIds = Array.Empty<Guid>();
|
|
||||||
Tags = Array.Empty<string>();
|
Tags = Array.Empty<string>();
|
||||||
Genres = Array.Empty<string>();
|
Genres = Array.Empty<string>();
|
||||||
Studios = Array.Empty<string>();
|
Studios = Array.Empty<string>();
|
||||||
@ -100,12 +98,52 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
};
|
};
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Guid[] ThemeSongIds { get; set; }
|
public Guid[] ThemeSongIds
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_themeSongIds == null)
|
||||||
|
{
|
||||||
|
_themeSongIds = GetExtras()
|
||||||
|
.Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeSong)
|
||||||
|
.Select(song => song.Id)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _themeSongIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_themeSongIds = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Guid[] ThemeVideoIds { get; set; }
|
public Guid[] ThemeVideoIds
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_themeVideoIds == null)
|
||||||
|
{
|
||||||
|
_themeVideoIds = GetExtras()
|
||||||
|
.Where(extra => extra.ExtraType == Model.Entities.ExtraType.ThemeVideo)
|
||||||
|
.Select(song => song.Id)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _themeVideoIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_themeVideoIds = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string PreferredMetadataCountryCode { get; set; }
|
public string PreferredMetadataCountryCode { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string PreferredMetadataLanguage { get; set; }
|
public string PreferredMetadataLanguage { get; set; }
|
||||||
|
|
||||||
@ -635,6 +673,9 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string _sortName;
|
private string _sortName;
|
||||||
|
private Guid[] _themeSongIds;
|
||||||
|
private Guid[] _themeVideoIds;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the sort.
|
/// Gets the name of the sort.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1582,7 +1623,8 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
item.ThemeVideoIds = newThemeVideoIds;
|
// They are expected to be sorted by SortName
|
||||||
|
item.ThemeVideoIds = newThemeVideos.OrderBy(i => i.SortName).Select(i => i.Id).ToArray();
|
||||||
|
|
||||||
return themeVideosChanged;
|
return themeVideosChanged;
|
||||||
}
|
}
|
||||||
@ -1619,7 +1661,8 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
item.ThemeSongIds = newThemeSongIds;
|
// They are expected to be sorted by SortName
|
||||||
|
item.ThemeSongIds = newThemeSongs.OrderBy(i => i.SortName).Select(i => i.Id).ToArray();
|
||||||
|
|
||||||
return themeSongsChanged;
|
return themeSongsChanged;
|
||||||
}
|
}
|
||||||
@ -2910,12 +2953,12 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
public IEnumerable<BaseItem> GetThemeSongs()
|
public IEnumerable<BaseItem> GetThemeSongs()
|
||||||
{
|
{
|
||||||
return ThemeVideoIds.Select(LibraryManager.GetItemById).Where(i => i.ExtraType.Equals(Model.Entities.ExtraType.ThemeSong)).OrderBy(i => i.SortName);
|
return ThemeSongIds.Select(LibraryManager.GetItemById);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<BaseItem> GetThemeVideos()
|
public IEnumerable<BaseItem> GetThemeVideos()
|
||||||
{
|
{
|
||||||
return ThemeVideoIds.Select(LibraryManager.GetItemById).Where(i => i.ExtraType.Equals(Model.Entities.ExtraType.ThemeVideo)).OrderBy(i => i.SortName);
|
return ThemeVideoIds.Select(LibraryManager.GetItemById);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user