mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-10-17 12:01:01 -04:00
Fixing the UFID field value giving a warning and not being correctly processed (#14851)
This commit is contained in:
parent
9c298c52f5
commit
71ebb1f456
@ -437,12 +437,12 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
{
|
{
|
||||||
audio.TrySetProviderId(MetadataProvider.MusicBrainzRecording, recordingMbId);
|
audio.TrySetProviderId(MetadataProvider.MusicBrainzRecording, recordingMbId);
|
||||||
}
|
}
|
||||||
else if (TryGetSanitizedAdditionalFields(track, "UFID", out var ufIdValue) && !string.IsNullOrEmpty(ufIdValue))
|
else if (TryGetSanitizedUFIDFields(track, out var owner, out var identifier) && !string.IsNullOrEmpty(owner) && !string.IsNullOrEmpty(identifier))
|
||||||
{
|
{
|
||||||
// If tagged with MB Picard, the format is 'http://musicbrainz.org\0<recording MBID>'
|
// If tagged with MB Picard, the format is 'http://musicbrainz.org\0<recording MBID>'
|
||||||
if (ufIdValue.Contains("musicbrainz.org", StringComparison.OrdinalIgnoreCase))
|
if (owner.Contains("musicbrainz.org", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
audio.TrySetProviderId(MetadataProvider.MusicBrainzRecording, ufIdValue.AsSpan().RightPart('\0').ToString());
|
audio.TrySetProviderId(MetadataProvider.MusicBrainzRecording, identifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,5 +537,24 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
value = GetSanitizedStringTag(value, track.Path);
|
value = GetSanitizedStringTag(value, track.Path);
|
||||||
return hasField;
|
return hasField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool TryGetSanitizedUFIDFields(Track track, out string? owner, out string? identifier)
|
||||||
|
{
|
||||||
|
var hasField = track.AdditionalFields.TryGetValue("UFID", out string? value);
|
||||||
|
if (hasField && !string.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
string[] parts = value.Split('\0');
|
||||||
|
if (parts.Length == 2)
|
||||||
|
{
|
||||||
|
owner = GetSanitizedStringTag(parts[0], track.Path);
|
||||||
|
identifier = GetSanitizedStringTag(parts[1], track.Path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
owner = null;
|
||||||
|
identifier = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user