Skip to main content

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

0 Members and 1 Guest are viewing this topic.
  • enigmatik
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #700
Doesn't work. Deleted .wine dir and did everything again, doesn't work. Too bad.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #701
i just installed mint in vmware to see if could fix this.... and i did.

i found winetricks bundled with WINE didn't work so i used this from my earlier post: http://www.kegel.com/wine/winetricks

save it and then run from a terminal

Code: [Select]
sh winetricks


select

Code: [Select]
gdiplus
ie8
wsh57


now browse the marc2003 folder and edit common4.js in a text editor.

edit line 23 to become

Code: [Select]
font = "Tahoma";


comment out lines 401, 402 like so
Code: [Select]
//vb.Language = 'VBScript';
//var script_path = fb.ProfilePath + "marc2003\\";


i can't get input dialogs working so if you haven't already set the username and api key, you need to edit the script in the panel itself - lines 17 and 19...

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

var api_key = "123456....";


  • Last Edit: 01 March, 2012, 01:01:10 PM by marc2003

  • enigmatik
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #702
Thanks, but it still doesn't work, I can't believe this.

Error: WSH Panel Mod (Playcount Sync by marc2003): Microsoft JScript runtime error:
Automation server can't create object
File: Z:\media\4E362CDE362CC8B3\Dropbox\Applications\foobar2000-linux\marc2003\common4.js
Ln: 396, Col: 1
<source text only available at compile time>

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #703
not that it matters because your error is in a different place but i completely messed up the lines you needed to comment out (400&401)

Code: [Select]
//var vb = new ActiveXObject('ScriptControl');
//vb.Language = 'VBScript';
var script_path = fb.ProfilePath + "marc2003\\";  //this line 402 should not be commented out.


but as yours isn't working anyway, there's not much else i can do.
  • Last Edit: 01 March, 2012, 03:30:52 PM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #704
hallo marc2003,

now I have managed that your script works for my foobar installation.
Now I want to display this:

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

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


I use ELPlaylist. Do you have a configuration file for me so I also see the heart for loved songs in my playlists?

Thank you in advanced,

Andi

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #705
you can display a heart with the default font using that code inside a $drawtextex function.

or if you want a nice to display a heart image, you can use the $imageabs function. check the ELPlaylist readme for both functions.

i would post my ELPlaylist config but i'm away from home at the moment.
  • Last Edit: 27 March, 2012, 04:21:50 AM by marc2003

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #706
back at home now.. my ELPLaylist config...

Field definition tab
name: images
value: %el_user_profile_path%\marc2003\images

script>track list tab
$ifequal(%LASTFM_LOVED_DB%,1,$imageabs($sub(%el_width%,90),0,20,20,%images%\love_h_small.png,,,,),)

because you're using this script, that image should be in place already.

you'll probably want to tweak the first 2 numbers of the $imageabs function for placement.
  • Last Edit: 27 March, 2012, 07:27:44 AM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #707
Hy Marc,

thx for your fast reply. Unfortunately it doesn't work with your hint.
I don't see a heart for loved songs or a playcount. I think that I could made
a mistake because I don't have any experience in JavaScript (My home base is C).

Please can help me with the elplaylist config  .

