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 384074 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 #1025
Hello! So, I've been using your artwork panel and last.fm biography scripts for a while now, and decided to try this one out since it seemed promising. The problem is, though, I can't get it to stop crashing. It launches all right, but after a few minutes, it's down (The script itself, not foobar). This is what pops into the console when it does:

Code: [Select]
Last.fm Playcount Sync: Contacting Last.fm.... 
Last.fm Playcount Sync: Last.fm responded ok. Attempting to update playcount...
Error: WSH Panel Mod Plus (Last.fm Playcount Sync by marc2003): The system cannot find the file specified.  File: E:\Cak3's Stuff\foobar2000\marc2003\common7.js
Ln: 2805, Col: 7
<source text only available at compile time>

Now, I have no experience at all with JScript, but I decided to look at the line it was referring to in the common7.js file. Using only what I can observe, yes, I do have "sqlite3.exe" in the marc2003 folder and "customdb_sqlite.db" in my foobar root folder. If more information helps, I'm running a portable installation of foobar on my external drive and am currently on Windows 8.1. The script says it's up to date. And, I don't know if this fact is related, but when I try importing my last.fm library, the console doesn't show any error, but the %LASTFM_LOVED_DB% tag doesn't seem to update or show any change, it only shows a song is one of my favorites if I add it through the interface itself. But it usually crashes not soon after, so I don't have time to wait to see if the favorites would just appear if I waited.

Well, sorry for the long-ish message. Anyways, any help would be appreciated

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

Reply #1026
sorry i didn't reply sooner, i completely missed your post. 

can you try replacing the line of code 2805 which is this...

Code: [Select]
p.WshShell.Run(p.fso.GetFile(p.script_path + "sqlite3.exe").ShortPath + " " + p.fso.GetFile(fb.ProfilePath + "customdb_sqlite.db").ShortPath + " " + query1, 0, true);


try this instead....

Code: [Select]
try {p.console(p.fso.GetFile(p.script_path + "sqlite3.exe").ShortPath);}catch(e){p.console("ShortPath fail on " + p.script_path + "sqlite3.exe");}
try {p.console(p.fso.GetFile(fb.ProfilePath + "customdb_sqlite.db").ShortPath);}catch(e){p.console("ShortPath fail on " + fb.ProfilePath + "customdb_sqlite.db");}
p.WshShell.Run(p.script_path + "sqlite3.exe" + " " + fb.ProfilePath + "customdb_sqlite.db" + " " + query1, 0, true);


post what the console says. for example, mine says this...

Code: [Select]
Last.fm Playcount Sync: Contacting Last.fm.... 
Last.fm Playcount Sync: Last.fm responded ok. Attempting to update playcount...
Last.fm Playcount Sync: E:\FOOBAR~1\marc2003\sqlite3.exe
Last.fm Playcount Sync: E:\FOOBAR~1\CUSTOM~1.DB
Last.fm Playcount Sync: Playcount updated successfully.

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

Reply #1027
Thanks for responding  Well, after replacing that line like you said, it now outputs this (It still crashes):

Code: [Select]
Last.fm Playcount Sync: Contacting Last.fm.... 
Last.fm Playcount Sync: Last.fm responded ok. Attempting to update playcount...
Last.fm Playcount Sync: Old value: ?
Last.fm Playcount Sync: New value: 11
Last.fm Playcount Sync: Attempt: 1
Last.fm Playcount Sync: E:\Cak3's Stuff\foobar2000\marc2003\sqlite3.exe
Last.fm Playcount Sync: E:\Cak3's Stuff\foobar2000\customdb_sqlite.db
Error: WSH Panel Mod Plus (Last.fm Playcount Sync by marc2003): The system cannot find the file specified.  File: E:\Cak3's Stuff\foobar2000\marc2003\common7.js
Ln: 2807, Col: 7
<source text only available at compile time>

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

