Skip to main content

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

0 Members and 1 Guest are viewing this topic.
  • acmodeu
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #200
@acmodeu, does your "legacy commands (unsorted)" context menu look like this?

screenshot

if it doesn't, you haven't followed the instructions properly.

also check the "properties" tab of the the file's properties to see if there are any customdb entries (also illustrated in the above screenshot).

Yep, my context menu looks the same, but I've turned it off in the context menu. Shouldn't I? My properties doesn't have such fields. Should I do smth with library?

  • acmodeu
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #201
Seems like I've finally made it work.  Is it right that the thing does not work with legacy commands hidden? And is there a chance for this stuff to work without wsh panel present in the interface because I have to hide them in 1x1 pixel?
  • Last Edit: 13 February, 2010, 06:24:38 PM by acmodeu

HOW TO: synchronise your last.fm playback stats with foobar
Reply #202
when you say freeze, how bad is it? does it affect windows as a whole when foobar is minimised? like i said before, if i stare at a visualisation, i'll notice it stutter but it doesn't cause the UI to freeze and certainly isn't noticeable under normal conditions. i only have a lowly pentium dual core and i'm guessing most other people don't have hardware as powerful as yours. i think you're the first person to report any such issues???


It doesn't affect Windows as a whole, but it does affect the foobar2000 UI.  So yes, visualizations stutter, the progress bar stutters, the playback time freezes, I can't click on anything, and I can't input text.  Additionally, the audio output is completely unaffected, it's just the UI that has problems.

My laptop (Core 2 Duo) will freeze when the playback time is at 0:10, and resumes at 0:14.  My desktop, as I mentioned earlier, freezes for about 2 seconds.

So far, my personal modification is working for the most part, and the stutter is less than a second per update.  It really seems like this is a customdb problem, but that doesn't seem to be updated often.

HOW TO: synchronise your last.fm playback stats with foobar
Reply #203
Seems like I've finally made it work.  Is it right that the thing does not work with legacy commands hidden? And is there a chance for this stuff to work without wsh panel present in the interface because I have to hide them in 1x1 pixel?


WSH Panel Mod can only run non-hidden context menu items.  I've requested that this be fixed, so hopefully if T.P Wang has time he'll get to it.

  • acmodeu
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #204
WSH Panel Mod can only run non-hidden context menu items.
Oh, so that was the reason of troubles.  Yeah, that definitely should be fixed.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #205
i have a new test version that i need guinea pigs to try. this has just 4 entries on the context menu. 

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

please only try this if you already have the previous version working already.

instructions.

extract sqlite3.exe into your foobar program directory
make sure foobar is closed and overwrite foo_customdb.dll.cfg in your configuration folder with this new one.
import the new .txt into your WSH panel

now you need migrate all your old playcounts across (library search> %LFM_U% PRESENT ). right click all files and select Migrate Lastfm Playcounts on the legacy commands (unsorted) context menu

