IPB

Welcome Guest ( Log In | Register )

41 Pages V  « < 35 36 37 38 39 > »   
Reply to this topicStart new topic
HOW TO: synchronise your last.fm playback stats with foobar, ...works with CUI and DUI
marc2003
post Aug 3 2013, 14:51
Post #901





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE
It's probably because of last.fm who corrects artist tag from "Snoop Doggy Dogg" to "Snoop Dogg". I'm sorry, my fault


indeed. this is covered in the readme. although it might look like a wall of text that makes your eyes glaze over, it does cover some important points. tongue.gif
Go to the top of the page
+Quote Post
kennethkee93
post Aug 3 2013, 17:20
Post #902





Group: Members
Posts: 4
Joined: 3-December 10
Member No.: 86203



Hi, I'm having trouble to get the script running on my foobar UI,



I get this error when i replace the WSH Panel script with the one in Playcount sync.txt

the original script is this

CODE
// ==PREPROCESSOR==
// @import "%fb2k_path%skin\mono_lite_2\scripts\common.js"
// @import "%fb2k_path%skin\mono_lite_2\scripts\tooltip_buttons.js"
// ==/PREPROCESSOR==

var bw = 16;
var bh = 15;
var top_margin = 0;
var left_margin = 0;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//var panel_id = window.GetProperty("panel_id", window.id);
var username_file = settings_path + "username";
var username = read(username_file);
var api_key_file = settings_path + "api_key";
var api_key = read(api_key_file);

on_item_focus_change();

function on_paint(gr) {
    //gr.FillSolidRect(0,0,ww,wh,RGB(220,220,220));
    var FP = fb.ComponentPath.replace("components","skin");
    var icon = gdi.Image(FP+ "mono_lite_2/lastfm/love.png");
    gr.DrawImage(icon,0,0,bw,bh,0,0,bw,bh);
    buttonsDraw(gr);
}

function on_notify_data(name, data) {
    if(name == "lastfm_update" && data == 1) {
        username = read(username_file);
        api_key = read(api_key_file);
        on_metadb_changed();
    }
}