Here is the script:
Code: [Select]
$if(%el_isplaying%,,

// track BG
$if($or(%el_selected%,%el_focused%),
    $gradientrect(0,0,%_ww_%,%el_height%,15-15-20,35-35-40,,)
    $drawrect(0,$sub(%_wh_%,1),%_ww_%,1,10-10-15,)
    $gradientrect(10,0,$sub(%_ww_%,20),1,0-0-0-0,0-0-0,horizontal,50)
    $drawrect(0,1,%_ww_%,1,35-35-40,)
    $gradientrect(0,$sub(%_wh_%,1),%_ww_%,1,40-40-45,45-45-50,horizontal,50)
,
    $gradientrect(10,0,$sub(%_ww_%,20),1,0-0-0-0,0-0-0,horizontal,50)
    $gradientrect(10,1,$sub(%_ww_%,20),1,0-0-0-0,40-40-45,horizontal,50)
)

// tracknumber or list index (when no header)
$font(%_txt_font_name_%, $sub(%_txt_font_size_%,2),)
$if(%queue_index%,
    $drawroundrect(%_tracknumber.x_%,$add(%_pad_top_%,1),$sub(%_tracknumber.w_%,8),15,2,2,47-127-47,0-0-0-160,)
    $gradientrect($add(%_tracknumber.x_%,2),$add(%_pad_top_%,3),$sub(%_tracknumber.w_%,11),13,67-167-67,37-137-37,)
,
    $drawroundrect(%_tracknumber.x_%,$add(%_pad_top_%,1),$sub(%_tracknumber.w_%,8),15,2,2,60-60-65,0-0-0-160,)
    $gradientrect($add(%_tracknumber.x_%,2),$add(%_pad_top_%,3),$sub(%_tracknumber.w_%,11),13,75-75-85,45-45-55,)
    $gradientrect($add(%_tracknumber.x_%,2),$add(%_pad_top_%,3),$sub(%_tracknumber.w_%,11),6,0-0-0-0,250-250-255-20,)
)
$drawtextex(%_tracknumber_%,%_tracknumber.x_%,$add(%_pad_top_%,2),$sub(%_tracknumber.w_%,6),%_wh_%,%_tracknumber_colour_%,hcenter top)

// artist
$if(%_artist_%,
    $puts(artist.w, $ifgreater(%_artist.w_%,%_free.w_%,%_free.w_%,%_artist.w_%))
    $font(%_txt_font_name_%, %_txt_font_size_%,)
    $drawtextex(%_artist_%,%_artist.x_%,$add(%_pad_top_%,1,$if($stricmp($ansi($upper(%_artist_%)),$upper(%_artist_%)),0,1)),$get(artist.w),%_wh_%,0-0-0,end_ellipsis)
    $drawtextex(%_artist_%,%_artist.x_%,$add(%_pad_top_%,$if($stricmp($ansi($upper(%_artist_%)),$upper(%_artist_%)),0,1)),$get(artist.w),%_wh_%,%_artist_colour_%,end_ellipsis)
,
    $puts(artist.w,0)
)

// title
$ifgreater($get(artist.w),%_free.w_%,,
    $puts(free.w,$sub(%_free.w_%, $get(artist.w)))
    $puts(title.x,$add(%_artist.x_%, $get(artist.w)))
    $puts(title.w,$ifgreater(%_title.w_%,$get(free.w),$get(free.w),%_title.w_%))
    $font(%_txt_font_name_%, %_txt_font_size_%,)
    $drawtextex(%_title_%,$get(title.x),$add(%_pad_top_%,1,$if($stricmp($ansi($upper(%_title_%)),$upper(%_title_%)),0,1)),$get(title.w),%_wh_%,0-0-0,end_ellipsis)
    $drawtextex(%_title_%,$get(title.x),$add(%_pad_top_%,$if($stricmp($ansi($upper(%_title_%)),$upper(%_title_%)),0,1)),$get(title.w),%_wh_%,%_title_colour_%,end_ellipsis)
)

$ifequal(%LASTFM_LOVED_DB%,1,$imageabs($sub(%el_width%,90),0,20,20,%images%\love_h_small.png,,,,),)


// duration
$font(%_txt_font_name_%, %_txt_font_size_%,)
$if(%el_isplaying%,,
$drawtextex($if2(%length%,0:00),%_duration.x_%,$add(%_pad_top_%,1),%_duration.w_%,%_wh_%,0-0-0,right)
$drawtextex($if2(%length%,0:00),%_duration.x_%,%_pad_top_%,%_duration.w_%,%_wh_%,%_duration_colour_%,right)
)

// rating
$if(%el_isplaying%,,
    $font(guifx v2 transports,12,)
    $drawtextex($repeat(b,5),$add(%_rating.x_%,05),$add(%_pad_top_%,1),%_rating.w_%,%_wh_%,00-00-05,)
    $drawtextex($repeat(b,5),$add(%_rating.x_%,05),$add(%_pad_top_%,3),%_rating.w_%,%_wh_%,35-35-40,)
    $drawtextex($repeat(b,5),$add(%_rating.x_%,05),$add(%_pad_top_%,2),%_rating.w_%,%_wh_%,20-20-25,)
    $font(guifx v2 transports,11,)
    $drawtextex($repeat(b,%_rating_%),$add(%_rating.x_%,05),$add(%_pad_top_%,3),%_rating.w_%,%_wh_%,0-0-0,)
    $drawtextex($repeat(b,%_rating_%),$add(%_rating.x_%,05),$add(%_pad_top_%,2),%_rating.w_%,%_wh_%,%_rating_colour_%,)
)

// playcounter
$if(%el_isplaying%,,
    $ifgreater(%_playcounter_%,0,
        $ifgreater(%_title.w_%,$get(free.w),
            $puts(playcounter.x,$sub(%_rating.x_%,%_playcounter.w_%))
        ,
            $puts(playcounter.x,$add($get(title.x),$get(title.w)))
        )
        $font(%_small_font_name_%, %_small_font_size_%,)
        $drawtextex(%_playcounter_%,$get(playcounter.x),%_pad_top_%,%_playcounter.w_%,%_wh_%,%_playcounter_colour_%,right)
    ,)
)

// icon select marker
$gradientrect(10,$add(%_pad_top_%,4),12,12,0-0-0,35-35-40,,)
$gradientrect(11,$add(%_pad_top_%,5),10,10,10-10-10,30-30-35,,)
$if($or(%el_selected%,%el_focused%),
    $font(Webdings,12,)
    $drawtextex('?',9,$add(%_pad_top_%,0),15,15,50-170-210,)
,)

)


