HOW TO: synchronise your last.fm playback stats with foobar, ...works with CUI and DUI |
![]() ![]() |
HOW TO: synchronise your last.fm playback stats with foobar, ...works with CUI and DUI |
Dec 11 2009, 18:22
Post
#51
|
|
![]() Group: Members Posts: 720 Joined: 24-November 05 From: Grenoble Member No.: 25981 |
I tested your last script, i like a lot. 2 things though:
- you dont update the button when syncing a track where you can write the tag. You only do it in the else. - i dont really like the auto_love, i really choose carefully which song i love! But on the contrary if i love a song i want to put it 5 stars. I added for personal use. May be some others would be interested ... Great job! |
|
|
|
Dec 11 2009, 18:29
Post
#52
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
|
|
|
|
Dec 12 2009, 07:39
Post
#53
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
a new version has been uploaded which supports foo_customdb. this requires foobar v1 because i've had to include my heavily customised .cfg file for foo_customdb.
new link... http://cid-649d3bfeaf541fbb.skydrive.live....ount%20sync.zip (this version supports either file tagging or foo_customdb. the option can be changed in the script) there is one "issue" which i've gone into a little detail about on page2 of the readme. it doesn't affect me. that's not to say it won't be an issue for others. |
|
|
|
Dec 12 2009, 23:26
Post
#54
|
|
|
Group: Members Posts: 116 Joined: 2-March 05 From: Tirgu-Mures Member No.: 20278 |
How about making this script a true component or integrate it in the scrobbler? Is there someone with the skills and will to do this? These functionalities depend too much on too many components and scripts. It would be a lot more elegant.
Please, please, pretty please! |
|
|
|
Dec 13 2009, 00:31
Post
#55
|
|
|
Group: Members Posts: 228 Joined: 11-December 09 Member No.: 75848 |
I really hope the developer considers making this a standalone plugin. I'd love this functionality, but I use the DUI. Although the dockable panels workaround is technically possible, it is very far from ideal.
|
|
|
|
Dec 14 2009, 17:11
Post
#56
|
|
|
Group: Members Posts: 5 Joined: 8-December 09 Member No.: 75738 |
I tested your last script, i like a lot. 2 things though: - you dont update the button when syncing a track where you can write the tag. You only do it in the else. - i dont really like the auto_love, i really choose carefully which song i love! But on the contrary if i love a song i want to put it 5 stars. I added for personal use. May be some others would be interested ... Great job! @carmenm -- I'd like to see what you've done to sync from loved to 5-stars. I'd like mine to sync both directions, i.e. 5-stars -> love and love -> 5-stars. Thanks! jimbothigpen This post has been edited by jimbothigpen: Dec 14 2009, 17:12 |
|
|
|
Dec 14 2009, 17:53
Post
#57
|
|
![]() Group: Members Posts: 720 Joined: 24-November 05 From: Grenoble Member No.: 25981 |
I tested your last script, i like a lot. 2 things though: - you dont update the button when syncing a track where you can write the tag. You only do it in the else. - i dont really like the auto_love, i really choose carefully which song i love! But on the contrary if i love a song i want to put it 5 stars. I added for personal use. May be some others would be interested ... Great job! @carmenm -- I'd like to see what you've done to sync from loved to 5-stars. I'd like mine to sync both directions, i.e. 5-stars -> love and love -> 5-stars. Thanks! jimbothigpen in the code look for CODE } else if (ok) { fb.trace(loved_tag_name + " not updated. No changes found."); } then add that below CODE if (auto_rating == 1 && lastfm_loved == 1 && ok) { g_metadb.UpdateFileInfoSimple("RATING","5"); } Then dont forget to add the global variable var auto_rating = 1; at the top of your script. It should be fine This post has been edited by carmenm: Dec 14 2009, 17:55 |
|
|
|
Dec 14 2009, 18:48
Post
#58
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
@ loft & Hitchhiker427, i couldn't agree more. it would be far nicer as a proper component that didn't have all these silly limitations. but sadly i just don't have the skills. programming is whole other world compared to hacking this little script together.
|
|
|
|
Dec 14 2009, 20:16
Post
#59
|
|
|
Group: Members Posts: 5 Joined: 8-December 09 Member No.: 75738 |
QUOTE in the code look for CODE } else if (ok) { fb.trace(loved_tag_name + " not updated. No changes found."); } then add that below CODE if (auto_rating == 1 && lastfm_loved == 1 && ok) { g_metadb.UpdateFileInfoSimple("RATING","5"); } Then dont forget to add the global variable var auto_rating = 1; at the top of your script. It should be fine @carmenm -- I think I see that you want to update the RATING tag in the file here, right? I use the Playback Statistics db, as I prefer not to write "non-universal" tags to my muzak as the library is shared among my family. Being a Windows scripting dummy, I've been unable to figure out how I should change that. Looked at the code for another wsh panel I use -- the one found at http://www.hydrogenaudio.org/forums/index....st&p=625796 -- but nothing jumped out at me. Don't go out of your way, but if the solution's obvious to you, please point it out to me! Thanks! jimbothigpen |
|
|
|
Dec 14 2009, 20:21
Post
#60
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
replace
CODE g_metadb.UpdateFileInfoSimple("RATING","5"); with CODE fb.RunContextCommandWithMetadb("Rating/5",g_metadb); |
|
|
|
Dec 14 2009, 22:53
Post
#61
|
|
|
Group: Members Posts: 5 Joined: 8-December 09 Member No.: 75738 |
OK... I use what I think is the most recent version of the code, with foo_customdb. When I use this code:
CODE if (auto_rating == 1 && lastfm_loved_db == 1) { fb.RunContextCommandWithMetadb("Rating/5",g_metadb); } ...in the update_file function, as initially recommended, I get no results. Nothing I can see, anyway. When I move that code to the end of the update_customdb function, I get the following: Error: WSH Panel Mod (GUID: 5493B479-5B82-4C88-A49E-F2545BDB0EC4): Microsoft JScript runtime error: 'lastfm_loved_db' is undefined If this is just not workable, I can let it go... Not a big deal. --jimbothigpen |
|
|
|
Dec 14 2009, 23:29
Post
#62
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
as you're using the customdb version, undo any changes you've made. now replace this line of code...
CODE userloved == 1 ? update_button(2) : update_button(3); with CODE if(userloved ==1) { fb.RunContextCommandWithMetadb("Rating/5",g_metadb); update_button(2); } else { update_button(3); } |
|
|
|
Dec 14 2009, 23:57
Post
#63
|
|
|
Group: Members Posts: 5 Joined: 8-December 09 Member No.: 75738 |
thanks so much to both marc2003 and carmenm!
--jimbothigpen |
|
|
|
Dec 15 2009, 09:08
Post
#64
|
|
![]() Group: Members Posts: 720 Joined: 24-November 05 From: Grenoble Member No.: 25981 |
Thanks for helping marc2003.
|
|
|
|
Dec 15 2009, 10:46
Post
#65
|
|
![]() Group: Members Posts: 95 Joined: 12-December 08 Member No.: 64410 |
This is great! I've been looking for this for so long, I can't tell you how happy I am that someone's actually gone and wrote this!
One small thing that may be my own oversight: it seems that if the song is not entered in my last.fm database already (ie. it's the first play of it), the script doesn't write a LASTFM_PLAYCOUNT tag. Is that supposed to work like that? I made an autoplaylist with all the songs that haven't had their data updated to LASTFM_PLAYCOUNT with the intention of playing that until the playlist is empty, but it doesn't remove stuff that I simply never played/entered into last.fm yet. (To be honest, i changed LASTFM_PLAYCOUNT to PLAY_COUNTER, which I already had on a couple files... but i don't think that should matter?). Anyway thanks again for this awesome script! This post has been edited by スラッシュ: Dec 15 2009, 11:36 |
|
|
|
Dec 15 2009, 13:32
Post
#66
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
the sync is a one way thing. if there is nothing from last.fm to write, your files aren't touched. and as a track isn't scrobbled until playback stops, the stats are always going to be 1 play behind.
however, you could add this extra function to take care of it (this runs after the song has played continuously for 60 seconds). CODE function on_item_played() { if(fb.TitleFormat("%" + playcount_tag_name + "%").EvalWithMetadb(g_metadb) == "?") { g_metadb.UpdateFileInfoSimple(playcount_tag_name, 1); } } (just add it anywhere between the other functions) This post has been edited by marc2003: Dec 15 2009, 13:39 |
|
|
|
Dec 15 2009, 13:41
Post
#67
|
|
![]() Group: Members Posts: 95 Joined: 12-December 08 Member No.: 64410 |
Brilliant, works a charm. Thanks again!
This post has been edited by スラッシュ: Dec 15 2009, 13:41 |
|
|
|
Dec 15 2009, 20:35
Post
#68
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
the link for the customdb version is now dead. this is because it's all been merged into the main version found in the link from the opening post.
click me by default it writes tags to the files just like the original script. i've included instructions on how to enable customdb support. there are many changes from the original script so if anybody wants any help, they must use this newer version. just copy over the text from "code.txt" making sure you preserve your existing settings. This post has been edited by marc2003: Dec 15 2009, 20:41 |
|
|
|
Dec 17 2009, 02:14
Post
#69
|
|
|
Group: Members Posts: 7 Joined: 7-November 08 Member No.: 61857 |
Thanks for this! I wondered a while ago if something like this was possible.
The only thing I don't like about it is that it doesn't see any difference between the same track title on a different album. Like with a live album. I don't think there's anything that can actually be done about it though, short of tagging all your live tracks as "Title (live)" or something. |
|
|
|
Dec 17 2009, 03:27
Post
#70
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
well i'm just using artist/title to query the last.fm webservices.
but looking at the documentation, it's possible to query the service using the musicbrainz track id instead. obviously this requires all your music is tagged with this information and assumes that last.fm really do handle it properly their end. i notice the audioscrobbler component has an option to scrobble this so it should be possible in theory. if your music is tagged in this way and you do have examples of different track ids with the same artist/title information i can check out, then maybe i could add support for that. EDIT: i can't see this working at all. i've been checking the raw feeds for lots of random tracks from my collection and none contain the track id, just the artist. This post has been edited by marc2003: Dec 17 2009, 03:38 |
|
|
|
Dec 17 2009, 07:01
Post
#71
|
|
![]() Group: Members Posts: 95 Joined: 12-December 08 Member No.: 64410 |
One more suggestion, although I'm not sure if last.fm lets you do this! If it's possible though, it'd be really great if this script could also get fill in the correct value for <FIRST_PLAYED> to be the first time it was added to last.fm. last.fm does keep that statistic (like here for example), but I don't know if you can actually get to this value... But it'd be really great cause then the values would all be correct, and that would help for stuff like hotness algorithms! (And just general accuracy I guess)
|
|
|
|
Dec 17 2009, 07:41
Post
#72
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
it would seem that is exclusive to their own web pages. they don't publish that info in the web services.
|
|
|
|
Dec 17 2009, 07:54
Post
#73
|
|
![]() Group: Members Posts: 95 Joined: 12-December 08 Member No.: 64410 |
Yeah, I was afraid of that. It's a shame they keep a lot of info to themselves. Thanks for checking
|
|
|
|
Dec 20 2009, 11:24
Post
#74
|
|
![]() Group: Members Posts: 7 Joined: 20-December 09 Member No.: 76165 |
Thank you so much for this plugin! I've been looking for it since 2007
I had to add this line: CODE function sync() { if (g_metadb.RawPath.indexOf("file://") != 0) return; This will prevent anything else but a physical file to get synchronized with last.fm (prevent mms, http, etc) Attached is my foobar2k
|
|
|
|
Dec 20 2009, 17:19
Post
#75
|
|
![]() Group: Members Posts: 3288 Joined: 27-January 05 From: England Member No.: 19379 |
I had to add this line: you didn't have to. i've already got checks in place to stop it trying to tag non-local files. the difference is that i do the check after contacting last.fm. this is because you can still see the loved status of a stream because the button will turn red if it is. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 24th May 2013 - 01:51 |