Skip to content

Instantly share code, notes, and snippets.

@rornor rornor/id.xsl Secret
Created Dec 28, 2012

What would you like to do?
Get foobar2000 playback statistics ID hashes for tracks with play count greater then 0
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="" xmlns:xs="" xmlns:fn="">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="param" as="xs:string" required="yes"/>
<xsl:param name="p" select="document($param)"/>
<!-- Note: delay parameter represeents time shift based on user location. For CET it turnes out as +2h. Change accordingly your timezone -->
<xsl:param name="delay" select="2 * 60 * 60"/>
<xsl:template match="/">
<xsl:for-each select="PlaybackStatistics/Entry">
<xsl:variable name="dt" select="string(xs:dateTime('1601-01-01T00:00:00Z') + (@FirstPlayed idiv 10000000 + $delay) * xs:dayTimeDuration('PT1S'))"/>
<xsl:if test="$dt != ''">
<xsl:attribute name="ID"><xsl:value-of select="string(@ID)"/></xsl:attribute>
<xsl:attribute name="Artist"><xsl:value-of select="$p/PlaybackStatistics/Item[FirstPlayed=$dt]/Artist"/></xsl:attribute>
<xsl:attribute name="Album"><xsl:value-of select="$p/PlaybackStatistics/Item[FirstPlayed=$dt]/Album"/></xsl:attribute>
<xsl:attribute name="Title"><xsl:value-of select="$p/PlaybackStatistics/Item[FirstPlayed=$dt]/Title"/></xsl:attribute>

This comment has been minimized.

Copy link
Owner Author

commented Dec 29, 2012

Thread: link

Example see linked thread for example usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.