Marc, I have a further question. I am very interesset in the foobar skin here: http://br3tt.deviantart.com/art/Xch4nge-216397917
The big problem is that your excellent script would not work on this skin because it you the WHS Panel Mod Mod 1.4.2.

How complicated is it port a skin to the newer Version of WHS Panel Mod Mod?

Many thanks!

Andi

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #708
you can't update that skin to a newer version of WSH panel mod because it uses a 3rd party modification of the official component to allow aero glass effects. it hasn't been updated since 1.4.2 so there is nothing you can do about it.

as for the ELplaylist code, the first number $sub(%el_width%,90) is the x co-ordinate for the image. in this case it's 90px away from the right side. if you want it a fixed distance from the left side then you'd just put a number on it's own without using $sub. 0 is the y co-ordinate. you may need to tweak these values in your own script. this is how it looks in mine:



right click an item in the playlist>properties and check the properties tab to see if the correct entries exist under the custom database section.
  • Last Edit: 27 March, 2012, 11:59:46 PM by marc2003

  • Maeldun
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #709
Hello Marc,

Much love for you and your script which I now find absolutely indispensable.

It seems to have abruptly stopped working for me though:


Playcount sync: Contacting Last.fm....
Error: WSH Panel Mod (Playcount Sync by marc2003): msxml3.dll:
The download of the specified resource has failed.

File: C:\Users\Adi\AppData\Roaming\foobar2000\\marc2003\common.js
Ln: 170, Col: 2
<source text only available at compile time>


I've updated to the 1.5.2 version of the component (which component update was not able to pick up) and overwrote my appdata files using the http://dl.dropbox.com/u/22801321/playcount%20sync.zip link you posted earlier. This has not made any difference.

Any suggestions?

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #710
you haven't imported the latest script in to your panel.

  • Maeldun
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #711
You mean importing the latest script code from the latest "playcount sync.txt" file, right?

Ok, I did that right now.. still doesn't work.

Quote
Playcount Sync: Contacting Last.fm....
Error: WSH Panel Mod (Playcount Sync by marc2003): msxml3.dll:
The download of the specified resource has failed.

File: C:\Users\Adi\AppData\Roaming\foobar2000\marc2003\common4.js
Ln: 162, Col: 2
<source text only available at compile time>


It seems I get an error on another line of code than before though.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #712
that error points to a line of code where it's trying to access the internet. you haven't got a firewall running that would block it? you haven't tried removing internet explorer (i believe it uses files from this to do it's work)

can you think of any other system changes you've made when it stopped working?? i must admit i don't really have any idea...

  • Maeldun
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #713
Ok, got it working again.. although I'm not sure what I did exactly.

In the WSH panel that showed the "aww, crashed" error I right clicked -> edit and then apply, or something similar - and that apparently prompted foobar to re-parse the files related to the script. (I did not modify anything)

Quote
WSH Panel Mod (Playcount Sync by marc2003): Parsing file "C:\Users\Adi\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (Playcount Sync by marc2003): Parsing file "C:\Users\Adi\AppData\Roaming\foobar2000\marc2003\tooltip_buttons.js"
WSH Panel Mod (Playcount Sync by marc2003): initialized in 10 ms
WSH Panel Mod (Playcount Sync by marc2003): Parsing file "C:\Users\Adi\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (Playcount Sync by marc2003): Parsing file "C:\Users\Adi\AppData\Roaming\foobar2000\marc2003\tooltip_buttons.js"
WSH Panel Mod (Playcount Sync by marc2003): initialized in 5 ms


Maybe I should have done something like this after importing?

