Check if the metadata is supported for title fallback

Signed-off-by: gnattu <gnattuoc@me.com>
This commit is contained in:
gnattu 2024-05-30 18:59:26 +08:00
parent 172feab084
commit ac9322370b

View File

@ -159,8 +159,13 @@ namespace MediaBrowser.Providers.MediaInfo
ATL.Settings.DisplayValueSeparator = '\u001F'; ATL.Settings.DisplayValueSeparator = '\u001F';
Track track = new Track(audio.Path); Track track = new Track(audio.Path);
// ATL will fall back to filename as title when it does not understand the metadata
if (track.MetadataFormats.All(mf => mf.Equals(ATL.Factory.UNKNOWN_FORMAT)))
{
track.Title = mediaInfo.Name;
}
track.Album = string.IsNullOrEmpty(track.Album) ? mediaInfo.Album : track.Album; track.Album = string.IsNullOrEmpty(track.Album) ? mediaInfo.Album : track.Album;
track.Title = string.IsNullOrEmpty(track.Title) ? mediaInfo.Name : track.Title;
track.Year ??= mediaInfo.ProductionYear; track.Year ??= mediaInfo.ProductionYear;
track.TrackNumber ??= mediaInfo.IndexNumber; track.TrackNumber ??= mediaInfo.IndexNumber;
track.DiscNumber ??= mediaInfo.ParentIndexNumber; track.DiscNumber ??= mediaInfo.ParentIndexNumber;