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 384693 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 #1050
I wasn't thinking about getting recent scrobbles but rather right-clicking a bunch of tracks and retrieve play counts for these.

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

Reply #1051
i guess that's possible but you'd have to do a separate request per track which is just horrible. also, it could easily be abused and get my API key in trouble.

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

Reply #1052
Hi,

Is it possible to update the stats provided by foo_playcount?

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

Reply #1053
if you're talking about background updates as you listen then no.

if you want to do a one-off transfer of the data from the customdb database into playback statistics then you can. but there is a big BUT. and that is that you have to temporarily  transfer the values into your files which means updating tags and wiping any last_modified stamps which i know some people can be fussy about. only continue with these steps if you don't mind that.

first use library search>%LASTFM_PLAYCOUNT_DB% PRESENT
select all results>right click>properties. create a PLAY_COUNT tag if it doesn't already exist.
now right click the PLAY_COUNT tag and select format from other fields.
enter %LASTFM_PLAYCOUNT_DB% as the pattern and click ok.
click ok again to actually write the tags and close the properties dialog.
now with all the results in your search window still highlighted, right click>playback statistics>import statistics from file tags.
you may now go back and remove the PLAY_COUNT tag if you want to

optionally, you can do another search for %LASTM_LOVED_DB% IS 1. you can right click all results and use playback statistics to set the rating to 5.

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

Reply #1054
Thanks Marc. I have a problem with multiple artists: no playcount/loved information is displayed for albums with multiple artists. I've tried what you said in this post but the script seems to have changed since then. I can't find the line you said to replace. Help appreciated.
file>preferences>tools>custom database>fields tab

edit both custom entries...

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


should become

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


RESTART foobar now. foo_customdb is buggy if these changes are made without immediately restarting

now inside the panel for the script....

line 95 should become

Code: [Select]
artist = fb.TitleFormat("$meta(artist,0)").EvalWithMetadb(g_metadb);


line 100 should become

Code: [Select]
crc32 = fb.TitleFormat("$crc32($lower($meta(artist,0)%title%))").EvalWithMetadb(g_metadb);


i think that should do it.


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

Reply #1055
you can right click the button and select artist field remapping. just enter $meta(artist,0) in that dialog box. i assume you've still edited the database options and configured foo_audioscrobbler to only submit that as well?

edit: i only think it's necessary to adjust the db settings if you want the library import to work. if you only use the background updates option, leaving the database settings alone should work. i probably should test it before making such statements.

edit2: i actually have a question for anyone who uses last.fm. if you have an artist with multiple values, do you submit it as-is or do you use $meta(artist,0). i checked the official client app and you don't get a choice with that - it simply submits the first value which is probably the most sensible choice. but i'm sure most people here use florian's foo_audioscrobbler component and that does actually submit %artist% by default. as all my artists only have single artists (i prefer feat. XXX as part of the title), i'm just wondering what other people do with this?

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

Reply #1056
you can right click the button and select artist field remapping. just enter $meta(artist,0) in that dialog box. i assume you've still edited the database options and configured foo_audioscrobbler to only submit that as well?

edit: i only think it's necessary to adjust the db settings if you want the library import to work. if you only use the background updates option, leaving the database settings alone should work. i probably should test it before making such statements.

No, audioscrobbler always had the default setting: [%artist%].

If that is relevant, here's how one of my scrobbles looks like to last.fm (as in the scrobbles.tsv from my last.fm data file):
artist name: Adam Skorupa & Krzysztof Wierzynkiewicz
uncorrected artist name: Adam Skorupa, Krzysztof Wierzynkiewicz

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

Reply #1057
right, lets forget everything about changing settings and put everything back to default. that means closing foobar and extracting the configuration folder from the zip and putting it in your profile folder (assuming you don't use foo_customdb for anything else??). then reset the artist field remapping dialog in the script to %artist%.

can you confirm:

1) you're not seeing the playcount/loved status for multi value artists after doing a library import
2) playing enough of the track to count as a scrobble does actually update the playcount successfully?

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

Reply #1058
right, lets forget everything about changing settings and put everything back to default. that means closing foobar and extracting the configuration folder from the zip and putting it in your profile folder (assuming you don't use foo_customdb for anything else??). then reset the artist field remapping dialog in the script to %artist%.

can you confirm:

1) you're not seeing the playcount/loved status for multi value artists after doing a library import
2) playing enough of the track to count as a scrobble does actually update the playcount successfully?

1. Yes.
2. Yes.

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

Reply #1059
go to this page while logged in... http://www.last.fm/settings/website

uncheck the setting for spelling correction. don't play anything because it might ruin future results when you change this setting back in a minute.

now run the full import again and all your results should match up. now go back to that last.fm webpage and turn the setting back on again.

assuming this works, i'll need to update the documentation. there was a time when changing this setting did not affect scrobbles made in the past but it appears to now which is why i'm hopeful it will work.

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

Reply #1060
It works! Thank you very much.

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

Reply #1061
that's good news! really this should be a parameter i could supply when fetching the results rather than getting the user to change the website setttings. i might put in a request on the last.fm forums but i won't hold my breath.

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

Reply #1062
Marc,

I'm a big fan of your script. And it has been running smoothly for quite some time now. Recently, the auto-update doesn't work anymore (right-click -> "Update Script").

I get this error message:
Quote
The script reports that the update file has not been found. It could be a temporary problem with dropbox but if this error persists then it is most likely due to support stopping for this version. Check the hydrogenaudio thread or the full zip for updates.

http://www.hydrogenaud.io/forums/index.php?showtopic=77883
https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip


foobar version is 1.3.5, WSH Panel Mod version is 1.5.6.

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