Reply #1028
Code: [Select]
Last.fm Playcount Sync: E:\Cak3's Stuff\foobar2000\marc2003\sqlite3.exe 
Last.fm Playcount Sync: E:\Cak3's Stuff\foobar2000\customdb_sqlite.db


i'm confused by this. it should read like this or given an error about ShortPath. 

Code: [Select]
Last.fm Playcount Sync: E:\CAK3'S~1\FOOBAR~1\marc2003\sqlite3.exe 
Last.fm Playcount Sync: E:\CAK3'S~1\FOOBAR~1\CUSTOM~1.DB


i also realised i made an error with that last line of code. i forgot to use quotes around paths with spaces in. try this line instead...

Code: [Select]
p.WshShell.Run("\"" + p.script_path + "sqlite3.exe" + "\" \"" + fb.ProfilePath + "customdb_sqlite.db" + "\" " + query1, 0, true);


you can remove those 2 lines before it.

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

Reply #1029
I have a number of tracks that don't get their playcount updated even if the track is effectively scrobbled on Last.fm
Is there an issue? Is it possible to update playcounts for individual tracks? I dont know what Customdb refresh does but that doesn't seem to work (it removes the playcount)

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

Reply #1030
first of all, you should ignore the context menu items. they're not meant to be triggered manually - only by the script.

individual tracks should be updated as you play them - but nothing happens until you've played enough of it for it to count as a a scrobble.

you can view the foobar console to see what is going on as all success/failures are reported. you can even right click the heart icon>auto-updates>extended logging which shows more info.

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

Reply #1031
first of all, you should ignore the context menu items. they're not meant to be triggered manually - only by the script.

individual tracks should be updated as you play them - but nothing happens until you've played enough of it for it to count as a a scrobble.

you can view the foobar console to see what is going on as all success/failures are reported. you can even right click the heart icon>auto-updates>extended logging which shows more info.

