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: WSH Panel Mod script discussion/help (Read 1400991 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod script discussion/help

Reply #900
Hey marc2003,

I use your artist images script, and for some reason art.exe has stopped finding art on last.fm
Is it just me?

WSH Panel Mod script discussion/help

Reply #901
still working here. can you give an example of an artist? i assume you've checked the last.fm webpage to see that images do exist for a given artist?

WSH Panel Mod script discussion/help

Reply #902
Works for me also.


WSH Panel Mod script discussion/help

Reply #904
i've never heard of Elsiane so i tagged a dummy file just to make sure it works from within foobar. it does....



you can try running "art" from the command prompt to see if it gives any feedback.


WSH Panel Mod script discussion/help

Reply #905
Hrmm...


WSH Panel Mod script discussion/help

Reply #906
Elsine or Elsiane?

WSH Panel Mod script discussion/help

Reply #907
the typo doesn't matter. i don't see the "request was aborted" error message like that. i guess it's some networking issues between garbanzo.bean and last.fm. are other last.fm services (like scrobbling) working OK? (not the website -that's completely unrelated)

edit: although i'm absolutely certain my modification can't have broken the app (i only commented out a few lines that request a user to press a key), you could try the original version from here...

http://www.hydrogenaudio.org/forums/index....aded&start=

and report your problem there if you're still not having any joy.

another edit:

you could try this in a new panel with your own api key. it might help troubleshoot?

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common.js"
// ==/PREPROCESSOR==

var username = "blah";
var api_key = "1234......";

lastfm("&method=artist.getimages&artist=Elisane" , "foo_wsh_lastfm_bio", function() {fb.ShowPopupMessage(xmlhttp.responsetext);});


you should get a popup window like this when you click ok.


WSH Panel Mod script discussion/help

Reply #908
thanks for your continued help with this!

other services (scrobbling, pulling charts and similar artists through wsh) are working fine.

turning off my software firewall doesn't change anything.

here is what pops up with that new code using my API:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<lfm status="ok">
<images artist="Elisane" page="1" perPage="50" totalPages="1" total="1">
            <image>
        <title>417ms6ndI4L._SL500_AA240_</title>
        <url>http://www.last.fm/music/+noredirect/Elisane/+images/27839077</url>
        <dateadded>Sat, 2 May 2009 22:13:13</dateadded>
        <format>jpg</format>
                    <owner type="user">
                <name>trulla-penny</name>
                <url>http://www.last.fm/user/trulla-penny</url>
            </owner>
                <sizes>
                    <size name="original" width="240" height="240">http://userserve-ak.last.fm/serve/_/27839077/Elisane+417ms6ndI4L_SL500_AA240_.jpg</size>
                    <size name="large" width="126" height="126">http://userserve-ak.last.fm/serve/126/27839077.jpg</size>
                    <size name="largesquare" width="126" height="126">http://userserve-ak.last.fm/serve/126s/27839077.jpg</size>
                    <size name="medium" width="64" height="64">http://userserve-ak.last.fm/serve/64/27839077.jpg</size>
                    <size name="small" width="34" height="34">http://userserve-ak.last.fm/serve/34/27839077.jpg</size>
                    <size name="extralarge" width="252" height="252">http://userserve-ak.last.fm/serve/252/27839077.jpg</size>
                </sizes>
        <votes>
            <thumbsup>0</thumbsup>
            <thumbsdown>0</thumbsdown>
        </votes>
    </image>
</images></lfm>

WSH Panel Mod script discussion/help

Reply #909
Is there a list or a guide for coding in the WSH Panel Mod?

I have seen that there are functions like fb.xxxxx

What are all these functions?

WSH Panel Mod script discussion/help

Reply #910
docs\interfaces.txt in the main component download.


WSH Panel Mod script discussion/help

Reply #912
Hi...  I just set up a WSH panel for the 1st time to see if I could get it to query Wikipedia.  I found Bryter's code from an earlier post that addressed this, and tried to fix the comma and squiggly bracket errors marc2003 pointed out.  But I keep getting errors that FB2K's console keeps pointing to around the Line 34 Column 184 and Line 35 Column 5 locations.

I'm not a programmer. Notepad++ has been useful to find beginning and end points of some aspects of the code.  I made copies of icon files included in the \images folder, and renamed them to match the filenames for the buttons in Bryter's script.  But I just haven't been able to find the problem here.  Could someone look over what I've got at this point?:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common.js"
// @import "%fb2k_profile_path%marc2003\tooltip_buttons.js"
// @name "Web Links"
// @author "marc2003"
// ==/PREPROCESSOR==

