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 386990 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

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

Reply #300
hey marc,

i found the problem!!!

As is said, my foobar didn't update the playcounter and now when i noticed that you first delete the record and then insert a new one, i thougt maybe he just don't execute the delete command. Well in the past I deactivated the context menu for the "Legacy Commands", because i dont need them in the context menu, but without visible they seems to not working. So the solution was to reactivate them in the context menu and now the delete&insert command works.

Maybe this help some people.

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

Reply #301
maybe i'll add that to the readme - don't hide context menu items.

could a mod completely replace the opening post with the following text:

UPDATED 26th April 2010

this isn't a proper a component but a script that utilises WSH panel mod, foo_customdb and foo_softplaylists

features:

-script runs inside a WSH panel which is supported in both default UI and columns UI
-import your last.fm library playback statistics into foobar in one go
-uses foo_customdb so your file tags won't be touched
-automatically updates stats in the background as you play more music
-also stores last.fm loved track status
-uses foo_softplaylists to love tracks via a button

full instructions can be found here. please read carefully.

http://cid-649d3bfeaf541fbb.skydrive.live....ount%20sync.zip

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

Reply #302
Installed this all yesterday, followed instructions to the letter. It is all working bar the on the fly playcount update. I play a track (Can see the ok response from lfm in the console) yet the playcount does not update. I can do "create and import SQL file" each time I want it updated but would really prefer for it to be auto. Any ideas what may be going wrong?

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

Reply #303
it won't increment on the first play after an import because the playcount is still the same. a play isn't scrobbled until you've finished listening to a track.

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

Reply #304
oh i apologise, i think i understand now. the playcounts will always be one behind lfm?

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

Reply #305
at the time the sync occurs, the playcount will the same as last.fm. but at the end of the track when that play is scrobbled, it will be 1 behind.

minor update:

http://cid-649d3bfeaf541fbb.skydrive.live....ount%20sync.zip

--documentation updated with the following info
how to use foo_softplaylists to import loved track status for the whole library
explanation of why playcount won't increment immediately after library import

--playcount sync.txt updated (the file which you import into a panel). it now outputs a console message when the playcount hasn't changed.

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

Reply #306
Maybe it's worth mention to anyone (like me) that feels bothered by the fact the playcount displayed is always 1 unity behind Last.fm after the track is played and scrobbled, that you can change that with a simple mod on "playcount sync.txt" (or the imported code itself inside WSH panel config). All that is needed is add a pair of + in the code so that line 96:
Code: [Select]
try { userplaycount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue; } catch(e) { userplaycount = 0;}
becomes
Code: [Select]
try { userplaycount = ++xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue; } catch(e) { userplaycount = 0;}
The downside on doing that is that the increment will occour after 10 seconds of play (unless you change the value on line 74).

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

Reply #307
i've just noticed that foo_softplaylists can only fetch up to 1000 loved tracks (the default is 500 so you have to change this in it's preferences). are there any people who have more than 1000? if there are, make yourself heard and i might add an option to fetch the records myself, bypassing this limitation.


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

Reply #309
Just spotted a bug (or is it a problem on my side ?) since I updated to the last version of your script :

When I click on "Visit your Last.fm user profile page", I get this in the console :

Code: [Select]
Error: WSH Panel Mod (GUID: 47866B82-E515-452D-A530-BFF018766B4C): (null):
(null)
Ln: 206, Col: 4
<source text only available in compile time>


Everything works perfectly apart from that.
Opus 96 kb/s (Android) / Vorbis -q5 (PC) / WavPack -hhx6m (Archive)

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

Reply #310
that would seem to indicate there is a problem with your system handling the default action for "http://..." links. have you got a default browser set ok? what happens if you go to start, run and type in

http://google.com

anyway, to stop the script from crapping out. on line 206, replace this

Code: [Select]
      
WshShell.run("http://www.last.fm/user/" + encodeURIComponent(username));


with

Code: [Select]
            try {
                WshShell.run("http://www.last.fm/user/" + encodeURIComponent(username));
            } catch(e) {
                fb.ShowPopupMessage("Unable to launch your default browser.", "Playcount Sync");
            }


i'll put this in the next update as well.

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

Reply #311
Weird, I just restarted Firefox and now it works. 
I don't have any other browser so I don't see what could have changed the HTTP protocol association.

