(04-06-2022, 10:08 AM)charlesky Wrote: 'Performer' and 'Conductor' tags appear to be interfering with retrieval of 'Artist' or 'Album Artist' data.
I see there have been a few issues with music tags in the past and heartily agree with @TheOldPresbyope that this whole thing is a dumpster fire with no standards. But right now (release 8.0.2) it appears that any files that have a 'Performer' or 'Conductor' tag defined end up being dumped in the 'Unknown Artist'/'Unknown AlbumArtist' category in tag view. This occurs with all of the choices in the 'Tag view artist' field.
My music is stored on a USB drive connected directly to the Pi. If I edit the file tags (using MP3tag 3.14 on a PC), solely remove the 'Performer' or 'Conductor' tag and update the library then the album turns up correctly listed under the relevant artist in tag view.
I should note that this is happening on AAC files (with the .m4a extension) that have been tagged using MP3Tag.
Ok, I found the place in the code that is causing this and fixed it.
/var/www/inc/playerlib.php controls the way the library handles tags. If a file doesn't have the 'AlbumArtist' tag defined then it tries to construct this by building an array containing the contents of the 'Artist', 'Performer' and 'Conductor' tags (if they are present). This works fine. Unfortunately, it looks like a trap was built in at some point to catch cases in which a file has multiple 'Artist' tags defined - this is certainly undesirable, though not really fatal - and spit them out as 'Unknown AlbumArtist'. This gets tripped when it encounters the Artist/Performer/Conductor array that was accumulated earlier, which certainly looks like an unintended behaviour.
The easiest way to fix this is simply to remove the trap. While multiple 'Artist' tags are a bad practice, music tags are such a wild west that it's not unknown, and probably not a good reason to disrupt the way the library is displayed.
The problem occurs at line 577 in playerlib.php:
Code:
'album_artist' => ($flatData['AlbumArtist'] ? $flatData['AlbumArtist'] : (count($flatData['Artist']) == 1 ? $flatData['Artist'][0] : 'Unknown AlbumArtist')),
Code:
'album_artist' => ($flatData['AlbumArtist'] ? $flatData['AlbumArtist'] : ($flatData['Artist'][0] ? $flatData['Artist'][0] : 'Unknown AlbumArtist')),
If anyone else is bothered by this behaviour and wants to make such a change feel free to PM me, though it's a slightly tricky process doing it from a Windows PC and needs special tools.
[Edit] The same change needs to be made to line 772 since there's a separate function to handle UTF8 encoding.