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 1400014 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

WSH Panel Mod script discussion/help

Reply #4100
Hi all,

I must have had a boo-boo with my API key on last-fm; I had to get a new one. Several of marcs scripts are not working anymore, could someone give me a link to the latest samples package? I try to rebuild my foobar.

WSH Panel Mod script discussion/help

Reply #4101
Sorry guys I cannot edit my above post.
My problem concern a) the last_fm script. WSH panel crashes, console says "WSH Panel mod:Parsing file xxx/common7.js error: settings_path is undefined"
and b) when I use the Last.fm Playcount Sync and insert my user name and password, I get the message "Suspended API Key - access to your account has been suspended, contact Last fm.

I have 2 API keys now and both seem alright from the Last FM page. Not sure why both scripts dont work anymore; any and all help really welcome, I am by no means good at these scripts

WSH Panel Mod script discussion/help

Reply #4102
Sorry guys I cannot edit my above post.
My problem concern a) the last_fm script. WSH panel crashes, console says "WSH Panel mod:Parsing file xxx/common7.js error: settings_path is undefined"
and b) when I use the Last.fm Playcount Sync and insert my user name and password, I get the message "Suspended API Key - access to your account has been suspended, contact Last fm.

I have 2 API keys now and both seem alright from the Last FM page. Not sure why both scripts dont work anymore; any and all help really welcome, I am by no means good at these scripts


Don't know if this helps but , Marc says about API:

http://www.hydrogenaud.io/forums/index.php...st&p=900034

WSH Panel Mod script discussion/help

Reply #4103
Sorry doesnt help  I already tried another API Key and get the same result.

WSH Panel Mod script discussion/help

Reply #4104
Okay, I digged through my old files and found older scripts, replaced mine with those and from now on everything is working again. I had not messed with the scripts so I dont really know why this happened, but it is fixed. If anyone wants me to share the working scripts, please PM me.

WSH Panel Mod script discussion/help

Reply #4105
I've got a button that switches my %love% tag between 0 and 1 (1 being love and 0 being not), i've got the button working but can't figure out how to make the button icon change when %love% is 1, here's my current WSH for the button;

Code: [Select]
        new Button(R_hoffset+(R_imgw*5), R_hoffset+(R_imgw*5), by+10, B.width, B.height/3, B, love_button, function () {
        if(g_love.EvalWithMetadb(g_metadb) == 1) {
g_metadb.UpdateFileInfoSimple("LOVE",0);
        } else {
g_metadb.UpdateFileInfoSimple("LOVE",1);
}

}, "Toggle Love"),

i tried setting a variable called "llove" to true/false based on the %love% tag and then use the following

Code: [Select]
        new Button(R_hoffset+(R_imgw*5), R_hoffset+(R_imgw*5), by+10, B.width, B.height/3, B, llove ? love_button : love_button_yes, function () {
        if(g_love.EvalWithMetadb(g_metadb) == 1) {
g_metadb.UpdateFileInfoSimple("LOVE",0);
        } else {
g_metadb.UpdateFileInfoSimple("LOVE",1);
}

}, "Toggle Love"),

but that always just gave me the first icon

thanks in adavance for any advice, i'm not very good with javascript just trying to learn from other scripts i see.

WSH Panel Mod script discussion/help

Reply #4106
Code: [Select]
var loved = g_love.EvalWithMetadb(g_metadb) == 1;
new Button(R_hoffset+(R_imgw*5), R_hoffset+(R_imgw*5), by+10, B.width, B.height/3, B, loved? love_button_yes : love_button, function () {
    g_metadb.UpdateFileInfoSimple("LOVE", loved ? "" : 1);
}, "Toggle Love"),


using an empty string instead of 0 removes the LOVE tag from the file. you can change it back to 0 if you like but i don't see the point of storing it.

WSH Panel Mod script discussion/help

Reply #4107
Thanks alot for cleaning up my messy attempt, i appear to be getting a syntax error when declaring the variable, removing the tag entirely is definitely better.