I know I have to wait for 50% of the track to have been played but the problem doesn't seem to happen anymore, I don't know if I changed something.
I missed the extended logging options (didn't expect it to be where it was) thank you for pointing it out.

Another question: would it be possible to consider these 2 characters as the same: ' and ’ (single quote and apostrophe)

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

Reply #1032
Another question: would it be possible to consider these 2 characters as the same: ' and ’ (single quote and apostrophe)


i don't think there is any need for this. all you need to do is make sure you synchronise the Spelling correction settings on the last.fm website with the Last.fm auto-correct setting found under the auto-updates menu on my panel.

most people probably won't have changed their setting (the default is on) on the last.fm website so that's why it's on by default in my script. but if you have turned this option off on the website, then you do need to turn it off in the script as well.

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

Reply #1033
most people probably won't have changed their setting (the default is on) on the last.fm website so that's why it's on by default in my script. but if you have turned this option off on the website, then you do need to turn it off in the script as well.

I had turned it off on both last.fm and your script. That's why I'd like some old scrobbles to be recognized because ’ is the correct punctuation but ' is quite widely used.

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

Reply #1034
That's why I'd like some old scrobbles to be recognized


this is the problem. when you have spelling correction turned off on the website and in the script, everything has to be an exact match. if you start messing around with character replacement, it's all or nothing. the chances are that trying to pick a few tracks that you've since changed the tags of, you're going to break the lookups for everything else with an apostrophe. i just don't think it's feasible.

with the set of options you've chosen, you can either update your tags to match what's on the last.fm website  - but this could mean not being able to retrieve "new" scrobbles.

really, if you have combinations of the same tracks with different punctuation, i'd delete one of them completely. you can browse your library on the last.fm website to do this.

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

Reply #1035
I don't really mind.
I'll keep the correct version, auto-correct has an history of correcting things that are right.
Thank you for your answers.

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

Reply #1036
Well, it's been a while since I responded. It seemed to fix the error on that line, but another error popped out. Although, I seem to have found the solution. I realized that since it seemed to have a problem looking up the directory of the file(s), it probably had to do with the way the directory was formatted. If you look at the first folder, it's "Cak3's Stuff". When I remove foobar out of that directory and into the root of my hard drive, the script works 100%. This is only my guess, but it probably had some kind of syntax problems with the apostrophe and/or space in the folder name. Also, just for reference, this is the error I got before moving the foobar directory:

Code: [Select]
Last.fm Playcount Sync: Contacting Last.fm.... 
Last.fm Playcount Sync: Last.fm responded ok. Attempting to update playcount...
Last.fm Playcount Sync: Old value: ?
Last.fm Playcount Sync: New value: 1
Last.fm Playcount Sync: Attempt: 1
Error: WSH Panel Mod Plus (Last.fm Playcount Sync by marc2003): The system cannot find the file specified.  File: E:\Cak3's Stuff\foobar2000\marc2003\common7.js
Ln: 2789, Col: 7

Anyways, thanks for your help! 

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

Reply #1037
one of my previous posts shows i re-created your folder structure exactly and it still works for me without changing any code that's been working for years.

...but with your last post i just noticed this...

Quote
Error: WSH Panel Mod Plus


this looks like some modified component so i'm going to point the finger at that. Cak3's Stuff should work if you use the original component here...

https://code.google.com/p/foo-wsh-panel-mod/downloads/list

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

Reply #1038
one of my previous posts shows i re-created your folder structure exactly and it still works for me without changing any code that's been working for years.

...but with your last post i just noticed this...

Quote
Error: WSH Panel Mod Plus


this looks like some modified component so i'm going to point the finger at that. Cak3's Stuff should work if you use the original component here...

https://code.google.com/p/foo-wsh-panel-mod/downloads/list


I tried it with wsh-panel-mod-plus and it works fine so it would not be wshmp's fault.
By the way wshmp should be compatible with wshm 's scripts.
A rose will bloom, it then will fade.

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

Reply #1039
Hello there marc, it's been over 1 year since I last in the foobar2k modding community. Recently I've been thinking to revise my Nocturne skin here and decided to implement this WSH script of yours instead of modding the ones from musickarte.

So far everything looks good, both manual and auto love track. But I do noticed some errors as shown in the console log below while the script is trying to update the play count. Not sure what it means by database error as I put all the fields correctly as written in the README file.

Code: [Select]
Last.fm Playcount Sync: Contacting Last.fm.... 
Last.fm Playcount Sync: Last.fm responded ok. Attempting to update playcount...
Last.fm Playcount Sync: Old value:  
Last.fm Playcount Sync: New value: 2
Last.fm Playcount Sync: Attempt: 1
Last.fm Playcount Sync: C:\FOOBAR~1\marc2003\sqlite3.exe
Last.fm Playcount Sync: Attempt: 2
Last.fm Playcount Sync: C:\FOOBAR~1\marc2003\sqlite3.exe
Last.fm Playcount Sync: Attempt: 3
Last.fm Playcount Sync: C:\FOOBAR~1\marc2003\sqlite3.exe
Last.fm Playcount Sync: Attempt: 4
Last.fm Playcount Sync: C:\FOOBAR~1\marc2003\sqlite3.exe
Last.fm Playcount Sync: Attempt: 5
Last.fm Playcount Sync: C:\FOOBAR~1\marc2003\sqlite3.exe
Last.fm Playcount Sync: Database error. Playcount not updated.

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

Reply #1040
I tried it with wsh-panel-mod-plus and it works fine so it would not be wshmp's fault.
By the way wshmp should be compatible with wshm 's scripts.


you're probably right. i'd just run out of things to blame. i've never seen this error before and this same code has been working for everyone else for nearly 5 years.

Not sure what it means by database error as I put all the fields correctly as written in the README file.


so you're using foo_customdb for other things and you performed the manual steps to enter all the data fields/actions yourself?? i must admit, i've never really tested how nicely it plays when other foo_customdb values are present because everyone usually uses the "bare" .cfg file i've provided. if you could browse your profile\configuration folder and put your foo_customdb.dll.cfg file online, i'll take a look at it.

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

Reply #1041
Wow that was fast marc  Appreciate it.

I've uploaded the foo_customdb.dll.cfg file on Google Drive as requested here. Hope you can take a look at it. It's a very strange problem indeed.

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

Reply #1042
well, i've discovered the problem quite quickly. my script simply does not play nice with foo_customdb when other values are present. i have an idea of how to get around it but i'll need to do some testing.

all that stuff in my manual about entering stuff manually is nonsense and i'm sorry to have wasted your time with that. 


Wrong conclusion, please see below!

[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]moderation: edited at author's request.[/size]

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

Reply #1043
That's alright marc. It's impressive that you are still actively supporting this amazing plugin of yours. From the project that I've involved in, some developers would have discontinue supporting after few months or years, such as the MusicCabinet mod for Subsonic web streaming client. Well in my case, I've abandoned supporting my skin after the initial release but have decided to revise it since some people are interested with it :-)

