Author Topic: Attempting to import last played timestamp from foobar2000  (Read 2607 times)

ganymede2314

  • Newbie
  • *
  • Posts: 3
Hello, i'm a recent Foobar2000 convert and so far am loving MusicBee.  I'm about 90% done with getting my library tags migrated over but have hit a wall on my current quest to import the 'last played timestamp' value that is written as a TXXX tag to my files.  The tag is in epoch time (in the format of microseconds elapsed since 1/1/1970) and i'm trying to get MusicBee to recognize that value as 'last played'.    I wasn't able to find anything in the functions list that might work nor could i find a way to do it with RegEx.   My questions are: 

1.  Is it even possible to update MB's 'Last Played' value from a tag field?  (not sure if this works similar to updating the Play Count, which worked ok)
2.  Any suggestions for converting epoch time values to date time values?

Tag example:
Tag Code                                    Value
TXXX/Last_Played_Timestamp    130339516430000000

The best information i could find was on http://www.epochconverter.com/ which shows how to do the conversion using languages such as Perl and T-SQL.

Thanks for the help!

ganymede2314

  • Newbie
  • *
  • Posts: 3
I was able to get this to work and thought i would post my solution in case others might benefit from it.  After reading a 16 page forum thread over on Hydrogen Audio's Foobar2000 forum i found out the the value in the Last_Played_Timestamp tag was not an epoch time code but rather a Windows FileTime value that, according to MSDN, "is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 A.M. January 1, 1601 Coordinated Universal Time (UTC)."   

Hmm, OK. 

I was able to find an Excel formula to get from epoch time to a date/time value (=(A1/86400)+25569) but now we need to get from Windows FileTime to epoch time and we're good.  A little googling revealed that this could be done with this formula (=A1 / 1e7 - 11644473600).  So combining the two formulas let's us input the Windows FileTime value and get a datetime value as a result.  Here it is (assuming A1 is the input cell):

=((A1/10000000 -11644473600)/86400)+25569+(-5/24)

Which lets us translate 128228745200468000 into 5/5/2007  4:35:20 PM.  Hooray for mathematics!

So my workflow ended up looking like this:

1. Define new tag to hold the last_playback_timestamp value (i used "Last Played FB")
2. Set Last Played FB tag to pull from last_playback_timestamp TXXX frame
3. Set a new filter to show only files that have a value for Last Played FB.
4. Select files and use the Copy Tags To Clipboard... function from the Additional Tagging Tools plugin.
5. Select only the Last Played FB checkbox.
6. Paste the values into Excel and apply the above formula, then Copy - Paste Special - Values into a new range.
7. Select range and copy to clipboard
8. Next we use the 'Paste Tags from Clipboard' function.
9. After verifying that we now have datetime values in the Last Played FB tag, use Tools | Copy Tags... and set it to copy Last Played FB to 'Last Played'.

Success!  I am ecstatic that I've been able to migrate my 8 years of playback statistics (in addition to ratings, play counts, album art, discogs tags and AMG tags) over from Foobar2000 into MusicBee with zero frustration and my only regret is that i didn't jump ship years ago.   I've started to realize that there is very little MusicBee can't do and it seems to work in a more elegant and civilized fashion compared to other media players.





Zak

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 2459
...I've been able to migrate my 8 years of playback statistics ... into MusicBee with zero frustration.

If you managed to work all of that out with zero frustration, you're a more patient person than I.   :P
Bee excellent to each other...