-
-
Save rornor/14775b660b7786977823 to your computer and use it in GitHub Desktop.
Get foobar2000 playback statistics ID hashes for tracks with play count greater then 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"> | |
<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="/"> | |
<Items> | |
<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 != ''"> | |
<Item> | |
<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> | |
</Item> | |
</xsl:if> | |
</xsl:for-each> | |
</Items> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thread: link
Example see linked thread for example usage