Looking forward to hear your updates :-)

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

Reply #1044
actually i was wrong, my script does work ok with other customdb values. it's a typo in your entries that causes the errors. 

on the fields page for LASTFM_PLAYCOUNT_DB and LASTFM_LOVED DB there is no space between %artist%%title%

Code: [Select]
$crc32($lower(%artist%%title%))


i just double checked my pdf was right and it is so you must have typed rather than copy/paste.

edit: could a moderator put a strike through the text on post 1043 and add something like "see below" at the end of it.

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

Reply #1045
actually i was wrong, my script does work ok with other customdb values. it's a typo in your entries that causes the errors. 

on the fields page for LASTFM_PLAYCOUNT_DB and LASTFM_LOVED DB there is no space between %artist%%title%

Code: [Select]
$crc32($lower(%artist%%title%))


i just double checked my pdf was right and it is so you must have typed rather than copy/paste.

edit: could a moderator put a strike through the text on post 1043 and add something like "see below" at the end of it.


Hey there marc. Now that was a typical programming mistake to made. I must have overlooked it when I manually typed it. It works flawlessly now :-)

Code: [Select]
Last.fm Playcount Sync: Contacting Last.fm.... 
Last.fm Playcount Sync: Last.fm responded ok. Attempting to update playcount...
Last.fm Playcount Sync: Old value: 3
Last.fm Playcount Sync: New value: 4
Last.fm Playcount Sync: Attempt: 1
Last.fm Playcount Sync: C:\FOOBAR~1\marc2003\sqlite3.exe
Last.fm Playcount Sync: [b]Playcount updated successfully[/b].

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

Reply #1046
I'm trying to use this script and it appears to get my library successfully from last.fm (gets 105 pages, then the blue box pops up, i close foobar and a few seconds later foobar reopens) i set the playcount column to use "[%LASTFM_PLAYCOUNT_DB%]" and after doing this only the first track in my library is showing that it has any plays (it shows 10) every other track shows 0... i tried copying all the components/etc over again to make sure i didn't miss anything but i get the same result, any idea what could be causing this?

after some more investigation i see that my database only has 4 entries so it doesn't appear to be writing the data to the database, but it does show that its grabbing it in the console

after more testing i've noticed that when i play songs it does properly sync the database with last.fm, for example a song that had no plays goes to 5 plays after 1 play when there were already 4 plays on lasrt.fm, not sure if this helps at all.

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

Reply #1047
can you browse your foobar profile folder and look inside the wsh_lastfm folder. there should be a file named lastfm.sql - open it in wordpad or decent text editor (windows notepad won't show the line breaks). if there are thousands of entries, i can at least determine that the fetched data was saved ok but the problem is with the import. if you can confirm either way, i'll see what we can try next.

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

Reply #1048
Would it be possible to update the play count only for a couple of tracks? (If I listened to them on another device) I'd love to see the updated count in fb2k.

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

Reply #1049
not really. my script doesn't work with the recent scrobbles feed because it doesn't supply real playcount data - only the fact it has been played at a certain time. also, knowing how far to go back is another headache i don't really want to think about.