Author Topic: Prevent export of certain tags to iTunes Music Library for compatibility  (Read 1752 times)

Wambo1992

  • Newbie
  • *
  • Posts: 2
Hello :)

I'm facing a compatibility issue with iTunes Music Library and custom Tags.

I defined a few custom tags with a custom display name. The tags are written to music files using some tags that I don't need.
The problematic part is, these custom tags are written to the iTunes Music Library.xml that is generated by enabling "export the library as an iTunes formatted XML File".

Unfortunately, these custom tags prevent the import of iTunes Music Library.xml in Native Instruments Traktor Pro (latest version as of writing, v3.9):
Unknown exception during iTunes import


I narrowed down the issue to be the existence of these custom tags in the library xml-file.
Deleting the key-value pairs from the Library xml-file fixes the issue.

Therefore, I would like to request a feature that allows to remove these problematic tags from iTunes Music Library.xml.

For example, I could think of a settings that:
 - allows to disable export of custom tags to iTunes Music Library.xml
 - OR allows to define a whitelist or blacklist of tags that are exported to iTunes Music Library.xml

Thank you and greetings
Wambo

jimiwili

  • Newbie
  • *
  • Posts: 2
Hey Wamboo,

I just discovered the same issue as you getting from MusicBee to Traktor after doing a fresh install of Windows 11 and getting everything back installed. I'm not sure exactly what caused it? What are these custom tags and how can I detect them?

I did a few autotagging of like 5 or 6 tracks just before I tried to configure the Itunes file, but It wouldn't work when I got to it. After reading your issue, I couldn't remember which tracks I autotagged, so can't go and check them. I tried to turn on some of the Custom fields and see if there was data but didn't see any.

Can you explain how I can look for these custom tags?

Regards
Jimiwili

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9350
Can you explain how I can look for these custom tags?
Custom tags are created by the user. If you've never created any, you can't look for them because you don't have any.
https://musicbee.fandom.com/wiki/Custom_Tags
Download the latest MusicBee v3.5 or 3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Posting screenshots is here
Searching the forum with Google is  here

Wambo1992

  • Newbie
  • *
  • Posts: 2
True, but interesting that it seems to fail for jimiwili without custom tags.

To give a more complete picture in the exact issue I identified.
This is an example of a key value pair of a custom tag written to the iTunes Music Library.xml
Code
[..]
<key>ImportFileURL</key><string>F:\Music\Inbox\Rave\Various - Techno Club - Rave Generation Vol. 1\CD1\04. Ravers Nature - Hands Up Ravers.flac</string>
[..]

And this is the Custom Tag definition in the Music Bee settings:


Removing all custom tags from the iTunesMusicLibrary.xml fixes the import.

I filed a bug report on Native Instruments side for Traktor 3 Pro describing this issue.
I will post any update I get there in this thread. (As of now, not much luck or progress though. They keep requesting more seemingly random info to work the ticket.)

In the meantime, I'll write a python script to automate the removal of the custom tags from the xml file.  :-\

Edit:
In case this is helpful for anybody who finds this. This is a simple Python Script that gets the job done as long as there's no newlines in the forbidden tags content:
Code: python
# Input: Relative or Absolute Path to 'iTunes Music Library.xml' (or filename if in same folder)
path_input_musiclibrary = 'iTunes Music Library.xml'
# Output: Relative or Absolute Path to output Music Library xml file, that is stripped from forbidden Tags
path_output_musiclibrary = 'Traktor\CleanedLibrary.xml'

# List of Tags that will be stripped from tracks of the Library file
forbidden_tags = ['PlaylistA', 'PlaylistB', 'PlaylistC', 'PlaylistD', 'ImportFileURL', 'ImportFolder']
forbidden_tags_formatted = []
for tag in forbidden_tags:
    forbidden_tags_formatted.append('<key>{}</key>'.format(tag))

with open(path_input_musiclibrary, 'r', encoding='utf-8') as lib_in, open(path_output_musiclibrary, 'w+', encoding='utf-8') as lib_out:
    for line in lib_in:
        if not any(forbidden_tag in line for forbidden_tag in forbidden_tags):
            lib_out.write(line)
Last Edit: July 29, 2023, 01:36:18 PM by Wambo1992

jimiwili

  • Newbie
  • *
  • Posts: 2
Whoooop! I just used your code, and the exported file ran just fine in Traktor!! I'm double happy because it's also my first time using a python script :D

So I guess there may have been some phantom hidden tags I didn't see, but either way, it's working. Happy DJing :)