Skip to main content

Topic: HOW TO: synchronise your last.fm playback stats with foobar (Read 269407 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #975
short answer: not possible with an existing last.fm account/foobar
slightly longer answer: you can import playcounts from WMP, winamp or itunes into a brand new last.fm account using the official software http://www.last.fm/help/faq?category=93#235


  • Kougeru
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #976
Lately it's not syncing my plays properly, even after doing a manual update. It's always a few plays behind for some reason. The exception is when I get a new song. It updates from 0 to 1, and sometimes to 2. But after 2 it pretty much stays at 2 plays on lastfm playcount despite lastfm itself showing 5+, and foo_playcount is updating properly as well. Right-clicking and using "customdb refresh" turns it into "?" until I highlight it, in which it turns back to the same incorrect number it was displaying prior. Any idea? I checked for updates on each component and the script as well, everything is Gold. Out of 15 new tracks I got, one of them is displaying properly. Older songs are 5-10 plays behind.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #977
what does the foobar console say? (view menu>console) when working, it should report 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: Playcount updated successfully.

  • Godly
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #978
I've been having similar problems to Kougeru. This is the error I get from the console:

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: Database error. Playcount not updated.



an example of the problem I'm having: http://i.imgur.com/5bcpgTD.png




  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #979
Code: [Select]
Last.fm Playcount Sync: Database error. Playcount not updated.


ok.... a few questions...

is this happening on everything now or is it intermittent?
does it happen on certain tracks only or is it random?
are you using foo_customdb for anything else apart from this script?

i've not changed any functionality but i've added some extra logging into this script. save this in your marc2003 folder while foobar is closed...

https://dl.dropboxusercontent.com/u/2280132...0log/common7.js

it should output something like 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: Old value: 17
Last.fm Playcount Sync: New value: 18
Last.fm Playcount Sync: Attempt: 1
Last.fm Playcount Sync: Attempt: 2
Last.fm Playcount Sync: Playcount updated successfully.



  • Godly
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #980
-It was happening on everything. I'm not sure how long it had been like that though.
- ^
- I don't use customdb for anything else besides this.

I've downloaded your new file and put it in the folder. I've since tested 5 tracks (including the one I mentioned above) and all of them were succesfully updated. This is the code I got from the above track:


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: 12
Last.fm Playcount Sync: Attempt: 1
Last.fm Playcount Sync: Playcount updated successfully.


It is also now updating other tracks that it previously hadn't been. Seems to be fixed. Thanks.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #981
i did make a change to the code after i posted that i thought might help and it looks like it's working. therefore i've put the fix in my main script. anyone can right click their panel>Update script. the extra logging has been removed because there's no need to spam the console with it.
  • Last Edit: 04 March, 2014, 11:40:26 AM by marc2003

  • Kougeru
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #982
i did make a change to the code after i posted that i thought might help and it looks like it's working. therefore i've put the fix in my main script. anyone can right click their panel>Update script. the extra logging has been removed because there's no need to spam the console with it.


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: Database error. Playcount not updated.
Last.fm Playcount Sync: Automatically loving this track....
Last.fm Playcount Sync: Attempting to love "Cupid (So Far...ver)" by "LAMA"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Track loved successfully.


I did what you said, to no avail. Does that other script still work with the extra logging? I didn't get a chance to try it because hydrogen only emailed me for the post I just quoted.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #983
if you right clicked your panel and it updated ok after my last post then you have the supposedly "fixed" script.

if you're still getting this error...

Code: [Select]
Last.fm Playcount Sync: Database error. Playcount not updated.


all you're missing is the attempt 1, 2, 3, 4, 5 in the console. it means the playcount is fetched ok but something is preventing my script from updating foo_customdb. it's always been bit of a hack job because i do it "outside" of foobar using a command line tool called sqlite. i've set it to try 5 times before it gives up. in my own testing i've seen it take 2 attempts but it's mostly 1. i made it 5 just for good luck.

are you using foo_customdb for anything else or just this script? is it now failing on everything that has an existing last.fm playcount?

edit: the logging code is still in the script - you can un-comment lines 2799, 2800 and 2806 but it shouldn't make any difference.
  • Last Edit: 04 March, 2014, 02:02:04 PM by marc2003

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #984
i've now updated the script with an Extended logging option and this is found under the Auto-updates menu.



it's off by default because it spams the console but if you want to see the old/new values and how many attempts it takes, you can enable it.

right click panel>Update script. restart foobar when prompted.

  • DustMagnet
  • [*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #985
Interesting. The update fixes a problem I didn't even realize I had until I read the last few posts. 
That's so plausible, I can't believe it.

  • Kougeru
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #986
edit: Alright I figured it , I think. I reinstalled the plugin and it's working now. I think it might've broke when I removed the custom DB Action "Delete Playcount" because it sounded scary. Coding is beyond my field of knowledge, so I guess I shouldn't mess with it. Thanks for your time and help.
  • Last Edit: 04 March, 2014, 06:32:22 PM by Kougeru

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #987
think it might've broke when I removed the custom DB Action "Delete Playcount" because it sounded scary.


yes, that most definitely did break it. it's not possible to update a playcount in place so i have to delete the old one first. hopefully it will be ok now. 

  • Last Edit: 04 March, 2014, 07:16:54 PM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #988
I want to make the switch from last.fm to libre.fm. I figured out how to make all my players -- including foobar2000 -- scrobble to libre.fm. Specifically, for foobar this entails entering 149.20.54.250 (http://turtle.libre.fm) as a proxy in Preferences -> Networking.

Can this plugin/script be made compatible with libre.fm?

(I think I could possibly test this myself. But I don't want to screw up my current config so I'm hoping somebody who reads this post knows.)
  • Last Edit: 05 March, 2014, 09:34:12 AM by whitewidow

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #989
at first glance, i'd have to say no. their API doesn't offer the feeds that this script uses.

http://bugs.foocorp.net/projects/librefm/w...efm_API_methods

i need these...

track.getInfo - needed for the background playcount/loved track updates
library.getTracks - needed for importing playcount

there appears to be support for loving/unloving tracks and fetching all loved tracks but that's about it.

  • Godly
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #990
I'm having trouble again. It won't update the playcount on any of my tracks 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: 12
Last.fm Playcount Sync: New value: 13
Last.fm Playcount Sync: Attempt: 1
Last.fm Playcount Sync: Attempt: 2
Last.fm Playcount Sync: Attempt: 3
Last.fm Playcount Sync: Attempt: 4
Last.fm Playcount Sync: Attempt: 5
Last.fm Playcount Sync: Database error. Playcount not updated.


I've updated the script to the latest version but it's still the same

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #991
well i have no idea what else it could be. try a clean portable install? make sure you copy files from the latest zip and not your current install.
  • Last Edit: 05 March, 2014, 05:58:49 PM by marc2003

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #992
if anyone has updated since the 4th (2 days ago), they should update again as i introduced a silly bug with my spring cleaning. it would set a playcount of 1 for tracks if the track length is not acceptable by last.fm (less than 30 seconds or more than 3 hours).

right click panel>Update script.

HOW TO: synchronise your last.fm playback stats with foobar
Reply #993
Heyho!

i have to import ~750 pages and i'm always getting problems with the last.fm web service.. maybe they are blocking me because of the many requests? Any way to slow down the process? hank you for your great script! mostly it's around page 240  here's a screenie

https://www.dropbox.com/s/6u78ppvrrkj1hqj/S...%2013.03.45.png
  • Last Edit: 10 March, 2014, 08:04:39 AM by Der Internet

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #994
if it was being blocked, i think the error would say so. also, we're allowed 5 requests per second which this script will never be in danger of passing.

as you have a fairly large library, you could try downloading your entire scrobbling history from this page: http://www.last.fm/settings/dataexporter

then you can run this entirely separate script on it: https://dl.dropboxusercontent.com/u/2280132...port/export.txt

having my original script in place means you should already have the files it needs. it may take a day or so to get the data from last.fm. also, you should edit the first 3 lines of code so that only the play_count option is set to true.

edit: if you what you say it failing at the same point each time is true, i really ought to have my script skip that page and trying to continue rather than aborting. i'll look at updating that as well.
  • Last Edit: 10 March, 2014, 08:16:20 AM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #995
if it was being blocked, i think the error would say so. also, we're allowed 5 requests per second which this script will never be in danger of passing.

as you have a fairly large library, you could try downloading your entire scrobbling history from this page: http://www.last.fm/settings/dataexporter

then you can run this entirely separate script on it: https://dl.dropboxusercontent.com/u/2280132...port/export.txt

having my original script in place means you should already have the files it needs. it may take a day or so to get the data from last.fm. also, you should edit the first 3 lines of code so that only the play_count option is set to true.


Thank you for your ultrafast repsonse  sadly , i'm not as good as computer stuff as i pretend to be  where do i have to put that file/insert the script?

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #996
when you get the data from last.fm, it will arrive as a zip. you just need to extract the files somewhere. as for that script above, i did actually forget to tell you how it works.  it goes in a new panel and then you close the editor. it's just a plain white panel with no interface. just double click to run it and a file browser will popup and you need to browse to a folder called scrobbles. this will be inside the folder than you extracted from the last.fm zip file. it takes a second or 2 to run and then make sure you follow the prompt from the popup window when it's done.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #997
edit: if you what you say it failing at the same point each time is true, i really ought to have my script skip that page and trying to continue rather than aborting. i'll look at updating that as well.


i've updated the script to skip all problematic pages instead of aborting. it keeps track of how many pages have errors and will report that when it's finished.

right click>Update script.

full download: https://dl.dropboxusercontent.com/u/2280132...ount%20sync.zip


HOW TO: synchronise your last.fm playback stats with foobar
Reply #998
Nice... now it worked! Thanx a lot, may your offspring be countless like grains of sand 

  • Zageron
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #999
I'm not sure if this has been reported before, and I'm not sure if this is something you are able to fix.
However,

Code: [Select]
Custom Database: library routine called out of sequence (21)
Custom Database: library routine called out of sequence (21)
Custom Database: library routine called out of sequence (21)
Custom Database: library routine called out of sequence (21)
Custom Database: library routine called out of sequence (21)
Custom Database: library routine called out of sequence (21)
Custom Database: library routine called out of sequence (21)
Custom Database: unknown error (21)


This occurs when I sort on Plays.
The playlist is populated by 4872 songs. Though the other playlists I have, 22140 and 15853, unsurprisingly react the same way.

Additionally, while when I sort on any other tag the sort is generally instant if I sort on heart or play there is a significant delay of between half a second to a few seconds depending on the size of the playlist.

This is most definitely caused by the custom database plugin, but I'm wondering if anyone else has experienced this and if it's possible to fix from your end.