Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: HOW TO: synchronise your last.fm playback stats with foobar (Read 386726 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #500
well i don't know what's going on there. the fact it says "OK" means the value is different from before.

anyway, find line 113 in the script. it should be this....
Code: [Select]
    if(fb.IsPlaying && time_elapsed >= target_time) {


now insert these 2 lines directly after it....

Code: [Select]
        fb.trace("Old value: " + old_userplaycount);
        fb.trace("New value: " + userplaycount);


now see what the console says after a few more plays.


Hello,

I've implemented the code, and the console now displays the "old" and "new" last.fm playcount values. From what I could tell, the big problem in my case seems to be that foobar doesn't save this value.

New console display

In the screenshot I've posted you can see that I've been playing songs from the same artist, that (at least for the tracks I've played so far) should have combined playcounts that are supposed to go way over the "31" that facets reports (the number of real foobar plays). Also, I've played the last song twice, to see if I would get a "?" for an old value twice (as if this was played for the first time, i suspect). As you can see,  the correct number of last.fm plays is reported (27, then 28) yet foobar doesn't save this value anywhere, treating the track as if it was played for the first time.

Am I making sense here? What do I need to do?

Thanks for your time.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #501
Your screenshot isn't very clear (shouldn't have shrunk it). This may sound silly, but since I couldn't get a clearer picture I'll ask:
1- Are you using "%LASTFM_PLAYCOUNT_DB%" vlaue to display the count?
2- You understand that the counts are stored for each track individually on CustomDB. Therefore if you are referring to the "album playcount" on the Facets, which probably counts by the built-in Playback Satistics Plugin, it will completely disregard the Last.fm statistics unless you import them to Statistics tags in the files or have any way to make it read the "%LASTFM_PLAYCOUNT_DB%" value intead of standard %play_count%.

Sorry if any of this sound obvious to you, but there is no way to know how deep you understand the program without asking these, just trying to help.

 

HOW TO: synchronise your last.fm playback stats with foobar

Reply #502
where are you expecting to see these values? i don't see any custom columns in your layout. 

from the manual....

Quote
8)   Lastly, you’ll need to configure your playlist (or some other panel) to show the data.

//this is what you use to display the play count.
[%LASTFM_PLAYCOUNT_DB%]

//show if a track is loved
$ifequal(%LASTFM_LOVED_DB%,1,♥,)


EDIT: doh, brutuz beat me to it.

@uberkrieg, you can set the variables by replacing lines 19 & 21

Code: [Select]
var username = "marc2003";

var api_key = "abcdef....";


i would be amazed if you got this running in WINE though.  if you do get it working, let me know how you did it.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #503
@uberkrieg, you can set the variables by replacing lines 19 & 21

Code: [Select]
var username = "marc2003";

var api_key = "abcdef....";


i would be amazed if you got this running in WINE though.  if you do get it working, let me know how you did it.


hey, thanks for your answer.
I tried that but it didn't work. I got the login information to work by copying the username and api_key files from a windows install to wine. now the script seems to be working but not completely. I can love/unlove songs in my playlist, but now the problem is the actual playcount doesn't seem to be working. I used database from the windows install after importing all the playcounts from my account on last.fm and they showed in foobar, but when I hit play and the script contacts last.fm,  it resets the playcount to 1 no matter what the previous number was. any ideas/suggestions? I'll keep investigating.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #504
so the script is contacting last.fm and getting a response? how did you get that far? i seem to remember the last time i tried WSH panel mod on foobar/WINE, i got all sorts of errors like "Automation server can't create object".

HOW TO: synchronise your last.fm playback stats with foobar

Reply #505
so the script is contacting last.fm and getting a response? how did you get that far? i seem to remember the last time i tried WSH panel mod on foobar/WINE, i got all sorts of errors like "Automation server can't create object".


WSH seems to be working without that much fixing around. at least it loads this script. I did get a lot of crashes during the first attempts of running it but it was because the script was looking for a registry key that wasn't there, so after creating it, it worked. the script "seems" to be contacting last.fm but I'm not really sure. I think the love/unlove part works because its based on soft playlists and that plugin works flawlessly as far as I know, so I'm not sure who is actually doing the last.fm contact there. when it comes to the actual play count update, it says its contacting last.fm and getting a response but it resets the playcount to 1 so I'm not really sure whether the contact is being made or the script things its being made and that's why it keeps reseting the playcount to 1.

if there's anyone else interested in getting this working under wine what I've managed to do so far is doing the complete library update in windows (you have to have access to your library from both win and linux) and getting all your playcounts from last.fm. then copy that database to your linux install and use the masstagger to import those playcounts to %play_count% or any other tag you prefer BEFORE actually playing your files because as you play them, this script is going to reset those play counts you imported from window back to 1.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #506
hello marc2003, it's seem that the last sync script has something wrong with me.
i added those line like you said.
http://www.hydrogenaudio.org/forums/index....mp;#entry742331
http://www.hydrogenaudio.org/forums/index....mp;#entry743685

the last.fm playcount and love/unlove still doesn't work . The last.fm system is fine, when i played a song, then import sql again, and the %LASTFM_PLAYCOUNT_DB% increase, but the tag doesnt change.

picture with console:
playcount : http://img265.imageshack.us/img265/4825/11796623.png
love/unlove : http://img593.imageshack.us/img593/7358/45464662.png

i guess this error happend when replace old tag %LASTFM_PLAYCOUNT_DB% and %LASTFM_LOVED_DB%

my component :
foo_customdb.dll (2009-05-09 12:17:06 UTC)
    Custom Database 0.0.9a

foo_softplaylists.dll (2011-02-04 21:04:50 UTC)
    Soft Playlists 2011-02-05

foo_uie_wsh_panel_mod.dll (2011-01-08 08:11:34 UTC)
    WSH Panel Mod 1.4.2

HOW TO: synchronise your last.fm playback stats with foobar

Reply #507
there is a newer version of foo_customdb - you could try that. http://blog.99ravens.net/index.php?e=283

and are you sure you've followed this from the readme? i don't know what else it could be.

Quote
Usage:

Note: Do not hide Last.fm or Legacy commands (unsorted) in your context menu options. The script needs these enabled to work.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #508
Quote
Note: Do not hide Last.fm or Legacy commands (unsorted) in your context menu options. The script needs these enabled to work.

arrhh it's clear the problem 

thanks you for your great work! 

HOW TO: synchronise your last.fm playback stats with foobar

Reply #509

Your screenshot isn't very clear (shouldn't have shrunk it). This may sound silly, but since I couldn't get a clearer picture I'll ask:
1- Are you using "%LASTFM_PLAYCOUNT_DB%" vlaue to display the count?
2- You understand that the counts are stored for each track individually on CustomDB. Therefore if you are referring to the "album playcount" on the Facets, which probably counts by the built-in Playback Satistics Plugin, it will completely disregard the Last.fm statistics unless you import them to Statistics tags in the files or have any way to make it read the "%LASTFM_PLAYCOUNT_DB%" value intead of standard %play_count%.

