Skip to main content

Topic: HOW TO: synchronise your last.fm playback stats with foobar (Read 269479 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 #775
first of all, this post is in the wrong thread. it should be in this one.

and i know i've not documented this, but this part of the error....

Code: [Select]
File: <main>


means line 15 of the script in the panel itself - not the common6.js file.

and from a glance i think it's related to a change i made a few weeks back. download the full samples.zip and import the last.fm charts.txt file again.

link: http://db.tt/BInQ3Abm

  • juso
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #776
Hello marc2003, thanks for the explanation - I have downloaded the full samples.zip and re added everything, I now get no error - but I still can't seem to display anything. I have posted the issues I'm experiencing in the other thread that you have mentioned,

Cheers, juso

HOW TO: synchronise your last.fm playback stats with foobar
Reply #777
Sometimes (about 10-20% of the time) the LASTFM_PLAYCOUNT_DB field is increased twice during a single play. Did I configure something wrong? Last.fm shows I only scrobbled it once, but the field is updated twice.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #778
are you sure only one instance of the panel exists in your layout? and even if there were duplicate requests, it would not affect playcount data. this is because a scrobble does not count until the track has finished. so even if there were multiple queries, the result would always be the same - of course i add 1 to increment the playcount but no matter how many times this were to happen, it would not increment by more than 1.

please describe exactly what you are seeing.
  • Last Edit: 27 February, 2013, 01:41:19 PM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #779
are you sure only one instance of the panel exists in your layout? and even if there were duplicate requests, it would not affect playcount data. this is because a scrobble does not count until the track has finished. so even if there were multiple queries, the result would always be the same - of course i add 1 to increment the playcount but no matter how many times this were to happen, it would not increment by more than 1.

please describe exactly what you are seeing.

I've only noticed it happening with songs that initially have zero playcounts (new to my library, and have not been scrobbled before). It might be happening to other songs, but I haven't noticed yet. It doesn't happen to every song with zero playcounts, just some.

I play the song in foobar. It gets to 50% duration, and the playcount increases from 0 to 2 instantly.

Console outputs this:

Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Last.fm responded 'OK'

If I play the same song again, it only increases once, to 3.

I am pretty certain I don't have multiple instances of the panel in my layout. I use the mnlt2 skin with the panel on it's own tab:


  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #780
Quote
and the playcount increases from 0 to 2 instantly.


sorry but i'm more inclined to think you are mistaken and last.fm already has a playcount of 1 stored for that track. login to the website and browse the Library section.

http://www.last.fm/user/YOU/library

browse for the artist/track and it will show the time and date of each individual scrobble.
  • Last Edit: 27 February, 2013, 02:17:53 PM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #781
Quote
and the playcount increases from 0 to 2 instantly.


sorry but i'm more inclined to think you are mistaken and last.fm already has a playcount of 1 stored for that track. login to the website and browse the Library section.

http://www.last.fm/user/YOU/library

browse for the artist/track and it will show the time and date of each individual scrobble.


This is the test track I played which I've previously never scrobbled







  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #782
well i'm just more confused now. 

because it's not just screwing up on the first play but on subsequent plays as well. the fact that playcounts are out of whack after playback has finished is not good either and i can't explain it - well other than the scrobble failing and getting stuck in the cache.

i still can't get how my script would fail in this way.

it's just one line of code that handles this. although it might be a bit confusing, this is simply a shorthand if/or statement....

Code: [Select]
this.userplaycount = this.parsed_data.track.userplaycount > 0 ? ++this.parsed_data.track.userplaycount : 1;


i check if the playcount is more than 0 (has been played) and i increment it by 1 if it has. if it hasn't i don't increment 0 to 1 by adding - i set the value of 1 directly as can be seen by the 1 after the colon at the end. using this method, it's impossible to jump from 0 to 2 on the first play.

HOW TO: synchronise your last.fm playback stats with foobar
Reply #783
Is the only explanation that I might have it installed twice? Still doesn't explain why it happens to only some songs and not others. I still haven't confirmed if it only happens to new songs, or if it happens to existing ones as well.

Could it be a conflict with other components?

These are my installed components:

Core (2012-12-28 12:23:58 UTC)
    foobar2000 core 1.2
foo_abx.dll (2012-07-15 05:00:36 UTC)
    ABX Comparator 1.3.4
foo_ac3.dll (2012-11-01 14:01:38 UTC)
    AC3 decoder 0.9.7
foo_albumlist.dll (2012-12-28 12:22:20 UTC)
    Album List 4.5
foo_audioscrobbler.dll (2008-05-13 21:36:16 UTC)
    Audioscrobbler 2.3.1
foo_cdda.dll (2012-12-28 12:21:56 UTC)
    CD Audio Decoder 3.0
foo_comserver2.dll (2006-07-31 19:13:20 UTC)
    COM Automation server 0.7 alpha 6
foo_converter.dll (2012-12-28 12:22:04 UTC)
    Converter 1.5
foo_customdb.dll (2013-02-15 23:03:38 UTC)
    Custom Database 0.0.9a
foo_dsp_eq.dll (2012-12-28 12:22:34 UTC)
    Equalizer 1.0
foo_dsp_soundtouch.dll (2012-01-06 20:38:14 UTC)
    SoundTouch DSP 1.1
foo_dsp_std.dll (2012-12-28 12:22:18 UTC)
    Standard DSP Array 1.2
foo_fileops.dll (2012-12-28 12:21:36 UTC)
    File Operations 2.2
foo_freedb2.dll (2012-12-28 12:20:38 UTC)
    Online Tagger 0.7
foo_input_monkey.dll (2012-11-01 14:01:38 UTC)
    Monkey's Audio Decoder 2.1.6
foo_input_std.dll (2012-12-28 12:21:48 UTC)
    Standard Input Array 1.0
foo_jesus.dll (2010-12-30 03:05:26 UTC)
    Autosave & Autobackup 10
foo_masstag.dll (2009-09-18 16:01:36 UTC)
    Masstagger 1.8.4
foo_playcount.dll (2011-10-17 02:26:26 UTC)
    Playback Statistics 3.0.2
foo_playlist_revive.dll (2012-10-02 17:19:55 UTC)
    Playlist Revive 0.2
foo_quicksearch.dll (2012-11-01 14:01:38 UTC)
    Quick Search Toolbar 3.4
foo_rgscan.dll (2012-12-28 12:21:32 UTC)
    ReplayGain Scanner 2.1.2
foo_run.dll (2009-06-07 21:15:18 UTC)
    Run services 0.3.7
foo_softplaylists.dll (2013-02-15 23:02:40 UTC)
    Soft Playlists 2011-02-05
foo_texttools.dll (2010-09-01 22:39:37 UTC)
    Text Tools 1.0.5
foo_ui_columns.dll (2010-05-03 13:38:32 UTC)
    Columns UI 0.3.8.6
foo_ui_std.dll (2012-12-28 12:22:32 UTC)
    Default User Interface 0.9.5
foo_uie_albumart.dll (2007-10-24 05:39:18 UTC)
    Album Art Panel 0.2.7
foo_uie_albumlist.dll (2009-06-13 22:49:19 UTC)
    Album list panel 0.3.5
foo_uie_console.dll (2009-08-29 16:06:24 UTC)
    Console panel 0.4
foo_uie_elplaylist.dll (2010-10-23 05:05:52 UTC)
    ELPlaylist 0.6.9.1(beta)
foo_uie_panel_splitter.dll (2009-12-09 16:16:12 UTC)
    Panel Stack Splitter 0.3.8.3(alpha)
foo_uie_typefind.dll (2007-10-22 21:30:44 UTC)
    Typefind 0.2 beta 2
foo_uie_vis_peakmeter_spectrum.dll (2008-04-20 03:18:50 UTC)
    Peakmeter Spectrum Visualisation 0.2.0.0 beta
foo_uie_wsh_panel_mod.dll (2013-02-15 23:02:02 UTC)
    WSH Panel Mod 1.5.6
foo_unpack.dll (2012-12-28 12:21:06 UTC)
    ZIP/GZIP/RAR Reader 1.6
foo_upnp.dll (2013-02-15 23:01:30 UTC)
    UPnP/DLNA Renderer, Server, Control Point 0.99.45
foo_verifier.dll (2009-10-05 18:39:20 UTC)
    File Integrity Verifier 1.1

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #784
Quote
foo_audioscrobbler.dll (2008-05-13 21:36:16 UTC)
Audioscrobbler 2.3.1

well that's the official last.fm scrobbler. i blame them. perhaps they are submitting before the track has finished playing which goes against their own specifications (well not now it seems). ditch it and use this....

http://mp3tag.de/en/fb2k.html

edit: i'm sure they've relaxed their own guidelines because now it says.....

Quote
When is a scrobble a scrobble?

A track should only be scrobbled when the following conditions have been met:

   The track must be longer than 30 seconds.
   And the track has been played for at least half its duration, or for 4 minutes (whichever occurs earlier.)

As soon as these conditions have been met, the scrobble request may be sent at any time. It is often most convenient to send a scrobble request when a track has finished playing.

i'm sure that wasn't the case before and it certainly conflicts with the way my script works.
  • Last Edit: 27 February, 2013, 03:47:11 PM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #785
Edit: ^^ okay, makes sense. There's definitely a conflict then.

The official scrobbler scrobbles at 50% of the track's duration by default, doesn't it?



Shouldn't your script be compatible with the official scrobbler?

  • Last Edit: 27 February, 2013, 03:22:11 PM by iamthejeff

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #786
Shouldn't your script be compatible with the official scrobbler?


nope, everyone around here uses Florian's component. you're the first with this complaint.

if i did add support i'd have to complicate things by telling people not to touch that slider. i'm kind of reluctant really but i can tell you how to edit your own script. it'll have to be later on as i'm about to watch something on TV.

HOW TO: synchronise your last.fm playback stats with foobar
Reply #787
Shouldn't your script be compatible with the official scrobbler?


nope, everyone around here uses Florian's component. you're the first with this complaint.

if i did add support i'd have to complicate things by telling people not to touch that slider. i'm kind of reluctant really but i can tell you how to edit your own script. it'll have to be later on as i'm about to watch something on TV.


Okay, I'm fluent with javascript so if you could give me some modifications later, that'd be great. Thanks.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #788
just about got time now. use a text editor with line numbering support and open your foobar profile\marc2003 folder and open common6.js

find line 2134...

change it to...

Code: [Select]
this.target_time = 5 + Math.min(Math.floor(fb.PlaybackLength / 2), 240);


this tells my script when to run - i'm just adding a few seconds to let the scrobbler do it's thing.

line 2202 should become

Code: [Select]
this.userplaycount = this.parsed_data.track.userplaycount;


i'm not sure this is enough to withstand errors so let me know how you get on. after saving the file, make sure you reload the panel so it picks up the changes.
  • Last Edit: 27 February, 2013, 03:57:09 PM by marc2003

  • kelmorn
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #789
Just had the same problem with last.fm playcount increasing by 2.

As above appears to be linked to use of last.fm's 'official' scrobbler. I've always set it to submit at 70% but this afternoon knocked it down to 50% and the problem started. It's back up at 70% now so I'm ok

And while I'm posting, thanks for creating this tool.

(Just spotted I've been a member for nearly six years and this is my first post  )
  • Last Edit: 27 February, 2013, 06:54:02 PM by kelmorn

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #790
heh, such a simple workaround. i really should have thought of that.

i'll update the readme incase anyone else wants to use the official scrobbler.

HOW TO: synchronise your last.fm playback stats with foobar
Reply #791
Thanks for the update. I also changed my scrobbler to scrobble at 70% and it appears fixed.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #792
don't change the code AND increase the slider. that will have the side effect of not incrementing the playcount at all. the track won't get scrobbled until after my script has run and the modification writes the current (soon to be old) value into the database.

do one or the other. i think reverting the code change and increasing the slider is the best bet.


HOW TO: synchronise your last.fm playback stats with foobar
Reply #793
i think reverting the code change and increasing the slider is the best bet.

that's what I did. And it means I'll be able to use future versions of the script without having to re-implement the hack

  • joelzhao
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #794
@marc2003:
Recently I found console says "Obsolete: Please use AppendTo() method to create sub menu instead of AppendMenuItem()", it used in common6.js. Would you have any plan to update it?

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #795
i already did that..... in october 2011. 

https://dl.dropbox.com/u/22801321/playcount%20sync.zip

make sure you extract the marc2003 folder again AND import the new script.

EDIT: you should quickly check your settings on the context menu as i've changed a few things since then. and if it crashes, right click on the panel and select properties>clear. all your existing playcount data will be untouched as that hasn't changed.
  • Last Edit: 04 March, 2013, 03:58:01 AM by marc2003

  • crshd
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #796
Everything worked fine until yesterday, and all of a sudden the panel keeps crashing. I didn't change anything, but just to make sure I set everything up from scratch, re-installed components, made sure I used the newest version of the script... 

Quote
WSH Panel Mod (Last.fm Playcount Sync v6.2013-01-23.01 by marc2003): Parsing file "C:\Program Files (x86)\foobar2000\marc2003\common6.js"
Error: WSH Panel Mod (Last.fm Playcount Sync v6.2013-01-23.01 by marc2003): Microsoft JScript runtime error:
Object required
File: C:\Program Files (x86)\foobar2000\marc2003\common6.js
Ln: 87, Col: 3
<source text only available at compile time>


EDIT Applied one of my infamous duct-tape style fixes - commented line 87. Seems to work for now.
  • Last Edit: 10 March, 2013, 07:14:10 AM by crshd

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #797
when you updated the script, you didn't update WSH panel mod at the same time. that line of code points to a feature that doesn't exist in older versions.

get the latest here: http://code.google.com/p/foo-wsh-panel-mod/downloads/list

the readme does state what version of WSH panel mod is required but i guess only new users would check that. i'll have to put an extra notice in the zip.

edit: the new file is in the zip and it reads as follows:

Quote
The current script requires WSH panel mod version 1.5.0 or above.

The latest version 1.5.6 is available here:

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

You can check your component version by looking at
File>Preferences>Components>WSH panel mod.

Also, if you've made any changes to the default settings, check
the right-click menu to see if they're all intact. Some settings
may be lost during the upgrade as I've changed the way some
of them are stored.

Your username will still be intact and of course all playcount
data will remain exactly the same as before. There have been
no changes as far as that is concerned.

And from now on, you can check for the latest version simply
by right clicking the button and selecting "Update script".
  • Last Edit: 10 March, 2013, 07:18:53 AM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #798
Everything worked fine until yesterday, and all of a sudden the panel keeps crashing. I didn't change anything, but just to make sure I set everything up from scratch, re-installed components, made sure I used the newest version of the script... 

Quote
WSH Panel Mod (Last.fm Playcount Sync v6.2013-01-23.01 by marc2003): Parsing file "C:\Program Files (x86)\foobar2000\marc2003\common6.js"
Error: WSH Panel Mod (Last.fm Playcount Sync v6.2013-01-23.01 by marc2003): Microsoft JScript runtime error:
Object required
File: C:\Program Files (x86)\foobar2000\marc2003\common6.js
Ln: 87, Col: 3
<source text only available at compile time>


EDIT Applied one of my infamous duct-tape style fixes - commented line 87. Seems to work for now.


bump, same issue. Updated WSH to 1.5.6 but error persists. Duct tape fix works for now. Was upgrading from playcount sync.zip dated 2012-03-02.

Edit: Am running foobar with applocale + CUI with "Small Font 7pt". (since line 87 references some fonts, I thought I should give it a mention)
  • Last Edit: 10 March, 2013, 07:52:57 AM by jabberwocky_one

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #799
heh, your font is the culprit. if you look again, you'll see the error is different from before.

Object required tells me the component is out of date

but now it will say...

Unable to get value of the property 'Name': object is null or undefined

all i can do is "catch" this error and default to using another font instead. this doesn't even affect this script because it doesn't use fonts - it's just a shared function with all my other scripts that do.

edit: Now fixed. Use Update script on the right click menu and restart foobar when prompted. the console will report when it detects font names it can't read. it defaults to Segoe UI instead. i'll try and investigate further as to why this happens.
  • Last Edit: 10 March, 2013, 08:15:13 AM by marc2003