function on_metadb_changed() {
    if(!g_metadb) return;
    artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
    track = fb.TitleFormat("%title%").EvalWithMetadb(g_metadb);
    love_command = "Last.fm Love '" + track + "' by '"+ artist + "'";
    old_userloved = fb.TitleFormat("%LASTFM_LOVED_DB%").EvalWithMetadb(g_metadb)  == 1 ? 1 : 0;
    old_userplaycount = fb.TitleFormat("%LASTFM_PLAYCOUNT_DB2%").EvalWithMetadb(g_metadb);
    crc32 = fb.TitleFormat("$crc32(%artist%%title%)").EvalWithMetadb(g_metadb);
    switch(true) {
        case (username.length == 0):
        case (api_key.length != 32):
            n = ".png";
            h = "exclamation_h.png";
            tooltip = "Please use the context menu to set your Last.fm username and API KEY.";
            func = null;
            break;
        case (old_userloved == 1):
            n = "love_h.png";
            h = "love_h.png";
            tooltip = "This track is already loved!";
            func = null;
            break;
        case (fb.TitleFormat("$strcmp($left(%path%,7),'http://')").EvalWithMetadb(g_metadb) != 0):
            n = "love.png";
            h = "exclamation_h.png";
            tooltip = "Unable to love!";
            func = null;
            break;
        default:
            n = "love.png";
            h = "love_h.png";
            tooltip = love_command;
            func = function() {love_track();}
            break;
    }
    Buttons = {
        but: new Button(left_margin,top_margin, bw, bh, {normal: images_path + n, hover: images_path + h}, func, tooltip)
    };
    window.Repaint();
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_playback_time(time) {
    if(time == 10) sync();
}

function love_track() {
    if(utils.CheckComponent("foo_softplaylists", true)) {
        fb.RunContextCommandWithMetadb(love_command, g_metadb);
        sync();
    } else {
        fb.ShowPopupMessage("Can't love track - the foo_softplaylists component is not installed.");
    }
}

function sync() {
    if(username.length == 0 || api_key.length != 32) return(fb.trace("Playcount sync: Can't contact Last.fm. Check your username / API KEY settings."));
    fb.trace("Playcount sync: Contacting Last.fm....");
    lastfm("&method=track.getinfo&artist=" + encodeURIComponent(artist) + "&track=" + encodeURIComponent(track), "foo_playcount_sync", function() {process();});
}

function process() {
    fb.trace("Playcount sync: Last.fm responded 'OK'");
    xmlDoc = xmlhttp.responseXML;
    try { userplaycount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue; } catch(e) { userplaycount = 0;}
    try { userloved = xmlDoc.getElementsByTagName("userloved")[0].childNodes[0].nodeValue; } catch(e) { userloved = 0; }
    if(old_userplaycount != userplaycount) {
        fb.RunContextCommandWithMetadb("Customdb Delete Playcount", g_metadb);
        if(userplaycount > 0) {
            if(old_userloved == 1) fb.RunContextCommandWithMetadb("Customdb Love 0", g_metadb);
            var attempt = 0;
            while(fb.TitleFormat("%LASTFM_PLAYCOUNT_DB2%").EvalWithMetadb(g_metadb) != userplaycount && attempt <=3) {
                var query1 = '\"INSERT INTO quicktag(url,subsong,fieldname,value) VALUES(\\"' + crc32 + '\\",\\"-1\\",\\"LASTFM_PLAYCOUNT_DB2\\",\\"' + userplaycount + '\\")\";';
                WshShell.Run("sqlite3.exe \"" + fb.ProfilePath + "\\\"customdb_sqlite.db " + query1, 0, true);
                attempt++;
            }
            if(fb.IsPlaying) { fb.PlayOrPause(); fb.PlayOrPause(); }
        }
    }
    if(old_userloved != userloved) fb.RunContextCommandWithMetadb("Customdb Love " + userloved, g_metadb);
}

function on_mouse_mbtn_down(x, y) {
    window.ShowConfigure();
}

function on_mouse_rbtn_up(x, y) {
    var _menu = window.CreatePopupMenu();
    var _child = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(username.length > 0 ? MF_STRING : MF_GRAYED, 1, "Visit your Last.fm user profile page");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 2, "Set your Last.fm username...");
    _menu.AppendMenuItem(MF_STRING, 3, "Set your API KEY...");
    idx = _menu.TrackPopupMenu(x, y);
    switch(idx) {
        case 1:
            WshShell.run("http://www.last.fm/user/" + encodeURIComponent(username));
            break;
        case 2:
            username = text_input_box("Playcount Sync", "Please enter your Last.fm username", username_file);
            if (username != null) {
                on_metadb_changed();
                window.NotifyOthers("lastfm_update", 1);
            }
            break;
        case 3:
            api_key = text_input_box("Playcount Sync", "Please enter your Last.fm API KEY\n\nhttp://www.last.fm/api/account", api_key_file);
            if (api_key != null) {
                on_metadb_changed();
                window.NotifyOthers("lastfm_update", 1);
            }
            break;
    }
    _menu.Dispose();
    _child.Dispose();
    return true;
}

function on_size() {
    ww = window.Width;
    wh = window.Height;
}


Am I doing it right? I replaced the whole script with the latest 1, and the love button crashed. Safe Mode is unchecked.

p/s - the UI (Monolite Plus Mod) I'm using comes with older version of the plugin. smile.gif

This post has been edited by kennethkee93: Aug 3 2013, 17:27
Go to the top of the page
+Quote Post
kennethkee93
post Aug 4 2013, 07:58
Post #903





Group: Members
Posts: 4
Joined: 3-December 10
Member No.: 86203



Ok, solved my problem, I copied the file wrongly. Works fine now. laugh.gif

P/s - I can't edit my post above.. ohmy.gif
Go to the top of the page
+Quote Post
DeVinel
post Aug 14 2013, 01:59
Post #904





Group: Members
Posts: 7
Joined: 7-May 12
Member No.: 99573



Hey Guys,
It seems like i copy it wrongly too. I got the same error and im getting frustrated. I just copy pasted playcountsync into the wsh mod by clicking configure. Can somebody give me a hint ?
Go to the top of the page
+Quote Post
marc2003
post Aug 14 2013, 05:56
Post #905





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



check the instructions in the bundled readme.pdf file. it's important that you follow all the steps.
Go to the top of the page
+Quote Post
aztec_mystic
post Aug 15 2013, 16:04
Post #906





Group: Members
Posts: 93
Joined: 28-March 13
Member No.: 107425



Just wanted to install this script on a new box. There's a problem, though. It seems the site which hosted foo_customdb was taken down for good.
Go to the top of the page
+Quote Post
marc2003
post Aug 15 2013, 16:25
Post #907





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



