mhite / swinsian2itlxml

Generate iTunes library XML from Swinsian database
MIT License
28 stars 4 forks source link

Handling of iTunes unsupported file types #3

Open lomm opened 7 years ago

lomm commented 7 years ago

Hi appreciate the work on this.

I have flac files in my library which caused the script to fail.

2016-08-26 10:49:56 INFO: Generating track information... Traceback (most recent call last): File "./swinsian2itlxml.py", line 327, in main() File "./swinsian2itlxml.py", line 322, in main itunes_music_folder=args.itunes_music_folder) File "./swinsian2itlxml.py", line 149, in generate_xml total_time = int(math.ceil(row["length"] * 1000)) TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

Would be at all possible for the itunes unsupported files to be ignored with a warning message?

Is it feasible/possible to export a specific playlist from Swinsian (smart or standard) to itunes.xml?

thanks again

mhite commented 7 years ago

Probably the easiest way for me to troubleshoot this is if you send over your Swinsian database. Send it to mhite@hotmail.com. Thanks! At some point, I'd like to run automated tests over a set of example, real-world Swinsian databases. You can see the first one is in the tests/fixtures repository directory.

mhite commented 7 years ago

Just wanted to close this loop on this. I've not been able to induce this same crash you hit. My offer still stands to examine your Swinsian database file to determine the reason for the crash.

With regards to FLAC -- Serato depends heavily on the "Kind" field in the iTunes track information XML to determine which audio parser to use when playing. Because FLAC is an unsupported iTunes file format, Serato can't import FLAC files from an iTunes XML. Additionally, even if you misrepresent the FLAC file as an "MPEG audio file" in the "Kind" field, it will play what sounds like corrupt audio static.

The bottom line is that I've never been able to get a FLAC file imported via an iTunes XML.

lomm commented 7 years ago

Hi Matt

apologies i thought i had replied last year! i came back to it a short time later and then haven't been able to reproduce the issue since. I'm personally not a Serato user and using this with Traktor and also Rekordbox.

Thanks for following up.

On Tue, 30 May 2017 at 11:03 Matt Hite notifications@github.com wrote:

Just wanted to close this loop on this. I've not been able to induce this same crash you hit. My offer still stands to examine your Swinsian database file to determine the reason for the crash.

With regards to FLAC -- Serato depends heavily on the "Kind" field in the iTunes track information XML to determine which audio parser to use when playing. Because FLAC is an unsupported iTunes file format, Serato can't import FLAC files from an iTunes XML. Additionally, even if you misrepresent the FLAC file as an "MPEG audio file" in the "Kind" field, it will play what sounds like corrupt audio static.

The bottom line is that I've never been able to get a FLAC file imported via an iTunes XML.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mhite/swinsian2itlxml/issues/3#issuecomment-304764017, or mute the thread https://github.com/notifications/unsubscribe-auth/AFNDQvhvG_LHLvz2p8531yiHZjJmQvf2ks5r-4bygaJpZM4JtwbE .

mhite commented 7 years ago

Ok, great. I'll close out this issue. One thing I am curious about: have you spotted any problems with Traktor and this tool? Likewise, any problems with Rekordbox?

lomm commented 7 years ago

Rekordbox is no longer recognising the xml file, been a while since it has worked for me. I've found myself managing playlists directly in Rekordbox so not been depending on the tool for rekordbox also the intelligent playlists are serviceable.

Traktor has been okay, it just has a hard time dealing with large libraries though.

cattz commented 7 years ago

I'm getting the exact same error, but AFAIK I do not have any file formats not compatible with iTunes (just been working on the transition all weekend). I'm happy to send you my DB, if you are interested. Since you mention you have not been able to get FLACs imported from an iTunes XML, maybe the best would be to log a warning and discard the issue?

mhite commented 7 years ago

Hi, @cattz -- give the current devel branch a try:

https://github.com/mhite/swinsian2itlxml/tree/devel

It ignores non-supported file types (and doesn't attempt to represent them as MP3 in the file type XML field).

If you can send me your database, that would be great! I'm mhite@hotmail.com.

mhite commented 7 years ago

If I were to guess, for this particular track it is crashing on, the Swinsian database length entry for the track has no value. I'd love to see the database in question to verify this, but I can also put in a safeguard to possibly skip or return a length of 0 if the Swinsian database value is empty. This might also be a FLAC only issue (ie. Swinsian might not record a length value until the first time you play the track in-app) or it might be impact all audio file types. Would love to get your database to determine.

cattz commented 7 years ago

Just tried the devel branch, same issue:

2017-06-21 21:18:59 INFO: Generating track information...
Traceback (most recent call last):
  File "./swinsian2itlxml.py", line 437, in <module>
    main()
  File "./swinsian2itlxml.py", line 432, in main
    itunes_music_folder=args.itunes_music_folder)
  File "./swinsian2itlxml.py", line 259, in generate_xml
    total_time = int(math.ceil(row["length"] * 1000))
TypeError: unsupported operand type(s) for *: 'NoneType' a
mhite commented 7 years ago

Hi, @cattz - Any chance you can send me your database? I'm mhite@hotmail.com.

Thanks.

notadrawing commented 5 years ago

I just tried both versions and I get the same error message. MacOS 10.14.4, Swinsian Version 2.1.12 (463), Python 2.7.10 I hope you're still interested in your script :-)

Traceback (most recent call last): File "./swinsian2itlxml_DEV.py", line 437, in main() File "./swinsian2itlxml_DEV.py", line 432, in main itunes_music_folder=args.itunes_music_folder) File "./swinsian2itlxml_DEV.py", line 259, in generate_xml total_time = int(math.ceil(row["length"] 1000)) TypeError: unsupported operand type(s) for : 'NoneType' and 'int'

My library is pretty big :-) 278MB

mhite commented 5 years ago

@notadrawing - Are you able to upload it anywhere? I'd like to take a look.

notadrawing commented 5 years ago

I'll upload it to dropbox. Grant access to mwhite@hotmail?

mhite commented 5 years ago

Close, it's mhite@hotmail.com.

mhite commented 5 years ago

@notadrawing - Still would love to get a copy of this so we can squash this bug. Thanks!

mhite commented 5 years ago

Hey, @notadrawing - Sorry to be a pester, but any chance you could upload it?