Anyway, thanks for your quick answer.
Opus 96 kb/s (Android) / Vorbis -q5 (PC) / WavPack -hhx6m (Archive)

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

Reply #312
new version uploaded

http://cid-649d3bfeaf541fbb.skydrive.live....ount%20sync.zip

-imports loved track status automatically at the same time as playcount. there are no limits to the number of loved tracks. unfortunately this has a required an update to the db structure so existing users (since the import script update) will need to delete their database and overwrite foo_customdb.dll.cfg again and of course import the new playcount sync.txt into their WSH panel.

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

Reply #313
another new version, same link as above.

-changes made to the panel script only. automatic updating now adds 1 to the returned result. instead of running after 10 seconds, it now runs at either half the track length or 4 minutes - whichever comes first. this is part of the the guidelines for having a play "count" set by last.fm so even though i'm manipulating data, it should be accurate when the track has finished playing.

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

Reply #314
This script is perfect, thanks!

I have one question/request though.  Would there be any way to get artist names that are non-English to download from the API as their translated names rather than their names in the original language?  For example, Nobuo Uematsu is actually 植松伸夫 on Last.fm (see here) and that's how the API downloads the stats, as 植松伸夫 and not his English name.  My artist tags for him are all in English so the play counts and loved status don't import (because there's no way to tell fb2k that 植松伸夫 and Nobuo Uematsu are actually the same artist).

Does that make sense?

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

Reply #315
like i said in the readme file, all i can do is match tags. but you could see if the "artist translation" option on this page helps. i have no idea if it will or not.

http://www.last.fm/settings/website

also, if you turned off spelling correction, i think that would force all plays to be counted against your tags exactly as they are. so the above artist would end up here..

http://www.last.fm/music/+noredirect/Nobuo+Uematsu

i'm not sure how those 2 options would work together though.

 

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

Reply #316
This script is perfect, thanks!

I have one question/request though.  Would there be any way to get artist names that are non-English to download from the API as their translated names rather than their names in the original language?  For example, Nobuo Uematsu is actually ???? on Last.fm (see here) and that's how the API downloads the stats, as ???? and not his English name.  My artist tags for him are all in English so the play counts and loved status don't import (because there's no way to tell fb2k that ???? and Nobuo Uematsu are actually the same artist).

Does that make sense?


You could use the similar() function I posted in the thread. It works perfectly fine for me when fixing such problems. I refuse to turn off spelling correction...so.

http://www.hydrogenaudio.org/forums/index....st&p=687610
:)

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

Reply #317
^i must confess, i forgot about your workaround that you mentioned earlier in the thread.

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

Reply #318
like i said in the readme file, all i can do is match tags. but you could see if the "artist translation" option on this page helps. i have no idea if it will or not.

http://www.last.fm/settings/website

also, if you turned off spelling correction, i think that would force all plays to be counted against your tags exactly as they are. so the above artist would end up here..

http://www.last.fm/music/+noredirect/Nobuo+Uematsu

i'm not sure how those 2 options would work together though.

This is so confusing.  Not only am I dealing with translating, but once a name is translated, it's an artist redirect as well.  I think that's where I'm getting confused.

I turned off spelling correction temporarily and rebuilt/redownloaded the database from your script ("Create and import SQL file") and I suddenly had a lot more loved tracks showing up in fb2k.  Didn't do what I wanted though, because now if I love a track from fb2k that has a redirected artist (let's say Beatles -> The Beatles, to keep it simple), it will love the track by the non-redirected artist (Beatles) and not the properly corrected one (The Beatles).

You could use the similar() function I posted in the thread. It works perfectly fine for me when fixing such problems. I refuse to turn off spelling correction...so.

http://www.hydrogenaudio.org/forums/index....st&p=687610


I added everything from your post to the script but I'm not sure what this does exactly, even though it does sound like something I'd want.  Using my example above, would your fix make it so if I loved a track from "Beatles" in fb2k, it would actually love that track from "The Beatles" instead, because "The Beatles" is the #1 similar artist to "Beatles"?  And if so, would my %LASTFM_LOVED_DB% and %LASTFM_PLAYCOUNT_DB% be updated accordingly?

I'll say it again, this is confusing the hell out of me, haha.  I'm pretty sure this would all be a non-issue if Last.fm started merging artist pages instead of just redirecting, or "correcting."

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