Sorry if any of this sound obvious to you, but there is no way to know how deep you understand the program without asking these, just trying to help.



Yes, right, my bad. I forgot to mention that I'm a Foobar noob. I've only been using it for about a month or two. Nothing sounds too obvious to me.

I was under the impression that the script would update the playcount meta tag that is used within the file viewer (or within facets or any other playlist viewer) by itself.

I've implemented the custom playlist columns, and I had to redo step 3 of the tutorial to get it working.But it is working now.


Thanks

HOW TO: synchronise your last.fm playback stats with foobar

Reply #510
@uberkrieg & @marc2003: I don't mean to fiddle with the pro's stuff, but couldn't that last bug be caused by the SQLite calls? I mean, does that SQLite client work under WINE? Maybe it doesn't but there probably is an alternative, or is just a matter of fiddling wwith settings. Or maybe i'm just saying bs, so i'll shut up now 

@maeldum: Glad I could help somehow

HOW TO: synchronise your last.fm playback stats with foobar

Reply #511
i don't believe it..... i tried it and it works. i did have to install a lot of stuff through a script called winetricks to get me started though.



@uberkrieg, did you make sure sqlite3.exe inside the "marc2003" folder is executable?

HOW TO: synchronise your last.fm playback stats with foobar

Reply #512
i don't believe it..... i tried it and it works. i did have to install a lot of stuff through a script called winetricks to get me started though.