Reply #1063
i forgot that error message would apply to this script and not just my other scripts. the part about stopping support for the old version is absolutely right. i've updated all the backend code but there really isn't anything new for this script except new images. it's also easier to use your own images because i've described in detail what you need to do to change them.

if you're happy with the old images, then there really isn't any need to update because i can't imagine anything ever changing at last.fm that will break it.

but if you do want to run the newest version, you can download the full zip from the first post. make sure you extract the whole marc2003 folder and then import the new .txt file into your panel. last.fm credentials will be remembered but all other settings set via the right click menu will need to be configured again. nothing has changed with the database settings so you will still see all your existing data.

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

Reply #1064
^^^ Thank you, the manual update worked just fine.

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

Reply #1065
i forgot to mention, the new script does have one minor new feature - it comes bundled with a newer version of sqlite. i'm now able to detect when they have been errors during the library import. it will report this in the blue popup window if problems are found.

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

Reply #1066
i've updated all the backend code but there really isn't anything new for this script except new images. it's also easier to use your own images because i've described in detail what you need to do to change them.
This may be a stupid question, but I cannot find where you described how to change the images. Could you point me in the right direction?

I've updated to the largestlatest version of the script. The images are now too large in the DUI. I've located the image files in .png format. I tried to simply resize those to 32x32. It didn't do the trick. The icons in fb2k are the same size as before, although they look different (it seems they're now upscaled; also, the background color is different).

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

Reply #1067
the notes are inside the script itself. you should have seen them when putting it in the panel. although the images are larger, they are actually resized to 32x32 by this first line of code. you can edit that if you want it smaller.

Code: [Select]
//function takes 3 values: x, y, size. see on_size function if you want to update these relative to panel width/height
var ps = new playcount_sync(3, 0, 32);
//if you want to change the images, uncomment these lines below and modify the paths accordingly
//do not use fb.FoobarPath here as fb.ProfilePath already points to the same location if using portable mode
//ps.cross_img = gdi.Image(fb.ProfilePath + "my_theme\\images\\cross.png");
//ps.loved_img = gdi.Image(fb.ProfilePath + "my_theme\\images\\loved.png");
//ps.unloved_img = gdi.Image(fb.ProfilePath + "my_theme\\images\\unloved.png");


Quote
also, the background color is different


just like the old script, it uses your UI settings by default - but you can over ride this by using the right click menu>Background.

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

Reply #1068
the notes are inside the script itself.

Oops, I should've checked there. Anyways, thank you very much for the instant answer. Setting size to 16 did exactly what I wanted.

Quote
Quote
also, the background color is different


just like the old script, it uses your UI settings by default - but you can over ride this by using the right click menu>Background.

No, that was the first thing I checked. Maybe MS Paint changed the background color or something. In any case, it doesn't matter, as changing the size in the script and going back to the original images provided by you did the trick.

---

One more question, unrelated to the previous one: it is still not possible to add the "love" button to the toolbar in DUI, correct? I use CUI on a different Windows box and I like that I can add the script to the toolbar buttons there.

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

Reply #1069
it is still not possible to add the "love" button to the toolbar in DUI, correct?


correct. no 3rd party components are allowed to do that.

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

Reply #1070
When I try to download the playcount sync.zip file from http://marc2003.x10host.com/lastfm-playcount-sync Chrome prevents me from downloading it, claiming it is a malicious file. I had downloaded the file earlier with Internet Explorer without any issues, and scanned it with my Antivirus (Nod32) and it passed. I just wanted to give you a heads up in case you were not aware of this issue.

Is the download safe to use? I ask because I do give it my Last.fm credentials (as expected).

Thank you, it is a great Foobar2000 script

I tried to send this via PM, but it said you couldn't get messages.

- Ben

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

Reply #1071
i just tested with chrome and see the same issue. but if use the link from the first post in this thread, it works fine. both links point towards the same file on my dropbox space so it would seem google chrome has a problem with my web space as the referring page. it's a free web host so perhaps that's why it might not be trusted?? i'll try and investigate but i doubt i'll get very far.

i hope you do trust my code not to be malicious. it's just javascript so anyone can read it. also, i've been supporting this script for over 5 years now.

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

Reply #1072
i just tested with chrome and see the same issue. but if use the link from the first post in this thread, it works fine. both links point towards the same file on my dropbox space so it would seem google chrome has a problem with my web space as the referring page. it's a free web host so perhaps that's why it might not be trusted?? i'll try and investigate but i doubt i'll get very far.

i hope you do trust my code not to be malicious. it's just javascript so anyone can read it. also, i've been supporting this script for over 5 years now.



I can also support that marc2003 code is not malicious.

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

Reply #1073
i just tested with chrome and see the same issue. but if use the link from the first post in this thread, it works fine. both links point towards the same file on my dropbox space so it would seem google chrome has a problem with my web space as the referring page. it's a free web host so perhaps that's why it might not be trusted?? i'll try and investigate but i doubt i'll get very far.

i hope you do trust my code not to be malicious. it's just javascript so anyone can read it. also, i've been supporting this script for over 5 years now.


Thank you for the quick reply. I certainly trust your code not to be malicious. I just wanted to be sure the file it was trying to download was in fact your code and not something that had been compromised or somehow uploaded by a less trustworthy source. Guess its just the former IT guy in me being overly paranoid.

If the link from the first post in this thread will work, I will use that.

Thanks again.

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

Reply #1074
the script has stopped working for me recently, it does not synchronize play counts. the log displays this message: Last.fm Playcount Sync: {"error":26,"message":"Suspended API key - Access for your account has been suspended, please contact Last.fm","links":[]}