mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Fix track MBID in audio metadata (#11301)
This commit is contained in:
parent
eccc9a0b64
commit
ab731d9212
@ -407,7 +407,14 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
|
||||
if (options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzTrack, out _))
|
||||
{
|
||||
audio.SetProviderId(MetadataProvider.MusicBrainzTrack, tags.MusicBrainzTrackId);
|
||||
// Fallback to ffprobe as TagLib incorrectly provides recording MBID in `tags.MusicBrainzTrackId`.
|
||||
// See https://github.com/mono/taglib-sharp/issues/304
|
||||
var mediaInfo = await GetMediaInfo(audio, CancellationToken.None).ConfigureAwait(false);
|
||||
var trackMbId = mediaInfo.GetProviderId(MetadataProvider.MusicBrainzTrack);
|
||||
if (trackMbId is not null)
|
||||
{
|
||||
audio.SetProviderId(MetadataProvider.MusicBrainzTrack, trackMbId);
|
||||
}
|
||||
}
|
||||
|
||||
// Save extracted lyrics if they exist,
|
||||
@ -431,5 +438,20 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
audio.LyricFiles = externalLyricFiles.Select(i => i.Path).Distinct().ToArray();
|
||||
currentStreams.AddRange(externalLyricFiles);
|
||||
}
|
||||
|
||||
private async Task<Model.MediaInfo.MediaInfo> GetMediaInfo(BaseItem item, CancellationToken cancellationToken)
|
||||
{
|
||||
var request = new MediaInfoRequest
|
||||
{
|
||||
MediaType = DlnaProfileType.Audio,
|
||||
MediaSource = new MediaSourceInfo
|
||||
{
|
||||
Path = item.Path,
|
||||
Protocol = item.PathProtocol ?? MediaProtocol.File
|
||||
}
|
||||
};
|
||||
|
||||
return await _mediaEncoder.GetMediaInfo(request, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user