here you go: https://dl.dropboxusercontent.com/u/2280132...oo_customdb.zip

i've also updated the link in the readme.
Go to the top of the page
+Quote Post
aztec_mystic
post Aug 15 2013, 18:22
Post #908





Group: Members
Posts: 93
Joined: 28-March 13
Member No.: 107425



Thanks, marc!
Go to the top of the page
+Quote Post
nickdc
post Aug 15 2013, 21:26
Post #909





Group: Members
Posts: 109
Joined: 21-February 10
From: Italy
Member No.: 78362



hi marc, im using your lastfm love button, what i would like to do now is paint in red the title of all the lastfm loved songs, which script should i use?
Go to the top of the page
+Quote Post
marc2003
post Aug 16 2013, 03:31
Post #910





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



you need to be using a playlist viewer that supports $rgb. either EsPlaylist or NGplaylist in columns UI. you can customise a column something like....

CODE
$ifequal(%LASTFM_LOVED_DB%,1,$rgb(255,0,0),)%title%


This post has been edited by marc2003: Aug 16 2013, 03:43
Go to the top of the page
+Quote Post
nickdc
post Aug 16 2013, 12:32
Post #911





Group: Members
Posts: 109
Joined: 21-February 10
From: Italy
Member No.: 78362



works, thanks
Go to the top of the page
+Quote Post
DVS
post Nov 11 2013, 03:53
Post #912





Group: Members
Posts: 7
Joined: 27-January 09
Member No.: 66135



I have often crashes foobar.
QUOTE
Problem caused by: foo_customdb.dll: Custom Database
Known buggy component.

Does anyone know, whether the update of this plugin?
Go to the top of the page
+Quote Post
marc2003
post Nov 11 2013, 04:16
Post #913





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



there is no update.

however, i've never seen or heard of it crash using the configuration file i provide. i mention in the readme that if you don't use foo_customdb for anything else then you should use the configuration folder that i bundle in the zip.

but if you manually configured the entries into an existing foo_customdb setup, it's very likely that the original settings are at fault - at least that's what i found with my testing. i found it crashed quite often which is why i supply my "stripped down" setup.
Go to the top of the page
+Quote Post
DVS
post Nov 15 2013, 23:23
Post #914





Group: Members
Posts: 7
Joined: 27-January 09
Member No.: 66135



marc2003, i'm use exactly your configuration file from the zip archive.
crc32: f090008d
Go to the top of the page
+Quote Post
marc2003
post Nov 16 2013, 01:33
Post #915





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



well the obvious thing to try is removing the component. if it stops crashing after that then it looks like it is to blame. you used the word "often" so you shouldn't have to wait long to find out.

if it really is the cause then i'm sorry but i can't do anything about it.




Go to the top of the page
+Quote Post
RuKuKi
post Nov 20 2013, 15:30
Post #916





Group: Members
Posts: 2
Joined: 20-November 13
Member No.: 112363



Thank you for your wonderful work.

foo_customdb keeps crashing with foobar 1.3b5 (with your config+customdb_sqlite.db is 1.2mb+there is column with %LASTFM_PLAYCOUNT_DB%)
The log messages are something like 'Custom Database: library routine called out of sequence (21)'

If I start the same config+the same .db with smaller library everything works fine. And anyway 1.2.9 works flawless.

Also is there any way to trigger last.fm sync on foo_uPnP track changes with foobar acting as server?

Go to the top of the page
+Quote Post
marc2003
post Nov 20 2013, 17:35
Post #917





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



perhaps the db file got corrupted? you could close foobar and deleting the db file and re-importing. try Library Import>from file first as the previously downloaded data should still exist. it might be out of date depending on how many tracks you've played since. failing that, doing an import from the website again would be the next step. of course if was the same file that worked on 1.2.9 then it probably isn't this. i just don't know what else to suggest.

if you like, i can test your last.fm userid if you let me know what it is. either here or via PM would be fine.

as for your upnp question, i have no idea how that works. my script relies on it being notified of a new track starting by the foobar2000 core. i think it's impossible to detect what any 3rd party component might be doing.

This post has been edited by marc2003: Nov 20 2013, 17:38
Go to the top of the page
+Quote Post
RuKuKi
post Nov 21 2013, 11:02
Post #918