Reply #319
yup, tis very confusing indeed. this is my take on what's going on the moment.

your files are tagged as Nobuo Uematsu but gets auto corrected by last.fm to 植松伸夫 when you scrobble (or love a track). when you import the whole library from last.fm, all the entries will be under 植松伸夫 so of course they won't show in foobar because of the tag mismatch.

now when you play a track, the auto update feature uses a different last.fm feed and this simply uses the tag data found in your files. in this instance it will look up Nobuo Uematsu against your username and will find no entries and so return nothing. this is where n0obie4life's workaround should come in handy for you. but there is no realistic way you could use that feature when importing your whole library. i guess at this point large chunks of your library will be missing data but it will get updated eventually as you play more songs with it running in the background.

i can't say anything about the "artist translation" option because i've never used it. but if you turned off "spelling correction"  (which i would not recommend in your case), then all future last.fm scrobbles with Nobuo Uematsu tracks would count against this tag on last.fm. of course this would mean starting this artist again from 0 which you wouldn't want. but in this scenario both elements of my script would work fine.

your options:
1) what i'd recommend: leave your tags/last.fm options as they are. accept the gaps in your library and use n0obie4life's workaround for updating tracks as you listen
2) obey last.fm by adjusting your tags to match theirs
3) force them to obey you by turning off spelling correction. 

obviously 2 and 3 aren't very appealing.





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

Reply #320
What do I need to do if I just want my last.fm played and loved stats synced once, and directly to the tags?

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

Reply #321
you can't import into the tags directly so you'd need to follow all the steps in the guide to import the playcount/loved status into the database as usual. then you could transfer the data into file tags afterwards.

when the import is complete, assuming all your music is in the foobar library, open a Library>Search window (if not add, all your music to a single playlist and use Edit>Search)

%LASTFM_PLAYCOUNT_DB% PRESENT

now with all files highlighted, right click, properties. create a new tag by double clicking one of the empty boxes. click ok. now right click this newly created tag and select "Format from other fields". in the format box, type in

%LASTFM_PLAYCOUNT_DB%

then repeat the above step for %LASTFM_LOVED_DB%

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

Reply #322
Hrm, I am pretty bad with anything to do with scripts, but I think it may be the mix of components I have, but foo_customdb.dll crashes for me. I am wondering if you know of a solution at all, but I suspect there's probably nothing I could do besides maybe stop using other components, if that's even the problem.
crash log for customdb.dll (1.0 beta, I think it is):  http://pastebin.com/qETsaqw7

also errors (but these haven't crashed for me yet): http://help.foobar2000.org/troubleshooter/...ba43d13612b80e2
A list of components I use: http://content.imagesocket.com/images/foob...mponents3d5.png

Any help is appreciated, but as far as it goes, I can still love tracks, but it won't show the silly icon without the customdb. Also.. more very minor problems, but I'm just going to be thankful it mostly works besides that crashing, haha. I think I messed up somewhere configuring.

---------- Below can be completely ignored if there's no way to stop customdb.dll from crashing, but if it can, if anyone likes to help >_>
Ah, also, if possible, but maybe just ignore this. Anyways, like you have the 1 heart in the screenshot for this, I guess I messed it up, either way I went with a work around. I just made 3 buttons with hearts and use one to love(to Last.fm), the other to display the heart in foobar columns, but I can't unlove a track with it. Actually, it's the Love 0 context menu, which just removes the heart, but I thought it would also unlove from Last.fm Puzzled

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

Reply #323
Just a hint, check all custom db action if they are mapped to an existing field.
I noticed crashes when an action (like Media Library (Modified)) tried to update a field which not exist anymore.

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

Reply #324
i do find customdb unstable with it's default actions in place. that's why i removed them all in the foo_customdb.dll.cfg file i provide. i've not had a single problem with it. seems odd how it crashes in it's default configuration but has been rock solid with the abuse i give it. in older versions of this script, i used to run 7 actions at a time and it was fine.

@Mercenary09 - you can't unlove a track on last.fm with this script/foo_softplaylists. last.fm don't provide any way for us to do that. you have to use the website.

unfortunately i can't help with your component errors. like i said above, it's been rock solid for me. and there is no thread on these forums either. the developer doesn't post here.

the context menu options are only there because the script needs them to work. lets say you loved a track but later changed your mind and you used the website to unlove it, the script would detect this on the next play and remove it from the database.