Code: [Select]
Error: WSH Panel Mod (WSH StrigUI control panel): Microsoft JScript compilation error:
Syntax error
File: C:\Users\Al\foobar2000\\WSH\scripts\WSH_ControlBar.js
Ln: 349, Col: 5
  var loved = g_love.EvalWithMetadb(g_metadb) == 1;

Edit: i got it to work by splitting it into 2 lines so the syntax error is nolonger an issue.

The button now changes based on the tag, but only when i re-load the WSH panel or restart foobar2000 entirely, so i just have to figure out how to refresh the button when its pressed

WSH Panel Mod script discussion/help

Reply #4108
I can nolonger edit my last post but i got it working, thanks alot for the help marc2003!

WSH Panel Mod script discussion/help

Reply #4109
I want to make auto-tag script, that will collect info from last.fm , and automaticaly tag song while playing..
But, when i have time..

Hey i found this this tool that can get Last.fm tags and put them it to genre tags ,there are many interesting tags so you can filter your library to find music easily.Thought you wold be interested if you are making a script
it would be very nice to have wsh script to do this to now playing track rather than doing it manually.
PS:
http://mir-research.blogspot.com/2008/06/l...tagging_29.html
http://michaelmarth.blogspot.com/2009/11/p...-in-itunes.html

WSH Panel Mod script discussion/help

Reply #4110
I adjusted a seekbar script http://www.hydrogenaud.io/forums/index.php...st&p=676629 so it looks like a regular seekbar but with custom colours by modifying two lines and adding one:

gr.FillGradRect(  0, 15,    pos, wh-26, 90, RGB(172,214,255), RGB(172,214,255));
gr.FillGradRect(pos, 15, ww-pos, wh-26, 90, RGB(235,240,254), RGB(235,240,254));
gr.FillGradRect(pos, 7, 8, wh-9, 290, RGB(172,214,255), RGB(172,214,255));    <--- vertical line in question


It looks and works as expected except for one detail, third rectangle disappears at the end of the track: pos+8. It starts too early too but it doesn't matter. Is there a simple way to block it? I tried randomly ;-) some relative dimensions but with no luck. The other relevant part, I think:
Code: [Select]
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var pos = 0;
var length = fb.PlaybackLength;
var txt;

if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
txt = " " + TimeFmt(g_drag_seek * length);
}
else{
pos = window.Width * (fb.PlaybackTime / length);
txt = g_titlefmt.Eval();
}
}
The whole script:
Code: [Select]
//--------
var weight_normal =400;
var weight_bold  =800;
var italic_no =0;
var italic    =1;
var uline_no  =0;
var uline    =1;
//--------
var align_top  =0;
var align_middle=1;
var align_bottom=2;

var align_left  =0;
var align_center=1;
var align_right =2;

var trim_no    =0;
var trim_chara  =1;
var trim_word  =2;
var trim_elips_chara =3;
var trim_elips_word  =4;
var trim_elips_path  =5;

var flag_rtl        =0x0001;
var flag_vert      =0x0002;
var flag_nofit      =0x0004;
var flag_dispctrl  =0x0020;
var flag_nofallback =0x0400;
var flag_trailspace =0x0800;
var flag_nowrap    =0x1000;
var flag_linelimit  =0x2000;
var flag_noclip    =0x4000;

function StrFmt(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
//--------
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
function RGBA(r,g,b,a){ return ((a<<24)|(r<<16)|(g<<8)|(b)); }
//--------
function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}
var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}
//----------------------------------------------------------------------------

var g_font = gdi.Font("PT Sans", 12, 1);
var g_titlefmt = fb.TitleFormat("");
var g_fileinfo = null; 

var g_drag = 0;
var g_drag_seek = 0;

function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var pos = 0;
var length = fb.PlaybackLength;
var txt;

if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
txt = " " + TimeFmt(g_drag_seek * length) ;
}
else{
pos = window.Width * (fb.PlaybackTime / length);
txt = g_titlefmt.Eval();
}
}