Now it's working again. Maybe this will be of some help to others. Thanks for the help.

  • D.Sync
  • [*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #714
Thanks for the script marc. However I noticed that foobar will pause for a few seconds when I click on the LOVE icon or auto rating is used. I assumed that the delay is because the script is contacting the lastfm server? Is it possible to make it doing it on background?
  • Last Edit: 06 June, 2012, 08:30:07 AM by D.Sync

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #715
you mean the music is pausing? it shouldn't do that. 

the only thing i notice is a temporary freeze of visualisations if they're active.

-how big is your library (some people complain foo_customdb is slow if it's very big)
-does it pause when playing back normally. the script contacts last.fm in the same way to fetch updated playcounts half way through.
-does it pause when using foo_softplaylists manually from the context menu? you should find the love track option under the Last.fm submenu.

  • D.Sync
  • [*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #716
Nope the music is still playing fine. What I meant is that the interface will freeze for 1-2 seconds (e.g. no interaction possible, visualizer freeze) while the script is contacting with last.fm server. And yes it does freeze when I love a track using the softplaylist.

My library is fairly large, around 2500 albums. I do not see this is a problem with foo_customdb because when I enter a custom tag in it, freezing does not occur.

  • ca5k
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #717
Everytime I go to use the WSH I get:

Code: [Select]
GUID: E348B0C4-8447-48A0-8A74-51C5C856CA5F, CODE: 0x80020101



I'm using CUI

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #718
@D.Sync

if it freezes when using foo_softplaylists then there is obviously nothing i can do about that. and to be honest, i can't even suggest anything about the script either. i've had instances where last.fm can take 5-10 seconds to reply and it doesn't cause foobar to become unresponsive because it runs in the background. and even i could reproduce the problem myself, there aren't any changes i know of that could fix it.

@ca5k

have you disabled safe mode in the wsh panel mod preferences like the readme says? if you have, then i have no idea...

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #719
@D.Sync, i've discovered my script can indeed foobar can go un-responsive when it's updating foo_customdb. i've never noticed running foobar on a normal pc but this week i'm running it from a slow USB stick and the delay is definitely there. it's not the network side at all because i've tested for that. you can tell what i'm going to say next... there's nothing i can do about it.

HOW TO: synchronise your last.fm playback stats with foobar
Reply #720
I installed this on my laptop the other day, and got it to work fine, but I tried doing the same on my desktop, and for some reason I'm having a problem with play counts not showing. However, after playing a track and thus increasing the play count by 1, it will display the updated play count. I've tried using the Customdb refresh, but though it seems to be working and doing something, the play count is still blank. I've tried importing my library again several times, but it doesn't help. Any idea how I can fix this, or will I have to listen to every song I have once more to make them display properly?

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #721
the reason why this happens is explained in the readme. i've emphasised the important bit in bold.

Quote
Limitations:
Unfortunately, I have no way to manipulate your foobar library. Instead I have to fetch your whole Last.fm library and import that into foo_customdb. So the database may well contain tracks that don’t exist in your foobar library. Also, the spelling and punctuation of your artist and title tags have to be an exact match to what is fetched from Last.fm (case isn’t important). This may be an issue for some because by default, Last.fm uses spelling correction on their website to “fix” any wrong tags you submit when scrobbling. When this happens you may well have blank entries in your playlists when displaying playcount data.
However, when doing background updates, it is possible fetch data for auto-corrected artist names and tie them to the correct track in your library.


If you don’t like Last.fm auto-correcting your submitted data, you can turn this off by visiting this page…
http://www.last.fm/settings/website
If you do this, make sure you turn off the option found on this script’s context menu as well (Auto-updates>Use spelling correction).

HOW TO: synchronise your last.fm playback stats with foobar
Reply #722
I doubt that's the problem, as I've had auto-correcting disabled on last.fm for a long time, and turned it off in the script as well. Also, this happens to every single track that hasn't been played since adding the script, and I doubt they're all tagged wrong. Also, what's not showing aren't the entries themselves, but the play count, though rather than "not showing" I should say that they're all at 0.

  • BrutuZ
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #723
I doubt that's the problem, as I've had auto-correcting disabled on last.fm for a long time, and turned it off in the script as well. Also, this happens to every single track that hasn't been played since adding the script, and I doubt they're all tagged wrong. Also, what's not showing aren't the entries themselves, but the play count, though rather than "not showing" I should say that they're all at 0.

I have to ask: Are you sure the displayed column is using the foo_customdb value instead of the built-in playcount component?

HOW TO: synchronise your last.fm playback stats with foobar
Reply #724
I have to ask: Are you sure the displayed column is using the foo_customdb value instead of the built-in playcount component?

It's using "%LASTFM_PLAYCOUNT_DB%", yes, and if it was using the normal playcount component, I would notice many playcounts being very different. Also, that wouldn't explain the playcount suddenly changing to a completely different number once I play a track.