var bw = 20;
var bh = 20;
var top_margin = 0;
var left_margin = 0;

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

var panel_id = window.GetProperty("panel_id", window.id);
var custom_background_file = settings_path + panel_id + "buttons_background";
var custom_background = read(custom_background_file);

on_item_focus_change();

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

function on_metadb_changed() {
    if(!g_metadb) return;
    var wikipedia = fb.TitleFormat("http://en.wikipedia.org/wiki/$replace(%artist%, ,_)").EvalWithMetadb(g_metadb);
    var rateyourmusic = fb.TitleFormat("http://rateyourmusic.com/artist/$lower($replace(%artist%, ,_))").EvalWithMetadb(g_metadb);
    var discogs = fb. Titleformat ("http://www.discogs.com/artist/$lower($replace(%artist%, ,))").EvalWithMetadb(g_metadb);
    Buttons = {
        but4: new Button(left_margin + (bw*0),top_margin,bw,bh, {normal: images_path + "wikipedia.png", hover: images_path + "wikipedia_h.png"}, function(){WshShell.run(wikipedia);}, wikipedia),
        but5: new Button(left_margin + (bw*1),top_margin,bw,bh, {normal: images_path + "rateyourmusic.png", hover: images_path + "rateyourmusic_h.png"}, function(){WshShell.run(rateyourmusic);}, rateyourmusic),
        but6: new Button (left_margin + (bw*2),top_margin,bw,bh,{normail: images_path + "discogs.png", hover: images_path + discogs_h.png"}, function(){Wshell.run(discogs);}, discogs)
    }
        window.Repaint();
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_mouse_rbtn_up(x, y) {
    buttons_menu(x,y);
    return true;
}

function on_paint(gr) {
    buttons_background(gr);
    buttonsDraw(gr);
}

Many thanks
TS
Geopoliticus Child Watching the Birth of the New Man

WSH Panel Mod script discussion/help

Reply #913
it says what line the error is on. if you can't see it, there isn't much hope. the colour coding used by the editor should help.

also Bryter introduced some strange code.... 

Code: [Select]
left_margin + (bw*0)


did people not learn in school that multiplying a number by 0 is 0. 

Code: [Select]
left_margin + (bw*1)


there's not much point in multiplying by 1 either. 

WSH Panel Mod script discussion/help

Reply #914
Any thoughts on my art.exe problem, marc2003?

WSH Panel Mod script discussion/help

Reply #915
... the colour coding used by the editor should help.

Yes, that is very helpful.  I tried going back to square 1, and instead of using all of Bryter's code, I just copied his lines for the Wikipedia variable and button into the code in your "web links.txt" file:

=============================================
function on_metadb_changed() {
   if(!g_metadb) return;
   var myspace = fb.TitleFormat("http://www.myspace.com/$replace(%artist%, ,)").EvalWithMetadb(g_metadb);
   var lastfm = fb.TitleFormat("http://www.last.fm/music/$replace(%artist%, ,+,/,'%'252F,?,'%'3F)/_/$replace(%title%, ,+,/,'%'252F,?,'%'3F)").EvalWithMetadb(g_metadb);
   var youtube = fb.TitleFormat("http://www.youtube.com/results?search_query=$replace(%artist%+%title%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
   var wikipedia = fb.TitleFormat("http://en.wikipedia.org/wiki/$replace(%artist%, ,_)").EvalWithMetadb(g_metadb);
   Buttons = {
      but1: new Button(left_margin,top_margin,bw,bh, {normal: images_path + "myspace.png", hover: images_path + "myspace_h.png"}, function(){WshShell.run(myspace);}, myspace),
      but2: new Button(left_margin + bw,top_margin,bw,bh, {normal: images_path + "lastfm.png", hover: images_path + "lastfm_h.png"}, function(){WshShell.run(lastfm);}, lastfm),
      but3: new Button(left_margin + (bw*2),top_margin,bw,bh, {normal: images_path + "youtube.png", hover: images_path + "youtube_h.png"}, function(){WshShell.run(youtube);}, youtube),
      but4: new Button(left_margin + (bw*0),top_margin,bw,bh, {normal: images_path + "wikipedia.png", hover: images_path + "wikipedia_h.png"}, function(){WshShell.run(wikipedia);}, wikipedia)
   }
=============================================

FB2K didn't report any problems with the code after applying the changes, but there were still only 3 icons in the WSH panel.  For some reason the 1st icon on the left edge had changed from the myspace icon to the lastfm icon that I had copied and named wikipedia.png.  But the URL it was pointing to was still: www.myspace.com .. and the shading of the normal and highlighted wikipedia(lastfm) icons was very odd... not the shade of red they are supposed to be for some reason.

Then I tried changing the "strange code" Bryter had written for the Wikipedia button you pointed out: new Button(left_margin + (bw*0),top_margin,bw,bh, 

And instead, used what you had for the lastfm button: new Button(left_margin + bw,top_margin,bw,bh,

Resulting in:

=============================================
function on_metadb_changed() {
   if(!g_metadb) return;
   var myspace = fb.TitleFormat("http://www.myspace.com/$replace(%artist%, ,)").EvalWithMetadb(g_metadb);
   var lastfm = fb.TitleFormat("http://www.last.fm/music/$replace(%artist%, ,+,/,'%'252F,?,'%'3F)/_/$replace(%title%, ,+,/,'%'252F,?,'%'3F)").EvalWithMetadb(g_metadb);
   var youtube = fb.TitleFormat("http://www.youtube.com/results?search_query=$replace(%artist%+%title%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
   var wikipedia = fb.TitleFormat("http://en.wikipedia.org/wiki/$replace(%artist%, ,_)").EvalWithMetadb(g_metadb);
   Buttons = {
      but1: new Button(left_margin,top_margin,bw,bh, {normal: images_path + "myspace.png", hover: images_path + "myspace_h.png"}, function(){WshShell.run(myspace);}, myspace),
      but2: new Button(left_margin + bw,top_margin,bw,bh, {normal: images_path + "lastfm.png", hover: images_path + "lastfm_h.png"}, function(){WshShell.run(lastfm);}, lastfm),
      but3: new Button(left_margin + (bw*2),top_margin,bw,bh, {normal: images_path + "youtube.png", hover: images_path + "youtube_h.png"}, function(){WshShell.run(youtube);}, youtube),
      but4: new Button(left_margin + bw,top_margin,bw,bh, {normal: images_path + "wikipedia.png", hover: images_path + "wikipedia_h.png"}, function(){WshShell.run(wikipedia);}, wikipedia)
   }
=============================================

Applying that code also got no complaints from FB2K.  All 3 of the original buttons appeared correctly, but no new button for Wikipedia was displayed.

Not a big deal... I've been copying and pasting artist names and titles into the Wikipedia search engine in a web browser for ages now.  Just thought this might be a handy shortcut.

TS
Geopoliticus Child Watching the Birth of the New Man

WSH Panel Mod script discussion/help

Reply #916
but4: new Button(left_margin + (bw*0),top_margin,bw,bh, {normal: images_path + "wikipedia.png", hover: images_path + "wikipedia_h.png"}, function(){WshShell.run(wikipedia);}, wikipedia)

I think it should be (bw*3)

WSH Panel Mod script discussion/help

Reply #917
Quote
it says what line the error is on.

when i said this, i was referring to the console message you posted....
Quote
But I keep getting errors that FB2K's console keeps pointing to around the Line 34

that's one line of code you had to double check. 

WSH Panel Mod script discussion/help

Reply #918
I think it should be (bw*3)

Yes!  That did the trick.  FB2K always seems to be very picky about icon sizing.  Not quite sure why the 1st 2 buttons didn't include (bw*1) and (bw*0) coding.

Previously I tried pasted the wikipedia URL into the line for the myspace variable, which applied and queried successfully.  But marc2003's myspace query coding resulted in artist names bigger than one term being reduced to just one term, deleting spaces.  But with (bw*3) set, the rest of Bryter's query string works great. 

Thanks tnnds.
TS
Geopoliticus Child Watching the Birth of the New Man

 

WSH Panel Mod script discussion/help

Reply #919
if button's width=100
1st=0
2nd=100(width)
3rd=200(width*2)
....

WSH Panel Mod script discussion/help

Reply #920
if button's width=100
1st=0
2nd=100(width)
3rd=200(width*2)
....

Yeah... and I got (bw*0) (bw*1) (bw*2) (bw*3) (bw*4) (bw*5) to work quite well by tweaking the code for myspace and lastfm a bit.

There were several little problems with the variable and button code Bryter had posted for querying discogs that I managed to work out.  Here's the complete code for what I finally got to work after I included wikipedia, rateyourmusic and discogs to the myspace, lastfm and youtube URLs in marc2003's basic 'web links' script:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common.js"
// @import "%fb2k_profile_path%marc2003\tooltip_buttons.js"
// @name "Web Links"
// @author "marc2003"
// ==/PREPROCESSOR==

var bw = 32;
var bh = 32;
var top_margin = 0;
var left_margin = 0;

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

var panel_id = window.GetProperty("panel_id", window.id);
var custom_background_file = settings_path + panel_id + "buttons_background";
var custom_background = read(custom_background_file);

on_item_focus_change();

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

function on_metadb_changed() {
    if(!g_metadb) return;
    var myspace = fb.TitleFormat("http://www.myspace.com/$replace(%artist%, ,)").EvalWithMetadb(g_metadb);
    var lastfm = fb.TitleFormat("http://www.last.fm/music/$replace(%artist%, ,+,/,'%'252F,?,'%'3F)/_/$replace(%title%, ,+,/,'%'252F,?,'%'3F)").EvalWithMetadb(g_metadb);
    var youtube = fb.TitleFormat("http://www.youtube.com/results?search_query=$replace(%artist%+%title%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
    var wikipedia = fb.TitleFormat("http://en.wikipedia.org/wiki/$replace(%artist%, ,_)").EvalWithMetadb(g_metadb);
    var rateyourmusic = fb.TitleFormat("http://rateyourmusic.com/artist/$lower($replace(%artist%, ,_))").EvalWithMetadb(g_metadb);
    var discogs = fb.Titleformat("http://www.discogs.com/artist/$replace(%artist%, ,+)").EvalWithMetadb(g_metadb);
    Buttons = {
        but1: new Button(left_margin + (bw*0),top_margin,bw,bh, {normal: images_path + "myspace.png", hover: images_path + "myspace_h.png"}, function(){WshShell.run(myspace);}, myspace),
        but2: new Button(left_margin + (bw*1),top_margin,bw,bh, {normal: images_path + "lastfm.png", hover: images_path + "lastfm_h.png"}, function(){WshShell.run(lastfm);}, lastfm),
        but3: new Button(left_margin + (bw*2),top_margin,bw,bh, {normal: images_path + "youtube.png", hover: images_path + "youtube_h.png"}, function(){WshShell.run(youtube);}, youtube),
        but4: new Button(left_margin + (bw*3),top_margin,bw,bh, {normal: images_path + "wikipedia.png", hover: images_path + "wikipedia_h.png"}, function(){WshShell.run(wikipedia);}, wikipedia),
        but5: new Button(left_margin + (bw*4),top_margin,bw,bh, {normal: images_path + "rateyourmusic.png", hover: images_path + "rateyourmusic_h.png"}, function(){WshShell.run(rateyourmusic);}, rateyourmusic),
        but6: new Button(left_margin + (bw*5),top_margin,bw,bh, {normal: images_path + "discogs.png", hover: images_path + "discogs_h.png"}, function(){WshShell.run(discogs);}, discogs)
    }
    window.Repaint();
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_mouse_rbtn_up(x, y) {
    buttons_menu(x,y);
    return true;
}

function on_paint(gr) {
    buttons_background(gr);
    buttonsDraw(gr);
}


I also googled and found png icons for those 3 websites and photoshopped them down to 32x32 dpi main and highlighted buttons that work with the whole setup.

Haven't been able to figure out if it's possible to center all 6 icons in the WSH panel tho', instead of all being left justified.
TS
Geopoliticus Child Watching the Birth of the New Man

WSH Panel Mod script discussion/help

Reply #921
var bw = 32;
var bh = 32;

you can change it to 24 or 16...any size you want

WSH Panel Mod script discussion/help

Reply #922
you can change it to 24 or 16...any size you want

As long as it matches the actual pixel size of the graphics file you're using as a button.  Otherwise...   
Geopoliticus Child Watching the Birth of the New Man

WSH Panel Mod script discussion/help

Reply #923
I really love this component!  The web links script lets me access a LOT more information about artists than what I get from Last.fm via the biography component.

Would it be possible to write code that could bring up a web browser and display information I've saved in HTML files in many of my album folders?  I also have several PDF files with album info that would be great to have a button in FB2K to access. 

If that's at all doable, would it be possible to have a button 'light up'/highlighted when playing a track with a matching HTML or MHT info file?

Thanks for all your good work on this component marc2003.
TS
Geopoliticus Child Watching the Birth of the New Man

WSH Panel Mod script discussion/help

Reply #924
^utils.FileTest can check for files.

samples updated and now using a new link: http://dl.dropbox.com/u/22801321/samples.zip

new script:

echonest is a webservice that can fetch summaries of various artist info online. use the context menu to change mode between "news", "reviews" and "blogs". it displays the title and a snippet of an article. if you click an article, it will open your default browser taking you to the source. tooltips will show the URL before you click. use the mouse wheel to scroll through all the items.

it looks like this:



if you currently use my older samples, make sure you overwrite all files and re-import any last.fm scripts because there are some new under the hood changes that will break the old versions.