Null characters being introduced...
zang74 opened this issue · 4 comments
MacOS: Monterey 12.3.1
Apple Music: 1.2.3.56
Music Library Exporter: 1.1.1 (32)
library-generator: 1.1.1 (32)
It would appear that both Music Library Exporter and library-generator are adding null characters {0x0} to exported XML.
When exporting directly from Apple Music, they either are not created or are stripped automatically. But copying the text from the Apple Music item's "get info" also doesn't seem to contain the null character.
This introduces issues with apps that may need to interpret those files. For instance, Eric Daugherty's awesome iTunes Export ( https://www.ericdaugherty.com/dev/itunesexport/ )—which takes an exported Library.xml and converts the playlists to individual files M3U files, chokes on the null characters created. In this case, it kills the automatic workflow I have going that shares my Apple Music playlists with Kodi by proxy of Jellyfin.
For an example of what's happening, I've sought the same playlist item in a direct iTunes export as well an export generated by library-generator.
BBEdit clearly points out the null character in the LG export after a carriage return in the song's comments:
Which is not seen in the direct Apple Music export:
Just adding that the Apple Music export does seem to have a space character where MLE/lg put the null character, but as far as I've been able to suss out, it's just a standard space.
Hi there,
Sorry for the delay in following up. My best guess would be that OrderedDictionary is the culprit.
I'll look into resolving this in the upcoming week.
Just adding that the Apple Music export does seem to have a space character where MLE/lg put the null character, but as far as I've been able to suss out, it's just a standard space.
Hi @zang74,
I was able to replicate this but only when there actually was a null character introduced in the comments. It seems like the Music app is sanitizing during export as well as when you copy.
I will try to add a sanitize pass but I would still recommend using Yate (free trial) to clean out your comments. Yate is, in my opinion, the only tag editor out there that holds weight.
If you drag the songs directly from Music, Yate will automatically link them to allow it to refresh Music's metadata cache after changes are made in Yate. Otherwise you can right click and hit "Link to Apple App".
If the text in your comments section is blue, it contains invalid characters. You can select the text and in a context menu select "Yate Transformations" > "Remove Invalid Characters".
You can also do this automatically for all songs currently open in Yate by using the editor 'Trim' function (useful for fixing all items in your library in one pass). See the screenshot below for an example. Again, you'll need to use the "Refresh Apple App" after saving your changes.
Please do let me know if this works for you.
Quick update @zang74
Null characters are now being replaced with spaces to emulate the same file format.
I'll be pushing an update for both the Music Library Exporter and library-generator shortly.
This issue will be auto-closed but please do let me know if this does or does not resolve it.