Foobar2000:Components/foo enhanced playcount: Difference between revisions
MordredKLB (talk | contribs) (Initial add of wiki page) |
MordredKLB (talk | contribs) (→Links: spacing) |
||
Line 37: | Line 37: | ||
[https://hydrogenaud.io/index.php/topic,115227.msg950576.html Official Discussion Thread] | [https://hydrogenaud.io/index.php/topic,115227.msg950576.html Official Discussion Thread] | ||
[https://hydrogenaud.io/index.php/topic,115227.msg950576.html#msg950576 Changelog] | [https://hydrogenaud.io/index.php/topic,115227.msg950576.html#msg950576 Changelog] |
Revision as of 07:07, 12 April 2018
foo_enhanced_playcount (Record time of every play, and retrieve Last.fm scrobbles)
This component records the timestamp of every single play that foobar makes. If a username is supplied, and last.fm support is enabled, it can also retrieve the timestamp of every scrobble of a song as well.
While foo_enhanced_playcount can be used in any theme, to get maximum use out of it you'll need to use a panel that supports javascript, like foo_jscript_panel, or foo_wsh_panel.
New fields provided
- %played_times% - Date formatted list: ["2012-08-04 15:58:37", "2012-12-10 14:40:46", "2018-01-02 23:38:13"]
- %played_times_js% - JS timestamp list: [1344117517000, 1355172047000, 1514957893431]
- %played_times_raw% - raw foobar timestamps: [129885911170000000, 129996456470000000, 131594314930000000] - There's probably no reason to ever use this.
- %lastfm_played_times% - Date formatted list of scrobbles: ["2012-08-04 15:58:37", "2012-12-10 14:40:46", "2018-01-02 23:38:13"]
- %lastfm_played_times_js% - JS timestamp list: [1344117517000, 1355172047000, 1514957893000]
- %lastfm_play_count% - Count of last.fm plays, a la %play_count%: 5
- %lastfm_added% - Single date: "2012-08-04 15:58:37"
- %lastfm_first_played% - Always exactly the same as %lastfm_added%. Use whichever one makes most sense logically
- %lastfm_last_played% - Single date: "2018-04-04 15:58:37"
Code Samples
To consume the Array's of timestamps, you'll need to parse the response:
var raw = fb.TitleFormat('[%played_times_js%]').Eval(); var playedTimes = []; try { playedTimes = JSON.parse(raw); // this is required because the value is a string } catch (e) { fb.trace('<<< ERROR parsing JSON >>>'); // you probably don't need this try/catch, but it was helpful in my debugging } for (i=0; i < playedTimes.length; i++) { var p = new Date(playedTimes[i]); // do something with this value }
More code samples in the official thread.