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 386884 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 #275
you need to disable WSH panel mod safe mode.

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

Reply #276
oh, thanks.
now I stuck on this

Code: [Select]
477 pages found 
Processing page 1
Error: WSH Panel Mod (GUID: DDBCD92F-7C1A-4ADF-9C71-C2F849AA9E19): (null):
(null)
Ln: 37, Col: 4
<source text only available in compile time>


I am running foobar as admin in win7

EDIT: sorry, sqlite3.exe was not present in foobar folder.... no errors right now - processing pages

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

Reply #277
oops, yet something else i forgot to mention.

right now, i'm having major problems with ESPlaylist. the database isn't getting updated for some reason. i've had no problems with the DUI playlist view or ELplayist in columns UI.

EDIT: test version removed. i'll try and make it update the database in one query rather than once per track. it's too slow. 

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

Reply #278
I played a bit with the script.
On first run it fills the DB then it stopped to fill the db but run without errors.
I traced the data and query1 var.

It looks like this:

Code: [Select]
Akron/Family,Of All the Things,28 
"INSERT OR REPLACE INTO quicktag(url,subsong,fieldname,value) VALUES(\"\",\"-1\",\"LASTFM_PLAYCOUNT_DB2\",\"28\")";
Port O'Brien,Valdez,28
"INSERT OR REPLACE INTO quicktag(url,subsong,fieldname,value) VALUES(\"\",\"-1\",\"LASTFM_PLAYCOUNT_DB2\",\"28\")";
Akron/Family,Love, Love, Love (everyone),28

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

Reply #279
foobar has to be playing for it to work. i've already removed the download as it's too problematic at the moment.

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

Reply #280
ah ok - now it's working here.
for now it's a smart start for me, to find out more about scripting
fb.trace("hello world") haha

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

Reply #281
I've modify your script a bit and collect the querys to bulk write them at end of every page loop.
maybe it's quick and dirty but it seem to work and it's not so slow like write it for each record.
Could it be possible that the script stop if track is changing?
Anyway it still takes time ^^.
I just let it run right know...
cheers m.

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

Reply #282
EDIT: OH FFS. ran into another problems i can't fix. i suck 

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

Reply #283
Hey, I wasted some time yesterday and played with your script, as far as I understand it.
I synced my lib to 80% the rest I try to sync with your track by track sync script.
I mean this is a one time task to sync a library with lfm.

I understand, that syncing the whole lib may not very easy.
For example:
I had too loop through 477 pages.
The script always stopped at Page 188 and I had to modify the startnumber in Script to 189.
I don't know why - maybe because of faulty data...
I run the script twice and everytime new tracks were added to database which are not added on first run.
So for unknown reason, tracks were skipped.
Sometimes the script just stopped working. Don't know why.

Second thing is, looping through lfm to fill the db may fill a lot of titles that not in my mp3 lib anymore.
Other way around would be better.

I think about using the custom db internal playcount, after filling the db with lfm data.

Anyway - thanks for your work so far ;-) I've learned a bit.
I just need to find out how to add more buttons/functions to use that youtube stuff and so on. can I paste the scripts in one wsh panel and just need to adjust the buttons? or do I need x wsh panels for each script?

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

Reply #284
my new version runs while foobar is closed so you shouldn't have any more skipped records. it parses all the results pages from last.fm first and then saves the query to an external file which is then triggered.

unfortunately there is no way for me to only find tracks that are in foobar's library - i have to write the whole last.fm library into the database.

although i've got it working now, i'm having serious performance issues in windows 7. even with my tiny collection of 1600 odd tracks it's taking over 2minutes. in XP SP3 it takes 18 seconds.

if anybody with a huge collection can share their last.fm username, i'll test to see if the script can handle it all in one go.

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

Reply #285
The script always stopped at Page 188 and I had to modify the startnumber in Script to 189.

that was a problem with malformed XML on the last.fm site - but it's my fault for not handling it properly. that's now fixed and i can pull the data for all pages without a problem. unfortunately, you do do lose the 50 records for every page it can't read. my external SQL file was created fine so now i'm about to test how long it takes to import.

