Store lyrics in the database as media streams (#9951)

This commit is contained in:
Cody Robibero
2024-02-26 05:09:40 -07:00
committed by GitHub
parent 59f50ae8b2
commit 0bc41c015f
49 changed files with 1481 additions and 262 deletions

View File

@@ -18,7 +18,6 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Lyrics;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.Providers;
@@ -53,7 +52,6 @@ namespace Emby.Server.Implementations.Dto
private readonly IMediaSourceManager _mediaSourceManager;
private readonly Lazy<ILiveTvManager> _livetvManagerFactory;
private readonly ILyricManager _lyricManager;
private readonly ITrickplayManager _trickplayManager;
public DtoService(
@@ -67,7 +65,6 @@ namespace Emby.Server.Implementations.Dto
IApplicationHost appHost,
IMediaSourceManager mediaSourceManager,
Lazy<ILiveTvManager> livetvManagerFactory,
ILyricManager lyricManager,
ITrickplayManager trickplayManager)
{
_logger = logger;
@@ -80,7 +77,6 @@ namespace Emby.Server.Implementations.Dto
_appHost = appHost;
_mediaSourceManager = mediaSourceManager;
_livetvManagerFactory = livetvManagerFactory;
_lyricManager = lyricManager;
_trickplayManager = trickplayManager;
}
@@ -152,10 +148,6 @@ namespace Emby.Server.Implementations.Dto
{
LivetvManager.AddInfoToProgramDto(new[] { (item, dto) }, options.Fields, user).GetAwaiter().GetResult();
}
else if (item is Audio)
{
dto.HasLyrics = _lyricManager.HasLyricFile(item);
}
if (item is IItemByName itemByName
&& options.ContainsField(ItemFields.ItemCounts))
@@ -275,6 +267,11 @@ namespace Emby.Server.Implementations.Dto
LivetvManager.AddInfoToRecordingDto(item, dto, activeRecording, user);
}
if (item is Audio audio)
{
dto.HasLyrics = audio.GetMediaStreams().Any(s => s.Type == MediaStreamType.Lyric);
}
return dto;
}

View File

@@ -1232,6 +1232,19 @@ namespace Emby.Server.Implementations.Library
return item;
}
/// <inheritdoc />
public T GetItemById<T>(Guid id)
where T : BaseItem
{
var item = GetItemById(id);
if (item is T typedItem)
{
return typedItem;
}
return null;
}
public List<BaseItem> GetItemList(InternalItemsQuery query, bool allowExternalContent)
{
if (query.Recursive && !query.ParentId.IsEmpty())