Group: Members
Posts: 2
Joined: 20-November 13
Member No.: 112363



Thanks for the answer. I've done a deeper research: re-imported whole library from last.fm (~650 pages)), removed all playlists and got 1.3 working fine.

So I've found autoplaylist causing crashes:
(%PLAY_COUNT% GREATER 0 AND %length% LESS 00:09:00 AND %length% GREATER 00:01:30) ~ 19030 works fine
comparing to
(%LASTFM_PLAYCOUNT_DB% GREATER 0 AND %PLAY_COUNT% GREATER 0 AND %length% LESS 00:09:00 AND %length% GREATER 00:01:30)
causing crashes and a lot of 'Custom Database: library routine called out of sequence (21)' messages

Well, I believe its a matter of new 1.3 playlists engine and there is nothing we can do =(

Go to the top of the page
+Quote Post
marc2003
post Nov 21 2013, 11:23
Post #919





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



i'm kind of surprised it's working with that many tracks. i know i've had people complain in the past when they've had 10's of thousands of tracks saying foo_customdb slows down foobar too much. but it seems you have 65,000 odd?? laugh.gif

i have less than 2000 tracks which is why i never have any issues myself. blush.gif

i have no idea why changes in 1.3 would affect this as i thought it was only for longer fields only. the max length you'll see in my database is 3 digits for playcounts in the hundreds. or 4 if you've listened to a track over a thousand times but that's not likely.

This post has been edited by marc2003: Nov 21 2013, 11:24
Go to the top of the page
+Quote Post
vanhoivanbinh
post Nov 25 2013, 06:02
Post #920





Group: Members
Posts: 11
Joined: 25-November 13
Member No.: 112538



Dear Sir
I am really appreciated your work
Now I want to enlarge the Love button in WSH panel. I try to replace the icon with larger image with the same name but it keeps same small size
I think I need to change something in the script
PLEASE ADVISE ME FOR THIS THING
THANK YOU VERY MUCH
Go to the top of the page
+Quote Post
marc2003
post Nov 25 2013, 08:51
Post #921





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



right click panel>configure. line 19 is this:

CODE
b.buttons.ps = new button(0, 0, ps.size, ps.size, {normal: ps.n, hover: ps.h}, ps.func, ps.tooltip);


replace ps.size with your image dimensions (width then height)

line 22 is

CODE
window.RepaintRect(b.buttons.ps.x, b.buttons.ps.y, 32, 32);


you need to replace both instances of 32 only if your image is bigger. (again it's width first, then height)
Go to the top of the page
+Quote Post
vanhoivanbinh
post Nov 26 2013, 04:26
Post #922





Group: Members
Posts: 11
Joined: 25-November 13
Member No.: 112538



QUOTE (marc2003 @ Nov 25 2013, 08:51) *
right click panel>configure. line 19 is this:

CODE
b.buttons.ps = new button(0, 0, ps.size, ps.size, {normal: ps.n, hover: ps.h}, ps.func, ps.tooltip);


replace ps.size with your image dimensions (width then height)

line 22 is

CODE
window.RepaintRect(b.buttons.ps.x, b.buttons.ps.y, 32, 32);


you need to replace both instances of 32 only if your image is bigger. (again it's width first, then height)

AWESOME!!!! SIR!!!
THANK YOU SO MUCH
Go to the top of the page
+Quote Post
スラッシュ
post Dec 7 2013, 13:41
Post #923





Group: Members
Posts: 113
Joined: 12-December 08
Member No.: 64410



I recently updated my computer and the added date problem reared its ugly head again for DADA scores and so on (I might edit it to disregard added date since it's causing so much trouble). Anyway, when searching about any updated info for last.fm "first played" date in the API, I came across this:

http://www.last.fm/group/Last.fm+Web+Servi...21604/_/2218628

Is that usable in any way, you think?
Go to the top of the page
+Quote Post
marc2003
post Dec 7 2013, 16:06
Post #924





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



that's only the first played date per artist. i don't see how that is useful.
Go to the top of the page
+Quote Post
スラッシュ
post Dec 8 2013, 09:56
Post #925





Group: Members
Posts: 113
Joined: 12-December 08
Member No.: 64410



Oh yeah I see, I didn't read it properly. That sucks sad.gif So frustrating when websites keep information to themselves like that.
Go to the top of the page
+Quote Post

41 Pages V  « < 35 36 37 38 39 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st April 2014 - 04:32