Skip to main content
Topic: if2ktool - Migrate iTunes data to foo_playcount (Playback Statistics) (Read 446 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

if2ktool - Migrate iTunes data to foo_playcount (Playback Statistics)

Hi all, first post here. This isn't really a plugin, but hopefully still relevant for this subforum.

I've been working on a tool that helps migrate data (play count, rating, date added and last played) from iTunes to foobar2000's playback statistics component. Having recently moved my library from iTunes, all this data wasn't carried over, and I missed having my amassed play counts in foobar and being able to sort by library by the date the tracks were added, going years back.

As far as I know, there was no easy way to go about migrating this data. What this tool does is simply read this information from your iTunes Library XML (data that isn't written to the files), and write it to the file tags that are expected by the import function of foo_playcount.

I won't get into much more here, but I figured I might as well share it on the forum. It is still considered "in development", and I've only really been able to test it on my library - so any feedback would be great. If you do give it a try, please make sure to back up your library beforehand! Included in the repo below is a readme, where I've tried to document as much as possible. It's a good start if you don't know where to begin.

Download
GitHub: https://github.com/macklinb/if2ktool (click the "Releases" tab)

Developer side note:
At the moment, this tool writes data to the file tags, and then relies on the plugin to import the data from the tags. However I'd really like to add a solution that doesn't require editing the user's files - and instead write directly to the foo_playcount database.

The only hurdle I've faced with this approach is with how the entry ID (e.g. 0123456789abcde) as seen in an export from the plugin relates to a track in foobar. It appears to be a hashed combination of track title + album + album artist - perhaps a MYSQL323, or really any 16-bit hash. Knowing how this is constructed would be the only key to accomplishing the above. Any information regarding this would be much appreciated!

Re: if2ktool - Migrate iTunes data to foo_playcount (Playback Statistics)

Reply #1
The only hurdle I've faced with this approach is with how the entry ID (e.g. 0123456789abcde) as seen in an export from the plugin relates to a track in foobar. It appears to be a hashed combination of track title + album + album artist - perhaps a MYSQL323, or really any 16-bit hash. Knowing how this is constructed would be the only key to accomplishing the above. Any information regarding this would be much appreciated!
I think marc2003 used the same hashing method in his foo_jscript_panel component as in foo_playcount (according to his wiki).
Wiki: https://github.com/marc2k3/foo_jscript_panel/wiki/Playback-Stats
Corresponding sources: https://github.com/marc2k3/foo_jscript_panel/blob/0112b8f0a7a30d359261c4d6c7f5352545a0b934/src/stats.cpp#L184

Re: if2ktool - Migrate iTunes data to foo_playcount (Playback Statistics)

Reply #2
I think marc2003 used the same hashing method in his foo_jscript_panel component as in foo_playcount (according to his wiki).
Wiki: https://github.com/marc2k3/foo_jscript_panel/wiki/Playback-Stats
Corresponding sources: https://github.com/marc2k3/foo_jscript_panel/blob/0112b8f0a7a30d359261c4d6c7f5352545a0b934/src/stats.cpp#L184
Thanks for the info. However I don't think that foo_jscript_panel uses the same method, as the hashes that come from foo_playcount are influenced by changing other info like album, track no, etc, which doesn't seem to be taken into account in his code.

I don't have a ton of knowledge with c++, but my understanding is that his hash is the result of "$lower(%artist% - %title%)" being hashed to an md5, and then half of it being XOR'd with the other half. I was able to confirm this by comparing the hash written to "index-data\835F0B63-D96C-447B-9CCB-714FA8304911" with some test code of my own to generate the same thing. The hash that is generated by the same track in foo_playcount is not the same though :(

You have given me some more information, as the XORHalf step seems to be from the foobar sdk, and not just his code - so perhaps foo_playcount does the same? It's a shame the code for the official components isn't open source, as just testing various inputs wildly isn't going to get me anywhere.

 

 
SimplePortal 1.0.0 RC1 © 2008-2019