I tried that but it makes no difference, I'm still getting my play counts reset to 1. was about to do a clean wine install and start from scratch to see if that made any difference, but I'm going to put that on hold until I get what you did. 

HOW TO: synchronise your last.fm playback stats with foobar

Reply #513
this is how i got it working on ubuntu 10.10. i deleted my .wine folder and tested again to be sure....

1) run the "configure tool" so your wine folder gets created again.
2) download and save this as "winetricks" http://www.kegel.com/wine/winetricks
3) open a terminal and navigate to where you saved the above file and run

sh winetricks

4) select these packages

gdiplus
ie6
msxml3
winhttp
wininet
wsh56

5) copy your foobar2000 folder to somewhere on the wine c drive. make sure foobar2000.exe is executable (likewise for sqlite3.exe inside the "marc2003" folder)
6) that's it.

BTW, i use columns UI because i find default UI redrawing of panels/toolbars to be very glitchy.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #514
this is how i got it working on ubuntu 10.10. i deleted my .wine folder and tested again to be sure....

1) run the "configure tool" so your wine folder gets created again.
2) download and save this as "winetricks" http://www.kegel.com/wine/winetricks
3) open a terminal and navigate to where you saved the above file and run

sh winetricks

4) select these packages

gdiplus
ie6
msxml3
winhttp
wininet
wsh56

5) copy your foobar2000 folder to somewhere on the wine c drive. make sure foobar2000.exe is executable (likewise for sqlite3.exe inside the "marc2003" folder)
6) that's it.

BTW, i use columns UI because i find default UI redrawing of panels/toolbars to be very glitchy.


you are a god among men my friend. I can confirm that this works perfectly. thanks you very very much.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #515
one thing i forgot to mention incase anybody else wants to try this and that's how to get around this....

I did get a lot of crashes during the first attempts of running it but it was because the script was looking for a registry key that wasn't there


just open "marc2003\common.js" in a text editor and on line 349, replace

Code: [Select]
var font = WshShell.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName") == "Microsoft Windows XP" ? "Tahoma" : "Segoe UI";


with this...

Code: [Select]
var font = "Tahoma";


(the line could be commented out as it's not required for this script but i've left it in because i've got all my other last.fm related scripts running as well)

HOW TO: synchronise your last.fm playback stats with foobar

Reply #516
Ive just tried creating a column that will show loved tracks using esplaylist. I used the
"//this is what you use to display the play count.
[%LASTFM_PLAYCOUNT_DB%]

//show if a track is loved
$ifequal(%LASTFM_LOVED_DB%,1,♥,) "

but nothing is showing in the column. This code works flawlessly with NGplaylist. Any sugestions?

HOW TO: synchronise your last.fm playback stats with foobar

Reply #517
all i can say is..."you're doing it wrong". if it works in one component then it must work everywhere else.....

FWIW, i use EsPlaylist myself...


HOW TO: synchronise your last.fm playback stats with foobar

Reply #518
I had to change the fonts to Unicode and now it is working.
Thanks Marco, you're the best

HOW TO: synchronise your last.fm playback stats with foobar

Reply #519
Hello. Looked around for other reports of this, did the whole procedure twice, but got this console error both times:

'settings_path' is undefined

..Am I doing something dumb?

HOW TO: synchronise your last.fm playback stats with foobar

Reply #520
oops, it looks like i've stuffed up the readme file by deleting something i shouldn't have.

you need to extract the "marc2003" folder from the zip into your foobar profile folder.

standard install: %appdata%\foobar2000
or inside the main foobar folder if portable

i'll get the corrected readme uploaded ASAP. 

edit: fixed version uploaded and apologies for the confusion.

HOW TO: synchronise your last.fm playback stats with foobar

Reply #521
Thanks! Worked!

HOW TO: synchronise your last.fm playback stats with foobar

Reply #522
Marc, I can't possibly ask you to do this but... Would you be able to give me your latest version of this script with file tag writing instead of foo_customdb?

The version I had been using seems to be broken. If you don't have time, I perfectly understand, as I can't expect you to coddle one user that likes to do things differently.


HOW TO: synchronise your last.fm playback stats with foobar

Reply #524
you've caught me in a good mood. i'll have a go at it later on.