traktor-nml-utils icon indicating copy to clipboard operation
traktor-nml-utils copied to clipboard

The Parser doesn't appear to support smartlists

Open b1kjsh opened this issue 3 years ago • 4 comments

I get the following error when loading my collection using the latest traktor. It seems that it does not support smartlists

File "/***/.venv/lib/python3.9/site-packages/xsdata/formats/dataclass/parsers/nodes.py", line 105, in child raise ParserError(f"Unknown property {self.meta.qname}:{qname}") xsdata.exceptions.ParserError: Unknown property NODEType:SMARTLIST

Here's my code:

from traktor_nml_utils import TraktorCollection
from pathlib import Path

collection = TraktorCollection(path=Path('/**/Documents/Native Instruments/Traktor 3.4.2/collection.nml'))

for entry in collection.nml.collection.entries:
    print(entry.artist)

b1kjsh avatar Aug 22 '21 00:08 b1kjsh

Could you post a (minimal) collection.nml containing such a smartlist? I didn't use these so far

wolkenarchitekt avatar Aug 22 '21 10:08 wolkenarchitekt

I pulled the code and fixed it myself. If you'd like I can post it as a PR or something for you to review if you'd like. I added some of the sample xml to the existing nml files and tested it with my collection.nml that I have. I also found an issue with the Indexing element as well and addressed that.

b1kjsh avatar Aug 23 '21 04:08 b1kjsh

I forked it and uploaded my changes. You can inspect them here if you'd like: https://github.com/b1kjsh/traktor-nml-utils/commit/5563920c6c1a4378be0c75c8be963e8dcf190643

b1kjsh avatar Aug 23 '21 04:08 b1kjsh

Sorry for the delay, I finally found the time to have a look at this library again.

Looking at all the errors that might occur due to the complex process approach of XML->XSD->Python conversion, I feel like this library is quite brittle and can break often, like with smartlists, and whatever else NML-XML-property that it doesn't consider.

Nowadays I'd probably just stick to use plain lxml to process NML-files, though that means lots of manual work and code-duplication (and harder to get type hints in a nice way).

Maybe I'll put this library into (non)-maintenance work somewhen soon.

Feel free to take over maintenance (at least within your fork) if you want and if you are brave enough ;-)

wolkenarchitekt avatar Oct 29 '21 20:10 wolkenarchitekt