finally update your playlist column to show %LASTFM_PLAYCOUNT_DB2% - this is where the playcounts are now going to be stored.
  • Last Edit: 13 February, 2010, 07:05:29 PM by marc2003

  • unclean
  • [*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #206
I had to comment out line 179 to get it working, but other than that and win7 barfing up a security prompt for the sql database it's great so far, thanks!

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #207
new beta uploaded - old version only worked on portable installs. it should now work on standard installs as well. same link as above.
  • Last Edit: 13 February, 2010, 08:04:42 PM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #208
Marc, you're my hero.  This fixed up my issue quite well and so far works fine.  I had to change the path to the customdb_sqlite.db file because it's stored in my profile folder rather than the program folder, but other than that I'm happy. Is this change I mentioned all that was fixed in the latest beta (portable vs. standard install), or is there any other reason I should upgrade?  Thanks again.

I'll let you know if I encounter any new problems.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #209
yes that was the exact issue. this is the change i made (line 106)

Code: [Select]
WshShell.Run("sqlite3.exe \"" + fb.ProfilePath + "\\\"customdb_sqlite.db " + query1, 0, true);


edit: only just noticed this..

I had to comment out line 179 to get it working, but other than that and win7 barfing up a security prompt for the sql database it's great so far, thanks!


line 179? that just draws the background?? i'll have to investigate the security prompt thing. i use windows 7 and don't see it - maybe it's because i'm using an admin account. i'll do some more testing.
  • Last Edit: 13 February, 2010, 08:34:11 PM by marc2003

  • dalover
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #210
Quote
I had to comment out line 179 to get it working, but other than that and win7 barfing up a security prompt for the sql database it's great so far, thanks!


For me the same

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #211
you having problems with line 179 as well? or just the security warning?

  • dalover
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #212
you having problems with line 179 as well? or just the security warning?


Sorry for the missing detail - i have only line 179

Code: [Select]
[02:41:55] Error: WSH Panel Mod (GUID: E7B1F570-46AE-4C3D-A37D-6E7368F38B6F): Laufzeitfehler in Microsoft JScript:
Objekt erwartet
Ln: 179, Col: 2

HOW TO: synchronise your last.fm playback stats with foobar
Reply #213
I can't speak for/against the line 179 issue because I removed it (and changed a few other parts to suit my theme) before even trying the new version.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #214
i'm thinking perhaps you guys don't have the latest version of my scripts. download the full package from the opening post in this thread and extract just the scripts folder into your foobar program directory. over write any files if you're prompted. restart foobar if it's running.
  • Last Edit: 13 February, 2010, 08:45:43 PM by marc2003

  • dalover
  • [*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #215
U are right  I updated the script folder and the error has disappeared

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #216
another beta uploaded - click me

existing beta users can just import the new .txt file

@Hitchhiker427, you won't like this update because there is a possibility of the script running 3 context menu commands at the same time. it's the only way i can reliably update the playcount for tracks that are already loved. i have to remove existing records for both playcount and loved status otherwise i sometimes get database locked errors.
  • Last Edit: 13 February, 2010, 10:14:52 PM by marc2003

HOW TO: synchronise your last.fm playback stats with foobar
Reply #217
Hmm... I see.  So, what disadvantages does the previous version have that this latest version addresses? 

Additionally, is it possible to use the sqlite3.exe to delete values in the customdb_sqlite.db and change the loved status?  In fact, it would be perfect (not sure if it's possible) to modify the .db file using ONLY the sqlite3.exe and not ever having to use the context menu controls.  That would both speed things up and clean out the context menu.

  • n0obie4life
  • [*][*][*]
  • Developer
HOW TO: synchronise your last.fm playback stats with foobar
Reply #218
Another piece of code to contribute here


I have a few artists whom I tagged as say "Beyonce", however last.fm aliases "Beyonce" to "Beyoncé".
The current script calls the API to look for "Beyonce" and last.fm does not take into account this alias on the API's side; hence via the API, the script does not detect any playcounts properly.
The API at this point of time does not provide any form indication what artist it's aliased to.

I threw up a fix that detects if the "+noredirect" string is in the URL, then look for similar artists and assumes that the first result is the "correct" artist. This works most of the time - of course there are exceptional cases, but I think this is the furthest we can go, can't possibly be searching through every single result there   


Code modification done is as follows:

In the process() function:
Add right at the top of the function
Code: [Select]
    try {
        var re = new RegExp("\\+noredirect");
        if ( re.test(xmlDoc) ) {
            similar();
            return;
        }
    } catch(e) { }


Add a new function called similar()

Code: [Select]
function similar() {
    fb.trace("Playcount sync: Finding similiar artists...");
    lastfm("&method=artist.getsimilar&limit=1&artist=" + encodeURIComponent(artist), "foo_playcount_sync", function() {
        xmlDoc = xmlhttp.responseText;
        var re = new RegExp("<name>(.*)</name>");
        var m = re.exec(xmlDoc);
        artist = m[1];
        sync();
    });
}



Cheers
  • Last Edit: 14 February, 2010, 01:55:26 AM by n0obie4life
:)

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #219
@Hitchhiker427, i already explained in my post why i have to use the context menu commands. if i don't, sqlite fails. it's as simple as that. and given that nobody else has reported issues with the original script that runs 6 commands at once, i'm not too bothered about this version running up to 3.

if a track isn't loved, it runs just 1 command to delete the playcount and then sqlite runs to update the new one
if you've just loved a track for the first time, then it runs 2 commands (1 to delete the playcount, sqlite runs and then 1 to update the loved status)
if you're just playing a track that is already loved, then it runs 3 commands, 1 to delete playcount, 1 to delete the loved status and then another to set the loved status again after sqlite has run.

no way around it i'm afraid. i've messed around using sqlite syntax such as DELETE FROM and INSERT OR REPLACE and it always fails with "database locked" errors when records exist.

@noobie4life, i turn off spelling correction in the website options. so that means i get +noredirect in many of my reponses because i refuse to change my tags when i know they are correct and last.fm are wrong. this way, my results always match my scrobbles.
  • Last Edit: 14 February, 2010, 05:52:23 AM by marc2003

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #220
new main version uploaded

-the rather large change is the liberation of the legacy commands (unsorted) context menu for existing foo_customdb users. it now contains just 4 entries for my script. there is a separate pdf file included explaining what has to be done to use this new script.
-new users should read the full readme.pdf included.
  • Last Edit: 14 February, 2010, 07:00:41 AM by marc2003

  • n0obie4life
  • [*][*][*]
  • Developer
HOW TO: synchronise your last.fm playback stats with foobar
Reply #221
@noobie4life, i turn off spelling correction in the website options. so that means i get +noredirect in many of my reponses because i refuse to change my tags when i know they are correct and last.fm are wrong. this way, my results always match my scrobbles.


Oh, I didn't know LFM takes into account your settings when it uses the API...it doesn't make sense to me anyhow.

Anyhow, if there are any users who listen to chinese songs and use this plugin, they may well be affected - traditional and simplified chinese are both correct, however lfm takes only the traditional chinese version. So the additional code could prove to be useful

---

May I ask though, why the need for this code in the latest version?
Code: [Select]
if(fb.IsPlaying) { fb.Pause(); fb.Play(); }
  • Last Edit: 14 February, 2010, 12:11:55 PM by n0obie4life
:)

HOW TO: synchronise your last.fm playback stats with foobar
Reply #222
@marc2003, Ok, I understand.  I just tried out the newest main version, and the problem is almost unnoticeable anyhow.  Thanks for all of your hard work.

  • marc2003
  • [*][*][*][*][*]
HOW TO: synchronise your last.fm playback stats with foobar
Reply #223
May I ask though, why the need for this code in the latest version?
Code: [Select]
if(fb.IsPlaying) { fb.Pause(); fb.Play(); }


it's a filthy hack to force the playlist to update instantly. because i'm updating foo_customdb externally, foobar doesn't always recognise that changes have been made so i have to give it a little nudge. the main thing is, it's totally invisible/inaudible to the end user.
  • Last Edit: 14 February, 2010, 05:07:31 PM by marc2003

  • n0obie4life
  • [*][*][*]
  • Developer
HOW TO: synchronise your last.fm playback stats with foobar
Reply #224
May I ask though, why the need for this code in the latest version?
Code: [Select]
if(fb.IsPlaying) { fb.Pause(); fb.Play(); }


it's a filthy hack to force the playlist to update instantly. because i'm updating foo_customdb externally, foobar doesn't always recognise that changes have been made so i have to give it a little nudge. the main thing is, it's totally invisible/inaudible to the end user.


Ah right okay, thanks.
:)