gr.FillGradRect(  0, 15,    pos, wh-26, 90, RGB(172,214,255), RGB(172,214,255));
gr.FillGradRect(pos, 15, ww-pos, wh-26, 90, RGB(235,240,254), RGB(235,240,254));
      gr.FillGradRect(pos, 7, 8, wh-9, 290, RGB(172,214,255), RGB(172,214,255));

gr.DrawString(txt, g_font, RGB(81,168,255), 0, 0, ww, wh,
StrFmt(align_right, align_top, trim_no, flag_nowrap | flag_noclip));

gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(255,255,255));
}
function on_size(){
}
function on_focus(focused){
//fb.trace("focus " + focused);
}
function on_key_down(key){
//fb.trace("key " + key);
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
if(g_drag){
g_drag = 0;
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
}
function on_mouse_move(x,y){
if(g_drag){
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
}
function on_mouse_wheel(delta){
//fb.trace("wheel " + delta);
}
//--------
function on_playback_starting(cmd, paused){
}
function on_playback_new_track(info){
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_pause(state){
}
function on_playback_edited(){
}
function on_playback_dynamic_info(){
}
function on_playback_dynamic_info_track(){
}
function on_playback_time(time){
window.Repaint();
}
function on_volume_change(val){
}

//EOF

WSH Panel Mod script discussion/help

Reply #4111
subtract 8 pixels from the width of the seekbar. so even when the track is right at the end, the "grabber" will just be touching the right edge of the panel.

Quote
var ww = window.Width - 8;

WSH Panel Mod script discussion/help

Reply #4112
subtract 8 pixels from the width of the seekbar. so even when the track is right at the end, the "grabber" will just be touching the right edge of the panel.

Quote
var ww = window.Width - 8;


Thanks, it didn't exactly work because it uses window.width later in script but perfect direction, adjusting those did work. I'm at inner peace now.

WSH Panel Mod script discussion/help

Reply #4113
you may consider removing this...

Code: [Select]
function on_playback_seek(time){
    window.Repaint();
}


and replacing it with this...

Code: [Select]
window.SetInterval(function () {
    if (fb.IsPlaying && !fb.IsPaused && fb.PlaybackLength > 0)
        window.Repaint();
}, 150);


now it will update several times a second instead of once a second resulting in much smoother movement. this will be more noticeable on shorter tracks.

WSH Panel Mod script discussion/help

Reply #4114
Could someone help me? I keep getting an error on Marc's Last fm Script:


The Error I am getting is:
Scripting Engine Initialization Failed (Last.fm by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

And the console says:
Syntaxerror Ln 239, Col 1

Pointing to this Line

Code: [Select]
parsed_data = JSON.parse(g_text);

WSH Panel Mod script discussion/help

Reply #4115
that must be some ancient script because i can't even remember naming something just "last.fm" and i can't remember using JSON.parse like that either. try this... (it won't make the script work but it will report the server response to the foobar console)

Code: [Select]
try {
     parsed_data = JSON.parse(g_text);
} catch(e) {
     parsed_data = [];
     fb.trace("JSON.parse error: " + g_text);
}

WSH Panel Mod script discussion/help

Reply #4116
Hey i found this this tool that can get Last.fm tags and put them it to genre tags ,there are many interesting tags so you can filter your library to find music easily.Thought you wold be interested if you are making a script
it would be very nice to have wsh script to do this to now playing track rather than doing it manually.
PS:
http://mir-research.blogspot.com/2008/06/l...tagging_29.html
http://michaelmarth.blogspot.com/2009/11/p...-in-itunes.html


Thanks, this is a python script, and it's a good example how to get tags. I only wait to see when new last.fm beta be available, would there be some changes in API and get info. Since i never try JSON i asked Marc for quick example in WSH(i can't learn from 1000 page's he wrote). I can scratch info from page, but this is a bad idea for such script. So i must learn before start.
Anyway i'l make script on one or other way..

 

WSH Panel Mod script discussion/help

Reply #4117
there shouldn't be any changes to the last.fm api. as for learning how to work JSON... google it. how do you think i learned?

WSH Panel Mod script discussion/help

Reply #4118
there shouldn't be any changes to the last.fm api. as for learning how to work JSON... google it. how do you think i learned?


Thanks Marc, i know that you have better things to do than to give examples.. I find some but it's a different from what i should use in foobar..

WSH Panel Mod script discussion/help

Reply #4119
Hey i found this this tool that can get Last.fm tags and put them it to genre tags ,there are many interesting tags so you can filter your library to find music easily.Thought you wold be interested if you are making a script
it would be very nice to have wsh script to do this to now playing track rather than doing it manually.
PS:
http://mir-research.blogspot.com/2008/06/l...tagging_29.html
http://michaelmarth.blogspot.com/2009/11/p...-in-itunes.html

Thanks, this is a python script, and it's a good example how to get tags. I only wait to see when new last.fm beta be available, would there be some changes in API and get info. Since i never try JSON i asked Marc for quick example in WSH(i can't learn from 1000 page's he wrote). I can scratch info from page, but this is a bad idea for such script. So i must learn before start.
Anyway i'l make script on one or other way..

I found this interesting , so here's a script to help you out.
In properties add your last.fm api key.
Buttons work only when track is playing, and existing genre tags are overwritten.

BTW http://www.w3schools.com/js/ is a good place to start.

Code: [Select]
// ==PREPROCESSOR==
// @name "Lastfm track.getInfo Genre Tag"
// @author "zeremy"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var api_key = window.GetProperty("LastFM api key", "");
var text = "";
var objXMLHTTP = new ActiveXObject("MSXML2.XMLHTTP");

function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

ButtonStates = {
    normal: 0,
    hover: 1,
    down: 2,
    hide: 3
}

var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;

var g_theme = window.CreateThemeManager("Button");
var g_font = gdi.Font("Tahoma", 12);

function SimpleButton(x, y, w, h, text, fonClick, state) {
    this.state = state ? state : ButtonStates.normal;
    this.x = x;
    this.y = y;
    this.w = w;
    this.h = h;
    this.text = text;
    this.fonClick = fonClick;

    this.containXY = function(x, y) {
        return (this.x <= x) && (x <= this.x + this.w) && (this.y <= y) && (y <= this.y + this.h);
    }

    this.changeState = function(state) {
        var old = this.state;
        this.state = state;
        return old;
    }

    this.draw = function(gr) {
        if (this.state == ButtonStates.hide) return;

        switch (this.state) {
            case ButtonStates.normal:
                g_theme.SetPartAndStateId(1, 1);
                break;

            case ButtonStates.hover:
                g_theme.SetPartAndStateId(1, 2);
                break;

            case ButtonStates.down:
                g_theme.SetPartAndStateId(1, 3);
                break;

            case ButtonStates.hide:
                return;
        }

        g_theme.DrawThemeBackground(gr, this.x, this.y, this.w, this.h);
        gr.GdiDrawText(this.text, g_font, RGB(0, 0, 0), this.x, this.y, this.w, this.h, DT_WORDBREAK | DT_CENTER | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX);
    }

    this.onClick = function() {
        this.fonClick && this.fonClick();
    }
}

function drawAllButtons(gr) {
    for (var i in $buttons) {
        $buttons[i].draw(gr);
    }
}

function chooseButton(x, y) {
    for (var i in $buttons) {
        if ($buttons[i].containXY(x, y) && $buttons[i].state != ButtonStates.hide) return $buttons[i];
    }

    return null;
}

$buttons = {
    FindTags: new SimpleButton(5, 5, window.Width / 2 - 5, 30, "Get TopTags from Last.fm", function() {
        getTags();
    }),
    WriteTags: new SimpleButton(window.Width / 2, 5, window.Width / 2 - 5, 30, "Add TopTags from Last.fm to file", function() {
        writeTags();
    }),
}

var cur_btn = null;
var g_down = false;


function on_paint(gr) {
    myfont = gdi.Font("Segoe UI", 12, 0)
    col = utils.GetSysColor(1);
    col2 = utils.GetSysColor(0);
    gr.FillSolidRect(0, 0, window.Width, window.Height, col);
    gr.GdiDrawText(text, myfont, col2, 0, 40, window.Width, window.Height, DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
    drawAllButtons(gr);
}

function on_mouse_move(x, y) {
    var old = cur_btn;
    cur_btn = chooseButton(x, y);

    if (old == cur_btn) {
        if (g_down) return;
    } else if (g_down && cur_btn && cur_btn.state != ButtonStates.down) {
        cur_btn.changeState(ButtonStates.down);
        window.Repaint();
        return;
    }

    old && old.changeState(ButtonStates.normal);
    cur_btn && cur_btn.changeState(ButtonStates.hover);
    window.Repaint();
}

function on_mouse_leave() {
    g_down = false;

    if (cur_btn) {
        cur_btn.changeState(ButtonStates.normal);
        window.Repaint();
    }
}

function on_mouse_lbtn_down(x, y) {
    g_down = true;

    if (cur_btn) {
        cur_btn.changeState(ButtonStates.down);
        window.Repaint();
    }
}

function on_mouse_lbtn_up(x, y) {
    g_down = false;

    if (cur_btn) {
        cur_btn.onClick();
        cur_btn.changeState(ButtonStates.hover);
        window.Repaint();
    }
}

function getTags() {
    if (fb.IsPlaying) {
        p_metadb = fb.GetNowPlaying();
        artist = fb.TitleFormat("%artist%").EvalWithMetadb(p_metadb);
        title = fb.TitleFormat("%title%").EvalWithMetadb(p_metadb);
        file = fb.TitleFormat("%path%").EvalWithMetadb(p_metadb);
        if (artist == "" || artist == "?" || title == "" || title == "?") return;

        url = "https://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=" + api_key + "&artist=" + encodeURIComponent(artist) + "&track=" + encodeURIComponent(title) + "&format=json";
        fb.trace(url);
        try {
            objXMLHTTP.open("GET", url, false);
            objXMLHTTP.send("");
            urlreadyState = (objXMLHTTP.readyState);
            urlstatus = (objXMLHTTP.status);
            fb.trace("urlreadyState: " + urlreadyState);
            fb.trace("urlstatus: " + urlstatus);
            if (urlreadyState == "4" && urlstatus == "200") {
                data = objXMLHTTP.ResponseText;
                //    fb.trace(data);
                objXMLHTTP.Close;
            }

            json_data = JSON.parse(data);

            artist_name = json_data.track.artist.name;
            fb.trace("Artist Name: " + artist_name);
            title_name = json_data.track.name;
            fb.trace("Title Name: " + title_name);

            top_tags = json_data.track.toptags.tag;
            top_tags_values = [];

            items = top_tags.length;

            if (top_tags.length > 0) {
                for (i = 0; i < items; i++) {
                    name = json_data.track.toptags.tag[i].name.replace(/&amp;/g, " \& ");
                    top_tags_values.push(name);
                }
            }
           
            fb.trace("Tags From Last.fm:" + top_tags_values);
           
            text = "File Name: " + file + "\n" + "Artist Name: " + artist_name + "\n" + "Title Name: " + title_name + "\n\n" + "Tags From Last.fm: " + top_tags_values;
           
            objXMLHTTP.Close;
        } catch (err) {
            objXMLHTTP.Close;
        }
    }
}


function writeTags() {
    if (fb.IsPlaying) {
        g_metadb = fb.GetNowPlaying();

        fb.trace("Values to be added: " + top_tags_values);

        tags = top_tags_values.toString();

        tags = tags.replace(/,/g, "; ");

        g_metadb.UpdateFileInfoSimple("GENRE", tags);
       
        text = "Tags Written to File \n" + file;
        window.Repaint();

    }
}

function on_playback_stop() {
    text = "";
    tags = "";
    window.Repaint();
}

WSH Panel Mod script discussion/help

Reply #4120
I found this interesting , so here's a script to help you out.
In properties add your last.fm api key.
Buttons work only when track is playing, and existing genre tags are overwritten.

BTW http://www.w3schools.com/js/ is a good place to start.

Thank you for this zeremy  and it's working perfectly !!



WSH scripts are written in j script  and java script is  pretty much the same (ECMAscript compatible) so java script libraries like d3,jQuery will work in WSH panel ??

WSH Panel Mod script discussion/help

Reply #4121
I found this interesting , so here's a script to help you out.
In properties add your last.fm api key.
Buttons work only when track is playing, and existing genre tags are overwritten.

BTW http://www.w3schools.com/js/ is a good place to start.

Thank you for this zeremy  and it's working perfectly !!



WSH scripts are written in j script  and java script is  pretty much the same (ECMAscript compatible) so java script libraries like d3,jQuery will work in WSH panel ??

Glad you like it.

Fix a typo at line 226 please replace

g_metadb.UpdateFileInfoSimple("GENRE", tags);

with

g_metadb.UpdateFileInfoSimple("GENRE", tags, "GENRE");

I really don't know if those libraries can be imported.
I once tried jQuery without any result.

WSH Panel Mod script discussion/help

Reply #4122
I found this interesting , so here's a script to help you out.
In properties add your last.fm api key.
Buttons work only when track is playing, and existing genre tags are overwritten.

BTW http://www.w3schools.com/js/ is a good place to start.


Oh well, you did it, thanks
now i can use JSON

Ok, what i want to do (is menu) like this:


-Auto Tag> 
*Apply on empty tag
*Rewrite existing Tags

-Manualy Tag>
*list of tags from last.fm (user can select tag to apply)

-Tag all tracks in playlist.. (it goes trough active playlist and tag all songs one by one)

-Write 'similar artist to tag' (you can use this to play similar artist from library later)

...Only button , without panel, or option to hide panel..

WSH Panel Mod script discussion/help

Reply #4123
Well
now you can use JSON

For menu button you have done it before so I guess its not that hard.

I suggest that you use another metadata field to save these values e.g LASTFMTOPTAGS instead of GENRE.
g_metadb.UpdateFileInfoSimple("LASTFMTOPTAGS", tags, "LASTFMTOPTAGS");

*Apply on empty tag

fileinfo = g_metadb.GetFileInfo();
idx = fileinfo.MetaFind("LASTFMTOPTAGS");
vidx = fileinfo.MetaValueCount(idx);

if (vidx == 0 )  //WRITE TAG CODE HERE//


*Rewrite existing Tags

Look into concat() function to join arrays and then write tags

-Manualy Tag>
*list of tags from last.fm (user can select tag to apply)

The array list of tags  must be converted to menu entries.

var _menu = window.CreatePopupMenu();
array = [];

for (i = 0; i < array.length; i++)
        {
            _menu.AppendMenuItem(MF_STRING, i + 1, array);
        }

        var idx = _menu.TrackPopupMenu(30, 300);

        if (idx > 0)

            //WRITE CODE HERE TO APPLY TO//  array[idx - 1]);


-Tag all tracks in playlist.. (it goes trough active playlist and tag all songs one by one)
Not so easy...

-Write 'similar artist to tag' (you can use this to play similar artist from library later)
You would have to get artist.getSimilar json

http://www.last.fm/api/show/artist.getSimilar

WSH Panel Mod script discussion/help

Reply #4124
tagging multiple items in a playlist is easy enough. you might want to limit how many you attempt at once though.

Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist)
var count = items.Count;
for (var i = 0; i < count; i++) {
    items.item(i).UpdateFileInfoSimple(tag, value);
}
items.Dispose();


if you don't want to tag all playlist items but just selected items, you can do this...

Code: [Select]
var items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);