HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: romor on 2012-10-14 12:00:42

Title: Revealing playback statistics track ID hashes
Post by: romor on 2012-10-14 12:00:42
Track ID exposure was requested several times. Here is stylesheet that can reveal it for tracks that do have some statistics: view (http://goo.gl/Zylx5) or download (http://goo.gl/ogWcR)

Limitation is that track needs to be played at least once, as FirstPlayed is the only reasonable unique data in exported playback statistics XML file.
Unfortunately Added is not unique, although the datetime unit is expressed in less then microsecond.

Workflow is this:

1. Export playback statistics to file (let's say to "ps.xml")

2. Select all library and by using text tools component, select advanced option, and add these patterns: http://pastebin.com/raw.php?i=HL52v6BS (http://pastebin.com/raw.php?i=HL52v6BS)
Copy result to "psx.xml"

3. Use tool that can process XSLT 2.0 instructions (i.e. saxon):

Code: [Select]
"C:\Program Files\Saxonica\SaxonHE9.4N\bin\Transform.exe" ps.xml id.xsl param="C:/temp/psx.xml"

param is path to file created with text tools (step 2), note forward slashes

Example output:

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<Items xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:fn="http://www.w3.org/2005/xpath-functions">
   <Item ID="984a40d944faa990"
         Artist="Robert Rich"
         Album="Rainforest"
         Title="Mbira"/>
   <Item ID="d24a08e2bd79b21d"
         Artist="Robert Rich"
         Album="Rainforest"
         Title="The Raining Room"/>
   <Item ID="f00b2c410e7a4e3e"
         Artist="Brian Eno"
         Album="Dune"
         Title="Prophecy Theme"/>
   ...

Other possibility worth noting is less known playback statistics component foo_playcount_sql, which after installation imports all playback statistics from foo_playcount component and exposes SQL SE database, which can be updated by user knowing this format (it is very similar to sqlite). IMHO drawback of using foo_playcount_sql is lack of Added field.