Merge pull request #12126 from gnattu/add-extracted-lyrics

Try to add extracted lyrics during scanning
This commit is contained in:
Bond-009 2024-06-24 22:51:28 +02:00 committed by GitHub
commit 25f02658f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Jellyfin.Data.Enums; using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
@ -136,6 +137,10 @@ namespace MediaBrowser.Providers.MediaInfo
if (!audio.IsLocked) if (!audio.IsLocked)
{ {
await FetchDataFromTags(audio, mediaInfo, options, tryExtractEmbeddedLyrics).ConfigureAwait(false); await FetchDataFromTags(audio, mediaInfo, options, tryExtractEmbeddedLyrics).ConfigureAwait(false);
if (tryExtractEmbeddedLyrics)
{
AddExternalLyrics(audio, mediaStreams, options);
}
} }
audio.HasLyrics = mediaStreams.Any(s => s.Type == MediaStreamType.Lyric); audio.HasLyrics = mediaStreams.Any(s => s.Type == MediaStreamType.Lyric);
@ -369,7 +374,10 @@ namespace MediaBrowser.Providers.MediaInfo
var externalLyricFiles = _lyricResolver.GetExternalStreams(audio, startIndex, options.DirectoryService, false); var externalLyricFiles = _lyricResolver.GetExternalStreams(audio, startIndex, options.DirectoryService, false);
audio.LyricFiles = externalLyricFiles.Select(i => i.Path).Distinct().ToArray(); audio.LyricFiles = externalLyricFiles.Select(i => i.Path).Distinct().ToArray();
currentStreams.AddRange(externalLyricFiles); if (externalLyricFiles.Count > 0)
{
currentStreams.Add(externalLyricFiles[0]);
}
} }
} }
} }