EDIT: with the help of another forum, i've been benchmarking sqlite performance and it's seriously fubared on windows 7 x64.

EDIT2: no it's not a problem with sqlite. it's my non existant knowledge that is the problem. now solved. it takes barely a second now.

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

Reply #286
Just tried the "full sync" script on a clean install, seems to have worked fine, but i wonder why were the Table name changed to "LASTFM_PLAYCOUNT_DB" (without 2) and the $lower() fnction added to the key. Gets a little messy when you try to import the full sync DB into the regular script one since the CRCs won't match

EDIT: nvm, i got the point of the $lower() funtion, really makes sense, less chances of duplicates this way  , just wonder if there's a way to convert the current values to the new CRCs (you know, just to be on the safe side, in case some faulty XML page contains tracks that you already fetched the old-fashioned way)

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

Reply #287
i can only assume you've browsed my skydrive space for the full sync script as i haven't posted a link. it's not quite ready for a full release yet. i need to completely overhaul the instructions which i absolutely hate doing. i'll be merging it all into the main script linked to in the opening post. it will be recommended that users delete their old database. (it's not absolutely essential but it means it will contain loads of orphaned records which is a waste)

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

Reply #288
Guilty  , I did search the skydrive space, i assumed it'd be easier to find there than scavenge the link among all the topic pages. Seems I shouldn't have though, sorry about that  . Shame about the old databases, would be nice if there was a way to re-export the values to comply with the new CRC (maybe sorting the library by %LASTFM_PLAYCOUNT_DB2% and then assigning %LASTFM_PLAYCOUNT_DB% the same value as %LASTFM_PLAYCOUNT_DB2% through a CustomDB action?  )

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

Reply #289
i've tested your user ID and there weren't any problems. i've found a few more usernames to test who have more than 50,000 tracks in their last.fm libraries and there weren't any problems with those either. but it can take awhile depending on the size of your collection. i haven't done exact timing but it's around 50 pages (2500 tracks) per minute. i guess connection speeds and last.fm server response times may vary for each person though.

i'll post it later on when i can finally be bothered to do the readme. 

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

Reply #290
hi,
just to add my experience with marc2003 forthcomming script.
It works very nice, lfm download need some time, but thats no problem.
Because I am using custom_db for some other values, I didn't want to use a new clean db, so I cleaned it by myself, with
http://sqlitebrowser.sourceforge.net/ and a simple SQL Query to remove the previous downloaded LFM playcounts
Code: [Select]
DELETE FROM quicktag WHERE fieldname = 'LASTFM_PLAYCOUNT_DB2'

Then compact the db and run the new script.

I tried to clean up orphaned records with the plugin build in tools, but foobar freeze - don't know how long it takes or if this function is buggy?
cheers

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

Reply #291
you could have used the old "Customdb Delete Playcount" action on the context menu before updating it with the new settings. oh well.

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

Reply #292
ok, new main version uploaded. same link as first post

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

-import whole last.fm library at once. please read the documentation carefully
-still has the same features as the old script to update as you play/love tracks/etc
-not compatible with old version so please read instructions as if you are a new user

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

Reply #293
ok, new main version uploaded. same link as first post

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

-import whole last.fm library at once. please read the documentation carefully
-still has the same features as the old script to update as you play/love tracks/etc
-not compatible with old version so please read instructions as if you are a new user


thanks for all of your work, the script works great! I've been looking for something to do this for a while now

 

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

Reply #294
Any chances to have an option to sync all Loved tracks at once too? Nvm, there were so few tracks that it was easier to set the Loved status manually searching the library

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

Reply #295
hey marc2003,

i got a little problem, in the old version either the new one. My Problem is, that he didn't update the lastfm playcount from songs, that are already in the customdb database.

for example:
i play the song and this is what he calls for the WshShell.Run Command:
Code: [Select]
sqlite3.exe "D:\Media\foobar2000\\"customdb_sqlite.db "INSERT INTO quicktag(url,subsong,fieldname,value) VALUES(\"930765360\",\"-1\",\"LASTFM_PLAYCOUNT_DB\",\"8\")";


The real interessting part is, that with an SQL Viewer like the firefox addon sqlitemanager i tried to UPDATE the record, instead of insert a new one, because this fails also in the sqlite viewer for the customdb database.

But when i run the following command:
Code: [Select]
 "UPDATE quicktag SET value='15' WHERE url='930765360' AND fieldname='LASTFM_PLAYCOUNT_DB'";


it works. Mhm okay, lets try this with sqlite3.exe

and i run this in the cmd shell:
Code: [Select]
sqlite3.exe "D:\Media\foobar2000\\"customdb_sqlite.db "UPDATE quicktag SET value=\"9\" WHERE url=\"930765360\" AND fieldname=\"LASTFM_PLAYCOUNT_DB\""


Guess what? That works 100%, he updates the database and in foobar i see the new value (of course i have to refresh the playlist panel)

So i tried to get this working in foobar and ended with this little snippet:

Code: [Select]
if(fb.TitleFormat("%LASTFM_PLAYCOUNT_DB%").EvalWithMetadb(g_metadb)>0){
                    var query1 = '\"UPDATE quicktag SET value=\\"' + userplaycount + '\\" WHERE url=\\"' + crc32 + '\\" AND fieldname=\\"LASTFM_PLAYCOUNT_DB\\"\";';
                    WshShell.Run("sqlite3.exe \"" + fb.ProfilePath + "\\\"customdb_sqlite.db " + query1, 0, true);
            }else{
                while(fb.TitleFormat("%LASTFM_PLAYCOUNT_DB%").EvalWithMetadb(g_metadb) != userplaycount && attempt <=3) {              
                    var query1 = '\"INSERT quicktag(url,subsong,fieldname,value) VALUES(\\"' + crc32 + '\\",\\"-1\\",\\"LASTFM_PLAYCOUNT_DB\\",\\"' + userplaycount + '\\")\";';
                    WshShell.Run("sqlite3.exe \"" + fb.ProfilePath + "\\\"customdb_sqlite.db " + query1, 0, true);
                    attempt++;
                }
            }


But unfortunately that doesn't work and i don't know why, it seems that he's not starting sqlite3.exe at all, because if i run this command exactly manually from the cmd shell, everything works. I just wonder myself why you don't update the database, i mean, if you insert a new record he seems to return a error, well .... at my computer

hope you can help me or that you have an idea of whats going on.

PS:Tried the last version of your config, your new "get all lastm data" script works really great, but he does not update the files.

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

Reply #296
So marc..... I'm sure I'm in the minority of wanting this here but... Is there any way to make your scripts actually write tags instead of using customdb anymore 

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

Reply #297
Any chances to have an option to sync all Loved tracks at once too? Nvm, there were so few tracks that it was easier to set the Loved status manually searching the library

you can use foo_softplaylists to generate a playlist of your loved tracks (Library>Last.fm Loved tracks>user). then simply highlight, right click and choose "Legacy commands (unsorted)>Customdb Love 1".

@eikaramba - i have no idea what you're doing. i'll try and digest your post tomorrow when i have a little less alcohol in me.

@Fractal_Mortality - if you need file tagging support there's no reason to stop using the original version. although it's old, the only changes have been foo_customdb related. i can't tag files using this new library import method even if i wanted to. but you could use the foobar properties dialog and "format from other fields" to transfer database records to tags.

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

Reply #298
I can't tag files using this new library import method even if i wanted to. but you could use the foobar properties dialog and "format from other fields" to transfer database records to tags.


Good strategy, I think I will do this and just retain my older version of your script (seeing as how import library is really only a one time deal anyway  )

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

Reply #299
eikaramba, the reason i don't UPDATE is because the database is locked when foobar is running. i hack around this by deleting the playcount record for the current track and then INSERT should work (it still fails on very rare occasions - i'm talking maybe a few times a month playing 70 tracks or so a day which isn't that bad really).