HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: marc2003 on 2010-01-15 12:13:57

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-15 12:13:57
taken from the main WSH panel mod thread....

A semi-offtopic suggestion:
Maybe the script exchange business could take place elsewhere, so this topic would be left for the general component discussion only? By that I mean information about new releases, feature requests, bug reports and other support, while the creations of the users and stories about the others struggling to use them would be kept separate.


definitely a great idea. so here's a new thread for it.

to get us started, here's a replacement artwork panel i made. it does a few things the standard CUI/DUI* panels can't do...

http://javascript.pastebin.com/f7aeaaa1b (http://javascript.pastebin.com/f7aeaaa1b)

-if you edit/add artwork for the currently playing track, use the "Refresh" context menu item to see the changes without having to restart playback.
-changes made in the foobar display preferences also take effect immediately if you use the "Refresh" command. currently, the DUI/CUI artwork panels require a foobar restart for those changes to take effect.
-displays artwork for the previously played/selected track on foobar startup.
-you can lock the panel size in pixels. no more messing around locking splitters. both CUI and DUI obey the limits set in the panel.
-tooltip to show if the artwork is embedded or not. it also shows the actual image dimensions plus the currently displayed size.
-it has the usual context menu options you would expect to set front/back/cover/artist/etc

(*for those that aren't aware - WSH panel mod can now run in DUI natively without dockable panels)

for people who are new to WSH panel mod, remember to download the samples (http://code.google.com/p/foo-wsh-panel-mod/downloads/list) as there's lots of good stuff to get you going.
Title: WSH Panel Mod script discussion/help
Post by: NullString on 2010-01-15 12:52:24
nice G!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-15 16:01:54
here's another script. this is for DUI only. it allows you to create your own buttons of any size, using any images you like. by default it uses the DUI background colour (it changes colour as you change theme).

(http://k5sbdw.blu.livefilestore.com/y1pnSC1mxAv6zhmAM9tfE2dwzsyFDhkqYGiuFMesBndW9eoZHe5qxCOF5yc8mNhFPclrKdUihbbhFwnKRIm9kqrQBlCbLdfhstS/buttons1.png)

but it also has an option to set the background to the same colour as the splitter or your own custom colour which you can specify in the script.

(http://k5sbdw.blu.livefilestore.com/y1pJxLDqo4xDIfZw7SeL2pG3laazoPtzxyubTBVq5ROMGuWuTLukt86QIh4o4ZTRdRJUv27cmgxN9J9C89OPv2tKvIiOMrNkWU-/buttons2.png)

it does require a little tinkering to get going so here's a guide. first of all download and save this script....

http://javascript.pastebin.com/f77d9e62f (http://javascript.pastebin.com/f77d9e62f)

you need to create a folder called scripts inside your main foobar directory. make sure you save the file inside this folder and name it dui_buttons.js

next you need to add a WSH panel to your layout. copy/paste this

http://javascript.pastebin.com/f1c08ceca (http://javascript.pastebin.com/f1c08ceca)

into your panel and read the comments (sorry for the rambling). here are the images i've used.

http://cid-649d3bfeaf541fbb.skydrive.live....uide/images.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/images.zip)

extract into your foobar install directory.

it should at least be a starting point for anyone wanting to create their own button toolbars.
Title: WSH Panel Mod script discussion/help
Post by: anishbenji on 2010-01-15 17:27:28
Hi marc,
The custom WSH panel based album art viewer is cool. Would it be possible make it keep its aspect ratio constant, instead of keeping the dimensions fixed as foobar2000 changes sizes?
Anish
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-15 18:32:31
you mean what i put in the very first 2 lines of the script?

Quote
//edit this line or comment it out if you don't want a fixed size....
window.MinWidth = window.MinHeight = window.MaxWidth = window.MaxHeight = 375;


and you use the context menu to control the aspect ratio of the image itself, just like the standard artwork panel.

Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2010-01-15 18:42:41
Wow... great work, marc! Thank you very much for this.

Just an idea: Might it be possible to open the art-containing folder by doubleclick? I mean, like in the default album art-panel (DUI).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-15 19:25:34
sorry but i don't think that is possible with this component.
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2010-01-15 19:27:03
Ok, thanks for your answer.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-15 20:17:07
here's another script for DUI. it's a ratings panel that displays the current rating and of course lets you set it. it works with the official playback statistics component. it has the same context menu options as the "buttons" panel above to set the background colour.

when foobar is playing it sticks to now playing. and when playback is stopped, it follows the cursor.

just copy/paste this code into a new panel and download these images and extract them to your foobar folder.

(credit to NEMO7538 for providing the original rating code)

script: http://javascript.pastebin.com/f5450d71a (http://javascript.pastebin.com/f5450d71a)
images: http://cid-649d3bfeaf541fbb.skydrive.live....uide/rating.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/rating.zip)
screenshot: http://k5sbdw.blu.livefilestore.com/y1pQER...-BTE/rating.png (http://k5sbdw.blu.livefilestore.com/y1pQEROMvP8PeG-iiDic9gDEb2TxQrfW45PGezY61A9hdyduzWqDXS-Sa3RLcYHr9lLW4ecDYwTRkyiy1DHBRx9fqlsVp9B-BTE/rating.png)



Title: WSH Panel Mod script discussion/help
Post by: anishbenji on 2010-01-15 21:25:59
//edit this line or comment it out if you don't want a fixed size....
window.MinWidth = window.MinHeight = window.MaxWidth = window.MaxHeight = 375;

Yes, just like that. I'm an idiot.
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-01-15 23:06:19
I recall some poster somewhere talking about a WSH version of the biography component that could be used with the DUI. Was there any progress on that?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-15 23:40:26
interesting idea. getting the text from last.fm feeds is fairly trivial as i'm already doing this with another script. but how to get the images, i don't know.
Title: WSH Panel Mod script discussion/help
Post by: anishbenji on 2010-01-16 05:58:19
//edit this line or comment it out if you don't want a fixed size....
window.MinWidth = window.MinHeight = window.MaxWidth = window.MaxHeight = 375;

Yes, just like that. I'm an idiot.

Actually, what I want is slightly different from this (I really shouldn't post in the middle of the night when I'm half asleep). I want behavior that is similar to the DUI & CUI, when the album view panel is not locked, except the panel keeps its aspect ratio constant.
Anish
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 09:20:38
i have absolutely no idea what you're talking about. there is a "Correct Aspect Ratio" option on the context menu which behaves exactly the same as the normal DUI/CUI panels.
Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-01-16 09:40:38
I recall some poster somewhere talking about a WSH version of the biography component that could be used with the DUI. Was there any progress on that?


+1
drool... do want
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 10:52:49
Here my new mod of the album art panel. There is now buttons on the panel which will fade when entering. Actually there is one button to refresh, prev, play/pause/next and one buttons i use to launch Album Art Downloader.
Right now buttons are placed at the bottom but i will make it configurable through the menu.
To make it work you must change that line
Code: [Select]
window.SetProperty("BtnimageDirectory", fb.FoobarPath + "Images/tintin/buttons/");
To the path that will contain your buttons images. You must have a Prev.png, Pause.png, next.png. reload.png, albumart.png.

This is a work in progress!
Code: [Select]
//edit this line or comment it out if you don't a fixed size....
//window.MinWidth = window.MinHeight = window.MaxWidth = window.MaxHeight = 200;

var RefreshInterval = 50;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//no need to edit anything below here///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var g_metadb = fb.GetFocusItem();
var NewImage, CurImage, new_width, new_height = null;
var CurSize = null;
var NewSize = null;
var ww = window.Width;
var wh = window.Height;
var opacity = 255;
var step = Math.min(Math.ceil(255*RefreshInterval/300),255);
var timer = null;
var cur_btn = null;

var g_tooltip = window.CreateTooltip();
var hover = null;
var dui = window.InstanceType;
window.GetProperty("aspect",1);
window.GetProperty("id",0);
window.SetProperty("BtnimageDirectory", fb.FoobarPath + "Images/tintin/buttons/");
window.GetProperty("Buttons", 1);

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

function on_timer(id) {
    Buttons.OnTimer && Buttons.OnTimer(id);
if (timer && id==timer.ID) {
if (opacity>0) {
opacity = Math.max(opacity-step,0);
window.Repaint();
} else {
CurImage = NewImage;
CurSize = NewSize;
NewImage = null;
NewSize = null;
opacity = 255;
timer && window.KillTimer(timer);
timer = null;
CollectGarbage(); // Release memory.
//window.RepaintRect(this.x, this.y, this.width, this.height);
}
}
}

function on_size() {
ww = window.Width;
wh = window.Height;
Buttons.OnResize && Buttons.OnResize(ww, wh);

}

function on_colors_changed() {
window.Repaint();
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, dui ==1 ? window.GetColorDUI(1) : window.GetColorCUI(3));
var Img, size;
if (Img = CurImage) {
currentopacity = opacity;
size = CurSize;
gr.DrawImage(Img, size.x, size.y, size.width, size.height, 0, 0, Img.width, Img.height, 0, opacity);
}
if (Img = NewImage) {
currentopacity = 255-opacity;
size = NewSize;
gr.DrawImage(Img, size.x, size.y, size.width, size.height, 0, 0, Img.width, Img.height, 0, 255-opacity);
}

//gr.DrawImage(g_img, pos_x, pos_y, new_width, new_height, 0, 0, g_img.Width, g_img.Height);

if(dui == 1)
{
    gr.DrawRect(0,0, window.Width, window.Height, 1.0, RGB(160,160,160));
}
Buttons.OnPaint && Buttons.OnPaint(gr);
}

function CalcNewImgSize(img) {
var size = {x:0, y:0, width:ww, height:wh};
if (img) {
if(window.GetProperty("aspect") == 1) {
var scale_w = ww / img.Width;
var scale_h = wh / img.Height;
scale = Math.min(scale_w, scale_h);
if (scale_w < scale_h)
size.y = (wh - g_img.height * scale) / 2;
else if (scale_w > scale_h)
size.x = (ww - img.Width * scale) / 2;
size.width = img.Width * scale;
size.height = img.Height * scale
}
}
return size;
}

function on_playback_new_track(){
Buttons.SetPauseStatus && Buttons.SetPauseStatus();
    changeImage();
}

function on_playback_pause(state) {
Buttons.SetPauseStatus && Buttons.SetPauseStatus();
window.Repaint();
}

function on_playback_stop(reason){
Buttons.SetPauseStatus && Buttons.SetPauseStatus();
}

function changeImage() {
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

is_embedded = "No";
if(g_metadb) {
type = window.GetProperty("id");
g_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, type);
if(g_img) {
is_embedded = "Yes";
} else {
g_img = utils.GetAlbumArtV2(g_metadb, type);
}
if (NewImage) {
CurImage = NewImage;
CurSize = NewSize;
opacity = 255;
}
NewImage = g_img;
NewSize = CalcNewImgSize(NewImage);
if (!timer) timer = window.CreateTimerInterval(RefreshInterval);

window.Repaint();
}

//if ( fb.IsPlaying) return;

}

function on_item_focus_change()
{
if (!fb.IsPlaying)
{
changeImage();
}
}

changeImage();

function on_mouse_move(x,y) {
    Buttons.OnMouseMove && Buttons.OnMouseMove(x, y);
if(!hover) {
if (NewImage)
{
g_tooltip.Text = "Embedded image: " + is_embedded + ". Actual size: " + NewImage.Width + " x " + NewImage.Height + ". Current size: " + Math.round(NewSize.width) + " x " + Math.round(NewSize.height) + ".";
}
else if (CurImage)
{
g_tooltip.Text = "Embedded image: " + is_embedded + ". Actual size: " + CurImage.Width + " x " + CurImage.Height + ". Current size: " + Math.round(CurSize.width) + " x " + Math.round(CurSize.height) + ".";
}
g_tooltip.Activate();
hover = true;
}
}

function on_mouse_leave() {
    Buttons.OnMouseLeave && Buttons.OnMouseLeave();
g_tooltip.Deactivate();
hover = null;
}

function on_mouse_lbtn_down(x,y){
Buttons.OnLbtnDown && Buttons.OnLbtnDown(x, y);
}

function on_mouse_lbtn_up(x, y) {
    Buttons.OnLbtnUp && Buttons.OnLbtnUp(x, y);
}


function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Refresh");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Correct Aspect Ratio");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 4, "Front Cover");
_menu.AppendMenuItem(MF_STRING, 5, "Back Cover");
_menu.AppendMenuItem(MF_STRING, 6, "Disc");
_menu.AppendMenuItem(MF_STRING, 7, "Icon");
_menu.AppendMenuItem(MF_STRING, 8, "Artist");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
//_menu.AppendMenuItem(MF_STRING, 9, "Properties");
_menu.AppendMenuItem(MF_STRING, 10, "Configure...");
_menu.CheckMenuItem(2, window.GetProperty("aspect") == 0 ? 0x0 : 0x8);
_menu.CheckMenuRadioItem(4, 8, window.GetProperty("id")+4);
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
case 1:
changeImage();
break;
case 2:
window.GetProperty("aspect") == 0 ? window.SetProperty("aspect", 1) : window.SetProperty("aspect", 0);
changeImage();
window.Repaint();
break;
case 4:
case 5:
case 6:
case 7:
case 8:
window.SetProperty("id", idx-4);
changeImage();
break;
case 9:
window.ShowProperties();
break;
case 10:
window.ShowConfigure();
break;
}
_menu.Dispose();
return true;
}

//if (window.GetProperty("Buttons") == 1) {
if (true) {
var Buttons = new function () {
var BtnDir = window.GetProperty("BtnimageDirectory");
var Position = 4;
this.x = 100;
this.y =0;
this.width = 0;
this.height = 0;
var opacity = 0;
var defaultOp = 150;
var hbtn = null;
var dbtn = null;
var timer = null;
var RefreshInterval = 50;
var step = 40;
var dstOp = 0;
var _this = this;
this.BtnsArray = new Array();

// Define button class ------------------------------------------------
var Button = function (x, y, img, OnClick, tiptext) {
this.x = x;
this.y = y;
this.width = img.width;
this.height = img.height;
this.Img = img;
this.tiptext = tiptext;
this.state = 0; // 0=normal, 1=hover, 2=down, 3=disabled
this.enabled = true;
this.OnClick = OnClick;
var Tooltip = g_tooltip;

this.isXYinBtn = function (x, y) {
if (!this.enabled) return false;
return (x >= this.x && y >= this.y && x<= this.x + this.width && y <= this.y + this.height) ? true : false;
};

this.Draw = function (gr, op) {
if (!opacity) return;
gr.DrawImage(this.Img, this.x, this.y, this.width, this.height, 0, 0, this.width, this.height, 0, opacity);
};

this.ChangeState = function (s, enabled) {
//if (!this.enabled && !enabled) return;
if (enabled===undefined) {
if (s==this.state)
return;
else
this.state = s;
} else {
this.enabled = enabled;
this.state = enabled ? 0 : 3;
}
if (s==1) {
Tooltip.Text =  this.tiptext;
Tooltip.Activate();
} else
Tooltip.Deactivate();
if (opacity)
window.RepaintRect(Math.max(0, this.x), Math.max(0, this.y),
Math.min(window.width,this.width), Math.min(window.height, this.height));
};
};

// Create buttons --------------------------------
var img_play = gdi.image(BtnDir+"Play.png");
var img_pause = gdi.image(BtnDir+"Pause.png");
var img_next = gdi.image(BtnDir+"Next.png");
var img_prev = gdi.image(BtnDir+"Prev.png");
var img_reload = gdi.image(BtnDir+"reload.png");
var img_albumart = gdi.image(BtnDir+"albumart.png");
var xOffset = this.x;
this.BtnsArray.push(new Button(xOffset, this.y, img_reload, function(){changeImage();}, "Refresh"));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;
this.BtnsArray.push(new Button(xOffset, this.y, img_prev, function(){fb.Prev();}, "Previous"));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;
this.BtnsArray.push(PlayBtn = new Button(xOffset, this.y, img_play, function(){fb.PlayOrPause();}, ""));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;
this.BtnsArray.push(new Button(xOffset, this.y, img_next, function(){fb.Next();}, "Next"));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;
this.BtnsArray.push(new Button(xOffset, this.y, img_albumart, function(){fb.RunContextCommand("Run service/AlbumArt");}, "NexAlbumArt"));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;


PlayBtn.tiptext_play = "Play";
PlayBtn.tiptext_pause = "Pause";
PlayBtn.tiptext = fb.IsPaused ? PlayBtn.tiptext_play : PlayBtn.tiptext_pause;
PlayBtn.img_pause = img_pause;
PlayBtn.img_play = img_play;
PlayBtn.Img = fb.IsPlaying ? PlayBtn.img_pause : PlayBtn.img_play;
PlayBtn.ChangeState(null, true);
this.PlayBtn = PlayBtn;

this.width = xOffset-this.x;
this.height = PlayBtn.height;



this.SetPauseStatus = function () {
if (fb.IsPlaying && !fb.IsPaused) {
PlayBtn.Img = PlayBtn.img_pause;
PlayBtn.tiptext = PlayBtn.tiptext_pause;
} else {
PlayBtn.Img = PlayBtn.img_play;
PlayBtn.tiptext = PlayBtn.tiptext_play;
}
};

var isXYinBtns = function (x, y) {
return (x >= _this.x && y >= _this.y && x<= _this.x + _this.width && y <= _this.y + _this.height) ? true : false;
};

var Fading = function (dstop) {
if (dstOp==dstop) return;
dstOp = dstop;
if (!timer) timer = window.CreateTimerInterval(RefreshInterval);
};

this.OnPaint = function (gr) {
if (!opacity) return;
for (var i=0; i<this.BtnsArray.length; i++)
this.BtnsArray[i].Draw(gr, opacity);
};

this.OnMouseMove = function (x, y) {
if (isXYinBtns(x, y)) {
if (opacity!=255) {
dstOp = 255;
opacity = 255;
window.RepaintRect(Math.max(0, this.x), Math.max(0, this.y),
Math.min(window.width,this.width), Math.min(window.height, this.height));
}
} else if (opacity!=defaultOp)
Fading(defaultOp);

if (dbtn) {
if (dbtn.isXYinBtn(x, y))
dbtn.ChangeState(2);
else
dbtn.ChangeState(1);
} else {
for (var i=0; i < this.BtnsArray.length ; i++)
if (this.BtnsArray[i].isXYinBtn(x,y)) {
if (hbtn!=this.BtnsArray[i]) {
if(hbtn) hbtn.ChangeState(0);
hbtn = this.BtnsArray[i];
hbtn.ChangeState(1);
}
break;
}
if (i==this.BtnsArray.length) {
if (hbtn) {
hbtn.ChangeState(0);
hbtn = null;
}
}
}
};

this.OnLbtnDown = function (x, y) {
if (hbtn) {
dbtn = hbtn;
dbtn.ChangeState(2);
}
};

this.OnLbtnUp = function (x, y) {
if (dbtn) {
if (dbtn.state==2) {
dbtn.OnClick();
dbtn.ChangeState(1);
}
dbtn = null;
this.OnMouseMove(x, y);
}
};

this.OnMouseLeave = function () {
Fading(0);
if (hbtn) {
hbtn.ChangeState(0);
hbtn = null;
}
};

this.OnTimer = function (id) {
if (timer && id==timer.ID) {
if (opacity==dstOp) {
timer && window.KillTimer(timer);
timer = null;
CollectGarbage(); // Release memory.
//window.RepaintRect(this.x, this.y, this.width, this.height);
} else {
if (opacity<dstOp)
opacity = Math.min(opacity+step, dstOp);
else
opacity = Math.max(opacity-step, dstOp);
window.RepaintRect(Math.max(0, this.x), Math.max(0, this.y),
Math.min(window.width,this.width), Math.min(window.height, this.height));
}
}
};

this.OnResize = function (ww, wh) {
if (Position==1 || Position==4)
this.x = (ww-this.width)/2;
else if (Position==2 || Position==5)
this.x = ww-this.width;

if (Position>2)
this.y = wh-this.height;

var x = this.x;
for (var i=0; i<this.BtnsArray.length; i++) {
this.BtnsArray[i].x = x;
x += this.BtnsArray[i].width;
if (Position>2)
this.BtnsArray[i].y = wh-this.BtnsArray[i].height;
else this.BtnsArray[i].y = 0;
};
this.width = x-this.x;
};
this.OnResize(window.Width, window.Height);

} ();

} else
var Buttons = {};
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 10:58:26
work in progress of text only bio panel for DUI.

[a href="http://k5sbdw.blu.livefilestore.com/y1pPOpFoa7lzRfqT7f4wY_qJxB5ZCBSqi3ON2CXShGq84Oe67KFT7tdZLopO_jmF-pYnYeY7wX2cuqIV63p_t1u2_WkBj7Js7az/bio.png" target="_blank"]
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-16 11:30:45
Here my new mod of the album art panel. There is now buttons on the panel which will fade when entering. Actually there is one button to refresh, prev, play/pause/next and one buttons i use to launch Album Art Downloader.
Right now buttons are placed at the bottom but i will make it configurable through the menu.
To make it work you must change that line
Code: [Select]
window.SetProperty("BtnimageDirectory", fb.FoobarPath + "Images/tintin/buttons/");

To the path that will contain your buttons images. You must have a Prev.png, Pause.png, next.png. reload.png, albumart.png.

This is a work in progress!


That's pretty cool.  What would be really awesome is if your fading effects could somehow be merged with marc2003's button script to easily create buttons that fade between the normal state and hover state.
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 11:33:22
Sorry but i dont see what script. May be i can do it.
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-16 11:37:58
Sorry but i dont see what script. May be i can do it.


This one here: http://javascript.pastebin.com/f77d9e62f (http://javascript.pastebin.com/f77d9e62f)
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 11:40:32
Sorry but i dont see what script. May be i can do it.


This one here: http://javascript.pastebin.com/f77d9e62f (http://javascript.pastebin.com/f77d9e62f)

Ok so that s the first one i used but i dont want it because you cant hae centered buttons. in this script the buttons have fixed position.
Title: WSH Panel Mod script discussion/help
Post by: MB. on 2010-01-16 12:02:40
here's another script. this is for DUI only. it allows you to create your own buttons of any size, using any images you like. by default it uses the DUI background colour (it changes colour as you change theme).

(http://k5sbdw.blu.livefilestore.com/y1pnSC1mxAv6zhmAM9tfE2dwzsyFDhkqYGiuFMesBndW9eoZHe5qxCOF5yc8mNhFPclrKdUihbbhFwnKRIm9kqrQBlCbLdfhstS/buttons1.png)

but it also has an option to set the background to the same colour as the splitter or your own custom colour which you can specify in the script.

(http://k5sbdw.blu.livefilestore.com/y1pJxLDqo4xDIfZw7SeL2pG3laazoPtzxyubTBVq5ROMGuWuTLukt86QIh4o4ZTRdRJUv27cmgxN9J9C89OPv2tKvIiOMrNkWU-/buttons2.png)

it does require a little tinkering to get going so here's a guide. first of all download and save this script....

http://javascript.pastebin.com/f77d9e62f (http://javascript.pastebin.com/f77d9e62f)

you need to create a folder called scripts inside your main foobar directory. make sure you save the file inside this folder and name it dui_buttons.js

next you need to add a WSH panel to your layout. copy/paste this

http://javascript.pastebin.com/f1c08ceca (http://javascript.pastebin.com/f1c08ceca)

into your panel and read the comments (sorry for the rambling). here are the images i've used.

http://cid-649d3bfeaf541fbb.skydrive.live....uide/images.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/images.zip)

extract into your foobar install directory.

it should at least be a starting point for anyone wanting to create their own button toolbars.


super!
i cant script JS but this looks so brilliant, i'm gonna learn it and make an awesome DUI interface!
thanks so much! keep more scripts coming!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 13:00:29
here's my text only biography display.

[a href="http://k5sbdw.blu.livefilestore.com/y1pPOpFoa7lzRfqT7f4wY_qJxB5ZCBSqi3ON2CXShGq84Oe67KFT7tdZLopO_jmF-pYnYeY7wX2cuqIV63p_t1u2_WkBj7Js7az/bio.png" target="_blank"]
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-16 13:24:10
here's my text only biography display.


you'll need a last.fm api key to use it. register here.... http://www.last.fm/api/account (http://www.last.fm/api/account) and then edit the first line of the script.

just copy/paste this code into a new panel

[removed]

it caches the results in a folder called lastfm_bio inside your profile folder (this is created automatically for you). but you can force an update through the context menu should you want to.

it has no other features. it's for display purposes only.

and sorry if there is too much text to fit in a panel. i don't have the skills or inclination to learn how to do such a thing. just make it bigger. 


Awesome.  I always loved the functionality of the biography plugin, but it always causes at least a split second stutter when switching tracks (and considerably more than that if I want to display artist art) on the DUI.  This works very well.
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 13:24:58
Great job marc2003.
Just one thing. You know that biography view can get those info for you and cache them. As it works as a background process i suppose it also works with DUI.
i am using biograview tags to do what you do.
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-16 13:33:24
Great job marc2003.
Just one thing. You know that biography view can get those info for you and cache them. As it works as a background process i suppose it also works with DUI.
i am using biograview tags to do what you do.


Yes, it can.  But it causes some minor pauses (for me at least) when switching tracks even when only running as a background process.  Not relying on the biography plugin seems to solve that problem.
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 13:35:25
Great job marc2003.
Just one thing. You know that biography view can get those info for you and cache them. As it works as a background process i suppose it also works with DUI.
i am using biograview tags to do what you do.


Yes, it can.  But it causes some minor pauses (for me at least) when switching tracks even when only running as a background process.  Not relying on the biography plugin seems to solve that problem.

Oh i didnt know that. Sorry
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-16 13:40:10
It might not be the case for CUI, but I can notice it on DUI.  If you use a crossfader (I do) or gapless playback, there's a small (yet noticeable) blip between tracks.  Additionally, this "blip" also freezes the UI display, so it effectively breaks the fading effect in your new album art script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 15:02:03
You know that biography view can get those info for you and cache them.


i didn't. but at least mine gives people a blank canvas to work with. it could easily be expanded to use the foobar artreader for images, adding backgrounds, styling, buttons, etc.
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 15:33:09
You know that biography view can get those info for you and cache them.


i didn't. but at least mine gives people a blank canvas to work with. it could easily be expanded to use the foobar artreader for images, adding backgrounds, styling, buttons, etc.

Yes you are right. Great job
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 15:51:23
an update on my bio panel. just a little bug fix.

Moderation: (Link removed by [a href='index.php?act=findpost&pid=682249']request[/a].)[/size]
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-01-16 17:19:01
carmenm, be sure to post your similar artists script when you get to a point where you think it's stable, that looks amazing!
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 17:26:09
carmenm, be sure to post your similar artists script when you get to a point where you think it's stable, that looks amazing!

Thanks i will. But seeing problems people have with Biography view, i am writing a background script to do its caching job. All my other lastfm scripts will depend on it. Will post as soon as it is stable.
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-16 17:39:27
I have a script to share, it's an album art/lyrics view. Also, I made a quick script to get the colours and font, name it getColoursFonts.js in your scripts directory: http://pastebin.com/f194f3496 (http://pastebin.com/f194f3496)

Now here is my art viewer. It has the following features: double click to swap between prefer now playing and prefer focused track, middle click to swap between prefer art and prefer lyrics, and mouse scroll to change art type or to scroll lyrics. http://pastebin.com/f3d25a237 (http://pastebin.com/f3d25a237)

I haven't got a fade transition on the art, and I'm not sure the lyrics scroll quite right. It also doesn't handle synced lyrics, but it probably could be modified to.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 18:17:50
thanks for those tom. can't believe i didn't think of using the mouse wheel to scroll my biography panel.   

updated version with scrolling support.

Moderation: (Link removed by [a href='index.php?act=findpost&pid=682249']request[/a].)[/size]

@tom, your script needs a little fixing. starting foobar with an empty playlist causes your panel to crash.
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-01-16 19:20:08
Hey Marc, I don't want to discourage your efforts, but take a look at the biography view thread: http://www.hydrogenaudio.org/forums/index....5&start=225 (http://www.hydrogenaudio.org/forums/index.php?showtopic=70955&st=225&start=225)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 19:40:30
oh well....

i hope ssenna ports over his other components to DUI. library tree and ELPlaylist would be amazing
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-16 19:42:16
Wow that s a great news.

I wanted to show what i managed to build with WSH panel Mod. Every panel is made with WSH.
I have no Biography View. There is a background wsh that download everything necessary from Lastfm. All the others are just triggered for new data.
I could use biography view to do so, but syncing with my panel would be hard and would still have to communicate with lastfm for love, etc ... And i prefer to limit the number of connections.
Moreover the back script does not only download data for the playing track, it also download small artist images for similar.
All images are cached.

For the similar artists, those are buttons that link to the lastfm page

I will released as soon as possible. I still need to debug and use an ini file for all panels.

Hope you like it

(http://img685.imageshack.us/img685/3060/61533844.th.jpg) (http://img685.imageshack.us/i/61533844.jpg/)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-16 20:00:38
my menu is better than yours....

Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-16 20:30:33
@tom, your script needs a little fixing. starting foobar with an empty playlist causes your panel to crash.

Thanks, I think I fixed it: http://pastebin.com/f1e4b9ee6 (http://pastebin.com/f1e4b9ee6)
Title: WSH Panel Mod script discussion/help
Post by: Andre69 on 2010-01-18 17:12:58
here's another script. this is for DUI only. it allows you to create your own buttons of any size, using any images you like. by default it uses the DUI background colour (it changes colour as you change theme).

..ZIP..
I want to make a buttonpanel. I use your scripts.
I setup a run service to aktivate Album Art Downloader with the Artist and Title of the selected song.
If I press the button nothing happends. Only if I play the song the button will work.

Can I change this ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-18 17:28:48
you can add add this to your script.....

Code: [Select]
var g_metadb = fb.GetFocusItem();

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
on_metadb_changed();
window.WatchMetadb(g_metadb);
}
}

function on_playlist_switch() {
    on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb) return;
//you need to move your buttons declaration into here
Buttons = {
but1: new Button(0,0,bw,bh, {normal: images + "stop.png", hover: images + "stop_h.png"}, function(){fb.Stop();}, "Stop"),
but2: new Button(bw,0,bw,bh, {normal: images + "pause.png", hover: images + "pause_h.png"}, function(){fb.Pause();}, "Pause"),
but3: new Button(bw*2,0,bw,bh, {normal: images + "play.png", hover: images + "play_h.png"}, function(){fb.Play();}, "Play"),
but4: new Button(bw*3,0,bw,bh, {normal: images + "previous.png", hover: images + "previous_h.png"}, function(){fb.Prev();}, "Previous"),
but5: new Button(bw*4,0,bw,bh, {normal: images + "next.png", hover: images + "next_h.png"}, function(){fb.Next();}, "Next")
};
}

function on_playback_new_track() {
on_item_focus_change();
}

on_item_focus_change();

you need to use this as your function

Code: [Select]
fb.RunContextCommandWithMetadb("context menu command goes here", g_metadb);

also, be aware that WSH panel mod can only run commands on the selected/playing item only and not a selection.
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2010-01-20 07:28:51
This is a simple demo that using GdiDrawText() with scroll (mouse):

EDIT: Improved
EDIT2: Improved again, now both mouse whell and mouse drag work.

http://pastebin.ca/1758754 (http://pastebin.ca/1758754)

Code: [Select]
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;

String.prototype.repeat = function( num ) {
    return new Array( num + 1 ).join( this );
}

var g_font = gdi.Font("Tahoma", 12);
var g_text = ("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n" +
    "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n" +
    "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n" +
    "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n\n").repeat(5);

var ww = 0, wh = 0;
var g_textcolor = 0xff000000;
var g_backcolor = 0xffffffff;
var g_need_calc = true;
var g_textheight = 0;
var g_offset = 0;
var g_drag = false;
var g_drag_y = 0;

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
   
    if (g_need_calc) {
        calc();
    } else {
        gr.GdiDrawText(g_text, g_font, g_textcolor, 0, g_offset, ww, wh - g_offset, DT_CENTER | DT_WORDBREAK | DT_NOPREFIX);
    }
}

function on_mouse_lbtn_down(x, y) {
    g_drag = true;
    g_drag_y = y;
}

function on_mouse_lbtn_up(x, y) {
    g_drag = false;
}

function on_mouse_move(x, y) {
    if (g_drag) {
        applyDelta(y - g_drag_y);
        g_drag_y = y;
    }
}

function on_mouse_wheel(step) {
    applyDelta(step * 20);
}

function calc() {
    // Using a temp IGdiGraphics interface
    var temp_bmp = gdi.CreateImage(1, 1);
    var temp_gr = temp_bmp.GetGraphics();
   
    // Calculate
    arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX).toArray();
    g_textheight = arr[3] - arr[1];
    g_offset = wh / 2;
    g_need_calc = false;
   
    // Free the resources
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
    temp_gr = null;
    temp_bmp = null;
    window.Repaint();
}

function applyDelta(delta) {
    var temp = g_offset + delta;
   
    if ((temp <= wh / 2) && (temp >= wh / 2 - g_textheight)) {
        g_offset = temp;
        window.Repaint();
    }
}

function reset() {
    g_need_calc = true;
    g_offset = 0;
}

Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-20 08:39:20
It s faster than with the other method. I like it a lot.
Using it right now.
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-20 22:50:52
MediaInfo panel

Grab script: http://pastie.org/787344 (http://pastie.org/787344)

Screenshot:
(http://i29.photobucket.com/albums/c276/saivert/th_fb2k-mediainfo-wshpanel-2.jpg) (http://s29.photobucket.com/albums/c276/saivert/fb2k-mediainfo-wshpanel-2.jpg)

Requires:
MediaInfo CLI version (http://mediainfo.sourceforge.net/en/Download/Windows)

Notes:
Using the WshShell.Exec to grab output from a console application via STDOUT will throw up a console window for a fraction of a second. This is ugly so we have get the output from MediaInfo in a different manner. Instead I use WshShell.Run to run my app via CMD so I can redirect output to a text file and then read this text file back to a variable. This is a roundabout way because WshShell.Exec is badly implemented (should have hidden the console window).

Code: [Select]
function get_mediainfo() {
    if (!g_metadb) return;
    
    var tmp = fb.ProfilePath+"tmp.txt";
    //if (fso.FileExists(tmp)) fso.DeleteFile(tmp); // permission denied?
    var e = "cmd /C \"\"" + mediainfo_path + "\" \"" + g_metadb.Path + "\">\""+tmp+"\"\""; // Mind the quotes!
    //fb.trace(e);
    
    wsh.Run(e, 0, true); // Run hidden and wait for it

    var text = fso.OpenTextFile(tmp, 1, false);
    g_text = text.ReadAll();

}
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-21 20:47:17
I create a simple lyrics panel and have one question about how to remove the timestamps.

For now i use:
replace(/\[\d+:\d+.\d+\]/g,"")

This removes the timestamps, but not the info parts at the beginning of such timestamped lyrics files.
Has anybody an idea how i can remove all "squared brackets" parts?
So [ar:Peter Gabriel] and [01:56.32] for instance will be removed completely?
Is there any "wildcard" in jscript so i could use something like: replace(/\[*\]/g,"")
Thanks.
Title: WSH Panel Mod script discussion/help
Post by: fbuser on 2010-01-21 21:04:43
Try replace(/\[.*\]/g,"")
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-21 21:05:14
Code: [Select]
replace(/\[.+\]/g,"")


maybe?
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-21 21:09:00
Thanks
I knew it must be something easy...

Seems to work both.
Where are the differences?

EDIT: Nevermind, i found it. Thanks again
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-21 21:10:05
Hi guys, I am currently trying to make some buttons that act more like the main menu, that is, you click once to open the menu and click again to close it. The problem is my buttons at the moment only open the menu. I can't figure out how to stop it from opening in a way that doesn't break it. Here is a simplified script , the red rectangle is the button to open the menu:

Code: [Select]
var colour = 0xffff0000;
var menu_on = false;

function menu()
{
var basemenu = window.CreatePopupMenu();
basemenu.AppendMenuItem(0x00000000, 1, "Hi");
   
menu_on = true;
ret = basemenu.TrackPopupMenu(20, 60);
  menu_on = false;
 
if(ret) fb.trace("Hello there");
   
basemenu.Dispose();
}

function on_paint(gr)
{
gr.FillSolidRect(0,0,window.Width,window.Height,0xffffffff);
gr.FillSolidRect(20,20,40,40,colour);
}

function on_mouse_lbtn_down(x,y)
{
    if(x>=20 && x<=60 && y>=20 && y<=60)
        colour = 0xff0000ff;

    window.Repaint();
}

function on_mouse_move(x, y)
{
if(x>=20 && x<=60 && y>=20 && y<=60)
colour = 0xff00ff00;
else
colour = 0xffff0000;
       
window.Repaint();
}

function on_mouse_lbtn_up(x, y)
{
    if(x>=20 && x<=60 && y>=20 && y<=60)
{
        menu();
        colour = 0xff00ff00;
    }
window.Repaint();
}

function on_mouse_leave()
{
if(!menu_on)
colour = 0xffff0000;
window.Repaint();
}
If anyone could suggest anything I'd really appreciate it
Title: WSH Panel Mod script discussion/help
Post by: Yirkha on 2010-01-21 21:15:34
Where are the differences?
The difference is in the quantifier, * for 0 or more and + for 1 or more.
But [font= "Courier New"]/\[[^\]]*\]/g[/font] is best (a literal [, then any number of chars not being a ], then the closing bracket itself).
I don't know if it matters here, but the previous patterns are greedy and would replace for example "foo[123]bar[456]2000" to "foo2000" instead of "foobar2000".
Title: WSH Panel Mod script discussion/help
Post by: fbuser on 2010-01-21 21:15:56
Thanks 
I knew it must be something easy...

Seems to work both.
Where are the differences?

replace(/\[.+\]/g,"") matches for example
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-21 21:25:40
Thanks Yirkha
(and of course thanks to fbuser and marc2003 too )

Now my little lyrics panel will become perfect (in time...)

EDIT:
@fbuser
Your last suggestions works too (tried it with the foo[123]bar[456]2000 sample from Yirkha )
Its shorter, so i'll use it.
Thanks again.
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-21 22:06:01
The last.fm bios panel annoyed me with always starting the text half-way down in the panel so I fixed it.

fixed on_paint function:

Code: [Select]
function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    if(window.InstanceType == 1) gr.DrawRect(0,0, ww, wh, 1.0, RGB(160,160,160));
    if(g_metadb) {
        try {
            if(fso.FileExists(folder + "\\" + filename)) {
                ts = fso.OpenTextFile(folder + "\\" + filename,1);
                g_text = ts.ReadAll();
                ts.close();
                
                if (g_need_calc) {
                    calc();
                } else {
                    //old: gr.GdiDrawText(g_text, g_font, g_textcolor,
                    //          5, g_offset, ww-5, wh - g_offset,  DT_WORDBREAK | DT_NOPREFIX);
                    gr.GdiDrawText(g_text, g_font, g_textcolor,
                          5, g_offset-(wh/2), ww-5, wh*2-g_offset,  DT_WORDBREAK | DT_NOPREFIX);
                }

            }
        } catch(e) {}
    }
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-21 22:12:02
oh yuck. you shouldn't be loading the text file in on_paint like that - but it looks like you took the example i posted so that's entirely my fault for posting awful code. trouble is with these forums i can't edit my posts. 

the opening text file bit should be in on_metadb_changed().

sorry to be a nuisance, but could a moderator delete these posts.

http://www.hydrogenaudio.org/forums/index....st&p=680709 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=680709)
http://www.hydrogenaudio.org/forums/index....st&p=680754 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=680754)
http://www.hydrogenaudio.org/forums/index....st&p=680791 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=680791)

from now i'll post snippets on my own webspace so if i **** them up i can edit them without having to pester you guys. sorry.
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-21 22:13:35
@tedgo: You might also want to delete the blank lines at the beginning of the text, try this as well:
Code: [Select]
replace(/^(\r?\n)+/g,"")

I'm not sure it's best to delete everything inside square brackets. You could use multi-line mode and only match square bracketed stuff at the beginning of each line:
Code: [Select]
replace(/^\[.*\]/mg,"")
I'm not using laziness because I've found some lyrics that have multiple time stamps at the beginning of some lines.
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-21 22:24:33
Hi guys, I am currently trying to make some buttons that act more like the main menu...

Try this instead.

Code: [Select]
var colour = 0xffff0000;
//var menu_on = false;
var g_t = null;

function menu()
{
    var d = new Date();
    if (d.getTime()-g_t < 200) return;

var basemenu = window.CreatePopupMenu();
basemenu.AppendMenuItem(0x00000000, 1, "Hi");
   
//menu_on = true;
ret = basemenu.TrackPopupMenu(20, 60);
    d = new Date();
    g_t = d.getTime();
  //menu_on = false;
 
if(ret) fb.trace("Hello there");
   
basemenu.Dispose();
}

function on_paint(gr)
{
gr.FillSolidRect(0,0,window.Width,window.Height,0xffffffff);
gr.FillSolidRect(20,20,40,40,colour);
}

function on_mouse_lbtn_down(x,y)
{
    if(x>=20 && x<=60 && y>=20 && y<=60)
        colour = 0xff0000ff;

    window.Repaint();
}

function on_mouse_move(x, y)
{
if(x>=20 && x<=60 && y>=20 && y<=60)
colour = 0xff00ff00;
else
colour = 0xffff0000;
       
window.Repaint();
}

function on_mouse_lbtn_up(x, y)
{
    if(x>=20 && x<=60 && y>=20 && y<=60)
{
        menu();
        colour = 0xff00ff00;
    }
window.Repaint();
}

function on_mouse_leave()
{
//if(!menu_on)
// colour = 0xffff0000;
//window.Repaint();
        //bscly!
}

This should do it I guess. It is indeed a hack since TrackPopupMenu is a blocking function and there is no proper way around that fact.

Notes:

Having a global variable which you set before opening the menu and reset after TrackPopupMenu returns doesn't work. It is of no use in the interim as the script simply doesn't run at that time. As long as the menu is visible (not dismissed) the script is waiting.
Maybe if WSH Panels had a callback function for menus so you call a non-blocking version of TrackPopupMenu and then handle the menu ID clicked in a callback function. This would require WSH Panel to handle the menu in a separate thread, which I'm not sure would work properly.
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-21 22:38:25
from now i'll post snippets on my own webspace so if i **** them up i can edit them without having to pester you guys. sorry.



Which is what was proposed earlier by Yirkha. Post scripts on pastebin (or your own webspace) or something instead of using ugly codeboxes on the forum.
Why not using gitshub ?

https://github.com/ (https://github.com/)
lets people contribute on scripts online. versioning etc.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-21 22:48:24
er yes. it was me who started the thread on the advice of Yirkha. the snippets in those posts are all on pastebin. 

the problem with pastebin is that making changes generates a new url so the links in my posts are still pointing towards the original duff code which i can't delete.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-21 22:54:17
@TomBarlow
You mean like this?
Code: [Select]
lyrics.replace(/\[.*?\]/g,"").replace(/^(\r?\n)+/g,"")

Seems to work...
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-21 23:25:24
Try this instead.

Thanks very much, it works well. Unfortunately I do need something under on_mouse_leave as it is called when the menu is opened, and I want my buttons to be in the 'down' state.

Tedgo, I think this should work?
Code: [Select]
.replace(/^(\[.*?\])+/mg,"").replace(/^(\r?\n)+/g,"")


It should turn this:

[1234][2345]tra la la [huh] la la

into this:

tra la la [huh] la la

As well as getting rid of empty lines at the start.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-21 23:28:09
Yes, it does.
Thanks again
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-22 08:39:30
Hi everyone,

I wanted to show you guys what i am working on. SO here is a screenshot.
(http://img683.imageshack.us/img683/2253/66899230.th.jpg) (http://img683.imageshack.us/i/66899230.jpg/)
THere is an lot of features behind that config like:

- automatic download and caching of artists bio, big, similar artists small arts. And all that is done in the background.
- All other panels are informed when a new info related to them is available so that they update themselves
- the 2 art panels you see are actually the same config. Huge amount of options like my new fillImage algorithm that you can see in use in the artist panel. You can also add button, choose the position. The art panel allows you to use an external program(aad here) to change the current image. And the panel will automatically update itself afterwards.
- THe similar panels has a lot of options like a custom right click menu for each artists with multiple search engines and opening the artist radio with lastfm_radio!
- the biography panel doesnt have so much options yet
- All those back features are controled by one background config that does the works and can inform you of any errors.
- All those panels config are saved and loaded from ini in a smart way. Change a common option from the back wsh and all other panels will update themselves.

I would love to release it today but there are still things i want to change. Like more options for buttons and everything. And i also use the hours i spend using it to correct all the possible bugs(like with artists names). Yet i couldnt resist showing you what i have so far.
Hope you like it.

And i couldnt have done any of this without TPWang and marc2003 so thanks a lot to both of you!
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-22 08:50:20
That sounds great.  I'm really looking forward to it!
Title: WSH Panel Mod script discussion/help
Post by: allerlei on 2010-01-22 09:51:56
@carmenm: Absolutely great, that's what I'm looking for... so where you're going to release it?
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-22 10:01:54
@carmenm: Absolutely great, that's what I'm looking for... so where you're going to release it?

To be true i could just release it now. It works great and is already very configurable. but I dont want to release it too fast and then have to make updates that will break your configs. So i just need a little time to make it more configurable.
In fact what i want is for you never to have to modify anything in the code itself.
I dont have so much time here at work.
Will do as much as i can tomorrow.
I hope to release it this we then.
Title: WSH Panel Mod script discussion/help
Post by: allerlei on 2010-01-22 10:59:27
@carmenm: Good luck! I'm really looking forward to try your work. Especially the upper half of your design fits totally my expectations on a design I always tried to build on my own, but I hadn't this success (maybe based on a lack of time) you have - chapeau!
Title: WSH Panel Mod script discussion/help
Post by: nifferl7 on 2010-01-23 08:50:01
wow carmenm, can't wait to try it out!
Title: WSH Panel Mod script discussion/help
Post by: Shaun1 on 2010-01-23 09:48:29
(sorry, I originally posted this in the WSH Panel Mod thread without seeing this script discussion one and can't delete my post there)

I installed this plugin and used the MainMenuManager All-In-One sample so I can access the entire foobar menu just by clicking the panel. My question is, how do I make the wsh panel look better by making it display text "Menu" or an icon button?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-23 11:19:33
Code: [Select]
g_img = gdi.Image(fb.FoobarPath + "path\\to\\image.png");

function on_paint(gr) {
   gr.DrawImage(g_img, 0, 0, g_img.Width, g_img.Height, 0, 0, g_img.Width, g_img.Height);
}
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-01-23 18:29:23
This is a simple demo that using GdiDrawText() with scroll (mouse):

EDIT: Improved
EDIT2: Improved again, now both mouse whell and mouse drag work.

http://pastebin.ca/1758754 (http://pastebin.ca/1758754)

it doesn't work here on WSH Pnale Mod 1.3.0 beta 4 + foobar 1.0

WSH Panel Mod (GUID: DD259EC0-0DA3-4856-BFD4-B8402D106108): initliased in 0.0000006 s
Error: WSH Panel Mod (GUID: DD259EC0-0DA3-4856-BFD4-B8402D106108): Erreur d'exécution Microsoft JScript:
Cet objet ne gère pas cette propriété ou cette méthode
Ln: 70, Col: 1
<no source text available>


forgot, it's ok with v1.3.0 final...
Title: WSH Panel Mod script discussion/help
Post by: Shaun1 on 2010-01-24 01:13:52
Thanks marc2003!  I pasted it into the window and I changed "path\\to\\image.png" to "images\\image.jpg" to point it to my foobar\images directory.  But it still just shows a blank window.  Sorry, I have very little knowledge about this stuff.


Code: [Select]
g_img = gdi.Image(fb.FoobarPath + "path\\to\\image.png");

function on_paint(gr) {
   gr.DrawImage(g_img, 0, 0, g_img.Width, g_img.Height, 0, 0, g_img.Width, g_img.Height);
}

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-24 01:44:17
the script would error if the image wasn't found. not sure what's going on there.
Title: WSH Panel Mod script discussion/help
Post by: Shaun1 on 2010-01-24 04:44:35
the script would error if the image wasn't found. not sure what's going on there.


Doh, made a little typo when putting it in.  Now works perfectly, thanks again marc!
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-24 17:25:14
Updates the Bios panel:

http://gist.github.com/285324 (http://gist.github.com/285324)


Changes:
- Doesn't open text file in on_paint anymore
- Prints "#EOF" in red at end of text to avoid confusion as to where the text actually ends.

Plans:
- Proper scrollbar (coding a scrollbar from scratch should be feasible, but such a waste (http://www.hiddenpixels.com/javascript/custom-javascript-scrollbar/)).
- Autoscrolling (need to use timer)

Actually adding real scrollbar to the panel window and then having some events in the js code for handling scrollbar messages would be better.
Might take a look at the WSH Panels Mod source and see what I can do.

I imagine something like:

Code: [Select]
var SCROLLBAR_NONE = 0;
var SCROLLBAR_VERTICAL = 1;
var SCROLLBAR_HORIZONTAL = 2;
// to get both use OR
window.enableScrollbar(SCROLLBAR_VERTICAL);
window.setScrollbarExtent(SCROLLBAR_VERTICAL, 100);
function on_scrollbar_message(which, pos) {

}

// etc...


I actually don't like that other separate Bios component. It is buggy and slow. Coding my own with WSH Panels Mod is much better.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-24 18:18:15
It is buggy.

but yours is pretty buggy as well.

#EOF gets printed over the text a lot (it's position on a previous artist isn't updated when switching to a new artist)
it can't save text files with special characters in (see this post on how to fix - http://www.hydrogenaudio.org/forums/index....t&p=682074) (http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&view=findpost&p=682074))
text sometimes disappears completely when scrolling.
text doesn't always update when changing tracks with different artists (random)
sometimes can't scroll back to top

edit: try this one (it doesn't support dragging though, only mouse scrolling)

Code: [Select]
api_key = "";

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

FontTypeCUI = {
items: 0,
labels: 1
};

ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
};

FontTypeDUI = {
defaults: 0,
tabs: 1,
lists: 2,
playlists: 3,
statusbar: 4,
console: 5
};

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

function get_font() {
if (g_instancetype == 0) {
g_font = window.GetFontCUI(FontTypeCUI.items);
} else if (g_instancetype == 1) {
g_font = window.GetFontDUI(FontTypeDUI.defaults);
}
}

function get_colors() {
if (g_instancetype == 0) {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
} else if (g_instancetype == 1) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_font_changed() {
get_font();
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

g_instancetype = window.InstanceType;
get_font();
get_colors();

function lastfm(url, user_agent, func, debug) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", url + "&s=" + Math.random(), true);
xmlhttp.setRequestHeader('User-Agent',user_agent);
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
if(debug) fb.trace(xmlhttp.responsetext);
func();
} else {
fb.trace(xmlhttp.responsetext);
}
}
}
}

g_metadb = fb.GetFocusItem();
var artist = g_text = '';
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {
    url = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=" + api_key + "&artist=" + encodeURIComponent(artist);
    lastfm(url, "foo_wsh_lastfm_bio", function() {save_file();},0);
}

function save_file() {
    xmlDoc = xmlhttp.responseXML;
    try {
        g_text = xmlDoc.getElementsByTagName("content")[0].childNodes[0].nodeValue;
        g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "");
        doc = new ActiveXObject("htmlfile");
        doc.open();
        div = doc.createElement("div");
        div.innerHTML = g_text.replace(/\n/g, "<br>");
        g_text = div.innerHTML;
        g_text = g_text.replace(/<BR>/g,"\n");
        g_text = g_text.replace(/&amp;/g,"&");
    } catch(e) {
        g_text = "This artist does not have a biography page on Last.fm.";
    }
    try {
        ts = fso.OpenTextFile(filename, 2, true, -1);
        ts.WriteLine(g_text);
        ts.close();
    } catch(e) {
        g_text = "Error saving biography for this artist.";
    }
    calc();
}

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    if(g_metadb) {
        gr.GdiDrawText(g_text, g_font, g_textcolor, 6, offset + 36, ww-16, wh-offset,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
        gr.FillSolidRect(0, 0, ww, 38, g_backcolor);
        gr.GdiDrawText(artist, gdi.Font("Segoe UI", 16, 1), g_textcolor_hl, 6, 5, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.DrawLine(5, 29, ww-10, 29, 1, RGB(137,140,149));
    }
}


function on_playback_new_track() {
    on_item_focus_change();
}

function on_metadb_changed() {
    if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
    artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)
    filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
    if(fso.fileExists(filename)) {
        try {
            ts = fso.OpenTextFile(filename,1, false, -1);
            g_text = ts.ReadAll();
            ts.close();
        } catch(e) {
            g_text = "Error opening file!";
        }
        calc();
    } else {
        get_bio();
    }
}

function calc() {
    temp_bmp = gdi.CreateImage(1, 1);
    temp_gr = temp_bmp.GetGraphics();
    arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
    textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
    temp_gr = null;
    temp_bmp = null;
    offset = 0;
    window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
    var MF_SEPARATOR = 0x00000800;
    var MF_STRING = 0x00000000;
    var _menu = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(MF_STRING, 1, "Force update");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 2, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    if(idx == 1) get_bio();
    if(idx == 2) window.ShowConfigure();
    _menu.Dispose();
    return true;
}

function on_mouse_wheel(delta) {
    step = g_font.height * 5;
    offset += (delta * step);
    if(offset > 0 || textheight < wh) {
        offset = 0;
    } else {
        temp = -textheight + wh;
        if(offset < temp) offset = Math.round(temp / step) * step;
    }
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-25 01:11:24
Excellent code marc2003! You have simplified a lot. Good idea getting rid of all the "var" stuff. Really not needed with JS being a loosely typed language.

I didn't want to edit too much on the previous code I borrowed from you. I know it still needed a lot of work.


But why not use the preprocessor features and import flags.txt and handlers.txt. I think a standard install of WSH Panels mod should have a scripts directory in foobar2000 folder with those standard includes. This would slim down the scripts even further and makes things really clean.

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\flags.txt"
// @import "%fb2k_path%scripts\helpers.txt"
// ==/PREPROCESSOR==
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-25 01:24:16
edit: try this one (it doesn't support dragging though, only mouse scrolling)


Oh, I really like this one.  The non-scrolling artist header is a cool idea.
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2010-01-25 02:05:30
Quote
Excellent code marc2003! You have simplified a lot. Good idea getting rid of all the "var" stuff. Really not needed with JS being a loosely typed language.
But JS has "scope", without "var" it's declared in global scope, and will confuse you if you are constructing a closure and use that variable in and it's hard to locate bugs if all variables are in global scope, eg:
Code: [Select]
function func1() {
    i = 1;
    fb.trace('"i" in func1() is :', i);  // i = 1
}

function test2() {
    // Call func1() here, and see what happens
    i = 2;
    func1();
    fb.trace('"i" in func2() is :', i);  //  i = 1 !!!
}

test2();
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-25 02:11:37
doesn't hurt to use var everywhere. but the script mostly avoided "var" on the global variables (outside closures).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 02:52:29
But why not use the preprocessor features


i do already. and stuff like the sample colour/font changing stuff goes into an external file as well. then i have an external last.fm script to store my credentials and xmlhttp function - so i can share it between multiple panels.

i just merged it all into a single script above because i couldn't be bothered to explain myself.
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-25 06:28:10
Last.fm records the number of times I play a track by a specific artist in order to come up with the "top artists" stats.  Is this information available to the API?  If so, how would I access this in WSH Panel Mod?  Thanks.

Edit: I've got it.
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-25 08:00:29
In case anyone's interested, I modified marc2003's bio script to create a Windows 7 style bio panel and lyrics panel.  Screenshots:

(http://imgur.com/3hlZC.png)

(http://imgur.com/aVNwB.png)

The code for the bio panel:
Code: [Select]
var username = "";
var api_key = "";
var image_path = fb.FoobarPath + "images\\";

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
    text: 0,
    selection_text: 1,
    inactive_selection_text: 2,
    background: 3,
    selection_background: 4,
    inactive_selection_background: 5,
    active_item_frame: 6
};

FontTypeCUI = {
    items: 0,
    labels: 1
};

ColorTypeDUI = {
    text: 0,
    background: 1,
    highlight: 2,
    selection: 3
};

FontTypeDUI = {
    defaults: 0,
    tabs: 1,
    lists: 2,
    playlists: 3,
    statusbar: 4,
    console: 5
};

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

function get_font() {
    if (g_instancetype == 0) {
        g_font = window.GetFontCUI(FontTypeCUI.items);
    }
    else if (g_instancetype == 1) {
        g_font = window.GetFontDUI(FontTypeDUI.defaults);
    }
}

function get_colors() {
    if (g_instancetype == 0) {
        g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
        g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
        g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
    }
    else if (g_instancetype == 1) {
        g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
        g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
        g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
    }
}

function on_playlist_switch() {
    on_item_focus_change();
}

function on_colors_changed() {
    get_colors();
    window.Repaint();
}

function on_font_changed() {
    get_font();
    window.Repaint();
}

function on_item_focus_change() {
    if (g_metadb) window.UnwatchMetadb();
    g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    if (g_metadb) {
        try { on_metadb_changed(); } catch(e) {}
        window.WatchMetadb(g_metadb);
    }
}

g_instancetype = window.InstanceType;
get_font();
get_colors();

function lastfm(url, user_agent, func, debug) {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open("GET", url + "&s=" + Math.random(), true);
    xmlhttp.setRequestHeader('User-Agent',user_agent);
    xmlhttp.send();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                if(debug) fb.trace(xmlhttp.responsetext);
                func();
            }
            else {
                fb.trace(xmlhttp.responsetext);
            }
        }
    }
}

g_metadb = fb.GetFocusItem();
var artist = g_text = playcount = '';
var g_img = gdi.Image(image_path + "header.png");
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();
get_playcount();

String.prototype.count=function(s1) {
    return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {
    url = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=" + api_key + "&username=" + username + "&artist=" + encodeURIComponent(artist);
    lastfm(url, "foo_wsh_lastfm_bio", function() {save_file();},0);
}

function get_playcount() {
    url = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=" + api_key + "&username=" + username + "&artist=" + encodeURIComponent(artist);
    lastfm(url, "foo_wsh_lastfm_bio", function() {extract_playcount();},0);
}

function save_file() {
    xmlDoc = xmlhttp.responseXML;
    try {
        g_text = xmlDoc.getElementsByTagName("content")[0].childNodes[0].nodeValue;
        playcount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue;
        g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "");
        doc = new ActiveXObject("htmlfile");
        doc.open();
        div = doc.createElement("div");
        div.innerHTML = g_text.replace(/\n/g, "<br>");
        g_text = div.innerHTML;
        g_text = g_text.replace(/<BR>/g,"\n");
        g_text = g_text.replace(/&amp;/g,"&");
    }
    catch(e) {
        playcount = "0";
        g_text = "This artist does not have a biography page on Last.fm.";
    }
    try {
        ts = fso.OpenTextFile(filename, 2, true, -1);
        ts.WriteLine(g_text);
        ts.close();
    }
    catch(e) {
        g_text = "Error saving biography for this artist.";
    }
    calc();
}

function extract_playcount() {
    xmlDoc = xmlhttp.responseXML;
    try {
        playcount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue;
    }
    catch(e) {
        playcount = "0";
    }
    window.Repaint();
}

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    if(g_metadb) {
        gr.GdiDrawText(g_text, g_font, g_textcolor, 21, offset + 60, ww-42, wh-offset,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
        gr.FillSolidRect(0, 0, ww, 55, g_backcolor);
        gr.DrawImage(g_img, 0, 0, 830, 55, 0, 0, 830, 55);
        gr.FillGradRect(830, 0, ww - 820, 55, 0, RGB(252,252,252), RGB(255,255,255));
        gr.GdiDrawText(artist, gdi.Font("Segoe UI", 18, 0), RGB(0, 120, 50), 21, 4, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText("Artist Playcount:", gdi.Font("Segoe UI", 13, 0), RGB(90, 103, 121), 21, 29, ww-16, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(playcount, gdi.Font("Segoe UI", 13, 0), RGB(42, 102, 212), 120, 29, ww-16, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.DrawLine(21, 54, ww-21, 54, 1, RGB(214,229,245));
        gr.FillGradRect(6, 54,15, 1, 0, RGB(255,255,255), RGB(214,229,255));
        gr.FillGradRect(ww-21, 54,10, 1, 0, RGB(214,229,255),RGB(255,255,255));
    }
}


function on_playback_new_track() {
    on_item_focus_change();
    get_playcount();
}

function on_metadb_changed() {
    if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
    artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
    filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
    if(fso.fileExists(filename)) {
        try {
            ts = fso.OpenTextFile(filename,1, false, -1);
            g_text = ts.ReadAll();
            ts.close();
        }
        catch(e) {
            g_text = "Error opening file!";
        }
        calc();
    }
    else {
        get_bio();
        get_playcount();
    }
}

function calc() {
    temp_bmp = gdi.CreateImage(1, 1);
    temp_gr = temp_bmp.GetGraphics();
    arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
    textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
    temp_gr = null;
    temp_bmp = null;
    offset = 0;
    window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
    var MF_SEPARATOR = 0x00000800;
    var MF_STRING = 0x00000000;
    var _menu = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(MF_STRING, 1, "Force update");
    _menu.AppendMenuItem(MF_STRING, 2, "View on Last.fm");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 3, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    if(idx == 1) get_bio();
    if(idx == 2) WshShell.run("http://www.last.fm/music/" + encodeURIComponent(artist));
    if(idx == 3) window.ShowConfigure();
    _menu.Dispose();
    return true;
}

function on_mouse_wheel(delta) {
    step = g_font.height * 5;
    offset += (delta * step);
    if(offset > 0 || textheight < wh) {
        offset = 0;
    }
    else {
        temp = -textheight + wh;
        if(offset < temp) offset = Math.round(temp / step) * step;
    }
    window.Repaint();
}

The code for the lyrics panel:
Code: [Select]
var image_path = fb.FoobarPath + "images\\";
var lyrics_tag = "%lyrics%";

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

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

function on_playlist_switch() {
on_item_focus_change();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

var artist = '';
var title = '';
var lyrics = '';
var g_img = gdi.Image(image_path + "header.png");

g_instancetype = window.InstanceType;
g_metadb = fb.GetFocusItem();

fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, RGB(255,255,255));
if(g_metadb) {
gr.GdiDrawText(lyrics, gdi.Font("Segoe UI", 13, 2), RGB(0, 0, 0), 0, offset + 65, ww-16, wh-offset,DT_CENTER|DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
gr.FillSolidRect(0, 0, ww, 55, RGB(255,255,255));
gr.DrawImage(g_img, 0, 0, 830, 55, 0, 0, 830, 55);
gr.FillGradRect(830, 0, ww - 820, 55, 0, RGB(252,252,252), RGB(255,255,255));
gr.GdiDrawText(title, gdi.Font("Segoe UI", 18, 0), RGB(0, 120, 50), 0, 4, ww-16, 24,DT_CENTER|DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(artist, gdi.Font("Segoe UI", 13, 0), RGB(90, 103, 121), 0, 29, ww-16, 24,DT_CENTER|DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.DrawLine(21, 54, ww-21, 54, 1, RGB(214,229,245));
gr.FillGradRect(6, 54,15, 1, 0, RGB(255,255,255), RGB(214,229,255));
gr.FillGradRect(ww-21, 54,10, 1, 0, RGB(214,229,255),RGB(255,255,255));
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
title = fb.TitleFormat("%title%").EvalWithMetadb(g_metadb);
lyrics = fb.TitleFormat(lyrics_tag).EvalWithMetadb(g_metadb);
if (lyrics == "?") lyrics = "No Lyrics Available";
window.Repaint();
}

function calc() {
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(lyrics, gdi.Font("Segoe UI", 13, 2), RGB(0, 0, 0), 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh/2) + (lyrics.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
offset = 0;
window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Refresh");
_menu.AppendMenuItem(MF_STRING, 2, "Edit Lyrics");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 3, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) window.Repaint();
if(idx == 2) fb.RunContextCommandWithMetadb("edit",g_metadb);
    if(idx == 3) window.ShowConfigure();
_menu.Dispose();
return true;
}

function on_mouse_wheel(delta) {
step = gdi.Font("Segoe UI", 13, 2).height * 5;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;
}
else {
temp = -textheight + wh;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}

The required header image (needs to be named "header.png"):
(http://imgur.com/z23iK.png)

Finally, in order to get the "edit lyrics" command working, you need this component:
http://www.hydrogenaudio.org/forums/index....showtopic=36598 (http://www.hydrogenaudio.org/forums/index.php?showtopic=36598)

In order to preserve the Windows 7 styling, these scripts don't really play nice with the CUI/DUI default colors.  Hopefully someone finds these useful.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 08:20:52
that needs some serious reworking. you're making 3 requests to last.fm for the same file all at once.

edit: and it just caused my foobar to crash when starting.....

Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-25 08:44:37
Ok, this should make fewer calls to Last.fm.  Hopefully it also fixes any crashes:

Code: [Select]
var username = "";
var api_key = "";
var image_path = fb.FoobarPath + "images\\";

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

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

function on_playlist_switch() {
    on_item_focus_change();
}

function on_item_focus_change() {
    if (g_metadb) window.UnwatchMetadb();
    g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    if (g_metadb) {
        try { on_metadb_changed(); } catch(e) {}
        window.WatchMetadb(g_metadb);
    }
    get_bio();
}

g_instancetype = window.InstanceType;
g_font = gdi.Font("Segoe UI", 12, 0);
g_textcolor = RGB(0,0,0);
g_backcolor = RGB(255,255,255);

g_metadb = fb.GetFocusItem();
var artist = g_text = playcount = '';
var g_img = gdi.Image(image_path + "header.png");
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
    return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {
    url = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=" + api_key + "&username=" + username + "&artist=" + encodeURIComponent(artist);
    lastfm(url, "foo_wsh_lastfm_bio", function() {save_file();extract_playcount();},0);
}

function lastfm(url, user_agent, func, debug) {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open("GET", url + "&s=" + Math.random(), true);
    xmlhttp.setRequestHeader('User-Agent',user_agent);
    xmlhttp.send();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                if(debug) fb.trace(xmlhttp.responsetext);
                func();
            }
            else {
                fb.trace(xmlhttp.responsetext);
            }
        }
    }
}

function save_file() {
    xmlDoc = xmlhttp.responseXML;
    try {
        g_text = xmlDoc.getElementsByTagName("content")[0].childNodes[0].nodeValue;
        playcount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue;
        g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "");
        doc = new ActiveXObject("htmlfile");
        doc.open();
        div = doc.createElement("div");
        div.innerHTML = g_text.replace(/\n/g, "<br>");
        g_text = div.innerHTML;
        g_text = g_text.replace(/<BR>/g,"\n");
        g_text = g_text.replace(/&amp;/g,"&");
    }
    catch(e) {
        playcount = "0";
        g_text = "This artist does not have a biography page on Last.fm.";
    }
    try {
        ts = fso.OpenTextFile(filename, 2, true, -1);
        ts.WriteLine(g_text);
        ts.close();
    }
    catch(e) {
        g_text = "Error saving biography for this artist.";
    }
    calc();
}

function extract_playcount() {
    xmlDoc = xmlhttp.responseXML;
    try {
        playcount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue;
    }
    catch(e) {
        playcount = "0";
    }
    window.Repaint();
}

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    if(g_metadb) {
        gr.GdiDrawText(g_text, g_font, g_textcolor, 21, offset + 60, ww-42, wh-offset,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
        gr.FillSolidRect(0, 0, ww, 55, g_backcolor);
        gr.DrawImage(g_img, 0, 0, 830, 55, 0, 0, 830, 55);
        gr.FillGradRect(830, 0, ww - 820, 55, 0, RGB(252,252,252), RGB(255,255,255));
        gr.GdiDrawText(artist, gdi.Font("Segoe UI", 18, 0), RGB(0, 120, 50), 21, 4, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText("Artist Playcount:", gdi.Font("Segoe UI", 13, 0), RGB(90, 103, 121), 21, 29, ww-16, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(playcount, gdi.Font("Segoe UI", 13, 0), RGB(42, 102, 212), 120, 29, ww-16, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.DrawLine(21, 54, ww-21, 54, 1, RGB(214,229,245));
        gr.FillGradRect(6, 54,15, 1, 0, RGB(255,255,255), RGB(214,229,255));
        gr.FillGradRect(ww-21, 54,10, 1, 0, RGB(214,229,255),RGB(255,255,255));
    }
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_metadb_changed() {
    if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
    artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
    filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
    if(fso.fileExists(filename)) {
        try {
            ts = fso.OpenTextFile(filename,1, false, -1);
            g_text = ts.ReadAll();
            ts.close();
        }
        catch(e) {
            g_text = "Error opening file!";
        }
        calc();
    }
    else {
        get_bio();
    }
}

function calc() {
    temp_bmp = gdi.CreateImage(1, 1);
    temp_gr = temp_bmp.GetGraphics();
    arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
    textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
    temp_gr = null;
    temp_bmp = null;
    offset = 0;
    window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
    var MF_SEPARATOR = 0x00000800;
    var MF_STRING = 0x00000000;
    var _menu = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(MF_STRING, 1, "Force update");
    _menu.AppendMenuItem(MF_STRING, 2, "View on Last.fm");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 3, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    if(idx == 1) get_bio();
    if(idx == 2) WshShell.run("http://www.last.fm/music/" + encodeURIComponent(artist));
    if(idx == 3) window.ShowConfigure();
    _menu.Dispose();
    return true;
}

function on_mouse_wheel(delta) {
    step = g_font.height * 5;
    offset += (delta * step);
    if(offset > 0 || textheight < wh) {
        offset = 0;
    }
    else {
        temp = -textheight + wh;
        if(offset < temp) offset = Math.round(temp / step) * step;
    }
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 08:58:59
you should be making one call. it's the same file. why are you fetching it twice?

and you might as well scrap the idea of caching files being as though you're fetching the file on every new track.
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-01-25 09:50:48
Ok, so I'm (obviously) new at this.  What I was trying to do was always download the xml file on each new track to obtain the artist playcount.  However, I wanted to use the cached artist bio if available (as your code does).  Yes, I understand that much of the usefulness of the cached data is lost in this implementation, but displaying the bio info itself should still be quick (cached data) and only the playcount itself will always have a slight delay.  So, it should have worked like this:

if no bio is cached, it makes 1 request for the xml file and extracts the bio and playcount.
if a bio is cached, it makes 1 request for the xml file and extracts the playcount only.

I made some stupid mistakes in the previous versions, however, I've reworked the code again (last time for the night), and I think this does what I want it to:

Code: [Select]
var username = "";
var api_key = "";
var image_path = fb.FoobarPath + "images\\";

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

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

function on_playlist_switch() {
    on_item_focus_change();
}

function on_item_focus_change() {
    if (g_metadb) window.UnwatchMetadb();
    g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    if (g_metadb) {
        try { on_metadb_changed(); } catch(e) {}
        window.WatchMetadb(g_metadb);
    }
}

g_instancetype = window.InstanceType;
g_font = gdi.Font("Segoe UI", 12, 0);
g_textcolor = RGB(0,0,0);
g_backcolor = RGB(255,255,255);

g_metadb = fb.GetFocusItem();
var artist = g_text = playcount = url = '';
var g_img = gdi.Image(image_path + "header.png");
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);

on_item_focus_change();

String.prototype.count=function(s1) {
    return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {
    lastfm(url, "foo_wsh_lastfm_bio", function() {save_file();},0);
}

function get_playcount() {
    lastfm(url, "foo_wsh_lastfm_bio", function() {extract_playcount();},0);
}

function lastfm(url, user_agent, func, debug) {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open("GET", url + "&s=" + Math.random(), true);
    xmlhttp.setRequestHeader('User-Agent',user_agent);
    xmlhttp.send();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                if(debug) fb.trace(xmlhttp.responsetext);
                func();
            }
            else {
                fb.trace(xmlhttp.responsetext);
            }
        }
    }
}

function save_file() {
    xmlDoc = xmlhttp.responseXML;
    try {
        g_text = xmlDoc.getElementsByTagName("content")[0].childNodes[0].nodeValue;
        playcount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue;
        g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "");
        doc = new ActiveXObject("htmlfile");
        doc.open();
        div = doc.createElement("div");
        div.innerHTML = g_text.replace(/\n/g, "<br>");
        g_text = div.innerHTML;
        g_text = g_text.replace(/<BR>/g,"\n");
        g_text = g_text.replace(/&amp;/g,"&");
    }
    catch(e) {
        g_text = "This artist does not have a biography page on Last.fm.";
        playcount = "0";
    }
    try {
        ts = fso.OpenTextFile(filename, 2, true, -1);
        ts.WriteLine(g_text);
        ts.close();
    }
    catch(e) {
        g_text = "Error saving biography for this artist.";
    }
    calc();
}

function extract_playcount() {
    xmlDoc = xmlhttp.responseXML;
    try {
        playcount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue;
    }
    catch(e) {
        playcount = "0";
    }
    window.Repaint();
}

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    if(g_metadb) {
        gr.GdiDrawText(g_text, g_font, g_textcolor, 21, offset + 60, ww-42, wh-offset,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
        gr.FillSolidRect(0, 0, ww, 55, g_backcolor);
        gr.DrawImage(g_img, 0, 0, 830, 55, 0, 0, 830, 55);
        gr.FillGradRect(830, 0, ww - 820, 55, 0, RGB(252,252,252), RGB(255,255,255));
        gr.GdiDrawText(artist, gdi.Font("Segoe UI", 18, 0), RGB(0, 120, 50), 21, 4, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText("Artist Playcount:", gdi.Font("Segoe UI", 13, 0), RGB(90, 103, 121), 21, 29, ww-16, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(playcount, gdi.Font("Segoe UI", 13, 0), RGB(42, 102, 212), 120, 29, ww-16, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.DrawLine(21, 54, ww-21, 54, 1, RGB(214,229,245));
        gr.FillGradRect(6, 54,15, 1, 0, RGB(255,255,255), RGB(214,229,255));
        gr.FillGradRect(ww-21, 54,10, 1, 0, RGB(214,229,255),RGB(255,255,255));
    }
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_metadb_changed() {
    if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
    artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
    filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
    url = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=" + api_key + "&username=" + username + "&artist=" + encodeURIComponent(artist);
    playcount = '';
    if(fso.fileExists(filename)) {
        get_playcount();
        try {
            ts = fso.OpenTextFile(filename,1, false, -1);
            g_text = ts.ReadAll();
            ts.close();
        }
        catch(e) {
            g_text = "Error opening file!";
        }
        calc();
    }
    else {
        get_bio();
    }
}

function calc() {
    temp_bmp = gdi.CreateImage(1, 1);
    temp_gr = temp_bmp.GetGraphics();
    arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
    textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
    temp_gr = null;
    temp_bmp = null;
    offset = 0;
    window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
    var MF_SEPARATOR = 0x00000800;
    var MF_STRING = 0x00000000;
    var _menu = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(MF_STRING, 1, "Force update");
    _menu.AppendMenuItem(MF_STRING, 2, "View on Last.fm");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 3, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    if(idx == 1) get_bio();
    if(idx == 2) WshShell.run("http://www.last.fm/music/" + encodeURIComponent(artist));
    if(idx == 3) window.ShowConfigure();
    _menu.Dispose();
    return true;
}

function on_mouse_wheel(delta) {
    step = g_font.height * 5;
    offset += (delta * step);
    if(offset > 0 || textheight < wh) {
        offset = 0;
    }
    else {
        temp = -textheight + wh;
        if(offset < temp) offset = Math.round(temp / step) * step;
    }
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 10:23:58
@carmenm, how did you parse the feeds to get image urls? i'm stuck doing this. 
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-25 10:54:09
@carmenm, how did you parse the feeds to get image urls? i'm stuck doing this. 

Can you wait 1 or 2 days? i am on the  verge of releasing the manager that will do all that for you.
If you cant tell me and i ll put a code here.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 10:59:54
i'm only interested in downloading 1 image per artist - the one in the artist.getinfo

Code: [Select]
  <image size="small">http://userserve-ak.last.fm/serve/34/34848663.png</image>
  <image size="medium">http://userserve-ak.last.fm/serve/64/34848663.png</image>
  <image size="large">http://userserve-ak.last.fm/serve/126/34848663.png</image>
  <image size="extralarge">http://userserve-ak.last.fm/serve/252/34848663.png</image>
  <image size="mega">http://userserve-ak.last.fm/serve/_/34848663/Jem++PNG+6.png</image>


i just want to know how to get the url for the "mega" bit and that is all. i tried that activex thing you posted and that works fine if i put in the url manually so i'm happy using that.
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-25 11:08:00
i'm only interested in downloading 1 image per artist - the one in the artist.getinfo

Code: [Select]
  <image size="small">http://userserve-ak.last.fm/serve/34/34848663.png</image>
  <image size="medium">http://userserve-ak.last.fm/serve/64/34848663.png</image>
  <image size="large">http://userserve-ak.last.fm/serve/126/34848663.png</image>
  <image size="extralarge">http://userserve-ak.last.fm/serve/252/34848663.png</image>
  <image size="mega">http://userserve-ak.last.fm/serve/_/34848663/Jem++PNG+6.png</image>


i just want to know how to get the url for the "mega" bit and that is all. i tried that activex thing you posted and that works fine if i put in the url manually so i'm happy using that.

Yes that s exactly what my manager does, i wont spoil all the fun  I am kidding.
With that line you get all artist tags
Code: [Select]
var artistsArray = xmlDoc.getElementsByTagName("artist");

then with this one you get the mega picture
Code: [Select]
var artistpicture = (artistsArray[i].childNodes[7].childNodes[0])?artistsArray[i].childNodes[7].childNodes[0].nodeValue:"";
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 11:23:41
thanks.
Title: WSH Panel Mod script discussion/help
Post by: carmenm on 2010-01-25 16:21:32
I finally released (http://www.hydrogenaudio.org/forums/index.php?showtopic=78166)my suite.

Enjoy
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2010-01-25 18:10:45
where is the updated Bios panel without multi last .fm requests. I just want a simple codebase to work from.
no fluff or useless crap. Don't understand why you guys have to go overboard with your scripts. Keep it simple stupid. Less is more, etc... etc..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 19:16:08
updated biography panel which caches the whole xml repsonse which means you can save/display all data. rather than parse the response, it now parses the cached file if it exists during on_metadb_changed. uses external js files so check those as well.

http://cid-649d3bfeaf541fbb.skydrive.live....astfm%20bio.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/lastfm%20bio.zip)

(it doesn't display any new data but i've put in samples of how to do it)
Title: WSH Panel Mod script discussion/help
Post by: Scidd0w on 2010-01-25 22:50:28
marc2003;

Thank you for the above script. I can't seem to get it working though.
Any idea whats going wrong?

popup:
Scripting Engine Initialization Failed (GUID: F22DD133-CB46-41DF-874E-93B34B56CD82, CODE: 0x80020101)
Check the console for more detailed information (Always caused by unexcepted script error).

console output:
WSH Panel Mod (GUID: DA503407-4725-42B8-B2D7-A823F69425D5): initliased in 0.0000371 s
WSH Panel Mod (GUID: F22DD133-CB46-41DF-874E-93B34B56CD82): Parsing file "C:\Program Files (x86)\foobar2000\scripts\marc2003\fonts_colours_flags.js"
WSH Panel Mod (GUID: F22DD133-CB46-41DF-874E-93B34B56CD82): Parsing file "C:\Program Files (x86)\foobar2000\scripts\marc2003\lastfm.js"
Error: WSH Panel Mod (GUID: F22DD133-CB46-41DF-874E-93B34B56CD82): Microsoft JScript runtime error:
Automation server can't create object
Ln: 8, Col: 1
<source text only available in compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-25 23:11:12
file>preferences>tools>wsh panel mod>uncheck "safe mode". restart foobar.
Title: WSH Panel Mod script discussion/help
Post by: Scidd0w on 2010-01-25 23:17:15
Great...
Works now!
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-01-26 09:03:17
Can some kind soul convert the playback section of this theme (buttons, progress, volume etc) to a script for someone like me who doesn't know even a little but of jscript
Thanks
http://fanco86.deviantart.com/art/MonoLite-122756120 (http://fanco86.deviantart.com/art/MonoLite-122756120)
Title: WSH Panel Mod script discussion/help
Post by: Scidd0w on 2010-01-26 09:31:36
With some bio's it fetches I see &nbsp; codes in there. Is it easy to replace these with normal spaces via your script? What line should I edit where etc?

i'm only interested in downloading 1 image per artist - the one in the artist.getinfo
[...]
i just want to know how to get the url for the "mega" bit and that is all. i tried that activex thing you posted and that works fine if i put in the url manually so i'm happy using that.
Are you in the process of writing a new script that fetches the artist images from last.fm? Something in the same manner that the bio plugin does. If so I'm lookig forward to it!  Now that I think of it a configurable amount of images per artist would be a nice to have too (than it will have all I like from the bio plugin without the overhead).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-26 12:14:35
i've been thinking about image support but it's not something i'm particularly bothered about. my main motivation is always going to be making something that i'm going to use. sharing it requires no effort at all. maybe i'll consider it when i'm really bored.

can you point me towards a page that shows the &nbsp?
Title: WSH Panel Mod script discussion/help
Post by: Scidd0w on 2010-01-26 18:24:48
After checking alot of artists in my collection when I came back from work it seems a very minor issue. I coud only find one bio so far. I seem to have hit the same artist alot last night or something.

Here's the link btw but don't feel rushed to fix it. It seems the only one as stated above:
http://www.last.fm/music/The+Temper+Trap (http://www.last.fm/music/The+Temper+Trap)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-26 19:52:16
you can just open "scripts\marc2003\lastfm.js" and at the end, you'll see this line of code....

Code: [Select]
return value.replace(/&amp;/g,"&");

just add this on the line before it.

Code: [Select]
value = value.replace(/&nbsp;/g," ");

BTW, i'm just finishing off a panel to download album artist art from last.fm. i'll post it later on.

screenshot (http://k5sbdw.blu.livefilestore.com/y1pH2jz98PKrmlL_iFEMcM9pF4dCbQIcynL2KIS4fMba0lsU_jFo-A42p0W0puJuWxOYIV5MuOM3Qr_eQIIg_BougUohy5KB3Yy/artist%20art.png)

edit: damn typo.
Title: WSH Panel Mod script discussion/help
Post by: Maf on 2010-01-26 20:32:11
Is it possible to Graphical Browser for WSH?
Title: WSH Panel Mod script discussion/help
Post by: Scidd0w on 2010-01-26 21:59:30
marc2003;
Thanks for the fix.
The screenshot looks great, I'm looking forward to it!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-26 23:40:05
right i've bundled all my scripts into 1 package. these should be usable by anybody even without scripting knowledge. if you know how add panels to a layout and use things like an "import" button, you pass the test.

download here: http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

i normally leave a trail of dead links but i'll make sure this one stays. any updates will use this link

the usage of this assumes you have WSH panel mod installed and that safe mode is disabled (File>Preferences>Tools>WSH panel mod>uncheck "Safe mode")

extract the scripts folder from zip into your main foobar directory. overwrite any files if prompted. i've used my username as a subfolder so it shouldn't conflict with anybody else's scripts. now you just need to edit this file foobar path\scripts\marc2003\lastfm.js (this file is compatible with my "playcount stats" script. all settings go in this single file. i hope the comments are self explanatory. and you can just ignore the ones for the panels you're not using. for most people, just adding their username and api key will be enough - an api key is something needed to access lastfm's webservices. get one here (http://www.last.fm/api/account)

then add as many WSH panels as you want to use to your layout and import 1 or more of text files. no further configuration should be required.

list of panels:

enhanced artwork panel
meant to be a straight replacement for the default CUI/DUI artwork panels.
features:
--always prioritise embedded album art if present
--full support of patterns set in display preference
--on the fly refresh. this means you can add/edit artwork for the currently playing track and use the "Refresh" context menu item to update the panel. with the standard panels, you have to restart playback.
--tooltip to show image dimensions and current display size. also shows if image is embedded or not.
--has the usual context menu items to set front/back/artist/correct aspect etc

simple text only biography panel
--built in caching support so it doesn't update on every track change (default expiry time is 24 hours because it shows your playcount for each artist. i figured an update every day would be enough)
--button to launch last.fm radio / browse last.fm website

simple seekbar
--shows realtime seek position when dragged.
--move mouse out of bounds downwards to automatically release the drag in the currently playing position

last.fm artist art panel
--download and display artist artwork from last.fm. must be triggered manually using the context menu.
--option to set the number of images to download in the aforementioned configuration file. i've set a default of 5. be warned, some of the images can be very large. i've had some 2-3mb files.
--when images are downloaded, you can scroll through them with your mouse wheel. also, double clicking the panel will open the current image in your default viewer.
--shows new random image on each new track (assuming there are images present for that artist)
--does not use the foobar artreader at all - it stores it's owns files. panel has "open containing folder" option for easy access.

playback buttons
--sample buttons for use in DUI. supports any size images you like. you can replace the included images with your own.

all panels support the default colouring scheme of CUI and DUI as can be seen in this screenshot i posted above (http://k5sbdw.blu.livefilestore.com/y1pH2jz98PKrmlL_iFEMcM9pF4dCbQIcynL2KIS4fMba0lsU_jFo-A42p0W0puJuWxOYIV5MuOM3Qr_eQIIg_BougUohy5KB3Yy/artist%20art.png).
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2010-01-27 01:08:22
Hey Marc,

great work... thank you very much.

But I'm getting the following error if I want to use your "simple biography":

Quote
WSH Panel Mod (GUID: 8CFF1E32-BA19-428C-9A98-4852EAFD9818): Microsoft JScript runtime error:
Invalid procedure call or argument
Ln: 112, Col: 2
<source text only available in compile time>

Line 112 is:

Quote
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh-40,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();


I'm an absolute beginner in this JScript-thing and I don't know what it means. Do you have an idea?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 01:14:15
have you definitely got the scripts folder from the zip extracted into your foobar install directory? i can't think what else would cause that. also, are you running the very latest version of WSH panel mod?

http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2010-01-27 01:29:10
Yes, I run the latest version and I extracted the "scripts"-folder into the foobar install directory. I checked not only once.

I deleted the "foo_uie_wsh_panel_mod.dll.cfg"-file in the configuration-folder and tried it again, too, but no luck.

In the line 112 it's about text and font. Perhaps it's a missing font? It seems that you use "Segoe UI", or? But I have it on my system. No idea...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 01:46:20
i've been testing in columns UI and default UI all along and other people have been using that script for quite awhile without problems. just now i did a clean portable install and used only the files in the download to setup from scratch and it all works as it should. i even booted into my xp install and that works with no problems as well. i'm totally stumped. 
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2010-01-27 09:17:43
Is there a way to use a WSH panel to cycle through images in a folder path like \Artist Images\%artist%\%artist%*.jpg, cycling either by mouse click/wheel, or preferably by changing every X seconds?

I've tried to look at some of the scripts posted here and elsewhere but finding a difficult time to glean the appropriate lines.  Any help would be appreciated!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 10:06:42
i've updated my sample package a few posts up with a crude image cycling script. might not be tested as much it should. give it a try. settings have to be set inside the script.

you can ignore all the waffle about configuring the last.fm script - obviously not needed. just extract scripts folder and import the image cycler script.
Title: WSH Panel Mod script discussion/help
Post by: Scidd0w on 2010-01-27 11:14:10
Thank you marc2003.
Can't wait to test them out tonight. As it's a complete package of your scripts, I'm missing the rating panel and the last.fm playback stats sync panel. Any reason why you left them out? (Not as good as you want them to be yet?)
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2010-01-27 11:16:11
The image cycle script works great out of the box, but I can't figure out how to point to my image folder.

I've tried changing the line

folder_title_format = "$directory_path(%path%)\\";

to many different methods to point to M:\Artist Images\%artist% both with and without the $directory_path function without success.  Is this the line I should be editing or is it elsewhere?  Can you help?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 11:21:26
did you use double backslashes to separate folders like the comments said?

Code: [Select]
folder_title_format = "M:\\Artist Images\\%artist%\\"


sorry i forgot to mention to include trailing slashes for the folder- only the example showed this.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 11:25:01
(Not as good as you want them to be yet?)


you've just made me cry. 

  the last.fm playback stats has it's own thread and i must admit, i totally forgot about rating - this is because i don't use it. but i'll include it later on.

edit: oh flip. double post. sorry mods.
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2010-01-27 12:16:19
Marc - The image cycle script works perfectly!  Thanks for the help!
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 13:22:51
I'm still working on my lyrics display but have some questions on how to do some things i still need to improve in the script.

Here is the current script:
http://pastebin.de/3519 (http://pastebin.de/3519)

- It displays all lyrics as plain text (doesn't supports timestamps, only ignores the stamps on display).
- Can be switched to "Autoscroll" via context menu (only for lyrics longer than the panel)
- a "fading effect" can also be turned on (only when autoscroll option for long texts is active, because it may "disguise" textparts otherwise  . Maybe i change it next time...)
- a manual "reset" option is available via context menu, too (if one adds an external textfile to the search path folder during playback it will be displayed immediately)
- via "Properties" padding settings can be made
- also in "Properties" search paths for Lyrics can be changed
- and - if foo_lyricsgrabber or foo_lyricsdb is present in the components folder - a online search command can be executed (set up in Properties as well).

My Problems:
1.) I don't know exactly if i have used Dispose() correctly...

2.) As you can see i have two Properties for lyrics path, one for TXT-files, one for LRC-files.
I'd have them in one Property but have no idea about, how i can make it that utils.ReadTextFile auto-recognizes the file ending and only uses txt or lrc.
I asked T.P Wang still and he said to me, i could use utils.Glob() for this (as var arr = utils.Glob("{$filename}.*").toArray();), but i have no clue how to add it (haven't seen any sample using it and you have to know: i'm a scripting-idiot...  )
And then i had to test this array with /\.(lrc|txt)$/m.
Can anyone give me an example how to use/include it in my script?

I think these are my only problems.
If someone finds any errors in my script or have ideas improving it, please let me know
Thanks

EDIT:
After reading my own post, if haven't understood myself... 

So let me specify:
I want something like this:
var ext_lyrics = window.GetProperty("Lyrics Path", "$directory_path(%path%)\\%artist% - %title%");
var filetype = (This is my problem... How can i make it to only recognise "lrc" and "txt" and prefer "lrc" when both are in the search path?)
var reading = utils.ReadTextFile(fb.TitleFormat(ext_lyrics).Eval() + filetype);

Anybody an idea?
Or a better solution?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 15:19:49
something like

Code: [Select]
var lrc = utils.Glob(ext_lyrics + ".lrc").toArray();
var txt = utils.Glob(ext_lyrics + ".txt").toArray();
arr = lrc.concat(txt);
if(arr.length > 0) file = arr[0];


or maybe use fso.FileExists with an if else if?
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 15:39:04
No, i want to avoid using FSO.
I want it working without user action (with FSO "Safe mode" has to be disabled first).

Thanks for this snippet.
Maybe i found out how to use it in my script with that fb.Titleformat
(i want to call fb.Titleformat only once, not more than necessary)

I'd need to call it twice with this snippet, do I?
Code: [Select]
var lrc = utils.Glob(fb.TitleFormat(ext_lyrics).Eval() + ".lrc").toArray();
var txt = utils.Glob(fb.TitleFormat(ext_lyrics).Eval() + ".txt").toArray();
arr = lrc.concat(txt);
if(arr.length > 0) file = arr[0];
var reading = utils.ReadTextFile(file);

Is it correct?
(You see, i really have only basic knowledge about what i'm doing... )
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2010-01-27 15:47:26
What the utils.Glob() do is using wildcards and return a VBArray of matched items:
e.g:
Code: [Select]
var arr = utils.Glob("D:\\something.*").toArray();

will match:
D:\something.txt
D:\something.dat
D:\something.blah
...

and then iterate that array, exclude unnecessary items:
Code: [Select]
for (var i = 0; i < arr.length; ++i) {
    if (arr[i].match(/\.txt$/m) {} // text file
    else if (arr[i].match(/\.lrc$/m) {} //lrc file
    ....
}
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 15:51:35
Ah, thanks, now its more clear
Haven't found anything about utils.Glob() except the short description in "Interfaces.txt".
(And you know, i need looooooooooong descriptions and explanations always twice ).

Thanks again
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-27 16:22:44
Thanks for the last.fm script Marc, it works well. The only problem I have with it is it seems immensely slow when it comes to scrolling. I think it is because of the longs lines that have to be wrapped, I have a lyric panel that is far far quicker to scroll. I wonder if it would be possible to wrap the text before painting it then paint that?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 16:28:05
I'd need to call it twice with this snippet, do I?


just once. what i'd do is this...

Code: [Select]
//outside of any functions so it gets set (if needed) on script load
window.GetProperty("Lyrics Path", "$directory_path(%path%)\\%artist% - %title%");

//inside your function
var lyrics_path = fb.TitleFormat(window.GetProperty("Lyrics Path")).Eval();
var lrc = utils.Glob(lyrics_path + ".lrc").toArray();
var txt = utils.Glob(lyrics_path + ".txt").toArray();
arr = lrc.concat(txt);
if(arr.length > 0) var reading = utils.ReadTextFile(arr[0]);


I wonder if it would be possible to wrap the text before painting it then paint that?


hehe, i have no idea what any of that means. i'm still very noob at this. i'm using the sample script T.P provided to calculate the height. maybe you can ask him?

I have a lyric panel that is far far quicker to scroll.


if that's the case, can't you just modify the on paint bits from that into the biog script?
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 16:35:10
Thanks, i'll try it, too
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 17:20:11
I think i got it:
Code: [Select]
var ext_lyrics = window.GetProperty("Lyrics Path", "$directory_path(%path%)\\%artist% - %title%");

var arr = utils.Glob(fb.TitleFormat(ext_lyrics).Eval() + ".*").toArray();
for (var i = 0; i < arr.length; ++i) {
    if (arr[i].match(/\.lrc$/m)) d = utils.ReadTextFile(arr[i]);
    else if (arr[i].match(/\.txt$/m)) d = utils.ReadTextFile(arr[i]);
}

Seems to work at least...
It excludes all files beside lrc and txt.
But it prefers txt files over lrc, although i ask for lrc first.
Any idea how to solve this?
(Or did i made again an error?)

I want to prefer lrc because it is always a lyrics file, but txt may contain something else than lyrics...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 17:31:19
you'll want to break the loop when the first file is found. your problem is that the last file in the array is used.

as the filenames are the same, this should be safe to do because .lrc comes before .txt alphebetically.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 17:34:53
And how can i solve it? Any idea?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 17:40:46
just thinking about it, it's a bit presumptuous of me to assume the files will be in the array in alphabetical order. let's hope so.

to break out of a loop....

break;

(or increase i beyond the maximum boundary)

edit: just had another thought. i'd never really noticed that utils.ReadTextFile function before. wouldn't it be easier just to try and load the files with that? as you only have 2 possibilities, it saves messing about with all this array nonsense.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 17:52:05
I don't think that break would help here.
I guess the problem is utils.ReadTextFile(arr).
It seems that this arr will always match the last one in alphabetical order...
(Renamed lrc to xxx and tried it again. now it is loaded no matter if i ask for it first or last...)

EDIT (to your edit):
Is one other solution, yes.
But i wanted a more elegant way
Should work, though (why i haven't had this idea by myself? Grrr... )
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 17:58:34
I don't think that break would help here.


2nd edit...    (sorry for the misinformation before)

Code: [Select]
loop:
for (var i = 0; i < arr.length; ++i) {
    if (arr[i].match(/\.lrc$/m)) {
        d = utils.ReadTextFile(arr[i]);
        break loop;
    } else if (arr[i].match(/\.txt$/m)) {
        d = utils.ReadTextFile(arr[i]);
        break loop;
    }
}


3rd edit: my original post using 2 arrays and concat would have preferred lrc files but you went with T.Ps code...

this is getting very messy. 
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 18:10:05
3rd edit: my original post using 2 arrays and concat would have preferred lrc files but you went with T.Ps code...


Looked more logical.
I'll see what i do now...

EDIT:
You break loop doesn't change anything.
utils.ReadTextFile(arr) still prefers the last file in an alphabetical row.
How the hell could i make this to LRC?
Or i advice all the possible users of my script to delete all their lrc's, would be the easiest to code 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-27 18:25:27
You break loop doesn't change anything.


works for me. try fb.trace to see if they are in order like mine....

Code: [Select]
arr = new Array("a.lrc", "a.txt");
fb.trace(arr[0]);
fb.trace(arr[1]);
loop:
for(var i = 0; i < arr.length; i++) {
    if (arr[i].match(/\.lrc$/m)) {
        d = arr[i];
        break loop;
    } else if (arr[i].match(/\.txt$/m)) {
        d = arr[i];
        break loop;
    }
}
fb.trace(d);

//console output
a.lrc
a.txt
a.lrc

//confirmed by removing break statement
a.lrc
a.txt
a.txt
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 18:41:52
Guess what?
It is working now. Thanks
Maybe i made a typo before, but now it works.

Now i can finish my lyrics panel
Title: WSH Panel Mod script discussion/help
Post by: jmccrohan on 2010-01-27 22:24:22
I have taken marc2003's lastfm biography code and modified it to display lyrics stored within ID3 tags.
I liked the style of the lastfm code, so I created this to work around that.

link (http://www.netsoc.tcd.ie/~jmccroha/simple_lyrics.txt)
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-01-27 22:49:15
Very short code
But why do you create a context menu with the default context menu entries only?
You could delete the whole on_mouse_rbtn_up() section.

Here is my current preliminary lyrics panel script:
http://pastebin.de/3533 (http://pastebin.de/3533)

Maybe someone finds it useful
If anybody has ideas to improve it, please let me know.
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-01-28 14:02:33
Guys any idea why
WshShell.run("http://www.last.fm/music/" + encodeURIComponent(artist).replace(/\s+/,"+"));
doesn't replace the space in the artist name with a + ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-28 15:45:30
try

Code: [Select]
"http://www.last.fm/music/" + artist.replace(/\s+/g,"+")


i only use encodeURIComponent for accessing the webservices.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-28 16:07:06
just another update to my samples....

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

as my old pack contained 3 separate artwork panels, i've taken a big hammer and merged them all into one. it has 3 modes.

-default foobar artreader
-lastfm artist art with built in download facility (uses this command line tool made by paradog (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425&hl=PARADOG) (runs silently - you won't notice it at all). you don't need to download it - i've included it. it's just 8kb in size. and the effort it's saved me is untrue. )
-cycle folder. you just set some title formatting and it will automatically cycle all the images. options are off, 5, 10 and 20 seconds.

(the last.fm mode supports this cycling as well.)

everything is controlled via context menu except the path for the "cycle folder". you need to edit the script itself to set that.

Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-01-28 17:46:57
marc can you please take a shot at this?
Quote
Can some kind soul convert the playback section of this theme (buttons, progress, volume etc) to a script for someone like me who doesn't know even a little but of jscript
Thanks
http://fanco86.deviantart.com/art/MonoLite-122756120 (http://fanco86.deviantart.com/art/MonoLite-122756120)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-28 18:15:44
the playback controls and background are panel stack splitter. the volume control, seekbar and playback order button are 3 separate WSH scripts. you can right click those, select configure to open the editor and then export the contents to a text file. or you can use the columns UI layout page to copy panels between layouts. i
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-30 09:39:07
edit: question removed. totally unrelated to the scripting. 
Title: WSH Panel Mod script discussion/help
Post by: geoslay on 2010-01-30 11:08:00
Hi i want to make a seek bar with WSH panel mod but i dont know nothing about script's.Any help? Here is a pic of my Foobar
Thanks in advance.


(http://img222.imageshack.us/img222/9840/foob.png)
By wizard20 (http://profile.imageshack.us/user/wizard20) at 2010-01-30
Title: WSH Panel Mod script discussion/help
Post by: jeremija on 2010-01-30 11:22:17
here is what i use:

SEEKBAR

Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }

var g_font = gdi.Font("Segoe UI", 12, 0);
var g_drag = 0;

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

    
    if (length>0){
        if(g_drag){
            pos = ww * g_drag_seek;
        } else {
            pos = ww * (fb.PlaybackTime / length);
        }
    }

       var txt = "Seekbar";
       gr.DrawRect(0,0,ww-1,wh-1,1.0,RGB(0,0,0));
       gr.FillSolidRect(1,1,ww-2,wh-2,RGB(28,28,28));
      
    var dio1 = 0.375*(wh-2);
       var dio2 = 0.625*(wh-2);

       gr.FillSolidRect(1,1,pos-1,dio1,RGB(119,187,255));
       gr.FillSolidRect(1,1+dio1,pos-1,dio2,RGB(51,153,255));

}
function on_mouse_lbtn_down(x,y){
    g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
//    on_mouse_move(x,y);
    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;
    window.Repaint();
}
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_playback_new_track(info){
    window.Repaint();
}

function on_playback_stop(){
    window.Repaint();
}

function on_playback_seek(time){
    window.Repaint();
}

function on_playback_time(time){
    window.Repaint();
}
//EOF
Title: WSH Panel Mod script discussion/help
Post by: geoslay on 2010-01-30 11:40:45
Thank you,is very good.anything for playbak order? I ask too much... 
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-01-30 15:46:15
the playback controls and background are panel stack splitter. the volume control, seekbar and playback order button are 3 separate WSH scripts. you can right click those, select configure to open the editor and then export the contents to a text file. or you can use the columns UI layout page to copy panels between layouts. i


I tried that but it is not possible to remove borders for wsh panel, I thought there would be a way to draw the whole thing using one wsh panel
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-01-30 17:49:07
marc can you please provide a snippet to convert the play button into a play/pause button. I have no idea how to switch images and I am using the layout
< || >
Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-01-30 20:21:59
I thought there would be a way to draw the whole thing using one wsh panel


that's way beyond my capabilities.   

as for the buttons, i already told you, they're done in panel stack splitter for that config. there isn't much need to make buttons in WSH panel mod when you're using columns UI/PSS because you already have much easier ways (using standard columns UI toolbar or $imagebutton in PSS).
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-30 20:48:55
Here is something that might come in handy, but I don't know exactly what your script looks like Icedtea so it probably won't work without some tweaking.

Code: [Select]
function on_playback_stop()
{
    buttons.pop.icon=gdi.Image(dir+"play"+".png");
    buttons.pop.tooltiptxt="Play";
    window.Repaint();
}
function on_playback_pause(is_paused)
{
    buttons.pop.icon=is_paused?gdi.Image(dir+"play"+".png"):gdi.Image(dir+"pause"+".png");
    buttons.pop.tooltiptxt=is_paused?"Play":"Pause";
    window.Repaint();
}
function on_playback_starting(cmd, is_paused)
{
    buttons.pop.icon=is_paused?gdi.Image(dir+"play"+".png"):gdi.Image(dir+"pause"+".png");
    buttons.pop.tooltiptxt=is_paused?"Play":"Pause";
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-01-31 03:36:01
I thought there would be a way to draw the whole thing using one wsh panel


that's way beyond my capabilities.   

as for the buttons, i already told you, they're done in panel stack splitter for that config. there isn't much need to make buttons in WSH panel mod when you're using columns UI/PSS because you already have much easier ways (using standard columns UI toolbar or $imagebutton in PSS).


sorry for the confusing message
What I meant was in the button example in your samples is there a way to convert the play button to a Play/Pause button. The function replacement fb.PlayOrPause() works ok but I have no idea on how to switch the images between play and pause i.e. when the playback is paused the button should be play.png and when the song is playing the button should be pause.png, with the hover effects of course.
Thanks
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-01-31 18:15:41
Tom I am trying to implement your suggestion but image switching isn't working for me
Code: [Select]
image_path = fb.FoobarPath + "\\scripts\\images\\";
play_image = gdi.Image(image_path + "play.png");
pause_image = gdi.Image (image_path + "pause.png");
display_image = play_image;

function on_playback_new_track(){
    display_image = pause_image;
    window.Repaint();
}
function on_playback_pause() {
    display_image = play_image;
    window.Repaint();
}

function on_playback_starting(){
    display_image = pause_image;
    window.Repaint();
}

function on_paint(gr) {
    gr.DrawImage(display_image, 0, 0, 32, 28, 0, 0, 32, 28, 0, 255);
}

on starting playback I get pause.png OK
on pausing playback I get play.png OK
on resuming playback I get play.png Not OK should be pause.png

What am I doing wrong?
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-01-31 20:06:31
Hi, on_playback_pause() is called when playback is either paused or unpaused, so you need to alternate between the play and pause images there, like this.

Code: [Select]
image_path = fb.FoobarPath + "\\scripts\\images\\";
play_image = gdi.Image(image_path + "play.png");
pause_image = gdi.Image (image_path + "pause.png");
display_image = play_image;

function on_playback_stop(){
    display_image = play_image;
    window.Repaint();
}
function on_playback_pause(is_paused) {
    display_image = is_paused?play_image:pause_image;
    window.Repaint();
}

function on_playback_starting(cmd, is_paused){
    display_image = is_paused?play_image:pause_image;
    window.Repaint();
}

function on_paint(gr) {
    gr.DrawImage(display_image, 0, 0, 32, 28, 0, 0, 32, 28, 0, 255);
}
Title: WSH Panel Mod script discussion/help
Post by: jmccrohan on 2010-02-01 00:54:52
Very short code
But why do you create a context menu with the default context menu entries only?
You could delete the whole on_mouse_rbtn_up() section.

I uploaded an old version accidentally. 

The current version refreshes the displayed lyrics.
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-01 04:41:24
Thanks Tom
I got everything else to work but lost hover somehow in the process. That is the only thing left and I would appreciate the help
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\tooltip_buttons.js"
// ==/PREPROCESSOR==

var image_path = fb.FoobarPath + "\\scripts\\images\\";
var play_image = image_path + "play.png";
var pause_image = image_path + "pause.png";
var previous_image = image_path + "previous.png";
var next_image =  image_path + "next.png";
var display_image = play_image;
var bw = 32;
var bh = 28;
var window_color = RGB(240,240,240);
var dui = window.InstanceType
var top_margin = 2;
var left_margin = 4;
window.MinWidth = window.MaxWidth = 104;
window.MinHeight = window.MaxHeight = bh + 4;

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

function on_playback_stop(){
    display_image = play_image;
    window.Repaint();
}
function on_playback_pause(is_paused) {
    display_image = is_paused?play_image:pause_image;
    window.Repaint();
}

function on_playback_starting(cmd, is_paused){
    display_image = is_paused?play_image:pause_image;
    window.Repaint();
}

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

function on_paint(gr) {
    Buttons = {
        but1: new Button(left_margin,top_margin,bw,bh, {normal: previous_image, hover: image_path + "previous_h.png"}, function(){fb.Prev();}, "Previous"),
    but2: new Button(bw + left_margin,top_margin,bw,bh, {normal: display_image, hover: image_path + "play_h.png"}, function(){fb.PlayOrPause();}, "Play/Pause"),
    but3: new Button((bw*2) + left_margin,top_margin,bw,bh, {normal: next_image, hover: image_path + "next_h.png"}, function(){fb.Next();}, "Next")
        }
    gr.FillSolidRect(0, 0, ww, wh, window_color);
buttonsDraw(gr);
}

tooltip_buttons.js is from marc2003's examples
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-02-01 11:44:55
Have a look under on_paint where the buttons are defined, there is a line starting with "but2: new button..." - there is a bit inside there that looks like this: {normal: display_image, hover: image_path + "play_h.png"}, you need to change that to {normal: display_image, hover: display_image_h} for example and then change display_image_h at the same time you change display_image.
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-01 12:11:08
Have a look under on_paint where the buttons are defined, there is a line starting with "but2: new button..." - there is a bit inside there that looks like this: {normal: display_image, hover: image_path + "play_h.png"}, you need to change that to {normal: display_image, hover: display_image_h} for example and then change display_image_h at the same time you change display_image.

That is not the problem hover images aren't shown at all even when they are defined and that included the static previous and next buttons. I suspect there is something in tooltip_buttons.js that is causing it but I cannot wrap my head around that script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-01 13:34:41
the original tooltip button code is by T.P Wang and tedgo. i don't understand it that well either.

i'll try and work it out from what Tom posted.

in the meantime, i've updated my samples. they've all had their options updated to be accessible from the context menu only. no more script editing should be needed (one exception is setting the image size and margins for buttons).

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

samples include

rating script by NEMO7538
simple seekbar
simple biography
playback buttons
web links (myspace, youtube, lastfm)
3 in 1 artwork panel
-the first is a straight replacement for the default art panel. it always prefers embedded album art if it exists. it then falls back on the usual display options set in the foobar preferences.
-last.fm artist art panel. can download multiple images from last.fm and cycle through them. it must be triggered manually using the context menu
-cycle folder option. can cycle through images in a folder at 5, 10 or 20 second intervals

so no instructions needed really. just extract the scripts folder into your foobar directory. add panels and import the samples you want and right click them to see the various options.

EDIT: in the unlikely event someone downloaded this between 1:35-150pm today, please download it again. i didn't update the zip with my newest files. 
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-02-01 14:51:37
@icedtea
Don't create the buttons in on_paint(), that's all

EDIT:
I rewrote your script (should work now)
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\tooltip_buttons.js"
// ==/PREPROCESSOR==

var image_path = fb.FoobarPath + "\\scripts\\images\\";
var play_image = {normal: image_path + "play.png", hover: image_path + "play_h.png"};
var pause_image = {normal: image_path + "pause.png", hover: image_path + "play_h.png"};
var previous_image = {normal: image_path + "previous.png", hover: image_path + "previous_h.png"};
var next_image =  {normal: image_path + "next.png", hover: image_path + "next_h.png"};
var bw = 32;
var bh = 28;
var window_color = RGB(240,240,240);
var dui = window.InstanceType;
var top_margin = 2;
var left_margin = 4;
window.MinWidth = window.MaxWidth = 104;
window.MinHeight = window.MaxHeight = bh + 4;

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

function on_playback_stop(){
    Buttons.but2.alterImage(genPPImageSrc());
    Buttons.but2.repaint();
}

function on_playback_pause(state) {
    Buttons.but2.alterImage(genPPImageSrc());
    Buttons.but2.repaint();
}

function on_playback_starting(){
    Buttons.but2.alterImage(genPPImageSrc());
    Buttons.but2.repaint();
}

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, window_color);
buttonsDraw(gr);
}

function genPPImageSrc() {
return (fb.IsPlaying && !fb.IsPaused) ? pause_image : play_image;
}

Buttons = {
    but1: new Button(left_margin,top_margin,bw,bh, previous_image, function(){fb.Prev();}, "Previous"),
    but2: new Button(bw + left_margin,top_margin,bw,bh, genPPImageSrc(), function(){fb.PlayOrPause();}, "Play/Pause"),
    but3: new Button((bw*2) + left_margin,top_margin,bw,bh, next_image, function(){fb.Next();}, "Next")
}

You need this tooltip_buttons.js for this: http://pastebin.de/3644 (http://pastebin.de/3644)
(has some additional lines to repaint the play/pause button only)
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-02 03:51:36
thanks tego! I will try to understand it if I can
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-02 05:55:05
this post is aimed at people who are happy enough writing their own scripts.

this little snippet allows you to present the user with a text input box, save this text and use it in your scripts.

(http://public.blu.livefilestore.com/y1puPG5Nwn4hzpr7mnfWVhGBiTghQJ-FCPOnm2Li6vRAXbTVfdSHDvymO8S03FVENGFF4Vyboto6KYnWZRtI1bM9Q/easy2.png)

javascript doesn't have a text input box but vbscript does so i found this code (http://wsh2.uw.hu/ch08c.html) online to do the work. it has to be saved in an external file and we can call it using WshShell.Run.

first of you need my modified version of the script from that link. save this as "input.wsf" in your "scripts" directory...

Code: [Select]
<?xml version="1.0" encoding="ISO-8859-1"?>
<job id="IncludeExample">
<script language="VBScript">
<![CDATA[
Function WSHInputBox(Message, Title, Value)
WSHInputBox = InputBox(Message, Title, Value)
End Function
]]>
</script>
<script language="JScript">
<![CDATA[
args = WScript.Arguments;
var WshShell = WScript.CreateObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
try {
ts = fso.OpenTextFile(args(2), 1, false, -1);
s = ts.ReadLine();
ts.close();
} catch(e) {
s = ''
}
var result = WSHInputBox(args(1), args(0), s);
if (result != null) {
try {
ts = fso.OpenTextFile(args(2), 2, true, -1);
ts.WriteLine(result);
ts.close();
} catch(e) {
Wscript.Echo("Error saving data!");
}
}
]]>
</script>
</job>

this is the script to go in your panel. i'm pretty crap at explaining things so i hope the comments make some sort of sense. it's pretty simple really....

Code: [Select]
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;

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

function text_input_box(title, message, filename) {
WshShell.Run("\"" + wsf + "\" \"" + title + "\" \"" + message + "\" \"" + filename + "\"", 0, true);
return read(filename);
}

function read(fn) {
try {
var f = fso.OpenTextFile(fn, 1, false, -1);
var s = f.Readline();
f.Close()
return s;
} catch(e) {
return '';
}
}

///////this is the bit you'll want to customise for your own usage//////

var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var wsf = fb.FoobarPath + "scripts\\input.wsf";
//need to be somewhere with "write" access
var settings_path = fb.ProfilePath + "text_input_settings\\";
if(!fso.FolderExists(settings_path)) fso.CreateFolder(settings_path);

//each variable you want to use needs an associated file.
//the input box saves input to this file and then WSH panel mod can read it.
g_text_file = settings_path + "g_text";
//check to see if a value already exists and use it
g_text = read(g_text_file);

//now we a need a function to trigger our input
function on_mouse_lbtn_up(x, y) {
    //the text_input box will read the file and present the current value as the default text.
    //when you click ok, the external script will then save the result to the text file
    //wsh panel mod can then read this updated file and return the new value
    //in this simple example, it will just be updating the display using window.Repaint().
    g_text = text_input_box("Message Title", "Enter some text:", g_text_file);
    window.Repaint();
}

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, RGB(255,255,255));
    gr.GdiDrawText(g_text, gdi.Font("Segoe UI", 16), RGB(0,0,0), 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
}
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-02 08:51:51
marc2003 is it possible to get a wikipedia image for the links? better yet a template where we can create similar icons.
Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-02 08:59:28
i just got those images from google image search. try it yourself....  (there wasn't a wikipedia icon in the pack that i used)
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-04 12:22:24
marc2003 whenever you get the time please consider making a button to switch playback modes i.e. shuffle, default etc
Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-04 12:33:20
there's already one in T.P's samples i think.

the samples are on the same download page as the component.
Title: WSH Panel Mod script discussion/help
Post by: catchyfourwordphrase on 2010-02-04 23:50:02
Hello there, fellow alien cats!

I've been experimenting with WSH Panel Mod (DUI) for quite a while now but there's still something I'd like to have in my config but can't manage to script. Well, about that... I should mention that I have nearly no clue of scripting whatsoever. All I did before was copy&paste-ing and changing some numeric values. ^^

So here's what I wanna do:  I want a heart-shaped love button like I’ve seen in marc2003’s or carmenm’s configs. But it should work without LastFM. I aleady used NEMO7538's rating buttons and created a column named "Loved" that displays a heart when a track has a 5-rating.

But for  several reasons I don’t wanna handle it this way. One of them is that you’re not able to uncheck a “loved” song (I could only give it a <5rating). So, I’d love to see a script that can either

1) create a rating-tag and fills it with the value 5
or
2) create a %loved%-tags (by using customdb i.e.).

I’d be really really grateful for any helping hand! =)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2010-02-05 15:14:06
is it appropriate to make requests here?
i'm no coder, and the scripting for this panel, whatever it is, flies straight over my head.

what i'd like to see is a config that divides its host panel into 9 equal areas - basically a 3x3 grid. each area is filled with a solid colour.
each area is also assigned a number, 1-9, based on the layout of a standard keypad (1 bottom-left and 9 top-right).
clicking on a coloured box sends the box's number to the %mood% tag of the currently playing track.

the whole idea is that the horizontal axis represents tempo, and the vertical axis is mood. mimicking the layout of a keypad would make it work well with global hotkeys.
it would also be easy to implement each track's 'color' into a CUI playlist view, and you could build great autoplaylists based on the values.

i really have no idea how difficult this would be to implement, but if anyone is inclined to put it together, i think people would find it useful!

inspired by:
http://www.crayonroom.com/moody.php (http://www.crayonroom.com/moody.php)

Title: WSH Panel Mod script discussion/help
Post by: ojdo on 2010-02-05 15:39:40
is it appropriate to make requests here?
i'm no coder, and the scripting for this panel, whatever it is, flies straight over my head.

You are lucky, I just coded such a panel with a 5x5 grid. It is available as a ready theme for DUI in this ZIP file (http://www.openaudio.eu/wsh_mood_annotation.zip) on openaudio.eu (http://www.openaudio.eu/) (link is at the bottom of the page). It is configured to set the tags %valence% (sad to happy) and %arousal% (calm to active) on a scale from -2 to 2.

I also added tagging scripts for foo_masstag to "move" a track's rating in this grid with 4 keyboard shortcuts (I use the keys W,A,S,D).

This is how a portable installation looks after loading the theme:
(http://www.ojdo.de/screenshots/wsh_mood_annotation_v2.png)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2010-02-05 16:42:00
ojdo, that is tremendous! it integrates perfectly with my CUI config.
now i just have to build a massive playlist column script to show each track's color

thanks for sharing. i am very lucky indeed!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-05 17:04:01
@catchyfourwordphrase, i've made you a script. it's totally separate from the rating script so just use that as usual.

you'll need the latest version of my samples zip.

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

it contains updates since my last post (plus i've fixed the ratings panel to let you customise the background colour)

now you'll need to configure customdb. on the "fields" page, create a new field called "LOVE". set the "name" and "display" as this. for the "key", you should select "custom" and add

%artist%,%title%

now restart foobar. now go to the "actions" page and add these 2 actions

Code: [Select]
Display: Love
Field: LOVE
Update: ContextMenu
Set Value: 1


Code: [Select]
Display: Unlove
Field: LOVE
Update: ContextMenu->Erase


now add a panel and download this code

http://pastebin.com/f7baf0174 (http://pastebin.com/f7baf0174)

use a tag named %love% in your playlist to display a heart if it equals 1.

Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-02-05 18:36:26
http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)


In single every sctipt of yours i got error
"Cant create object" in common.js on line 237

Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");


did i missed somthing so much mandatary that it wasnt even in readme?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-05 18:38:40
file>preferences>tools>wsh panel mod>uncheck "safe mode". restart foobar.

i keep meaning to make some proper documentation but i never quite get around to it.
Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-02-05 18:51:54
file>preferences>tools>wsh panel mod>uncheck "safe mode". restart foobar.

i keep meaning to make some proper documentation but i never quite get around to it.


solved. thx for swift response.
Title: WSH Panel Mod script discussion/help
Post by: catchyfourwordphrase on 2010-02-05 19:38:13
Thanks a ton, marc2003!! 
Worked like a charm...at least until foobar decided to crash several times because of customdb. It's kind of weird - I've been running fb2k with four dockable panels (one of them is a chronflow panel in nearly fullscreen) and haven't experienced any crashes at all but as soon as I want to add a tiny little heart to my screen, foobar goes bananas 
But nevertheless, thanks again for helping me out. Members like you are one of the reasons why I love foobar and its community so much.

Well, is there any work around to get along with foo_customdb's buggyness? If not, I'd be totally happy with a heart button which generates a 5 in the %rating%-tag and can also erase it. Right now, I'm trying to change your script to do so but the only result was the lovely "ping" sound of a script error 
So, sorry to bother you again, but could you please help me again with this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-05 19:56:42
i experienced a few crashes with foo_customdb during my very first hour of use. and i think it's related to the default fields/actions being triggered during playback. because as soon as i removed them all and just used my own settings, i've not had a single problem. i've been using it for pushing on 2 months now with my last.fm script and it's behaved perfectly.

so try removing all the defaults and leave just your own settings - make sure you restart foobar when done.
Title: WSH Panel Mod script discussion/help
Post by: catchyfourwordphrase on 2010-02-05 23:26:54
For me it seems like this actually did the trick, no crash so far. 
So, thanks again!
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-02-06 16:39:49
I completely rewrote my form and keyboard input scripts - and wasted way to much of my time. The result is much more universal and probably useful for others:

FormsAndButtons.zip (http://cid-229871a834d2fa56.skydrive.live.com/self.aspx/.Public/FormsAndButtons%20v1.zip)

It includes a demonstration to show the different elements (harmless to your files):
(http://j5xrtg.bay.livefilestore.com/y1p_BlVeQhULp-hy8ItXyrxTLByp9rnC66pazmJbLtNrwRO-8_WMcltV6cCKPY38jCyRF4dzahWZuizQzgZtWdsbLBOEDhrXv84/screenshot.jpg)

I implemented the possibility for keyboard-only use, for details see FormsAndButtons.js

There are a few issues:
- I do call window.Repaint() in on_size, although it is recommended not to do (anyone a suggestion how to it otherwise if I need to get the window size?)
- I get a windows sound if I show a pop-up menu after pressing enter (see: this post (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=685958))
- I wrote this script for an US-international keyboard layout (supporting dead keys and alt-gr) and there is (as far as I know) currently no way in WSH panel mod to find out which layout is used or to decode vkeys depending on keyboard layout. So anyone who wants to use this script with another keyboard layout should manually rewrite KeyboardHandling.js.
- Graphically my elements are plain and simple and that is the way I prefer it, so anyone who wants them otherwise is free to alter the script, but I am not going to do it. Colours could be changed in FormsStyle.js

Comments (or bug reports) are welcome!
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-07 22:52:55
In my current setup, I've created a "now playing" panel showing artist/album/title information.  It works pretty well, but there's a bit of a discrepancy when playing streaming audio. 

Some of my streams provide the artist/title information for the currently playing track, and this displays properly in the playlist viewer.  Unfortunately, my now playing WSH panel only displays the radio station's name.  Additionally, if I right-click on the playing track in the playlist viewer and go to properties, the artist and title fields do not represent the currently playing track, but rather the radio station's name. 

Therefore, it seems like the now playing WSH panel is displaying the metadata information "properly", but I'm not sure how to access the streaming artist/title.  Any ideas?
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-02-07 23:25:32
You can get it with on_playback_dynamic_info_track() and the Eval() method (not EvalWithMetadb() ).
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-08 00:29:02
Thanks, this replacement worked well.
Title: WSH Panel Mod script discussion/help
Post by: erzatz on 2010-02-09 00:32:34
Hi.

If this could be the place for a request - there it is, if not - please move it.

The only thing I actually miss in foobar2000 DUI is a panel allowing to tag files easily. Constantly visible, as opposed to Properties, that has some pre-set buttons, configurable preferably, such as "Genre: rock/blues/blah...", same for %date%. Just easier, quicker that quicktagger component, without right-click-menus-in-menus. It would be GREAT to have a field to fill with Artist, Title, Album names manually. Sometimes it's the only option.

I can't write it myself but maybe someone can?
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-02-09 08:38:54
The only thing I actually miss in foobar2000 DUI is a panel allowing to tag files easily. Constantly visible, as opposed to Properties, that has some pre-set buttons, configurable preferably, such as "Genre: rock/blues/blah...", same for %date%. Just easier, quicker that quicktagger component, without right-click-menus-in-menus. It would be GREAT to have a field to fill with Artist, Title, Album names manually. Sometimes it's the only option.

I can't write it myself but maybe someone can?


It is exactly therefore that I wrote my FormsAndButtons script, which I posted last week. As soon as I find some time I will make an (easy to customise) example of how to use it for tag input.
Title: WSH Panel Mod script discussion/help
Post by: ebaboon on 2010-02-10 21:42:05
How can i select DSP preset within WSH script? I tried fb.RunMainMenuCommand("Playback/DSP Settings/[Preset Name]") but it does not work.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-02-12 13:53:14
Hi,

does anyone know how i can compare to strings to eachother in the WSH_Panel_Mod?
I have searched on MSDN and tried to use some of the code from there,
but it gives me errors.

For instance if i put this in my code:


public static function Compare(
    strA : String,
    strB : String
) : int

i get the error Expected ';'

Oh Yeah, i'm a total newbie in using Jscript.
At first I always try to change little code from existing codes.
But in this case i couldn't find one that suites me.

cheers
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-12 14:04:01
keeping it simple.

Code: [Select]
function compare(a,b) {
  (a == b) ? return true : return false;
}

var result = compare("apples", "oranges");
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-02-12 14:27:13
keeping it simple.

Code: [Select]
function compare(a,b) {
  (a == b) ? return true : return false;
}

var result = compare("apples", "oranges");


Marc,

when is use the first code i get an Syntax error,
when using the second it says Object expected.

As I said i'm a newbie 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-12 14:32:41
oops, should have tested...

Code: [Select]
function compare(a,b) {
  if(a == b) return true
  else return false;
}

var result = compare("apples", "oranges");
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-02-12 14:40:18
Even simpler:
Code: [Select]
function compare(a, b) { return a==b; }

var result = compare("apples", "oranges");

If you want to learn the syntax, try here: http://msdn.microsoft.com/en-us/library/4y...28VS.85%29.aspx (http://msdn.microsoft.com/en-us/library/4yyeyb0a%28VS.85%29.aspx)
This might also help: http://www.w3schools.com/js/default.asp (http://www.w3schools.com/js/default.asp) It's for JavaScript on the web, but it's the same syntax.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-12 14:41:44
doh!
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-02-12 14:43:11
Thanks Tom/Marc for the help and links.
I'm got a little reading to do  now

cheers
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2010-02-13 18:06:13
If i may request something then i would ask for an enhancement for some of marc2003s scripts and tedgos lyrics script wich are now limited to show info about now playing track. It would be useful if they would respond to the Dui option in preferences -> display to prefer playing track or selection. Does the WSH Panel at all let you grab this option?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-13 21:43:18
no, it's not possible to get that preference. you can edit my script to always follow the selection.  open

Code: [Select]
scripts\marc2003\v2\common.js


line 108 should be this....

Code: [Select]
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();


replace it with...

Code: [Select]
g_metadb = fb.GetFocusItem();


restart foobar (or reload script) for changes to take effect.
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-02-14 12:12:49
The only thing I actually miss in foobar2000 DUI is a panel allowing to tag files easily. Constantly visible, as opposed to Properties, that has some pre-set buttons, configurable preferably, such as "Genre: rock/blues/blah...", same for %date%. Just easier, quicker that quicktagger component, without right-click-menus-in-menus. It would be GREAT to have a field to fill with Artist, Title, Album names manually. Sometimes it's the only option.


I updated my FormsAndButtons script: FormsAndButtons v1.1.zip (http://cid-229871a834d2fa56.skydrive.live.com/self.aspx/.Public/FormsAndButtons%20v1.1.zip)

Besides some fixed bugs it now includes an example of how to make a tag editor with it.

It still had the issue that it only supports the US or US-international (QWERTY) keyboard layout, unless one edits the KeyboardHandling.js file. @T.P Wang: couldn't you implement windows' MapVirtualKeyEx function (http://msdn.microsoft.com/en-us/library/ms646307(VS.85).aspx)?
Title: WSH Panel Mod script discussion/help
Post by: nosatyj on 2010-02-14 16:46:14
hi, guys! I know I`m insane, but how send all Media Library`s fields to array?
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-02-14 18:47:18
@nosatyj

No offense but... you better use use C++ and the official SDK.
WSH Panel mod can retrieve metadata of only ONE track at any point.
Title: WSH Panel Mod script discussion/help
Post by: Tefra on 2010-02-14 23:18:20
i took pieces from here and there and i made a simple text based playback order drop down
it's based on the marc23's scripts lib (bground options, etc) and his scripting style, vars etc

Here's my result for my controls bar
(http://ypxvpa.bay.livefilestore.com/y1pztV9vJY4cheu5Szt0Wa5oT5LLXF67Sj0IFmnHw7guvdPzO8-Rr0J4LBXKWIciQa4RIQR8B8eOTpnYX2MkFnCoYsdN62wyfv6/myfb2k_ctrl.gif)


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

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);
var top_margin = 0;
var left_margin = 4;
var bw = 16;
var bh = 16;

var mypbo = [];
mypbo[0] = "Default";
mypbo[1] = "Repeat (Playlist)";
mypbo[2] = "Repeat (Track)";
mypbo[3] = "Random";
mypbo[4] = "Shuffle (tracks)";
mypbo[5] = "Shuffle (albums)";
mypbo[6] = "Shuffle (folders)";

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

function on_mouse_lbtn_down(x, y) {
    var pbo = window.CreatePopupMenu();
    var i;
    var ret;
    for(i = 0; i < mypbo.length; i++)
    {
        pbo.AppendMenuItem(MF_STRING, i+1, mypbo[i]);
    }
    pbo.CheckMenuRadioItem(1, i, fb.PlayBackOrder + 1);
    ret = pbo.TrackPopupMenu(x, y);
    if (ret >= 1 && ret <= i)
    {
        fb.PlayBackOrder = ret - 1;
    }
    pbo.Dispose();
}

function on_paint(gr) {
    buttons_background(gr);
    icon = gdi.Image(images_path + "arrow_down.png");
    gr.DrawImage(icon,left_margin,top_margin,bw,bh,0,0,icon.Width,icon.Height);
    gr.SetTextRenderingHint(5);
    gr.DrawString("Order: " + mypbo[fb.PlayBackOrder], g_font, g_textcolor, left_margin+bw, top_margin, ww, wh, 0);
}

function on_playback_order_changed(new_order_index)
{
    window.Repaint();
}

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


you will need to put a small arrow img in in the folder \scripts\marc2003\v2\images named arrow_down.png
here's one for you (http://ypxvpa.bay.livefilestore.com/y1p5q3i9RwFCUDSFgLLZn9p1XcN3BRcXq8wUw8ULFimz7s5PfYLV2E7d9Nq9fd398kwvRNs33NyAnD7fAB5tQY5y_QPPzGer2mK/arrow_down.png)


Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-16 05:42:18
Is there any way to determine if certain title formatting fields have multiple values, and if so, choose a custom separator?  For instance, this works:

Code: [Select]
artist = fb.TitleFormat("$replace(%artist%,',', &)").Eval();


Now all of my multiple artist tracks have variable "artist" equal to "Artist A & Artist B" (more suitable for compatibility with Last.fm).  The problem with this method is that if the artist field naturally has a comma in it, the script mistakenly sees it as a multiple artist field.  Is there any way around this?  Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-16 08:02:31
have a look here...

http://wiki.hydrogenaudio.org/index.php?ti...ence#Metadata_2 (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference#Metadata_2)
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-16 09:43:28
Thanks, that worked.  Additionally, I've noticed that the foo_softplaylists component doesn't work on tracks with multiple artists.  It only recognizes the first artist.
Title: WSH Panel Mod script discussion/help
Post by: unclean on 2010-02-18 07:48:51
Could someone help me get a script working? I've built a little menu that searches shoutcast based off of the genre of the playing track:



Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\common.js"
// @import "%fb2k_path%scripts\tooltip_buttons.js"
// ==/PREPROCESSOR==

function on_paint(gr){
    var ww = window.Width;
    var wh = window.Height;    
    gr.FillSolidRect(0,0,ww,wh,RGB(220,220,220));
}

//Split multiline tags into an array
function split_tag(t) {
    var splitstrings = [", ",",","; "," - "," "];
    var tag=fb.TitleFormat("$caps(%"+t+"%)").EvalWithMetadb(g_metadb);
    //if (tag = "?") return;
    var foo = -1;
    do {
        foo++;
        var splitcheck = tag.indexOf(splitstrings[foo]);
    }
    while (splitcheck == -1 && foo < 6)
    return tag.split(splitstrings[foo]);
}

//doesn't work
//Create a dynamic menu for a tag
function scast_menu(t,m,n) {
    var tag = t;
    var menu_index = m;
    var menu_name = n;
    fb.trace(tag.toString());
    var times = tag.length;
    var foo = -1;    
    do {
        foo++;
        _child4.AppendMenuItem(MF_STRING,foobar++,"Search for "+tag[foo]+" stations");
    }
    while (foo < times-1)
}

//Menu Commands
function on_mouse_lbtn_down(x, y) {
    var basemenu = window.CreatePopupMenu();
    var ret;

    basemenu.AppendMenuItem(MF_STRING, 50, "Open a custom station...");
    basemenu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    
    var genres = split_tag("genre");
    var times = genres.length;
    var foo = -1;    
    var foobar=52;
    do {
        foo++;
        basemenu.AppendMenuItem(MF_STRING,foobar++,"Search for "+genres[foo]+" stations");
    }
    while (foo < times-1)

    basemenu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    basemenu.AppendMenuItem(MF_STRING, 51, "Most popular stations");

    var ret = basemenu.TrackPopupMenu(x, y);
    if (ret == 0)
        return;
    
    switch (ret)
    {
    case 50:
        var scast_station = text_input_box("Shoutcast Radio","Search for a Shoutcast station","scast")
        var shout = "http://www.shoutcast.com/radio/"+scast_station;
        WshShell.Run(shout);
        break;  
    case 51:  
        var shout = "http://www.shoutcast.com/most-popular-radio-stations";
        WshShell.Run(shout);
        break;
    default:
        var shout = "http://www.shoutcast.com/radio/"+encodeURIComponent(genres[ret - 52]);
        WshShell.Run(shout);
        break;
    }
    basemenu.Dispose();
}


Seems like the way to do it is would be to have on_metadb_changed() call window.Repaint(), and call the function that draws the menu in on_paint(gr), but hell if I can get it working.

Thanks if someone can help, I'll probably bumble my way to victory eventually but this is driving me up the wall.
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-02-18 08:05:56
@unclean:

You must use window.WatchMetadb(IFbMetadbHandle)
See interfaces.txt and the example file Watch Metadb Change (Base).txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-18 09:43:40
it looks like unclean is importing the scripts i uploaded (common.js). this already contains the on_item_focus_change() function which takes care of setting g_metadb.

but this function still needs to be called inside each panel using...

Code: [Select]
function on_playback_new_track() {
    on_item_focus_change();
}

//also need to call it when the script initialises as well
on_item_focus_change();
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2010-02-18 10:56:53
@Harm:
I've add a callback on_char in WSH Panel Mod 1.3.2 Beta 1
You can receive proper char code now:
Code: [Select]
function on_char(code) {
    char_string = String.fromCharCode(code);
}


And don't forget to use window.DlgCode property:
Code: [Select]
// See flags.txt
// DLGC_WANTCHARS will enable on_char() callback
window.DlgCode = DLGC_WANTALLKEYS | DLGC_WANTCHARS;
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-18 11:12:48
If i may request something then i would ask for an enhancement for some of marc2003s scripts and tedgos lyrics script wich are now limited to show info about now playing track. It would be useful if they would respond to the Dui option in preferences -> display to prefer playing track or selection. Does the WSH Panel at all let you grab this option?


no, it's not possible to get that preference.


things change. T.P has released a new version which supports this.
Title: WSH Panel Mod script discussion/help
Post by: unclean on 2010-02-18 22:57:29
Thanks marc, that was a really easy fix.
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-02-19 11:31:18
I updated my FormsAndButtons script: FormsAndButtons v1.2.zip (http://cid-229871a834d2fa56.skydrive.live.com/self.aspx/.Public/FormsAndButtons%20v1.2.zip)

Thanks to T.P Wang it should now work with any keyboard layout.

Overview of available elements:
Code: [Select]
//FORM ELEMENTS

//----------
//General comments:
//
//- If 'x', 'y', 'w', or 'h' depends on the size of the screen this value should be placed between brackets. For example:
//
// FormIButton("ww - 20", 0, 20, 20, skip, imgscr, func);
//
//- One can jump from element to element using the left, right, up and down arrow keys, although if 'skip' is set true the element will be skipped.
//
//- 'font' should be of type IGdiFont
//
//- 'func' should always be a function that if called without argument returns the value to be displayed and that will be called if this value is changed by the form element.
//
//- For single line text elements with a fixed width a tool tip shows the value on mouse over if clipping occurs.
//
//- Elements should be put in the array 'intobject' to work
//
//- These functions should be called in the corresponding callback functions:
// forms_on_size();
// forms_on_paint(gr);
// forms_on_mouse_move(x, y);
// forms_on_mouse_lbtn_up(x, y); //Does call wondows.Repaint()!
// forms_on_key_down(vkey);
// forms_on_char(code);
// forms_on_focus(is_focused); //Does call wondows.Repaint()!
// forms_on_timer(id);


//function FormIButton(x, y, w, h, skip, imgsrc, func)
//----------
//Draws a button using images.
//----------
//Using keyboard:
// Enter: switch button
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//imgsrc:
// array of form {inactive: <<path to image>>, active: <<path to image>>, inactiveon: <<path to image>>, activeon: <<path to image>>}
//func: boolean func(boolean);


//function FormTButton(x, y, w, h, skip, text, font, func)
//----------
//Draws a button using text.
//----------
//Using keyboard:
// Enter: switch button
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//func: boolean func(boolean);
//
//if w is set 0 it will be based on marginx, if h is set 0 it will be based on marginy


//function FormTButtonAlt(x, y, skip, text, font, func)
//----------
//Draws a button which is nothing more than a line of text which can be set or not set.
//----------
//Using keyboard:
// Enter: switch button
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//func: boolean func(boolean);


//function FormTextBox(x, y, w, h, skip, font, func)
//----------
//Draws a text box for editing multiple lines of text.
//----------
//Using keyboard (not in edit mode):
// Enter: enter edit mode
// PgUp: scroll to start
// PgDn: scroll to end
// Left: jump to previous element
// Up: if possible scroll up, otherwise jump to previous element
// Right: jump to next element
// Down: if possible scroll down, otherwise jump to next element
//
//Using keyboard (edit mode):
// Bksp,
// Enter,
// Left,
// Up,
// Right,
// Down,
// Ins,
// Del: like expected in a text editor
// Esc: exit edit mode and send value if changed
// PgUp: cursor to start of text
// PgDn: cursor to end of text
// End: cursor to end of row
// Home: cursor to start of row
// Ctrl-Z: undo change
//
//func: string func(string);


//function FormText(x, y, w, h, skip, font, func)
//----------
//Draws multiple lines of text.
//----------
//Using keyboard:
// PgUp: scroll to start
// PgDn: scroll to end
// Left: jump to previous element
// Up: if possible scroll up, otherwise jump to previous element
// Right: jump to next element
// Down: if possible scroll down, otherwise jump to next element
//
//func: string func();


//function FormTextInput(x, y, w, skip, font, func)
//----------
//Draws single line text input.
//----------
//Using keyboard (not in edit mode):
// Enter: enter edit mode
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//Using keyboard (edit mode):
// Bksp,
// Left,
// Right,
// Ins,
// Del: like expected in a text editor
// Enter: exit edit mode and send value if changed
// Esc: exit edit mode and send value if changed
// End: cursor to end of row
// Home: cursor to start of row
// Ctrl-Z: undo change
//
//func: string func(string);


//function FormTextLine(x, y, w, skip, font, func)
//----------
//Draws single line of text.
//----------
//Using keyboard:
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//func: string func();


//function FormMVTextInput(x, y, w, skip, font, func)
//----------
//Draws single line text input to edit an array of values.
//----------
//Using keyboard (not in edit mode):
// Enter: enter edit mode
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//Using keyboard (edit mode):
// Bksp,
// Left,
// Right,
// Ins,
// Del: like expected in a text editor
// Enter: exit edit mode and send value if changed
// Esc: exit edit mode and send value if changed
// End: cursor to end of row
// Home: cursor to start of row
// Ctrl-Z: undo change
//
//func: array func(array);


//function FormMVSTextInput(x, y, w, skip, font, func)
//----------
//Draws single line text input to edit an array of values in which the odd ones are the main values and the even ones the separators.
//----------
//Using keyboard (not in edit mode):
// Enter: enter edit mode
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//Using keyboard (edit mode):
// Bksp,
// Left,
// Right,
// Ins,
// Del: like expected in a text editor
// Enter: exit edit mode and send value if changed
// Esc: exit edit mode and send value if changed
// End: cursor to end of row
// Home: cursor to start of row
// Ctrl-Z: undo change
//
//func: array func(array); where this array contains the values as odd elements and the separators as even elements


//function FormMVTextLine(x, y, w, skip, font, func)
//----------
//Draws single line showing the content of an array of values.
//----------
//Using keyboard:
// Left: jump to previous element
// Up: jump to previous element
// Right: jump to next element
// Down: jump to next element
//
//func: array func(); where this array contains the values as odd elements and the separators as even elements


//function FormKeyWords(x, y, w, skip, font, list, func)
//----------
//Draws single line showing the content of an array of key words and add new ones from a drown-down list.
//----------
//Using keyboard:
// Enter: execute selected button
// End: jump to last value
// Home: jump to first value
// Left: if possible jump to previous button, otherwise jump to previous element
// Ctrl-left:
// move selected value to the left
// Up: jump to previous element
// Right: if possible jump to next butten, otherwise jump to next element
// Ctrl-right:
// move selected value to the right
// Down: jump to next element
// Ins: insert value after selected value
// Del: remove selected value
//
//func: array func(array);
//list: array of possible values


//function FormKeyWordsH(x, y, skip, font, list, func)
//----------
//Draws single line showing a list of key words which can be set or not set.
//----------
//Using keyboard:
// Enter: add or remove selected value
// End: jump to last value
// Home: jump to first value
// Left: if possible select previous value, otherwise jump to previous element
// Up: jump to previous element
// Right: if possible select next value, otherwise jump to next element
// Down: jump to next element
//
//func: array func(array);
//list: array of possible values


//function FormKeyWordsHS(x, y, skip, font, list, func)
//----------
//Draws single line showing a list of key words of which only one can be set.
//----------
//Using keyboard:
// Enter: set or remove selected value
// End: jump to last value
// Home: jump to first value
// Left: if possible select previous value, otherwise jump to previous element
// Up: jump to previous element
// Right: if possible select next value, otherwise jump to next element
// Down: jump to next element
//
//func: string func(string);
//list: array of possible values


//function FormRating(x, y, skip, font, max, func)
//----------
//Draws line of stars to edit rating.
//----------
//Using keyboard:
// Enter: set selected rating or if this rating is set, set rating to 0
// End: jump to maximum
// Home: jump to 1
// Left: if possible select previous rating, otherwise jump to previous element
// Up: jump to previous element
// Right: if possible select next rating, otherwise jump to next element
// Down: jump to next element
//
//func: int func(int);
//max: maximum rating


//function FormDrawString(x, y, font, colour, str)
//----------
//Draws string.

Change log:

v1.2:
- Bugs fixed
- Added blinking cursor
- Solved issue with calling window.Repaint() in on_size
- Now works on all keyboard layouts
- Solved issue with enter key
- No need to include KeyboardHandling.js anymore
- Added forms_on_timer(id) to be called in on_timer(id)
- Added forms_on_char(code) to be called in on_char(code)
- Improved documentation
- Requires wsh panel mod v1.3.2

v1.1:
- Bugs fixed
- Added tag editing example
Title: WSH Panel Mod script discussion/help
Post by: acmodeu on 2010-02-20 10:26:09
I don't find any of these in the archive.
Quote
// @import "%fb2k_path%scripts\Flags.txt"
// @import "%fb2k_path%scripts\Helpers.txt"
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-02-20 12:35:59
I don't find any of these in the archive.
Quote
// @import "%fb2k_path%scriptsFlags.txt"
// @import "%fb2k_path%scriptsHelpers.txt"



These are in the docs directory of the zip file, so you have to copy them to the scripts directory.

That is: of the wsh panel mod zip file - it is part of the documentation
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-21 12:36:42
i've updated my samples - http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a bug fix for the artwork panel. it also has a new feature to double click the panel in "foobar artreader" mode and it will open the image in your default image viewer. (the lastfm/cycle folder modes already had this feature).

also contains a new "now playing" artwork panel. it looks like this.....

http://public.blu.livefilestore.com/y1py0e...ad%20200210.png (http://public.blu.livefilestore.com/y1py0euzN8nsGejHcHE15HuKXBYV7qDwAvGpTUV5TuFt9dvfbxB7A_dImGQnU0GclLOXlFGvVBvJlsp4PpE9KEI8g/dui%20appearance%20thread%20200210.png)

(credit really must go ojdo for the idea. his original panel can be found here (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77413&view=findpost&p=688718).)

it uses last.fm to download artist art for the background. you have to use the context menu to trigger the download manually. it can download either 1,3,5 or 10 images. optionally it can cycle through the images at set intervals. you can also use the mouse wheel to scroll. (it's the same code from the "last.fm" mode of my previous artwork panel so if anybody has a cache of artwork built up already, it will use that).

it then uses the built in foobar artreader to display the album cover.

readme included in the download.
Title: WSH Panel Mod script discussion/help
Post by: dalover on 2010-02-21 13:52:00
i've updated my samples - http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a bug fix for the artwork panel. it also has a new feature to double click the panel in "foobar artreader" mode and it will open the image in your default image viewer. (the lastfm/cycle folder modes already had this feature).

also contains a new "now playing" artwork panel. it looks like this.....

...

readme included in the download.


Your "now playing" Panel looks really nice 

For my personel needs i've changed the size of the embeded cover and also of the fonts. Some properties may be useful ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-21 14:29:35
new version uploaded. (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a few variables at the top of the script. i can't be bothered to build a menu to set these values.

Title: WSH Panel Mod script discussion/help
Post by: dalover on 2010-02-21 14:52:33
For me it's all i need

thanx
Title: WSH Panel Mod script discussion/help
Post by: Chaser on 2010-02-21 15:27:47
This is very impressive and I just tried it on my setup and it is working smoothly. I did not (yet) dig deep and just ask: Is it possible to have the ArtistArt automatically downloaded if none is present?

edit:
Ok  -  I succesfully hacked it in myself by changing the function "on_playback_new_track()" to:
Code: [Select]
function on_playback_new_track() {
    image_set = null;
    on_item_focus_change();
    
            WshShell.Run("\"" + script_path + "art.exe\" \""  + artist + "\" \"" + folder + "\" " + limit, 0, true);
            image_set = null;
            on_metadb_changed();
}


I have no clue if this is forbidden/disrecommended. It works.. :-)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-21 16:57:44
shouldn't be a problem. just one minor change i'd make...

Code: [Select]
function on_playback_new_track() {
    image_set = null;
    on_item_focus_change();
    //arr is an array that contains all the images. only try if there are no images.
    if(arr.length == 0) {
            WshShell.Run("\"" + script_path + "art.exe\" \""  + artist + "\" \"" + folder + "\" " + limit, 0, true);
            image_set = null;
            on_metadb_changed();
    }
}
Title: WSH Panel Mod script discussion/help
Post by: Chaser on 2010-02-21 17:57:01
That's exactly what I was thinking about. Thank you for implementing it right away. Before I had no muse to look for a nice way to achieve this. Is this jScript or VBScript you are writing?

Another thing I might play around with is that albumart is resized according to the width of the WSH-Panel. In my case the panel is rather narrow and thus hardly nothing of the title is displayed. I resolved this for now by making the albumart smaller, though a more elegant way would be to resize the albumart with both an upper and a lower border.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-21 18:15:09
mess about with the on_size function (edit the one that already exists in the script)

Code: [Select]
function on_size() {
    ww = window.width;
    wh = window.height;
    //new line of code....
    album_img_size = ww * 0.25;
}


or you might want to try a fixed size of 90. that makes it fit nicely inside the "text" box.

i'll look at tidying up the art.exe bits of code. what i posted was just a quick fix to prevent un-necessary queries to last.fm.
Title: WSH Panel Mod script discussion/help
Post by: Chaser on 2010-02-21 19:07:31
Oh well - did not see your answer. This is what I came up with:

This goes into the user settings: (remove the var album_img_size there)
Code: [Select]
var album_img_size_percent = 25;
var album_img_size_min = 90;
var album_img_size_max = 280;


This goes in "on_paint":
Quote
if(album_img) {
        var album_img_size = album_img_size_percent * ww / 100;
        if (album_img_size > album_img_size_max ) album_img_size = album_img_size_max;
        if (album_img_size < album_img_size_min ) album_img_size = album_img_size_min;


   text_x = album_img_size + 40;


Fun playing around :-)

edit:
Wouldn't it be beautiful to set up a svn on google code? I guess I would have fun playing around a little.
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-22 08:49:46
mar2003 wouldn't it be more suitable to save the xml files in the format lastfmfolder<mbid>.xml with a fallback of saving as <artist>.xml if mbid doesn't exist. This would be suitable when bands or artists have the same name as mbid is unique but it needs to be read from the xml first.

PS: AFAIK mbid exists for an overwhelming majority of artists.

Does anyone know how to justify text in a panel?
Title: WSH Panel Mod script discussion/help
Post by: gurubhai on 2010-02-22 09:36:05
new version uploaded. (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a few variables at the top of the script. i can't be bothered to build a menu to set these values.

Hi, I am using this & it works quite well.
I have one issue, however.
Many songs in my library are duets/sung by multiple artists & I use the standard foobar ; to separate them.
The script is not able to either download or display the artist image for these songs.
I used to use the following code to cycle the images of different artists in a wsh mod script :
Code: [Select]
G:\music\art\artist\$meta(artist,0).*||G:\music\art\artist\$meta(artist,1).*||G:\music\art\artist\$meta(artist,2).*||G:\music\art\artist\$meta(artist,0)_01.*||G:\music\art\artist\$meta(artist,1)_01.*||G:\music\art\artist\$meta(artist,2)_01.*||G:\music\art\artist\$meta(artist,0)_02.*||G:\music\art\artist\$meta(artist,1)_02.*||G:\music\art\artist\$meta(artist,2)_02.*

Can it be done in your script ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-22 11:18:03
Quote from: icedtea link=msg=689502 date=
mar2003 wouldn't it be more suitable to save the xml files in the format lastfmfolder\<mbid>.xml with a fallback of saving as <artist>.xml if mbid doesn't exist. This would be suitable when bands or artists have the same name as mbid is unique but it needs to be read from the xml first.

PS: AFAIK mbid exists for an overwhelming majority of artists.


what xml files are you talking about now? my biography panel? i save them in a folder named after $crc32(%artist%). this means i don't have to worry about filename validation / illegal characters in tags. i'm not using MBID because that would require that i have every single file in my library tagged with correct musicbrainz info. if that's the way your library is set up, feel free to make your own modifications.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-22 11:50:36
@gurubhai, i haven't tested this but you can try replacing this....
Code: [Select]
    var jpg = utils.Glob(folder + "\\*.jpg").toArray();
    var png = utils.Glob(folder + "\\*.png").toArray();
    var gif = utils.Glob(folder + "\\*.gif").toArray();
    arr = jpg.concat(png, gif);


with

Code: [Select]
    var jpg = utils.Glob(folder + "\\*.jpg").toArray();
    var png = utils.Glob(folder + "\\*.png").toArray();
    var gif = utils.Glob(folder + "\\*.gif").toArray();
    var artist0 = utils.Glob("G:\\music\\art\\artist\\" + fb.TitleFormat("$meta(artist,0)*.*").EvalWithMetadb(g_metadb)).toArray();
    var artist1 = utils.Glob("G:\\music\\art\\artist\\" + fb.TitleFormat("$meta(artist,1)*.*").EvalWithMetadb(g_metadb)).toArray();
    var artist2 = utils.Glob("G:\\music\\art\\artist\\" + fb.TitleFormat("$meta(artist,2)*.*").EvalWithMetadb(g_metadb)).toArray();
    arr = jpg.concat(png, gif, artist0, artist1, artist2);
Title: WSH Panel Mod script discussion/help
Post by: gurubhai on 2010-02-22 12:30:36
thanks marc2003 , It works provided I don't use the wild card but for some reason it is also checking on the text files lying in the folder (its actually my biography plugin folder)
so basically it shows first artist picture then blank and then artist2 & so on.
how do I solve this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-22 12:32:46
well i put *.* because i wrongly assumed that all your files in a folder named "art" would be image files. just change it to *.jpg
Title: WSH Panel Mod script discussion/help
Post by: gurubhai on 2010-02-22 12:43:32
Sorry,I should have spotted that. this works fine.

However, this way I have to keep two sources, one from your script & other being my current art folder.
I would like to switch exclusively to your script if possible.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-22 16:18:13
you could modify the script yourself to fetch the artwork for multiple artists. or you could use field remapping with $meta_sep.

http://wiki.hydrogenaudio.org/index.php?ti...28name.2Csep.29 (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference#.24meta_sep.28name.2Csep.29)
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-22 17:47:06
marc2003 do you remember the url from which you got the web links button?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-22 18:42:24
i didn't keep a link but i've just spent a few minutes googling and i can't find it again. 

edit: found them....

http://www.freeiconsweb.com/Social-Network-Icon-Pack.html (http://www.freeiconsweb.com/Social-Network-Icon-Pack.html)
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-23 10:45:03
Does anyone know how to get the text width using GdiDrawText() in pixels for a given font and font size?
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-24 06:02:24
Can anyone help me change applyDelta() in Scroll with GdiDrawText.txt to implement a "floor" so that when offset = 0 you can't drag the text down as there is no text on top. Every method I try ends up cutting some text from the bottom
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-24 07:58:03
Scratch my last question, I chose to work around that.  New question:  Is there a way to specify where the popup menu appears?  Using the command provided in the samples, it always appears wherever the mouse cursor is.  However, I'm making a "toolbar-like" panel, and it would look a lot better if the popups appeared directly under the command, rather than where the cursor is.  Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-24 10:13:03
i'm guessing you have this in your menu?

Code: [Select]
idx = _menu.TrackPopupMenu(x, y);


simply replace x and y with the x co-ordinate and height of your object that is being clicked.

@icedtea, this is the formula i use to work out the height of my text. it's not perfect but it's close enough.

Code: [Select]
String.prototype.count=function(s1) { 
    return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}
textheight = arr[3] - arr[1] + wh  + (g_text.count("\n") * 3);
offset = 0;
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-24 10:37:14
i'm guessing you have this in your menu?

Code: [Select]
idx = _menu.TrackPopupMenu(x, y);


simply replace x and y with the x co-ordinate and height of your object that is being clicked.


Thanks!
Title: WSH Panel Mod script discussion/help
Post by: dalover on 2010-02-24 11:57:20
Some minor changes (quick and dirty )  i've made at marc2003s "now playing"-script

for multple artists i use
Code: [Select]
    folder = data_folder + fb.TitleFormat("$crc32($meta(artist,0))").EvalWithMetadb(g_metadb);
    var jpg = utils.Glob(folder + "\\*.jpg").toArray();
    var png = utils.Glob(folder + "\\*.png").toArray();
    var gif = utils.Glob(folder + "\\*.gif").toArray();
    
    var folder1= data_folder + fb.TitleFormat("$crc32($meta(artist,1))").EvalWithMetadb(g_metadb);
    var folder2= data_folder + fb.TitleFormat("$crc32($meta(artist,2))").EvalWithMetadb(g_metadb);  
    var artist1 = utils.Glob(folder1 + "\\*.jpg").toArray();
    var artist2 = utils.Glob(folder2 + "\\*.jpg").toArray();

    arr = jpg.concat(png, gif, artist1, artist2);


and in the scale-function to show the upper part of an portrait picture in an landscape panel
Code: [Select]
function scale(gr, img, pos_x, pos_y, width, height, mth) {
    var s = mth == "max" ? Math.max(width / img.width, height / img.height) : Math.min(width / img.width, height / img.height);
    var nw = img.width * s;
    var nh = img.height * s;
    pos_x += ((width - nw) / 2);
    pos_y += ((mth == "max") && (img.width < img.height)) ? 0 : ((height - nh) / 2);
    // pos_y += ((height - nh) / 2);
    gr.DrawImage(img, pos_x, pos_y, nw, nh, 0, 0, img.width, img.height);
}


it could surely done better, but maybe it's useful for some. I haven't found a good multi-language & multi-artist solution for the bio-panel.

greetz dalover
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-24 12:56:44
you can change the language for the biography panel (line 25)

Code: [Select]
lastfm("&lang=XX&method=artist.getinfo&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_bio", function() {save_file();});


Quote
lang (Optional) : The language to return the biography in, expressed as an ISO 639 alpha-2 code.


Title: WSH Panel Mod script discussion/help
Post by: dalover on 2010-02-24 13:18:06
you can change the language for the biography panel (line 25)

Code: [Select]
lastfm("&lang=XX&method=artist.getinfo&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_bio", function() {save_file();});


Quote
lang (Optional) : The language to return the biography in, expressed as an ISO 639 alpha-2 code.



i know - that's my solution with a language variable
Code: [Select]
function get_bio_lang() {
    switch(biolang) {
        case 1:
            lastfm("&lang=de&method=artist.getinfo&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_bio", function() {save_file();});
            break;
        case 2:
            lastfm("&lang=jp&&method=artist.getinfo&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_bio", function() {save_file();});
            break;
         case 0:
        default:
            lastfm("&method=artist.getinfo&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_bio", function() {save_file();});
    }  
}


it's a non automatic solution. i change the biolang-var in the update part
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-25 05:07:42
@icedtea, this is the formula i use to work out the height of my text. it's not perfect but it's close enough.

Code: [Select]
String.prototype.count=function(s1) { 
    return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}
textheight = arr[3] - arr[1] + wh  + (g_text.count("\n") * 3);
offset = 0;

marc2003 what are you using for applyDelta?

I am using this from Hitchhiker427 but the panel's text gets frozen occasionally i.e. does not drag
Code: [Select]
function applyDelta(delta) {
var temp = offset + delta;
if (offset > 0 || (offset == 0 && delta > 0) || textheight < wh) {
offset = 0;
} else if (offset > -delta) {
offset = 0;
window.Repaint();
} else if (offset > -textheight + wh) {
offset = temp;
window.Repaint();
} else if (delta > 0) {
offset = temp;
window.Repaint();
}
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-02-25 05:32:40
i haven't bothered with drag support - it uses the mouse wheel only. i'm using the font height as a measurement unit so the text always lines up at the top of the panel.

Code: [Select]
function on_mouse_wheel(delta) {
    step = g_font.height * 5;
    offset += (delta * step);
    if(offset > 0 || textheight < wh) {
        offset = 0;
    } else {
        temp = -textheight + wh;
        if(offset < temp) offset = Math.round(temp / step) * step;
    }
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-25 06:49:26
marc2003 another thing I needed your help with
I am using your bio panel with some modifications. I was trying to switch between artist summary and details using
Code: [Select]
    if (idx == 1) {
        cont = 'summary';
        artist='';
        on_metadb_changed();
        }
    if (idx == 2) {
        cont = 'content';
        artist='';
        on_metadb_changed();
        }

and passing cont to the metadb function. This works ok but where I am failing is getting the selection to stick between sessions using window.SetProperty(); and then using window.GetProperty() to set MF_CHECKED/MF_UNCHECKED for the option.

Thanks
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-02-25 07:04:00
@icedtea,

You mentioned that you were using a script from me for scrolling.  Is that the same bio script I sent you a while ago?  If so, I've fixed a number of bugs (some to do with scrolling) and added a few features.  I haven't noticed any scrolling issues in my latest version.  Do you want me to send you what I have?  Maybe you can dissect it and figure out a solution to the problem.
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-25 07:27:16
@icedtea,

You mentioned that you were using a script from me for scrolling.  Is that the same bio script I sent you a while ago?  If so, I've fixed a number of bugs (some to do with scrolling) and added a few features.  I haven't noticed any scrolling issues in my latest version.  Do you want me to send you what I have?  Maybe you can dissect it and figure out a solution to the problem.

I would really appreciate that.
Thanks
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-02-25 08:02:15
marc2003 please ignore the previous message I made it work by using
Code: [Select]
bio_text = xmlDoc.getElementsByTagName(window.GetProperty("mode") ? "summary" : "content")[0].childNodes[0].nodeValue;
...
_menu.AppendMenuItem(window.GetProperty("mode") ? MF_CHECKED : MF_UNCHECKED, 1, "Summary");
_menu.AppendMenuItem(window.GetProperty("mode") ? MF_UNCHECKED : MF_CHECKED, 2, "Details");
...
if (idx == 1) {
 window.SetProperty("mode", 1);
 artist = '';
 need_calc = true;
 on_metadb_changed();
}
if (idx == 2) {
 window.SetProperty("mode", 0);
 artist = '';
 need_calc = true;
 on_metadb_changed();
}

Just wanted to check if there is a more optimum way
Thanks
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-03-04 00:17:00
@marc2003

I'm trying to change the fonts and background from your excellent biography panel

this is what i have so far

Code: [Select]
function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    if(username.length == 0 || api_key.length != 32) {
        gr.GdiDrawText("Last.fm username and/or API KEY is not set.", g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX);
    } else if(g_metadb) {
        gr.GdiDrawText(g_text, g_font, g_textcolor, 6, offset + 65, ww-16, wh-offset,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
        gr.FillSolidRect(0, 0, ww, 56, g_backcolor);
        gr.GdiDrawText(artist, gdi.Font("Calibri", 26, 1), g_textcolor_hl, 6, 5, ww-77, 32,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(addCommas(listeners) + " listeners,  " + addCommas(userplaycount) + " plays in your library.", gdi.Font("Calibri", 22, 0), g_textcolor_hl, 6, 33, ww-16, 28,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.DrawImage(lfm_img, ww-60, 8, 50, 18, 0, 0, 50, 18);
        gr.DrawLine(5, 35, ww-10, 35, 1, g_textcolor_hl);
    } else {
        gr.GdiDrawText("[no selection]", g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX);
    }
}


now i want to change the background color to black, all fonts to some kind of light grey and the size of the biography text font to let's say 18 or 20.
Help would be much appreciated.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-04 00:25:49
just put these 4 variables anywhere in the script (not inside any function).

Code: [Select]
g_backcolor = RGB(0,0,0);
g_textcolor = RGB(180,180,180);
g_textcolor_hl = RGB(200,200,200);
g_font = gdi.Font("Segoe UI", 20, 0);


obviously you can play around with the colours yourself.
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-03-04 00:31:54
thank you.
Works perfectly!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-04 00:41:26
just one thing - the panel will change colour if you change the text/background colours in the DUI/CUI settings. you'll have to reload the script to get your colours back. shouldn't be much of an issue but i thought i'd mention it.

EDIT: i suppose you could move those variables inside on_paint right at the start. then you won't have any problems. i should have just said this in the first place.
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-03-04 12:12:20
Thx 

only one more question:

where are those icons for youtube, myspace, lastfm from?
It would be great if it were a button set because I need a google, wikipedia, discogs and a
rate your music button which fit your buttons and to combine them to a nice web toolbar
in my foobar htpc mod.

If you made them yourself then I have to say good work! if not please tell me where
you downloaded them...

edit: nevermind...found them on top of this page 
Title: WSH Panel Mod script discussion/help
Post by: YTMY on 2010-03-04 12:24:41
Hi everybody. As I'm totally new at scripting I have a simple question - where and what should I add/change to the seekbar script to get "Stopped" displayed in the middle of the seekbar when no song is playing? Currently of course it is not displaying anything 

I compiled this code from different sources out here. 

Code: [Select]
function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}

text_colour = RGB(50,50,50);
background_colour = RGB(240,240,240);

/*you can set 2 colours here for a gradient effect on the seekbar. this sample replicates the aero blue found in windows 7.
if you want a solid colour, set

bar_colour_2 = "none";

(then only bar_colour_1 will be used)*/

bar_colour_1 = RGB(240,240,240);
bar_colour_2 = RGB(190,190,190);

/////////////////////////end user settings//////////////////////////////////////////////////////////////////////////////////////////////////////

var g_font = gdi.Font("Segoe UI", 12, 1);
var g_drag = 0;
var g_drag_seek = 0;
var g_timer, txt;

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, background_colour);
if(fb.IsPlaying) {
if(fb.PlaybackLength > 0) {
if(g_drag){
t = fb.PlaybackLength * g_drag_seek;
h = Math.floor(t/3600)
m = Math.floor((t-=h*3600)/60);
s = Math.floor(t-=m*60);
pos = ww * g_drag_seek;
txt = (h > 0 ? h + ":" + (m <10 ? "0" + m : m) : m) + ":" + (s < 10 ? "0" + s : s) + " / " + length;
} else {
pos = ww * (fb.PlaybackTime / fb.PlaybackLength);
txt = fb.IsPaused ? "Paused" : fb.titleformat("Playing | %codec% | %bitrate% kbps | %samplerate% Hz | $caps(%channels%) | %playback_time%").Eval() + " / " + length;
}
if(bar_colour_2 == "none") {
gr.FillSolidRect(0, 0, pos, wh, bar_colour_1);
} else {
gr.FillGradRect(0, 0, pos, wh, 90, bar_colour_1,bar_colour_2);
}
} else if(fb.PlaybackTime > 0.1) {
txt = fb.IsPaused ? "Paused" : fb.titleformat("Playing | %codec% | %bitrate% kbps | %samplerate% Hz | $caps(%channels%) | %playback_time%").Eval() + " / LIVE";
}

        gr.SetTextRenderingHint(5);
gr.DrawString(txt, g_font, text_colour, 0, 0, ww, wh,0x11005000);
}

if(window.InstanceType == 1) gr.DrawRect(0,0, ww, wh, 1.0, RGB(137,140,149));
}

function on_mouse_lbtn_down(x,y){
if(fb.IsPlaying && fb.PlaybackLength > 0) g_drag = 1;
}

function on_mouse_lbtn_up(x,y){
if(g_drag) {
g_drag = 0;
g_drag_seek = x < 0 ? 0 : x > ww ? 1 : x / ww;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
}

function on_mouse_mbtn_down(x,y){
    if(fb.IsPlaying && fb.PlaybackTime > 0) fb.RunMainMenuCommand("View/Columns playlist/Activate now playing");
}

function on_mouse_move(x,y){
if(y > wh) g_drag = 0;
if(g_drag) {
g_drag_seek = x < 0 ? 0 : x > ww ? 1 : x / ww;
window.Repaint();
}
}

function on_playback_new_track() {
length = fb.TitleFormat("%length%").Eval();
g_timer = window.CreateTimerInterval(100);
}

function on_playback_stop() {
if(g_timer) window.KillTimer(g_timer);
    window.Repaint();
    CollectGarbage();
    }

function on_playback_seek(time){
window.Repaint();
}

function on_timer(id){
window.Repaint();
}

function on_mouse_wheel(delta) {
fb.PlaybackTime = fb.PlaybackTime + 5*delta;
}

if(fb.isplaying) on_playback_new_track();
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-05 02:50:12
replace your on_paint function with this...

Code: [Select]
function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, background_colour);
    if(fb.IsPlaying) {
        if(fb.PlaybackLength > 0) {
            if(g_drag){
                t = fb.PlaybackLength * g_drag_seek;
                h = Math.floor(t/3600)
                m = Math.floor((t-=h*3600)/60);
                s = Math.floor(t-=m*60);
                pos = ww * g_drag_seek;
                txt = (h > 0 ? h + ":" + (m <10 ? "0" + m : m) : m) + ":" + (s < 10 ? "0" + s : s) + " / " + length;
            } else {
                pos = ww * (fb.PlaybackTime / fb.PlaybackLength);
                txt = fb.IsPaused ? "Paused" : fb.titleformat("Playing | %codec% | %bitrate% kbps | %samplerate% Hz | $caps(%channels%) | %playback_time%").Eval() + " / " + length;
            }
            if(bar_colour_2 == "none") {
                gr.FillSolidRect(0, 0, pos, wh, bar_colour_1);
            } else {
                gr.FillGradRect(0, 0, pos, wh, 90, bar_colour_1,bar_colour_2);
            }
        } else if(fb.PlaybackTime > 0.1) {
                txt = fb.IsPaused ? "Paused" : fb.titleformat("Playing | %codec% | %bitrate% kbps | %samplerate% Hz | $caps(%channels%) | %playback_time%").Eval() + " / LIVE";
        }
    } else {
        txt = "Stopped";
    }   
    gr.SetTextRenderingHint(5);
    gr.DrawString(txt, g_font, text_colour, 0, 0, ww, wh,0x11005000);
}
Title: WSH Panel Mod script discussion/help
Post by: YTMY on 2010-03-05 07:27:31
thank you very much Marc! I was adding the same "else" code, but my mistake was that i was adding it at the very end of on_paint(gr) function 

a real noob
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-03-05 13:12:38
Hi,

I'm trying to get an action when I roll over an image.
Can someone show some basic stuff on this?

Cheers
Title: WSH Panel Mod script discussion/help
Post by: Benji99 on 2010-03-05 15:47:33
Hey guys, I'm thinking of writing a script to grab stuff from allmusic.com (biography, work info, etc...)
Since I've never written any VBScript or JScript, did anyone write a sample or script that I could be useful?
For example how to load an html page, parse, etc...

Thanks in advance!
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-03-05 21:11:26
@ marc2003

Code: [Select]
}

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)/_/$replace(%title%, ,+,/,'%'252F)").EvalWithMetadb(g_metadb);
    var youtube = fb.TitleFormat("http://www.youtube.com/results?search_query=$replace(%artist%+%title%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
    var google = fb.Titleformat ("http://www.google.com/search?q=$replace(%artist%+%album%, ,+)&ie=utf-8").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*3),top_margin,bw,bh, {normal: images_path + "google.png", hover: images_path + "google_32.png"}, function(){WshShell.run(google);},google)

    }


If I understand correctly:
The first part is for definition of the variables or rather search strings. In my case i added google.
The second part is for placing the buttons. (bw*3 goes 32 pixels to the right,) right?
The only thing I can think of is that my search string is wrong..... 
I've borrowed that string from run services...
I'm really trying to figure this out now, so any help and explanation is greatly appreciated...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-05 21:41:08
you need to add a comma at the end of the line of code that begins with "but3".
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-03-05 21:48:23
 thank you very much.
Title: WSH Panel Mod script discussion/help
Post by: allerlei on 2010-03-06 21:53:10
Hi there,

I'm using Marc's code to retrieve the biographie of the current artist by last.fm.
Is there any chance to get this biographie in another language as the standard code does (English)?

I do not see any paramter for this within the script at all.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-06 21:57:57
http://www.hydrogenaudio.org/forums/index....st&p=689990 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=689990)
Title: WSH Panel Mod script discussion/help
Post by: allerlei on 2010-03-06 23:10:54
Great - thanks a lot!
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-03-08 11:37:58
I must say I don't know a thing about scripting, though I managed to learn to decipher some portions. Still, I have a question: in marc2003's "Now Playing" panel is there any way to make it use artist pics stored in a folder on my hdd?

Here's the script:
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\marc2003\v2\common.js"
// ==/PREPROCESSOR==


var title_tf =  fb.TitleFormat("%title%");
var album_tf = fb.TitleFormat("$if2(%album%,)");
var artist_tf = fb.TitleFormat("%artist%");
var g_font_title = gdi.Font("Agency FB", 34, 0);
var g_font_album = gdi.Font("Agency FB", 20, 0);
var g_font_artist = gdi.Font("Agency FB", 24, 0);

var album_img = null;
var artist_img = null;

var cycle = window.GetProperty("cycle", 200) - 200;
var limit = window.GetProperty("limit", 305) - 300;
var album_img_size = window.GetProperty("album_img_size", 490) - 400;

if(fb.IsPlaying) on_playback_new_track();

function on_playback_time(time) {
if(cycle > 0 && arr.length > 1 && (time % cycle == 0)) on_mouse_wheel(1);
}

function on_playback_stop(reason) {
if(album_img) album_img.Dispose();
if(artist_img) artist_img.Dispose();
g_metadb = album_img = artist_img = null;
if(reason != 2) window.Repaint();
}

function  on_playback_new_track() {
g_metadb = fb.GetNowPlaying();
artist = artist_tf.EvalWithMetadb(g_metadb);
title = title_tf.EvalWithMetadb(g_metadb);
album = album_tf.EvalWithMetadb(g_metadb);
if(album_img) album_img.Dispose();
album_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
if(album_img) {
window.Repaint();
} else {
utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
}
folder = data_folder + fb.TitleFormat("$crc32(%artist%)").EvalWithMetadb(g_metadb);
var jpg = utils.Glob(folder + "\\*.jpg").toArray();
var png = utils.Glob(folder + "\\*.png").toArray();
var gif = utils.Glob(folder + "\\*.gif").toArray();
arr = jpg.concat(png, gif);
index = Math.floor(Math.random()*arr.length)
load_image();
}

function on_mouse_wheel(delta) {
if(arr.length < 2) return;
index += delta;
if(index < 0) index = arr.length-1;
if(index == arr.length) index = 0;
load_image();
}

function load_image() {
if(artist_img) artist_img.Dispose();
artist_image_path = arr[index];
artist_img = gdi.Image(artist_image_path);
window.Repaint();
}

function on_mouse_lbtn_dblclk() {
try {WshShell.Run("\"" + artist_image_path + "\""); } catch(e) {}
}

function on_get_album_art_done(metadb, art_id, im, ip) {
album_img = im;
window.Repaint();
}

function on_size() {
ww = window.width;
wh = window.height;
}

function scale(gr, img, pos_x, pos_y, width, height, mth) {
var s = mth == "max" ? Math.max(width / img.width, height / img.height) : Math.min(width / img.width, height / img.height);
var nw = img.width * s;
var nh = img.height * s;
pos_x += ((width - nw) / 2);
pos_y += ((height - nh) / 2);
gr.DrawImage(img, pos_x, pos_y, nw, nh, 0, 0, img.width, img.height);
}

function on_paint(gr) {
if(artist_img) {
gr.FillSolidRect( 0, 0,ww, wh, RGBA(0,0,0,200));
scale(gr, artist_img, 0, 0, ww, wh, "min")
} else {
gr.FillSolidRect( 0, 0,ww, wh, RGB(240,240,240));
}
gr.FillSolidRect(20,wh-130,ww - 40,110,RGBA(90,90,90,175));
if(album_img) {
text_x = album_img_size + 25;
scale(gr, album_img, 10, wh-10-album_img_size, album_img_size, album_img_size, "min");
} else {
text_x = 30;
}
if(fb.IsPlaying) {
gr.GdiDrawText(title, g_font_title, RGB(255,255,255), text_x, wh-130, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(album, g_font_album, RGB(255,255,255), text_x, wh-80, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(artist, g_font_artist, RGB(255,255,255), text_x, wh-55, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
}
}


function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var _cycle = window.CreatePopupMenu();
var _limit = window.CreatePopupMenu();
var _album = window.CreatePopupMenu();
var idx;
_cycle.AppendMenuItem(MF_STRING, 200, "Off");
_cycle.AppendMenuItem(MF_STRING, 205, "5 seconds");
_cycle.AppendMenuItem(MF_STRING, 210, "10 seconds");
_cycle.AppendMenuItem(MF_STRING, 220, "20 seconds");
_cycle.CheckMenuRadioItem(200, 220, window.GetProperty("cycle"));
_limit.AppendMenuItem(MF_STRING, 301, "1");
_limit.AppendMenuItem(MF_STRING, 303, "3");
_limit.AppendMenuItem(MF_STRING, 305, "5");
_limit.AppendMenuItem(MF_STRING, 310, "10");
_limit.CheckMenuRadioItem(301, 310, window.GetProperty("limit"));
_album.AppendMenuItem(MF_STRING, 490, "Small");
_album.AppendMenuItem(MF_STRING, 600, "Large");
_album.CheckMenuRadioItem(490, 600, window.GetProperty("album_img_size"));
_menu.AppendMenuItem(g_metadb ? MF_STRING : MF_GRAYED, 11, "Download artist art from Last.fm");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _limit.ID, "Limit");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(artist_img? MF_STRING : MF_GRAYED, 12, "Open containing folder");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _cycle.ID, "Cycle");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _album.ID, "Cover image size");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
//_menu.AppendMenuItem(MF_STRING, 99, "Properties");
_menu.AppendMenuItem(MF_STRING, 100, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
case 200:
case 205:
case 210:
case 220:
window.SetProperty("cycle", idx);
cycle = idx - 200;
break;
case 301:
case 303:
case 305:
case 310:
window.SetProperty("limit", idx);
limit = idx - 300;
break;
case 490:
case 600:
window.SetProperty("album_img_size", idx);
album_img_size = idx - 400;
window.Repaint();
break;
case 11:
WshShell.Run("\"" + script_path + "art.exe\" \""  + artist + "\" \"" + folder + "\" " + limit, 0, true);
on_playback_new_track();
break;
case 12:
WshShell.Run("explorer /select," + artist_image_path);
break;
case 99:
window.ShowProperties();
break;
case 100:
window.ShowConfigure();
break;
}
_menu.Dispose();
_cycle.Dispose();
_limit.Dispose();
_album.Dispose();
return true;
}

function RGBA(r, g, b, a) { return ((a << 24) | (r << 16) | (g << 8) | (b)); }


Edit: and another one: using marc2003's "Playback Buttons", how would I go about adding other buttons (mainly 'media library search' and 'playback statistics/rate/5')? I need the "function(){fb.XXX()" bit.
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-03-08 14:23:53
Could a mod please remove my previous comment? It's no longer relevant.

Nevermind the previous questions, I managed to find a workaround for my design. What I'd still like to know is if it's possible to add a background jpg/png to the "now playing" and "artwork 3in1" panels.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-10 06:05:29
out of boredom i've updated my biography panel with full language support as an option accessible via the context menu. it now caches the text indefinitely and it won't automatically update when you switch language. to update, you have to use the context menu. (it still automatically downloads when no biography exists)

(http://k5sbdw.blu.livefilestore.com/y1p3AQAhRqijp_UKFsjz1YxrVtwjciutm5P8Md7e8EypPyWXfi7KLKx9Zm1EGpuPYRzDIauh3nUFXTWZFc2pKGUA7_Gf_CkpE2s/languages.jpg)

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: allerlei on 2010-03-10 06:49:39
Thanks a lot! I was able to change the language based on your helpful comment, but this is nicer.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-10 07:03:32
i just had to re-upload it because i got the code for sweden wrong. i doubt this will affect many people here but you never know.
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-10 20:06:24
Hi marc.

I'm trying to integrate one of your scripts (artwork 3in1) into tedgo's DarkOne v2.0 (http://tedgo.deviantart.com/art/DarkOne-v2-0-156697932) but I get the following error:
Code: [Select]
Scripting Engine Initialization Failed (GUID: FF1A308A-F5B2-49E1-B98F-594F180E0BA6, CODE: 0x80020101)
Check the console for more detailed information (Always caused by unexcepted script error).
In the console I see:
Code: [Select]
WSH Panel Mod (GUID: FF1A308A-F5B2-49E1-B98F-594F180E0BA6): Parsing file "C:\Programmi\foobar2000\scripts\marc2003\v2\common.js": Failed to load
Error: WSH Panel Mod (GUID: FF1A308A-F5B2-49E1-B98F-594F180E0BA6): Errore di run-time di Microsoft JScript:
'settings_path' non è definito
Ln: 6, Col: 1
<source text only available in compile time>
which basically means the variable settings_path is undefined. I tried investigating and discovered it should be set in common.js but its inclusion seems to be commented in all your scripts, so perhaps I shoud set it elsewhere.

Can you assist me?

TIA.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-10 20:12:43
you need to extract the "scripts" folder from my download into your foobar folder. that is in the readme. 
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-10 20:36:51
Thanks for taking time to reply.

Please forgive my newbieness but what do you mean exactly? My foobar folder is C:\Programmi\foobar2000 and I extracted you zip in C:\Programmi\foobar2000\scripts, so I now have the following structure:

- C:\Programmi\foobar2000\scripts\other WSH samples (new)
- C:\Programmi\foobar2000\scripts\scripts\marc2003
- C:\Programmi\foobar2000\scripts\scripts\marc2003\v2

Is that correct?

Regards.

Alessandro

Never mind: got it. Apologies for wasting your time.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-10 20:38:51
i meant the "scripts" folder from the zip should go inside your foobar folder. like this

- C:\Programmi\foobar2000\scripts\marc2003
- C:\Programmi\foobar2000\scripts\marc2003\v2

edit: you sorted it. good stuff.
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-10 20:52:39
Oh my, I'm really embarassed: I extracted the zip directly into the foobar folder (not in the scripts subfolder) and it seemed to work, but after restarting foobar I'm back to square one.

What am i missing?

Alessandro

Edit: ok, it's official: I'm DUMB. Sorry.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-03-13 12:00:02
removed. wrong topic. sorry
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 12:54:57
Hi marc,

me again, apologies for being a PITA.

I'm using your artwork 3in1 and it works fine in Artreader mode both for Front and Artist image (I don't use Back, Disc and Icon). As it worked right out of the box, I suppose it uses the settings found in Preferences -> Display -> Front Cover & Artist tabs.

I didn't manage to make the Cycle Folder option work, though: in Set Cycle Folder I entered the same string I have in the above mentioned Artist tab:
Code: [Select]
E:\My Music\artists\substr(%artist%,1,1)\%artist%_*.*
but no image is shown. Am I misunderstanding how this option works?

Would it be possible to let it cycle using the same sources of Artreader mode (which, in my case, would mean showing the front cover and the artist image(s) at regular intervals)?

Thanks.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-13 13:26:04
typo? that should be $substr. or you could use $abbr(%artist%) instead.
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 13:43:28
typo? that should be $substr. or you could use $abbr(%artist%) instead.
Yep that was a typo here (looks like I'm not even able to copy and paste, geez).

I re-checked (and re-copied) and the Cycle folder contains exactly the same string as the Artist tab in preferences:
Code: [Select]
E:\My Music\artists\$substr(%artist%,1,1)\%artist%_*.*
Also tried $abbr (thanks for the tip, didn't know that):
Code: [Select]
E:\My Music\artists\$abbr(%artist%)\%artist%_*.*
but doesn't seem to make any difference.

Alessandro

PS: oh, and Cycle IS set to 5 secs, not off.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-03-13 13:48:26
@mobyduck
As you wrote you use DarkOne v2.0, i enhanced my cover panel to auto-cycle artreader or up to 5 custom pictures.
Maybe you want to try it instead: http://pastebin.de/4550 (http://pastebin.de/4550)
Cycle-Interval can be changed by right-click --> Properties "Auto Cycle Image Interval in s" (its preconfigured to 15s like Biography view panel).

Btw. how is your correct path named? $abbr(%artist%) gives DM for Depeche Mode, but A for Abba.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-13 13:51:31
oh sorry. that's me confusing things. go back to $substr if it's just the first letter. i thought that's all $abbr did as well.
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 14:06:31
Thanks both for your assistance.

Yes, in my case $substr is the correct function to use: thanks for the clarification.

@tedgo: I tried your script but it appears only to cycle between the front cover and the FIRST artist image (and yes, I have more that one image for the current artist). What else should I check?

Regards.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-03-13 14:12:20
Oh, yes it only cycles the first image found.
Sorry, its by design of the panel...
I don't wanted to rewrite it completely.

But you could add up to 5 images as "Custom Pictures" and cycle between them (right-click in the panel --> Properties and type-in the paths to the 5 images to the according "Picture x").
The panel can only cycle between album art OR custom pictures, not all in a row.
Maybe i change this behaviour but i guess not...
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 14:29:58
Oh, yes it only cycles the first image found.
Sorry, its by design of the panel...
I don't wanted to rewrite it completely.
Oh, I see...

Well, perhaps I should go back to the old albumart panel: after all it worked well for me and didn't cause any crashes. I'll try and study if and how it can replace your wsh panel.

Thanks again.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-13 14:37:15
try my script again but remove the *.*. it already has wildcard support (but is limited to jpg/png/gif files).

Code: [Select]
E:\My Music\artists\$substr(%artist%,1,1)\%artist%_
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 14:43:16
Sorry marc, still no go.

Let me know if there's anything else I can do to track down the problem.

Cheers.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-03-13 14:53:26
@mobyduck
Does your string work in artreader?
I guess your path to an artist picture is like: E:\My Music\artists\M\Michael Jackson_01.jpg
(this is what your string suggests, although you could also use $left(%artist%,1) instead $substr())
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-13 14:57:33
i see the problem now. it's because i only meant the script to use folders. if you change your pattern to

Code: [Select]
E:\My Music\artists\$substr(%artist%,1,1)


.. that should work.

but if there are other images in that folder you don't want displayed, you'll have to edit the script. remove the \\ on lines 90-92 and change your pattern back to the original. then if you want to use folders at a later time, you'll need to add a trailing slash yourself in the dialog box.
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 15:04:48
remove the \\ on lines 90-92 and change your pattern back to the original.
Right on the mark! Thanks so much.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 15:08:19
Does your string work in artreader?
I guess your path to an artist picture is like: E:\My Music\artists\M\Michael Jackson_01.jpg
Yeah, your guess is right. But, forgive me, what do you mean by artreader exactly?

And thanks for the $left suggestion: learning a lot today!

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2010-03-13 15:09:10
artreader = Preferences --> Display
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2010-03-13 15:20:32
Well, it works AFAICT, but only the first image that matches is returned.

Alessandro

Edit: that's just speculation on my part, haven't tested extensively.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-15 09:53:38
samples updated (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

-added transition effect to "now playing" panel. track info and album art slide into view when playback starts
-known issue: it's not always smooth when changing artists as the script has to scan your hard disk for images
-you can toggle the effect on or off via the context menu
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-03-16 14:21:49
samples updated (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

-added transition effect to "now playing" panel. track info and album art slide into view when playback starts
-known issue: it's not always smooth when changing artists as the script has to scan your hard disk for images
-you can toggle the effect on or off via the context menu



The transition looks great! What would I need to change to make the "Now playing" panel show artist images (embedded forst)? I was looking over the code, but my lack of scripting skills clearly shows.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-16 14:50:38
this uses the foobar artreader instead....

http://pastebin.org/114502 (http://pastebin.org/114502)

edit: cleaned up code a bit by removing all last.fm related stuff
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-03-16 15:03:25
this uses the foobar artreader instead....

http://pastebin.org/114479 (http://pastebin.org/114479)



This will do nicely! You just saved my entire afternoon. 
Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-03-16 15:45:41
samples updated (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

-added transition effect to "now playing" panel. track info and album art slide into view when playback starts
-known issue: it's not always smooth when changing artists as the script has to scan your hard disk for images
-you can toggle the effect on or off via the context menu


i have a little problem with now playing script  when i turn foobar off and on again i receive error on line 108

Code: [Select]
gr.GdiDrawText(title, g_font_title, RGB(255,255,255), text_x, wh-130, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);


with console text "title not defined"

i suspect its some issue with script being evaluated before playback start but do not know how to resolve it
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-16 16:10:08
are you sure you downloaded it from the link you quoted and it's totally un-modified? it should never generate an error like that.

Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-03-16 21:49:15
are you sure you downloaded it from the link you quoted and it's totally un-modified? it should never generate an error like that.

mmm pretty sure... but it does not generate this error everytime which kind of bugs me as its not easily redoable. just from time to time all i see instead of "now playing" is "script error"

im not sure if i translated the error msg correctly (as i dont run English windows and error is in my native lang). What is debuger trying to say is that "variable title" is not defined.

maybe something like this could help
Code: [Select]
if (!isset(title)) { title="";}

but imnot sure if something like this is possible in wshpanel[/s]

edit: Interesting think just happened and ive found out that i used previous version of now playing script... will continou explore
Title: WSH Panel Mod script discussion/help
Post by: Keesface on 2010-03-18 12:57:53
I'm currently using the Main Menu manager (All in one) script. It works fine, but I'd really like to have a button in it (right now clicking anywhere in the panel shows the menu from that point). Can anyone help me with it?

This is the script I'm talking about:
http://www.pastebin.org/116881 (http://www.pastebin.org/116881)
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-03-18 16:35:31
@Keesface, the on_mouse_lbtn_up function can use "x" and "y" to do just that.  Find the x and y coordinates of your button's boundaries x1, x2, y1, y2. 

This can be done easily by putting this function in your script and watching the console:
Code: [Select]
function on_mouse_move (x,y) {
   fb.trace("x: " + x);
   fb.trace("y: " + y);
}


Now, just encase the entirety of the menu command you posted within:
Code: [Select]
if(x > x1 && x < x2 && y > y1 && y < y2) {
<MENU COMMANDS>
}


That should work.  Now, the menu only comes up when you click within the specified boundaries.
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-03-18 16:38:18
this uses the foobar artreader instead....

http://pastebin.org/114502 (http://pastebin.org/114502)

edit: cleaned up code a bit by removing all last.fm related stuff


Getting a script error when I try to use this... Hm. I'm using the latest WSH panel mod (1.3.2)
Title: WSH Panel Mod script discussion/help
Post by: Joe30 on 2010-03-19 18:06:32
I am VERY interested in those scripts too, to be integrated in the fabulous DarkOne skin.
But I can't seem to be able to download samples.zip.
Is the link still OK ?  http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2010-03-21 00:39:58
I'm trying to add a 4th link to marc "web links" sample, i would like to add a link to rateyourmusic.com artist page or album...

i write this in the script:

(http://img534.imageshack.us/img534/3604/immagineon.th.jpg) (http://img534.imageshack.us/i/immagineon.jpg/)

but i got a link to rateyourmusic home page and not to artist page, anyone knows why?

Thanks anyway.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-21 00:47:51
@Fractal_Mortality, you do realise that script was a modification of my samples. it requires files from the zip file linked above. perhaps you are missing that?

@joe30, no problems with the link my end. it's always been reliable for me.

@nickdc, your $replace doesn't serve any purpose. try removing it. also, if you hover your mouse over the button, a tooltip will show the actual link before you click so that should help you troubleshoot it as well.

Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-03-21 06:32:04
Ah, my bad Marc, thanks.
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2010-03-21 09:29:46
@nickdc, your $replace doesn't serve any purpose. try removing it. also, if you hover your mouse over the button, a tooltip will show the actual link before you click so that should help you troubleshoot it as well.

Ok i wrote this in the script:

var rym = fb.TitleFormat("http://rateyourmusic.com/artist/$replace(%artist%, ,)").EvalWithMetadb(g_metadb);

now, when i go with mouse over the button i read
http://rateyourmusic.com/artist/JohnLennon (http://rateyourmusic.com/artist/JohnLennon),

but the right link on artist page on rym is:
http://rateyourmusic.com/artist/john_lennon (http://rateyourmusic.com/artist/john_lennon)

so i think i need to replace the caps letters with no caps, and replace the space between the words with a "_" to get the right link, do you know how to do?
Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-03-21 11:45:46
so i think i need to replace the caps letters with no caps, and replace the space between the words with a "_" to get the right link, do you know how to do?


if thats all you want:

Code: [Select]
$lower($replace(%artist%,' ','_'))
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2010-03-21 12:09:30
Awesome cart, it works good, thanks
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-03-27 19:53:25
Sadly I can't use Lyrics Show Panel 2 anymore, it became too unstable...

Is there any script out there that can download lyrics without having to store them somewhere before?

I'll write my own Lyrics panel but I have no idea how to download the lyrics from a site such as LyricWiki.

Any help is appreciated!
Title: WSH Panel Mod script discussion/help
Post by: alex1nax on 2010-03-28 10:46:18
To xbullethammer.
1. I have problems with english.
2. I have problems with jscript.
I do not know how, but I wrote this script and it works for me  .

http://rghost.ru/1260945 (http://rghost.ru/1260945)

These scripts are not completed, but things that may help you are in a folder "scripts".
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-03-28 15:01:12
Hey thanks for this, it works great!

I'll start to work on this once I finish my homework 
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-03-31 22:24:36
@marc2003

I have a few suggestions for your awesome now playing panel:

1.) Save artist images to foobarpath\lastfm\artist 1...artist 2...artist 3...
like biography panel does. This way, we will be able to find the images later on
and also download images by ourselves and put it in the appropriate folder
to display them in the panel.

2.) Option for downloading artist images automatically.

3.) Display something like "foobar2000" on panel startup/no track playing.

You would do me (and maybe others too) a huge favour.

Thanks.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-03-31 23:13:12
i have no intention of changing the file path for saved images. the reason i use foobar title formatting $crc32(%artist%) to generate the folder name is so i don't have to worry about windows filename validation. regardless of language/alphabet/special characters/punctuation, it just works. and it also means you can put this in the foobar artreader options so other components can use the same images.

you can right click the panel and use "Open containing folder" if you want to remove/edit/insert your own images in there for rotation (playback would have to be restarted for the script to detect the new files).
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-03-31 23:17:57
Ok, will do so for rotating images.
What about automatic downloading?
Title: WSH Panel Mod script discussion/help
Post by: grounder on 2010-04-01 11:29:47
I've tried to do automatic downloading, but there is one problem with art.exe. I wrote about it .here (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425&view=findpost&p=694656)
 When creating request for nonexistent artist's name in database last.fm. art.exe not self-closing, and remains in Task Manager.

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


var title = fb.TitleFormat("[%title%]").Eval();
var album_tf = fb.TitleFormat("$if2(%album%,)");
var artist_tf = fb.TitleFormat("%artist%").Eval();
var g_font_title = gdi.Font("Calibri", 16, 0);
var g_font_album = gdi.Font("Calibri", 18, 0);
var g_font_artist = gdi.Font("Calibri", 18, 0);

var artist = old_artist = null;
var album_img = null;
var artist_img = null;
var g_timer = null;
var offset = 0;

var cycle = window.GetProperty("cycle", 200) - 200;
var limit = window.GetProperty("limit", 325) - 300;
var transition = window.GetProperty("transition", 801) - 800;
var album_img_size = window.GetProperty("album_img_size", 490) - 400;

ww = window.width;
wh = window.height;

var arr = new Array();

if(fb.IsPlaying) on_playback_new_track();



function on_playback_stop(reason) {
if(album_img) album_img.Dispose();
if(artist_img) artist_img.Dispose();
g_metadb = album_img = artist_img = null;
if(reason != 2) window.Repaint();
}

function on_timer(id) {
offset--;
if(offset == 0) {
window.KillTimer(g_timer);
CollectGarbage();
}
window.Repaint();
}

function  on_playback_new_track() {

 
if(transition == 1) {
g_timer = window.CreateTimerInterval(1);
offset = 30;
}
g_metadb = fb.GetNowPlaying();
if(artist) old_artist = artist;
artist_out = fb.TitleFormat("[%artist%]").EvalWithMetadb(g_metadb);
artist = fb.TitleFormat("$replace($lower(%artist%),.,)").EvalWithMetadb(g_metadb);

album = album_tf.EvalWithMetadb(g_metadb);
if(album_img) album_img.Dispose();
album_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
if(!album_img) utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
if(artist != old_artist) {
folder = data_folder + fb.TitleFormat("$replace($lower(%artist%),.,)").EvalWithMetadb(g_metadb);
WshShell.Run("\"" + script_path + "art.exe\" \""  + artist + "\" \"" + folder + "\" " + limit, 0, true);
var jpg = utils.Glob(folder + "\\*.jpg").toArray();
var png = utils.Glob(folder + "\\*.png").toArray();
var gif = utils.Glob(folder + "\\*.gif").toArray();
arr = jpg.concat(png, gif);
}
index = Math.floor(Math.random()*arr.length);
load_image();
}

function on_playback_time(time) {
if(cycle > 0 && arr.length > 1 && (time % cycle == 0)) on_mouse_wheel(1);
}

function on_mouse_wheel(delta) {
if(arr.length < 2) return;
index += delta;
if(index < 0) index = arr.length-1;
if(index == arr.length) index = 0;
load_image();
}

function load_image() {
if(artist_img) artist_img.Dispose();
artist_image_path = arr[index];
artist_img = gdi.Image(artist_image_path);
window.Repaint();
}

function on_mouse_lbtn_dblclk() {
try {WshShell.Run("\"" + artist_image_path + "\""); } catch(e) {}
}

function on_get_album_art_done(metadb, art_id, im, ip) {
album_img = im;
window.Repaint();
}

function on_size() {
ww = window.width;
wh = window.height;
}

function scale(gr, img, pos_x, pos_y, width, height, mth) {
var s = mth == "max" ? Math.max(width / img.width, height / img.height) : Math.min(width / img.width, height / img.height);
var nw = img.width * s;
var nh = img.height * s;
pos_x += ((width - nw) / 2);
pos_y += ((height - nh) / 2);
gr.DrawImage(img, pos_x, pos_y, nw, nh, 0, 0, img.width, img.height);
}

function on_paint(gr) {
if(artist_img) {
  gr.FillSolidRect(0,0,ww,wh,RGBA(17,19,49,255)); //background
scale(gr, artist_img, 0, 0, ww, wh, "min");

} else {
gr.FillGradRect(0, 0, ww, wh, 90,g_backcolor, g_textcolor_hl);
}
gr.FillSolidRect(20,wh-130,ww - 40,110,RGBA(0,0,0,156));
  if(album_img) {
text_x = album_img_size + 40;
scale(gr, album_img, (-offset * 20) + 30, wh-30-album_img_size, album_img_size, album_img_size, "min");
} else {
text_x = 30;
}
if(fb.IsPlaying) {
gr.GdiDrawText(title, g_font_title, RGB(255,255,255), text_x, (offset * 15) + wh - 100, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(album, g_font_album, RGB(255,255,255), text_x, (offset * 20) + wh - 55, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(artist_out, g_font_artist, RGB(255,255,255), text_x, (offset * 10) + wh - 130, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
}
}


function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var _cycle = window.CreatePopupMenu();
var _limit = window.CreatePopupMenu();
var _album = window.CreatePopupMenu();
var _transition = window.CreatePopupMenu();
var idx;
_cycle.AppendMenuItem(MF_STRING, 200, "Off");
_cycle.AppendMenuItem(MF_STRING, 205, "5 seconds");
_cycle.AppendMenuItem(MF_STRING, 210, "10 seconds");
_cycle.AppendMenuItem(MF_STRING, 220, "20 seconds");
_cycle.CheckMenuRadioItem(200, 220, window.GetProperty("cycle"));
_limit.AppendMenuItem(MF_STRING, 301, "1");
_limit.AppendMenuItem(MF_STRING, 305, "5");
_limit.AppendMenuItem(MF_STRING, 310, "10");
_limit.AppendMenuItem(MF_STRING, 325, "25");
_limit.CheckMenuRadioItem(301, 325, window.GetProperty("limit"));
_album.AppendMenuItem(MF_STRING, 490, "Small");
_album.AppendMenuItem(MF_STRING, 600, "Large");
_album.CheckMenuRadioItem(490, 600, window.GetProperty("album_img_size"));
_transition.AppendMenuItem(MF_STRING, 800, "Off");
_transition.AppendMenuItem(MF_STRING, 801, "On");
_transition.CheckMenuRadioItem(800, 801, window.GetProperty("transition"));
_menu.AppendMenuItem(g_metadb ? MF_STRING : MF_GRAYED, 11, "Download artist art from Last.fm");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _limit.ID, "Limit");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(artist_img? MF_STRING : MF_GRAYED, 12, "Open containing folder");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _cycle.ID, "Cycle");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _album.ID, "Cover image size");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _transition.ID, "Transition effects");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
//_menu.AppendMenuItem(MF_STRING, 99, "Properties");
_menu.AppendMenuItem(MF_STRING, 100, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
case 200:
case 205:
case 210:
case 220:
window.SetProperty("cycle", idx);
cycle = idx - 200;
break;
case 301:
case 305:
case 310:
case 325:
window.SetProperty("limit", idx);
limit = idx - 300;
break;
case 490:
case 600:
window.SetProperty("album_img_size", idx);
album_img_size = idx - 400;
window.Repaint();
break;
case 800:
case 801:
window.SetProperty("transition", idx);
transition = idx - 800;
break;
case 11:
WshShell.Run("\"" + script_path + "art.exe\" \""  + artist + "\" \"" + folder + "\" " + limit, 0, true);
on_playback_new_track();
break;
case 12:
WshShell.Run("explorer /select," + artist_image_path);
break;
case 99:
window.ShowProperties();
break;
case 100:
window.ShowConfigure();
break;
}
_menu.Dispose();
_cycle.Dispose();
_limit.Dispose();
_transition.Dispose();
_album.Dispose();
return true;
}

function RGBA(r, g, b, a) { return ((a << 24) | (r << 16) | (g << 8) | (b)); }
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-04-01 16:00:54
I rewrote Marc2003's lastfm and art scripts. They do not need art.exe anymore.

Here is the include file, to see how it works:

Code: [Select]
function BioInfo() {
this.ArtistList = [];
this.Elements = [];
this.AlbumArtist = "";
this.Album = "";
this.Selected = 0;

this.Bio = function() {
if (this.Elements.length > 0) return this.Elements[this.Selected].Bio;
else return "";
}

this.Similar = function() {
var tarr = [];
for (var i in this.Elements) {
for (var j in this.Elements[i].Similar) {
var d = false;
for (var k in tarr) {
if (this.Elements[i].Similar[j] == tarr[k]) d = true;
}
for (var k in this.ArtistList) {
if (this.Elements[i].Similar[j] == this.ArtistList[k]) d = true;
}
if (!d) tarr.push(this.Elements[i].Similar[j]);
}
}
return tarr;
}

this.Tags = function() {
var tarr = [];
for (var i in this.Elements) {
for (var j in this.Elements[i].Tags) {
var d = false;
for (var k in tarr) {
if (this.Elements[i].Tags[j] == tarr[k]) d = true;
}
if (!d) tarr.push(this.Elements[i].Tags[j]);
}
}
return tarr;
}

this.Url = function() {
if (this.Elements.length > 0) return this.Elements[this.Selected].Url;
else return "";
}

this.Get = function(artistlist, albumartist, album, force) {
if (artistlist.toString() != this.ArtistList.toString() || force) {
if (artistlist.toString() != this.ArtistList.toString()) {
this.ArtistList = artistlist;
this.Selected = 0;
}
GetLastFMArtistPics(artistlist[0]);
this.Elements = [];
for (var i in artistlist) {
this.Elements[i] = new BioElement();
this.Elements[i].Get(artistlist[i]);
}
}
if (albumartist != this.AlbumArtist || album != this.Album) {
this.AlbumArtist = albumartist;
this.Album = album;
GetLastFMAlbumPics(albumartist, album);
}
}

this.Force = function() {
this.Elements[this.Selected].Get(this.ArtistList[this.Selected], true);
}

this.Select = function(artist) {
var tmp = 0
for (var i in this.ArtistList) {
if (artist == this.ArtistList[i]) tmp = i;
}
if (tmp != this.Selected) {
this.Selected = tmp;
GetLastFMArtistPics(this.ArtistList[this.Selected]);
} else {
this.Force();
}
}

//artalb: 0 for artist, 1 for album, 2 for both
this.GetImages = function(artalb) {
if (artalb == 0 || artalb == 2) GetLastFMArtistPics(this.ArtistList[0]);
if (artalb == 1 || artalb == 2) GetLastFMAlbumPics(this.AlbumArtist, this.Album);
}
}

function BioElement() {
this.Artist = "";
this.Bio = "";
this.Similar = [];
this.Tags = [];
this.Url = "";

this.Get = function(artist, force) {
if (artist != this.Artist || force) {
this.Artist = artist;
this.Bio = "";
this.Similar = [];
this.Tags = [];
this.Url = "";
var filename = datafolder + crc32(artist).toString(16) + ".xml";
try {
if(fso.fileExists(filename)) {
var file = fso.Getfile(filename);
if(Date.parse(Date()) - Date.parse(file.DateLastModified) < 86400000) {
var text = "";
try {
ts = fso.OpenTextFile(filename,1, false, -1);
text = ts.ReadAll();
ts.close();
} catch(e) {}
if(text.length > 0) {
var xmldom = new ActiveXObject("Microsoft.XMLDOM");
xmldom.async = "false";
xmldom.loadXML(text);
try {this.Bio = decodeXML(xmldom.getElementsByTagName("content")[0].childNodes[0].nodeValue)} catch(e) {}
try {
var similar = xmldom.getElementsByTagName("similar");
for (var i = 0; i < similar[0].getElementsByTagName("name").length; i++) {
this.Similar.push(decodeXML(similar.item(0).getElementsByTagName("name")[i].childNodes[0].nodeValue));
}
} catch(e) {}
try {
var tags = xmldom.getElementsByTagName("tags");
for (var i = 0; i < tags[0].getElementsByTagName("name").length; i++) {
this.Tags.push(decodeXML(tags.item(0).getElementsByTagName("name")[i].childNodes[0].nodeValue));
}
} catch(e) {}
try {this.Url = decodeXML(xmldom.getElementsByTagName("url")[0].childNodes[0].nodeValue)} catch(e) {}
}
} else {
GetLastFMArtist(artist);
}
} else {
GetLastFMArtist(artist);
}
} catch(e) {
fb.trace("ERROR BioElement.Get");
}
}
}
}

//--------------------

var LastFMAPI = ""; // put your lastfm api here
var LastFMUserName = ""; put your lastfm username here
var fso = new ActiveXObject("Scripting.FileSystemObject");
var datafolder = "D:\\Music\\LastFMBio\\"
if(!fso.FolderExists(datafolder)) fso.CreateFolder(datafolder);

//--------------------

function GetLastFMArtist(artist) {
try {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://ws.audioscrobbler.com/2.0?&api_key=" + LastFMAPI +  "&username=" + LastFMUserName + "&method=artist.getinfo&artist=" + encodeURIComponent(artist) + "&s=" + Math.random(), true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
savetextfile(datafolder + crc32(artist).toString(16) + ".xml", xmlhttp.responsetext);
} else {
fb.trace(xmlhttp.responsetext);
}
}
datareload = true;
window.Repaint();
}
} catch(e) {
fb.trace("ERROR GetLastFMArtist");
}
}

function savetextfile(filename, content) {
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(content);
ts.close();
} catch(e) {
fb.trace("ERROR savetextfile");
}
}

function GetLastFMArtistPics(artist) {
window.NotifyOthers("artist", artist);
try {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://ws.audioscrobbler.com/2.0?&api_key=" + LastFMAPI + "&method=artist.getImages&artist=" + encodeURIComponent(artist) + "&limit=5&s=" + Math.random(), true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var xmldom = new ActiveXObject("Microsoft.XMLDOM");
xmldom.async = "false";
xmldom.loadXML(xmlhttp.responsetext);
var urls = [];
try {
var images = xmldom.getElementsByTagName("image");
for (var i = 0; i < images.length; i++) {
var sizes = images[i].getElementsByTagName("size");
for (var j = 0; j < sizes.length; j++) {
if (sizes[j].attributes.getNamedItem("name").value == "original") urls.push(decodeXML(sizes[j].childNodes[0].nodeValue));
}
}
} catch(e) {}
for (var i in urls) {
GetWebPicture(urls[i], artist, "artist", i == (urls.length - 1));
}
} else {
fb.trace(xmlhttp.responsetext);
}
}
}
} catch(e) {
fb.trace("ERROR GetLastFMArtistPics");
}
}

function GetLastFMAlbumPics(artist, album) {
window.NotifyOthers("album", artist + album);
try {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://ws.audioscrobbler.com/2.0?&api_key=" + LastFMAPI + "&method=album.getInfo&artist=" + encodeURIComponent(artist) + "&album=" + encodeURIComponent(album) + "&s=" + Math.random(), true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var xmldom = new ActiveXObject("Microsoft.XMLDOM");
xmldom.async = "false";
xmldom.loadXML(xmlhttp.responsetext);
var url = null;
try {
var images = xmldom.getElementsByTagName("image");
for (var i = 0; i < images.length; i++) {
if (images[i].attributes.getNamedItem("size").value == "extralarge") url = decodeXML(images[i].childNodes[0].nodeValue);
}
} catch(e) {}
if (url) GetWebPicture(url, artist + album, "album", true);
} else {
fb.trace(xmlhttp.responsetext);
}
}
}
} catch(e) {
fb.trace("ERROR GetLastFMAlbumPics");
}
}

function GetWebPicture(url, str, type, last) {
try {
var filename = datafolder + crc32(str).toString(16) + "\\" + crc32(url).toString(16) + url.slice(url.lastIndexOf("."));
if (!utils.FileTest(filename, "e")) {
if(!fso.FolderExists(datafolder + crc32(str).toString(16))) fso.CreateFolder(datafolder + crc32(str).toString(16));
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", url, true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
savebinaryfile(filename, xmlhttp.responseBody);
if (last) window.NotifyOthers(type, str);
} else {
fb.trace(xmlhttp.responsetext);
}
}
}
}
} catch(e) {
fb.trace("ERROR GetWebPicture");
}
}

function savebinaryfile(filename, content) {
try { 
var ostream = new ActiveXObject("adodb.stream");
ostream.Type = 1 //binary
ostream.Open();
ostream.Write(content);
ostream.SaveToFile(filename,  2);
} catch(e) {
fb.trace("ERROR savebinaryfile");
}
}

function decodeXML(value) {
try {
value = value.replace(/<\/?[^>]+(>|$)/g, "");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = value.replace(/\n/g, "<br>");
value = div.innerHTML;
value = value.replace(/<BR>/g,"\n");
value = value.replace(/&gt;/g,">");
value = value.replace(/&lt;/g,"<");
value = value.replace(/&nbsp;/g," ");
return value.replace(/&amp;/g,"&");
} catch(e) {
fb.trace("ERROR decodeXML");
}
}

function crc32(str) {
var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
var crc = 0;
var x = 0;
var y = 0;
crc = crc ^ (-1);
for (var i = 0, iTop = str.length; i < iTop; i++) {
y = (crc ^ str.charCodeAt (i)) & 0xFF;
x = "0x" + table.substr (y * 9, 8);
crc = (crc >>> 8) ^ x;
}
  return crc ^ (-1);
};

Maybe I'll write an example of how to use it soon, together with an example for my by now largely upgraded input FormsAndButtons script.
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-04-01 16:31:04
I've tried to do automatic downloading, but there is one problem with art.exe. I wrote about it .here (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425&view=findpost&p=694656)
When creating request for nonexistent artist's name in database last.fm. art.exe not self-closing, and remains in Task Manager.

Thank you for posting this. It stays in the task manager but it works just fine.

I rewrote Marc2003's lastfm and art scripts. They do not need art.exe anymore.

Here is the include file, to see how it works:

Maybe I'll write an example of how to use it soon, together with an example for my by now largely upgraded input FormsAndButtons script.

That would be awesome. Thank you!

Edit: Deleted some misunderstood things...
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-04-02 19:49:38
I'm using the excellent lyrics viewer by alex1nax. I've made some changes to the code fit it to my taste; however, there's a problem I can't solve.
To make things (I believe) faster, the panel draws the lyrics in a IGdiBitmap which is then drawn into the panel. The problem is that it appears that GdiDrawText() draws the text blended on a black background rather than on a transparent one. I tried switching rendering methods but it appears that DrawString() has the same problem. Is there any way to draw text correctly on a non-black image?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-03 17:37:38
edit: samples NOT updated

something caused it to crash so script removed.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-03 19:35:38
2nd attempt: samples updated.

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

changes to "now playing" panel only

-transitions removed. behaviour too random.
-automatically download artist art from lastfm if no artist images exist (you can turn this on/off via the context menu)
-shows text when playback is stopped. you can set this yourself at the top of the script.
-modded "art.exe" that doesn't hang in task manager when artist doesn't exist on last.fm
-minor appearance tweak
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-04-03 20:19:20
Excellent update marc!
Works flawlessly...

Thank you!
Title: WSH Panel Mod script discussion/help
Post by: Joe30 on 2010-04-03 22:43:17
-automatically download artist art from lastfm if no artist images exist


This looks awesome. Could you please tell how to use this exactly ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-03 23:01:02
follow the instructions inside the zip. at the end, the file you need to import is named "now playing.txt". you can control most of the script options via the context menu.

a couple of things which aren't documented:

you can double click the panel to open the current image in your default viewer
use your mouse wheel to cycle through the images
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-04-05 14:10:35
Hi. Could you please help me pointing me the right direction or some tips to achieve my will.

I would like to reproduce a Simple Volume Knob, inspired by AbeltonLive.
I made an exemple with photoshop in 4 states : 0% 30% 60% and 100% of the volume.

(http://img200.imageshack.us/img200/5134/voltest.png) (http://img200.imageshack.us/i/voltest.png/)

I've read the script of some knobs config (Kameleon and Xchange, by Falstaff) and tried to simplify the code to my purpose.
But i have to say that JScript is for me, much more difficult to understand and learn than TitleFormat Script.

So maybe someone can point me the way to find a very simple code, to start learning JScript, and achieve my knob project.
I put the example image specially to have your comment about how much images/overlays i will need.

Any help would be very appreciated. WSH scares me a bit very much!
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2010-04-05 22:57:36
I uploaded a new version of my FormsAndButtons script for buttons and keyboard text input. I also included, a modified version of Marc2003's last.fm script, which doesn't need art.exe anymore (it is possible to download binary files in jscript!).

To show how it works I included an example layout.

[a href='index.php?showtopic=80035']See this topic for screenshots and to download[/a]
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-04-05 23:05:54
Kabuki: Here is something to start you off. I don't know how to get the two colour effect, I think it would be quite hard. You really need to be able to draw curves I guess. Or figure out how to put a polygon on top that masks the right part- you need to define a set of points that depend on the angle so that it ends up looking how you want. Not easy...

Code: [Select]
function pos2vol(pos) {
    return (50 * Math.log(0.99 * p + 0.01) / Math.LN10);
}

function vol2pos(v){
    return (Math.pow(10, v / 50) - 0.01) / 0.99;
}

var vcol = window.InstanceType?window.GetColorDUI(0):window.GetColorCUI(0);
var bg = window.InstanceType?window.GetColorDUI(1):window.GetColorCUI(3);

var radius = 16;
var line = 3;
var offset = 3;

var voldrag = false;

var p = vol2pos(fb.Volume);
var ang = (3/4)*Math.PI + (3/2)*Math.PI*p;

function on_paint(gr)
{
    gr.FillSolidRect( 0, 0, ww, wh, bg);
    gr.SetSmoothingMode(4);
    gr.DrawEllipse(offset, offset, 2*radius, 2*radius, line, vcol);
    gr.DrawLine(radius*(1+Math.cos(ang))+offset, (radius)*(1+Math.sin(ang))+offset, radius+offset, radius+offset, line, vcol);
}

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

function on_mouse_lbtn_down(x,y)
{
voldrag = true;
p = vol2pos(fb.Volume);
y_old = y;
}

function on_mouse_lbtn_up(x,y)
{
voldrag = false;
}

function on_mouse_move(x,y)
{
if(voldrag)
{
p = p - (y-y_old)/80;
        p = (p>1)?1:(p<0)?0:p;
fb.Volume = pos2vol(p);
y_old = y;
}
}

function on_mouse_wheel(delta)
{
    p = p + delta/10;
    p = (p>1)?1:(p<0)?0:p;
    fb.Volume = pos2vol(p);
}

function on_volume_change(val)
{
    p = vol2pos(val);
ang = (3/4)*Math.PI + (3/2)*Math.PI*p;
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-04-05 23:23:39
the reason i use foobar title formatting $crc32(%artist%) to generate the folder name ... you can put this in the foobar artreader


Ive never thought of that... man its brilliant THANKS!
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-04-06 02:48:20
Kabuki: Here is something to start you off.
Thank you TomBarlow for having taken time to specially code this. Yes i will step by step learn JScript, since i suppose that more and more components will use this instead of TF.
Now, thanks to you i have a simple code to start.
Cheers
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2010-04-06 14:07:22
@ marc2003, do u know how to add item details (title, album, artist) in your aero seekbar script? I think it would be nice...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-06 22:26:46
samples updated with glass playback buttons.

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

this has additonal requirements compared to the other scripts:

1) requires columns UI and a specially modified version of WSH panel mod -
http://sites.google.com/site/jk7800/foobar...?attredirects=0 (http://sites.google.com/site/jk7800/foobar2000/foo_uie_wsh_panel_mod.dll?attredirects=0)
2) the panel must be placed at the bottom of a vertical splitter with both the status bar and status pane turned off

and it looks like this....
(http://k5sbdw.blu.livefilestore.com/y1pC1eZ2OXF2PyCcZb78W9RK1u8rDxnagB3sKqGEsiEAUPbXd3US9vYveX8xdnunvwHRiHH_cjxJ28PiAM9LkrVrCKFxfo3pG2H/glass%20buttons.png)
Title: WSH Panel Mod script discussion/help
Post by: Keesface on 2010-04-06 23:23:34
I like that .
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-04-07 02:02:28
Quote from:  link=msg=698174 date=0
I'm using the excellent lyrics viewer by alex1nax. I've made some changes to the code fit it to my taste; however, there's a problem I can't solve.
To make things (I believe) faster, the panel draws the lyrics in a IGdiBitmap which is then drawn into the panel. The problem is that it appears that GdiDrawText() draws the text blended on a black background rather than on a transparent one. I tried switching rendering methods but it appears that DrawString() has the same problem. Is there any way to draw text correctly on a non-black image?


Any ideas about this?
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2010-04-07 07:28:55
^No, since AA/ClearType text doesn't like alpha channel, so you need to have a solid background in that case.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-04-07 15:43:07
hi, maybe i can reach another time some help from you, here.
2 questions:
Thx
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2010-04-08 06:50:32
coverflow

(http://www.abload.de/img/coverflow10ckgu.jpg) (http://www.abload.de/image.php?img=coverflow10ckgu.jpg)


prerequisite:


Code: [Select]
//coverflow by grimes
//fb2k 1.0+, WSH Panel Mod 1.3.2+ required
//DUI/CUI ready

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

var dui = window.InstanceType;
//var g_font = gdi.Font("Segoe UI", 12, 0);
var g_font = dui === 1 ? window.GetFontDUI(0) : window.GetFontCUI(0);
//var color = RGB(200,0,0);
var color = dui === 1 ? window.GetColorDUI(2) : RGB(200, 0, 0);
//var color2 = RGB(0,0,0);
var color2 = dui === 1 ? window.GetColorDUI(0) : window.GetColorCUI(0);

var id = 0;
var zz = 0;
var ww = 0,
    wh = 0;
var patharray = new Array(
//insert paths
);

var g_img;
var g_img2;
var g_img3;
var g_img4;
var g_img5;

function get_image() {
    g_img = utils.GetAlbumArt(patharray[zz], id);
    g_img2 = utils.GetAlbumArt(patharray[zz - 2], id);
    g_img3 = utils.GetAlbumArt(patharray[zz - 1], id);
    g_img4 = utils.GetAlbumArt(patharray[zz + 1], id);
    g_img5 = utils.GetAlbumArt(patharray[zz + 2], id);
}

get_image();

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww * 6, wh, dui === 1 ? window.GetColorDUI(1) : window.GetColorCUI(3));
    if (g_img && g_img2 && g_img3 && g_img4 && g_img5) {
        var scale = 0;
        var y = 0;
        var scale_w = ww / g_img.Width;
        var scale_h = wh / g_img.Height;

        if (scale_w * 2 <= scale_h) {
            scale = scale_w * 2;
            y = (wh - g_img.Height * scale) / 2;
        } else {
            scale = scale_h;
        }
        var scale2 = 0;
        var y2 = 0;
        var scale_w2 = ww / g_img2.Width;
        var scale_h2 = wh / g_img2.Height;

        if (scale_w2 <= scale_h2) {
            scale2 = scale_w2;
            y2 = (wh - g_img2.Height * scale2) / 2;
        } else {
            scale2 = scale_h2;
        }
        var scale3 = 0;
        var y3 = 0;
        var scale_w3 = ww / g_img3.Width;
        var scale_h3 = wh / g_img3.Height;

        if (scale_w3 <= scale_h3) {
            scale3 = scale_w3;
            y3 = (wh - g_img3.Height * scale3) / 2;
        } else {
            scale3 = scale_h3;
        }
        var scale4 = 0;
        var y4 = 0;
        var scale_w4 = ww / g_img4.Width;
        var scale_h4 = wh / g_img4.Height;

        if (scale_w4 <= scale_h4) {
            scale4 = scale_w4;
            y4 = (wh - g_img4.Height * scale4) / 2;
        } else {
            scale4 = scale_h4;
        }
        var scale5 = 0;
        var y5 = 0;
        var scale_w5 = ww / g_img5.Width;
        var scale_h5 = wh / g_img5.Height;

        if (scale_w5 <= scale_h5) {
            scale5 = scale_w5;
            y5 = (wh - g_img5.Height * scale5) / 2;
        } else {
            scale5 = scale_h5;
        }
        gr.DrawImage(g_img, ww * 3 - g_img.Width * scale / 2, y, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
        gr.DrawImage(g_img2, 0, y2, g_img2.Width * scale2, g_img2.Height * scale2, 0, 0, g_img2.Width, g_img2.Height);
        gr.DrawImage(g_img3, ww, y3, g_img3.Width * scale3, g_img3.Height * scale3, 0, 0, g_img3.Width, g_img3.Height);
        gr.DrawImage(g_img4, ww * 5 - g_img4.Width * scale4, y4, g_img4.Width * scale4, g_img4.Height * scale4, 0, 0, g_img4.Width, g_img4.Height);
        gr.DrawImage(g_img5, ww * 6 - g_img5.Width * scale5, y5, g_img5.Width * scale5, g_img5.Height * scale5, 0, 0, g_img5.Width, g_img5.Height);
        gr.GdiDrawText(zz + 1, g_font, color, 10, 5, window.Width - 10, window.Height, 0x00000010);
    } else {
        gr.GdiDrawText("error: no stub image path defined", g_font, color2, 10, 5, window.Width - 10, window.Height, 0x00000010);
    }
}

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

function on_playback_stop(reason) {
    window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
    if (x > ww * 3 && y < wh) {
        if (zz === patharray.length - 1) {
            zz = 0;
        } else if (zz < patharray.length - 1) {
            zz += 100;
        }
        if (zz >= patharray.length - 1) {
            zz = patharray.length - 1;
        }
    }
    if (x < ww * 3 && y < wh) {
        if (zz === 0) {
            zz = patharray.length - 1;
        } else if (zz > 0) {
            zz -= 100;
        }
        if (zz < 0) {
            zz = 0;
        }
    }
    if (g_img) {
        get_image();
    }
    window.Repaint();
}

function on_mouse_move() {
    if (g_img) window.SetCursor(32649);
}

function on_mouse_wheel(delta) {
    for (i = 0; i < delta; i++) {
        zz++;
    }
    for (i = 0; i < -delta; i++) {
        zz--;
    }
    if (zz < 0) {
        zz = patharray.length - 1
    } else if (zz > patharray.length - 1) {
        zz = 0;
    }
    if (g_img) {
        get_image();
    }
    window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
    var MF_SEPARATOR = 0x00000800;
    var MF_STRING = 0x00000000;
    var _menu = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(MF_STRING, 1, "cover");
    _menu.AppendMenuItem(MF_STRING, 2, "back");
    _menu.AppendMenuItem(MF_STRING, 3, "disc");
    _menu.AppendMenuItem(MF_STRING, 4, "icon");
    _menu.AppendMenuItem(MF_STRING, 5, "artist");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    //_menu.AppendMenuItem(MF_STRING, 5, "Properties");
    _menu.AppendMenuItem(MF_STRING, 6, "Configure...");
    _menu.CheckMenuRadioItem(1, 5, id + 1);
    idx = _menu.TrackPopupMenu(x, y);
    switch (idx) {
    case 1:
        id = 0;
        break;
    case 2:
        id = 1;
        break;
    case 3:
        id = 2;
        break;
    case 4:
        id = 3;
        break;
    case 5:
        id = 4;
        break;
    case 5:
        window.ShowProperties();
        break;
    case 6:
        window.ShowConfigure();
    }

    _menu.Dispose();
    if (g_img) {
        get_image();
    }
    window.Repaint();
    return true;
}

function on_colors_changed() {
    color = dui === 1 ? window.GetColorDUI(2) : RGB(200, 0, 0);
    color2 = dui === 1 ? window.GetColorDUI(0) : window.GetColorCUI(0);
    window.Repaint();
}

function on_font_changed() {
    g_font = dui === 1 ? window.GetFontDUI(0) : window.GetFontCUI(0);
    window.Repaint();
}

Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-04-08 12:28:49
  • in foobar2000: Library | Search | %tracknumber% IS 01 | Create Playlist
  • select all tracks in playlist | rightclick | Utilities | Text Tools | Advanced | Track Pattern: "%path%", | Copy
  • open editor (notepad++) | Paste | replace \ by \\ and remove last comma
  • Insert created paths in WSH Panel mod script at line 20 (array) | Apply


Looks good. Are you planning to improve the script further
so that user don't have to go through the steps described above?
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2010-04-08 14:10:37
At this point this is only a testversion. The steps are only necessary after adding new albums to media library.
These new albums are simply missing in coverflow.
Maybe new albums could be added to the array by playing a track of the new album, but i don't plan to add this feature.
I would like to add something like reflection or 3d effect, but i don't know the graphic abilities of WSH panel mod, especially IGdiGraphics interface.
Maybe someone could give more information, what is possible?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-08 17:43:48
samples updated: http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

2 minor changes
"artwork 3 in 1" now fills the panel instead of leaving gaps when the image doesn't fit. aspect is still maintained so edges will be clipped if necessary.
"simple biography" panel now stops scrolling at the right place.

i've also re-jigged lots of background stuff that you won't notice. hopefully i didn't break anything in the process.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-08 17:48:11
I would like to add something like reflection or 3d effect, but i don't know the graphic abilities of WSH panel mod, especially IGdiGraphics interface.
Maybe someone could give more information, what is possible?


for this, you should look at ojdo's HTPC panels thread in the uploads section. his script has reflections in.
Title: WSH Panel Mod script discussion/help
Post by: Keesface on 2010-04-08 18:11:08
I've got a request for a script that can do the following:

1. show tags directly from last.fm (like the biography panel)
2. write them to a tag with a button click
3. filters for tags you want to exclude/include (like in the last.fm plus plugin for picardtagger).

Would this be possible, and would anyone like to create a script like this if it is?
Title: WSH Panel Mod script discussion/help
Post by: MB. on 2010-04-08 18:56:31
I've got a request for a script that can do the following:

1. show tags directly from last.fm (like the biography panel)
2. write them to a tag with a button click
3. filters for tags you want to exclude/include (like in the last.fm plus plugin for picardtagger).

Would this be possible, and would anyone like to create a script like this if it is?


its possible
even without scripting experience you can do this yourself.
all you have to do is edit the scripts that are floating around here.
just take the lastfm script from marc2003 and change it so that it gets the tags from the last fm api.
filtering is the easiest part where you just add a new column with [%lastmf_tags%] for example
Title: WSH Panel Mod script discussion/help
Post by: bwat47 on 2010-04-08 20:30:26
samples updated with glass playback buttons.

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

this has additonal requirements compared to the other scripts:

1) requires columns UI and a specially modified version of WSH panel mod -
http://sites.google.com/site/jk7800/foobar...?attredirects=0 (http://sites.google.com/site/jk7800/foobar2000/foo_uie_wsh_panel_mod.dll?attredirects=0)
2) the panel must be placed at the bottom of a vertical splitter with both the status bar and status pane turned off

and it looks like this....
(http://k5sbdw.blu.livefilestore.com/y1pC1eZ2OXF2PyCcZb78W9RK1u8rDxnagB3sKqGEsiEAUPbXd3US9vYveX8xdnunvwHRiHH_cjxJ28PiAM9LkrVrCKFxfo3pG2H/glass%20buttons.png)

When I try and use any of your samples I get a script error, the only one that works is aero seekbar. I am trying to get the glass buttons and I have the modded version of wsh panel you linked too.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-08 20:59:23
did you follow the instructions regarding extracting the zip into your foobar folder and turning off safe mode in the WSH panel mod preferences?
Title: WSH Panel Mod script discussion/help
Post by: bwat47 on 2010-04-08 22:12:04
got it working, I forgot to put the scripts folder in the install dir, but I do have one issue, the playback icons for me look much blurrier than in the screenshot. here is a screen:
http://img245.imageshack.us/img245/3935/22007058.png (http://img245.imageshack.us/img245/3935/22007058.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-08 22:48:30
that looks fine to me??

but in my screen shot i'm not using standard windows aero. i'm using a theme called win7blend found on devinatart.
Title: WSH Panel Mod script discussion/help
Post by: bwat47 on 2010-04-08 23:19:02
They get sharper if I change the code where it says 160 / 2 to 160 / 200 (which moves them all to the left side) basically anywhere but the middle they look much shaprer, as soon as I put them back in the middle they are quite noticeably blurry for me though.
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-04-08 23:34:43
Y'll should use integer values as coordinates! Just use Math.round()
The images look blurry because they are being rendered at non-integer values i.e. 12.5 pixels.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-08 23:43:42
thanks for the tip. but i still can't tell the difference. .

for anybody using this script change line 22:

Code: [Select]
pos = Math.round((ww-160) / 2);


i've updated the hosted file as well.
Title: WSH Panel Mod script discussion/help
Post by: bwat47 on 2010-04-08 23:46:30
Thanks guys! worked great. they look perfectly sharp now.
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-04-09 00:51:41
did you follow the instructions regarding extracting the zip into your foobar folder and turning off safe mode in the WSH panel mod preferences?


your "rating" work in "other WSH samples (new)" have a sad problem.

when i click on the star ,nothing happens, it can't rate the song, another word , your work can only show the rating , it can't rate the rating.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-09 05:38:03
i'm thinking perhaps my issue with not be able to see so clearly is that i have a crappy old CRT monitor....

anyway, samples updated with a proper readme detailing what each script does and all relevant instructions.

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-04-09 17:46:53
Pardon my ignorance but I couldn't find a way to align text drawn with the new IStyleTextRender. How do I do it?
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-04-11 09:33:03
In MainMenuManager All-In-One.txt can someone please show my how I can append the preferences entry?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-11 09:53:54
add these 2 lines just before "ret = 0".

Code: [Select]
basemenu.AppendMenuItem(MF_SEPARATOR, 0, 0);
basemenu.AppendMenuItem(MF_STRING,2000,"Preferences");


then add this as the first item in the switch statement just below.

Code: [Select]
case(ret == 2000):
    fb.ShowPreferences();
    break;
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-04-11 12:27:23
thanks marc2003 can you please give me the code for adding a rating submenu as well contextman.Init("Rating") doesn't seem to do the trick for me.
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-04-11 16:51:23
I need help with this code:

Code: [Select]
function createPattern(w,h){
    var bg = gdi.CreateImage(w,h);
    var mask = gdi.CreateImage(w,h);
    var g = mask.GetGraphics();
    g.FillSolidRect(0,0,w,h,0xff000000);
    for (i = 0; i < Math.round(h/2); i++){
        g.FillSolidRect(0,i*2+1,w,1,0xffffffff);
    }
    mask.ReleaseGraphics(g);
    g = bg.GetGraphics();
    g.FillSolidRect(0,0,w,h,0xffffffff);
    bg.ReleaseGraphics(g);
    bg.ApplyMask(mask);
    return bg;
}

This thing creates a pattern I use to paint a volume bar, my panel calls this in the on_size callback. Everything works when I press the OK button. My problem appears to be on foobar2000 startup. The console throws this: Microsoft JScript runtime error: 'null' is null or not an object Ln: 23, Col: 5 which is the line: var g = mask.GetGraphics();

Does anyone see anything stupid there?
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2010-04-11 16:53:56
New version of cover browser (formerly coverflow)

(http://www.abload.de/img/coverbrowser1gyzw.jpg) (http://www.abload.de/image.php?img=coverbrowser1gyzw.jpg)

Updated instructions for filling array and arrayupdate (prerequisite):


http://pastebin.de/5265 (http://pastebin.de/5265)

updates and information: http://foobar-users.de/index.php?topic=200...g16441#msg16441 (http://foobar-users.de/index.php?topic=2000.msg16441#msg16441)
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-04-12 13:48:21
thanks marc2003 can you please give me the code for adding a rating submenu as well contextman.Init("Rating") doesn't seem to do the trick for me.


Marc I could not find a way to get the rating menu from the context menu so instead I created a custom menu and used fb.RunContextCommandWithMetadb. Is there a way to just populate using the context playback statistics rating menu?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-12 13:56:36
nope, not possible. re-creating it with your own custom menu is the only way.
Title: WSH Panel Mod script discussion/help
Post by: phunkydizco on 2010-04-13 14:41:12
Where can I find some scripts for displaying album art with some nice effects such as reflection or shadow?
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-04-14 12:13:49
Marc I was looking through your updated samples and noticed that you switched to DrawString from GdiDrawText. I wanted to know why because according to the docs the latter is faster.
Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-14 12:48:43
i changed because using MeasureString() to calculate text dimensions is accurate. using the gdi method isn't.

as for speed, could you really tell them apart if you had 2 panels side by side? i don't think so.
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-04-14 13:08:29
i changed because using MeasureString() to calculate text dimensions is accurate. using the gdi method isn't.

as for speed, could you really tell them apart if you had 2 panels side by side? i don't think so.

I noticed that with DrawString some characters overlap and hinting doesn't seem as good as GDIDrawText
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-14 13:20:51
overlapping characters? i've not seen that before. have you got a screenshot? (not that i could anything about it - i'm just curious)
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-04-14 14:59:15
overlapping characters? i've not seen that before. have you got a screenshot? (not that i could anything about it - i'm just curious)

I'll try to get one for you. Will have to re edit my script. Maybe it only happens with Segoe UI
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-04-14 17:12:16
Shouldn't we be able to do?
Code: [Select]
_menu.EnableMenuItem(ID, !fb.IsPlaying);

instead of
Code: [Select]
 _menu.EnableMenuItem(ID, fb.IsPlaying ? 0 : 1);

Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-04-14 17:43:13
Hi,

is it possible to create a button for a masstagger script
and edit multiple files with it?

I Managed to do that to the now playing file, but not more than that one.

r3v0
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2010-04-15 13:43:36
@grimes

I have been enjoying using your cover browser script.

I did have a few issues with regard to getting working arrays.

tagarray[0]

in foobar2000: Library | Search | %tracknumber% IS 01 | Create Playlist

This did not fully work for me as I have a number of compilation albums that do not have track 01 where I have removed needless duplicate tracks.

I ended up creating a playlist of my whole library and using a text format in text tools as below with skip duplicate/repeating lines ticked.

"$cut(%path%,3)\$directory(%path%,6)\\$directory(%path%,5)\\$directory(%path%,4)\\$directory(%path%,3)\\$directory(%path%,2)\\$directory(%path%,1)\\",

Obviously the number of required paths will depend on the folder structure and the last comma still needs deleting.

tagarray[1]

Using the track pattern "%album%", yielded two problems. Firstly, albums with names such as "Heroes" ended up as ""Heroes"" which causes a script error. "\"Heroes\"" needs to be used instead. Secondly, there are problems when there is more than one album of the same name, e.g. I have several called Greatest Hits but by different artists, and with these the show playing album setting often fails to display the correct cover. I ended up creating a playlist of my whole library and using a track pattern of [%album artist%] -[ '['%date%']'][ %album%] with skip duplicate/repeating lines ticked in text tools. This is much more robust and ensures all have a unique name. I changed the var album definition accordingly.

Also if you end up playing tracks not in the array, e.g. something like a playlist generated by the last.fm plug-in, where the covers are available then no covers show at all in the cover browser. It may be worth considering showing at least the central cover for tracks not in the array but where the cover is available.

It's also a pity that you cannot click on a cover and send it to a playlist or select it in the playlist.
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2010-04-15 17:45:23
Also if you end up playing tracks not in the array, e.g. something like a playlist generated by the last.fm plug-in, where the covers are available then no covers show at all in the cover browser. It may be worth considering showing at least the central cover for tracks not in the array but where the cover is available.


Try to implement this feature. First Test-Version here: http://pastebin.de/5387 (http://pastebin.de/5387)
Title: WSH Panel Mod script discussion/help
Post by: Chugfrenzy on 2010-04-15 20:17:04
Don't know if this is possible but thought I'd ask anyway 'cos I'm totally new to scripting for WSH but trying to get to grips with it.

Basically, I've altered slightly a code from Tombarlow (thanks!) to use as a volume knob as follows -
Code: [Select]
function pos2vol(pos) {
return (50 * Math.log(0.99 * p + 0.01) / Math.LN10);
}

function vol2pos(v){
return (Math.pow(10, v / 50) - 0.01) / 0.99;
}

var vcol = window.InstanceType?window.GetColorDUI(0):window.GetColorCUI(1);
var bg = window.InstanceType?window.GetColorDUI(1):window.GetColorCUI(3);

var radius = 16;
var line = 3;
var offset = 3;

var voldrag = false;

var p = vol2pos(fb.Volume);
var ang = (3/4)*Math.PI + (3/2)*Math.PI*p;

function on_paint(gr)
{
//gr.FillSolidRect( 0, 0, ww, wh, bg);
gr.SetSmoothingMode(4);
//gr.DrawEllipse(offset, offset, 2*radius, 2*radius, line, vcol);
gr.DrawLine(radius*(1+Math.cos(ang))+offset, (radius)*(1+Math.sin(ang))+offset, radius+offset, radius+offset, line, vcol);
}

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

function on_mouse_lbtn_down(x,y)
{
voldrag = true;
p = vol2pos(fb.Volume);
y_old = y;
}

function on_mouse_lbtn_up(x,y)
{
voldrag = false;
}

function on_mouse_move(x,y)
{
if(voldrag)
{
p = p - (y-y_old)/80;
p = (p>1)?1:(p<0)?0:p;
fb.Volume = pos2vol(p);
y_old = y;
}
}

function on_mouse_wheel(delta)
{
p = p + delta/10;
p = (p>1)?1:(p<0)?0:p;
fb.Volume = pos2vol(p);
}

function on_volume_change(val)
{
p = vol2pos(val);
ang = (3/4)*Math.PI + (3/2)*Math.PI*p;
window.Repaint();
}


Which works great over a .png to give a vintage "knob" style volume control, but I'm now trying to do the same thing as a seekbar dial and I'm completely baffled as to where to even start

Anyone any ideas?
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2010-04-16 17:14:16
@grimes

Cover browser rc5. This is working nicely. The change to using path instead of album seems to make it unnecessary to use array [1], the album array, unless sorting by array [1] is considered essential.  At least I have it working fine without filling array [1] with the text previously displayed by this being directly retrieved using titleformatting.

A small bug is that the side reflection often disappears on track change. This seems to be a problem with evaluating: !(g_img2.Width * scale < ww - 0.01) in: if (reflectionside && !(g_img2.Width * scale < ww - 0.01)) as using: if (reflectionside) alone works fine.

Personally for tracks not in the array I prefer having something other than the stub images for img2, 3, 4 & 5. Currently I put the artist as img2 & 5 and repeated the front cover as img 3 & 4, but this is not necessarily ideal (I have no back, disc or icon images). Also if a track not in the array is playing and you interact with cover browser (e.g. mouse wheel scroll) it reverts to the array covers, which is fine, but it seems that you cannot then go back to the playing track cover.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2010-04-17 16:16:08
@grimes

Thanks for cover browser rc6. All is working fine so far. May be the warning message something like "no stub image path defined in foobar2000 preferences" needs to go back in because if just one of the images is missing - especially for tracks not in the array - no images display. I had this problem initially and it took me a while to realise what was going on. The cursor change on mouse move over certain images with tracks not in the array is also somewhat confusing as it does nothing and it would be best if it did not happen.
Title: WSH Panel Mod script discussion/help
Post by: powernemo on 2010-04-18 16:11:43
Hello all,

im using Dark-One 1.6 theme by br3tt and i came across the cool component foo_menu_addons by Acropolis and i wanted to implement the A-B repat function in the interface on the WSH pane using JScript.

I put 4 buttons [E] [A] [R]

E to enable the repeat
A and B to set the markers
R to reset.

What i can do :
- A and B cannot be turned ON if E is not turned ON (and it works )
- Toggle A, B and E on and off (and works)
- When i press R the E button should stay enabled and toggle off only A and B ( i didnt do that yet but i think i can figure this out easily)

What i cant do:
- when i skip track E should get disabled and disable automatically also A and B markers. Anyone can help on this?

i used this code :

Code: [Select]
var A_on = {normal: imgPath + "AOn.png", hover: imgPath + "AOn.png"};
var A_off = {normal: imgPath + "AOff.png", hover: imgPath + "AOn.png"};
var a_tooltip = "Set A Marker";

var B_on = {normal: imgPath + "BOn.png", hover: imgPath + "BOn.png"};
var B_off = {normal: imgPath + "BOff.png", hover: imgPath + "BOn.png"};
var b_tooltip = "Set B Marker";

var E_on = {normal: imgPath + "EOn.png", hover: imgPath + "EOn.png"};
var E_off = {normal: imgPath + "EOff.png", hover: imgPath + "EOn.png"};
var e_tooltip = "Enable A-B";

var R_on = {normal: imgPath + "ROn.png", hover: imgPath + "ROn.png"};
var R_off = {normal: imgPath + "ROff.png", hover: imgPath + "ROn.png"};
var r_tooltip = "Reset A-B";

var a_sw = false;
var b_sw = false;
var e_sw = false;

function genAImageSrc() {
    return (a_sw & e_sw) ? A_on : A_off;
}
function switch_a() {
    a_sw = !a_sw;
    Buttons.A.alterImage(genAImageSrc());
    Buttons.A.repaint();
}

function genBImageSrc() {
    return (b_sw & e_sw) ? B_on : B_off;
}

function switch_b() {
    b_sw = !b_sw;
    Buttons.B.alterImage(genBImageSrc());
    Buttons.B.repaint();
}
function genEImageSrc() {
    return (e_sw) ? E_on : E_off;
}

function switch_e() {
        e_sw =!e_sw
        Buttons.E.alterImage(genEImageSrc());
        Buttons.E.repaint();
    if (!e_sw){    
                
                Buttons.A.alterImage(A_off);
                Buttons.A.repaint();    
                Buttons.B.alterImage(B_off);
                Buttons.B.repaint();    
    }
}

Buttons["E"] = new Button(0, 0, 13, 11, genEImageSrc(), function () { fb.RunMainMenuCommand("Playback/Repeat A-B/Enable");switch_e();}, e_tooltip);
Buttons["A"] = new Button(10, 0, 13, 11, genAImageSrc(), function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Mark A");switch_a();}, a_tooltip);
Buttons["B"] = new Button(20, 0, 13, 11, genBImageSrc(), function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Mark B");switch_b();}, b_tooltip);
Buttons["R"] = new Button(30, 0, 13, 11, R_off, function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Reset");}, r_tooltip);


That's the first time i use JScript so dont blame me if the code is lame =P

Any help would be really appreciated

Thanks !
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-04-18 17:18:10
@powernemo:

Dark-One 1.6 is a theme by tedgo, not me
Title: WSH Panel Mod script discussion/help
Post by: powernemo on 2010-04-18 17:30:57
Sorry
my bad, btw seems like i cant edit so...

 
@powernemo:

Dark-One 1.6 is a theme by tedgo, not me
Title: WSH Panel Mod script discussion/help
Post by: powernemo on 2010-04-18 18:17:33
Ok, figured out myself
(any more elegant solution of course is much appreciated)

Code: [Select]
function genAImageSrc() {
    
    return (a_sw & e_sw) ? A_on : A_off;
}

function switch_a() {
    
    a_sw = !a_sw;
    if (a_sw) {A_active = true};
    Buttons.A.alterImage(genAImageSrc());
    Buttons.A.repaint();
}

function genBImageSrc() {
    
    return (b_sw & e_sw) ? B_on : B_off;
}

function switch_b() {
    
    b_sw = !b_sw;
    if (b_sw) {
        B_active = true
        if (!A_active) {     // That's cause if we press B before pressing A the song will start looping frm the beginning to marker B so we wanna turn on A (even if its not so necessary)
            A_active = true
            a_sw = true
            Buttons.A.alterImage(genAImageSrc());
            Buttons.A.repaint();
            }
        };
    Buttons.B.alterImage(genBImageSrc());
    Buttons.B.repaint();
}

function genEImageSrc() {
    
    return (e_sw) ? E_on : E_off;
}

function switch_e() {
    
        e_sw =!e_sw
        Buttons.E.alterImage(genEImageSrc());
        Buttons.E.repaint();

        if (!e_sw){    
                Buttons.A.alterImage(A_off);
                Buttons.A.repaint();    
                Buttons.B.alterImage(B_off);
                Buttons.B.repaint();    
        }
        if ((e_sw) & (A_active)) {
                Buttons.A.alterImage(A_on);
                Buttons.A.repaint();    
            }
        if ((e_sw) & (B_active) ){
                Buttons.B.alterImage(B_on);
                Buttons.B.repaint();    
            }
}

function reset_sw(){
    
        a_sw = false;
        b_sw = false;
        e_sw =false
        A_active = false
        B_active = false
        Buttons.A.alterImage(A_off);
        Buttons.A.repaint();    
        Buttons.B.alterImage(B_off);
        Buttons.B.repaint();    
        Buttons.E.alterImage(E_off);
        Buttons.E.repaint();

}

function on_playback_new_track(){
        
    reset_sw()
}

Buttons["E"] = new Button(0, 0, 13, 11, genEImageSrc(), function () { fb.RunMainMenuCommand("Playback/Repeat A-B/Enable");switch_e();}, e_tooltip);
Buttons["A"] = new Button(10, 0, 13, 11, genAImageSrc(), function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Mark A");switch_a();}, a_tooltip);
Buttons["B"] = new Button(20, 0, 13, 11, genBImageSrc(), function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Mark B");switch_b();}, b_tooltip);
Buttons["R"] = new Button(30, 0, 13, 11, R_off, function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Reset");reset_sw();}, r_tooltip);
Title: WSH Panel Mod script discussion/help
Post by: cartman(2vd) on 2010-04-18 22:56:46
Code: [Select]
function genAImageSrc() {

return (a_sw & e_sw) ? A_on : A_off;
}

function switch_a() {

a_sw = !a_sw;
if (a_sw) {A_active = true};
Buttons.A.alterImage(genAImageSrc());
Buttons.A.repaint();
}

function genBImageSrc() {

return (b_sw & e_sw) ? B_on : B_off;
}

function switch_b() {

b_sw = !b_sw;
if (b_sw) {
B_active = true
if (!A_active) { // That's cause if we press B before pressing A the song will start looping frm the beginning to marker B so we wanna turn on A (even if its not so necessary)
A_active = true
a_sw = true
Buttons.A.alterImage(genAImageSrc());
Buttons.A.repaint();
}
};
Buttons.B.alterImage(genBImageSrc());
Buttons.B.repaint();
}

function genEImageSrc() {

return (e_sw) ? E_on : E_off;
}

function switch_e() {

e_sw =!e_sw
Buttons.E.alterImage(genEImageSrc());
Buttons.E.repaint();

if (!e_sw){
Buttons.A.alterImage(A_off);
Buttons.A.repaint();
Buttons.B.alterImage(B_off);
Buttons.B.repaint();
}
if ((e_sw) & (A_active)) {
Buttons.A.alterImage(A_on);
Buttons.A.repaint();
}
if ((e_sw) & (B_active) ){
Buttons.B.alterImage(B_on);
Buttons.B.repaint();
}
}

function reset_sw(){

a_sw = false;
b_sw = false;
e_sw =false
A_active = false
B_active = false
Buttons.A.alterImage(A_off);
Buttons.A.repaint();
Buttons.B.alterImage(B_off);
Buttons.B.repaint();
Buttons.E.alterImage(E_off);
Buttons.E.repaint();

}

function on_playback_new_track(){

reset_sw()
}

Buttons["E"] = new Button(0, 0, 13, 11, genEImageSrc(), function () { fb.RunMainMenuCommand("Playback/Repeat A-B/Enable");switch_e();}, e_tooltip);
Buttons["A"] = new Button(10, 0, 13, 11, genAImageSrc(), function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Mark A");switch_a();}, a_tooltip);
Buttons["B"] = new Button(20, 0, 13, 11, genBImageSrc(), function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Mark B");switch_b();}, b_tooltip);
Buttons["R"] = new Button(30, 0, 13, 11, R_off, function () {fb.RunMainMenuCommand("Playback/Repeat A-B/Reset");reset_sw();}, r_tooltip);

next time you can use "codebox" bbtag and omit those horid long posts
Title: WSH Panel Mod script discussion/help
Post by: thomi on 2010-04-21 01:48:09
Hi,

I was using marc2003's rating script but it's not working anymore, nor is another one i found in another topic. They both show up just fine but when i click on the stars to set a rating, nothing happens.

Is there any change I could have done in the settings to brake it ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-21 01:56:03
have you got the official playback statistics component? it requires that....

http://www.foobar2000.org/components/view/foo_playcount (http://www.foobar2000.org/components/view/foo_playcount)
Title: WSH Panel Mod script discussion/help
Post by: thomi on 2010-04-21 07:59:31
have you got the official playback statistics component? it requires that....

http://www.foobar2000.org/components/view/foo_playcount (http://www.foobar2000.org/components/view/foo_playcount)


Yeah, it's there.

And if I right-click a song and use the Quicktagger to set the rating it works.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-21 11:36:55
the script doesn't use quick tagger. what if you try and use the context menu "Playback Statistics>Rating"? if that entry isn't there, you need to enable it under preferences>display>context menu. (the script needs this enabled to work)

also, the tracks you're trying to rate must be monitored as part of the media library.
Title: WSH Panel Mod script discussion/help
Post by: thomi on 2010-04-22 01:37:51
You're right. I had removed it from the context menu, I'd never figure that out lol.

Thanks
Title: WSH Panel Mod script discussion/help
Post by: xbullethammer on 2010-04-22 05:45:34
Is there a way to retrieve playlist sizes and lengths?

I want to create my own playlist switcher but, I need that information.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-04-25 21:04:56
Help required :

i want to use the SendKeys method to write in a dialog box somthing, and first, opening this dialog Box

in a WSH panel, i call this on left mouse button up :

var WshShell = new ActiveXObject("WScript.Shell");
WshShell.SendKeys("(^P)");

it should open Preferences window, but it does nothing ... i think that the focus is on the WSH panel hosting this command, so maybe i should send a {TAB} key to swap to another panel of the foobar window BEFORE trying to send Ctrl+P (^ = Ctrl key) :

WshShell.SendKeys("{TAB}");


any idea ?
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-04-26 19:39:14
@marc2003

Issue 1: still having issues with the "now playing" script. All others work and safe mode is turned off.

Whenever I turn auto download off it shows no artist pictures, not even from the tags. As soon as I stop playing a track without an artist pic the panel goes into SCRIPT ERROR. Starts working again after right click -> configure -> apply, but still without tag images. Foobar can't be closed before I do this step because art.exe stalls it. I have to manually end art.exe from the task manager and then close foobar.

Note I use your scripts from: 4/26/2010 11:47 AM.

Issue 2: a while back (page 12. posts 285, 286), I asked you if there was a way for "now playing" to display cover art instead of artist pic (swap them). You then posted the code for this on pastebin (and it worked great, many thanks), but when I checked again today, the code was gone. Would you mind re-uploading it?

Issue 3: this is probably easy, but since I'm not a coder, I only mix and match to get a result; can't quite create something new. Is it possible for "now playing" to have a three color gradient?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-26 20:05:02
i have no idea why you're getting an error. check the console, see which line it is and then post what it is. auto-download is turned off by default and it's the setting i always use. you shouldn't have any problems if there are no images, it just looks like this...

(http://k5sbdw.blu.livefilestore.com/y1pEzRc3_sPI-fDYl2UCcuIpw5JWR0zyBDlP7BkkPreGsTZs-J2Wx98dbPLMj7x4F6ac-m2Gox_DUzQENe_0QC6QxFRCZszJC_j/no%20art.png)

did you overwrite all files when downloading the zip. there was a problem with art.exe hanging if artists weren't found on last.fm. i've since re-compiled it to fix that. (note i didn't write that program but the author (paradog (http://www.hydrogenaudio.org/forums/index.php?showuser=53710)) published the source code. the reason it hung is that it was waiting for user input but i hide the program so that wasn't possible. i just commented out one line of code so it exits by itself)

i suppose i can modify it not to use last.fm and the artreader instead. i'll do that later.

and no, you can't have a 3 colour gradient.

edit: i lied. you can have 3 colours if you spilt the panel. i'll post how to do that later as well.
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-04-26 20:55:10
did you overwrite all files when downloading the zip. there was a problem with art.exe hanging if artists weren't found on last.fm. i've since re-compiled it to fix that. (note i didn't write that program but the author (paradog (http://www.hydrogenaudio.org/forums/index.php?showuser=53710)) published the source code. the reason it hung is that it was waiting for user input but i hide the program so that wasn't possible. i just commented out one line of code so it exits by itself)


I deleted everything related and redownloaded: seems to be working fine now, but I don't know why, since it's exactly what I did an hour before (I did a new portable install today due to getting a new hard drive). Well, if it works...

In any case, I took a short screencast (http://drop.io/f2kissue) (1min.) for reference if you should need it in the future. The error was:
Quote
Error: WSH Panel Mod (GUID: BA3A201A-5E28-425F-9B01-A3245A424D5F): Microsoft JScript runtime error:
Object required
Ln: 269, Col: 2


I'll wait patiently for your other info and "thanks" in advance.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-04-26 21:24:28
i'm sure i told pastebin to keep it forever last time but here it is again.

http://pastebin.com/zHQxxwns (http://pastebin.com/zHQxxwns)

there are 3 variables at the top of the script to set 3 colours top_c, mid_c and bot_c

as for the error, i can only assume you were using a new script with an old version of the scripts folder in your foobar directory??

EDIT: link updated due to a small error. 
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-04-26 21:44:54
Superb! I won't have time to fiddle with it now since it's midnight for me, but I'll be sure to post tomorrow if something comes up.

As for the error, yeah I guess it's possible. Since I did a fresh Windows install today I had folders and files scattered all over the desktop for me take a look at; something could have snuck by. In any case, thanks a lot for the prompt response.
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-05-06 09:57:32
I'm not really sure if this is the right place to ask, but since I'm scripting with WSH Panel mod.. Is there a way to find out the possible position of text 'live' (case insensitive) within string. For example, if I have "Song2 (live)" function would return 7 (as first character is 0).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-05-06 10:15:03
var title = fb.TitleFormat("%title%").EvalWithMetadb(g_metadb);
var pos = title.toLowerCase().indexOf("live");
Title: WSH Panel Mod script discussion/help
Post by: Maf on 2010-05-09 19:54:53
There is a script for viewing album covers on the panel has buttons to switch Folder\CD\Artist\etc. Please help make switch tracks for this buttons Previous\Play\Pause\Next.
Code: [Select]
function RGBA(r,g,b,a){
var res = 0xff000000|(r<<16)|(g<<8)|(b);
if (a!=undefined) res = (res & 0x00ffffff) | (a << 24)
return res;
}
//====================================================
// Properties Object =======================================
/* All settings store here */
var Properties = new function (){
this.Panel = {
// 0: Never, 1: When not playing, 2: Always.
FollowCursor: window.GetProperty("Panel.FollowCursor", 1),
// Where the images folders in.
WorkDirectory: fb.FoobarPath+fb.TitleFormat(window.GetProperty("Panel.WorkDirectory", "Images\\EIKO\\WSH Cover\\")).Eval(true),
// "cn": Chinese, "en": English, "auto": Auto choose, base on foobar2000 core language.
lang: window.GetProperty("Panel.Language", "auto").toLowerCase(), // Language
// Separate with comma, like "255,255,255"
BackGroundColor: window.GetProperty("Panel.BackGroundColor", ""),
Tooltip: window.CreateTooltip() // Create button's tooltip
};

if (typeof(this.Panel.FollowCursor)!="number")
this.Panel.FollowCursor = 1;
else if (this.Panel.FollowCursor<0)
this.Panel.FollowCursor = 0;
else if (this.Panel.FollowCursor>2)
this.Panel.FollowCursor = 2;

if (this.Panel.lang != "cn" && this.Panel.lang != "en")
this.Panel.lang = (fb.TitleFormat("$meta()").Eval(true)=="[未知函数]") ? "cn" : "en";

try {
this.Panel.FSO = new ActiveXObject("Scripting.FileSystemObject");
} catch(e) {
// Impossible to work without FSO.
fb.ShowPopupMessage(this.Panel.lang=="cn" ? "无法创建FSO对象, WSH Cover面板无法工作." : "Can not create File System Object (FSO), WSH Cover Panel can't work.", "WSH Cover Panel", 1);
new ActiveXObject("Scripting.FileSystemObject"); // End scripts running.
}

if (!this.Panel.FSO.FolderExists(this.Panel.WorkDirectory))
fb.ShowPopupMessage(this.Panel.lang=="cn" ? "无效的工作路径." : "Invalid work directory.", "WSH Cover Panel", 1);

if (this.Panel.BackGroundColor) {
this.Panel.BackGroundColor = this.Panel.BackGroundColor.replace(/ | /g, "");
this.Panel.BackGroundColor = this.Panel.BackGroundColor.split(",");
for (var i in this.Panel.BackGroundColor) {
if (this.Panel.BackGroundColor[i]<0)
this.Panel.BackGroundColor[i] = 0;
else if (this.Panel.BackGroundColor[i]>255)
this.Panel.BackGroundColor[i] = 255;
}
if (this.Panel.BackGroundColor.length<4)
this.Panel.BackGroundColor.length = 4;
}

//---------------------------------------------------------------------
this.Cycle = {
// Enable image cycle.
Enable: window.GetProperty("Cycle.Enable", true),
// Interval period.
Period: window.GetProperty("Cycle.Period", 10000),
// Cycle all the wildcard match files in image SourceFormat.
CycleInWildCard: window.GetProperty("Cycle.CycleInWildCard", true),
// Pause images cycle automatic when following cursor.
AutoPauseWhenFollowCursor: window.GetProperty("Cycle.AutoPauseWhenFollowCursor", true),
// Animations on image's changing. Not only in image cycle, but also in track switching.
Animation: {
Enable: window.GetProperty("Cycle.Animation.Enable", true),
RefreshInterval: window.GetProperty("Cycle.Animation.RefreshInterval", 50),
Duration: window.GetProperty("Cycle.Animation.Duration", 400)
}
};

if (typeof(this.Cycle.Period)!="number")
this.Cycle.Period = 7000;
else if (this.Cycle.Period<100)
this.Cycle.Period = 100;

if (typeof(this.Cycle.Animation.RefreshInterval)!="number")
this.Cycle.Animation.RefreshInterval = 50;
else if (this.Cycle.Animation.RefreshInterval<10)
this.Cycle.Animation.RefreshInterval = 10;

if (typeof(this.Cycle.Animation.Duration)!="number")
this.Cycle.Animation.Duration = 300;
else if (this.Cycle.Animation.Duration<10)
this.Cycle.Animation.Duration = 10;

//---------------------------------------------------------------------
this.Image = {
// Separate paths by "||"; use "|||" to separate default images and other images, only can be used once; "<embed>" means embed cover, must be a individual path in sourceformat.
SourceFormat: window.GetProperty("Image.SourceFormat", "<embed>||$directory_path(%path%)\\cover.*||$directory_path(%path%)\\folder.*"),
// In same group, if SourceFormat not changed, panel will not check any new files, and the images cycle will not be reset.
GroupFormat: window.GetProperty("Image.GroupFormat", "%album%"),
// Default image path.
DefaultImagePath: fb.TitleFormat(window.GetProperty("Image.DefaultImagePath", "Images\\EIKO\\Default.jpg")).Eval(true),
// File larger than this value will not be loaded. <=0 means no limit.
MaxFileSize: window.GetProperty("Image.MaxFileSize", 2097152),
// Keep images aspect ratio.
KeepAspectRatio: window.GetProperty("Image.KeepAspectRatio", true),
// Stretch images to fit panel.
Stretch: window.GetProperty("Image.Stretch", false),
// Images is stored after resize, so you can set this value larger if your panel size is not very large.
ImageCacheCapacity: window.GetProperty("Image.ImageCacheCapacity", 10),
// This panel also stores path search result, only stores the strings.
PathCacheCapacity: window.GetProperty("Image.PathCacheCapacity", 20),
// Only these types of files can be displayed. Not necessary to modify this at most times.
SupportTypes: new Array("jpg", "jpeg", "png", "gif", "bmp"),
// Image smoothing mode.
SmoothingMode: window.GetProperty("Image.SmoothingMode", 0),
// Image interpolation mode in resizing.
InterpolationMode: window.GetProperty("Image.InterpolationMode", 0)
};

if (typeof(this.Image.MaxFileSize)!="number")
this.Image.MaxFileSize = 2097152;
else if (this.Image.MaxFileSize<0)
this.Image.MaxFileSize = 0;

if (typeof(this.Image.ImageCacheCapacity)!="number")
this.Image.ImageCacheCapacity = 10;
else if (this.Image.ImageCacheCapacity<0)
this.Image.ImageCacheCapacity = 0;

if (typeof(this.Image.PathCacheCapacity)!="number")
this.Image.PathCacheCapacity = 20;
else if (this.Image.PathCacheCapacity<0)
this.Image.PathCacheCapacity = 0;

if (typeof(this.Image.SmoothingMode)!="number")
this.Image.SmoothingMode = 0;
else if (this.Image.SmoothingMode<-1)
this.Image.SmoothingMode = -1;
else if (this.Image.SmoothingMode>4)
this.Image.SmoothingMode = 4;

if (typeof(this.Image.InterpolationMode)!="number")
this.Image.InterpolationMode = 0;
else if (this.Image.InterpolationMode<-1)
this.Image.InterpolationMode = -1;
else if (this.Image.InterpolationMode>7)
this.Image.InterpolationMode = 7;

//---------------------------------------------------------------------
this.Buttons = {
// Whether display the control buttons.
Display: window.GetProperty("Buttons.Display", true),
// 0: topleft, 1:topright, 2:bottomleft, 3:bottomright
Position: window.GetProperty("Buttons.Position", "4")
};

if (typeof(this.Buttons.Position)!="number")
this.Buttons.Position = 4;
else if (this.Buttons.Position<0)
this.Buttons.Position = 0;
else if (this.Buttons.Position>5)
this.Buttons.Position = 5;

}();


//====================================================
// Three funtions ==========================================

//---------------------------------------------------------------------------------------------
/* Calculate image's new size and offsets in new width and height range.
Use panel's default settings of stretch and ratio if they are not specified */
function CalcNewImgSize (img, dstW, dstH, srcW,srcH, strch, kar) {
if (!img) return;
if (!srcW) srcW = img.width;
if (!srcH) srcH = img.height;
if (strch==undefined) strch = Properties.Image.Stretch;
if (kar==undefined) kar = Properties.Image.KeepAspectRatio;

var size;
if (strch) {
size = {x:0, y:0, width:dstW, height:dstH};
if (kar) {
size.width = Math.ceil(srcW*dstH/srcH);
if (size.width>dstW) {
size.width = dstW;
size.height = Math.ceil(srcH*dstW/srcW);
}
}
} else {
size = {x:0, y:0, width:srcW, height:srcH};
if (kar) {
if (srcH>dstH) {
size.height = dstH;
size.width = Math.ceil(srcW*dstH/srcH);
}
if (size.width>dstW) {
size.width = dstW;
size.height = Math.ceil(srcH*dstW/srcW);
}
} else {
size.width = Math.min(srcW, dstW);
size.height = Math.min(srcH, dstH);
}
}
size.x = Math.floor((dstW-size.width)/2);
size.y = Math.floor((dstH-size.height)/2);
return size;
}

//---------------------------------------------------------------------------------------------
/* Reisze image to new width and height */
function ResizeImg (img, dstW, dstH) {
if (!img || !dstW || !dstH) return img;
if (img.width==dstW && img.height==dstH) return img;

var newimg = gdi.CreateImage(dstW, dstH);
var g = newimg.GetGraphics();
g.DrawImage(img, 0, 0, dstW, dstH, 0, 0, img.width, img.height);
newimg.ReleaseGraphics(g);
CollectGarbage(); // Release memory.
return newimg;
}

//---------------------------------------------------------------------------------------------
/* Remove an element from "this" array, return the removed element */
function RemoveFromArray (index) {
if (index==0)
return this.shift();
else if (index==this.length-1)
return this.pop();
var c = this[index];
var rest = this.slice(index+1);
this.length = index;
this.push.apply(this, rest);
return c;
}


//====================================================
// Define Image Loader ====================================
/* Loader image file from specified path. It contains a image cache.
Primarily provides the "GetImg()" method */
var ImageLoader = new function (Prop) {
var ImgCacheCapacity = Prop.Image.ImageCacheCapacity;

if (ImgCacheCapacity) {
// Cache array is always sorted, sort by last accessed.
// Array's length never change.
// No empty element, only empty "cacheitem".
// No item will really be deleted, only be deassigned.
var ImgsCache = new Array;
// Admissible size error in cache reading.
ImgsCache.ImgSizeError1 = 10; // For enlarge.
ImgsCache.ImgSizeError2 = 50; // For shrink.

// Class of the items in cache.
ImgsCache.cacheItem = function (path, imgobj) {
this.Path = path; // String.
this.ImgObj = imgobj; // Object, gdi.image() object, or empty.
this.srcW = 0; // Source width.
this.srcH = 0; // Source height
};

// Fill the cache array with empty cacheitems.
for (var i=0; i<ImgCacheCapacity-1; i++)
ImgsCache.push(new ImgsCache.cacheItem(null, null));

// Remove element from cache array, return the removed element.
ImgsCache.remove = RemoveFromArray;

// Store item in the beginning of the cache array. Duplicate item's "ImgObj" will be overwritten.
ImgsCache.Store = function (path, imgobj, srcW, srcH) {
var c;
if (this.SearchFor(path)) {
c = this[0]; // This is the one just found.
c.ImgObj = imgobj;
if (srcW) c.srcW = srcW;
if (srcH) c.srcH = srcH;
} else if (c = this.pop()) {
c.Path = path;
c.ImgObj = imgobj;
c.srcW = srcW ? srcW : (imgobj ? imgobj.width : 0); // Store source width.
c.srcH = srcH ? srcH : (imgobj ? imgobj.height : 0); // Store source height.
this.unshift©;
}
};

// Search in cache, find the image object.
// Resize "ImgObj" to "dst" size, if current size is not enough, and the source size is closer, remove this item and return nothing.
// Or, move it to the beginning of the cache array, then resize image, then return this cache item.
// If no result found, return nothing.
ImgsCache.SearchFor = function (path, dstW, dstH) {
var i = 0;
for (i; i<this.length; i++) // Find it.
if (this[i].Path==path)
break;

if (i<this.length) {
var c = this.remove(i);
var img = c.ImgObj;
// For resizing------------------------
if (img && dstW && dstH) {
var size = CalcNewImgSize(img, dstW, dstH, c.srcW, c.srcH);
// If image should be enlarged and it still can be enlarged...
if ((size.width>img.width && img.width<c.srcW) || (size.height>img.height && img.height<c.srcH)) {
// If the dst size is not too large...
if (size.width-img.width<this.ImgSizeError1 && size.width<c.srcW && size.height-img.height<this.ImgSizeError1 && size.height<c.srcH)
img = ResizeImg(img, size.width, size.height); // Only resize, no cache.
else {
// Return to reload image file.
this.push©;
return;
}
// If it's shrinking...
} else if (size.width<img.width || size.height<img.height) {
// If the dst size is too small...
if (img.width-size.width>this.ImgSizeError2 || img.height-size.height>this.ImgSizeError2) {
img = ResizeImg(img, size.width, size.height); // Resize and cache.
c.ImgObj = img;
} else
img = ResizeImg(img, size.width, size.height); // Resize and don't cache.
} else {
size = CalcNewImgSize(img, dstW, dstH);
img = ResizeImg(img, size.width, size.height);
c.ImgObj = img;
}
}
//------------------------------------
this.unshift©;
return (img || true); // If path was found, return something "true" at all times.
}
};

// Clear cache, only reset all cache items indeed.
ImgsCache.Clear = function () {
for (var i=0; i<this.length-1; i++) {
this[i].Path = null;
this[i].ImgObj = null;
this[i].srcW = 0;
this[i].srcH = 0;
}
};
}

// Load image file from specified path, generate gdi.image() object, resize it, cache it, then return it.
// If path invalid or file corrupt, return nothing.
this.GetImg = function (path, dstW, dstH, NoCache) {
if (!path) return;
var imgobj;
if (!NoCache && ImgsCache)
imgobj = ImgsCache.SearchFor(path, dstW, dstH);

if (imgobj) {
if (typeof(imgobj)!="object") imgobj = null; // Maybe it's a boolean value.
} else {
if (path.charAt(0)=="<") // Embed image.
imgobj = utils.GetAlbumArtEmbedded(path.substring(1, path.length-1), 0);
else
imgobj = gdi.image(path);

var srcW, srcH;
if (imgobj) {
srcW = imgobj.width;
srcH = imgobj.height;
if (dstW && dstH) {
var size = CalcNewImgSize(imgobj, dstW, dstH);
imgobj = ResizeImg(imgobj, size.width, size.height);
}
}
// Store every path, even no valid image exists.
ImgsCache && ImgsCache.Store(path, imgobj, srcW, srcH);
}

if (imgobj)
return imgobj;
};

this.ClearCache = function () {
ImgsCache && ImgsCache.Clear();
};

} (Properties);

var GetImg = ImageLoader.GetImg;


//====================================================
// Define Path Checker =====================================
/* Find matches image files in directorys. It contains a paths cache.
Primarily provides the "GetImgPaths()" method */
var PathChecker = new function (Prop, ImgLoader) {
var FSO = Prop.Panel.FSO;
var ImgSrcFmt = Prop.Image.SourceFormat;
var ImgSrcStr = "";
var SupportTypes = Prop.Image.SupportTypes;
var MaxFileSize = Prop.Image.MaxFileSize;
var CycleInWildCard = Prop.Cycle.CycleInWildCard;
var GetEmbedImg = ImgLoader;
var FoundFiles = new Array;
var PathsArray;
var PathCacheCapacity = Prop.Image.PathCacheCapacity;

if (PathCacheCapacity) {
// This cache array is similar to the images cache array.
var PathsCache = new Array;
PathsCache.FSO = FSO;

PathsCache.cacheItem = function (path, files) {
this.Path = path; // String.
this.MatchFiles = files; // Must an array, path array.
};

for (var i=0; i<PathCacheCapacity-1; i++)
PathsCache.push(new PathsCache.cacheItem(null, null))

PathsCache.remove = RemoveFromArray;

// Duplicate item will be overwritten.
PathsCache.Store = function (path, files) {
var c;
if (this.SearchFor(path))
this[0].MatchFiles = files;
else if (c = this.pop()) {
c.Path = path;
c.MatchFiles = files;
this.unshift©;
}
};

// Search in cache, returns the search result, and move it to the beginning of the cache array.
// All files in result array will be checked before return, if one or more files doesn't exist, remove this item and return nothing.
// If no result found, return nothing.
PathsCache.SearchFor = function (path) {
var i = 0;
for (i; i<this.length; i++)
if (this[i].Path==path)
break;

if (i<this.length) {
var c = this.remove(i);
var rslt = c.MatchFiles;

for (var j=0; j<rslt.length; j++) // Check whether all the files are exist.
if (!this.FSO.FileExists(rslt[j])) {
c.Path = null;
this.push©;
return;
}

this.unshift©;
return rslt;
}
};

PathsCache.Clear = function () {
for (var i=0; i<this.length-1; i++) {
this[i].Path = null;
this[i].MatchFiles = null;
}
};
}

// Union Array2 into Array1.
var unionArray = function (Array1, Array2 ) {
var seen = {};
for (var i=0; i<Array1.length; i++)
seen[Array1[i]] = true;
for (var i=0; i<Array2.length; i++)
if (!seen[Array2[i]])
Array1.push(Array2[i]);
};

// Calculate ImageSourceFormat, and replace <embed> with <rawpath>.
var CalcPathFmt = function (pathfmt, metadb) {
if (metadb)
var paths =  fb.TitleFormat(ImgSrcFmt).EvalWithMetadb(metadb)
else
var paths =  fb.TitleFormat(ImgSrcFmt).Eval();
paths = paths.replace(/<embed>/gi, "<"+metadb.RawPath+">");
return paths;
};

// Check file type and file size.
var IsFilePropOK = function (file) {
var ext = FSO.GetExtensionName(file).toLowerCase();
for (var i=0; i<SupportTypes.length; i++) {
if (ext==SupportTypes[i] && (MaxFileSize<=0 || file.Size<=MaxFileSize))
return true;
}
return false;
};

// Find matches image files in "ImgSrc", cache relational paths, return the valid paths array.
// If "ImgSrc" has nothing changed, return the previous array directly.
// If no valid path found, return an empty array.
this.GetImgPaths = function (metadb) {
var newsrc = CalcPathFmt(ImgSrcFmt, metadb);
if (newsrc==ImgSrcStr)
return FoundFiles; // If the source format has nothing changed, return the previous results directly.
else
ImgSrcStr = newsrc;

PathsArray = ImgSrcStr.split("||");
var NewFoundFiles = new Array;

for (var i=0; i<PathsArray.length; i++) {
var Path = PathsArray[i];
var SearchResults = PathsCache ? PathsCache.SearchFor(Path) : null;
if (!SearchResults) {
SearchResults = new Array;
var EmbedPath = Path.match(/<.*>/);
if (EmbedPath) { // Check embed cover.
EmbedPath = EmbedPath.toString();
if (GetEmbedImg(EmbedPath))
SearchResults.push(EmbedPath);
} else if (Path.indexOf("*")==-1 && Path.indexOf("?")==-1) { // If not wildcard exist.
if (!FSO.FileExists(Path)) continue;
SearchResults.push(Path);
} else { // Search in wildcard.
var foldername = FSO.GetParentFolderName(Path);
if (!FSO.FolderExists(foldername)) continue;

if (CycleInWildCard) {
// Check file type and size first -----------------
var ValidFiles = PathsCache ? PathsCache.SearchFor(foldername+"\\*") : null; // Search in cache first.
if (!ValidFiles) {
ValidFiles = new Array;
var e = new Enumerator(FSO.GetFolder(foldername).Files);
for (; !e.atEnd(); e.moveNext()) {
var file = e.item();
if (IsFilePropOK(file))
ValidFiles.push(file.Path);
}
PathsCache && PathsCache.Store(foldername+"\\*", ValidFiles); // Store this step's result in cache.
}
// Then match wildcard ------------------
var exp = FSO.GetFileName(Path);
if (exp!="*" && exp!="*.*") {
for (var j=0; j<ValidFiles.length; j++) {
if (utils.PathWildcardMatch(exp, FSO.GetFileName(ValidFiles[j])))
SearchResults.push(ValidFiles[j]);
}
} else
SearchResults = ValidFiles;

} else {
var exp = FSO.GetFileName(Path);
var e = new Enumerator(FSO.GetFolder(foldername).Files);
for (; !e.atEnd(); e.moveNext()) {
var file = e.item();
if (IsFilePropOK(file) && utils.PathWildcardMatch(exp, file.Name)) {
SearchResults.push(file.Path);
break; // One file per path is enough.
}
}
}
}
PathsCache && PathsCache.Store(Path, SearchResults); // Store search results for this path.
}
// Merge these files of this path into the final results, duplicate files will only keep one.
unionArray(NewFoundFiles, SearchResults);
}

if (NewFoundFiles.join()!=FoundFiles.join()) // If the result has nothing changed, return the previous results directly.
FoundFiles = NewFoundFiles;
CollectGarbage(); // Release memory.
return FoundFiles;
};

this.ClearCache = function () {
PathsCache && PathsCache.Clear();
ImgSrcStr = "";
};

} (Properties, GetImg);

var GetImgPaths = PathChecker.GetImgPaths;


//====================================================
// Define Display Style =====================================
/* Define style, display image and animation.
Primarily provides the "ChangeImage()" method */
var Display = new function (Prop, ImgLoader) {
this.margin = {top: 0, left: 0, bottom: 0, right: 0};
this.x = this.margin.left;
this.y = this.margin.top;
this.width;
this.height;
var FSO = Prop.Panel.FSO;
var EnableFading = Prop.Cycle.Animation.Enable;
var RefreshInterval = Prop.Cycle.Animation.RefreshInterval;
var step = Math.min(Math.ceil(255*RefreshInterval/Prop.Cycle.Animation.Duration),255);
var DefaultImg = gdi.image(Prop.Image.DefaultImagePath);
var ext = FSO.GetExtensionName(Prop.Image.DefaultImagePath).toLowerCase();
var DefaultRaw = null;
if (DefaultImg && ext!="png" && ext!="gif")
DefaultRaw = DefaultImg.CreateRawBitmap();
var ImgPath = null;
var CurImage = DefaultImg;
var CurRaw = DefaultRaw;
var CurSize = null;
var NewImage = null;
var NewSize = null;
var CanBeCreateRaw = true;
var opacity = 255;
var timer = null;

if (ImgLoader)
var GetImg = ImgLoader;
else
var GetImg = function () {
return gdi.image(path);
};

// Change now displaying image to the new one.
// "path" is a string object, or empty.
// When "path" is empty, means change to style default image (DefaultImg).
// "GroupChanged" means "GroupFormat" calculate result changes.
this.ChangeImage = function (path, GroupChanged) {
if (path==ImgPath) return;
ImgPath = path;
var newimg;
if (ImgPath) {
newimg = GetImg(ImgPath, this.width, this.height);
var ext = FSO.GetExtensionName(ImgPath).toLowerCase();
CanBeCreateRaw = ext!="png" && ext!="gif";
} else
newimg = DefaultImg;

if (EnableFading) {
if (NewImage) {
CurImage = NewImage;
//CurRaw = NewImage==DefaultImg ? DefaultRaw : (CanBeCreateRaw ? CurImage.CreateRawBitmap() : null);
CurSize = NewSize;
opacity = 255;
}
NewImage = newimg;
NewSize = CalcNewImgSize(NewImage, this.width, this.height);
if (!timer) timer = window.CreateTimerInterval(RefreshInterval);
} else {
CurImage = newimg;
CurRaw = ImgPath ? (CanBeCreateRaw ? CurImage.CreateRawBitmap() : null) : DefaultRaw;
CurSize = CalcNewImgSize(CurImage, this.width, this.height);
window.RepaintRect(this.x, this.y, this.width, this.height);
}
};

this.Refresh = function () {
if (ImgPath) {
CurImage = GetImg(ImgPath, this.width, this.height, true); // Get image bypass cache.
if (CurRaw) CurRaw = CurImage.CreateRawBitmap();
} else {
DefaultImg = gdi.image(Prop.Image.DefaultImagePath);
DefaultRaw = DefaultImg.CreateRawBitmap();
CurImage = DefaultImg;
CurRaw = DefaultRaw;
}
if (CurImage)
CurSize = CalcNewImgSize(CurImage, this.width, this.height);
if (NewImage)
NewSize = CalcNewImgSize(NewImage, this.width, this.height);
window.Repaint();
};

this.OnPaint = function (gr) {
var Img, size;
if (Img = CurImage) {
size = CurSize;
if (opacity==255 && CurRaw)
// This funtion is much more faster.
gr.GdiDrawBitmap(CurRaw, this.x+size.x, this.y+size.y, size.width, size.height, 0, 0, Img.width, Img.height);
else
gr.DrawImage(Img, this.x+size.x, this.y+size.y, size.width, size.height, 0, 0, Img.width, Img.height, 0, opacity);
}
if (Img = NewImage) {
size = NewSize;
gr.DrawImage(Img, this.x+size.x, this.y+size.y, size.width, size.height, 0, 0, Img.width, Img.height, 0, 255-opacity);
}
};

this.OnTimer = function (id) {
if (timer && id==timer.ID) {
if (opacity>0) {
opacity = Math.max(opacity-step,0);
window.RepaintRect(this.x, this.y, this.width, this.height);
} else {
CurImage = NewImage;
CurRaw = ImgPath ? (CanBeCreateRaw ? CurImage.CreateRawBitmap() : null) : DefaultRaw;
CurSize = NewSize;
NewImage = null;
NewSize = null;
opacity = 255;
timer && window.KillTimer(timer);
timer = null;
CollectGarbage(); // Release memory.
//window.RepaintRect(this.x, this.y, this.width, this.height);
}
}
};

this.OnResize = function (ww, wh) {
this.width = ww-this.margin.left-this.margin.right;
this.height = wh-this.margin.top-this.margin.bottom;

if (ImgPath) {
CurImage = GetImg(ImgPath, this.width, this.height);
if (CurRaw) CurRaw = CurImage.CreateRawBitmap();
}
if (CurImage)
CurSize = CalcNewImgSize(CurImage, this.width, this.height);
if (NewImage)
NewSize = CalcNewImgSize(NewImage, this.width, this.height);
};

} (Properties, GetImg);


//====================================================
// Define Main Controler ====================================
/* Main controler of the panel,
controls images loading, changing, cycle, and paths checking */
var Controler = new function (Prop, GetImgPaths, Dsp) {
var CycleEnabled = Prop.Cycle.Enable;
this.CycleActivated = false;
var CyclePeriod = Prop.Cycle.Period;
var GroupFmt = Prop.Image.GroupFormat;
var GroupStr = null;
var ImgPaths = null;
this.CurImgPath = null;
var CurImgIdx = 0;
this.Paused = window.GetProperty("Cycle.Paused", !CycleEnabled);
var timer = null;
var _this = this;

var ChangeImg = function (arg, GroupChanged) {
switch (arg) {
case 2: // Last
CurImgIdx = ImgPaths.length-1;
break;
case 1: // Next
CurImgIdx = CurImgIdx+1<ImgPaths.length ? CurImgIdx+1 : 0;
break;
case -1: // Previous
CurImgIdx = CurImgIdx-1>=0 ? CurImgIdx-1 : ImgPaths.length-1;
break;
case -2: // First
CurImgIdx = 0;
break;
default: // Default
arg = 0;
}
var path = arg ? ImgPaths[CurImgIdx] : null;
toDefault(path ? false : true);

if (!GroupChanged && path==_this.CurImgPath)
return;
else
_this.CurImgPath = path;

Dsp.ChangeImage(_this.CurImgPath, GroupChanged);
};

var ResetTimer = function () {
if (!timer) return;
window.KillTimer(timer);
timer = window.CreateTimerInterval(CyclePeriod);
CollectGarbage(); // Release memory.
};

this.Play = function () {
this.Paused = false;
window.SetProperty("Cycle.Paused", this.Paused);
if (!this.CycleActivated) return;
if (!timer) timer = window.CreateTimerInterval(CyclePeriod);
};

this.Pause = function (p) {
if (!p) {
this.Paused = true;
window.SetProperty("Cycle.Paused", this.Paused);
}
if (!this.CycleActivated) return;
if (timer) {
window.KillTimer(timer);
timer = null;
CollectGarbage(); // Release memory.
}
};

this.Next = function () {
if (!this.CycleActivated) return;
ResetTimer();
ChangeImg(1);
};

this.Previous = function () {
if (!this.CycleActivated) return;
ResetTimer();
ChangeImg(-1);
};

this.First = function () {
if (!this.CycleActivated) return;
ResetTimer();
ChangeImg(-2);
};

this.Last = function () {
if (!this.CycleActivated) return;
ResetTimer();
ChangeImg(2);
};

this.OnNewTrack = function (metadb, followcur) {
var NewImgPaths = GetImgPaths(metadb);
if (metadb)
var groupstr = fb.TitleFormat(GroupFmt).EvalWithMetadb(metadb)
else
var groupstr = fb.TitleFormat(GroupFmt).Eval();

if (GroupStr!=groupstr) {
GroupStr = groupstr;
var IsNewGroup = true;
} else
var IsNewGroup = false;

if (ImgPaths!=NewImgPaths || IsNewGroup) {
ImgPaths = NewImgPaths;
if (ImgPaths.length<=1)
SetCycleStatus(false);
else
SetCycleStatus(CycleEnabled);
ResetTimer();
ChangeImg(-2, IsNewGroup);
}

if (followcur && Prop.Cycle.AutoPauseWhenFollowCursor) {
this.Pause(true);
if (CurImgIdx!=0)
ChangeImg(-2);
} else
!this.Paused && this.Play();
};

this.OnStop = function (reason) {
timer && window.KillTimer(timer);
if (reason<=1)
ChangeImg();
if (reason!=2) {
this.Pause(true);
SetCycleStatus(false);
ImgPaths = null;
this.CurImgPath = null;
CurImgIdx = 0;
GroupStr = null;
}
};

this.OnTimer = function (id) {
if (timer && id==timer.ID)
this.Next();
};

} (Properties, GetImgPaths, Display);


//====================================================
// Define Control Buttons ===================================
/* All button's funtions are calls of Controler's method */
if (Properties.Buttons.Display && Properties.Cycle.Enable) {
var Buttons = new function (Prop, Ctrl) {
var BtnDir = Prop.Panel.WorkDirectory + "Buttons\\";
var lang = Prop.Panel.lang;
var Position = Prop.Buttons.Position;
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
var opacity = 0;
var defaultOp = 150;
var hbtn = null;
var dbtn = null;
var timer = null;
var RefreshInterval = 50;
var step = 40;
var dstOp = 0;
var _this = this;
this.BtnsArray = new Array();

// Define button class ------------------------------------------------
var Button = function (x, y, img, OnClick, tiptext) {
this.x = x;
this.y = y;
this.width = img.width/4;
this.height = img.height;
this.Img = img;
this.tiptext = tiptext;
this.state = 3; // 0=normal, 1=hover, 2=down, 3=disabled
this.enabled = false;
this.OnClick = OnClick;
var Tooltip = Prop.Panel.Tooltip;

this.isXYinBtn = function (x, y) {
if (!this.enabled) return false;
return (x >= this.x && y >= this.y && x<= this.x + this.width && y <= this.y + this.height) ? true : false;
};

this.Draw = function (gr, op) {
if (!opacity) return;
gr.DrawImage(this.Img, this.x, this.y, this.width, this.height, this.state*this.Img.width/4, 0, this.width, this.height, 0, opacity);
};

this.ChangeState = function (s, enabled) {
//if (!this.enabled && !enabled) return;
if (enabled===undefined) {
if (s==this.state)
return;
else
this.state = s;
} else {
this.enabled = enabled;
this.state = enabled ? 0 : 3;
}
if (s==1) {
Tooltip.Text =  this.tiptext;
Tooltip.Activate();
} else
Tooltip.Deactivate();
if (opacity)
window.RepaintRect(this.x, this.y, this.width, this.height);
};
};

// Create buttons --------------------------------
var img_play = gdi.image(BtnDir+"Play.png");
var img_pause = gdi.image(BtnDir+"Pause.png");
var img_next = gdi.image(BtnDir+"Next.png");
var img_prev = gdi.image(BtnDir+"Prev.png");
var xOffset = this.x;
this.BtnsArray.push(new Button(xOffset, this.y, img_prev, function(){Ctrl.Previous();}, lang=="cn" ? "上一张图片" : "Previous Image"));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;
this.BtnsArray.push(PlayBtn = new Button(xOffset, this.y, img_play, function(){SetPauseStatus(Ctrl.Paused)}, ""));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;
this.BtnsArray.push(new Button(xOffset, this.y, img_next, function(){Ctrl.Next();}, lang=="cn" ? "下一张图片" : "Next Image"));
xOffset += this.BtnsArray[this.BtnsArray.length-1].width;

PlayBtn.tiptext_play = lang=="cn" ? "循环封面" : "Cycle Covers";
PlayBtn.tiptext_pause = lang=="cn" ? "暂停循环" : "Pause Cycle";
PlayBtn.tiptext = Ctrl.Paused ? PlayBtn.tiptext_play : PlayBtn.tiptext_pause;
PlayBtn.img_pause = img_pause;
PlayBtn.img_play = img_play;
PlayBtn.Img = Ctrl.Paused ? PlayBtn.img_play : PlayBtn.img_pause;
PlayBtn.ChangeState(null, true);
this.PlayBtn = PlayBtn;

this.width = xOffset-this.x;
this.height = PlayBtn.height;
//---------------------------------------
this.SetCycleStatus = function (s) {
this.BtnsArray[0].ChangeState(null, s);
this.BtnsArray[2].ChangeState(null, s);
};

this.SetPauseStatus = function (s) {
if (s) {
PlayBtn.Img = PlayBtn.img_pause;
PlayBtn.tiptext = PlayBtn.tiptext_pause;
} else {
PlayBtn.Img = PlayBtn.img_play;
PlayBtn.tiptext = PlayBtn.tiptext_play;
}
};

var isXYinBtns = function (x, y) {
return (x >= _this.x && y >= _this.y && x<= _this.x + _this.width && y <= _this.y + _this.height) ? true : false;
};

var Fading = function (dstop) {
if (dstOp==dstop) return;
dstOp = dstop;
if (!timer) timer = window.CreateTimerInterval(RefreshInterval);
};

this.OnPaint = function (gr) {
if (!opacity) return;
for (var i=0; i<this.BtnsArray.length; i++)
this.BtnsArray[i].Draw(gr, opacity);
};

this.OnMouseMove = function (x, y) {
if (isXYinBtns(x, y)) {
if (opacity!=255) {
dstOp = 255;
opacity = 255;
window.RepaintRect(this.x, this.y, this.width, this.height);
}
} else if (opacity!=defaultOp)
Fading(defaultOp);

if (dbtn) {
if (dbtn.isXYinBtn(x, y))
dbtn.ChangeState(2);
else
dbtn.ChangeState(1);
} else {
for (var i=0; i < this.BtnsArray.length ; i++)
if (this.BtnsArray[i].isXYinBtn(x,y)) {
if (hbtn!=this.BtnsArray[i]) {
if(hbtn) hbtn.ChangeState(0);
hbtn = this.BtnsArray[i];
hbtn.ChangeState(1);
}
break;
}
if (i==this.BtnsArray.length) {
if (hbtn) {
hbtn.ChangeState(0);
hbtn = null;
}
}
}
};

this.OnLbtnDown = function (x, y) {
if (hbtn) {
dbtn = hbtn;
dbtn.ChangeState(2);
}
};

this.OnLbtnUp = function (x, y) {
if (dbtn) {
if (dbtn.state==2) {
dbtn.OnClick();
dbtn.ChangeState(1);
}
dbtn = null;
this.OnMouseMove(x, y);
}
};

this.OnMouseLeave = function () {
Fading(0);
if (hbtn) {
hbtn.ChangeState(0);
hbtn = null;
}
};

this.OnTimer = function (id) {
if (timer && id==timer.ID) {
if (opacity==dstOp) {
timer && window.KillTimer(timer);
timer = null;
CollectGarbage(); // Release memory.
//window.RepaintRect(this.x, this.y, this.width, this.height);
} else {
if (opacity<dstOp)
opacity = Math.min(opacity+step, dstOp);
else
opacity = Math.max(opacity-step, dstOp);
window.RepaintRect(this.x, this.y, this.width, this.height);
}
}
};

this.OnResize = function (ww, wh) {
if (Position==1 || Position==4)
this.x = (ww-this.width)/2;
else if (Position==2 || Position==5)
this.x = ww-this.width;

if (Position>2)
this.y = wh-this.height;

var x = this.x;
for (var i=0; i<this.BtnsArray.length; i++) {
this.BtnsArray[i].x = x;
x += this.BtnsArray[i].width;
this.BtnsArray[i].y = this.y;
};
this.width = x-this.x;
};

} (Properties, Controler);

} else
var Buttons = {};


//====================================================
// Functions Menu ========================================
var FuncMenu = new function (Prop, Ctrl, Dsp, Btns, ImgLoader, ImgFinder) {
// Flags ----------
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;

var lang = Prop.Panel.lang;
var ItemList = {};
var ItemID = 1;

var BuildMenu = function (items) {
var menu = window.CreatePopupMenu();
var mf, id, radio;
for (var i=0; i<items.length; i++) {
mf =  items[i].Flag || MF_STRING;
id = items[i].ID || ItemID++;
menu.AppendMenuItem(mf, id, items[i].Caption);
if (i==items.Radio)
radio = id;
ItemList[id] = items[i];
}
radio && menu.CheckMenuRadioItem(1, items.length, radio);
return menu;
};

// Submenu: Follow Cursor -------------------------
var Menu_FC_Items = new Array(
{
Caption: lang=="cn" ? "仅在非播放时" : "Only when not playing",
Func: function(){
if (Prop.Panel.FollowCursor==1) return;
Prop.Panel.FollowCursor = 1;
window.SetProperty("Panel.FollowCursor", 1);
Menu_FC_Items.Radio = 0;
if (fb.IsPlaying)
on_playback_new_track(fb.GetNowPlaying());
else
on_item_focus_change(fb.GetFocusItem());
RebuildMenu();
}
},
{
Caption: lang=="cn" ? "总是" : "Always",
Func: function(){
if (Prop.Panel.FollowCursor==2) return;
Prop.Panel.FollowCursor = 2;
window.SetProperty("Panel.FollowCursor", 2);
Menu_FC_Items.Radio = 1;
on_item_focus_change(fb.GetFocusItem());
RebuildMenu();
}
},
{
Caption: lang=="cn" ? "从不" : "Never",
Func: function(){
if (Prop.Panel.FollowCursor==0) return;
Prop.Panel.FollowCursor = 0;
window.SetProperty("Panel.FollowCursor", 0);
Menu_FC_Items.Radio = 2;
if (fb.IsPlaying)
on_playback_new_track(fb.GetNowPlaying());
else
on_playback_stop(0);
RebuildMenu();
}
}
);
var fc = Prop.Panel.FollowCursor;
Menu_FC_Items.Radio = fc==1 ? 0 : fc==2 ? 1 : fc==0 ? 2 : null;
var Menu_SubItem_FC = {
Flag: MF_POPUP,
Caption: lang=="cn" ? "光标跟随模式" : "Follow Cursor",
ID: null
}

// Submenu: Image Stretching ----------------------
var Menu_IS_Items = new Array(
{
Flag: Prop.Image.Stretch ? MF_CHECKED : MF_UNCHECKED,
Caption: lang=="cn" ? "拉伸图像" : "Stretch Image",
Func: function(){
Prop.Image.Stretch = !Prop.Image.Stretch;
window.SetProperty("Image.Stretch", Prop.Image.Stretch);
this.Flag = Prop.Image.Stretch ? MF_CHECKED : MF_UNCHECKED;
Dsp && Dsp.Refresh();
RebuildMenu();
}
},
{
Flag: Prop.Image.KeepAspectRatio ? MF_CHECKED : MF_UNCHECKED,
Caption: lang=="cn" ? "保持比例" : "Keep Aspect Ratio",
Func: function(){
Prop.Image.KeepAspectRatio = !Prop.Image.KeepAspectRatio;
window.SetProperty("Image.KeepAspectRatio", Prop.Image.KeepAspectRatio);
this.Flag = Prop.Image.KeepAspectRatio ? MF_CHECKED : MF_UNCHECKED;
Dsp && Dsp.Refresh();
RebuildMenu();
}
}
);
var Menu_SubItem_IS = {
Flag: MF_POPUP,
Caption: lang=="cn" ? "图像拉伸" : "Image Stretching",
ID: null
}

// Main menu --------------------------------
var Item_cycle = {
Flag: MF_ENABLED,
cap_play: lang=="cn" ? "继续循环" : "Resume Cycle",
cap_pause: lang=="cn" ? "暂停循环" : "Pause Cycle",
Caption: null,
Func: function () {Ctrl && SetPauseStatus(Ctrl.Paused);}
};
Item_cycle.Caption = Ctrl.Paused ? Item_cycle.cap_play : Item_cycle.cap_pause;

var Item_VWEV, Item_OIF;
var Menu_Items = new Array (
Item_cycle,
{
Flag: MF_GRAYED,
Caption: lang=="cn" ? "上一张图片" : "Previous Image",
Func: function(){Ctrl & Ctrl.Previous();}
},
{
Flag: MF_GRAYED,
Caption: lang=="cn" ? "下一张图片" : "Next Image",
Func: function(){Ctrl && Ctrl.Next();}
},
{
Flag: MF_GRAYED,
Caption: lang=="cn" ? "第一张图片" : "First Image",
Func: function(){Ctrl && Ctrl.First();}
},
{
Flag: MF_GRAYED,
Caption: lang=="cn" ? "最后一张图片" : "Last Image",
Func: function(){Ctrl && Ctrl.Last();}
},
//--------------------------------------------------------------
Item_VWEV = {
Flag: MF_GRAYED,
Caption: lang=="cn" ? "在外部查看器中查看" : "View With External Viewer",
Func: function(){
var path = Ctrl.CurImgPath;
if (!path) return;
if (path.charAt(0)=="<") {
fb.ShowPopupMessage(lang=="cn" ? "当前图片为内嵌图片,无法用外部查看器显示" : "This image is embed image, can't be displayed in external viewer", "WSH Cover Panel", 1);
return;
}
if (!Prop.Panel.ShellObj)
Prop.Panel.ShellObj= new ActiveXObject("Shell.Application");
Prop.Panel.ShellObj.ShellExecute('"' + path + '"', "", "", "open", 1);
}
},
Item_OIF = {
Flag: MF_GRAYED,
Caption: lang=="cn" ? "打开图片所在目录" : "Open Containing Folder",
Func: function(){
var path = Ctrl.CurImgPath;
if (!path) return;
if (path.charAt(0)=="<")
path = path.substring(1, path.length-1);
if (!Prop.Panel.ShellObj)
Prop.Panel.ShellObj= new ActiveXObject("Shell.Application");
Prop.Panel.ShellObj.ShellExecute("explorer", '/select,\"' + path + '"', "", "open", 1);
}
},
{
Flag: MF_SEPARATOR // Insert separator.
},
Menu_SubItem_IS // Insert "Image Stretching" submenu.
,
Menu_SubItem_FC // Insert "Follow Cursor" submenu.
,
{
Flag: MF_SEPARATOR
},
{
Caption: lang=="cn" ? "刷新图片" : "Refresh Image",
Func: function(){Dsp && Dsp.Refresh();}
},
{
Flag: (Prop.Image.ImageCacheCapacity || Prop.Image.PathCacheCapacity) ? MF_ENABLED : MF_GRAYED,
Caption: lang=="cn" ? "清除缓存" : "Clear Cache",
Func: function () {
ImgLoader && ImgLoader.ClearCache();
ImgFinder && ImgFinder.ClearCache();
CollectGarbage(); // Release memory.
}
},
{
Flag: MF_SEPARATOR
},
{
Caption: lang=="cn" ? "WSH Cover 参数设置..." : "WSH Cover Properties...",
Func: function(){window.ShowProperties();}
},
{
Caption: lang=="cn" ? "帮助..." : "Help...",
Func: function(){
var HelpFile = Prop.Panel.WorkDirectory + "WSH_Cover_Properties_Help.txt";
if (!Prop.Panel.FSO.FileExists(HelpFile)) {
fb.ShowPopupMessage(Prop.Panel.lang=="cn" ? "找不到 "+HelpFile+" 文件." : "Can not find file "+HelpFile+" .", "WSH Cover Panel", 1);
return;
}
var file = Prop.Panel.FSO.OpenTextFile(HelpFile, 1);
var txt = file.ReadAll();
fb.ShowPopupMessage(txt, "WSH Cover Panel", 2);
file.Close();
}
}
);

this.ViewWithExternalViewer = Item_VWEV.Func;
this.Menu_Items = Menu_Items;
var Menu, Menu_FC;

var RebuildMenu = function(){
ItemList = {};
ItemID = 1;
Menu_FC = BuildMenu(Menu_FC_Items);
Menu_SubItem_FC.ID = Menu_FC.ID;
Menu_IS = BuildMenu(Menu_IS_Items);
Menu_SubItem_IS.ID = Menu_IS.ID;
Menu = BuildMenu(Menu_Items);
};

this.RebuildMenu = RebuildMenu;
RebuildMenu();

this.Show = function (x, y) {
var ret = Menu.TrackPopupMenu(x, y);
if (ret!=0)
ItemList[ret].Func();
};

this.SetCycleStatus = function (s) {
for (var i=1; i<5; i++)
Menu_Items[i].Flag = s ? MF_ENABLED : MF_GRAYED;
RebuildMenu();
};

this.SetPauseStatus = function (s) {
if (s)
Item_cycle.Caption = Item_cycle.cap_pause;
else
Item_cycle.Caption = Item_cycle.cap_play;
RebuildMenu();
};

var IsDefaultImg = true;
this.toDefault = function (s) {
if (s==IsDefaultImg) return;
IsDefaultImg = s;
Item_VWEV.Flag = s ? MF_GRAYED : MF_ENABLED;
Item_OIF.Flag = s ? MF_GRAYED : MF_ENABLED;
RebuildMenu();
};

} (Properties, Controler, Display, Buttons, ImageLoader, PathChecker);


//====================================================
function SetCycleStatus (s) {
Controler.CycleActivated = s;
Buttons.SetCycleStatus && Buttons.SetCycleStatus(s);
FuncMenu && FuncMenu.SetCycleStatus(s);
};

function SetPauseStatus (s) {
if (s)
Controler.Play();
else
Controler.Pause();
Buttons.SetPauseStatus && Buttons.SetPauseStatus(s);
FuncMenu && FuncMenu.SetPauseStatus(s);
};

function toDefault (s) {
FuncMenu && FuncMenu.toDefault(s);
};


//====================================================
// BackGround ===========================================
var bgcolor = Properties.Panel.BackGroundColor;
if (bgcolor)
bgcolor = RGBA(bgcolor[0], bgcolor[1], bgcolor[2], bgcolor[3]);


//====================================================
//====================================================
function on_paint(gr){
gr.SetSmoothingMode(Properties.Image.SmoothingMode);
gr.SetInterpolationMode(Properties.Image.InterpolationMode);

if (bgcolor)
gr.FillSolidRect(0, 0, ww, wh, bgcolor);

Display.OnPaint && Display.OnPaint(gr);
Buttons.OnPaint && Buttons.OnPaint(gr);
}
function on_size(){
if (!window.Width || !window.Height) return;
ww = window.Width;
wh = window.Height;
Display.OnResize && Display.OnResize(ww, wh);
Buttons.OnResize && Buttons.OnResize(ww, wh);
}
// Track events ---------------------------------------------
function on_item_focus_change(){
if (fb.GetFocusItem() && (Properties.Panel.FollowCursor==2 || (Properties.Panel.FollowCursor==1 && !fb.IsPlaying)))
Controler.OnNewTrack && Controler.OnNewTrack(fb.GetFocusItem(), true);
}
function on_playback_new_track(metadb){
if (Properties.Panel.FollowCursor<=1)
Controler.OnNewTrack && Controler.OnNewTrack(metadb);
}
function on_playback_stop(reason){
var metadb = fb.GetFocusItem();
if (Properties.Panel.FollowCursor==0 || !metadb)
Controler.OnStop && Controler.OnStop(reason);
else if (Properties.Panel.FollowCursor==1 && reason!=2)
Controler.OnNewTrack && Controler.OnNewTrack(metadb, true);
}
// Mouse events --------------------------------------------
var rbtnDown, ShiftDown, mbtnDown;
function on_mouse_move(x,y){
Buttons.OnMouseMove && Buttons.OnMouseMove(x, y);
}
function on_mouse_lbtn_down(x,y){
Buttons.OnLbtnDown && Buttons.OnLbtnDown(x, y);
}
function on_mouse_lbtn_up(x,y){
Buttons.OnLbtnUp && Buttons.OnLbtnUp(x, y);
}
function on_mouse_leave(){
Buttons.OnMouseLeave && Buttons.OnMouseLeave();
}
function on_mouse_rbtn_down(x, y, vkey){
rbtnDown = true;
ShiftDown = vkey==6 ? true : false;
}
function on_mouse_rbtn_up(x, y, vkey){
if (!rbtnDown) return true;
rbtnDown = false;
if (ShiftDown)
return; // If shift key was pressed down, show default right click menu.
else {
FuncMenu.Show(x,y); // Show customize menu.
return true; // Disable default right click menu.
}
}
function on_mouse_mbtn_down(x, y, mask) {
mbtnDown = true;
}
function on_mouse_mbtn_up(x, y, mask) {
if (!mbtnDown) return;
FuncMenu.ViewWithExternalViewer();
mbtnDown = false;
}
function on_mouse_wheel(delta){
if (delta>0)
Controler && Controler.Previous();
else
Controler && Controler.Next();
}
//---------------------------------------------------------
function on_timer(id){
Controler.OnTimer && Controler.OnTimer(id);
Display.OnTimer && Display.OnTimer(id);
Buttons.OnTimer && Buttons.OnTimer(id);
}
http://maf.freedom-vrn.ru/Images.zip (http://maf.freedom-vrn.ru/Images.zip)
Title: WSH Panel Mod script discussion/help
Post by: aereogramme on 2010-05-10 13:02:12
I have used Songbird before and they have a add-on called MashTape.  I like the plugin and was wondering if there was a WSH script to get some similar functionality.

What I really like is the reviews.  Has anyone developed a script to pull down reviews from say AMG or something?

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2010-05-10 14:28:24
marc2003 an idea for a panel
Using http://www.youtube.com/rssls (http://www.youtube.com/rssls) to display popular videos (links to) in a panel.
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-05-11 14:23:38
Marc2003: I'm using your Now Playing - panel but it seems that autodownload doesn't work with artists with "&" in their names (like Emerson, Lake & Palmer). Is there any way to make this work besides copying the images manually from last.fm?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-05-11 15:25:03
there shouldn't be any problem with & in the artist name - i have plenty of images downloaded just fine.

i'm unable to test that artist because i'm running linux at the moment and WSH panel mod doesn't work in it.
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-05-11 15:40:23
there shouldn't be any problem with & in the artist name - i have plenty of images downloaded just fine.

i'm unable to test that artist because i'm running linux at the moment and WSH panel mod doesn't work in it.


I tried this with different artists, and it seems to retrieve anything before "&", for example "B.B. King & Eric Clapton" gets images from "B.B. King", "Echo & the bunnymen" downloads images from artist called "Echo" etc.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-05-11 16:06:42
i see. i'll take another look when i'm back on windows again.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-05-12 09:18:59
it was an old version of art.exe (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425&st=0) not handling the & that was the problem. but the author (paradog (http://www.hydrogenaudio.org/forums/index.php?showuser=53710)) has fixed it ages ago.

as before, you can't use that version as it will hang waiting for user input when the artist doesn't exist. so you'll need my modified version. i've updated my samples with it....

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-05-12 12:19:05
as before, you can't use that version as it will hang waiting for user input when the artist doesn't exist. so you'll need my modified version. i've updated my samples with it....


Much appreciated, works fine now.
Title: WSH Panel Mod script discussion/help
Post by: Joe30 on 2010-05-12 22:30:58
@marc2003: I just discovered your "now playing.txt" script. It is exactly what I was looking for:
- automatic artist images download
- and cycle them
- display the song infos on top of that

==> THANK YOU!
Title: WSH Panel Mod script discussion/help
Post by: metal_termite on 2010-05-13 21:21:22
How would I make a "text button," as in display a string that acts like a hyperlink button? I want to do something like this:

Quote
Now playing: Title (http://) by Artist (http://)


Where the Title is a text button for Quicksearch for Same / Title, and the Artist text button for Quicksearch for Same / Artist
Title: WSH Panel Mod script discussion/help
Post by: phunkydizco on 2010-05-15 20:33:52
Is it possible with WSH Panel Mod to change the active tab in CUI? I want to switch to my Now Playing Tab when playback starts.
Title: WSH Panel Mod script discussion/help
Post by: phunkydizco on 2010-05-20 09:15:07
I have two questions:

Is there a way to drop a shadow in real-time, without additional graphics?

How can I make the reflection effect seen in CUI playlist viewer?

I use gr.GdiDrawBitmap for displaying album art at the moment.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2010-06-04 05:58:32
i'm having problems with the rating script in marc2003's sample package.
it shows my track ratings just fine, but i can't set them. clicking on stars has no effect.
i have foo_playcount installed...

any thoughts?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-06-04 06:43:32
check "playback statistics" is enabled on your context menu.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2010-06-04 08:08:13
that fixes it, thanks!
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2010-06-04 09:50:10
another question for you, marc2003

in this post you put up a script for a button that tags tracks with %love%
http://www.hydrogenaudio.org/forums/index....st&p=685807 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=685807)

but it uses foo_customdb. is there a way to have a Love button like this that actually writes to the tag?

i use quick tagger right now to set %love% to 1 or 0 with keyboard shortcuts, but would like to have a button too.

thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-06-04 11:19:40
use that same script on pastebin but change

line 29:
func = function() { g_metadb.UpdateFileInfoSimple("love", ''); }

line 34:
func = function() { g_metadb.UpdateFileInfoSimple("love", 1); }
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2010-06-04 11:31:57
cool, thanks 
Title: WSH Panel Mod script discussion/help
Post by: Sinusoid on 2010-06-05 21:00:15
Hello, everyone.  I am very new to creating WSH panel mod scripts.  I've managed to read enough to learn how to make a working volume and playback slider so I have a basic understanding of how things work but I'm trying to create a track info "ticker" that scrolls the now playing info across a window (not bounce back and forth) and it seems to be quite a bit more complicated.  I'm not asking for someone to do my work for me, I'm just hoping someone could point me/tell me if I'm headed in the right direction as far as how I might go about creating this.  Anyways, here are my attempts to understand how I might go about doing this:

on a new track, use this titleformatting script of the now playing item as a string "%track% - %artist% - %album%"  and constantly make it scroll to the right by 1px increments
get the last character of the string
get the width of the last character of the string
delete the last character of the string
insert the last character of the string at beginning when the string has been scrolled to the right a distance equal to the width of the last character which was just deleted

To instruct the info to be gathered each time a new track is played I know I'll need to use: function on_playback_new_track(metadb) {}

I will need to update these variables each time the string is scrolled a distance equal to the width of the last character (I am going to use "hello" as an example string because I am unsure of how to get the "%track% - %artist% - %album%" of the currently playing track at the moment).

var ww = window.Width;
var wh = window.Height;
var txt = "hello"
var lastpos = txt.length-1;   
var info = txt.replace(txt.charAt(-1), txt.charAt(lastpos));
var info_new = info.slice(0, -1)

I don't think I've got this quite right yet but this is the effect I want to acheive:

hello
then "hello" continues to scroll to the right until the o is no longer visible in the window at which time it will be inserted before h...
ohell
then "ohell" continues to scroll to the right until the l is no longer visible in the window at which time it will be inserted before o...
lohel

etc...

What I DON'T want is for it to happen like this:

hello
ohell
oohell
ooohell

etc...

Maybe I'm going about this task completely wrong and you know a much more simple way.  In that case I'd love to hear it.  Thanks
Thank you so much for any advice.
Title: WSH Panel Mod script discussion/help
Post by: 2E7AH on 2010-06-05 21:20:49
here is one example: http://www.hydrogenaudio.org/forums/index....st&p=670657 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=670657)
Title: WSH Panel Mod script discussion/help
Post by: Sinusoid on 2010-06-05 21:55:41
Thanks.  I saw one similar to that but the one thing I wanted to do differently is to have it scroll in just one direction over and over again.  I might be wrong, but it seems like achieving this would require something very different than how the script does it there.

Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-06-06 23:10:06
Maybe you looking something like this?




Code: [Select]
function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

var g_font = gdi.font("Tahoma", 24, 0);
var g_timer;
var i = 0;
var interval = 20;
var tw = 0;

function on_paint(gr) {

    gr.SetTextRenderingHint(5);

    var text = fb.TitleFormat("%title% - %artist% - %album%").Eval();

    tw = gr.CalcTextWidth(text, g_font);

    if (fb.IsPlaying) {

        if (g_timer) {

            gr.GdiDrawText(text, g_font, RGB(0, 0, 0), ww - i, 20, ww + tw, g_font.height + 5, format = 0)

        }

    }
}

function on_timer(id) {

    i = i + 1 * 1;
    if (i == ww + tw) i = 0;
    window.RepaintRect(ww - i -10, 17, tw + 20, g_font.height + 6);

}

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

   
        if (i == ww + tw) i = 0;
        if (i == 0) g_timer = window.CreateTimerInterval(interval);
   
}

function on_playback_new_track() {

    i = 0;
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: Sinusoid on 2010-06-07 02:45:06
Thank you so much, ExtremeHunter!  Hahaha I can't believe I how complicated my ideas were compared to this. 

While I was trying to figure out how to get the automated scrolling, i managed to modify one of the wsh panel mod samples so that it allows the info to be dragged horizontally back and forth in case the window isn't displaying all of the text.  I'm sure there is a better way of doing this too but I thought I'd share it since it took me so much work to figure out (you'll probably notice some strange things going on here since i'm not very experienced, but it works just fine):

Code: [Select]
var DT_VCENTER = 0x00000004;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_SINGLELINE = 0x00000020;
var DT_END_ELLIPSIS = 0x00008000;
var DT_WORD_ELLIPSIS = 0x00040000;

var g_text;
var g_font = gdi.Font("Tahoma", 10);
var ww = 0, wh = 0;
var g_textcolor = 0xff787878;
var g_need_calc = true;
var g_textheight = 0;
var g_offset = 0;
var g_drag = false;
var g_drag_x = 0;
var g_textwidth;
var title_tf =  fb.TitleFormat("%title%");
var album_tf = fb.TitleFormat("%album%");
var artist_tf = fb.TitleFormat("%artist%");
var title;
var album;
var artist;


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

if(fb.IsPlaying) on_playback_new_track();

function on_playback_new_track(){
    g_metadb = fb.GetNowPlaying();
artist = artist_tf.EvalWithMetadb(g_metadb);
title = title_tf.EvalWithMetadb(g_metadb);
album = album_tf.EvalWithMetadb(g_metadb);
}

function on_paint(gr) {
    g_text = title + " - " + artist  + " - " + album;
    g_textwidth = gr.CalcTextWidth(g_text, g_font);
    if (g_need_calc) {
        calc();
    } else {
            if(fb.IsPlaying) {
        gr.GdiDrawText(g_text,g_font, g_textcolor, g_offset, 1, ww - g_offset, wh, DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
            }
        }
}

function on_mouse_lbtn_down(x) {
    g_drag = true;
    g_drag_x = x;
}

function on_mouse_lbtn_up(x) {
    g_drag = false;
    g_offset=0;
    window.Repaint();
}

function on_mouse_move(x) {
    if (g_drag) {
        applyDelta(x - g_drag_x);
        g_drag_x = x;
    }
}

function calc() {
    var temp_bmp = gdi.CreateImage(1, 1);
    var temp_gr = temp_bmp.GetGraphics();
    arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_SINGLELINE | DT_CALCRECT | DT_NOPREFIX).toArray();
    g_offset = 0;
    g_need_calc = false;
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
    temp_gr = null;
    temp_bmp = null;
    window.Repaint();
}

function applyDelta(delta) {
    var temp = g_offset + delta;
    if ((temp <= ww / 2) && (temp >= ww / 2  - g_textwidth)) {
        g_offset = temp;
        window.Repaint();
    }
}

function reset() {
    g_need_calc = true;
    g_offset = 0;
}
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-06-11 08:01:48
Gentlemen, I wonder if any of you good scripters might be up to a bit of a challenge?

I've seen quite a few nice title bar panels throughout the thread, but I don't quite have the knowledge to figure out exactly what I need to make this work.

First of all, here's a picture of my setup:

(http://img38.imageshack.us/img38/7632/foobarsetup.jpg)

What I'd like is a panel that replicates the behavior of titlebar (highlighted in red), but better. Perhaps having the time segment permantly placed at the left hand side without having to make two seperate panels as in this instance. I also wouldn't mind having color controls over different parts of the tag information.


But anyway, I realize this isn't a request thread, but if anyone has a script that might help me get started, please let me know. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-06-11 13:33:37
Gentlemen, I wonder if any of you good scripters might be up to a bit of a challenge?

I've seen quite a few nice title bar panels throughout the thread, but I don't quite have the knowledge to figure out exactly what I need to make this work.

First of all, here's a picture of my setup:

(http://img38.imageshack.us/img38/7632/foobarsetup.jpg)

What I'd like is a panel that replicates the behavior of titlebar (highlighted in red), but better. Perhaps having the time segment permantly placed at the left hand side without having to make two seperate panels as in this instance. I also wouldn't mind having color controls over different parts of the tag information.


But anyway, I realize this isn't a request thread, but if anyone has a script that might help me get started, please let me know. Thanks.

maybe a easy task?
what's the current panel that shows time and info now?looks so bad
if my brain works,i guess what you want is a panel which can show the info and time in fixed places.
pin out your idea in a picture to let me get the right idea in your brain.....or what you want is just a WSH panel which can realize the effect in your current photo?
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-06-11 16:00:10
Gentlemen, I wonder if any of you good scripters might be up to a bit of a challenge?

I've seen quite a few nice title bar panels throughout the thread, but I don't quite have the knowledge to figure out exactly what I need to make this work.

First of all, here's a picture of my setup:

. And like I said, I'd also love if it had $rgb support.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-06-12 07:03:01
here you go-

Code: [Select]
function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}

var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_END_ELLIPSIS = 0x00008000;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;

var ww = 0, wh = 0;

var g_textcolor = RGB(19,240,236);
var g_backcolor = RGB(0,0,0);
var g_font = gdi.Font("Segoe UI", 26,1);

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    if(fb.IsPlaying) {
        gr.GdiDrawText(fb.TitleFormat("%playback_time%[ / %length%]").Eval(), g_font, g_textcolor, 0, 0, 250, wh, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(fb.TitleFormat("[%tracknumber% [/ %totaltracks% ]- ]%title%").Eval(), g_font, g_textcolor, 250, 0, ww-270, wh, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
    }
}

function on_playback_new_track() {
    window.Repaint();
}

function on_playback_stop(reason) {
if(reason != 2) window.Repaint();
}

function on_playback_time() {
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-06-12 08:28:40
I love you 
Title: WSH Panel Mod script discussion/help
Post by: Fabio258 on 2010-06-13 11:47:46
Maybe you looking something like this?

Hello ExtremeHunter, I have this old script that is a scrollbar with now playing info. It works well (for me) except for the scroll speed that is very slow. Do you think that your script can be adapted to this? Or you know another way to make this modify? I'm not a programmer so I don't know how to make working changes 
Many thanks in advance
Fabio

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( "bitstream vera sans mono",40);
var g_font1 = gdi.Font( "bitstream vera sans mono",40);
var g_timeFmt = fb.TitleFormat("%playback_time%[ / %length%]");
var g_titleFmt = fb.TitleFormat("%ARTIST% - %title%");
var g_fileinfo = null;

var g_drag = 0;
var g_drag_seek = 0;

var tic_ArtistAlbumText= { size:26, step:1};
var tic_SongTimeText= { size:20, step: 2};
resetTics();

function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var pos = 0;
var length = fb.PlaybackLength;
var songTimeText;
var artistAlbumText;
if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
songTimeText= "Seek " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
} else{
pos = window.Width * (fb.PlaybackTime / length);
songTimeText= g_timeFmt.Eval();
artistAlbumText = g_titleFmt.Eval();
}
}

gr.FillGradRect(  0, 0,    pos, wh, 90, RGB(5,150,35), RGB(5,100,35)); //green scroll
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(0,0,0), RGB(0,0,0)); //black background

if(artistAlbumText==null) artistAlbumText= "";
gr.DrawString(getScrolledText(artistAlbumText, tic_ArtistAlbumText), g_font, RGB(255,255,255), 0, 0, ww, wh, StrFmt(align_left, align_center, trim_no, flag_nowrap | flag_noclip));

if(songTimeText==null) songTimeText= "";
gr.DrawString(getScrolledText(songTimeText, tic_SongTimeText), g_font1, RGB(255,255,255), 0, 0, ww, wh, StrFmt(align_right, align_center, trim_no, flag_nowrap | flag_noclip));
}

function getScrolledText(txt,tic) {
if(txt.length<=tic.size)
return txt;
if(tic.val>=(txt.length+tic.spacer.length))
tic.val= 0;
else
tic.val+= tic.step;
return (txt+tic.spacer+txt).substring(tic.val, tic.val+tic.size);
}

function resetTics() {
tic_ArtistAlbumText.val=0;
tic_ArtistAlbumText.spacer= "";
for(var i=0; i<=(tic_ArtistAlbumText.size/2); i++) tic_ArtistAlbumText.spacer+=' ';
tic_SongTimeText.val=0;
tic_SongTimeText.spacer= "";
for(var i=0; i<=(tic_SongTimeText.size/2); i++) tic_SongTimeText.spacer+=' ';
}

function on_size(){
resetTics();
}

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){
resetTics();
}
function on_playback_new_track(info){
resetTics();
window.Repaint();
}
function on_playback_stop(){
resetTics();
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
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-06-14 05:19:35
@Fabio258


Well your scroll uses per second window update and mine uses different timing, so they cannot be overlaped like this, but i made a little compromise  . It's a quick and ugly hack but ...


link (http://pastebin.com/MTpeeKRs)
Title: WSH Panel Mod script discussion/help
Post by: Fabio258 on 2010-06-14 06:25:18
@Fabio258


Well your scroll uses per second window update and mine uses different timing, so they cannot be overlaped like this, but i made a little compromise  . It's a quick and ugly hack but ...


link (http://pastebin.com/MTpeeKRs)


Many thanks, but it returns me this error:
Error: WSH Panel Mod (GUID: 97DC514D-0A5C-4D8F-875B-57D83D56C051): Errore di compilazione di Microsoft JScript:
Errore di sintassi
Ln: 242, Col: 7
      else

 

Fabio
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-06-14 08:29:42
How is that possible? There is only 206 lines in the script and your error is in line 242. 
Title: WSH Panel Mod script discussion/help
Post by: Fabio258 on 2010-06-14 19:54:15
How is that possible? There is only 206 lines in the script and your error is in line 242. 


I'm sorry, my mistake, having hurry to try before going to work, I didn't realize that copying and pasting the script had been added strange characters. 
Now it works fine.  I'm sorry that it's not possible to group all in one line because I use a seven inch touch screen monitor and have optimized the layout for this size, but obviously I can't have everything. 

Thanks again

Fabio
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-06-24 12:25:24
samples updated:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a new script that displays thumbnails of images in a folder.


-no support for scrolling in thumbnail view if you have too many images to fit in the panel (in full view, you can use the mouse wheel to scroll through all images)
-it chokes a bit if you have a folder full of lots of large images
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2010-07-03 17:26:49
Hello

I'm trying to open album art with default Windows image viewer using wscript.shell. For some reason I get "source text only available in compile time" error with below script. g_metadb is defined.
Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");
var img_path = fb.titleformat("$replace(%path%,%filename_ext%,front.jpg)").EvalWithMetadb(g_metadb);

function(){WshShell.run("file://" + img_path);}

I tested a simple version (below) which works fine, so problem is with img_path variable. Also seems to work without "file://".
Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");

function(){WshShell.run("file://C:/1.png");}
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2010-07-03 19:14:51
Just a little update with my problem. Figured WScript.Shell doesn't like backslashes or spaces. img_path.replace(/\\/g, "/") sorted the slashes but I have no clue what to do with spaces. Googleing suggested using double or triple quotes but these give errors in wsh panel.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-07-03 22:10:50
Maybe this helps.

Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");

function on_mouse_lbtn_dblclk() {

    g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

    var img_path = fb.titleformat("$replace(%path%,%filename_ext%,front.jpg)").EvalWithMetadb(g_metadb);

    try {
        WshShell.Run("\"" + img_path + "\"");
    } catch (e) {};

}
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2010-07-04 09:41:46
Thanks "\"" + img_path + "\"" worked
Title: WSH Panel Mod script discussion/help
Post by: MB. on 2010-07-08 18:38:33
[a href="http://matthijsb.deviantart.com/art/foo-silk-4-0-beta-4-170546750" target="_blank"]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-09 15:25:23
i've updated my scripts with some last.fm charts as well....

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

(http://k5sbdw.blu.livefilestore.com/y1pHULdeilWf2E7ivYcLNqXXY1_Y5o9eMVLsY3_EQe5EthfocPbttGVRSBGHhgd_-jPTmPNN3YYviNqAJLw3rBCmQIBHxjifpaj/lastfm%20charts.png)

features:

click the last.fm logo in the top right to switch between artist, album and track. you can also change the period.
the text is clickable and it will open the corresponding page in your web browser
the artist charts have "play" buttons which will launch last.fm radio directly in foobar (requires foo_lastfm radio (http://www.unkempt.co.uk/fb2k/foo_lastfm_radio.html))
charts update once a day but you can force an update using the context menu if you really must
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-10 20:37:18
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

just a bug fix for the last.fm charts - they'd never update automatically as i got my cached file age calculation wrong. 
Title: WSH Panel Mod script discussion/help
Post by: Wooops on 2010-07-18 02:04:10
I´m trying to add some fields and edit a little this track info script (http://www.hydrogenaudio.org/forums/index.php?showtopic=79057&st=0&p=714222&#entry714222), thanks Hitchhiker427 and Marc2003 for the code! and I kind a need some help...

I´m using the line "playback = fb.TitleFormat("%playback_time%").EvalWithMetadb(g_metadb);" along with the gr.GdiDrawText one
to display the playback time but it always shows up "?".

Also how can I align the text to the left instead of using the "center of the word/field" so that I can align all the info such as playback time, bitrate, etc in the left like using a tab? Maybe replacing the "DT_CENTER" value?

Is it possible as well, to display the sample rate "in the natural behavior" like %filesize_natural% such that if it´s "48000 Hz" it displays "48 Khz" and what´s the syntax of the volume say in db to display it too? I couldn´t find it in the help files.

Here´s what I´m using:
Code: [Select]
var image_path = fb.FoobarPath + "colores personalizados\\";
var g_img = gdi.Image(image_path + "Fondo Azul.bmp");
var background_width = 220;
var background_height = 300;
var artist = title = album = track = '';
var bgcolor = RGB(238,246,253);
var textcolor1 = RGB(249, 249, 249);
var textcolor2 = RGB(249, 249, 249);
var font1 = gdi.Font("Segoe UI", 14, 1);
var font2 = gdi.Font("Segoe UI", 14, 1);
var font3 = gdi.Font("Segoe UI", 10, 0);


DT_CENTER = 0x00000001;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;
g_metadb = fb.GetFocusItem();
on_item_focus_change();

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, bgcolor);
gr.DrawImage(g_img, 0, 0, ww, wh, 0, 0, background_width, background_height);
if(g_metadb) {
gr.GdiDrawText(title, font1, textcolor1, 0, 0, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
gr.GdiDrawText(artist, font2, textcolor2, 0, 17, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
gr.GdiDrawText(album, font3, textcolor2, 0, 40, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
gr.GdiDrawText(track, font3, textcolor2, 0, 50, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
gr.GdiDrawText(channels, font3, textcolor2, 148, 3, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
gr.GdiDrawText(playback, font3, textcolor2, 144, 16, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
gr.GdiDrawText(bitrate, font3, textcolor2, 155, 29, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
gr.GdiDrawText(samplerate, font3, textcolor2, 155, 42, ww, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}
}

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

function on_metadb_changed() {
artist = fb.TitleFormat("$replace([%artist%],_, )$replace($stripprefix($substr([%title%],1,$sub($strstr(%title%,-),2)),-),_, )").EvalWithMetadb(g_metadb);
title = fb.TitleFormat("$replace($stripprefix($substr([%title%],$strstr(%title%,-),1000),-),_, )").EvalWithMetadb(g_metadb);
album = fb.TitleFormat("[%album%] ['('%date%')']").EvalWithMetadb(g_metadb);
track = fb.TitleFormat("[Track # %tracknumber%]").EvalWithMetadb(g_metadb);
playback = fb.TitleFormat("%playback_time%").EvalWithMetadb(g_metadb);
channels = fb.TitleFormat("%channels%").EvalWithMetadb(g_metadb);
bitrate = fb.TitleFormat("%bitrate% Kbps").EvalWithMetadb(g_metadb);
samplerate = fb.TitleFormat("%samplerate% Hz").EvalWithMetadb(g_metadb);
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
on_metadb_changed();
window.WatchMetadb(g_metadb);
}
}

function on_playback_new_track() {
on_item_focus_change();
}
Thanks!
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-07-18 07:40:07
@Wooops:
For the playback time, try using "playback = fb.TitleFormat("%playback_time%").Eval()". 

For left aligning, try just removing DT_CENTER altogether... I think that will work. 

Next, I'm not sure what to do about the natural sample rate.  I'm almost sure that there's an easy way to do it.  However, here's a brute-force method.  This will get the job done, but hopefully someone can post something more efficient:
Code: [Select]
sample_rate = fb.TitleFormat("%samplerate%").Eval();
if(sample_rate.substring(sample_rate.length - 3, sample_rate.length) == "000") sample_rate = sample_rate.substring(0,sample_rate.length - 3);
else {
    sample_rate = sample_rate.substring(0,sample_rate.length - 3) + "." + sample_rate.substring(sample_rate.length - 3,sample_rate.length);
    if(sample_rate.substring(sample_rate.length - 1, sample_rate.length) == "0") sample_rate = sample_rate.substring(0, sample_rate.length - 1);
    if(sample_rate.substring(sample_rate.length - 1, sample_rate.length) == "0") sample_rate = sample_rate.substring(0, sample_rate.length - 1);
}
sample_rate = sample_rate + " kHz";

Finally, the volume is just "fb.Volume"

----------

Now, I have a question for myself.  I'm trying out Columns UI, and I'm just wondering if there's a way to show/hide panels with WSH Panel Mod.  If so, how would I go about doing that?  I know this is possible with PSS, but I'm unfamiliar with that scripting language, and would prefer to use WSH Panel Mod if at all possible.  Thanks.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-07-18 11:01:40
@Hitchhiker427

or just

sample_rate = fb.TitleFormat("%samplerate%").Eval();

gr.GdiDrawText(sample_rate/1000+" kHz", font, textcolor, 155, 42, ww, 24, 0);


----------

Now, I have a question for myself. I'm trying out Columns UI, and I'm just wondering if there's a way to show/hide panels with WSH Panel Mod. If so, how would I go about doing that? I know this is possible with PSS, but I'm unfamiliar with that scripting language, and would prefer to use WSH Panel Mod if at all possible. Thanks.

---------

I don't think that can be done without PSS.





Title: WSH Panel Mod script discussion/help
Post by: Wooops on 2010-07-19 08:19:05
@Hitchhiker427
uh well I had been playing... The playback and the volume show up, but they don´t get updated  I´ve to manually refresh* the panel each time...
and with the volume I used the code from another sample to limit the decimals "volume = fb.TitleFormat(Math.ceil(fb.volume)+" dB").EvalWithMetadb(g_metadb); though It would be better with two decimals as F2K does.

Also I realized that sometimes the title overlapped the right side info, so I limited it´s width "gr.GdiDrawText(title, font1, textcolor1, 0, 0, 305, 24, D.." but then the title is no longer centered so I created a "DT_CENTER2" for the title, with no luck with the values so far.

Quote
"For left aligning, try just removing DT_CENTER altogether... I think that will work."

Removing it worked perfectly  and both sample rate script works great too.

Thanks for the help.

Edit: In asking there´s no trick so I wonder is it possible to move the title to the bottom (more centered) when there´s no album or track info?
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-19 09:33:30
samples updated:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a new script that displays thumbnails of images in a folder.


-no support for scrolling in thumbnail view if you have too many images to fit in the panel (in full view, you can use the mouse wheel to scroll through all images)
-it chokes a bit if you have a folder full of lots of large images


Great!
There is some request.
1. Multiple folder support.
2. Image size fit to panel size.
3. External viewer launch mode.
4. Thumbs centering.(now exist rest on right)
5. Glow effect.
6. Thumbs size editing.

Of course, It is not compulsion.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-19 12:18:39
1) done, just remember it will be slow if you have too many images. use | to separate folders in custom folder dialog box.
2) there was already an option to fill the panel (with cropping). you can untick the "Fill" context menu item to show the whole image.
3) done
4) already does??
5) not really sure what you mean by this??
6) i haven't added an option for editing as such but i've added some choices for size on the context menu.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-19 15:00:17
^i just re-uploaded because i totally fudged the multiple folder support. it should work now. 
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-19 15:08:04
1) done, just remember it will be slow if you have too many images. use | to separate folders in custom folder dialog box.
2) there was already an option to fill the panel (with cropping). you can untick the "Fill" context menu item to show the whole image.
3) done
4) already does??
5) not really sure what you mean by this??
6) i haven't added an option for editing as such but i've added some choices for size on the context menu.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)


Oh..., Thank you!!! 

1. How I can Limit number of image each folder?
or..., Is it possible add paging function same as google image search?
And 'slow' mean inside WSH Panel Mod panel? or affect fb2k playback?
2. I see. Thank you.
3. Thank you.
4. Umm, Like iTunes grid view, it is centering total.
5. I'm sorry. misstake. "glass effect" is correct. like cd art display skins.
Also I thinking reflection effect.(like iTunes cover flow.)
6. Thank you.

There is new ideas.
7. If panel area is spacious, Thumbs and big image show same time.
8. Use concurrent Last.fm artist art mode and Custom folder mode.
Now I operate "set 'data_folder + $crc32(%artist%)' to Custom folder->get lastfm image->set custom folder mode".
9. "Open this image" assign to Middle click.
10. Edit Last.fm artist art download folder path.
I want use like this.
C:\Image\Artist\$replace(%artist%,\,-,/,-,:,-,*,-,?,-,",-,<,-,>,-,|,-)\

Well, please develop and maintain this script.

You may not do all.
You need not conform to these.
Of course, you can say "Do it yourself.". 

^i just re-uploaded because i totally fudged the multiple folder support. it should work now. 

OK. Thank you.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-19 17:47:00
1) it only slows down the panel. you might find clicking on an image to "maximise" it is slow. and also scrolling images if they are too many to fit in the panel can also be slow. i might think about adding pagination support.
5) if you have an overlay image i could use, i could add it....
7) & 8) maybe i'll think about it.
9) done. download again using the link above
10) you can change the path used by last.fm mode by editing the title formatting on line 83.
Title: WSH Panel Mod script discussion/help
Post by: Wooops on 2010-07-20 03:44:23
I´ve got the playback and volume refreshing adding
Code: [Select]
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;

gr.GdiDrawText(fb.TitleFormat("%playback_time%").Eval(), font3, textcolor2, 310, 16, ww, 24, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(fb.TitleFormat(Math.ceil(fb.volume)+" dB").Eval(), font3, textcolor2, 307, 29, ww, 24, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);

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_volume_change(val) {
window.Repaint();
}
Solved the position of the title too.
About moving the title to the bottom when there´s no album/track. I tried this:
Code: [Select]
g_metamiss = fb.TitleFormat("(%album% MISSING) AND (%tracknumber% MISSING)");
g_metahas = fb.TitleFormat("(%album% PRESENT) OR (%tracknumber% PRESENT)");

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, bgcolor);
gr.DrawImage(g_img, 0, 0, ww, wh, 0, 0, background_width, background_height);
if(g_metadb) {
if(g_metahas) {
gr.GdiDrawText(title, font1, textcolor1, 0, 0, 305, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}
if(g_metamiss) {
gr.GdiDrawText(title, font1, textcolor1, 0, 30, 305, 24, DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}
It displays two titles and not sure what to do/try next. Help is appreciated. btw if the questions are too silly just point me to the documentation/samples. Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-20 07:48:00
you're trying to use query stuff like MISSING / PRESENT in standard title formatting and you can't do that. have a look at $meta and $meta_test

http://wiki.hydrogenaudio.org/index.php?ti...ence#Metadata_2 (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference#Metadata_2)
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-20 15:44:49
1) it only slows down the panel. you might find clicking on an image to "maximise" it is slow. and also scrolling images if they are too many to fit in the panel can also be slow. i might think about adding pagination support.
5) if you have an overlay image i could use, i could add it....
7) & 8) maybe i'll think about it.
9) done. download again using the link above
10) you can change the path used by last.fm mode by editing the title formatting on line 83.


Thank you very much.

1) I see. another idea: Like autopagerize.(userscript on modern browser. auto addition page when scroll.)
5) I have some overlay image. but these are small on maximized image. umm.
I do not think glass effect are necessary.
But now this script gui appearance is very simplicity.(Yes, I know this is sample script.)
I may want little decorate.
9) Thank you.
10) OK. but I hope this script get function that use custom folder and lastfm artist image simultaneous.

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: Empty_45 on 2010-07-23 13:47:57
Hello everybody,

I would like to understand more how works WSH Panel Mod and I'm trying to understand some scripts. I would like to do a button that fade on and out, between normal and hover state. I would like to know if someone has a "little" script in order to do that ? I found some ideas in Br3tt skin, but a little help would be welcome !

Thanks !
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-07-23 15:44:12
Take a look to my Duifoon (http://browse.deviantart.com/customization/skins/media/foobar2000/#/d2u7d16) button scritpts, you may get some ideas. I have there image and text button script with fading effect.
Title: WSH Panel Mod script discussion/help
Post by: Empty_45 on 2010-07-23 15:50:01
Thank you, I will take a look !
Title: WSH Panel Mod script discussion/help
Post by: Empty_45 on 2010-07-24 09:32:07
Would like to know if it is possible to do something like this : Create buttons in PSS and I would like to make a border that will fade around that button with WSH.

I have found how to draw my button in front of the WSH panel. Here is my code for the WSH panel

Code: [Select]
var g_foc = 0;

function on_paint(gr){
    
    if(g_foc){
        gr.FillSolidRect(0,0,window.Width,window.Height,RGB(0,0,0));
    }
    else {  
        gr.FillSolidRect(0,0,window.Width,window.Height,RGB(100,100,100));      
    }
}
    
function on_mouse_move(x,y){
    g_foc = 1;
        window.Repaint();
}

function on_mouse_leave(x,y){
   if(g_foc){
        g_foc = 0;
        window.Repaint();
        }
    }


I wanted just for a test make the WSH panel become black when the mouse pass on and grey when it is not focused.

Here is what I have first:
(http://img38.imageshack.us/img38/5757/27491813.jpg)
When the mouse is on the WSH panel (it works fine)
(http://img192.imageshack.us/img192/7329/16045676.jpg)
But when the mouse focused the button in PSS, the WSH panel seems to not be still focused.
(http://img341.imageshack.us/img341/4824/40592805.jpg)
So my question, is it possible that the WSH panel is still focused (so black) when the button is pointing ?
Title: WSH Panel Mod script discussion/help
Post by: morphguy12 on 2010-07-28 02:36:38
Hey guys,
This is my work in progress, right now it is currently 3 WSH panels,  I will eventually merge them into 1 hopefully soon.

One question, I put both Similar Artist & Rating codes together, and I can't figure out how to isolate the RATING button click to just the stars area.
Whenever I click in the panel, the star rating will correspond with the X axis position, so clicking on the similar artists doesn't go to their last.fm website.

(http://img525.imageshack.us/img525/9213/sidebar1r.jpg)

The code is a little messy, let me know if you need more details, since I hope to release this DUI eventually.

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\simple_buttons.js"
// @import "%fb2k_path%scripts\utils.js"
// @import "%fb2k_path%scripts\marc2003\v2\common.js"
// ==/PREPROCESSOR==

function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
var bw = 13;
var bh = 13;
var left_margin = 48;
var top_margin = 89;
var Buttons;
var g_metadb;
var section = "SIMILARPANEL";
var rating;
var nrating;
var lrating;
var img;
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);
var g_drag = 0;
var g_tfo = fb.TitleFormat("%rating%");
var artist = ""
var album = ""
var title = ""
var codec = ""
var bitrate = ""
var played = ""
var codecprofile = ""
var played = ""
var genre = ""
var lastartist = ""
var lastplay = ""
var rating = ""
var last1 = ""
var last2 = ""
var last3 = ""
var last4 = ""
var playing = "0"
var playcount = "0";
var year = 0;
var date = 0;
var difyear = 0;
var date2 = 0;
var avgdate = 0;
var difdate = 0;
var today = 0;
var ar_days = 0;
var ar_years = 0;
var ar_days2 = 0;
var ar_years2 = 0;
var ar_days3 = 0;
var ar_years3 = 0;
var ar_days4 = 0;
var ar_years4 = 0;
var bitrate = 0;
var days = 0;
var hours = 0;
var minutes = 0;
var seconds = 0;
var on_playback_new_track2 = 0;
var playcount = "0";
var playcount2 = 0;
var playcount3 = 0;
var playcount4 = 0;
var avgplaycount = 0;
var minplaycount = 0;
var maxplaycount = 0;
var ranplaycount = 0;
var devplaycount = 0;
var test = 0;
var test2 = 0;
var dui = window.InstanceType;

var g_font = dui == 1 ? window.GetFontDUI(0) : window.GetFontCUI(0);
//var color = RGB(200,0,0);
var color = dui == 1 ? window.GetColorDUI(2) : RGB(200,0,0);
//var color2 = RGB(0,0,0);
var color2 = dui == 1 ? window.GetColorDUI(0) : window.GetColorCUI(0);
var color3 = RGB(255,99,71);

//global Variables for text field
var DT_TOP = 0x00000000;
var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_BOTTOM = 0x00000008;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_EXPANDTABS = 0x00000040;
var DT_TABSTOP = 0x00000080;
var DT_NOCLIP = 0x00000100;
var DT_EXTERNALLEADING = 0x00000200;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_INTERNAL = 0x00001000;
var DT_EDITCONTROL = 0x00002000;
var DT_PATH_ELLIPSIS = 0x00004000;
var DT_END_ELLIPSIS = 0x00008000;
var DT_MODIFYSTRING = 0x00010000;
var DT_RTLREADING = 0x00020000;
var DT_WORD_ELLIPSIS = 0x00040000;
var DT_NOFULLWIDTHCHARBREAK = 0x00080000;
var DT_HIDEPREFIX = 0x00100000;
var DT_PREFIXONLY = 0x00200000;
var defaultartistimage = "";
var lastfmdatapath = "";
var g_tooltip = window.CreateTooltip();
var g_down = false;
var timer = null;
var btn_down = null;
var cur_btn = null;
var ww = window.Width;
var wh = window.Height;
window.GetProperty("currentArtists", "");
window.GetProperty("bio_played", "");


function reloadConf(inipath)
{
skinpath = translatePath(utils.ReadINI(inipath, "SKIN", "imgpath", ""),true);
window.GetProperty("buttons.show", utils.ReadINI(inipath, section, "showbuttons", "0"));
window.GetProperty("buttons.list", utils.ReadINI(inipath, section, "buttons", ""));
window.GetProperty("font.name", utils.ReadINI(inipath, section, "fontname", "Segoe UI"));
window.GetProperty("font.size", utils.ReadINI(inipath, section, "fontsize", "10"));
window.GetProperty("buttons.width", utils.ReadINI(inipath, section, "buttonswidth", "110"));
window.GetProperty("buttons.height", utils.ReadINI(inipath, section, "buttonsheight", "38"));
lastfmdatapath = translatePath(utils.ReadINI(inipath, "LASTFM", "datapath"),true);
updateButtons();

}

reloadConf(inipath);


function on_script_unload()
{
utils.WriteINI(inipath, section, "showbuttons", window.GetProperty("buttons.show"));
utils.WriteINI(inipath, section, "buttons", window.GetProperty("buttons.list"));
utils.WriteINI(inipath, section, "fontname", window.GetProperty("font.name"));
utils.WriteINI(inipath, section, "fontsize", window.GetProperty("font.size"));
utils.WriteINI(inipath, section, "buttonswidth", window.GetProperty("buttons.width"));
utils.WriteINI(inipath, section, "buttonsheight", window.GetProperty("buttons.height"));
}

function ArtistButton(x, y, w, h, img, func, tiptext, url)  {
this.left = x;
this.top = y;
this.w = w;
this.h = h;
this.right = x + w;
this.bottom = y + h;
this.func = func;
this.tiptext = tiptext;
this.url = url;
this.font = gdi.Font(window.GetProperty("font.name"), window.GetProperty("font.size"), 0);
this.color = RGB(255,255,255);
this.state = ButtonStates.normal;
this.img= img;

this.lastfmcommand = url;

this.alterImage = function(img_src) {
this.img= img_src ? gdi.Image(img_src) : null;

this.changeState(this.state);
}

this.traceMouse = function (x, y) {
var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);
if (b)
g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
else
this.changeState(ButtonStates.normal);
return b;
}


this.changeState = function (newstate) {
if (newstate != this.state)
window.RepaintRect(this.left, this.top, this.w, this.h);
this.state = newstate;
switch (this.state)
{
case ButtonStates.normal:
this.font = gdi.Font(window.GetProperty("font.name"), window.GetProperty("font.size"), 0);
this.color = RGB(255,255,255);
break;

case ButtonStates.hover:
case ButtonStates.down:
this.font = gdi.Font(window.GetProperty("font.name"), window.GetProperty("font.size"), 4);
this.color = RGB(0,92,185);
break;

default:
this.img = null;
}
}



this.draw = function (gr) {

gr.DrawRect(this.left, this.top, this.h,  this.h, 1.0, RGB(170,170,170));

this.img && gr.DrawImage(this.img, this.left + 2, this.top + 2, this.h -3, this.h -3, 0, 0, Math.min(this.img.Width,  this.img.Height), Math.min(this.img.Width,  this.img.Height));
gr.GdiDrawText(this.tiptext, this.font, this.color,  this.left + this.h + 3, this.top + 3, this.w - this.h - 3 , this.h -3, DT_VCENTER | DT_NOPREFIX | DT_WORDBREAK|DT_END_ELLIPSIS);
}

this.onClick = function () {
this.func && this.func(x,y);
}

  this.onRightClick = function (x,y)
{
var _menu = window.CreatePopupMenu();
var idx;
var buttontocreate = window.GetProperty("buttons.list").split(";");
var numbersearchengines = 0;
  if (buttontocreate != null)
  {
for (var i in buttontocreate)
{
var text = getWebServiceName(buttontocreate[i], this.tiptext);
if (text != "")
{
_menu.AppendMenuItem(MF_STRING, numbersearchengines +1, text);
numbersearchengines += 1;
}
}
numbersearchengines += 1;
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
}
_menu.AppendMenuItem(MF_STRING,  numbersearchengines + 1, "Update LastFM data");
_menu.AppendMenuItem(MF_SEPARATOR,  numbersearchengines + 2, 0);
_menu.AppendMenuItem(MF_STRING, numbersearchengines + 3,  getWebServiceName("lastfmsimilarradio", this.tiptext));
_menu.AppendMenuItem(MF_SEPARATOR, numbersearchengines + 4, 0);
_menu.AppendMenuItem(MF_STRING,  numbersearchengines +5, "Properties");
//_menu.AppendMenuItem(MF_STRING, 7, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if (idx <= numbersearchengines)
{
launchWebService(buttontocreate[idx - 1], this.tiptext);
}
else if (idx == numbersearchengines + 1)
{
window.NotifyOthers("ask_lastfm_data", "");
}
else if (idx ==  numbersearchengines + 3)
{
launchWebService("lastfmsimilarradio", this.tiptext);
}
else
{
window.ShowProperties();
}
_menu.Dispose();
}

this.onMouseIn = function() {
g_tooltip.Text = this.tiptext;
g_tooltip.Activate();
}

this.onMouseOut = function() {
g_tooltip.Deactivate();
}
}

function buttonsDraw(gr) {
for (i in Buttons) {
Buttons[i].draw(gr);
}
}

function buttonsTraceMouse(x, y) {
var btn = null;
for (i in Buttons) {
if (Buttons[i].traceMouse(x, y) && !btn)
btn = Buttons[i];
}

return btn;
}

function on_timer(id) {
if (timer && id==timer.ID) {
updateButtons();
timer && window.KillTimer(timer);
timer = null;
CollectGarbage(); // Release memory.
}
}

function on_mouse_move(x, y) {
var btn = buttonsTraceMouse(x, y);

if (btn != cur_btn) {
cur_btn && cur_btn.onMouseOut();
btn && btn.onMouseIn();
}

cur_btn = btn;
}

function on_mouse_lbtn_down(x, y) {
if (g_metadb) {
g_drag = 1;
nrating = Math.ceil((x - left_margin) / bw);
if (nrating > 5) nrating = 5;
if (nrating != lrating) {
lrating = nrating;
window.Repaint();
}
}


g_down = true;
btn_down = cur_btn;
if (cur_btn) {
cur_btn.changeState(ButtonStates.down);
}
}

function on_mouse_lbtn_up(x, y, mask) {
if (mask & MK_SHIFT)
{
window.ShowConfigure();
}
else
{
if (cur_btn) {
cur_btn.changeState(ButtonStates.hover);
if( btn_down == cur_btn )
cur_btn.onClick(x, y);
}
g_down = false;
}
}

function on_mouse_lbtn_up(x,y){
if (lrating !=rating && g_metadb) bool = fb.RunContextCommandWithMetadb("Rating/"+((lrating==0) ? "<not set>" : lrating),g_metadb);
}

function on_mouse_leave() {
on_metadb_changed()
if (cur_btn) {
cur_btn.changeState(ButtonStates.normal);
}
}

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

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

function on_metadb_changed() {
g_drag = 0;
rating = g_tfo.EvalWithMetadb(g_metadb);
if (rating == "?") rating = 0;
lrating = rating;
window.Repaint();
}

function on_paint(gr) {
// Background
gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));

buttons_background(gr);
if (g_metadb) {
for (i = 1; i < 6; i++) {
img = gdi.image(images_path + ((i > (g_drag ? lrating : rating)) ? "off.png" : "on.png"));
gr.DrawImage(img, left_margin + bw * (i-1), top_margin, bw, bh, 0, 0, img.Width, img.Height);
}
}
buttonsDraw(gr);

gr.GdiDrawText("Artist: " + artist, g_font, color, 5, 5, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
gr.GdiDrawText("Title: " + title, g_font, color, 5, 25, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
if (playing === 1){
gr.GdiDrawText("Album: " + album +" "  + "("+ date + ")", g_font, color, 5, 45, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
gr.GdiDrawText("Album:", g_font, color, 5, 45, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
gr.GdiDrawText("Genre: " + genre, g_font, color2, 5, 65, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
gr.GdiDrawText("Rating: ", g_font, color2, 5, 85, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
if (playing === 1){
  if (playcount === 0){
gr.GdiDrawText("Played: never", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
  if (playcount === 1){
gr.GdiDrawText("Played: " + playcount + " time", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
gr.GdiDrawText("Played: " + playcount + " times", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}}}
  else{
gr.GdiDrawText("Played:", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  if (playing === 1){
gr.GdiDrawText("Codec: " + codec +"-"+ codecprofile + " -- " + bitrate+" "+"Kbit/s", g_font, color2, 5, 125, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
gr.GdiDrawText("Codec:", g_font, color2, 5, 125, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  if (playing === 1) {
  if (Math.floor(ar_years) === 0) {
gr.GdiDrawText("Added: " + ar_days, g_font, color2, 5, 145, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
gr.GdiDrawText("Added: " + ar_days + " (" + Math.floor(ar_years) + " years)", g_font, color2, 5, 145, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
}
  else{
gr.GdiDrawText("Added:", g_font, color2, 5, 145, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  if (playing === 1){
  if (playcount === 0) {
gr.GdiDrawText("First Played: never", g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
gr.GdiDrawText("Last Played: never", g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
if (Math.floor(ar_years2) === 0) {
gr.GdiDrawText("First Played: " + ar_days2, g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
gr.GdiDrawText("First Played: " + ar_days2 + " (" + Math.floor(ar_years2) + " years) ", g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
if (Math.floor(ar_years3) === 0) {
gr.GdiDrawText("Last Played: "+ ar_days3, g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
gr.GdiDrawText("Last Played: "+ ar_days3 + " (" + Math.floor(ar_years3) + " years) ", g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
}}
  else{
gr.GdiDrawText("First Played:", g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
gr.GdiDrawText("Last Played:", g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
// gr.GdiDrawText("Artist Playcount: " + last1, g_font, color2, 5, 205, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
gr.GdiDrawText("Artist Listeners: " + last2, g_font, color2, 5, 235, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
gr.GdiDrawText("Album Playcount: " + last3, g_font, color2, 5, 255, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
  if (playing === 1){
gr.GdiDrawText("Artist Played: " + window.GetProperty("bio_played")+ " times", g_font, color2, 5, 205, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
  else{
gr.GdiDrawText("Artist Played:", g_font, color2, 5, 205, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
gr.GdiDrawText("Similiar Artists:", g_font, color2, 5, 285, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}



function on_notify_data(name, info)
{
switch (name)
{
case "lastfm_similarArtists":
window.SetProperty("currentArtists", info);
updateButtons();
break;
  case "config_updated":
  reloadConf(info);
break;
case "lastfm_bio":
var res = info.split("%separator%");

window.SetProperty("bio_played", res[2]);
if ( window.GetProperty("bio_played") == "")
{
window.SetProperty("bio_played","0");
}
window.Repaint();
default:
break;



}


}

function updateButtons() {
delete Buttons;
Buttons = null;
CollectGarbage(); // Release memory.

if(window.GetProperty("currentArtists") != "")
{
var x = 10;
var y = 310;
varartistsArray = window.GetProperty("currentArtists").split(";");
Buttons = new Array (varartistsArray.length);
var currentartist = "";
for (var i in varartistsArray)
{
switch (i % 2)
{
case 0:
currentartist = varartistsArray[i];
break;
case 1:
//skinpath
var currentartisturl =  varartistsArray[i];
if (currentartist != "")
{
var img =  gdi.Image(lastfmdatapath + ansi(currentartist) + "_small.jpg");

if(img == null)
{
img = gdi.Image(lastfmdatapath + ansi(currentartist) + "_small.png");
if(img == null)
{
img=  gdi.Image(lastfmdatapath + ansi(currentartist) + "_small.gif");
if(img == null)
{
img=  gdi.Image(skinpath + "Last.fm.small.png");
}
}
}
Buttons[i] = new ArtistButton(x, y, parseInt(window.GetProperty("buttons.width")), parseInt(window.GetProperty("buttons.height")), img, function(){WshShell.run(this.lastfmcommand);}, currentartist, currentartisturl);
if  (x + 2*window.GetProperty("buttons.width") + 5 > ww)
{
y = y + parseInt(window.GetProperty("buttons.height")) + 5;
x = 10;
}
else
{
x = x + parseInt(window.GetProperty("buttons.width")) + 5;
}
}
break;
}
}
}
window.Repaint();
}




function on_playback_new_track() {
on_playback_new_track2++;

artist = fb.Titleformat("%artist%").Eval();
album = fb.TitleFormat("%album%").Eval();
title = fb.TitleFormat("%title%").Eval();
genre = fb.Titleformat("%genre%").Eval();
codec = fb.Titleformat("%codec%").Eval();
bitrate = fb.Titleformat("%bitrate%").EvalWithMetadb(g_metadb); 
codecprofile = fb.Titleformat("%codec_profile%").Eval();
rating = fb.TitleFormat("$if(%rating%,$repeat($char(9733),%rating%),)").Eval();
last1 = fb.Titleformat("%lastfm_artist_playcount%").EvalWithMetadb(g_metadb);
last2 = fb.Titleformat("%lastfm_artist_listeners%").EvalWithMetadb(g_metadb); 
last3 = fb.Titleformat("%lastfm_album_playcount%").EvalWithMetadb(g_metadb); 
last4 = fb.Titleformat("%lastfm_album_listeners%").EvalWithMetadb(g_metadb); 
playing = 1;
playcount = fb.TitleFormat("%play_count%");
playcount = playcount.Eval();
playcount = parseInt(playcount);
playcount2 += playcount;
playcount4 += playcount;
playcount3 += (playcount * playcount);
if (on_playback_new_track2 === 1) {
minplaycount = playcount;
maxplaycount = playcount;
}

window.GetProperty("bio_played")

last1 = addCommas(last1)
last2 = addCommas(last2)
last3 = addCommas(last3)
last4 = addCommas(last4)

date = fb.TitleFormat("%date%");
date = date.Eval();
date = parseInt(date);
dt = new Date();
year = dt.getFullYear();
difyear = year - date;
date2 = date2 + date;
if (on_playback_new_track2 >= 2) {
avgdate = date2 / on_playback_new_track2;
avgdate = Math.round(avgdate);
difdate = year - avgdate;
}

today = new Date();
var fpy = fb.TitleFormat("$year(%added%)").Eval();
var fpm = fb.TitleFormat("$sub($month(%added%),1)").Eval();
var fpd = fb.TitleFormat("$day_of_month(%added%)").Eval();
var fday = new Date(fpy, fpm, fpd);
var one_day = 1000 * 60 * 60 * 24;
if (fday > 0) {
ar_days = Math.floor((today.getTime() - fday.getTime()) / one_day);
ar_years = ar_days / 365;
}
fpy = fb.TitleFormat("$year(%first_played%)").Eval();
fpm = fb.TitleFormat("$sub($month(%first_played%),1)").Eval();
fpd = fb.TitleFormat("$day_of_month(%first_played%)").Eval();
fday = new Date(fpy, fpm, fpd);
one_day = 1000 * 60 * 60 * 24;
if (fday > 0) {
ar_days2 = Math.floor((today.getTime() - fday.getTime()) / one_day);
ar_years2 = ar_days2 / 365;
} else {
ar_days2 = 0;
}

fpy = fb.TitleFormat("$year(%last_played%)").Eval();
fpm = fb.TitleFormat("$sub($month(%last_played%),1)").Eval();
fpd = fb.TitleFormat("$day_of_month(%last_played%)").Eval();
fday = new Date(fpy, fpm, fpd);
one_day = 1000 * 60 * 60 * 24;
if (fday > 0) {
ar_days3 = Math.floor((today.getTime() - fday.getTime()) / one_day);
ar_years3 = ar_days3 / 365;
} else {
ar_days3 = 0;
}

fpy = fb.TitleFormat("$year(%last_modified%)").Eval();
fpm = fb.TitleFormat("$sub($month(%last_modified%),1)").Eval();
fpd = fb.TitleFormat("$day_of_month(%last_modified%)").Eval();
fday = new Date(fpy, fpm, fpd);
one_day = 1000 * 60 * 60 * 24;
if (fday > 0) {
ar_days4 = Math.floor((today.getTime() - fday.getTime()) / one_day);
ar_years4 = ar_days4 / 365;
} else {
ar_days4 = 0;
}

if (ar_days === 0) {
ar_days = "today"
}
if (ar_days === 1) {
ar_days = "yesterday"
}
if (ar_days >>> 1) {
ar_days = ar_days + " days ago"
}

if (ar_days2 === 0) {
ar_days2 = "today"
}
if (ar_days2 === 1) {
ar_days2 = "yesterday"
}
if (ar_days2 >>> 1) {
ar_days2 = ar_days2 + " days ago"
}


if (ar_days3 === 0) {
ar_days3 = "today"
}
if (ar_days3 === 1) {
ar_days3 = "yesterday"
}
if (ar_days3 >>> 1) {
ar_days3 = ar_days3 + " days ago"
}

window.Repaint();
}




function on_playback_stop() {
artist = ""
album = ""
title = "" 
genre = ""
ar_days = 0;
ar_days2 = 0;
ar_days3 = 0;
ar_days4 = 0;
ar_years = 0;
ar_years2 = 0;
ar_years3 = 0;
ar_years4 = 0;
date = 0;
difyear = 0;
playcount = "";
last1 = "";
last2 = "";
last3 = "";
last4 = "";
rating = "";
bitrate = 0;
playing = 0;
window.Repaint();
}


function on_item_played() {
playcount++;
playcount4++;

if (on_playback_new_track2 === 1) {
minplaycount = playcount;
maxplaycount = playcount;
}
var test = window.GetProperty("bio_played")
var test = parseInt(test)
var test2 = test + 1
window.SetProperty("bio_played",test2);

ar_years3 = 0;

if (ar_days2 === 0) {
ar_days2 = "today"
}
if (ar_days2 === 1) {
ar_days2 = "yesterday"
}
if (ar_days2 >>> 1) {
ar_days2 = ar_days2 + " days ago"
}
ar_days3 = 0;
if (ar_days3 === 0) {
ar_days3 = "today"
}


window.Repaint();
}


function on_playlist_switch() {
window.Repaint();
}

function on_colors_changed() {
color = dui ==1 ? window.GetColorDUI(2) : RGB(200,0,0);
color2 = dui ==1 ? window.GetColorDUI(0) : window.GetColorCUI(0);
window.Repaint();
}

function on_font_changed() {
g_font = dui == 1 ? window.GetFontDUI(0) : window.GetFontCUI(0);
window.Repaint();
}





Any help would definitely be appreciated, thanks so much!!!
Title: WSH Panel Mod script discussion/help
Post by: morphguy12 on 2010-07-28 06:12:33
Version without the rating problem ( just strictly text )
I also cleaned it up a bit
Clicking through playlists seems much smoother without the rating stars problem

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\utils.js"
// @import "%fb2k_path%scripts\marc2003\v2\common.js"
// ==/PREPROCESSOR==


var bw = 13;
var bh = 13;
var left_margin = 48;
var top_margin = 89;
var Buttons;
var g_metadb;
var section = "SIMILARPANEL";
var rating;
var nrating;
var lrating;
var img;
var g_drag = 0;
var g_tfo = fb.TitleFormat("%rating%");
var artist = ""
var album = ""
var title = ""
var codec = ""
var bitrate = ""
var played = ""
var codecprofile = ""
var played = ""
var genre = ""
var lastartist = ""
var lastplay = ""
var rating = ""
var last1 = ""
var last2 = ""
var last3 = ""
var last4 = ""
var playing = "0"
var playcount = "0";
var year = 0;
var date = 0;
var difyear = 0;
var date2 = 0;
var avgdate = 0;
var difdate = 0;
var today = 0;
var ar_days = 0;
var ar_years = 0;
var ar_days2 = 0;
var ar_years2 = 0;
var ar_days3 = 0;
var ar_years3 = 0;
var ar_days4 = 0;
var ar_years4 = 0;
var bitrate = 0;
var days = 0;
var hours = 0;
var minutes = 0;
var seconds = 0;
var on_playback_new_track2 = 0;
var playcount = "0";
var playcount2 = 0;
var playcount3 = 0;
var playcount4 = 0;
var avgplaycount = 0;
var minplaycount = 0;
var maxplaycount = 0;
var ranplaycount = 0;
var devplaycount = 0;
var test = 0;
var test2 = 0;
var dui = window.InstanceType;

var g_font = dui == 1 ? window.GetFontDUI(0) : window.GetFontCUI(0);
//var color = RGB(200,0,0);
var color = dui == 1 ? window.GetColorDUI(2) : RGB(200,0,0);
//var color2 = RGB(0,0,0);
var color2 = dui == 1 ? window.GetColorDUI(0) : window.GetColorCUI(0);
var color3 = RGB(255,99,71);

//global Variables for text field
var DT_TOP = 0x00000000;
var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_BOTTOM = 0x00000008;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_EXPANDTABS = 0x00000040;
var DT_TABSTOP = 0x00000080;
var DT_NOCLIP = 0x00000100;
var DT_EXTERNALLEADING = 0x00000200;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_INTERNAL = 0x00001000;
var DT_EDITCONTROL = 0x00002000;
var DT_PATH_ELLIPSIS = 0x00004000;
var DT_END_ELLIPSIS = 0x00008000;
var DT_MODIFYSTRING = 0x00010000;
var DT_RTLREADING = 0x00020000;
var DT_WORD_ELLIPSIS = 0x00040000;
var DT_NOFULLWIDTHCHARBREAK = 0x00080000;
var DT_HIDEPREFIX = 0x00100000;
var DT_PREFIXONLY = 0x00200000;
var defaultartistimage = "";
var lastfmdatapath = "";
var g_tooltip = window.CreateTooltip();
var g_down = false;
var timer = null;
var btn_down = null;
var cur_btn = null;
var ww = window.Width;
var wh = window.Height;
window.GetProperty("currentArtists", "");
window.GetProperty("bio_played", "");


function reloadConf(inipath)
{
    skinpath = translatePath(utils.ReadINI(inipath, "SKIN", "imgpath", ""),true);
    window.GetProperty("buttons.show", utils.ReadINI(inipath, section, "showbuttons", "0"));
    window.GetProperty("buttons.list", utils.ReadINI(inipath, section, "buttons", ""));
    window.GetProperty("font.name", utils.ReadINI(inipath, section, "fontname", "Segoe UI"));
    window.GetProperty("font.size", utils.ReadINI(inipath, section, "fontsize", "10"));
    window.GetProperty("buttons.width", utils.ReadINI(inipath, section, "buttonswidth", "110"));
    window.GetProperty("buttons.height", utils.ReadINI(inipath, section, "buttonsheight", "38"));
    lastfmdatapath = translatePath(utils.ReadINI(inipath, "LASTFM", "datapath"),true);
    updateButtons() ;

}

reloadConf(inipath);


function on_script_unload()
{
        utils.WriteINI(inipath, section, "showbuttons", window.GetProperty("buttons.show"));
        utils.WriteINI(inipath, section, "buttons", window.GetProperty("buttons.list"));
        utils.WriteINI(inipath, section, "fontname", window.GetProperty("font.name"));
        utils.WriteINI(inipath, section, "fontsize", window.GetProperty("font.size"));
        utils.WriteINI(inipath, section, "buttonswidth", window.GetProperty("buttons.width"));
        utils.WriteINI(inipath, section, "buttonsheight", window.GetProperty("buttons.height"));
}

function ArtistButton(x, y, w, h, img, func, tiptext, url)  {
this.left = x;
this.top = y;
this.w = w;
this.h = h;
this.right = x + w;
this.bottom = y + h;
this.func = func;
this.tiptext = tiptext;
this.url = url;
    this.font = gdi.Font(window.GetProperty("font.name"), window.GetProperty("font.size"), 0);
    this.color = RGB(255,255,255);
this.state = ButtonStates.normal;
this.img= img;
   
    this.lastfmcommand = url;

this.alterImage = function(img_src) {
    this.img= img_src ? gdi.Image(img_src) : null;

this.changeState(this.state);
}

this.traceMouse = function (x, y) {
var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);
if (b)
g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
else
this.changeState(ButtonStates.normal);
return b;
}


this.changeState = function (newstate) {
if (newstate != this.state)
window.RepaintRect(this.left, this.top, this.w, this.h);
this.state = newstate;
        switch (this.state)
{
case ButtonStates.normal:
this.font = gdi.Font(window.GetProperty("font.name"), window.GetProperty("font.size"), 0);
            this.color = RGB(255,255,255);
break;

case ButtonStates.hover:
case ButtonStates.down:
this.font = gdi.Font(window.GetProperty("font.name"), window.GetProperty("font.size"), 4);
            this.color = RGB(0,92,185);
break;

default:
this.img = null;
}
}

   
   
this.draw = function (gr) {
       
gr.DrawRect(this.left, this.top, this.h,  this.h, 1.0, RGB(170,170,170));
       
this.img && gr.DrawImage(this.img, this.left + 2, this.top + 2, this.h -3, this.h -3, 0, 0, Math.min(this.img.Width,  this.img.Height), Math.min(this.img.Width,  this.img.Height));
gr.GdiDrawText(this.tiptext, this.font, this.color,  this.left + this.h + 3, this.top + 3, this.w - this.h - 3 , this.h -3, DT_VCENTER | DT_NOPREFIX | DT_WORDBREAK|DT_END_ELLIPSIS);
}

this.onClick = function () {
this.func && this.func(x,y);
}
   
this.onRightClick = function (x,y)
    {
        var _menu = window.CreatePopupMenu();
        var idx;
        var buttontocreate = window.GetProperty("buttons.list").split(";");
        var numbersearchengines = 0;
      if (buttontocreate != null)
      {
            for (var i in buttontocreate)
            {
                var text = getWebServiceName(buttontocreate[i], this.tiptext);
                if (text != "")
                {
                    _menu.AppendMenuItem(MF_STRING, numbersearchengines +1, text);
                        numbersearchengines += 1 ;
                }
            }
            numbersearchengines += 1 ;
            _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
        }
        _menu.AppendMenuItem(MF_STRING,  numbersearchengines + 1, "Update LastFM data");
        _menu.AppendMenuItem(MF_SEPARATOR,  numbersearchengines + 2, 0);
        _menu.AppendMenuItem(MF_STRING, numbersearchengines + 3,  getWebServiceName("lastfmsimilarradio", this.tiptext));
        _menu.AppendMenuItem(MF_SEPARATOR, numbersearchengines + 4, 0);
        _menu.AppendMenuItem(MF_STRING,  numbersearchengines +5, "Properties");
        //_menu.AppendMenuItem(MF_STRING, 7, "Configure...");
        idx = _menu.TrackPopupMenu(x, y);
        if (idx <= numbersearchengines)
        {
            launchWebService(buttontocreate[idx - 1], this.tiptext);
        }
        else if (idx == numbersearchengines + 1)
        {
            window.NotifyOthers("ask_lastfm_data", "");           
        }
        else if (idx ==  numbersearchengines + 3)
        {
            launchWebService("lastfmsimilarradio", this.tiptext);
        }
        else
        {
            window.ShowProperties();
        }
        _menu.Dispose();
    }

this.onMouseIn = function() {
g_tooltip.Text = this.tiptext;
g_tooltip.Activate();
}

this.onMouseOut = function() {
g_tooltip.Deactivate();
}
}


function buttonsDraw(gr) {
for (i in Buttons) {
Buttons[i].draw(gr);
}
}

function buttonsTraceMouse(x, y) {
var btn = null;
for (i in Buttons) {
if (Buttons[i].traceMouse(x, y) && !btn)
btn = Buttons[i];
}

return btn;
}

function on_timer(id) {
if (timer && id==timer.ID) {
updateButtons() ;
timer && window.KillTimer(timer);
timer = null;
CollectGarbage(); // Release memory.
}
}

function on_mouse_move(x, y) {
var btn = buttonsTraceMouse(x, y);
if (btn != cur_btn) {
cur_btn && cur_btn.onMouseOut();
btn && btn.onMouseIn();
}

cur_btn = btn;
   
}

function on_mouse_lbtn_down(x, y) {
   
    g_down = true;
btn_down = cur_btn;
if (cur_btn) {
cur_btn.changeState(ButtonStates.down);
}
}

function on_mouse_lbtn_up(x, y, mask) {
    if (mask & MK_SHIFT)
    {
        window.ShowConfigure();
    }
    else
    {
        if (cur_btn) {
            cur_btn.changeState(ButtonStates.hover);
            if( btn_down == cur_btn )
                cur_btn.onClick(x, y);
        }
        g_down = false;
    }
}

 //function on_mouse_lbtn_up(x,y){
// if (lrating !=rating && g_metadb) bool = fb.RunContextCommandWithMetadb("Rating/"+((lrating==0) ? "<not set>" : lrating),g_metadb);
//  }

// function on_mouse_move(x, y) {
// if (g_metadb) {
// g_drag = 1;
// nrating = Math.ceil((x - left_margin) / bw);
// if (nrating > 5) nrating = 5;
// if (nrating != lrating) {
// lrating = nrating;
// window.Repaint();
// }
// }
// }

function on_mouse_leave() {
 //  on_metadb_changed()
if (cur_btn) {
cur_btn.changeState(ButtonStates.normal);
}
}

function on_mouse_rbtn_down(x, y)
{
    on_mouse_move(x, y);   
    if (cur_btn)
    {
        cur_btn.changeState(ButtonStates.hover);
        cur_btn.onRightClick(x, y);
    }
    else
    {
        var _menu = window.CreatePopupMenu();
        var idx;
        _menu.AppendMenuItem(MF_STRING, 1, "Refresh");
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
        _menu.AppendMenuItem(MF_STRING, 2, "Properties");
        _menu.AppendMenuItem(MF_STRING, 3, "Configure...");
        idx = _menu.TrackPopupMenu(x, y);
        switch(idx) {
        case 1:
        updateButtons() ;
        break;
        case 2:
        window.ShowProperties();
        break;
        case 3:
        window.ShowConfigure();
        break;
        }
        _menu.Dispose();
    }

    return true;
   
}

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

 //function on_metadb_changed() {
// g_drag = 0;
// rating = g_tfo.EvalWithMetadb(g_metadb);
// if (rating == "?") rating = 0;
// lrating = rating;
// window.Repaint();
//}

function on_paint(gr) {
    // Background
gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
   
//buttons_background(gr);
//if (g_metadb) {
// for (i = 1; i < 6; i++) {
// img = gdi.image(images_path + ((i > (g_drag ? lrating : rating)) ? "off.png" : "on.png"));
// gr.DrawImage(img, left_margin + bw * (i-1), top_margin, bw, bh, 0, 0, img.Width, img.Height);
// }
// }
    buttonsDraw(gr);

gr.GdiDrawText("Artist: " + artist, g_font, color, 5, 5, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Title: " + title, g_font, color, 5, 25, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        if (playing === 1){
        gr.GdiDrawText("Album: " + album +" "  + "("+ date + ")", g_font, color, 5, 45, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
        gr.GdiDrawText("Album:", g_font, color, 5, 45, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
        gr.GdiDrawText("Genre: " + genre, g_font, color2, 5, 65, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Rating: "+ rating , g_font, color2, 5, 85, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        if (playing === 1){
          if (playcount === 0){
        gr.GdiDrawText("Played: never", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
          if (playcount === 1){
        gr.GdiDrawText("Played: " + playcount + " time", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
        gr.GdiDrawText("Played: " + playcount + " times", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }}}
          else{
        gr.GdiDrawText("Played:", g_font, color2, 5, 105, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          if (playing === 1){
        gr.GdiDrawText("Codec: " + codec +"-"+ codecprofile + " -- " + bitrate+" "+"Kbit/s", g_font, color2, 5, 125, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
}
          else{
        gr.GdiDrawText("Codec:", g_font, color2, 5, 125, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          if (playing === 1) {
          if (Math.floor(ar_years) === 0) {
        gr.GdiDrawText("Added: " + ar_days, g_font, color2, 5, 145, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
        gr.GdiDrawText("Added: " + ar_days + " (" + Math.floor(ar_years) + " years)", g_font, color2, 5, 145, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
        }
          else{
        gr.GdiDrawText("Added:", g_font, color2, 5, 145, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          if (playing === 1){
          if (playcount === 0) {
        gr.GdiDrawText("First Played: never", g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Last Played: never", g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
            if (Math.floor(ar_years2) === 0) {
        gr.GdiDrawText("First Played: " + ar_days2, g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
        gr.GdiDrawText("First Played: " + ar_days2 + " (" + Math.floor(ar_years2) + " years) ", g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
            if (Math.floor(ar_years3) === 0) {
        gr.GdiDrawText("Last Played: "+ ar_days3, g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
        gr.GdiDrawText("Last Played: "+ ar_days3 + " (" + Math.floor(ar_years3) + " years) ", g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
        }}
          else{
        gr.GdiDrawText("First Played:", g_font, color2, 5, 165, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Last Played:", g_font, color2, 5, 185, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
    // gr.GdiDrawText("Artist Playcount: " + last1, g_font, color2, 5, 205, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Artist Listeners: " + last2, g_font, color2, 5, 235, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Album Playcount: " + last3, g_font, color2, 5, 255, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
          if (playing === 1){
        gr.GdiDrawText("Artist Played: " + window.GetProperty("bio_played")+ " times", g_font, color2, 5, 205, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
          else{
        gr.GdiDrawText("Artist Played:", g_font, color2, 5, 205, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
        gr.GdiDrawText("Similiar Artists:", g_font, color2, 5, 285, window.Width - 10, window.Height, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }



function on_notify_data(name, info)
{
switch (name)
{
case "lastfm_similarArtists":
        window.SetProperty("currentArtists", info);
        updateButtons();
break;
      case "config_updated":
      reloadConf(info);
    break;
        case "lastfm_bio":
            var res = info.split("%separator%");
           
            window.SetProperty("bio_played", res[2]);
            if ( window.GetProperty("bio_played") == "")
            {
                window.SetProperty("bio_played","0");
            }
            window.Repaint();
default:
break;
       
       
       
}
   

}

function updateButtons() {
    delete Buttons;
    Buttons = null;
    CollectGarbage(); // Release memory.
   
    if(window.GetProperty("currentArtists") != "")
    {
var x = 10;
    var y = 310;
        varartistsArray = window.GetProperty("currentArtists").split(";");
        Buttons = new Array (varartistsArray.length);
        var currentartist = "";
        for (var i in varartistsArray)
        {
            switch (i % 2)
            {
                case 0:
                currentartist = varartistsArray[i];
            break;
                case 1:
            //skinpath
            var currentartisturl =  varartistsArray[i];
        if (currentartist != "")
        {
                var img =  gdi.Image(lastfmdatapath + ansi(currentartist) + "_small.jpg");
               
                if(img == null)
                {
                    img = gdi.Image(lastfmdatapath + ansi(currentartist) + "_small.png");
                    if(img == null)
                    {
                        img=  gdi.Image(lastfmdatapath + ansi(currentartist) + "_small.gif");
                        if(img == null)
                        {
                            img=  gdi.Image(skinpath + "Last.fm.small.png");
                        }
                    }
                }
                Buttons[i] = new ArtistButton(x, y, parseInt(window.GetProperty("buttons.width")), parseInt(window.GetProperty("buttons.height")), img, function(){WshShell.run(this.lastfmcommand);}, currentartist, currentartisturl) ;
                if  (x + 2*window.GetProperty("buttons.width") + 5 > ww)
                {
                    y = y + parseInt(window.GetProperty("buttons.height")) + 5;
                    x = 10 ;
                }
                else
                {
                    x = x + parseInt(window.GetProperty("buttons.width")) + 5;
                }
        }
            break;
        }
        }
    }
    window.Repaint();
}




function on_playback_new_track() {
    on_playback_new_track2++;

    artist = fb.Titleformat("%artist%").Eval();
    album = fb.TitleFormat("%album%").Eval();
    title = fb.TitleFormat("%title%").Eval();
    genre = fb.Titleformat("%genre%").Eval();
    codec = fb.Titleformat("%codec%").Eval();
    bitrate = fb.Titleformat("%bitrate%").EvalWithMetadb(g_metadb); 
    codecprofile = fb.Titleformat("%codec_profile%").Eval();
    rating = fb.TitleFormat("$if(%rating%,$repeat($char(9733),%rating%),)").Eval();
    last1 = fb.Titleformat("%lastfm_artist_playcount%").EvalWithMetadb(g_metadb);
    last2 = fb.Titleformat("%lastfm_artist_listeners%").EvalWithMetadb(g_metadb); 
    last3 = fb.Titleformat("%lastfm_album_playcount%").EvalWithMetadb(g_metadb); 
    last4 = fb.Titleformat("%lastfm_album_listeners%").EvalWithMetadb(g_metadb); 
    playing = 1;
    playcount = fb.TitleFormat("%play_count%");
    playcount = playcount.Eval();
    playcount = parseInt(playcount);
    playcount2 += playcount;
playcount4 += playcount;
    playcount3 += (playcount * playcount);
if (on_playback_new_track2 === 1) {
minplaycount = playcount;
maxplaycount = playcount;
}

    window.GetProperty("bio_played")

    last1 = addCommas(last1)
    last2 = addCommas(last2)
    last3 = addCommas(last3)
    last4 = addCommas(last4)

    date = fb.TitleFormat("%date%");
    date = date.Eval();
    date = parseInt(date);
    dt = new Date();
    year = dt.getFullYear();
    difyear = year - date;
    date2 = date2 + date;
    if (on_playback_new_track2 >= 2) {
        avgdate = date2 / on_playback_new_track2;
        avgdate = Math.round(avgdate);
        difdate = year - avgdate;
    }

    today = new Date();
    var fpy = fb.TitleFormat("$year(%added%)").Eval();
    var fpm = fb.TitleFormat("$sub($month(%added%),1)").Eval();
    var fpd = fb.TitleFormat("$day_of_month(%added%)").Eval();
    var fday = new Date(fpy, fpm, fpd);
    var one_day = 1000 * 60 * 60 * 24;
    if (fday > 0) {
        ar_days = Math.floor((today.getTime() - fday.getTime()) / one_day);
        ar_years = ar_days / 365;
    }
    fpy = fb.TitleFormat("$year(%first_played%)").Eval();
    fpm = fb.TitleFormat("$sub($month(%first_played%),1)").Eval();
    fpd = fb.TitleFormat("$day_of_month(%first_played%)").Eval();
    fday = new Date(fpy, fpm, fpd);
    one_day = 1000 * 60 * 60 * 24;
    if (fday > 0) {
        ar_days2 = Math.floor((today.getTime() - fday.getTime()) / one_day);
        ar_years2 = ar_days2 / 365;
    } else {
        ar_days2 = 0;
    }

    fpy = fb.TitleFormat("$year(%last_played%)").Eval();
    fpm = fb.TitleFormat("$sub($month(%last_played%),1)").Eval();
    fpd = fb.TitleFormat("$day_of_month(%last_played%)").Eval();
    fday = new Date(fpy, fpm, fpd);
    one_day = 1000 * 60 * 60 * 24;
    if (fday > 0) {
        ar_days3 = Math.floor((today.getTime() - fday.getTime()) / one_day);
        ar_years3 = ar_days3 / 365;
    } else {
        ar_days3 = 0;
    }

    fpy = fb.TitleFormat("$year(%last_modified%)").Eval();
    fpm = fb.TitleFormat("$sub($month(%last_modified%),1)").Eval();
    fpd = fb.TitleFormat("$day_of_month(%last_modified%)").Eval();
    fday = new Date(fpy, fpm, fpd);
    one_day = 1000 * 60 * 60 * 24;
    if (fday > 0) {
        ar_days4 = Math.floor((today.getTime() - fday.getTime()) / one_day);
        ar_years4 = ar_days4 / 365;
    } else {
        ar_days4 = 0;
    }

    if (ar_days === 0) {
    ar_days = "today"
    }
    if (ar_days === 1) {
    ar_days = "yesterday"
    }
    if (ar_days >>> 1) {
    ar_days = ar_days + " days ago"
    }

    if (ar_days2 === 0) {
    ar_days2 = "today"
    }
    if (ar_days2 === 1) {
    ar_days2 = "yesterday"
    }
    if (ar_days2 >>> 1) {
    ar_days2 = ar_days2 + " days ago"
    }


    if (ar_days3 === 0) {
    ar_days3 = "today"
    }
    if (ar_days3 === 1) {
    ar_days3 = "yesterday"
    }
    if (ar_days3 >>> 1) {
    ar_days3 = ar_days3 + " days ago"
    }

    window.Repaint();
}




function on_playback_stop() {
    artist = ""
    album = ""
    title = "" 
    genre = ""
    ar_days = 0;
    ar_days2 = 0;
    ar_days3 = 0;
    ar_days4 = 0;
    ar_years = 0;
    ar_years2 = 0;
    ar_years3 = 0;
    ar_years4 = 0;
    date = 0;
    difyear = 0;
    playcount = "";
    last1 = "";
    last2 = "";
    last3 = "";
    last4 = "";
    rating = "";
    bitrate = 0;
    playing = 0;
    window.Repaint();
}


function on_item_played() {
    playcount++;
    playcount4++;

    if (on_playback_new_track2 === 1) {
minplaycount = playcount;
maxplaycount = playcount;
    }
var test = window.GetProperty("bio_played")
        var test = parseInt(test)
        var test2 = test + 1
        window.SetProperty("bio_played",test2);
       
    ar_years3 = 0;
   
    if (ar_days2 === 0) {
    ar_days2 = "today"
    }
    if (ar_days2 === 1) {
    ar_days2 = "yesterday"
    }
    if (ar_days2 >>> 1) {
    ar_days2 = ar_days2 + " days ago"
    }
    ar_days3 = 0;
    if (ar_days3 === 0) {
    ar_days3 = "today"
    }


    window.Repaint();
}


function on_playlist_switch() {
    window.Repaint();   
}


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-29 16:26:39
scripts updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a new script called "thumbs2.txt"

(http://k5sbdw.blu.livefilestore.com/y1pQZLbMEuYlv6pP3wtfMAv2sy5ijmJdzdnyIY_Hv32xAlCaSR2U3T3tUAHuRTMe03Nksu7ta9TAfJKElEi-aL7be1Yl3BL3MEW/thumbs2.png)

-support for downloading last.fm artist art like all my other scripts
-multiple custom folder support
-hover mouse over thumbnails and use mouse wheel to scroll through all images
-single click thumbnail to show larger version
-single click large image to open in external viewer
-right click large image and you can delete it using the context menu
-check the context menu for all other options
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-29 17:40:38
marc2003, if I was a woman, i would run to you, jump at your neck and give you a kiss that would made your wife jealous! 

thx a lot for this update! thumbnails below the cover, that what i was expecting from your script.

Now I can play a bit with it to:
  -center the thumbnails under cover when (cover width) is bigger than (thumbs widtht x number of thumbs)
  -reduce a bit thumbs size and draw a nice border around

edit:typo
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-29 19:25:19
-center the thumbnails under cover when (cover width) is bigger than (thumbs widtht x number of thumbs)


although it's possible, i think it's easier to lock the panel width. otherwise you have to take into account the margins when tracking the mouse pointer for selecting/opening images. i guess it shouldn't be that hard - i'm just lazy.

Quote
-reduce a bit thumbs size and draw a nice border around


hold shift while right clicking and that will show "properties" on the context menu. you can change the "thumb_size" variable there. if you want to draw a better border, you'll need to edit scripts\marc2003\v2\common.js and find the "scale" function.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-30 01:59:46
hold shift while right clicking and that will show "properties" on the context menu. you can change the "thumb_size" variable there. if you want to draw a better border, you'll need to edit scripts\marc2003\v2\common.js and find the "scale" function.
I was a bit confuse that changing size in "configure..." windows returns no effect. Thx again.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-30 15:53:19
i've now updated the "thumbs2" script so the thumbnails are centered.

(http://k5sbdw.blu.livefilestore.com/y1pi9ESBKspFzJdi0qDnykrMQiKpXMOzugbK_9Z2TBX6-NfMbYcVfs3rU8OS45qPKNbj53wTeiew-RCdT09OaH8Fq_FOamxDx2A/centered.png)

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-30 16:01:20
i've now updated the "thumbs2" script so the thumbnails are centered.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-30 18:34:39
Marc, about Thumbs script...I would like to make a suggestion, not for design this time.
I've not entered yet to your script to see if it would be difficult or not.

As you know, the bigger image does not keep focus on the selected thumbs.
The focus change, and go back to the first image contained in the folder, when playback changes, or even when selection changes.
I dont know what was your plan when you began to script this panel. And surely maybe? my suggestion will not go in your way.

mainly: Is it possible to keep cover focused on the selected thumb and no reset to first image?


[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]What i have in mind, is more a combination between artreader/thumb script 1/thumb script 2.
When you click on a thumb, it show bigger one; if you (double) click on the bigger image, it acts like thumbs1/artreader: thumbnails disappear to extend bigger image, with a kind of diaporama.
Next, clicking on the extended big image, that will switch to the combined display (Thumbs+Big cover). If you middle click on thumbs, it could extend thumbs (big cover disappear, for browsing thumbs)... and if needed, another action to open it in external viewer.
I'm not asking anything, just sharing what, with a maximum effort, i'll try to achieve starting with your scripts.
[/size]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-30 19:16:21
sorry but i have no idea what you're on about? :/

edit: i'll just explain how it works and maybe you can tell me what your problem is.

when foobar is playing, it follows the "now playing" item. it only resets when the playing artist changes, resize the panel or use the context menu to delete an image.
when foobar isn't playing it follows the cursor. but again, it only resets when the selected artist changes. this is because i assume most people who want to display multiple images will be using either last.fm mode or using their own collection of art using %artist% titleformatting in the custom folder setup.

EDIT2: i see what the problem is now. i only set the artist in last.fm artist mode and not custom folder mode. my mistake, i've uploaded fixed versions of "thumbs" and "thumbs2".

EDIT3: 

now i've uploaded another "fix". in last.fm mode, it still changes on the artist as before. but in custom folder mode, it only changes when the evaluated custom title formatting changes. i think that makes more sense.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-31 02:03:23
i've now updated the "thumbs2" script so the thumbnails are centered.


Great!!!!! Thank you so much.

I have some idea. 

1) If area of panel is oblong and small, thumbnail place is left side.(Now preview image very small if panel height is short.)
2) Download Last.fm images on Custom folder mode.
3) Support multiple value on download lastfm image function. Select artist on context menu.(default use $meta(%tag%,0))
I use original meta tag(e.g. %original artist%) on multiple artist track.
Some tracks %artist% is "A and B", "A feat. B", "A,B", "A with B" etc.
In these, I set "A;B" on original artist field.
I use the following TF on biography view(Remap meta).

$if2(%<original artist>%,%artist%)

I will use like the following TF on custom folder path If this function added.
C:\image\$meta(original artist,0)\;
C:\image\$meta(original artist,1)\;
C:\image\$meta(original artist,2)\;
C:\image\$meta(original artist,3)\;
...

4) work for focused item on playlist permanently.(Can I use this script in multiple?)
5) High quality image resize algorithm on thumb.
6) Thumb size config not available?
7) Put arrow that suggest more image exist on thumb.
8) Config priority on Last.fm Image downloading.(e.g. newest, popular)
9) Store already exist image on Last.fm image downloading and limit show image.(choice is random)
10) Background color config.

Please examine these. 
This is a proposal. 

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-31 02:27:38
changing the background is easy enough. on line 103, replace "g_backcolor" with "RGB(x,y,z)".

as for the rest. have fun.....
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-31 02:38:06
changing the background is easy enough. on line 103, replace "g_backcolor" with "RGB(x,y,z)".

as for the rest. have fun.....


Thank you.
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-31 08:35:28
11) Download progress images.
12) Auto download Last.fm images.
13) NG image function.(Some time, very small image and no relation image downloaded.)
14) If wheel scroll on big image, show next image.
15) If image count is 1, not show thumb.
16) Stands out current thumb.
17) Config image sort order.(filename, folder path, random)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-31 11:02:23
i see we have a comedian in the house. 

a few things make sense and i might implement. i can't do progress but i should be able to show it's doing something when downloading images. and automatic downloading would be handy.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-31 11:22:08
@Watercolor:
Point 6 is already possible
hold shift while right clicking and that will show "properties" on the context menu. you can change the "thumb_size" variable there. if you want to draw a better border, you'll need to edit scripts\marc2003\v2\common.js and find the "scale" function.


@Marc:
Quote
14) If wheel scroll on big image, show next image.
15) If image count is 1, not show thumb.
point 14 could have sense if we could switch between "BigImage+Thumbs" and "only BigImage display".
point 15 have sense, even for you, using only lastFM mode.

Quote
17) Config image sort order.(filename, folder path, random)
As, marc, you only use this script for lastfm artist, i suppose you will not mess the code to give us the possibility to chose the name of the first image (e.g. Front, instead of Back...). It is not a priority, but it would be cool, later, one day, maybe, perhaps...
Greets

edit: details for 14 & 15
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-31 11:25:50
@marc, sorry to spam you about this script:
could you point me the direction and place in your code where I could change the ratio of thumbs (is it possible)?
actually, i don't want you to make it for me, i want just to change that part, so all thumbs would be square.

Thx

edit:typo
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-31 11:33:40
@Watercolor:
Point 6 is already possible
hold shift while right clicking and that will show "properties" on the context menu. you can change the "thumb_size" variable there. if you want to draw a better border, you'll need to edit scripts\marc2003\v2\common.js and find the "scale" function.



OK. but old version have context menu that config thumb size. Thank you.

Everyone, sorry my bad English. 

If can not understand something in my post, please ask for me.
I will effort explain.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-31 11:52:14
OK. but old version have context menu that config thumb size. Thank you.
I know that too, but as you have 17 asking points, maybe some "conceding" could help  .As, I suppose, you will not change the thumbs size every minute, maybe it is not so important to have it in context menu or not.
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-31 11:59:38
OK. but old version have context menu that config thumb size. Thank you.
I know that too, but as you have 17 asking points, maybe some "conceding" could help  .As, I suppose, you will not change the thumbs size every minute, maybe it is not so important to have it in context menu or not.


Windows 7 Explorer have slider that config thumb size.
...Sorry, I only change thumb size when panel layout changed.

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-31 12:25:06
EDIT3: 

now i've uploaded another "fix". in last.fm mode, it still changes on the artist as before. but in custom folder mode, it only changes when the evaluated custom title formatting changes. i think that makes more sense.
I'm really ashamed to knock hammer  at your door that way.
Actually it changes to another custom folder only if artist changes... (but the focus is ok now).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-31 12:30:16
if it only changes when the artist changes, then you must be using %artist% in your title formatting. :/

RE: square thumbnails, you need to look at the maths calculations in the scale function. it's in the external file "scripts\marc2003\v2\common.js" inside the scale() function. this function is shared between lots of my scripts so you might want to make a copy and call it by another name.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-31 12:36:34
i'm using this:
$replace(%path%,%filename_ext%,)\Cover\

maybe i m doing wrong, so i will fix and find it by myself.
but if not, if there is a "bug" with custom folder definition, there is no emergency about that.
i'm not asking you to focus about that, i know you are about multiple thing at once.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-31 12:44:01
remove the trailing slash.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-31 14:17:28
http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

thumbs & thumbs2
-added square thumbnail option (it's the default). 
-added auto download option. it only works on the start of a new track and if no images are found. you can turn if off via the context menu.

thumbs2
-added configurable thumbnail size
-scrolling over large image cycles through them (thumbnails do not track it at the moment)
-don't show thumbnails if there is only 1 image

now playing.txt
-bugfix. script may have errored if scrolling too fast.

note: changes were made to the "scripts" folder so make sure you extract the contents, overwriting the old files.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-31 15:07:16
note: changes were made to the "scripts" folder so make sure you extract the contents, overwriting the old files.


i'm such a half-wit. i didn't bundle the new files in the zip. i just re-uploaded. 
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-07-31 15:30:19
i'm such a half-wit. i didn't bundle the new files in the zip. i just re-uploaded. 
I was self-silenced by my shame to hammered you all the day... So i was silently waiting that you see that by yourself.

so, thx for all. Now everyting is ok. The square format is nice (and you decide to crop image, keeping aspect ratio. Good choice)
And, beside everything, now custom folder change, even if artist is the same.

THANK YOU for your reactivity and your patience. If you were my neighbor, i would offer you some drink... or make you some cookies
Now, i keep my mouth closed, and my hands out of the keyboard until september. Nothing more to ask, except that I wish you a nice summertime.
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-31 16:28:55
note: changes were made to the "scripts" folder so make sure you extract the contents, overwriting the old files.


i'm such a half-wit. i didn't bundle the new files in the zip. i just re-uploaded. 


Wonderful! 

I am wishing this script to become better.

p.s.
I posted some ideas that I wanted.
But I especially want function is
"Multiple value tag support",
"Last.fm Artist Art and Custom Folder can be used at the same time" and
"Blacklist of image"
.

Multiple value tag support:
Support %<tag>% or delimiter(like "$meta_sep($if(%original artist%,original artist,artist),|)". I will use more complex TF.).
Same as custom folder path config.
art.exe will run multiple time(number of tag value).
Plus, I want the setting of the condition disregarding downloading.(Like "$if(%nolastfm%,1)".)
Also I think ignore conditon set by use artist TF.(e.g. "$if(%nolastfm%,,$if(%original artist%,original artist,artist),|))")

Last.fm Artist Art and Custom Folder can be used at the same time:
For example, If I play soundtrack of movie, I want to see some photograph of the movie and liner notes.
Also I want to see composer(%artist% in this case) images.
I think mode changing is tedium. All images should show same time.

Blacklist of image:
Whenever a trivial photograph is seen, I get irritated.
Then, I delete those images.
However, these revive again when downloading again.
Accordingly, I think need function that exclude these images.
I do not understand how to this.(filename? md5? crc32?)

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-07-31 16:46:20
i just re-uploaded to fix a bug in thumbs2. i didn't implement "don't show thumbnails if there is only 1 image" properly.

i can't stop art.exe downloading images. maybe blacklisting could be added to my script. i'll have to have a think on how to implement that.

as for merging last.fm/custom folder mode and multiple tag support, that's not likely to happen.
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-07-31 17:35:36
as for merging last.fm/custom folder mode and multiple tag support, that's not likely to happen.


 
difficulty? or not needed?

Anyway, I see. I am sorry for saying a trivial demand.
I might make them by myself. 

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-01 11:41:17
small update for thumbs2.

(http://k5sbdw.blu.livefilestore.com/y1pekBJpHxOPjI6EVXtCnX2Zx08Hb7zvEcn-0gGLPvydYyI8JG042Co_aRIq2k9a_Qyl3Q7WWtguUTibHf03ZaQ_5X0WSqlW3gC/thumbs2%20arrows.png)

-added forward/back buttons to show when there are more thumbnails. (scripts folder contains new images so make sure you extract that as well)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-01 14:48:53
another update for thumbs2.  http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

-when deleting images in last.fm mode, you can now blacklist them to prevent them showing again. although i can't stop them being downloaded again, the script deletes them when checking the folder. you can turn off blacklisting or clear the blacklist from the context menu.

EDIT: yet again, i didn't put all the new files in the zip. still, it was only 10 minutes before i realised this time. i just re-uploaded....
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-08-01 15:35:17
small update for thumbs2.




Nice update.

OK. There is new idea! 

18) Put loading image when downloading.(animation gif is easy?)
19) Thumbs scrollbar.
20) Show total images count. Show current image offset number. (Like 12/20.) Show number that assignment to thumbs.
21) Do fade effect(or some effect) when current image is changed.
22) New mode.(Goolgle image, MySpace, Flickr etc. ...also use custom folder same time. hehehe.  )
23) Mouseover effect.(Thumb, big image etc.)
24) Config auto cycle.(Stop, Start, Interval, Order)
25) A lot of image downloading over 50. Plus, limit use image about under 20-30.(Number is rough.)
26) Config search query TF that use download.(Can I use delimiter? Oh, sorry.  )
27) Config identification TF that use change image set.
28) Support skin.(maybe image file set and color settings.)
29) Reload function that useful in custom folder mode when put some images at playing music.
30) Favorite(or whitelist) image function.(If a image is added to favorite(or whitelist), this image not delete when redownload. And warn alert appear when exec manual delete.)
31) Config limit (min|max) download image's (filesize|pixel|height|width|filetype|date).
32) Another external program execute menu or mouse operation.(to edit image. not viewer. like PhotoShop, Paint.Net, Gimp etc.)
33) additional download function.(5+,10+) This cause too many image problem. but if can limit show image count, it is no problem.
34) Search toolbar or prompt. Any artist images can preview by this.

 

Thank you!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-01 15:54:34
go **** yourself.
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-08-01 21:39:10
Hey all, I have a quick question I hope someone can help me with.  I'm trying to use the UpdateFileInfoSimple function to write data to some of my file tags, but I occasionally receive the following error when the file being changed is currently playing:

Code: [Select]
Could not update tags (Sharing violation) on: 
"<filename>"


It doesn't happen all the time, but when it does it's annoying.  Is there any way to suppress this error message?  Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-01 22:35:40
you'd get the same dialog if you tried updating the tags manually. there's nothing i don't think there is anything you can do in WSH panel mod to suppress it.

of course, you could look at what's locking the files in the first place. maybe some other components or 3rd party programs??
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-08-01 22:54:08
Whatever is locking the files is only temporary.  If I try re-running the script after getting that error it almost always works.  So there's no way in WSH Panel Mod to test whether a file is locked?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-01 23:08:52
Whatever is locking the files is only temporary.


so you have an idea what it is? this is what you need to look at to prevent the errors.

like i said, the message you're seeing is a standard foobar dialog so as far as WSH panel mod is concerned, the "UpdateFileInfoSimple" function has run successfully.
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-08-01 23:26:30
No I don't, but I guess I'll have to figure it out.  I just figured that foobar was locking it because it was currently playing.  I guess that's not the case.  Thanks for your help.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-01 23:30:21
i've made scripts that can update the tags of the currently playing file so it's definitely not that.
Title: WSH Panel Mod script discussion/help
Post by: SwooshyCueb on 2010-08-02 10:17:35
marc2003, I think your samples zip is missing a few files. All I see is the pdf and the v2 folder.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-02 10:25:17
i just checked and you're right. i have no idea what happened there. anyway, i've updated it....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-04 02:18:45
little update for thumbs & thumbs2 to improve the image quality when resizing....

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

i only just noticed this really bad example.

(http://k5sbdw.blu.livefilestore.com/y1p5tF8j_ZKhZbNeoZCrLICM9aKD02b8cFA3muLOdIK0Z9mVaRTyKhj0iX4b1SSVd5uBC24UrnKd2dPMpzxBosp57UBaPx_mmvR/beforeafter.png)
before / after
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-08-04 13:00:02
little update for thumbs & thumbs2 to improve the image quality when resizing....

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

i only just noticed this really bad example.



This script has greatly improved the enjoyment of foobar2000.

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: SwooshyCueb on 2010-08-04 16:27:47
Something I would like to see: A script that allowed me to love/unlove/ban/unban tracks on last.fm. These api calls do exist (http://www.hydrogenaudio.org/forums/index.php?showtopic=82170&view=findpost&p=715947) and if fb2k had them, it would put it above all other last.fm compatible players.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-07 17:28:16
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

thumbs / thumbs2 bugfix. ' ( ) [ ] weren't handled correctly in custom folder mode.
Title: WSH Panel Mod script discussion/help
Post by: phool on 2010-08-07 21:48:47
So does anyone feel like taking marc2003's "thumbs 2" and turning it into a graphical browser for the media library... 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-07 22:32:46
there is already EsPlaylist which can browse the library and show covers. it's impossible for WSH panel mod to do anything like that.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-08-08 15:53:15
thumbs / thumbs2 bugfix. ' ( ) [ ] weren't handled correctly in custom folder mode.
Hey, thank you for constantly improving your script.

but...

this doesn't work anymore:
Code: [Select]
$replace(%path%,%filename_ext%,)Cover

something bad from my side, that i should now change?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-08 16:06:21
doh, i'm an idiot. i'll have to revert back to how it was before.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

if your folder path contains those characters '()[], they'll have to be escaped manually much like when you want to display them when using foobar normally.
Title: WSH Panel Mod script discussion/help
Post by: kabuki on 2010-08-08 22:13:28
doh, i'm an idiot.
I would have not said that! But we are changing you to a weathercock!
i'll have to revert back to how it was before.
Sorry to make you play yoyo with your script, now it is i-m-p-e-c-a-b-l-e  (for me).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-08 22:50:15
i was messing about using absolute folder paths which had () in the name. i made that change totally forgetting it would break anything using title formatting functions. 

edit: BTW i uploaded another new version earlier. it contains a bugfix for the "thumbs" script only. "cycle" mode was broken but now it's fixed.
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-08-09 00:00:07
Marc, I'm playing with your scripts and I have one quick question: in the rating script, how would I go about aligning the stars to the center of the panel?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2010-08-09 15:04:48
Marc, I'm playing with your scripts and I have one quick question: in the rating script, how would I go about aligning the stars to the center of the panel?




put this line to function on_size

left_margin = ww/2-bw*5/2;

like this

function on_size() {
   ww = window.Width;
   wh = window.Height;
    left_margin = ww/2-bw*5/2;
}
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-08-09 15:42:10
Great, thank you!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-09 16:05:49
i've just uploaded a new version of the rating script as well. it's centered horizontally and vertically and the hover effect only responds when actually over the stars as opposed to the whole panel like it was before.

EDIT: just uploaded another new version. it now checks if foo_playcount is installed and will prompt you if it isn't.
Title: WSH Panel Mod script discussion/help
Post by: Empty_45 on 2010-08-09 17:19:51
I would like to know if someone can help me : I try to measure the width of a string that contains \n :

var txt = "line 1\nline2";

I tried with CalcTextWidth but it returns the width of line 1 + line 2 but I'd like to obtain the value of the greater line ! I tried also with CalcTextHeight but I don't understand how it works and can't find samples here !!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-09 17:30:23
split the text into an array like this...

Code: [Select]
var some_text = "some text\nsome more text";
arr = some_text.split("\n");

arr[0] //some text
arr[1] //some more text


you could loop through the array and check the length of each line and keep the longest one.
Title: WSH Panel Mod script discussion/help
Post by: Empty_45 on 2010-08-09 18:02:16
Thank you Marc ! Works fine 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-11 03:26:03
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

i've added "similar artists" to my "simple biography" script. 



Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-11 20:38:39
samples updated. 

i decided to split "similar artists" into it's own script and have reverted "simple biography" to how it was before.

each "similar artist" now has a "search spotify" button as i think this is more useful than using foo_lastfm_radio.

(http://k5sbdw.blu.livefilestore.com/y1py2PzGMIBgFJt2H7rdfwlSbuZTWKw1zQEIt4bAwgI87HMJod13yPDP_ljIjDPIGL4bCYtLkp2v9OOymaSIS-2U9spbVV4sGGI/similar%20artists.png)

Title: WSH Panel Mod script discussion/help
Post by: mastema on 2010-08-11 23:30:05
I'm looking at your previous screenshot and I just have to ask something:

(http://i.imgur.com/WRrwb.png)

Is the rounded edge (see arrow) part of the button design or is it part of a script?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-11 23:49:03
it's just rounded rectangles offset with negative numbers so you don't see the top...

Code: [Select]
function on_paint(gr) {
    gr.FillGradRect(0, 0, ww, wh, 270, utils.GetSysColor(15), RGB(255,255,255));
    gr.SetSmoothingMode(2);
    gr.FillRoundRect(5, -8, ww-10, 48, 8, 8, RGB(210, 210, 210));
    gr.FillRoundRect(7, -6, ww-14, 44, 8, 8, RGB(245, 245, 245));
    gr.FillRoundRect(11, -2, ww-22, 40, 8, 8, RGB(245, 247, 246));
    drawAllButtons(gr);
}
Title: WSH Panel Mod script discussion/help
Post by: watercolor on 2010-08-12 12:51:18
samples updated. 

i decided to split "similar artists" into it's own script and have reverted "simple biography" to how it was before.

each "similar artist" now has a "search spotify" button as i think this is more useful than using foo_lastfm_radio.

(http://k5sbdw.blu.livefilestore.com/y1py2PzGMIBgFJt2H7rdfwlSbuZTWKw1zQEIt4bAwgI87HMJod13yPDP_ljIjDPIGL4bCYtLkp2v9OOymaSIS-2U9spbVV4sGGI/similar%20artists.png)


Nice script!
But multiple tag value is not supported, it is sad.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2010-08-13 15:35:28
Marc, I've tried your Similar Artists panel, but I can't get the spotify buttons to work.  I guess I have to install the spotify protocol on my machine, but I don't know how.  Do I need to install the despotify frontend?
Can you help a newbie like me?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-13 17:00:57
i have spotify free installed. i have no idea what despotify is? when you install the spotify app, the "spotify:" protocol automatically links in so it opens the app with the search results listed.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2010-08-13 17:54:43
i have spotify free installed. i have no idea what despotify is? when you install the spotify app, the "spotify:" protocol automatically links in so it opens the app with the search results listed.

Thanks.  Unfortunately, spotify is not available here (Belgium), and I can't download it.

Despotify is an open source implementation of the spotify app.  I don't know it, and I will not try to install it, as I prefer to stay in foobar for all audio and radio related stuff.

Maybe you should consider to make the spotify buttons optional, as spotify is available only in a few lands, and anyway, some users may prefer to not have to download the official app just to use that buttons.  (I have already replaced them with "play last.fm artist radio' buttons, so I don't need an update, but I think other users may need it.)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-13 17:59:08
ok, i can add an option to make them optional. i'll do it over the weekend sometime.

edit: i didn't realise it was so restricted. i just checked and you can only get it in

Quote
Sweden, Norway, Finland, the UK, France, Spain and the Netherlands


i knew it wasn't available in the US but i thought more european users could use it. oh well.
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2010-08-14 06:09:44
Where is your favorite band on tour?

FooTour


(http://www.abload.de/img/footour3b7bj.jpg) (http://www.abload.de/image.php?img=footour3b7bj.jpg)


Script Download: http://pastebin.de/9052 (http://pastebin.de/9052)

Updates: http://foobar-users.de/index.php?topic=200...g17454#msg17454 (http://foobar-users.de/index.php?topic=2000.msg17454#msg17454)


Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2010-08-14 17:19:23
ok, i can add an option to make them optional. i'll do it over the weekend sometime.

edit: i didn't realise it was so restricted. i just checked and you can only get it in

Quote
Sweden, Norway, Finland, the UK, France, Spain and the Netherlands


i knew it wasn't available in the US but i thought more european users could use it. oh well.

Yes, except in Belgium!  :-(

IMO, instead of the option to make the spotify buttons optional, the user should be able to chose the old behaviour (play last.fm radio).  It's also less work for you.  You have just to change the icon, the tooltip and the command, and you don't have to do different calculations for the layout of the window.

BTW, I have had to modify several of your panels, as they don't work well when a radio is playing, because the dynamic track info is not monitored.
I realized too that I don't want to permanently save the xml and images files downloaded from last.fm for the radio artists, as I don't necessarily like all artists I hear on the radios.  So, I have modified the scripts so that, when a radio is playing, it saves its files in my temp folder (with the artist name in the file names), and it removes them when the script is unloaded (when foobar is closed).  Unfortunately, I had to hardcode the temp folder, because I don't know how to retrieve the %temp% environment variable of Windows.  Do you know how to do it?  Is it possible?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-17 16:34:40
IMO, instead of the option to make the spotify buttons optional, the user should be able to chose the old behaviour (play last.fm radio).  It's also less work for you.  You have just to change the icon, the tooltip and the command, and you don't have to do different calculations for the layout of the window.


done.

Quote
Unfortunately, I had to hardcode the temp folder, because I don't know how to retrieve the %temp% environment variable of Windows.  Do you know how to do it?  Is it possible?


google?

Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell"); //this line is already in my common.js
var envVars = WshShell.Environment("USER");
var temp_path = envVars.Item("TEMP");
Title: WSH Panel Mod script discussion/help
Post by: muzack on 2010-08-17 16:58:16
Code: [Select]
var fso = new ActiveXObject("Scripting.FileSystemObject");
var temp = fso.GetSpecialFolder(2)


is possible too ( http://msdn.microsoft.com/en-us/library/a7...28VS.85%29.aspx (http://msdn.microsoft.com/en-us/library/a72y2t1c%28VS.85%29.aspx) )
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2010-08-18 08:05:49
Thanks to you both!  I've googled, of course, and found the Environment object, but I'm new to the Windows programming environment, and I find the doc pages confusing.  I did not know that it was possible to link WScript.Shell.Environment together.  (Finding the right objects is the major difficulty in object oriented programming imo.  I will have to study that stuff...)
Title: WSH Panel Mod script discussion/help
Post by: voodoomonkey on 2010-08-21 16:25:47
I know this is off current discussion but it says : "discussion/help" and I need some help with the following:

1. Panels switching inside Foobar only shows after resizing the main window. Should be immidiate. "Tech" was able to do it right but I dunno how.
2. Fade back transition from hover to normal is not smooth how to fix ?
3. How to tell the button to remain in changeState(2) which is the active state until hitting another button ?
Thanks for helping me out

WSH Panel Code:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%\skins\foooffice\scripts\Flags.txt"
// @import "%fb2k_path%\skins\foooffice\scripts\Helpers.txt"
// @import "%fb2k_path%\skins\foooffice\scripts\Buttons.txt"
// ==/PREPROCESSOR==
var DT_LEFT = 0x00000000;
var DT_RIGHT = 0x00000002;
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 DT_END_ELLIPSIS = 0x00008000;

var g_timer_started = false;
var g_timer;
var WshShell = new ActiveXObject("WScript.Shell");
var button_font = gdi.font("Calibri", 12, 0);
var gen_font = gdi.font("Calibri", 12, 0);
var codec_font = gdi.font("segoe ui", 14, 0);
var settings_dir = fb.FoobarPath + "skins\\foooffice\\settings\\";
var img_dir = fb.FoobarPath + "skins\\foooffice\\images\\";
var script_dir = fb.FoobarPath + "skins\\foooffice\\scripts\\";

function on_paint(gr) {
Foobar_hWnd = utils.GetHWND("{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}");
utils.CreateGlass(Foobar_hWnd, 0, 0, 30, 0)
gr.FillSolidRect(0, 0, ww, 30, 0xFF000000);
  for (var i in $buttons) {
    $buttons[i].draw(gr);
  }
}

function on_size() {

  ww = window.Width;
  wh = window.Height;

  if (ww <= 0 || wh <= 0) return;

$buttons = {
    button_1: new Button(5, 5, FILETAB.width / 3, FILETAB.height, FILETAB, function () {
      update_option("panel_id",1);
      }),
    button_2: new Button(60, 5, PLAYINGTAB.width / 3, PLAYINGTAB.height, PLAYINGTAB, function () {
      update_option("panel_id",2);
      })
  }
window.Repaint();
    
}

function on_mouse_move(x, y) {
buttons_on_mouse_move(x, y);
}

function on_mouse_lbtn_down(x, y) {
buttons_on_lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
buttons_on_mouse_lbtn_up(x, y);
}

function on_mouse_leave() {
buttons_on_mouse_leave();
}

function on_timer(id) {
button_on_timer(id);
}

function update_option(optname, optvalue) {
    var fso, f1, ts, s;
    var ForReading = 1;
    var ForWriting = 2;
    fso = new ActiveXObject("Scripting.FileSystemObject");

    ts = fso.OpenTextFile(settings_dir + optname + ".txt", ForReading);
    s = ts.ReadLine();
    ts.Close();

    f1 = fso.MoveFile(settings_dir + optname + "_" + s, settings_dir + optname + "_" + optvalue);

    ts = fso.OpenTextFile(settings_dir + optname + ".txt", ForWriting);
    ts.WriteLine(optvalue);
    ts.Close();
    return optvalue;
}

function read_option(optname, initvalue) {
    var fso, ts, ts2, s;
    var ForReading = 1;
    var ForWriting = 2;
    fso = new ActiveXObject("Scripting.FileSystemObject");

    if (file_exists(settings_dir + optname + ".txt") == true) {
        ts = fso.OpenTextFile(settings_dir + optname + ".txt", ForReading);
        s = ts.ReadLine();
        ts.Close();
        return s;
    } else {
        ts = fso.CreateTextFile(settings_dir + optname + ".txt", ForWriting);
        ts.WriteLine(initvalue);
        ts.Close();
        ts2 = fso.CreateTextFile(settings_dir + optname + "_" + initvalue, ForWriting);
        ts2.Close();
        return initvalue;
    }
}



This is the imported Buttons.txt

Code: [Select]
var imgPath = fb.FoobarPath + "skins\\foooffice\\images\\";
var FILETAB = gdi.Image(imgPath +"buttons\\tab_file_sprite.png");
var PLAYINGTAB = gdi.Image(imgPath +"buttons\\tab_playing_sprite.png");
var button_timer = false;
var button_timeout;
var button_font = gdi.font("Lucida Sans Unicode", 10, 0);
var g_font = gdi.font("segoe_ui", 14, 0);
var xy = false;
var hbtn;
var dbtn;

function Button(x, y, w, h, o, onclick) {

    this.x = x;
    this.y = y;
    this.w = w;
    this.h = h;
    this.o = o;
    this.onclick = onclick;
    this.oldstate = 0;
    this.state = 0;
    this.opacity = 0;
    this.refresh = 0;
    

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

// ===================================  
    
    this.changeState = function (state) {
    
        if (!button_timer) button_timer = window.CreateTimerInterval(60);
        
        this.oldstate = this.state;
        this.state = state;
        this.opacity = 0;
        this.refresh = 1;

        switch (state) {

        case 0:
            this.step = 35;
            window.SetCursor(32512);
            break;

        case 1:
            this.step = 55;
            window.SetCursor(32649);
            break;

        case 2:
            this.step = 75;
            break;

        };

    }

// =================================== Image Button
    
    this.draw = function (gr) {

        if (this.opacity < 255) gr.DrawImage(this.o, this.x, this.y, this.w, this.h, this.oldstate * this.w, 0, this.w, this.h, 0, 255);
        if (this.opacity) gr.DrawImage(this.o, this.x, this.y, this.w, this.h, this.state * this.w, 0, this.w, this.h, 0, this.opacity);
  };
  
// ===================================
    
    this.RefreshOpacity = function () {
        
        if (this.opacity < 255) this.opacity = Math.min(this.opacity + this.step, 255);
        else {            
            this.oldstate = this.state;
            this.opacity = 0;
            this.refresh = 0;
        if (this.opacity == 0) button_timeout = window.CreateTimerTimeout(5000);
           }
          
         window.RepaintRect(this.x, this.y, this.w, this.h+2);

    };

// ===================================
    
    this.onClick = function () {
        
        this.onclick && this.onclick();
    }
}

// ========================================================================== //

buttons_on_mouse_move = function(x, y){

    xy = false;

    for (var i in $buttons)

    if ($buttons[i].xy(x, y)) {

    xy = true;

    if (hbtn != $buttons[i]) {
      if (hbtn) hbtn.changeState(0);
        hbtn = $buttons[i];
        hbtn.changeState(1);
        };
    }
    
    if (xy == false) {
        if (hbtn) {
        hbtn.changeState(0);
        hbtn = undefined;
        };
    }
}

// ========================================================================== //

buttons_on_lbtn_down = function (x, y) {

    if (hbtn) {
        dbtn = hbtn;
        dbtn.changeState(2);
        hbtn = undefined;
    }
}

// ========================================================================== //

buttons_on_mouse_lbtn_up = function (x, y) {

    if (dbtn) {
        dbtn.changeState(1);
        dbtn.onClick();
        dbtn = undefined;
    }
}

// ========================================================================== //

buttons_on_mouse_leave = function () {

    if (hbtn) {
        hbtn.changeState(0);
        hbtn = undefined;
    }

    on_size();
    window.Repaint();
    
    }


// ===================================

button_on_timer = function (id) {

    if (button_timeout && id == button_timeout.ID) {
        if (button_timer) window.KillTimer(button_timer);
        button_timer = false;

    }

    for (var i in $buttons) {
        if ($buttons[i].refresh) {
            $buttons[i].RefreshOpacity();
        }
    };

}


Here you can download the pack for use in columnsUI

http://hotfile.com/dl/63610538/4ccaadb/foooffice.zip.html (http://hotfile.com/dl/63610538/4ccaadb/foooffice.zip.html)

Wshpanel Pastebin (http://pastebin.de/9246)

Buttons.txt Pastebin (http://pastebin.de/9247)
Title: WSH Panel Mod script discussion/help
Post by: Juro on 2010-08-21 21:31:09

Hi marc2003, your sample scripts are awesome! Finally something a newbie can use without cracking his head!

I just have problems making the scripts (e.g. "now playing") to follow the current selection instead of the song played. I tried this, but it didnt work (replaced line #131):

no, it's not possible to get that preference. you can edit my script to always follow the selection.  open

Code: [Select]
scripts\marc2003\v2\common.js


line 108 should be this....

Code: [Select]
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();


replace it with...

Code: [Select]
g_metadb = fb.GetFocusItem();


restart foobar (or reload script) for changes to take effect.


Any ideas?
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2010-08-21 23:42:55
Does anyone know of a way to differentiate whether or not the current playlist is an autoplaylist?  If there's no variable available to WSH Panel Mod is there a component that can automatically append something to the playlist's name that I can parse in WSH Panel Mod?  Thanks.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2010-08-22 00:25:25
Any ideas?

If you're running Vista or Win7, maybe you have not edited the right file.  Due to the way Windows now redirects your changes in protected directories to %AppData%\Local\VirtualStore, your edits are not stored where WSH expects to find them.  You should copy common.js somewhere where you have all access rights, edit it, and copy the modified version in the scripts folder, overwriting the original file.
(I'm not sure it's really your problem, but I've faced a similar problem under Win7.)

BTW, Marc, could you consider to change the default location of your scripts?  With UAC enabled, it is a pain to modify them in the foobar installation folder.  Anyway, the Program Files folder should never be modified directly by the user.  And now, the new beta version of foobar stores the optional components in the user's profile directory.  It seems logical to do the same thing for the WSH scripts.
Title: WSH Panel Mod script discussion/help
Post by: Juro on 2010-08-23 09:21:47
Any ideas?

If you're running Vista or Win7, maybe you have not edited the right file.  Due to the way Windows now redirects your changes in protected directories to %AppData%\Local\VirtualStore, your edits are not stored where WSH expects to find them.  You should copy common.js somewhere where you have all access rights, edit it, and copy the modified version in the scripts folder, overwriting the original file.
(I'm not sure it's really your problem, but I've faced a similar problem under Win7.)


Thanks for the help, but this wasn't the problem. I just figured out I made a mistake in testing and also some of the scripts needed some tweaking to work.
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2010-08-28 21:09:47
FooTheEchoNest

Provides information from http://developer.echonest.com (http://developer.echonest.com)



(http://www.abload.de/img/footheechonest108wsb.jpg) (http://www.abload.de/image.php?img=footheechonest108wsb.jpg)

Installation:
Download of "Powered By The Echo Nest" banner:
http://the.echonest.com/media/images/logos/140x50_dk.gif (http://the.echonest.com/media/images/logos/140x50_dk.gif)
Copy banner to (Profile)\foobar2000\pictures\

Script download: http://pastebin.de/9468 (http://pastebin.de/9468)

Updates: http://foobar-users.de/index.php?topic=200...g17505#msg17505 (http://foobar-users.de/index.php?topic=2000.msg17505#msg17505)
Title: WSH Panel Mod script discussion/help
Post by: XJDenton on 2010-08-30 02:07:00
Hallo,

I'm looking to create a button that changes when you mouse over it, like you get with the standard panel stack splitter behavior. I'm mostly sorted except I cant find out what function I need to create the mouse over behavior. Is it on_mouse_over I need or something similar?

Cheers
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-08-30 05:04:50
Marc, having trouble with your similar artists script in regards to playing a last.fm radio station...

I have foo_lastfm_radio installed, with my username and pass filled in, as well as all associations regarding last.fm:// squared away, yet I'm still getting the error message when I try to click on a radio link.
Title: WSH Panel Mod script discussion/help
Post by: Empty_45 on 2010-08-30 10:11:54
Is it on_mouse_over I need or something similar?


function on_mouse_move(x,y) {
}
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-08-31 02:32:16
Marc, having trouble with your similar artists script in regards to playing a last.fm radio station...

I have foo_lastfm_radio installed, with my username and pass filled in, as well as all associations regarding last.fm:// squared away, yet I'm still getting the error message when I try to click on a radio link.


Fixed this by inseting sa_artists[index] into line 156 instead of whatever was there before for the artist name 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-08-31 09:37:07
oops. i've fixed the online version as well. i stupidly copy/pasted that section from another script which uses different names. 
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2010-08-31 17:58:16
I have got an working code from tedgo and i want to add
Costum Database Rating %RATING_CD%
and if it is possible love and unlove for LastFM
(I use the LastFM script from marc2003)

Could anyone help me please? 

that's my foobar skin Silent Night for fb2k v.1+ (http://arnie77.deviantart.com/#/d2k323j)


Global Button Script.js

Code: [Select]
// Global Button Script
// Code by T.P Wang and tedGo

var ButtonStates = {normal: 0, hover: 1, down: 2, hide: 3};
var Buttons = {};
var g_down = false;

// ----- CREATE BUTTON OBJECT --------------------------------------
var g_tooltip;

function Button(x, y, w, h, img_src, func, tiptext) {
this.left = x;
this.top = y;
this.w = w;
this.h = h;
this.right = x + w;
this.bottom = y + h;
this.func = func;
this.tiptext = tiptext;
this.state = ButtonStates.normal;
this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
this.img = this.img_normal;

this.alterImage = function(img_src) {
this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
this.changeState(this.state);
}

this.traceMouse = function(x, y) {
if (this.state == ButtonStates.hide) return false;

var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);

if (b)
g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
else
this.changeState(ButtonStates.normal);
return b;
}

this.changeState = function(newstate) {
newstate != this.state && window.RepaintRect(this.left, this.top, this.w, this.h);
this.state = newstate;
switch (this.state) {
case ButtonStates.normal:
this.img = this.img_normal;
break;

case ButtonStates.hover:
this.img = this.img_hover;
break;

case ButtonStates.down:
this.img = this.img_down;
break;

default:
this.img = null;
}
}

this.changePos = function(x, y, w, h) {
this.left = x;
this.top = y;
this.w = w;
this.h = h;
this.right = x + w;
this.bottom = y + h;
}

this.draw = function(gr) {
this.img && gr.DrawImage(this.img, this.left, this.top, this.w, this.h, 0, 0, this.w, this.h);
}

this.repaint = function() {
window.RepaintRect(this.left, this.top, this.w, this.h);
}

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

this.onMouseIn = function() {
g_tooltip = window.CreateTooltip();
g_tooltip.Text = this.tiptext;
g_tooltip.Activate();
}

this.onMouseOut = function() {
g_tooltip.Deactivate();
g_tooltip.Dispose();
}
}

function buttonsDraw(gr) {
for (var i in Buttons) {
Buttons[i].draw(gr);
}
}

function buttonsTraceMouse(x, y) {
var btn = null;
for (var i in Buttons) {
if (Buttons[i].traceMouse(x, y) && !btn)
btn = Buttons[i];
}
return btn;
}

// ----- MOUSE ACTIONS ---------------------------------------------
var cur_btn = null;
var btn_down;

function on_mouse_move(x, y) {
var btn = buttonsTraceMouse(x, y);

if (btn != cur_btn) {
cur_btn && cur_btn.onMouseOut();
btn && btn.onMouseIn();
}

cur_btn = btn;
}

function on_mouse_lbtn_down(x, y) {
g_down = true;
(btn_down = cur_btn) && cur_btn.changeState(ButtonStates.down);
}

function on_mouse_lbtn_up(x, y) {
if (cur_btn) {
cur_btn.changeState(ButtonStates.hover);
btn_down == cur_btn && cur_btn.onClick(x, y);
}

g_down = false;
}

function on_mouse_leave() {
cur_btn && cur_btn.changeState(ButtonStates.normal);
}


Popup-Rating Menu

Code: [Select]

// Popup-Rating Menu
// Code by tedGo

// ==PREPROCESSOR==
// @import "%fb2k_path%Silent Night\scripts\Global Button Script.js"
// ==/PREPROCESSOR==

var ww = 0; wh = 0;

// ----- CREATE BUTTON ---------------------------------------------
var imgPath = fb.FoobarPath + "Silent Night\\images\\";
Buttons.RAT = new Button(0, 0, 39, 20, {normal: imgPath + "Rate.png", hover: imgPath + "Rate1.png"}, getRatingMenu);

// ----- CREATE MENU -----------------------------------------------
function RateMode() {
rm = window.GetProperty("Rating Mode", 0);
if (typeof rm < 0 || rm > 1) rm = 0;
return rm;
}

RateMode();

function getRatingMenu(x, y) {
x = Buttons.RAT.left;
y = Buttons.RAT.top;

var a = window.CreatePopupMenu();
var g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
var isRating = fb.TitleFormat("$if2(%rating%,0)").EvalWithMetadb(g_metadb);
var delRating = isRating > 0 ? 0 : 1;
var idx;


a.CheckMenuRadioItem(101, 102, rm + 101);

a.AppendMenuItem(0, 101, "Database Rating");
a.AppendMenuItem(0, 102, "Tag Rating");
a.CheckMenuRadioItem(101, 102, rm + 101);
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 1, "Rating 1 - ★");
a.AppendMenuItem(0, 2, "Rating 2 - ★★");
a.AppendMenuItem(0, 3, "Rating 3 - ★★★");
a.AppendMenuItem(0, 4, "Rating 4 - ★★★★");
a.AppendMenuItem(0, 5, "Rating 5 - ★★★★★");
a.CheckMenuRadioItem(1, 5, isRating);
a.AppendMenuItem(delRating, 6, "Remove Rating");

idx = a.TrackPopupMenu(x, y);

switch (true) {
case (idx >= 101 && idx <= 102):
window.SetProperty("Rating Mode", idx - 101);
RateMode();
break;

case (idx >= 1 && idx <= 5):
rm == 0 ? fb.RunContextCommandWithMetadb("Rating/" + idx, g_metadb) : g_metadb.UpdateFileInfoSimple("Rating", idx);
break;

case (idx == 6):
fb.IsMetadbInMediaLibrary(g_metadb) ? fb.RunContextCommandWithMetadb("Rating/<not set>", g_metadb) : g_metadb.UpdateFileInfoSimple("Rating", "");
break;
}

a.Dispose();
}


//Fixed coords for menu
function on_mouse_rbtn_down(x, y) {

}function on_mouse_rbtn_down(x, y, vkey){
rbtnDown = vkey==6 ? true : false;
}

function on_mouse_rbtn_up(x, y, vkey){
if (rbtnDown) {
rbtnDown=false;
return vkey==4 ? false : true;
} else
return true;
}

// ----- DRAW ------------------------------------------------------
function on_paint(gr) {
buttonsDraw(gr);
}

// ----- EVENTS ----------------------------------------------------
function on_size() {
ww = window.Width;
wh = window.Height;

Buttons.RAT.changePos(0, 0, 39, 20);   
}

Title: WSH Panel Mod script discussion/help
Post by: Nowings69 on 2010-09-01 14:24:40
Allways thanks to grimes and marc2003
Well,how to display console on the WSH-MOD?
Please help me,foo_cosole is only system color
Title: WSH Panel Mod script discussion/help
Post by: MB. on 2010-09-01 22:13:40
little update for my lastfm script

(http://th02.deviantart.net/fs70/300w/i/2010/244/e/6/foo_silk_lastfm_1_0_by_matthijsb-d2xrp69.png) (http://matthijsb.deviantart.com/art/foo-silk-lastfm-1-0-177652017)
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2010-09-02 23:28:05
Vertical scrollbar

After some (laborious) studies, I have finally written a script that you may find useful.  It's a file to import in your script to easily define a viewport in the WSH window, with a vertical scrollbar that the user can use to scroll the content of a bitmap vertically.  Keyboard and mouse scrolling are also supported (but are optional).

The scrollbar is configurable.  For example, it can be automatically hid when the mouse leave the WSH window or when it is useless, it can be placed on the left side of the viewport, you can change the colors (including the alpha channel), etc....

Download: main site (no wait) (http://download.videohelp.com/r0lZ/scrollbar_0.1.zip) or alternate download link (4shared) (http://www.4shared.com/file/mxsqG0Tc/scrollbar_01.html)

The archive contains scrollbar.js.  It's the main script, to import in your application.  It is fully documented.

There are also two demo scripts:

scrollbar_demo.js is a totally useless and stupid demo, with many comments.

info_text_viewer.js is a somewhat more useful script, that displays the content of the "info.txt" file in the folder containing the currently playing or focussed audio file, or, if that file doesn't exist, the first .txt file it finds in the folder.  (See image below.)

You will probably have to change the @import directive in the demo files, as my scripts are in "%fb2k_profile_path%\wsh_scripts\".

Feel free to report bugs or post suggestions in this thread.

info_text_viewer.js:
(http://img340.imageshack.us/img340/2162/textviewer.png)
Title: WSH Panel Mod script discussion/help
Post by: voodoomonkey on 2010-09-03 14:41:35
I am having trouble reversing the fading of the button states. Currently it's fading in when mouseover and simply dissappearing when mouseout. I want it the other way round. Like fade-in on_mouseover and disappearing when mouseout.

Image fade buttons (http://javascript.pastebin.com/dbWMmziw)

If you need the images for testing simply put any image into either the defined folder or change img_path and var sprite to your likeness.

Hope someone can figure this out.
Title: WSH Panel Mod script discussion/help
Post by: voodoomonkey on 2010-09-07 17:23:47
No one who could help me ? Either simplify this script or fix the fading ? If so maybe someone can tell me how to adress the output of a timer to use it as input of a function which changes the alpha
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-09-14 11:49:07
It's really strange that foobar has so many troubles with providing lyrics (to me at least)
Only valid component seems to be made years ago by author - ssenna, with elements still in alpha stage and accessible by Columns UI users only. OTOH other users have choice of primitive text display element for displaying general tags and maybe lyrics if they contain novel

However I made simple CGI VBS (http://pastebin.com/LzWQ47Es) for biography view some time ago http://www.hydrogenaudio.org/forums/index....st&p=717583 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70955&view=findpost&p=717583), based on foo_lyricsdb interaction, kindly provided and maintained by dug, and it's working great but biography view can have only one instance with contents, so it's pretty useless generally. I also tried to access Winamp's lyricsplugin.com but they made some ajax trick not beatable by VBS scripting (unless you evoke IE panel)

So to cut this crap, is there ready-made WSH panel that can display provided text as lyrics. I found some posts with dead links so can't say
Not that it would be elegant foobar solution, but perhaps better then all those crash-ware available
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-09-14 13:14:54
afaik no. But i've planned to code a such panel (WSH panel Mod) all i need is free time now, the community will informed when it will be done ... or maybe some will code one before me
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-09-14 19:00:46
Thanks for confirmation... looking forward to your solution
Title: WSH Panel Mod script discussion/help
Post by: MB. on 2010-09-16 11:48:01
@romor: try this: http://matthijsb.deviantart.com/art/nfoo-V...r-1-1-170638369 (http://matthijsb.deviantart.com/art/nfoo-Viewer-1-1-170638369)
it searches the directory of the music you're playing for .nfo, .txt & .log files and displays them in a wsh panel.
you could change the code a bit so it reads the lyrics tag for example, or let it search a txt file for the lyrics you need.
Title: WSH Panel Mod script discussion/help
Post by: TomBarlow on 2010-09-16 12:27:17
I made a track display panel that shows lyrics, it doesn't do synced lyrics though. It would be possible to make it do that, but since I don't have synced lyrics I can't be bothered. If anyone wants to modify it so it does, feel free.

You'll need something like lyricsgrabber2 to get the lyrics.

I can't remember if I posted this already, oh well.

Download: http://www.hydrogenaudio.org/forums/index....showtopic=83696 (http://www.hydrogenaudio.org/forums/index.php?showtopic=83696)
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-10-09 18:35:03
Marc, how tough would it be to implement a cycle mode for Thumbs 2?
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-10-11 22:19:55
@marc2003

Hi,
just a quick question:
My "now playing" panel doesn't downloads artist pictures automatically even if it's ticked in the right click menu. 
I always have to download them manually choosing "download artist art from lastfm".

Newest WSH_Panel, Samples, Columns_Ui and Foobar.

Since I have no Idea why it would be nice if you could help me out.



Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-12 09:42:49
Thanks for confirmation... looking forward to your solution


Hello,

Ok, so here is my lyrics script for WSH panel Mod  ... it maybe needs some code optimization but it works fine apparently

get it here : http://pastebin.com/NHSLyrHu (http://pastebin.com/NHSLyrHu)

Lyriks 1.0 (build 20101012.0815) - a WSH lyrics module by Br3tt
- This WSH script get lyrics from TAG first then from local file in foobar2000\lyrics\
then it displays them (scrolling)
- It handles TXT and LRC format (sync handled), but not the LRC Enhanced format
(it translates eLRC to a normal LRC text)
- Comments, Blank lines, Info lines are ignored.
- Manual Scrolling possible with the mousewheel (double click on the panel to re-center on the active line)
- Requirements :
  1) foobar2000
  2) WSH Panel Mod component
  3) this script in a WSH panel
  4) Optional: a lyrics grabber (i.e: Lyric Show Panel by hidding the panel, foo_lyricsDB, ...)
- Some settings are available by using the panel Properties (right click on WSH panel -> Properties)

Please, gimme feedback
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-10-12 11:56:09
Marc, how tough would it be to implement a cycle mode for Thumbs 2?


not that tough. laziness is a factor though.

My "now playing" panel doesn't downloads artist pictures automatically even if it's ticked in the right click menu. 
I always have to download them manually choosing "download artist art from lastfm".


my mistake. i've uploaded a fixed version or you can just change this on line 54...

Code: [Select]
if(arr.length == 0 && window.GetProperty("auto") == 1001) {


to this

Code: [Select]
if(arr.length == 0 && window.GetProperty("auto")) {



Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2010-10-12 16:56:40
my mistake. i've uploaded a fixed version or you can just change this on line 54...

Thanks, it works now.
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2010-10-13 01:17:50
Marc, how tough would it be to implement a cycle mode for Thumbs 2?


not that tough. laziness is a factor though.



It's cool. I actually switched to Thumbs 1 now, so I don't even care anymore 
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-10-13 17:21:07
I thought I'd asked this before, but I can't seem to find the question or answer anymore.
Anyway, is there a tutorial where I can learn the basics of what is needed to fully understand the structure of the code that is used in the WSH Panel Mod.
I'm able to alter the code (is it Jscript or Javascript?) here and there from existing scripts, but to start one from scratch is something different.

cheers r3v0
Title: WSH Panel Mod script discussion/help
Post by: Wooops on 2010-10-14 05:22:15
@marc2003

For some reason I´m having troubles with thumbs & thumbs2. I´m getting 0xc0000135 error from art.exe when trying to download the images.
If I set the custom folder mode say with "*.jpg" it always displays "no image". I´m using the latest version. Thanks in advanced.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-10-14 09:58:33
^i think that error is because art.exe requires the net framework 2.0 installed.

as for custom folder mode simply put the path to a folder. you don't specify wildcards for filenames - it automatically reads all jpg files.
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2010-10-14 17:29:39
Falstaff - Just tried out your lyrics viewer script, and it works really well.  I like it better than all the other lyrics display options.  One request visually I would like is the option to use the default panel color.  I tried to switch "plain color background" toggle to True in the properties, and I got a script error.  I also tried to change the color values in the script itself and noticed you used RGBA instead of RGB so we can't edit that to match the rest of the panels.

Thanks for the script!  Works great with synced and unsynced embedded lyrics!  I don't have non-embedded lyrics so I can't attest to that performance.
Title: WSH Panel Mod script discussion/help
Post by: Wooops on 2010-10-15 06:39:44
Yep that was the reason. Got the config part as well.
Thanks marc2003, they are working nice
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-15 06:57:43
Falstaff - Just tried out your lyrics viewer script, and it works really well.  I like it better than all the other lyrics display options.  One request visually I would like is the option to use the default panel color.  I tried to switch "plain color background" toggle to True in the properties, and I got a script error.  I also tried to change the color values in the script itself and noticed you used RGBA instead of RGB so we can't edit that to match the rest of the panels.

Thanks for the script!  Works great with synced and unsynced embedded lyrics!  I don't have non-embedded lyrics so I can't attest to that performance.


thanx for your feedback, i'll fix what you point to me with default background colour asap.

PS1: fix the script error by replacing line 168 : "g_bgcolour" by "g_plainbg_colour" ... my bad
PS2: RGBA() is like RGB() with just an alpha composant for adjusting tranparency ! just set the 4th value to 255 to obtain the same result of RGB()
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-15 08:30:57
WOW Falstaff, this is excellent script! Thanks for making it man

(http://i.imgur.com/2T88O.png)

- It would be nice "DEFAULT_OFFSET" to be synced with "LINE_HEIGHT"
- Some lyrics with timestamps aren't recognized. I couldn't find why
- Some time ago I made VBS that fetches lyrics automatically from dug's database: http://www.hydrogenaudio.org/forums/index....st&p=717583 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70955&view=findpost&p=717583) Can you merge it somehow in your script if it is possible, as I don't understand JS?
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-15 09:37:55
WOW Falstaff, this is excellent script! Thanks for making it man

(http://i.imgur.com/2T88O.png)

- It would be nice "DEFAULT_OFFSET" to be synced with "LINE_HEIGHT"
- Some lyrics with timestamps aren't recognized. I couldn't find why
- Some time ago I made VBS that fetches lyrics automatically from dug's database: http://www.hydrogenaudio.org/forums/index....st&p=717583 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70955&view=findpost&p=717583) Can you merge it somehow in your script if it is possible, as I don't understand JS?

can you give me this skin you make? it is very beautiful. please^^
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-15 10:23:57
Here is default UI theme (http://goo.gl/w2An)

@Falstaff: Also some lyrics aren't shown. I can't find reason why - same release, same tag scheme etc., but for some tracks lyrics are shown while for others not
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-15 16:20:27
Here is default UI theme (http://goo.gl/w2An)

@Falstaff: Also some lyrics aren't shown. I can't find reason why - same release, same tag scheme etc., but for some tracks lyrics are shown while for others not


gimme the lyrics file (if embedded lyrics, paste them in a .txt) that doesn't work, to check what's wrong with it.

*waits*



PS: maybe (if embedded lyrics) it's due to the TAG name used for the lyrics, not handled by my script ? I only check for %LYRICS%, %LYRIC%, %UNSYNCED LYRICS% and %UNSYNCED LYRIC% ...
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-15 16:47:33
Falstaff, those lyrics doesn't have CRLF separator, so line was too long perhaps?

For timestamped lyrics there are some issues. Valid format by your script is [mm:ss.cc]
- it will fail, if lyrics have millisecond [mm:ss.uuu]
- or if minute digit isn't padded with zero [m:ss.cc]
- or if any kind of lyrics have square brackets in it "["

So maybe you should check if string inside square brackets has ":" separators and separated parts are numbers. Maybe just translate any possible time stamp to 00:00.000 and then process it. Like if time stamp is m:ss then you quickly process it to mm:ss.000 and go

edit: perhaps even ":" as centisecond separator instead ".", can be found in some online services providing LRC. It shouldn't be too hard to consider all this different scenarios
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-15 18:40:06
hmm, weird LRC timestamp format btw ... but the script have to handle them, so ok, i'll try to include this schemes in bext version
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-16 05:06:23
hmm, weird LRC timestamp format btw ... but the script have to handle them, so ok, i'll try to include this schemes in bext version


your work is the best!!  But it doesn't read (or load) the lrc file in the file's folder.  for exam:" leka - trable is a friend.lrc"in the leka folder.

can you make it happen. because my lrc almost all exist with "lrc file" style

http://cid-7c6fa1eb8fb8f2b7.photos.live.co...%E5%9B%BE00.png (http://cid-7c6fa1eb8fb8f2b7.photos.live.com/self.aspx/Blog%20Images/%E6%88%AA%E5%9B%BE00.png)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-16 09:16:49
hmm, weird LRC timestamp format btw ... but the script have to handle them, so ok, i'll try to include this schemes in bext version


your work is the best!!  But it doesn't read (or load) the lrc file in the file's folder.  for exam:" leka - trable is a friend.lrc"in the leka folder.

can you make it happen. because my lrc almost all exist with "lrc file" style

http://cid-7c6fa1eb8fb8f2b7.photos.live.co...%E5%9B%BE00.png (http://cid-7c6fa1eb8fb8f2b7.photos.live.com/self.aspx/Blog%20Images/%E6%88%AA%E5%9B%BE00.png)


as said in the comments of the script, "- This WSH script get lyrics from TAG first then from local file in foobar2000\lyrics\ "

be sure that your lrc files are stored in ...\foobar2000\lyrics\ or just change this path by yours in the script ... AND the filename must be <artist> -<Track_title>.lrc (it's the syntax to respect for .lrc read from disk (generated by Lyrics Show panel 2, i used the same), but you can change the syntax from the script too if your is slightly different ==> in your screenshot, there is a blank char just after the "-", not in my syntax, so add a blank char in the script line 649

or wait for my fix, i will handle more filenames syntax to fit with more schemes
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-16 10:24:59
hmm, weird LRC timestamp format btw ... but the script have to handle them, so ok, i'll try to include this schemes in bext version


your work is the best!!  But it doesn't read (or load) the lrc file in the file's folder.  for exam:" leka - trable is a friend.lrc"in the leka folder.

can you make it happen. because my lrc almost all exist with "lrc file" style

http://cid-7c6fa1eb8fb8f2b7.photos.live.co...%E5%9B%BE00.png (http://cid-7c6fa1eb8fb8f2b7.photos.live.com/self.aspx/Blog%20Images/%E6%88%AA%E5%9B%BE00.png)


as said in the comments of the script, "- This WSH script get lyrics from TAG first then from local file in foobar2000\lyrics\ "

be sure that your lrc files are stored in ...\foobar2000\lyrics\ or just change this path by yours in the script ... AND the filename must be <artist> -<Track_title>.lrc (it's the syntax to respect for .lrc read from disk (generated by Lyrics Show panel 2, i used the same), but you can change the syntax from the script too if your is slightly different ==> in your screenshot, there is a blank char just after the "-", not in my syntax, so add a blank char in the script line 649

or wait for my fix, i will handle more filenames syntax to fit with more schemes



you didn't understand me

my music is under

"H:\music\Sarah\"
"H:\music\Michael Jackson\"
"H:\music\Westlife\"
"H:\music\Simon & Garfunkel\"
"H:\music\Carpenters\"
………………………………

one artist's musics and lyrics are in one folder.

so how i write the code?

i try to write a code

Code: [Select]
var lyrics_dir =fb.Titleformat("$replace($replace(%path%,%filename_ext%,),\,\\)");


but it doesn't work,please help me

ps:the road in wsh is "\\"or "\“?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-16 10:35:08
sorry, my bad.

let me check this and include that path as default too...
Title: WSH Panel Mod script discussion/help
Post by: voodoomonkey on 2010-10-16 11:59:09
The samples that come with WSH Panel contain a script sample which lets you blur a text object and use that as a glow effect. Could someone with more experience in graphics programming explain to me how exactly this script works ?

Can this be applied to an image like a bitmap or png ?

- Simply defining an image as "img_to_blur" does not seem to have an effect.

Could this if the above works also be animated with a timerinterval object ?

Thanks for help.
Title: WSH Panel Mod script discussion/help
Post by: Robson on 2010-10-16 14:46:10
Marc, how tough would it be to implement a cycle mode for Thumbs 2?


not that tough. laziness is a factor though.


How to overcome Laziness (http://www.wikihow.com/Overcome-Laziness)  I'd like that, too. Any chance?
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-10-16 22:56:07
Vertical scrollbar

After some (laborious) studies, I have finally written a script that you may find useful.  It's a file to import in your script to easily define a viewport in the WSH window, with a vertical scrollbar that the user can use to scroll the content of a bitmap vertically.  Keyboard and mouse scrolling are also supported (but are optional).

...


r0lZ

I am trying to use our scrollbar script with buttons in it.
I'm succeeding in defining the buttons (i'm using tooltip_buttons.js) I can use them,
but i can't see the buttons that are outside the view you start with, before you scroll.

I'm guessing the y-coordinate of the buttons should move also when you scroll,
but i can't seem to find where you defined it.
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-17 03:33:38
sorry, my bad.

let me check this and include that path as default too...



when your modified work shows?

i really like this "lyriks" wsh code.

I will go to home , soon. Please hurry , thank you very very very very much
Title: WSH Panel Mod script discussion/help
Post by: asionwu on 2010-10-18 04:05:08
sorry, my bad.

let me check this and include that path as default too...



when your modified work shows?

i really like this "lyriks" wsh code.

I will go to home , soon. Please hurry , thank you very very very very much


Code: [Select]
// Paths
var metadb = fb.IsPlaying ? fb.GetNowPlaying() : false;
var lyrics_dir = fb.Titleformat("$replace($replace(%path%,%filename_ext%,),\,\\)").EvalWithMetadb(metadb);


Code: [Select]
g_lyrics_filename = artist.Eval() + " -" + title.Eval();

------------>>

g_lyrics_filename = artist.Eval() + " - " + title.Eval();
Title: WSH Panel Mod script discussion/help
Post by: asionwu on 2010-10-18 06:50:32
Code: [Select]
// Paths
[s]var metadb = fb.IsPlaying ? fb.GetNowPlaying() : false;[/s]

var metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
var lyrics_dir = fb.Titleformat("$replace($replace(%path%,%filename_ext%,),\,\\)").EvalWithMetadb(metadb);


Code: [Select]
function on_playback_new_track(info) {
    g_playtimer && window.KillTimer(g_playtimer);
    pos = 0;
    g_scroll = 0;
    g_is_scrolling = false;
    get_lyrics();
    change_focus();
    if (g_lyrics_status > 0) {
        g_playtimer = window.CreateTimerInterval(PLAYTIMER_VALUE);
    }
    lyrics_dir = fb.Titleformat("$replace($replace(%path%,%filename_ext%,),\,\\)").EvalWithMetadb(metadb);
}


Code: [Select]
g_lyrics_filename = artist.Eval() + " -" + title.Eval();

------------>>

g_lyrics_filename = artist.Eval() + " - " + title.Eval();
Title: WSH Panel Mod script discussion/help
Post by: asionwu on 2010-10-18 10:39:53
To hejiame

Code: [Select]
/*
====================================================================================================
=======
Lyriks 1.0 (build 20101012.0815) - a WSH lyrics module by Br3tt
- This WSH script get lyrics from TAG first then from local file in foobar2000\lyrics\
then it displays them (scrolling)
- It handles TXT and LRC format (sync handled), but not the LRC Enhanced format
(it translates eLRC to a normal LRC text)
- Comments, Blank lines, Info lines are ignored.
- Manual Scrolling possible with the mousewheel (double click on the panel to re-center on the active line)
- Requirements :
  1) foobar2000
  2) WSH Panel Mod component
  3) this script in a WSH panel
  4) Optional: a lyrics grabber (i.e: Lyric Show Panel by hidding the panel, foo_lyricsDB, ...)
- Some settings are available by using the panel Properties (right click on WSH panel -> Properties)
- This script don't make any changes to your files and write nothing on your system.
It's just a read&display data script.
====================================================================================================
=======
*/
 
// Text formatting function
// {{
function StringFormat() {
    var h_align = 0,
        v_align = 0,
        trimming = 0,
        flags = 0;
    switch (arguments.length) {
        // fall-thru
    case 4:
        flags = arguments[3];
    case 3:
        trimming = arguments[2];
    case 2:
        v_align = arguments[1];
    case 1:
        h_align = arguments[0];
        break;
    default:
        return 0;
    }
    return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}
StringAlignment = {
    Near: 0,
    Centre: 1,
    Far: 2
};
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
// }}
 
//{{
// IO Mode
var ForReading = 1;
var ForWriting = 2;
var ForAppending = 8;
//}}
 
//{{
// Paths
var metadb = fb.IsPlaying ? fb.GetNowPlaying() : false;
if (metadb){
var lyrics_dir = fb.Titleformat("$replace($replace(%path%,%filename_ext%,),\,\\)").EvalWithMetadb(metadb);
}
else{
var lyrics_dir = "C:\\"
}
//fb.trace(lyrics_dir);
lyrics_folder_exists();
//}}
 
//{{
// new object
sentence = function () {
    this.type = null;
    this.timer = 0;
    this.text = "";
    this.total_lines = 0;
    this.ante_lines = 0;
}
//}}
 
function RGBA(r, g, b, a) {
    return ((a << 24) | (r << 16) | (g << 8) | (b));
}
 
// ================================================/ TF
var len_seconds = fb.Titleformat("%length_seconds%");
var elap_seconds = fb.TitleFormat("%playback_time_seconds%");
var artist = fb.Titleformat("$replace(%artist%,'/','_')");
var title = fb.Titleformat("%title%");
var lyrics = fb.TitleFormat("[$if2(%LYRICS%,$if2(%LYRIC%,$if2(%UNSYNCED LYRICS%,%UNSYNCED LYRIC%)))]");
 
// ================================================/ Declarations
var g_font = gdi.Font("segoe ui", 12, 0);
var g_playtimer;
var ww = 0,
    wh = 0;
var g_fso = new ActiveXObject("Scripting.FileSystemObject");
var g_file = null;
var g_tab = Array();
var g_scroll = 0;
var g_lyrics_filename;
var g_lyrics_status;
var focus = 0;
var focus_next = 0;
var g_plainbg_colour;
var g_ovbg_normalcolour;
var g_ovbg_highlightcolour;
var g_txt_normalcolour;
var g_txt_highlightcolour;
var g_txt_shadowcolour;
var centiemes = 0;
var g_is_scrolling = false;
var g_multi_balise = false;
var g_balise_total;
var g_balise_char_offset;
var g_tab_length;
 
var midpoint;
var pos;
 
// ================================================/ Settings
var PLAYTIMER_VALUE = window.GetProperty("Timer value in ms [10;100]", 10);
var LINE_HEIGHT = window.GetProperty("Line height [20;30]", 24);
var TEXT_SHADOW = window.GetProperty("Text shadow (true/false)", true);
var PLAIN_COLOR_BG = window.GetProperty("Plain colour background (true/false)", false);
var DITHER = window.GetProperty("Top & Botom dither (true/false)", true);
var H_PADDING = window.GetProperty("Horizontal padding [0;20]", 20);
var TXT_ALIGN = window.GetProperty("Text alignment (left/center/right)", "center");
var LIGHT_BG = window.GetProperty("Light background", true);
var DEBUG = false;
var DEFAULT_OFFSET = 29;
 
// START
function on_size() {
    var k;
    ww = window.Width;
    wh = window.Height;
 
    // exit test on useless calls made (wsh tweak)
    if (!ww && !wh) return true;
 
    midpoint = wh / 2 - LINE_HEIGHT / 2;
 
    // colours
    g_plainbg_colour = RGBA(140, 200, 250, 255);
    g_ovbg_normalcolour = RGBA(000, 000, 000, 130);
    g_ovbg_highlightcolour = RGBA(020, 100, 240, 130);
    g_txt_normalcolour = RGBA(200, 200, 210, 255);
    g_txt_highlightcolour = RGBA(255, 255, 255, 255);
    g_txt_shadowcolour = RGBA(000, 000, 000, 150);
 
    g_playtimer && window.KillTimer(g_playtimer);
 
    if (fb.IsPlaying || fb.IsPaused) {
        g_scroll = 0;
        g_is_scrolling = false;
        get_lyrics();
        change_focus();
        k = g_tab[focus].ante_lines * LINE_HEIGHT;
        if (g_lyrics_status > 0) {
            pos = midpoint - k;
            g_playtimer = window.CreateTimerInterval(PLAYTIMER_VALUE);
        } else {
            delta = (g_tab[g_tab.length - 1].ante_lines + g_tab[g_tab.length - 1].total_lines);
            pos = (wh / 2) - (delta * LINE_HEIGHT / 2);
        }
    }
}
 
function on_paint(gr) {
    PLAIN_COLOR_BG && gr.FillSolidRect(0, 0, ww, wh, g_bgcolour);
    if (fb.IsPlaying || fb.IsPaused) {
        show_lyrics(gr, g_tab, pos);
        DEBUG && gr.GdiDrawText(g_lyrics_status.toString(), g_font, g_normalcolour, 5, 5, ww, LINE_HEIGHT, DT_TOP | DT_LEFT | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
    }
    DITHER && gr.FillGradRect(0, 0, ww, 11, 90, g_txt_shadowcolour, RGBA(0, 0, 0, 0));
    DITHER && gr.FillGradRect(0, wh - 11, ww, 11, 270, g_txt_shadowcolour, RGBA(0, 0, 0, 0));
}
 
function on_mouse_lbtn_dblclk(x, y, mask) {
    on_size();
}
 
function on_mouse_leave() {
    window.Repaint();
}
 
function on_playback_time(time) {
    // at each new seconde, centiemes is reset to 0 (Increment on timer every 100ms)
    centiemes = 0;
    if (g_lyrics_status == 0) {
        if (elap_seconds.Eval() == 3) {
            on_size();
        }
        window.Repaint();
    }
}
 
function on_playback_new_track(info) {
    g_playtimer && window.KillTimer(g_playtimer);
    pos = 0;
    g_scroll = 0;
    g_is_scrolling = false;
metadb = fb.IsPlaying ? fb.GetNowPlaying() : false;
    lyrics_dir = fb.Titleformat("$replace($replace(%path%,%filename_ext%,),\,\\)").EvalWithMetadb(metadb);
    get_lyrics();
    change_focus();
    if (g_lyrics_status > 0) {
        g_playtimer = window.CreateTimerInterval(PLAYTIMER_VALUE);
    }
// fb.trace(lyrics_dir);
}
 
function on_playback_seek(time) {
    var k;
    if (g_lyrics_status > 0) {
        g_scroll = 0;
        g_is_scrolling = false;
        change_focus();
        k = g_tab[focus].ante_lines * LINE_HEIGHT;
        pos = midpoint - k;
        window.Repaint();
    }
}
 
function on_playback_stop(reason) {
    g_playtimer && window.KillTimer(g_playtimer);
    if (reason == 0) {
        // Stop
        window.Repaint();
    }
}
 
function on_mouse_wheel(delta) {
    if (g_lyrics_status > 0) {
        if (delta > 0) {
            pos = (pos >= midpoint) ? pos : pos + LINE_HEIGHT;
        } else {
            pos = (pos <= (wh / 2 - g_tab_length * LINE_HEIGHT)) ? pos : pos - LINE_HEIGHT;
        }
        window.Repaint();
    }
}
 
function on_timer(id) {
    var t1 = elap_seconds.Eval() * 100 + centiemes;
    var t2 = len_seconds.Eval() * 100;
    var p1, p2;
 
    if (t1 > t2 - 100) {
        g_playtimer && window.KillTimer(g_playtimer);
    }
 
    if (g_playtimer) {
        if (g_playtimer.ID == id) {
            if (!g_is_scrolling && t1 >= g_tab[focus_next].timer) {
                p1 = g_tab[focus].ante_lines * LINE_HEIGHT;
                p2 = g_tab[focus_next].ante_lines * LINE_HEIGHT;
                g_scroll = p2 - p1;
                change_focus();
                g_is_scrolling = true;
            }
            if (g_scroll > 0) {
                pos--;
                g_scroll--;
                window.Repaint();
            } else {
                g_is_scrolling = false;
            }
            centiemes = (centiemes > 98) ? 0 : (centiemes + 1);
        }
    }
}
 
function show_lyrics(gr, tab, posy) {
    var i, k;
    var text_colour;
    var txt_align;
 
    gr.SetTextRenderingHint(5);
    gr.SetSmoothingMode(2);
 
    switch (TXT_ALIGN.toUpperCase()) {
    case "LEFT":
        txt_align = lc_stringformat;
        break;
    case "CENTER":
        txt_align = cc_stringformat;
        break;
    case "RIGHT":
        txt_align = rc_stringformat;
        break;
    default:
        txt_align = cc_stringformat;
    }
 
    if (g_lyrics_status > 0) {
        if (posy >= 0) {
            LIGHT_BG && gr.FillSolidRect(0, Math.floor(posy - wh / 2), ww, Math.floor(wh / 2), g_ovbg_normalcolour);
        }
    } else {
        LIGHT_BG && gr.FillSolidRect(0, 0, ww, wh, g_ovbg_normalcolour);
    }
 
    for (i = 0; i < tab.length; i++) {
        if (Math.round(posy) >= (LINE_HEIGHT * -4) && Math.round(posy) < wh) {
            if (i == focus && g_lyrics_status == 1) {
                text_colour = g_txt_highlightcolour;
            } else {
                if (g_lyrics_status == 0) {
                    text_colour = g_txt_highlightcolour;
                } else {
                    text_colour = g_txt_normalcolour;
                }
            }
            if (g_lyrics_status > 0) {
                LIGHT_BG && gr.FillSolidRect(0, Math.floor(posy), ww, (tab[i].total_lines * LINE_HEIGHT - 0), (i == focus && tab[i].text.length > 1 && g_lyrics_status == 1) ? g_ovbg_highlightcolour : g_ovbg_normalcolour);
            }
            TEXT_SHADOW && gr.DrawString(tab[i].text, g_font, g_txt_shadowcolour, 1 + H_PADDING, Math.floor(posy) + 0, ww - H_PADDING * 2, (tab[i].total_lines * LINE_HEIGHT), txt_align);
            TEXT_SHADOW && gr.DrawString(tab[i].text, g_font, g_txt_shadowcolour, 1 + H_PADDING, Math.floor(posy) + 1, ww - H_PADDING * 2, (tab[i].total_lines * LINE_HEIGHT), txt_align);
            gr.DrawString(tab[i].text, g_font, text_colour, 0 + H_PADDING, Math.floor(posy), ww - H_PADDING * 2, (tab[i].total_lines * LINE_HEIGHT), txt_align);
        }
        posy = Math.floor(posy + LINE_HEIGHT + ((tab[i].total_lines - 1) * LINE_HEIGHT));
    }
    if (g_lyrics_status > 0 && posy <= wh) {
        LIGHT_BG && gr.FillSolidRect(0, Math.floor(posy), ww, Math.floor(wh), g_ovbg_normalcolour);
    }
}
 
function grab_timer(tab, str, count, timer_prec, balise) {
    var tminutes, tsecondes, tcentiemes;
    var balise_type = -1;
    var i;
    var redo = 0;
    var f_sentence = new sentence;
    var b = balise - 1;
    while (balise_type < 0) {
        if (g_lyrics_status == 1 && balise > 0) {
            if (str.substring(0, 1) == "[") {
                tminutes = str.substring(1 + (b * g_balise_char_offset), 3 + (b * g_balise_char_offset));
                tsecondes = str.substring(4 + (b * g_balise_char_offset), 6 + (b * g_balise_char_offset));
                // balise type test [99:99] or [99:99.99]
                if (str.substring(6, 7) == "]") {
                    balise_type = 1;
                    tcentiemes = 0;
                } else {
                    balise_type = 2;
                    tcentiemes = str.substring(7 + (b * g_balise_char_offset), 9 + (b * g_balise_char_offset));
                }
 
                switch (str.substring(1, 2)) {
                case "0":
                    f_sentence.type = "ly";
                    f_sentence.timer = Math.round(tminutes) * 60 * 100 + Math.round(tsecondes) * 100 + Math.round(tcentiemes) - DEFAULT_OFFSET;
                    f_sentence.text = remove_enhanced_balises(str.substring(g_balise_char_offset * g_balise_total, str.length));
                    break;
                case "1":
                    f_sentence.type = "ly";
                    f_sentence.timer = Math.round(tminutes) * 60 * 100 + Math.round(tsecondes) * 100 + Math.round(tcentiemes) - DEFAULT_OFFSET;
                    f_sentence.text = remove_enhanced_balises(str.substring(g_balise_char_offset * g_balise_total, str.length));
                    break;
                case "2":
                    f_sentence.type = "ly";
                    f_sentence.timer = Math.round(tminutes) * 60 * 100 + Math.round(tsecondes) * 100 + Math.round(tcentiemes) - DEFAULT_OFFSET;
                    f_sentence.text = remove_enhanced_balises(str.substring(g_balise_char_offset * g_balise_total, str.length));
                    break;
                case "3":
                    f_sentence.type = "ly";
                    f_sentence.timer = Math.round(tminutes) * 60 * 100 + Math.round(tsecondes) * 100 + Math.round(tcentiemes) - DEFAULT_OFFSET;
                    f_sentence.text = remove_enhanced_balises(str.substring(g_balise_char_offset * g_balise_total, str.length));
                    break;
                default:
                    // technical info (not displayed)
                    f_sentence.type = null;
                    f_sentence.timer = 0;
                    f_sentence.text = "";
                }
            } else {
                // no balise ==> line is set as a comment (as a blank line)
                if (count == 0) g_lyrics_status = 2;
                balise_type = 0;
                f_sentence.type = null;
                f_sentence.timer = timer_prec;
                f_sentence.text = "";
            }
        } else {
            f_sentence.type = "tx";
            f_sentence.timer = 0;
            // check if it's not finally a synch lyrics (lrc) with some first lines with no timestamp!
            if (str.substring(0, 1) == "[") {
                // balise type test [99:99] or [99:99.99]
                if (str.substring(6, 7) == "]") {
                    g_lyrics_status = 1;
                    g_balise_char_offset = 7;
                } else if (str.substring(9, 10) == "]") {
                    g_lyrics_status = 1;
                    g_balise_char_offset = 10;
                } else {
                    balise_type = 0;
                    f_sentence.text = str;
                }
            } else {
                balise_type = 0;
                f_sentence.text = str;
            }
        }
        redo++;
    }
    return f_sentence;
}
 
function load_file(filePath, fileName) {
    var tab = Array();
    var fline = new sentence;
    var count = 0;
    var enr = 0;
    var str = "";
    var balise;
    var delta;
    g_file = open_file(filePath, fileName, ForReading);
    g_balise_shift = 0;
    while (!g_file.AtEndOfStream) {
        str = g_file.ReadLine();
        g_balise_total = 0;
        if (g_lyrics_status == 1) {
            if (str.substring(0, 1) == "[") {
                // balise type test [99:99] or [99:99.99]
                if (str.substring(6, 7) == "]") {
                    g_balise_char_offset = 7;
                    balise = 0; // b = # of balise
                    while (str.substring(balise * 7, balise * 7 + 1) == "[") {
                        balise += 1;
                    }
                } else {
                    g_balise_char_offset = 10;
                    balise = 0; // b = # of balise
                    while (str.substring(balise * 10, balise * 10 + 1) == "[") {
                        balise += 1;
                    }
                }
                g_balise_total = balise;
            } else if (enr == 0) {
                g_lyrics_status = 2;
                g_balise_total = 1;
            }
        } else {
            g_balise_total = 1;
        }
 
        if (g_balise_total > 1) g_multi_balise = true;
        else g_multi_balise = false;
 
        // str loop for each balise found for it ==> occurs created in the array
        for (balise = 1; balise <= g_balise_total; balise++) {
            fline = grab_timer(tab, str, count, (count > 0) ? tab[count - 1].timer : 0, balise);
            if (fline.type != null) {
                tab.push(fline);
                count++;
            }
        }
        enr += 1;
    }
    close_file(g_file);
 
    // if file read is empty, set lyrics as not found to avoid script errors
    if (count == 0) {
        g_lyrics_status = 0;
        g_tab = load_track_info();
        delta = (g_tab[g_tab.length - 1].ante_lines + g_tab[g_tab.length - 1].total_lines);
        pos = (wh / 2) - (delta * LINE_HEIGHT / 2);
        return g_tab;
    } else {
        // add a default last sentence with a timer maximum (for ease of use focus line search method)
        tab.push(new sentence);
        tab[count].type = "ly";
        tab[count].timer = 9999999;
        tab[count].text = "---";
        tab[count].total_lines = 1;
        tab[count].ante_lines = tab[count - 1].ante_lines + tab[count - 1].total_lines;
        return sort_tab(tab);
    }
}
 
function parse_tag(tag) {
    var t_tab = Array();
    var i, j, count;
    j = 0;
    for (i = 0; i < tag.length; i++) {
        if (tag.charCodeAt(i) == 10) {
            t_tab.push(tag.substring(j, i));
            j = i + 1;
        }
    }
    return parse_line(t_tab);
}
 
function parse_line(tagtab) {
    var tab = Array();
    var fline = new sentence;
    var count = 0;
    var enr = 0;
    var str = "";
    var balise;
    var delta;
    g_balise_shift = 0;
    for (enr = 0; enr < tagtab.length; enr++) {
        str = tagtab[enr];
        g_balise_total = 0;
        if (g_lyrics_status == 1) {
            if (str.substring(0, 1) == "[") {
                // balise type test [99:99] or [99:99.99]
                if (str.substring(6, 7) == "]") {
                    g_balise_char_offset = 7;
                    balise = 0; // b = # of balise
                    while (str.substring(balise * 7, balise * 7 + 1) == "[") {
                        balise += 1;
                    }
                } else {
                    g_balise_char_offset = 10;
                    balise = 0; // b = # of balise
                    while (str.substring(balise * 10, balise * 10 + 1) == "[") {
                        balise += 1;
                    }
                }
                g_balise_total = balise;
            } else if (enr == 0) {
                g_lyrics_status = 2;
                g_balise_total = 1;
            }
        } else {
            g_balise_total = 1;
        }
 
        if (g_balise_total > 1) g_multi_balise = true;
        else g_multi_balise = false;
 
        // str loop for each balise found for it ==> occurs created in the array
        for (balise = 1; balise <= g_balise_total; balise++) {
            fline = grab_timer(tab, str, count, (count > 0) ? tab[count - 1].timer : 0, balise);
            if (fline.type != null) {
                tab.push(fline);
                count++;
            }
        }
    }
 
    // if file read is empty, set lyrics as not found to avoid script errors
    if (count == 0) {
        g_lyrics_status = 0;
        g_tab = load_track_info();
        delta = (g_tab[g_tab.length - 1].ante_lines + g_tab[g_tab.length - 1].total_lines);
        pos = (wh / 2) - (delta * LINE_HEIGHT / 2);
        return g_tab;
    } else {
        // add a default last sentence with a timer maximum (for ease of use focus line search method)
        tab.push(new sentence);
        tab[count].type = "ly";
        tab[count].timer = 9999999;
        tab[count].text = "---";
        tab[count].total_lines = 1;
        tab[count].ante_lines = tab[count - 1].ante_lines + tab[count - 1].total_lines;
        return sort_tab(tab);
    }
}
 
function load_track_info() {
    var tab = Array(new sentence, new sentence, new sentence, new sentence);
    var count = 0;
 
    tab[count].type = "tx";
    tab[count].text = "---";
    count++;
 
    tab[count].type = "tx";
    tab[count].text = artist.Eval();
    count++;
 
    tab[count].type = "tx";
    tab[count].text = title.Eval();
    count++;
 
    tab[count].type = "tx";
    tab[count].text = "---";
    count++;
 
    return calc_lines(tab);
}
 
function open_file(filePath, fileName, ioMode) {
    var fileInst = null;
    var bool = file_exists(filePath + fileName);
    if (bool) {
        fileInst = g_fso.OpenTextFile(filePath + fileName, ioMode);
    }
    return fileInst;
}
 
function close_file(fileInst) {
    fileInst.Close();
}
 
function read_file(fileInst) {
    var line = fileInst.ReadLine();
    return line;
}
 
function folder_exists(folderPath) {
    var fso, bool;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    bool = fso.FolderExists(folderPath);
    return bool;
}
 
function file_exists(filePath) {
    var fso, bool;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    bool = fso.Fileexists(filePath);
    return bool;
}
 
function lyrics_folder_exists() {
    var fso;
    var bool = 1;
    fso = new ActiveXObject("Scripting.FileSystemObject");
 
    if (folder_exists(lyrics_dir) == false) {
        fso.CreateFolder(lyrics_dir);
        bool = 0;
    }
    return bool;
}
 
function get_lyrics() {
    var i = 0;
    var nbl = 0;
    var delta;
    var tag;
    var bool_tag = false;
 
    // reset lyrics tab
    g_lyrics_status = 0;
    if (g_tab.length > 0) g_tab.splice(0, g_tab.length);
    pos = midpoint;
    focus = 0;
    window.Repaint();
 
    // check TAGs
    tag = lyrics.Eval();
    if (tag.length > 0) {
        bool_tag = true;
        if (tag.substring(0, 1) == "[") g_lyrics_status = 1;
        else g_lyrics_status = 2;
    } else {
        // check files
        g_lyrics_filename = artist.Eval() + " - " + title.Eval();
        if (file_exists(lyrics_dir + g_lyrics_filename + ".lrc")) {
            g_lyrics_filename = g_lyrics_filename + ".lrc";
            g_lyrics_status = 1;
        } else {
            if (file_exists(lyrics_dir + g_lyrics_filename + ".txt")) {
                g_lyrics_filename = g_lyrics_filename + ".txt";
                g_lyrics_status = 2;
            } else {
                g_lyrics_status = 0;
            }
        }
    }
    // if lyrics found
    if (g_lyrics_status > 0) {
        if (bool_tag) {
            g_tab = parse_tag(tag);
        } else {
            g_tab = load_file(lyrics_dir, g_lyrics_filename);
        }
        // console dump of the memory tab loaded
        if (g_lyrics_status > 0) {
            for (i = 0; i < g_tab.length; i++) {
                //fb.trace("line #"+i+" = "+g_tab[i].text + " / "+g_tab[i].timer + " / "+g_tab[i].total_lines + " / "+g_tab[i].ante_lines);
            }
        }
    } else {
        g_tab = load_track_info();
        // console dump of the memory tab loaded
        for (i = 0; i < g_tab.length; i++) {
            //fb.trace("line #"+i+" = "+g_tab[i].text + " / "+g_tab[i].timer + " / "+g_tab[i].total_lines + " / "+g_tab[i].ante_lines);
        }
        delta = (g_tab[g_tab.length - 1].ante_lines + g_tab[g_tab.length - 1].total_lines);
        pos = (wh / 2) - (delta * LINE_HEIGHT / 2);
    }
 
    if (g_lyrics_status == 2) {
        for (i = 0; i < g_tab.length - 1; i++) {
            g_tab[i].timer = i * Math.floor(len_seconds.Eval() * 100 / g_tab.length);
        }
    }
}
 
function change_focus() {
    var i, j;
    var t1 = elap_seconds.Eval() * 100 + centiemes;
 
    if (g_lyrics_status > 0) {
        // search line index just after actual timer
        for (i = 0; i < g_tab.length; i++) {
            if (g_tab[i].timer > t1) break;
        }
        focus_next = i;
        focus = (i > 0) ? i - 1 : 0;
        // now i check if there are more than one line with the same timer as focus one & if found, i take it as new focus 'cause it's the first (not a blank line)
        if (focus > 0) {
            for (i = 0; i < focus; i++) {
                if (g_tab[i].timer == focus) {
                    focus = i;
                    break;
                }
            }
        }
    }
}
 
function calc_lines(ctab) {
    var i, j;
    var padx = 0;
    g_tab_length = 0;
    for (i = 0; i < ctab.length; i++) {
        // calc sentence #lines to display / window.width
        if (ctab[i].type != null) {
            var tmp_img = gdi.CreateImage(ww - (H_PADDING * 2) - padx, 100);
            var gp = tmp_img.GetGraphics();
            var lineh = gp.MeasureString(ctab[i].text, g_font, 0, 0, ww - (H_PADDING * 2) - padx, wh).Height;
            ctab[i].total_lines = (lineh / LINE_HEIGHT) > Math.floor(lineh / LINE_HEIGHT) ? Math.floor(lineh / LINE_HEIGHT) + 1 : Math.floor(lineh / LINE_HEIGHT);
            ctab[i].ante_lines = 0;
            for (j = 0; j < i; j++) {
                ctab[i].ante_lines += ctab[j].total_lines;
            }
            CollectGarbage();
        }
        g_tab_length += ctab[i].total_lines;
    }
    return ctab;
}
 
function sort_tab(tab2sort) {
    var tab = Array();
    var i, j;
    var tmp = new sentence;
    var smallest = 0;
 
    for (i = 0; i < tab2sort.length; i++) {
        for (j = i; j < tab2sort.length; j++) {
            if (tab2sort[i].timer > tab2sort[j].timer) {
                tmp = tab2sort[i];
                tab2sort[i] = tab2sort[j];
                tab2sort[j] = tmp;
            }
        }
        tab.push(tab2sort[i]);
    }
    tab = calc_lines(tab);
    return tab;
}
 
function remove_enhanced_balises(str) {
    var i;
    var chr1, chr2;
    var new_str = "";
    for (i = 0; i < str.length; i++) {
        chr1 = str.substring(i, i + 1);
        if (i + 10 <= str.length) chr2 = str.substring(i + 9, i + 10);
        else chr2 = null;
        if (chr1 == "<" && chr2 == ">") {
            i = i + 9;
        } else {
            new_str = new_str + chr1;
        }
    }
    return new_str;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-10-18 13:23:52
How to overcome Laziness (http://www.wikihow.com/Overcome-Laziness)  I'd like that, too. Any chance?


hmmn.....

Quote
Think about the importance of the problem or goal. Is it something you can actually afford to ignore?


let me think about that. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-10-19 09:32:07
samples updated:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

thumbs2: added "cycle" image mode. default is off but can be set to 5, 10 or 20 seconds.

new script: themed toolbar buttons. can be seen here on this old screenshot. clicky (http://k5sbdw.blu.livefilestore.com/y1p7MP-0C-g5IZP0z79nL9BJxRtkCt5MOKjvxx7dLABSElo5kt4WOSI4ZKsyF5xOMSdMGsIpoDJW2VJcK2Bhf9xN5PUYUrRZuih/similar.png)
how they look depend on your windows theme - they don't work on windows classic. XP luna and aero/basic in vista/7 work fine as should all 3rd party themes.
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-19 10:33:04
sorry, my bad.

let me check this and include that path as default too...

[00:32.13]?????????????
[00:37.96]?????????
[00:42.72]
[02:05.69][00:43.23]?????????
[02:10.61][00:47.96]?????????
[02:15.86][00:53.24]?????????????
[02:21.08][00:58.55]?????????
[02:26.04][01:03.72]
[03:08.01][02:26.39][01:04.13]????????????


a huge problem?the Blank lines can't show up

e.x.when it is [00:42.72][02:26.04][01:03.72]

check it
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-19 11:48:04
i'll see.
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-19 12:08:57
i'll see.


%lyric% can show blank line

.lrc file can't show blank line
Title: WSH Panel Mod script discussion/help
Post by: Robson on 2010-10-19 19:25:31
thumbs2: added "cycle" image mode. default is off but can be set to 5, 10 or 20 seconds.


Great job, Marc! Thx a lot ...
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-20 11:35:44
update!

Lyriks 1.1 (build 20101020.1225) - a WSH lyrics module by Br3tt
- This WSH script get lyrics from TAG first then from local file in Music folder then in foobar2000\lyrics\ and finally it displays them (scrolling+sync)
- It handles TXT and LRC format (sync handled), but not the LRC Enhanced format (translated to simple LRC format)
- exotics timestamps are now handled (like [9:99], [99:99.999], [9:99.999], [99:99:999] ...)
- filenames supported are : <%artist%> -<%title%>.lrc (or .txt)  AND <%artist%> - <%title%>.lrc (or .txt)
- Comments, Blank lines (no timestamp) and Info lines (ar:, ti, ...) are ignored.
- Manual Scrolling possible with the mousewheel (double click on the panel to re-center on the active line)
- Requirements :
  1) foobar2000
  2) WSH Panel Mod component
  3) this script!
  4) Optional: a lyrics grabber (i.e: Lyric Show Panel by hidding the panel, foo_lyricsDB, ...)
- Some settings are available by using the panel Properties (right click on WSH panel -> Properties)
- This script don't make any changes to your files and write nothing on your system, except the creation of the folder foobar2000/lyrics if not found

Get it from here:
http://pastebin.com/LPyVy09c (http://pastebin.com/LPyVy09c)

Quick Changelog:
- exotic timestamps => converted to my default : [99:99.99]
- lyrics in music folder ckecked
- blank lines not displayed on multi-timestamp lines => fixed
- tweaks...

*waits for feedback*
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-20 12:10:04
I love you Falstaff!!!!
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-10-20 12:20:00
So i bit the bullet and been trying to use code with WSH panel. It's at least far better than the old ways and also far more flexible. I picked up the simple bio script in marc2003 sample pack and modified it a little into this (http://pastebin.com/cRZ6SwQN) (basically it supports cache life time and I changed the last.fm button feature a little). I hope someone can help me with the flashing tooltip problem. Thanks and marc2003, you were great with these examples to help me pick up using this component.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-20 13:09:48
I love you Falstaff!!!!

Me too  You are great

May I not leave you loose, but suggesting another feature? - If user clicks on timestamped lyrics row then seek the track to that position. I know you can do it, as you've made WSH seekbar among other things, but don't know what you think about it?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-20 13:22:31
@romor :

it's a pretty good idea  ... will be added asap!
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-20 13:57:58
@romor :

it's a pretty good idea  ... will be added asap!


I have another idea.

why won't you add " drag lrc to control playing progress" capability

pic here (http://cid-7c6fa1eb8fb8f2b7.skydrive.live.com/self.aspx/Blog%20Images/QQ%e6%88%aa%e5%9b%be%e6%9c%aa%e5%91%bd%e5%90%8d.png)

another saying : "Drag lyric of a song controlling the playing progress of a song"

if you know chinese,I will say "??????????"
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-20 14:10:56
I think there is minor foobar or WSH component issue related to AAC encoded files with LYRICS tag (not your script, but why not report it):
(http://i.imgur.com/4stTJ.png)
text display component vs. WSH lyrics element

also Falstaff can you consider scripts to automagically supply lyrics to your WSH script, as I can make also VBS for lyrdb.com or some other?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-20 14:19:36
weird, it should works as all other LYRICS tag!

is the tag well named : LYRICS or LYRIC ? Are you sure it's not due to my script ?

to check it, add this line in the script, just after line #634 (tag = lyrics.Eval();)

fb.trace("tag read="+tag);

replay the track to run the script, then check the console to check what's the value returned for tag variable!
if the result is not the whole lyrics text, so, it's probably a WSH component bug with tag in AAC files, BUT if it's correct, it's a bug from my script, so give me the lyrics for me testing and fixing the problem.

Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-20 14:30:39
here is console output:

Code: [Select]
Opening track for playback: "C:\Users\Admin\Music\Library\Pink Floyd\Early Singles\08 - Julia Dream.m4a"
tag read=[artist:Pink Floyd][title:Julia Dream][album:Relics][0:08.200]Sunlight bright upon my pillow[0:12.200]Lighter than an eiderdown[0:16.400]Will she let the weeping willow[0:20.600]Wind his branches round[0:26.600]Julia Dream, dreamboat queen, queen of all my dreams[0:36.050][0:37.400]Every night I turn the light out[0:41.400]Waiting for the velvet bride[0:45.600]Will the scaly armadillo[0:49.600]Find me where I'm hiding[0:55.600]Julia Dream, dreamboat queen, queen of all my dreams[1:21.325][1:25.000]Will the misty master break me[1:29.000]Will the key unlock my mind[1:33.200]Will the following footsteps catch me[1:37.200]Am I really dying[1:42.450][1:43.200]Julia Dream, dreamboat queen, queen of all my dreams[1:51.600]Julia Dream, dreamboat queen, queen of all my dreams[2:00.000]Julia Dream, dreamboat queen, queen of all my dreams[2:08.400]Julia Dream, dreamboat queen, queen of all my nightmares[2:17.933][2:34.616]
tag read=[artist:Pink Floyd][title:Julia Dream][album:Relics][0:08.200]Sunlight bright upon my pillow[0:12.200]Lighter than an eiderdown[0:16.400]Will she let the weeping willow[0:20.600]Wind his branches round[0:26.600]Julia Dream, dreamboat queen, queen of all my dreams[0:36.050][0:37.400]Every night I turn the light out[0:41.400]Waiting for the velvet bride[0:45.600]Will the scaly armadillo[0:49.600]Find me where I'm hiding[0:55.600]Julia Dream, dreamboat queen, queen of all my dreams[1:21.325][1:25.000]Will the misty master break me[1:29.000]Will the key unlock my mind[1:33.200]Will the following footsteps catch me[1:37.200]Am I really dying[1:42.450][1:43.200]Julia Dream, dreamboat queen, queen of all my dreams[1:51.600]Julia Dream, dreamboat queen, queen of all my dreams[2:00.000]Julia Dream, dreamboat queen, queen of all my dreams[2:08.400]Julia Dream, dreamboat queen, queen of all my nightmares[2:17.933][2:34.616]
(
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-20 14:35:07
@romor :

it's a pretty good idea  ... will be added asap!

I have another idea.

why won't you add " drag lrc to control playing progress" capability

pic here (http://cid-7c6fa1eb8fb8f2b7.skydrive.live.com/self.aspx/Blog%20Images/QQ%e6%88%aa%e5%9b%be%e6%9c%aa%e5%91%bd%e5%90%8d.png)

another saying : "Drag lyric of a song controlling the playing progress of a song"

if you know chinese,I will say "??????????"
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-20 14:43:42
weird, it should works as all other LYRICS tag!

Falstaff, also this could maybe related to CRLF expectation by your script as posted before. This files that have LYRICS tag and have 0D as line separator:
(http://i.imgur.com/t5w4h.png)
so on a second thought, it's perhaps related to that issue rather then file format

edit: just try to enter lyrics tag with one long line and see what will happen
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-20 14:58:50
thanks, i understand what's the problem ==> no crlf after each line and lyrics begin with [infos], so, this single line is bypassed! and there is no lyrics to display after ...

==> should be fixed with this update (i test "[" as a line delimiter) : http://pastebin.com/G9fnCnXR (http://pastebin.com/G9fnCnXR)
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-10-20 15:03:07
@romor :

it's a pretty good idea  ... will be added asap!


I have another idea.

why won't you add " drag lrc to control playing progress" capability

pic here (http://cid-7c6fa1eb8fb8f2b7.skydrive.live.com/self.aspx/Blog%20Images/QQ%e6%88%aa%e5%9b%be%e6%9c%aa%e5%91%bd%e5%90%8d.png)

another saying : "Drag lyric of a song controlling the playing progress of a song"

if you know chinese,I will say "??????????"


oops~??????????????????????????
What you suggested is the same as what romor suggested

Falstaff GJ~~
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-10-20 15:06:36
(http://i.imgur.com/36Zv9.png)
Title: WSH Panel Mod script discussion/help
Post by: Superunknown on 2010-10-21 03:42:05
Hi,
I'm discovering this mod and trying to make a seekbar.
Here is the code I am using, it works well except the bar is kinda green like Windows 7 status bar and I'd prefer it white.
What am I supposed to change to do so ?
Thanks in advance for your support.


Code: [Select]
var g_theme = window.CreateThemeManager("PROGRESS");
var g_bar_height = 4;
var g_cycles = 0;
var ww = 0,
wh = 0;
var top = 0;
var g_pos = 0;
var g_drag = false;
var g_length = 1;

function clamp(x, l, h) {
return (x < l) ? l : ((x > h) ? h : x);
}


function on_size() {
ww = window.Width;
wh = window.Height;
top = (wh - g_bar_height) >> 1;
}

function on_paint(gr) {
g_theme.SetPartAndStateID(1, 0);
g_theme.DrawThemeBackground(gr, 0, top, ww, g_bar_height);

if (fb.IsPlaying && g_length > 0) {
g_theme.SetPartAndStateID(5, fb.IsPaused ? 3 : 1);
g_theme.DrawThemeBackground(gr, 0, top, g_pos, g_bar_height);
}
}

function on_mouse_lbtn_down(x, y) {
if (g_length > 0) {
g_drag = true;
on_mouse_move(x, y);
}
}

function on_mouse_lbtn_up(x, y) {
if (g_length > 0 && g_drag) {
g_drag = false;
fb.PlaybackTime = g_length * g_pos / ww;
on_mouse_move(x, y);
}
}

function on_mouse_move(x, y) {
if (g_drag) {
g_pos = clamp(x, 0, ww);
window.Repaint();
}
}

function on_mouse_wheel(delta) {
fb.PlaybackTime = fb.PlaybackTime + delta * 2;
}

function on_playback_time(time) {
if (!g_drag) {
if (g_length > 0) g_pos = ww * time / g_length;
window.Repaint();
}
}

function on_playback_seek() {
if (!g_drag && g_length > 0) window.Repaint();
}

function on_playback_pause() {
window.Repaint();
}

function on_playback_stop() {
g_length = 0;
g_pos = 0;
g_drag = false;
window.Repaint();
}

function on_playback_new_track() {
g_length = fb.PlaybackLength;
g_pos = 0;
g_drag = false;
window.Repaint();
}

if (fb.IsPlaying) on_playback_new_track();
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-21 10:12:24
Lyriks 1.1 (build 20101021.1105) - a WSH lyrics module by Br3tt

here is a fix, because the last script contains an error in synch when lyrics are read from a file (ok from a tag) :

http://pastebin.com/LJEFwEiu (http://pastebin.com/LJEFwEiu)

Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-10-21 11:23:52
I tried to use your script Falstaff, but is it in LRC format that I must have a newline character at the end of my lyrics tag? My unsynced lyrics always has the last line missing.
For example, here's what in my lyrics tag:
Code: [Select]
At the very beginning, we were created, to live
together but soon, we hated in greed
and selfishness we, could never prosper,
created enemies against god's will.

and the last line is replaced by "---" by your code.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-21 11:49:34
it was a bug (when lyrics in Tag), script updated :

http://pastebin.com/UUNQgJmN (http://pastebin.com/UUNQgJmN)

thanx for reporting!
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-10-22 11:04:57
So i bit the bullet and been trying to use code with WSH panel. It's at least far better than the old ways and also far more flexible. I picked up the simple bio script in marc2003 sample pack and modified it a little into this (http://pastebin.com/cRZ6SwQN) (basically it supports cache life time and I changed the last.fm button feature a little). I hope someone can help me with the flashing tooltip problem. Thanks and marc2003, you were great with these examples to help me pick up using this component.


I fixed my own problem. Basically don't set tooltip text inside the on_mouse_move function.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-23 12:12:39
Lyriks 1.2 (build 20101023.1300) - a WSH lyrics module by Br3tt

new version of the script (optimized and cleaned)

http://pastebin.com/JsBSZx6v (http://pastebin.com/JsBSZx6v)

Next version will have reflection support and will look like this (for now)

(http://img543.imageshack.us/img543/8669/captureov.png)
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-10-24 15:19:55
I made an artist art panel based off samples from marc2003. In order to download artist art from correct artist name, I copied and modified the get() and load() functions from simple biography panel into lastfm_load(type) and lastfm_get(lang) and I put them into common.js. The lastfm_load function will set variable lastfm_artist with correct artist from lastfm and fire off an notification but somehow this notification doesn't fire and I'm stuck with my start() function doesn't get called. Please help me.

Relevant  files. (https://docs.google.com/leaf?id=0By5oGIJU70FaZTZjM2NiYmYtZjQ0MS00MjllLTgzNzctYTRmZGUzYjU3MGQy&hl=en)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-10-25 09:37:18
if you want an album art panel that automatically downloads artist art from last.fm then just modify the "now playing" script (by default it also shows the cover art and song details but you can easily remove this from the on_paint function)

(you might also be interested in the thumbs/thumbs2 scripts as they also download artist art as well)
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-26 06:50:14
@romor :

it's a pretty good idea  ... will be added asap!

If user clicks on timestamped lyrics row then seek the track to that position.

I have another idea.

why won't you add " drag lrc to control playing progress" capability

pic here (http://cid-7c6fa1eb8fb8f2b7.skydrive.live.com/self.aspx/Blog%20Images/QQ%e6%88%aa%e5%9b%be%e6%9c%aa%e5%91%bd%e5%90%8d.png)

another saying : "Drag lyric of a song controlling the playing progress of a song"

if you know chinese,I will say "??????????"
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-26 07:15:25
@romor :

it's a pretty good idea  ... will be added asap!

If user clicks on timestamped lyrics row then seek the track to that position.

I have another idea.

why won't you add " drag lrc to control playing progress" capability

pic here (http://cid-7c6fa1eb8fb8f2b7.skydrive.live.com/self.aspx/Blog%20Images/QQ%e6%88%aa%e5%9b%be%e6%9c%aa%e5%91%bd%e5%90%8d.png)

another saying : "Drag lyric of a song controlling the playing progress of a song"

if you know chinese,I will say "??????????"


nope, i prefer : user clicks on timestamped lyrics row then seek the track to that position.
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-26 07:19:56
@romor :

it's a pretty good idea  ... will be added asap!

If user clicks on timestamped lyrics row then seek the track to that position.

I have another idea.

why won't you add " drag lrc to control playing progress" capability

pic here (http://cid-7c6fa1eb8fb8f2b7.skydrive.live.com/self.aspx/Blog%20Images/QQ%e6%88%aa%e5%9b%be%e6%9c%aa%e5%91%bd%e5%90%8d.png)

another saying : "Drag lyric of a song controlling the playing progress of a song"

if you know chinese,I will say "??????????"

nope, i prefer : user clicks on timestamped lyrics row then seek the track to that position.


but not all lines show up. If a line doesn't show ,you click what?  if the window is small, it can show rare ? very little ?lines?or say not too many lines),

so that the lines that you can click is not too much. but Drag can show more lines, becanse it doesn't restricted by the lines that the Lyrik window can show.
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-10-26 17:50:04
I've finally finished my config with WSH panels. It was pretty fun to do. I based my code on marc2003's, so some credits go to you, Marc2003 for doing the samples. If not for those I wouldn't have known left from right.
(http://thumbnails15.imagebam.com/10393/a97e62103928211.jpg) (http://www.imagebam.com/image/a97e62103928211) (http://thumbnails34.imagebam.com/10393/ed0fa8103928218.jpg) (http://www.imagebam.com/image/ed0fa8103928218) (http://thumbnails14.imagebam.com/10393/86dcfd103928232.jpg) (http://www.imagebam.com/image/86dcfd103928232) (http://thumbnails11.imagebam.com/10393/c99273103928247.jpg) (http://www.imagebam.com/image/c99273103928247) (http://thumbnails14.imagebam.com/10393/e0f930103928269.jpg) (http://www.imagebam.com/image/e0f930103928269)

Panels code (https://docs.google.com/leaf?id=0By5oGIJU70FaNGZkN2FmOTMtZTJkNi00Y2Q2LTk3ZGUtYmZkZmMyYzIwYjI4&hl=en)
Title: WSH Panel Mod script discussion/help
Post by: voodoomonkey on 2010-10-26 23:06:46
Folks who can help me change the default seekbar script to look like on the pic ?

(http://thumbnails15.imagebam.com/10398/fde9c8103979607.jpg) (http://www.imagebam.com/image/fde9c8103979607)


I'm having trouble adjusting "on_mouse_move" after I set the margins. Any idea ? The default script is this

Themed seekbar (http://pastebin.com/JSMTuyRY)
Title: WSH Panel Mod script discussion/help
Post by: voodoomonkey on 2010-10-26 23:11:31
Hi,
I'm discovering this mod and trying to make a seekbar.
Here is the code I am using, it works well except the bar is kinda green like Windows 7 status bar and I'd prefer it white.
What am I supposed to change to do so ?
Thanks in advance for your support.


Code: [Select]
var g_theme = window.CreateThemeManager("PROGRESS");
var g_bar_height = 4;
var g_cycles = 0;
var ww = 0,
wh = 0;
var top = 0;
var g_pos = 0;
var g_drag = false;
var g_length = 1;

function clamp(x, l, h) {
return (x < l) ? l : ((x > h) ? h : x);
}


function on_size() {
ww = window.Width;
wh = window.Height;
top = (wh - g_bar_height) >> 1;
}

function on_paint(gr) {
g_theme.SetPartAndStateID(1, 0);
g_theme.DrawThemeBackground(gr, 0, top, ww, g_bar_height);

if (fb.IsPlaying && g_length > 0) {
g_theme.SetPartAndStateID(5, fb.IsPaused ? 3 : 1);
g_theme.DrawThemeBackground(gr, 0, top, g_pos, g_bar_height);
}
}

function on_mouse_lbtn_down(x, y) {
if (g_length > 0) {
g_drag = true;
on_mouse_move(x, y);
}
}

function on_mouse_lbtn_up(x, y) {
if (g_length > 0 && g_drag) {
g_drag = false;
fb.PlaybackTime = g_length * g_pos / ww;
on_mouse_move(x, y);
}
}

function on_mouse_move(x, y) {
if (g_drag) {
g_pos = clamp(x, 0, ww);
window.Repaint();
}
}

function on_mouse_wheel(delta) {
fb.PlaybackTime = fb.PlaybackTime + delta * 2;
}

function on_playback_time(time) {
if (!g_drag) {
if (g_length > 0) g_pos = ww * time / g_length;
window.Repaint();
}
}

function on_playback_seek() {
if (!g_drag && g_length > 0) window.Repaint();
}

function on_playback_pause() {
window.Repaint();
}

function on_playback_stop() {
g_length = 0;
g_pos = 0;
g_drag = false;
window.Repaint();
}

function on_playback_new_track() {
g_length = fb.PlaybackLength;
g_pos = 0;
g_drag = false;
window.Repaint();
}

if (fb.IsPlaying) on_playback_new_track();


Try lowering or raising the values here

g_theme.SetPartAndStateID(5, fb.IsPaused ? 3 : 1);

Sorry but I dunno if the thememanager contains a progressbar color of white.
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-27 00:26:00

a lrc file  shows wrong when 01:00.00

please check it

song?download (http://cid-7c6fa1eb8fb8f2b7.office.live.com/self.aspx/.Public/Antoine%20Dodson%20-%20Bed%20Intruder%20Song.mp3)

lrc file?download (http://cid-7c6fa1eb8fb8f2b7.office.live.com/self.aspx/.Public/Antoine%20Dodson%20-%20Bed%20Intruder%20Song.lrc)
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-10-27 11:30:11
Folks who can help me change the default seekbar script to look like on the pic ?

(http://thumbnails15.imagebam.com/10398/fde9c8103979607.jpg) (http://www.imagebam.com/image/fde9c8103979607)


I'm having trouble adjusting "on_mouse_move" after I set the margins. Any idea ? The default script is this

Themed seekbar (http://pastebin.com/JSMTuyRY)


http://pastebin.com/yJW2NUwX (http://pastebin.com/yJW2NUwX)

change the variable "H_padding" to adjust the distance between the bar and the margins.

BTW, the function clamp can be altered by this
function clamp(x, l, h) {
    return Math.min(Math.max(x,l),h);
}

P.S. your "mint" tastes wonderful~
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-10-27 15:47:55

a lrc file  shows wrong when 01:00.00

please check it

song?download (http://cid-7c6fa1eb8fb8f2b7.office.live.com/self.aspx/.Public/Antoine%20Dodson%20-%20Bed%20Intruder%20Song.mp3)

lrc file?download (http://cid-7c6fa1eb8fb8f2b7.office.live.com/self.aspx/.Public/Antoine%20Dodson%20-%20Bed%20Intruder%20Song.lrc)


i'll check it asap (maybe a bug fixed yesterday for some kind of ts!!!), thanks for reporting, update to come with the fix
Title: WSH Panel Mod script discussion/help
Post by: Joe30 on 2010-10-27 21:31:03
I've finally finished my config with WSH panels. It was pretty fun to do. I based my code on marc2003's, so some credits go to you, Marc2003 for doing the samples. If not for those I wouldn't have known left from right.
(http://thumbnails15.imagebam.com/10393/a97e62103928211.jpg) (http://www.imagebam.com/image/a97e62103928211) (http://thumbnails34.imagebam.com/10393/ed0fa8103928218.jpg) (http://www.imagebam.com/image/ed0fa8103928218) (http://thumbnails14.imagebam.com/10393/86dcfd103928232.jpg) (http://www.imagebam.com/image/86dcfd103928232) (http://thumbnails11.imagebam.com/10393/c99273103928247.jpg) (http://www.imagebam.com/image/c99273103928247) (http://thumbnails14.imagebam.com/10393/e0f930103928269.jpg) (http://www.imagebam.com/image/e0f930103928269)

Panels code (https://docs.google.com/leaf?id=0By5oGIJU70FaNGZkN2FmOTMtZTJkNi00Y2Q2LTk3ZGUtYmZkZmMyYzIwYjI4&hl=en)


Please, could you give me very detailed explanation on how to install your package this with all the nice last.fm tabulations ?
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-10-28 10:31:41
I think you better create a new thread asking how to create tab in your specific user interface component (DUI or CUI), as it is unrelated to this thread. After you have create the tabs, all you need to do is to import my panels code. How to do that has been included in my pack to some details, if you still need help for that, you can ask here, then.

Lastly, the code inside my pack is old and has some problems with certain responses from last.fm. I have fixed these issues in my current code but I'm at work now, will update the pack later.
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-10-29 00:41:38
a lrc file  shows wrong when 01:00.00

please check it

song:download (http://cid-7c6fa1eb8fb8f2b7.office.live.com/self.aspx/.Public/Antoine%20Dodson%20-%20Bed%20Intruder%20Song.mp3)

lrc file:download (http://cid-7c6fa1eb8fb8f2b7.office.live.com/self.aspx/.Public/Antoine%20Dodson%20-%20Bed%20Intruder%20Song.lrc)

i'll check it asap (maybe a bug fixed yesterday for some kind of ts!!!), thanks for reporting, update to come with the fix

Error: WSH Panel Mod ({96603E1C-15B1-4657-BEB3-A2A5389CA2BF}): Microsoft JScript 运行时错误:
无效的过程调用或参数
Ln: 769, Col: 5
<source text only available in compile time>

Ln: 769 is
  var tpath = Array(lyrics_dir1.EvalWithMetadb(g_metadb), lyrics_dir2);
Code: [Select]
/*
====================================================================================================
=======
Lyriks 1.2 (build 20101023.1300) - a WSH lyrics module by Br3tt
- This WSH script get lyrics from TAG first then from local file in Music folder then in foobar2000\lyrics\ and finally

it displays them (scrolling+sync)
- It handles TXT and LRC format (sync handled), but not the LRC Enhanced format (translated to simple LRC format)
- exotics timestamps are now handled (like [9:99], [99:99.999], [9:99.999], [99:99:999] ...)
- filenames supported are : <%artist%> -<%title%>.lrc (or .txt)  AND <%artist%> - <%title%>.lrc (or .txt)
- Comments, Blank lines (no timestamp) and Info lines (ar:, ti, ...) are ignored.
- Manual Scrolling possible with the mousewheel (double click on the panel to re-center on the active line)
- Requirements :
  1) foobar2000
  2) WSH Panel Mod component
  3) this script!
  4) Optional: a lyrics grabber (i.e: Lyric Show Panel by hidding the panel, foo_lyricsDB, ...)
- Some settings are available by using the panel Properties (right click on WSH panel -> Properties)
- This script don't make any changes to your files and write nothing on your system, except the creation of the folder

foobar2000/lyrics if not found
====================================================================================================
=======
*/

// Text formatting function
// {{
function StringFormat() {
var h_align = 0, v_align = 0, trimming = 0, flags = 0;
switch (arguments.length)
{
// fall-thru
case 4:
flags = arguments[3];
case 3:
trimming = arguments[2];
case 2:
v_align = arguments[1];
case 1:
h_align = arguments[0];
break;
default:
return 0;
}
return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}
StringAlignment = {
Near: 0,
Centre: 1,
Far: 2
};
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);
// }}

// Use with GdiDrawText()
// {{
var DT_LEFT = 0x00000000;
var DT_RIGHT = 0x00000002;
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 DT_END_ELLIPSIS = 0x00008000;
// }}

//{{
// IO Mode
var ForReading = 1;
var ForWriting = 2;
var ForAppending = 8;
//}}

//{{
// Paths
var lyrics_dir1 = fb.Titleformat("$replace($replace(%path%,%filename_ext%,),\,\\)");
var lyrics_dir2 =  fb.FoobarPath + "lyric\\";
//}}

//{{
// new objects
sentence = function () {
this.timer = 0;
this.text = "";
this.total_lines = 0;
this.ante_lines = 0;
}
//}}

function RGBA(r, g, b, a) {
return ((a << 24) | (r << 16) | (g << 8) | (b));
}

// ================================================/ TF
var len = fb.Titleformat("%length%");
var elap = fb.TitleFormat("%playback_time%");
var remain = fb.TitleFormat("%playback_time_remaining%");
var len_seconds = fb.Titleformat("%length_seconds%");
var elap_seconds = fb.TitleFormat("%playback_time_seconds%");
var remain_seconds = fb.Titleformat("%playback_time_remaining_seconds%");
var artist = fb.Titleformat("$replace(%artist%,'/','_')");
var title = fb.Titleformat("%title%");
var lyrics = fb.TitleFormat("[$if2(%LYRICS%,$if2(%LYRIC%,$if2(%UNSYNCED LYRICS%,%UNSYNCED LYRIC%)))]");

// ================================================/ Declarations
var g_font = gdi.Font("calibri", 12, 2);
var g_playtimer;
var g_metadb;
var ww = 0, wh = 0;

var PLAYTIMER_VALUE = window.GetProperty("Timer value in ms [10;100]", 10);
var LINE_HEIGHT = window.GetProperty("Line height [20;30]", 24);
var TEXT_SHADOW = window.GetProperty("Text shadow (true/false)", true);
var PLAIN_COLOR_BG = window.GetProperty("Plain colour background (true/false)", false);
var DITHER = window.GetProperty("Top & Botom dither (true/false)", true);
var H_PADDING = window.GetProperty("Horizontal padding [0;20]", 20);
var TXT_ALIGN = window.GetProperty("Text alignment (left/center/right)", "center");
var LIGHT_BG = window.GetProperty("Light background", true);
var DEBUG = false;
var DEFAULT_OFFSET = 29;

var g_fso = new ActiveXObject("Scripting.FileSystemObject");
var g_file = null;
var g_tab = Array();
var g_scroll=0;
var g_lyrics_path;
var g_lyrics_filename;
var g_lyrics_status;
var focus=0;
var focus_next=0;
var g_plainbg_colour;
var g_ovbg_normalcolour;
var g_ovbg_lineseparatorcolour;
var g_ovbg_highlightcolour;
var g_txt_normalcolour;
var g_txt_highlightcolour;
var g_txt_shadowcolour;
var centiemes = 0;
var g_is_scrolling = false;
var g_multi_balise = false;
var g_balise_total;
var g_balise_char_offset = 10;
var g_tab_length;
var g_txt_align;

var midpoint;
var pos;

// START
function on_size() {
var k;
ww = window.Width;
wh = window.Height;
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : false;
 
// exit test on useless calls made (wsh tweak)
if(!ww && !wh) return true;

midpoint = wh / 2 - LINE_HEIGHT / 2;

// colour definitions
// g_plainbg_colour = RGBA(140, 200, 250, 255);
// g_ovbg_normalcolour = RGBA(000, 000, 000, 255);
// g_ovbg_lineseparatorcolour = RGBA(000, 000, 000, 255);
// g_ovbg_highlightcolour = RGBA(020, 100, 240, 130);
// g_txt_normalcolour = RGBA(200, 200, 210, 255);
// g_txt_highlightcolour = RGBA(255, 255, 255, 255);
// g_txt_shadowcolour = RGBA(000, 000, 000, 150);


g_plainbg_colour = RGBA(140, 200, 250, 255);
g_ovbg_normalcolour = RGBA(255, 255, 255, 255);
g_ovbg_lineseparatorcolour = RGBA(255, 255, 255, 255);
g_ovbg_highlightcolour = RGBA(255, 255, 255, 255);
g_txt_normalcolour = RGBA(120, 120,120, 255);
// g_txt_highlightcolour = RGBA(148,148,239, 255);
g_txt_highlightcolour = RGBA(0,128,255, 255);
g_txt_shadowcolour = RGBA(255, 255, 255, 200);

g_playtimer && window.KillTimer(g_playtimer);

if(fb.IsPlaying||fb.IsPaused) {
g_scroll=0;
g_is_scrolling = false;
get_lyrics();
change_focus();
k = g_tab[focus].ante_lines * LINE_HEIGHT;
if(g_lyrics_status>0) {
pos = midpoint - k;
g_playtimer = window.CreateTimerInterval(PLAYTIMER_VALUE);
} else {
delta = (g_tab[g_tab.length-1].ante_lines + g_tab[g_tab.length-1].total_lines);
pos = (wh / 2) - (delta * LINE_HEIGHT / 2);
}
}
}

function on_paint(gr) {
PLAIN_COLOR_BG && gr.FillSolidRect(0, 0, ww, wh, g_plainbg_colour);
if(fb.IsPlaying||fb.IsPaused) {
show_lyrics(gr, g_tab, pos);
DEBUG && gr.GdiDrawText(g_lyrics_status.toString(), g_font, g_normalcolour, 5, 5, ww, LINE_HEIGHT, DT_TOP |

DT_LEFT | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
}
DITHER && gr.FillGradRect(0, 0, ww, 11, 90, g_txt_shadowcolour, RGBA(0,0,0,0));
DITHER && gr.FillGradRect(0, wh-11, ww, 11, 270, g_txt_shadowcolour, RGBA(0,0,0,0));
DITHER && gr.FillGradRect(0, 0, ww, 1, 90, g_txt_shadowcolour, RGBA(0,0,0,0));
DITHER && gr.FillGradRect(0, wh-2, ww, 1, 90, RGBA(0,0,0,0), g_txt_shadowcolour);
}

function on_mouse_lbtn_dblclk(x, y, mask) {
on_size();
}

function on_mouse_leave() {
window.Repaint();
}

function on_playback_time(time) {
// at each new seconde, centiemes is reset to 0 (Increment on timer every 100ms)
centiemes = 0;
if(g_lyrics_status==0) {
if(elap_seconds.Eval()==3) {
on_size();
}
window.Repaint();
}
}

function on_playback_new_track(info) {
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : false;
g_playtimer && window.KillTimer(g_playtimer);
pos=0;
g_scroll = 0;
g_is_scrolling = false;
get_lyrics();
change_focus();
if(g_lyrics_status>0) {
g_playtimer = window.CreateTimerInterval(PLAYTIMER_VALUE);
}
}

function on_playback_seek(time) {
var k;
if(g_lyrics_status>0) {
g_scroll = 0;
g_is_scrolling = false;
change_focus();
k = g_tab[focus].ante_lines * LINE_HEIGHT;
pos = midpoint - k;
window.Repaint();
}
}

function on_playback_stop(reason) {
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : false;
g_playtimer && window.KillTimer(g_playtimer);
if(reason==0) {
// Stop
window.Repaint();
}
}

function on_mouse_wheel(delta) {
if(g_lyrics_status>0) {
if(delta>0) {
pos = (pos>=midpoint)?pos:pos + LINE_HEIGHT;
} else {
pos = (pos<=(wh/2 - g_tab_length*LINE_HEIGHT))?pos:pos - LINE_HEIGHT;
}
window.Repaint();
}
}

function on_timer(id) {
var t1 = elap_seconds.Eval() * 100 + centiemes;
var t2 = len_seconds.Eval() * 100;
var p1, p2;
if(t1>t2-100) {
g_playtimer && window.KillTimer(g_playtimer);
}
if(g_playtimer) {
if(g_playtimer.ID == id) {
if(!g_is_scrolling && t1>=g_tab[focus_next].timer) {
p1 = g_tab[focus].ante_lines*LINE_HEIGHT;
p2 = g_tab[focus_next].ante_lines*LINE_HEIGHT;
g_scroll = p2 - p1;
change_focus();
g_is_scrolling = true;
}
if (g_scroll>0) {
pos -= 1;
g_scroll -= 1;
window.Repaint();
} else {
g_is_scrolling = false;
}
centiemes = (centiemes>98)?0:(centiemes+1);
}
}
}

function show_lyrics(gr, tab, posy) {
var i, k, text_colour;
gr.SetTextRenderingHint(5);
// decoding text alignment (from Properties)
switch(TXT_ALIGN.toUpperCase()) {
case "LEFT":
g_txt_align = lc_stringformat;
break;
case "CENTER":
g_txt_align = cc_stringformat;
break;
case "RIGHT":
g_txt_align = rc_stringformat;
break;
default:
g_txt_align = cc_stringformat;
}
if(g_lyrics_status>0) {
if(posy>=0) {
LIGHT_BG && gr.FillSolidRect(0, Math.floor(posy - wh/2), ww, Math.floor(wh/2), g_ovbg_normalcolour);
}
} else {
LIGHT_BG && gr.FillSolidRect(0, 0, ww, wh, g_ovbg_normalcolour);
}
for(i=0;i<tab.length;i++) {
if(Math.round(posy)>=(LINE_HEIGHT*-4) && Math.round(posy)<wh) {
if(i==focus && g_lyrics_status==1) {
text_colour = g_txt_highlightcolour;
} else {
if(g_lyrics_status==0) {
text_colour = g_txt_highlightcolour;
} else {
text_colour = g_txt_normalcolour;
}
}
if(g_lyrics_status>0) {
if(!LIGHT_BG && i==focus && tab[i].text.length>1 && g_lyrics_status==1) {
gr.FillSolidRect(0, Math.floor(posy), ww, (tab[i].total_lines*LINE_HEIGHT), g_ovbg_highlightcolour);
} else {
LIGHT_BG && gr.FillSolidRect(0, Math.floor(posy), ww, (tab[i].total_lines*LINE_HEIGHT-1), (i==focus

&& tab[i].text.length>1 && g_lyrics_status==1)?g_ovbg_highlightcolour:g_ovbg_normalcolour);
LIGHT_BG && gr.FillSolidRect(0, Math.floor(posy+(tab[i].total_lines*LINE_HEIGHT-1)), ww, 1,

g_ovbg_lineseparatorcolour);
}
}
TEXT_SHADOW && gr.DrawString(tab[i].text, g_font, g_txt_shadowcolour, 1+H_PADDING, Math.floor(posy)-1, ww-

H_PADDING*2, (tab[i].total_lines*LINE_HEIGHT), g_txt_align);
TEXT_SHADOW && gr.DrawString(tab[i].text, g_font, g_txt_shadowcolour, 1+H_PADDING, Math.floor(posy), ww-

H_PADDING*2, (tab[i].total_lines*LINE_HEIGHT), g_txt_align);
gr.DrawString(tab[i].text, g_font, text_colour, 0+H_PADDING, Math.floor(posy)-1, ww-H_PADDING*2, (tab

[i].total_lines*LINE_HEIGHT), g_txt_align);
}
posy = Math.floor(posy+LINE_HEIGHT+((tab[i].total_lines-1)*LINE_HEIGHT));
}
if(g_lyrics_status>0 && posy<=wh) {
LIGHT_BG && gr.FillSolidRect(0, Math.floor(posy), ww, Math.floor(wh), g_ovbg_normalcolour);
}
}

function grab_timer(t_tab) {
var tminutes, tsecondes, tcentiemes;
var i, k, f_sentence, b, c, delta, repeat_text;
var tab = Array();
for(i=0;i<t_tab.length;i++) {
if(g_lyrics_status==1) {
// -----------
// sync lyrics
// -----------
if(IsTimestamped(t_tab[i])) {
b = 0;
while(t_tab[i].substring(b*10, b*10+1)=="[") {
b++;
}
c = b;
repeat_text = remove_enhanced_balises(t_tab[i].substring(c*10, t_tab[i].length));
if(repeat_text.length==0) repeat_text = repeat_text + " ";
for(b=0;b<c;b++) {
f_sentence = new sentence;
tminutes = t_tab[i].substring(1+(b*10), 3+(b*10));
tsecondes = t_tab[i].substring(4+(b*10), 6+(b*10));
tcentiemes = t_tab[i].substring(7+(b*10), 9+(b*10));
f_sentence.timer = Math.round(tminutes)*60*100 + Math.round(tsecondes)*100 + Math.round(tcentiemes)

- DEFAULT_OFFSET;
if(f_sentence.timer<0) f_sentence.timer=0;
f_sentence.text = repeat_text;
tab.push(f_sentence);
}
}
} else {
// -------------
// unsync lyrics
// -------------
if(IsTimestamped(t_tab[i])) {
// if sync line in unsync lyrics, i remove timestamps in this line
b = 0;
while(IsTimestamped(t_tab[i].substring(b*10, b*10+10))) {
b++;
}
t_tab[i] = t_tab[i].substring(b*10, t_tab[i].length);
}
f_sentence = new sentence;
f_sentence.timer = 0;
f_sentence.text = t_tab[i];
tab.push(f_sentence);
}
}
if(tab.length==0) {
g_lyrics_status = 0;
tab = load_track_info();
delta = (tab[tab.length-1].ante_lines + tab[tab.length-1].total_lines);
pos = (wh / 2) - (delta * LINE_HEIGHT / 2);
} else {
f_sentence = new sentence;
f_sentence.timer = 9999999;
f_sentence.text = "---";
tab.push(f_sentence);
}
CollectGarbage();
return calc_lines(sort_tab(tab));
}

function load_file(filePath, fileName) {
var i;
var t_tab = Array();
var str;
g_file = open_file(filePath, fileName, ForReading);
while(!g_file.AtEndOfStream) {
str = g_file.ReadLine();
// blank lines are ignored
if(str.length>0) t_tab.push(str);
}
close_file(g_file);
return grab_timer(check_lyrics_type(t_tab));
}

function check_lyrics_type(t_tab) {
var i;
var count = 0;
var ts_percent;
var tab = Array();
for(i=0;i<t_tab.length;i++) {
if(IsTimestamped(t_tab[i])) {
// format timestamps to default syntax : [99:99.99]
tab.push(ts_analyzer(t_tab[i]));
// count # of sync lines
count++;
} else {
if(t_tab[i].length>0) tab.push(t_tab[i]);
}
}
// calc percent of sync lines, if more than 50% of the total filled lines, it's sync lyrics, else, unsync lyrics!
ts_percent = Math.round(count/tab.length*100);
if(ts_percent>50) {
// sync lyrics
g_lyrics_status = 1;
} else {
// unsync lyrics
g_lyrics_status = 2;
}
return t_tab;
}

function parse_tag(tag, delimiter) {
var t_tab = Array();
var i, j;
j = 0;
for(i=0;i<tag.length;i++) {
if(i==tag.length-1 || tag.charCodeAt(i)==10 || (i>0 && (i<tag.length-5) && (tag.substring(i, i+1)==delimiter) &&

(tag.substring(i-1, i)!="]"))) {
if(i==tag.length-1) {
t_tab.push(tag.substring(j, i+1));
} else {
t_tab.push(tag.substring(j, i));
}
if(tag.charCodeAt(i)!=10) {
j = i;
} else {
j = i+1;
}
}
}
return grab_timer(check_lyrics_type(t_tab));
}

function load_track_info() {
var tab = Array(new sentence, new sentence, new sentence, new sentence);
var count = 0;
tab[count].text = "---";
count++;
tab[count].text = artist.Eval();
count++;
tab[count].text = title.Eval();
count++;
tab[count].text = "---";
count++;
return calc_lines(tab);
}

function open_file(filePath, fileName, ioMode) {
var fileInst = null;
var bool = file_exists(filePath + fileName);
if(bool) {
fileInst = g_fso.OpenTextFile(filePath + fileName, ioMode);
}
return fileInst;
}

function close_file(fileInst) {
fileInst.Close();
}

function read_file(fileInst) {
var line = fileInst.ReadLine();
return line;
}

function folder_exists(folderPath) {
var fso, bool;
fso = new ActiveXObject("Scripting.FileSystemObject");
bool = fso.FolderExists(folderPath);
return bool;
}

function file_exists(filePath) {
var fso, bool;
fso = new ActiveXObject("Scripting.FileSystemObject");
bool = fso.Fileexists(filePath);
return bool;
}

function lyrics_folder_exists(folder_name) {
var fso;
var bool=1;
fso = new ActiveXObject("Scripting.FileSystemObject");
if (folder_exists(fb.ProfilePath + folder_name) == false) {
fso.CreateFolder(fb.ProfilePath + folder_name);
bool=0;
}
return bool;
}

function change_focus() {
var i, j;
var t1 = elap_seconds.Eval()*100+centiemes;
if(g_lyrics_status>0) {
// search line index just after actual timer
for(i=0;i<g_tab.length;i++) {
if(g_tab[i].timer>t1) break;
}
focus_next=i;
focus = (i>0)?i-1:0;
// now i check if there are more than one line with the same timer as focus one & if found, i take it as new

focus 'cause it's the first (not a blank line)
if(focus>0) {
for(i=0;i<focus;i++) {
if(g_tab[i].timer==focus) {
focus = i;
break;
}
}
}
}
}

function calc_lines(ctab) {
var i, j;
var padx = 0;
var tmp_img;
var gp;
var lineh;
g_tab_length = 0;
if(ww==0) return ctab; // test to avoid errors if panel is hidden (ww=0)
tmp_img = gdi.CreateImage(ww-(H_PADDING*2)-padx, 100);
gp = tmp_img.GetGraphics();
for(i=0;i<ctab.length;i++) {
// calc sentence #lines to display / window.width
lineh = gp.MeasureString(ctab[i].text, g_font, 0, 0, ww-(H_PADDING*2)-padx, wh).Height;
ctab[i].total_lines = (lineh/LINE_HEIGHT) > Math.floor(lineh/LINE_HEIGHT) ? Math.floor(lineh/LINE_HEIGHT) + 1 :

Math.floor(lineh/LINE_HEIGHT) ;
ctab[i].ante_lines = 0;
for(j=0;j<i;j++) {
ctab[i].ante_lines += ctab[j].total_lines;
}
g_tab_length += ctab[i].total_lines;
}
CollectGarbage();
return ctab;
}

function sort_tab(tab2sort) {
var tab = Array();
var i, j;
var tmp = new sentence;
var smallest = 0;
for(i=0;i<tab2sort.length;i++) {
for(j=i;j<tab2sort.length;j++) {
if(tab2sort[i].timer > tab2sort[j].timer) {
tmp = tab2sort[i];
tab2sort[i] = tab2sort[j];
tab2sort[j] = tmp;
}
}
tab.push(tab2sort[i]);
}
return tab;
}

function remove_enhanced_balises(str) {
var i;
var chr1, chr2;
var new_str="";
for(i=0;i<str.length;i++) {
chr1 = str.substring(i, i+1);
if(i+10<=str.length) chr2 = str.substring(i+9, i+10); else chr2=null;
if(chr1=="<" && chr2==">") {
i = i + 10 - 1;
} else {
new_str = new_str + chr1;
}
}
return new_str;
}

function ts_analyzer(str) {
var i, j, ch,  ts_len;
var str2 = "";
var state=0;
var deb = -1;
var fin = -1;
var sep1 = -1;
var sep2 = -1;
var suite=0;
for(i=0;i<str.length;i++) {
ch = str.substring(i, i+1);
switch(state) {
case 0:
if(ch=="[" && IsNumeric(str.substring(i+1, i+2))) {
state=1;
deb=i;
fin=-1;
}
break;
case 1:
if(deb>=0 && ch==":") {
state=2;
sep1=i;
}
if(i>deb+3) {
deb=-1;
fin=-1;
sep1=-1;
sep2=-1;
state=0;
}
break;
case 2:
if(sep1>=0 && (ch==":" || ch==".")) {
state=3;
sep2=i;
}
if(sep1>=0 && sep2==-1 && ch=="]") {
state=4;
fin=i;
}
if(i>sep1+3) {
deb=-1;
fin=-1;
sep1=-1;
sep2=-1;
state=0;
}
break;
case 3:
if(deb>=0 && ch=="]") {
state=4;
if(i==str.length-1) {
str=str+" ";
}
fin=i;
}
if(i>deb+10) {
deb=-1;
fin=-1;
sep1=-1;
sep2=-1;
state=0;
}
break;
case 4:
ts_len=fin-deb+1;
switch(ts_len) {
case 6:
str2 = str2 + "[0" + str.substring(deb+1,deb+2) + ":" + str.substring(deb+3, deb+5) + ".00]";
break;
case 7:
str2 = str2 + str.substring(deb,deb+6) + ".00]";
break;
case 9:
str2 = str2 + "[0" + str.substring(deb+1,deb+2) + ":" + str.substring(deb+3, deb+5) + "." +

str.substring(deb+6, deb+8) + "]";
break;
case 10:
if(sep1==deb+2) {
str2 = str2 + "[0" + str.substring(deb+1,deb+2) + ":" + str.substring(deb+3, deb+5) + "." +

str.substring(deb+6, deb+8) + "]";
} else {
str2 = str2 + str.substring(deb,deb+10);
}
break;
case 11:
str2 = str2 + str.substring(deb,deb+9) + "]";
break;
}
j += 10;
if(str.substring(fin+1,fin+2)=="[") {
suite = 1;
i = fin;
deb = -1;
fin = -1;
sep1 = -1;
sep2 = -1;
state = 0;
} else {
suite = -1;
i = str.length - 1;
str2 = str2 + str.substring(fin+1, str.length);
}
break;  
}
}
return str2;
}

function IsNumeric(str) {
var ValidChars = "0123456789.";
for (i = 0; i < str.length; i++) {
if (ValidChars.indexOf(str.charAt(i)) == -1) {
return false;
}
}
return true;
}

function IsTimestamped(str) {
var ValidChars = "[0123456789:.]";
var count = 0;
for (i = 0; i < (str.length>10?10:str.length); i++) {
if (ValidChars.indexOf(str.charAt(i)) >=0) {
count++;
}
}
if(count>=6 && count <=11) {
return true;
} else {
return false;
}
}

function check_file(path, filename) {
if(file_exists(path+filename+".lrc")) {
g_lyrics_filename  = filename+".lrc";
g_lyrics_path = path;
return true;
} else {
if(file_exists(path+filename+".txt")) {
g_lyrics_filename  = filename+".txt";
g_lyrics_path = path;
return true;
}
}
return false;
}

function get_lyrics() {
var i, count, delta, tag;
var tpath = Array(lyrics_dir1.EvalWithMetadb(g_metadb), lyrics_dir2);
var tfilename= Array(artist.Eval() + " -" + title.Eval(), artist.Eval() + " - " + title.Eval());
var bool_tag = false;
var bool_file = false;
 
// reset lyrics tab
g_lyrics_status = 0;
if(g_tab.length>0) g_tab.splice(0, g_tab.length);
pos = midpoint;
focus = 0;
window.Repaint();
 
// check TAGs
tag = lyrics.Eval();
if(tag.length>0) {
bool_tag = true;
if(tag.substring(0,1)=="[") g_lyrics_status = 1; else g_lyrics_status = 2;
} else {
// check files
i = 0;
while(!bool_file && i<2) {
j = 0;
while(!bool_file && j<2) {
bool_file = check_file(tpath[i], tfilename[j]);
j++;
}
i++;
}
}
// if lyrics found
if(bool_tag || bool_file) {
if(bool_tag) {
g_tab = parse_tag(tag, "[");
} else {
g_tab = load_file(g_lyrics_path, g_lyrics_filename);
}
}  else {
g_tab = load_track_info();
delta = (g_tab[g_tab.length-1].ante_lines + g_tab[g_tab.length-1].total_lines);
pos = (wh / 2) - (delta * LINE_HEIGHT / 2);
}

if(g_lyrics_status==2) {
for(i=0;i<g_tab.length-1;i++) {
g_tab[i].timer = i * Math.floor(len_seconds.Eval() * 100 / g_tab.length);
}
}
}
Title: WSH Panel Mod script discussion/help
Post by: mengxk2008 on 2010-10-30 12:21:23
the original tooltip button code is by T.P Wang and tedgo. i don't understand it that well either.

i'll try and work it out from what Tom posted.

in the meantime, i've updated my samples. they've all had their options updated to be accessible from the context menu only. no more script editing should be needed (one exception is setting the image size and margins for buttons).

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

samples include

rating script by NEMO7538
simple seekbar
simple biography
playback buttons
web links (myspace, youtube, lastfm)
3 in 1 artwork panel
-the first is a straight replacement for the default art panel. it always prefers embedded album art if it exists. it then falls back on the usual display options set in the foobar preferences.
-last.fm artist art panel. can download multiple images from last.fm and cycle through them. it must be triggered manually using the context menu
-cycle folder option. can cycle through images in a folder at 5, 10 or 20 second intervals

so no instructions needed really. just extract the scripts folder into your foobar directory. add panels and import the samples you want and right click them to see the various options.

EDIT: in the unlikely event someone downloaded this between 1:35-150pm today, please download it again. i didn't update the zip with my newest files. 


Hi guys,

Do you have any good idea to achieve the Album cover panel automatically download and mobile display cover?

BTW, I want to set Album text cache path to the location “D: \ Program Files \ Foobar2000V1.1 \ lastfm \ album“, but I hope it can instead using relative path for that never to worry about when folder and system changes. Could you hope me? I really appreciate you first.
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2010-10-31 00:35:39
marc, my foo_lastfm_radio along with your script WSH panel does not work, even with the the plugin configured with a username and password whenever I try to use the panel "similar artists" or "charts" of the same error: "Unable to launch last. fm radio ...."

I'm using the google translator, sorry but I am Brazilian
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-11-01 10:27:26
Hi guys,

Do you have any good idea to achieve the Album cover panel automatically download and mobile display cover?

BTW, I want to set Album text cache path to the location “D: \ Program Files \ Foobar2000V1.1 \ lastfm \ album“, but I hope it can instead using relative path for that never to worry about when folder and system changes. Could you hope me? I really appreciate you first.


for album covers, you'd be better off using foo_discogs (http://www.hydrogenaudio.org/forums/index.php?showtopic=50523) or Album Art Downloader XUI (http://www.hydrogenaudio.org/forums/index.php?showtopic=57392)

as for the path, if you install foobar in portable mode (preferably not in "program files"), then it already uses relative paths to a folder inside your foobar installation directory.

however, to fully customise it, you can open this file in your favourite text editor.....

Code: [Select]
foobar install dir\scripts\marc2003\v2\common.js


and scroll right to the bottom. look at line 351.....

Code: [Select]
var data_folder = fb.ProfilePath + "wsh_lastfm\\";


and change it as required. remember to use double backslashes when separating folders.

but as mentioned above, fb.ProfilePath already points to the foobar install dir when in portable mode. you could use fb.FoobarPath to point to the install directory regardless of mode but remember, windows doesn't usually allow write access to folders/files inside "program files".

"Unable to launch last. fm radio ...."


what happens if you try and use foo_lastfm radio normally either via "File>open last.fm radio" or use the "last.fm radio" context menu for any entry in your playlist.

it might be that last.fm doesn't allow streaming in your country.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-01 13:50:50
Hi,

Lyriks 1.3 released (bugs fix + tweaks)

Get it here : http://pastebin.com/CCeebA4x (http://pastebin.com/CCeebA4x)



Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2010-11-01 15:50:18
what happens if you try and use foo_lastfm radio normally either via "File>open last.fm radio" or use the "last.fm radio" context menu for any entry in your playlist.

it might be that last.fm doesn't allow streaming in your country.


marc, I tried to use the File> Open Last.fm Radio Station> Your recommended Last.fm radio and it worked
is only in your script that does not work: (
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-11-01 22:23:57
Hi,

Lyriks 1.3 released (bugs fix + tweaks)

Get it here : http://pastebin.com/CCeebA4x (http://pastebin.com/CCeebA4x)



user clicks on timestamped lyrics row then seek the track to that position.

this funtion is where?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-01 22:47:24
not done yet
Title: WSH Panel Mod script discussion/help
Post by: mengxk2008 on 2010-11-02 03:05:45
Hi guys,

Do you have any good idea to achieve the Album cover panel automatically download and mobile display cover?

BTW, I want to set Album text cache path to the location “D: \ Program Files \ Foobar2000V1.1 \ lastfm \ album“, but I hope it can instead using relative path for that never to worry about when folder and system changes. Could you hope me? I really appreciate you first.


for album covers, you'd be better off using foo_discogs (http://www.hydrogenaudio.org/forums/index.php?showtopic=50523) or Album Art Downloader XUI (http://www.hydrogenaudio.org/forums/index.php?showtopic=57392)

as for the path, if you install foobar in portable mode (preferably not in "program files"), then it already uses relative paths to a folder inside your foobar installation directory.

however, to fully customise it, you can open this file in your favourite text editor.....

Code: [Select]
foobar install dir\scripts\marc2003\v2\common.js


and scroll right to the bottom. look at line 351.....

Code: [Select]
var data_folder = fb.ProfilePath + "wsh_lastfm\\";


and change it as required. remember to use double backslashes when separating folders.

but as mentioned above, fb.ProfilePath already points to the foobar install dir when in portable mode. you could use fb.FoobarPath to point to the install directory regardless of mode but remember, windows doesn't usually allow write access to folders/files inside "program files".

"Unable to launch last. fm radio ...."


what happens if you try and use foo_lastfm radio normally either via "File>open last.fm radio" or use the "last.fm radio" context menu for any entry in your playlist.

it might be that last.fm doesn't allow streaming in your country.


thanks for your reply, maybe your solution can help me, I will try some test.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-03 13:12:46
Lyriks 1.3 released (bugs fix + tweaks)

Thanks

Curious, was this redundant:
Code: [Select]
// exit test on useless calls made (wsh tweak)
if(!ww && !wh) return true;


And please consider user defined color properties - every time I use new script I have to search this values inside script and make various adjustments by hand. What I'm saying is consider all "color definitions" in Properties
+ you changed the names of variables
Maybe also vertical height for gradient, which I always change to 32px, but it's easy to change parameter if it's only one
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-03 15:14:26
Timestamped lyrics aren't reseted when using seek-bar (seek back)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-03 17:50:47
Timestamped lyrics aren't reseted when using seek-bar (seek back)


right, i've found this bug after posting v1.3, next version is fixed, i'll share it soon.
Title: WSH Panel Mod script discussion/help
Post by: th3_jok3r on 2010-11-03 19:11:49
Scripting Engine Initialization Failed ({EA64722C-DA97-4460-94BB-B6B5A2C5FF14}, CODE: 0x86664004)
Check the console for more information (Always caused by unexcepted script error).


and

Can not create File System Object (FSO), WSH Cover Panel can't work.

I use Windows 7 and I think windows script host is installed by default.
here what I got in console:

Error: WSH Panel Mod ({EA64722C-DA97-4460-94BB-B6B5A2C5FF14}): Erro em tempo de execução do Microsoft JScript:
O servidor de automação não pode criar objeto
Ln: 45, Col: 3
<source text only available in compile time>
WSH Panel Mod ({2ADCA884-84EB-4B29-9BCC-B9491ABFF805}): initialized in 16 ms
WSH Panel Mod ({2E67F0FF-131A-4E6C-8162-5D269CDC4B44}): initialized in 3 ms
WSH Panel Mod ({3560A5C6-455B-4269-A51D-4443144330A3}): initialized in 11 ms
WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): Parsing file "C:\Users\soe9113\AppData\Roaming\foobar2000\\skins\ZiX+\Scrollbar\scrollbar.js": Failed to load
WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): initialized in 118 ms
Error: WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): Erro em tempo de execução do Microsoft JScript:
'VPSize' não está definido
Ln: 58, Col: 1
<source text only available in compile time>
WSH Panel Mod ({EA62CC17-FE36-4B8C-987D-EE4FE2D9285E}): initialized in 12 ms
WSH Panel Mod ({05FC3C9F-9AE7-4B2A-85F6-EBC5C6FBF042}): initialized in 26 ms
WSH Panel Mod ({0E317A12-BFF2-49A2-9965-3574476E9C06}): initialized in 12 ms
WSH Panel Mod ({AEFF8777-7709-4F68-B487-A99A9510830A}): initialized in 9 ms
Startup time : 0:01.784568

how can I solve this problem? I remember Appdata had some problems in other applications like mIRC

thanks
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-03 20:48:37
Scripting Engine Initialization Failed ({EA64722C-DA97-4460-94BB-B6B5A2C5FF14}, CODE: 0x86664004)
Check the console for more information (Always caused by unexcepted script error).

...

thanks

Is the Safe mode option unticked for WSH Panel Mod in File/Preferences?

Timestamped lyrics aren't reseted when using seek-bar (seek back)


right, i've found this bug after posting v1.3, next version is fixed, i'll share it soon.

ok, here is a new build that fix 2 bugs (reset position after a seek backward was wrong + bad scrolling length for some sync lyrics when the timer was higher to 10 ms)
+ colours in Properties panel

Lyriks 1.3 (build 20101103.2140) : http://pastebin.com/eVfJ2Ss8 (http://pastebin.com/eVfJ2Ss8)
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-04 03:34:06
Works great now, except:

Can you tell me how to adjust transition interval between active lines in timestamped lyrics? I think it was changed between versions and now it is too jumpy for my taste
I browsed your code and couple of your comments but nothing obvious there
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-11-04 04:55:23
Scripting Engine Initialization Failed ({EA64722C-DA97-4460-94BB-B6B5A2C5FF14}, CODE: 0x86664004)
Check the console for more information (Always caused by unexcepted script error).


and

Can not create File System Object (FSO), WSH Cover Panel can't work.

I use Windows 7 and I think windows script host is installed by default.
here what I got in console:

Error: WSH Panel Mod ({EA64722C-DA97-4460-94BB-B6B5A2C5FF14}): Erro em tempo de execução do Microsoft JScript:
O servidor de automação não pode criar objeto
Ln: 45, Col: 3
<source text only available in compile time>
WSH Panel Mod ({2ADCA884-84EB-4B29-9BCC-B9491ABFF805}): initialized in 16 ms
WSH Panel Mod ({2E67F0FF-131A-4E6C-8162-5D269CDC4B44}): initialized in 3 ms
WSH Panel Mod ({3560A5C6-455B-4269-A51D-4443144330A3}): initialized in 11 ms
WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): Parsing file "C:\Users\soe9113\AppData\Roaming\foobar2000\\skins\ZiX+\Scrollbar\scrollbar.js": Failed to load
WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): initialized in 118 ms
Error: WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): Erro em tempo de execução do Microsoft JScript:
'VPSize' não está definido
Ln: 58, Col: 1
<source text only available in compile time>
WSH Panel Mod ({EA62CC17-FE36-4B8C-987D-EE4FE2D9285E}): initialized in 12 ms
WSH Panel Mod ({05FC3C9F-9AE7-4B2A-85F6-EBC5C6FBF042}): initialized in 26 ms
WSH Panel Mod ({0E317A12-BFF2-49A2-9965-3574476E9C06}): initialized in 12 ms
WSH Panel Mod ({AEFF8777-7709-4F68-B487-A99A9510830A}): initialized in 9 ms
Startup time : 0:01.784568

how can I solve this problem? I remember Appdata had some problems in other applications like mIRC

thanks


A ZiX+ user, right?

well, when i was compiling the codes of scrollable trackinfo panel, it never occurred to me that many people choose to use the standard installation and i used the profile path in predecessor:(

BTW, please uncheck the safe mode in WSH panel.

I will fix this problem asap.
focus on my deviantart page.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-04 07:08:09
Works great now, except:

Can you tell me how to adjust transition interval between active lines in timestamped lyrics? I think it was changed between versions and now it is too jumpy for my taste
I browsed your code and couple of your comments but nothing obvious there


now the timer should not be greater than 10 ms (if greater, it will cause bad scrolling offsets on certain sync lyrics!)

but you can change the scroll step value, actually set to 1 (max), change it for a lower value for a slower scrolling, like 0.5, it's line 39:

(http://img80.imageshack.us/img80/7822/lyriks.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-11-04 09:55:34
samples updated:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

i've updated the "simple biograhy" script to use the new redirection feature made available in the last.fm API. this helps if your files are incorrect tagged.

old version of script with wrong tags / new script with spelling correction off
(http://k5sbdw.blu.livefilestore.com/y1pbnkRHixR13agC14VfKkVhGCwFIQ7JoAbDd2ZvEQ6fiFrDO2XwGTpaPQdAyXFuH0xN6fJFOqvOq9en25AoCEJ2FYbxzp3i16B/bio1.PNG)

new version of script, wrong tags, spelling correction on:
(http://k5sbdw.blu.livefilestore.com/y1px4CCP5b85Lbxcf4Jk7UZ5Ja5NgqNOLjgJ5FT3MuZE_1JFpSbhQySR8QqFcLjMIPDiYIzi2EqNaiGIwsm4nbX4qdZpkIEDZbY/bio2.PNG)

note this does not touch your file tagging at all. it's simply for display purposes.
Title: WSH Panel Mod script discussion/help
Post by: Sylph on 2010-11-04 10:06:17
I had one layout and it kept happening, I deleted it (manually though) and it keeps happening with a different layout (which wasn't written by me):

(http://i51.tinypic.com/2uyqhhv.png)

Sometimes it goes away when I  right-click on a panel and press OK, but usually it doesn't and I have to restart a zillion times until it somehow, magically starts to work.

Safe Mode is disabled.


Scripting Engine Initialization Failed ({EA64722C-DA97-4460-94BB-B6B5A2C5FF14}, CODE: 0x86664004)
Check the console for more information (Always caused by unexcepted script error).


and

Can not create File System Object (FSO), WSH Cover Panel can't work.

I use Windows 7 and I think windows script host is installed by default.
here what I got in console:

Error: WSH Panel Mod ({EA64722C-DA97-4460-94BB-B6B5A2C5FF14}): Erro em tempo de execução do Microsoft JScript:
O servidor de automação não pode criar objeto
Ln: 45, Col: 3
<source text only available in compile time>
WSH Panel Mod ({2ADCA884-84EB-4B29-9BCC-B9491ABFF805}): initialized in 16 ms
WSH Panel Mod ({2E67F0FF-131A-4E6C-8162-5D269CDC4B44}): initialized in 3 ms
WSH Panel Mod ({3560A5C6-455B-4269-A51D-4443144330A3}): initialized in 11 ms
WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): Parsing file "C:\Users\soe9113\AppData\Roaming\foobar2000\\skins\ZiX+\Scrollbar\scrollbar.js": Failed to load
WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): initialized in 118 ms
Error: WSH Panel Mod ({5D5CBB4E-09F1-4BC3-9329-6B485FC21525}): Erro em tempo de execução do Microsoft JScript:
'VPSize' não está definido
Ln: 58, Col: 1
<source text only available in compile time>
WSH Panel Mod ({EA62CC17-FE36-4B8C-987D-EE4FE2D9285E}): initialized in 12 ms
WSH Panel Mod ({05FC3C9F-9AE7-4B2A-85F6-EBC5C6FBF042}): initialized in 26 ms
WSH Panel Mod ({0E317A12-BFF2-49A2-9965-3574476E9C06}): initialized in 12 ms
WSH Panel Mod ({AEFF8777-7709-4F68-B487-A99A9510830A}): initialized in 9 ms
Startup time : 0:01.784568

how can I solve this problem? I remember Appdata had some problems in other applications like mIRC

thanks

Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-04 13:26:49
but you can change the scroll step value, actually set to 1 (max), change it for a lower value for a slower scrolling, like 0.5, it's line 39:

Thanks Falstaff
I've set it to 0.2
Now it's greater then ever

Cheers
Title: WSH Panel Mod script discussion/help
Post by: th3_jok3r on 2010-11-04 13:28:09
thanks for all replies, I disabled safe mode and now is working ok. Thanks.
I like ZiX+ cause  is a very clean and easy skin. I tried others but some other skin got lot of problems, maybe components not updated.

Title: WSH Panel Mod script discussion/help
Post by: Reflection on 2010-11-08 01:51:09
First, thanks to Marc and everyone else for their great scripts and tips. I've had some success tweaking various scripts to suit my needs, but I'm having trouble accomplishing one thing...

Basically I want to combine the custom folder mode from the Thumbs script and use that for the artist art in the Now Playing script. Can anyone help me achieve this?

I keep my artist art in the root folder of the artist: Music\Artist\Album\

Custom folder works perfectly for my needs I just need the option in the Now Playing script
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-11-08 11:26:29
you could do a quick and dirty edit of the "now playing" script, changing line 55 to something like...

Code: [Select]
folder = fb.TitleFormat("$replace($directory_path(%path%),%directory%,)").EvalWithMetadb(g_metadb);
Title: WSH Panel Mod script discussion/help
Post by: Reflection on 2010-11-08 19:35:06
Thank you that works perfectly.
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-11-09 06:23:45
I'm trying to figure simple way to add (or replace) variable to custom_db with WSH Panel Mod and could use some help since I have no experience with databases. Some sample code would be appreciated.

I have sqlite3.exe and foo_run present and have been trying to make some sense to marc2003's scripts but I'm afraid I will fuck something up with my db if I just copy those scripts...
Title: WSH Panel Mod script discussion/help
Post by: MB. on 2010-11-09 12:16:46
I'm trying to figure simple way to add (or replace) variable to custom_db with WSH Panel Mod and could use some help since I have no experience with databases. Some sample code would be appreciated.

I have sqlite3.exe and foo_run present and have been trying to make some sense to marc2003's scripts but I'm afraid I will fuck something up with my db if I just copy those scripts...


you can just add actions in the settings of custom database. then in your script you can call those actions using  fb.RunContextCommand([your_action])
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-11-10 13:53:02
you can just add actions in the settings of custom database. then in your script you can call those actions using  fb.RunContextCommand([your_action])

Thanks. I got it working but it's kinda ugly:
Code: [Select]
function on_playback_time()
{

    if (wait == 0) newsongready = 1;

    if (newsongready == 1 && song_handled == 0)
    {
        g_metadb = fb.GetNowPlaying();
        g_metadb.UpdateFileInfoSimple("artistinfo",lastfm_data[1][1]);
        g_metadb.UpdateFileInfoSimple("albuminfo",lastfm_data[2][1]);
        fb.trace("mdbc: "+lastfm_data[1][1]+" / "+lastfm_data[2][1]);
        song_handled = 2;
        fb.trace(song_handled+fb.TitleFormat(" art: %artistinfo% alb: %albuminfo%").Eval());
    }
    else if (song_handled == 2)
    {
        if (fb.TitleFormat("$if(%artistinfo%,$if(%albuminfo%,1,0),0)").Eval() == 1)
        {
            fb.RunContextCommand("Customdb SetArtistCount");
            fb.RunContextCommand("Customdb SetAlbumCount");
            song_handled = 1;
            g_metadb.UpdateFileInfoSimple("artistinfo","");
            g_metadb.UpdateFileInfoSimple("albuminfo","");
            fb.trace(song_handled+fb.TitleFormat(" art: %artistinfo% alb: %albuminfo%").Eval());
        }
    }
}

As you see, I have to first put my data to tags, then (when it's ready) use contextmenu to store it from tags to customdb and remove tags. If somebody knows better way of doing this I would be pleased.
Title: WSH Panel Mod script discussion/help
Post by: n0thng2bd0ne on 2010-11-10 21:39:23
i was looking for a way to bring up in my browser or foobar console a tinysong link to the song i'm playing.  tinysong has an api

http://tinysong.com/api (http://tinysong.com/api)

i was wondering if this is compatible with wsh panel mod?

there is a chrome extension that makes use of it:
https://chrome.google.com/extensions/detail...aejpghooihfdipa (https://chrome.google.com/extensions/detail/dnecfmdnglboegjiaaejpghooihfdipa)
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2010-11-17 12:12:48
@Falstaff

I am enjoying using your Lyriks 1.3 script. However, I am having problems with the wrong characters being displayed for some lyric files. One example is below.

The initial part of the lrc file is shown below. The last line displays incorrrectly as:

I don’t think I know my way around

[encoding:windows-1250]
[ti:Your mistake]
[ar:Melanie C]
[al:This time]
[la:en]
[00:02.10]| Melanie C - Your mistake |
[00:02.70]| album: 'This time' 2007 |

[00:05.67]I should concentrate on slowing down
[00:10.33]Cause all I wanna do is drive fast
[00:13.42]I don’t think I know my way around

There are problems with other characters as well in certain lrc files. Is it possible to fix these errors? The display font is your default of Segoe UI.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-17 12:27:35
...
The initial part of the lrc file is shown below. The last line displays incorrrectly as:

I don’t think I know my way around

...
[00:13.42]I don’t think I know my way around

There are problems with other characters as well in certain lrc files. Is it possible to fix these errors? The display font is your default of Segoe UI.


yes, some chars (ansi, non-ascii) may not be rendered as well if the lyrics are grabbed from a file from disk BUT it's OK if the lyrics are stored in the file TAG.

this is due to the fact that WSH can't (or i've not find how to do...) read non-ascii characteres ==> read file function in javascript limitations, it took the encoding mode of the system you are running with (i think)

if someone know how to fix it, i'm interrested too, btw, i store my lyrics in TAG, not on disk, so i don't encounter this problem often.

Is you example stored on disk ?
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2010-11-17 12:37:04
Yes my lrc files are stored on disk.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-17 16:21:46
if someone know how to fix it, i'm interrested too, btw, i store my lyrics in TAG, not on disk, so i don't encounter this problem often.

Code: [Select]
iconv.exe -s -f CP1250 -t CP1252 input.txt > output.txt


iconv can be dl, i.e. from here (Binaries + Dependencies link): http://gnuwin32.sourceforge.net/packages/libiconv.htm (http://gnuwin32.sourceforge.net/packages/libiconv.htm)

if lyrics are stored in tags foo_chacon would be ideal
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-17 21:41:46
i will try it, thanx romor
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2010-11-22 18:58:30
... in the meantime I have put a replace function in to strip out unwanted characters which helps the display a lot. After line 603 I have put:

new_str = new_str.replace(/[^'-;:,.?!"&*()+=\w\d\s]/gi,'');

I am also getting the occasional crash due to a script error. This is with your unaltered code. Always it occurs when using another application and it happens when return to foobar2000.

'g_tab[...].timer' is null or not an object
Ln: 279, Col: 13
<source text only available in compile time>

Is it possible to fix this?

Other than these points it is working extremely well.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-23 12:19:21
I am also getting the occasional crash due to a script error. This is with your unaltered code. Always it occurs when using another application and it happens when return to foobar2000.

Noticed same here unfortunatelly

And I thought your (Falstaff) question about encodings was general as I'm courious too if there is some VBS/JS conversion possible. At least conversion to ASCII or ANSI, and even only from European latin encodings (obviously if we are talking only about ASCII/ANSI)
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-11-24 07:53:34
As T.P mentions, he didn't consider any problem about file code when compiling WSH mod.
It's simply the problem from the component itself.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-24 18:41:37
I was thinking again on this encodings subject and two ideas come to my mind:
- dictionary object referring character original and it's Unicode representation, or
- dictionary object referring only problematic European encodings to their 'best fit' ASCII equivalent

Then parsing lyrics text object through function using above dict

Both methods should work unnoticeable, as lyrics text is small text object

I'm going to implement second one in VBS for my file manager as it can't read filenames other than my locale and has VBS extensibility
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-24 20:13:12
update to above:
There is option to do conversion with [ADODB.Stream] for which you can define [.Charset], but the problem is how can you know in which charset are source (problematic) lyrics?
So I guess best option is to do 'best fit' ASCII conversion with dictionary object

[edit] or to just strip non-ascii chars: 32 < Asc(Chr) < 125
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2010-11-25 11:54:33
So why not consider using utils.ReadTextFile()? It handles ANSI, UTF8 (with BOM) and UTF16 (with BOM) files.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-25 12:30:02
Problem are encоdings not covered by user's code page, for example your locale/code page/ANSI representation is in CP-1252 and file is CP-1250 encoded or similar
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-11-27 11:40:58
I wonder if you can hide external process window and accessing its stdin at the same time. I know how to hide the window with wshshell.Run() method and accessing stdin of an external process with wshshell.Exec() method but you can't access stdin with Run() method and similarly I can't run a hidden process with Exec() method. Is it possible, and how?

I'm kinda new to javascript so any help is appreciated.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-27 13:56:35
Problem are enc?dings not covered by user's code page, for example your locale/code page/ANSI representation is in CP-1252 and file is CP-1250 encoded or similar



try v1.4.0

http://www.hydrogenaudio.org/forums/index....st&p=733166 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=733166)
Title: WSH Panel Mod script discussion/help
Post by: romor on 2010-11-27 17:30:55
It's great that now there exist such a conversion function.

My point is how can you tell if lyrics file is CP1250 or CP1253 or whatever else encoded?
AFAIK there isn't smart way of knowing file encoding. You could eliminate some encodings, but it's impossible to know in which encoding is original file unless you do it visually by looking represented characters on monitor (through your code page).
For automated purpose I suggested "downsampling" to ASCII (which would work fine with some encodings). Similar to $ascii(), or even better $ansi() function in foobar TF. I overlooked in previous posts that foobar TF functions can be executed inside WSH code
IMHO all this should be leaved to user discretion, without trying to fix anything on other side. If user has lyrics files encoded in strange CP than he/she should take care of it (unfortunately I'd guess user is not aware of his lyrics file encodings, as they are mainly downloaded, shared etc.)

Maybe you can do simple check to see if file is UTF-8 encoded, then if it's not and byte stream values are not in ASCII or in user code page extended character representation, then do ASCII downsampling.

How do you plan to use this function inside your lyrics script, anyway?
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-11-28 19:07:06
I have made kind of intensive calculation function that takes about a minute to go through. During this foobar goes to "not responding"-state. How could I do this calculation "in the background" so it wouldn't affect the whole programs performance? (function mainly consist of one long while-loop that goes through all the tracks)
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2010-11-29 00:48:37
Problem are enc?dings not covered by user's code page, for example your locale/code page/ANSI representation is in CP-1252 and file is CP-1250 encoded or similar



try v1.4.0

http://www.hydrogenaudio.org/forums/index....st&p=733166 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=733166)



this download is bad for me

I can't download now

please give me another download address
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-11-29 07:23:36
@hejiamei:

i was not talking about my lyriks WSH script !!! but about WSH panel mod release... so there is no link to download something yet. later.
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2010-12-05 22:13:18
samples updated:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

i've updated the "simple biograhy" script to use the new redirection feature made available in the last.fm API. this helps if your files are incorrect tagged.

old version of script with wrong tags / new script with spelling correction off
(http://k5sbdw.blu.livefilestore.com/y1pbnkRHixR13agC14VfKkVhGCwFIQ7JoAbDd2ZvEQ6fiFrDO2XwGTpaPQdAyXFuH0xN6fJFOqvOq9en25AoCEJ2FYbxzp3i16B/bio1.PNG)

new version of script, wrong tags, spelling correction on:
(http://k5sbdw.blu.livefilestore.com/y1px4CCP5b85Lbxcf4Jk7UZ5Ja5NgqNOLjgJ5FT3MuZE_1JFpSbhQySR8QqFcLjMIPDiYIzi2EqNaiGIwsm4nbX4qdZpkIEDZbY/bio2.PNG)

note this does not touch your file tagging at all. it's simply for display purposes.


This doesnt appear to work for me. I have spelling correction turned off and whilst the biography details are of those it has redirected to, it doesnt display the "redirected from" text. Has this been removed from the latest samples script?

Example: Swedish House Mafia feat. Pharrell - One (Your Name)

The biography panel displays the info from the Swedish House Mafia page (http://www.last.fm/music/Swedish+House+Mafia) which when viewing in my browser states I have been redirected from Swedish House Mafia feat. Pharrell page (http://www.last.fm/music/+noredirect/Swedish+House+Mafia+feat.+Pharrell). The artist name in bold in the heading remains as Swedish House Mafia feat. Pharrell. As the thumbnails 2 panel displays the images from the Swedish House Mafia feat. Pharrell page.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-07 11:31:32
I'm using tooltip_buttons.js found in 1 of the 2 WSH threads.
How can I get the coordinates-part into the on_paint{} part?

I want this for instance:

Code: [Select]
function on_paint(gr) {

var Buttons = new Array;
Buttons[0]=new Button( 10, 80, 200, 75, {normal: images_BB + "Start_wide.png", hover: images_BB + "Start_wide.png"}, function(){blablabla}, "blablabla");
Buttons[1]=new Button( 10, 160, 200, 75, {normal: images_BB + "Start_wide.png", hover: images_BB + "Start_wide.png"}, function(){blablabla}, "blablabla");

var ChartType = 'Top2000';

var ChartType_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ ChartType + ".png");
        Buttons[0].draw(gr);
        Buttons[1].draw(gr);

}


But this doesn't seem to work.
Can anyone give me a hint?
Title: WSH Panel Mod script discussion/help
Post by: mengxk2008 on 2010-12-08 02:56:01
Hi All,

Apologies for involve everyone, I really appreciated can get someone‘s help.

I have used Tedgo’s version - DarkoneV3.01 for foobar2k, my question is How to simulate keyboard events through WSH script? There is no work for me after try to recode the Additional Buttons Panel script several times, I also search solution through internet,but...

I have make the two button point to the function(see below Additional Buttons Panel code)

Buttons.a = new Button(0, 22, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.ShowConsole();});
Buttons.b = new Button(83, 22, 58, 14, {normal: imgPath + "AddOnLeft.png", hover: imgPath + "AddOnLeftMH.png"}, function(){fb.ShowPreferences();});
Buttons.c = new Button(141, 22, 57, 14, {normal: imgPath + "AddOnRight.png", hover: imgPath + "AddOnRightMH.png"}, function(){fb.RunMainMenuCommand("Equalizer");});

Change:
fb.RunMainMenuCommand("Show Status pane") to fb.ShowPreferences()

fb.RunMainMenuCommand("Show Status bar") to fb.RunMainMenuCommand("Equalizer")

I just want them more useful to me,there is a Third-party plugins ---Autolyric(http://www.autolyric.com/index_en.htm),it can make Lyrics display on the desktop, it's very cool, I have set global shortcut keys(Alt+W) to show desktop Lyrics because I only can set it in Autolyric Preferences not foobar Preferences.

So whether button mouse click simulate the keyboard events,how to recode JS or anyway solution for that? Maybe I need to modify the WSH mod inferface, jscript, DO Global Script.js, DO Global Button Script.js, I have test and try but have no idea.

Could anyone please help me,I just want to make Darkone more and more easy-to-use.

Thanks for all, my friends.

Mejor

Tedgo has replied to me, see below, but I hope can get more help, who have better idea? or how to use the function on_key_down(vkey){}...

~tedgo 18 hours ago has replied

Its not possible to handle third-party-components within WSH Panel mod (at least to my knowledge...).

Maybe its possible when using foo_run (optional component) to execute commands via command-line, if Autolyric is able to used via commandline.
Then you could create a button in WSH Panel mod (fb.RunContextCommand("Run services/Name of your action").

I must confess that i never used keyboard shortcuts via WSH Panel mod, so maybe you should ask in the WSH Panel mod thread on hydrogenaudio. There may be a solution i don't know (or never thought about, since WSH Panel mod offers the - from me - never used possibility to disable "Safe mode" and will then have an enhanced functionality, but is probably insecure...).

There are some callbacks, though:
function on_key_down(vkey){} and function on_key_up(vkey){}
And here are the "vkeys" to be used: [link]
So you could "persuade" WSH Panel mod to use shortcuts to run foo_run.

Its the only thing i can imagine of for the moment...
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2010-12-08 22:01:27
Is it possible to change the colour of text contained in brackets, similar to how it can be done with columns ui.

$replace(%title%,']',$rgb(0,0,0),'[',$rgb(255,0,0))

The $rgb function does not work with WSH Panel Mod.

Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-10 12:59:13
Is it possible to change the colour of text contained in brackets, similar to how it can be done with columns ui.

$replace(%title%,']',$rgb(0,0,0),'[',$rgb(255,0,0))

The $rgb function does not work with WSH Panel Mod.

WSH panel mod could only translate the TF that produces strings.
If you want to change the color of a character appearing on screen, you can only use DrawString or GdiDrawText by assigning a color parameter to either of them.
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-12-11 02:51:38
When is callback on_script_unload() get called? Is it only when foobar starts?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-12-11 09:29:08
When is callback on_script_unload() get called? Is it only when foobar starts?


it's called on exit, not on start
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-11 09:33:55
When is callback on_script_unload() get called? Is it only when foobar starts?

when will the script unload?
certainly at the end of this program.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-11 10:20:35
Is there a way to declare a var only at the start of loading the panel?
If tried to use window.onload, but this gives me an error.
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-11 10:52:02
Is there a way to declare a var only at the start of loading the panel?
If tried to use window.onload, but this gives me an error.

If you DONOT change the value assigned to a variable declared at the beginning of the panel's script, the variable is unchanged.

Actually, under current non-fast mode, all the variable do not need declaring when used.

EineVariable = 2;
is equal to
var EineVariable = 2;
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-11 11:14:56
Is there a way to declare a var only at the start of loading the panel?
If tried to use window.onload, but this gives me an error.

If you DONOT change the value assigned to a variable declared at the beginning of the panel's script, the variable is unchanged.

Actually, under current non-fast mode, all the variable do not need declaring when used.

EineVariable = 2;
is equal to
var EineVariable = 2;


Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-11 11:39:44
Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.

What you want is so weird, 'cause it's exactly how a program assign its own variables.
.......

var EineVar = "Initialized";
function on_mouse_lbtn_down(x,y,mask){
fb.trace(EineVar);
EineVar  = "Changed";
fb.trace(EineVar);
}

/////////////////
//the console looks like:
//Initialized
//Changed

Is it?
BTW, window.GetProperty is much more useful and opreatable than ReadINI.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-11 12:12:14
Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.


What you want is so weird, 'cause it's exactly how a program assign its own variables.
.......

var EineVar = "Initialized";
function on_mouse_lbtn_down(x,y,mask){
fb.trace(EineVar);
EineVar  = "Changed";
fb.trace(EineVar);
}

/////////////////
//the console looks like:
//Initialized
//Changed

Is it?
BTW, window.GetProperty is much more useful and opreatable than ReadINI.


That's right.
But, I tried to use what you described dozens of times.
I use the var to determine if value a or b is used.
And that value I use to decide whether image a or image b is shown.
When instead of an image I use a text, It works.

The difference between the image and the text is,
that to show the image, I put the var in another var to declare the path to the image.
I can't lay my finger on the problem.

Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-11 12:34:25
Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.


What you want is so weird, 'cause it's exactly how a program assign its own variables.
.......

var EineVar = "Initialized";
function on_mouse_lbtn_down(x,y,mask){
fb.trace(EineVar);
EineVar  = "Changed";
fb.trace(EineVar);
}

/////////////////
//the console looks like:
//Initialized
//Changed

Is it?
BTW, window.GetProperty is much more useful and opreatable than ReadINI.


That's right.
But, I tried to use what you described dozens of times.
I use the var to determine if value a or b is used.
And that value I use to decide whether image a or image b is shown.
When instead of an image I use a text, It works.

The difference between the image and the text is,
that to show the image, I put the var in another var to declare the path to the image.
I can't lay my finger on the problem.


just tell me how did you "put the var in another var".
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-11 13:04:03
just tell me how did you "put the var in another var".

well, I put it something like this:
var c = gdi.image("path" +var a + ".png")
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-11 13:17:06
just tell me how did you "put the var in another var".

well, I put it something like this:
var c = gdi.image("path" +var a + ".png")

I got it.

"path" is a string.
//////////////////////////codes below should work
var Path = fb.FoobarPath+"skins\\boo_boo\\";
var a = "test";
var c = gdi.image(path + a + ".png");

//////////////////now, c is the object of Image.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-11 13:43:43
just tell me how did you "put the var in another var".

well, I put it something like this:
var c = gdi.image("path" +var a + ".png")

I got it.

"path" is a string.
//////////////////////////codes below should work
var Path = fb.FoobarPath+"skins\\boo_boo\\";
var a = "test";
var c = gdi.image(path + a + ".png");

//////////////////now, c is the object of Image.


Thanks so far.
gonna test it when i get home.
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2010-12-11 13:57:30
@falstaff, Neonphytismo: I intended to said exit but wrote start instead, got a hang over, but I guess that helped me get an answer faster. Thanks both of you.
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-11 14:02:22
@falstaff, Neonphytismo: I intended to said exit but wrote start instead, got a hang over, but I guess that helped me get an answer faster. Thanks both of you.


Actually, I totally have no idea about how to use this callback function...
More exactly, I have no idea about most of those functions provided....
haha.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-11 19:54:27
I got it.

"path" is a string.
//////////////////////////codes below should work
var Path = fb.FoobarPath+"skins\\boo_boo\\";
var a = "test";
var c = gdi.image(path + a + ".png");

//////////////////now, c is the object of Image.


Neonphytismo,

I tried it but I get an Invalid procedure call or argument error.
I pasted the entire code below:

Code: [Select]
var NewPlayList;
function on_size() {
    ww = window.Width;
    wh = window.Height;
var   NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", 'Playlists', 'ChartName');
}

function on_playlists_changed(){
  var  NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", 'Playlists', 'ChartName');
window.Repaint();
}

var path = fb.FoobarPath + "foo\\f003\\BB\\";
var img = gdi.Image(path + NewPlayList +".png");
function on_paint(gr) {

gr.DrawImage(img, 10, 80 , 200, 75, 0, 0, 200, 75);
}
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2010-12-12 01:12:21
Oh,no.
NEW CODE:
var ww,wh;
Code: [Select]
var NewPlayList;
function on_size() {
    ww = window.Width;
    wh = window.Height;
NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", "Playlists", "ChartName");
}

function on_playlists_changed(){
NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", "Playlists", "ChartName“);
window.Repaint();
}

var path = fb.FoobarPath + "foo\\f003\\BB\\";
//var img = gdi.Image(path + NewPlayList +".png");

function on_paint(gr) {
var img = gdi.Image(path + NewPlayList +".png");
img && gr.DrawImage(img, 10, 80 , 200, 75, 0, 0, 200, 75);
}

Is IT?
Also, I recommend to use window.GetProperty() method, and String Data Type should only be quoted by " ";
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-12 07:07:56
Also, I recommend to use window.GetProperty() method, and String Data Type should only be quoted by " ";


ok, I'm gonna look into that method, and change the quotes. Didn't know that makes a difference.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-12 10:02:34
Neonphytismo

I looked into the window.GetProperty() method,
but it doesn't completely fulfill my needs.
The addition of the var ww,wh; and the doubblequotes, did however work perfectly.
Thank You very much!
This was something what was puzzling me for weeks.
 
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-12-14 12:06:57
Hi everybody!

Could somebody tell me why this isn't working:

Code: [Select]
 

fb.RunMainMenuCommand("View/Switch to playlist/"+source_playlist_name);
fb.RunMainMenuCommand("Select All");
lista = fb.GetSelections(1);


It finds right playlist, switch to it and selects all files but fb.getSelections() still doesn't find anything (lista.Count remains 0). How could I get all files from specific playlist (or better yet, all items from media library) to MetadbHandleList with WSH Panel Mod?

EDIT:
I added "var sel_type = fb.GetSelectionType();" after mainmenu command "select all" and the result was 4 (now playing) even though all the files at the desired playlist appear selected.

EDIT2:
fb.getselections() seems to work only when selection is focused (when I click on playlist with mouse and press Ctrl+A this works)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-12-14 12:39:33
it seems that GetSelections() is not working in all callbacks  it's a shame. look at here : http://www.hydrogenaudio.org/forums/index....st&p=733756 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=733756)
Title: WSH Panel Mod script discussion/help
Post by: laite on 2010-12-14 13:39:33
it seems that GetSelections() is not working in all callbacks  it's a shame. look at here : http://www.hydrogenaudio.org/forums/index....st&p=733756 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=733756)


Thanks, I got it working. Would be nice feature though to get specific playlist as IFMetaDbHandleList with some function.
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2010-12-14 21:10:59
I have had ago at combining the Now Playing template with the Aero Seekbar template, though I have a problem and cannot get the album art to display correctly. Here is the code I am using:

Code: [Select]
// ==PREPROCESSOR==
// @name "Aero Seekbar"
// @author "marc2003"
// ==/PREPROCESSOR==

DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000

var stopped_text = "foobar2000";
var title_tf =  fb.TitleFormat("%title%");
var album_tf = fb.TitleFormat("[%album%]");
var artist_tf = fb.TitleFormat("%artist%");
var title_font = gdi.Font("Segoe UI", 30, 1);
var album_font = gdi.Font("Segoe UI", 22, 0);
var artist_font = gdi.Font("Segoe UI", 22, 0);
var title_colour = RGB(0, 255, 128);
var album_colour = RGB(0, 255, 128);
var artist_colour = RGB(0, 255, 128);
var blacklist_file = '';

var album_img = null;
var album_img_size = window.GetProperty("album_img_size", 510) - 400;

var g_font = gdi.Font("Segoe UI", 20, 1);

var g_drag = 0;
var g_drag_seek = 0;
var g_timer, txt;


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


if(fb.isplaying) on_playback_new_track();

function on_playback_stop(reason) {
    album_img && album_img.Dispose();
    g_metadb = album_img = null;
    if(reason != 2) window.Repaint();
    if(g_timer) window.KillTimer(g_timer);
    window.Repaint();
    CollectGarbage();
}

function on_playback_new_track() {
    g_metadb = fb.GetNowPlaying();
    artist = artist_tf.EvalWithMetadb(g_metadb);
    title = title_tf.EvalWithMetadb(g_metadb);
    album = album_tf.EvalWithMetadb(g_metadb);
    length = fb.TitleFormat("%length%").Eval();
    g_timer = window.CreateTimerInterval(100);
    album_img && album_img.Dispose();
    album_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
    if(!album_img) utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
}

function on_get_album_art_done(metadb, art_id, im, ip) {
    album_img = im;
    window.Repaint();
}

function on_playback_seek(time){
    window.Repaint();
}

function on_timer(id){
    window.Repaint();
}

function on_mouse_wheel(delta) {
    fb.PlaybackTime = fb.PlaybackTime + delta;
}

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

function on_paint(gr) {
    gr.FillSolidRect( 0, 0,ww, wh, RGB(0,0,0));
    if(album_img) {
        text_x = album_img_size + 10;
//        scale(gr, album_img, 0, wh-20-album_img_size, album_img_size, album_img_size);
    } else {
        text_x = 10;
    }
    if(fb.IsPlaying) {
        if(fb.PlaybackLength > 0) {
            if(g_drag){
                t = fb.PlaybackLength * g_drag_seek;
                h = Math.floor(t/3600)
                m = Math.floor((t-=h*3600)/60);
                s = Math.floor(t-=m*60);
                pos = ww * g_drag_seek;
                txt = (h > 0 ? h + ":" + (m <10 ? "0" + m : m) : m) + ":" + (s < 10 ? "0" + s : s) + " / " + length;
            } else {
                pos = ww * (fb.PlaybackTime / fb.PlaybackLength);
                txt = fb.IsPaused ? "Paused" : fb.titleformat("%playback_time%").Eval() + " / " + length;
            }
            gr.FillGradRect( 0, 0, pos, wh-1, 90, RGB(128,128,128), RGB(0,0,0));
        } else if(fb.PlaybackTime > 0.1) {
            txt = fb.IsPaused ? "Paused" : fb.titleformat("%playback_time%").Eval() + " / LIVE";
        }
        gr.GdiDrawtext(txt, g_font, RGB(0, 255, 128), 0, 0, ww-10, wh, DT_VCENTER | DT_RIGHT | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(title, title_font, title_colour, text_x, wh -127, ww-text_x-10, wh, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(album, album_font, album_colour, text_x, wh - 80, ww-text_x-10, wh, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(artist, artist_font, artist_colour, text_x, wh - 55, ww-text_x-10, wh, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
    }
    gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(137,140,149));
        

}

function on_mouse_lbtn_down(x,y){
    if(fb.IsPlaying && fb.PlaybackLength > 0) g_drag = 1;
}

function on_mouse_lbtn_up(x,y){
    if(g_drag) {
        g_drag = 0;
        g_drag_seek = x < 0 ? 0 : x > window.Width ? 1 : x / window.Width;
        fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
    }
}

function on_mouse_move(x,y){
    if(y > wh) g_drag = 0;
    if(g_drag) {
        g_drag_seek = x < 0 ? 0 : x > window.Width ? 1 : x / window.Width;
        window.Repaint();
    }
}


Line 88 is causing the problem (which is currently commented out):
Quote
scale(gr, album_img, 0, wh-20-album_img_size, album_img_size, album_img_size);


the console reports Object Expected error.

Could anyone help me out?
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2010-12-15 03:31:53
@djphatic:
Because you didn't have scale() function defined.
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2010-12-15 17:36:54
@djphatic:
Because you didn't have scale() function defined.

Thanks, appeared I was missing this line at the top:
// @import "%fb2k_path%scripts\marc2003\v2\common.js"

Now to figure out how to keep the album art on top of the seekbar instead of painting over it. - DONE!
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2010-12-15 18:30:31
Using the thumbs2 script from the templates marc2003 posted, I keep getting a crashed message every so often when it is switching images:

[18:20:14] Error: WSH Panel Mod (Thumbs2 by marc2003): Microsoft JScript runtime error:
Object required
Ln: 326, Col: 3

Line 326:    return true;

Anyone else having this issue?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-12-18 11:40:25
This doesnt appear to work for me. I have spelling correction turned off and whilst the biography details are of those it has redirected to, it doesnt display the "redirected from" text. Has this been removed from the latest samples script?

Example: Swedish House Mafia feat. Pharrell - One (Your Name)

The biography panel displays the info from the Swedish House Mafia page (http://www.last.fm/music/Swedish+House+Mafia) which when viewing in my browser states I have been redirected from Swedish House Mafia feat. Pharrell page (http://www.last.fm/music/+noredirect/Swedish+House+Mafia+feat.+Pharrell). The artist name in bold in the heading remains as Swedish House Mafia feat. Pharrell. As the thumbnails 2 panel displays the images from the Swedish House Mafia feat. Pharrell page.


i somehow fudged that. fixed version uploaded....

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

as for your error in the post above, i have no idea....
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2010-12-18 14:24:43
as for your error in the post above, i have no idea....


Updated WSH Panel Mod and it seems to be working ok now.
Title: WSH Panel Mod script discussion/help
Post by: phunkydizco on 2010-12-21 14:09:01
I have saved a PLS-File of an internet radio station and play this file in foobar. Now I want to get the path and the name of this playlist. How can I get this information?
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2010-12-22 11:10:51
Hi!

I would like to add a "save as..." command in the right-click menu in a Last.fm image viewer/downloader panel (such as marc2003's thumbs.txt or MatthijsB's foo_silk-artistart)

Can somebody help me? I can add another line in the Menu but I don't what to do after (in the additional "case")

Thanks in advance,
Decalicatan_Decalicatan
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2010-12-22 12:21:20
@Decalicatan_Decalicatan

Hi! (la compagnie créole  te salue également )

You want to save a displayed image from a WSH to disk ? i don't think there is a such method to do this in the actual version of WSH panel Mod ... afaik

bye.


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-12-22 12:55:44
with my scripts you can click the image and this will open it in a default viewer for that particular file extension. you can then "save as...". additionally, you'll find a "open containing folder" option on the context menu which will open explorer.

if you really want, you could use the CopyFile (http://msdn.microsoft.com/en-us/library/e1wf9e7w%28v=vs.85%29.aspx) method in jscript. in my scripts the path to the current image is typically stored in this variable..

Code: [Select]
arr[index]
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2010-12-22 13:49:29
ok, thank you both for your quick answer. I will try with CopyFile or else I will use the open-file-then-save-as... method
Title: WSH Panel Mod script discussion/help
Post by: sonvolt on 2010-12-23 16:12:56
Sorry posted this in wrong thread will post there please ignore this
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2010-12-23 20:41:37
Hi,

I have an issue with marc2003's Now Playing script: If I quit foobar without stopping playback (for example after using Stop after current), the next time foobar starts the now playing panel crashes:

According to the console, it seems the problem is with the on_playback_new_track() which is called by: if(fb.IsPlaying) on_playback_new_track();

Code: [Select]
Error: WSH Panel Mod ({D58A2114-2A1E-492D-A9E3-8BB5AAD5F967}): Erreur d'exécution Microsoft JScript:
'title' est indéfini.
Ln: 110, Col: 3

Thanks in advance,

Decalicatan Decalicatan
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2010-12-24 11:53:09
fixed version uploaded.

http://www.hydrogenaudio.org/forums/index....=33&t=77883 (http://www.hydrogenaudio.org/forums/index.php?act=post&do=reply_post&f=33&t=77883)

under normal circumstances the script shouldn't error but i noticed it does if foobar is set to resume playback on startup which i hadn't accounted for. doh... 
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2010-12-30 21:01:50
Is there a way to select multiple tracks and use a button to start for example
a contextmenu  action, like Tagging/Discogs... ?

I created a button for it but when I select a couple of tracks and push the button,
nothing happens.

This is a little snippet:
Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommand('Tagging/Get Tags From MusicBrainz (by TOC)');
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommand('Tagging/Discogs/Write Tags...');
    })
}


Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2011-01-07 14:10:19
Is there a way to select multiple tracks and use a button to start for example
a contextmenu  action, like Tagging/Discogs... ?

I created a button for it but when I select a couple of tracks and push the button,
nothing happens.

This is a little snippet:
Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommand('Tagging/Get Tags From MusicBrainz (by TOC)');
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommand('Tagging/Discogs/Write Tags...');
    })
}


Bump..
Title: WSH Panel Mod script discussion/help
Post by: Hitchhiker427 on 2011-01-08 11:11:21
Bump..


Try this:

Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommandWithMetadb('Tagging/Get Tags From MusicBrainz (by TOC)', fb.GetSelections());
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommandWithMetadb('Tagging/Discogs/Write Tags...', fb.GetSelections());
    })
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-08 13:25:35
samples updated.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a new script called "thumbs3". exactly the same as thumbs2 except the thumbnail strip is vertical instead of horizontal.

(http://public.blu.livefilestore.com/y1pJ0UJCJex2NcUyhYzgHy8LueH8cQh7Tlc0EwOoqtdUmPbasEwW7gz7mv3cDQCr5aFjfmFGVNTTm3GnpJlw56aBQ/thumbs3.png)
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2011-01-08 19:29:10
Bump..


Try this:

Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommandWithMetadb('Tagging/Get Tags From MusicBrainz (by TOC)', fb.GetSelections());
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommandWithMetadb('Tagging/Discogs/Write Tags...', fb.GetSelections());
    })
}



Thanks a million Hitchhiker427.
Couldn't figure this out.
It works!
Title: WSH Panel Mod script discussion/help
Post by: myvision on 2011-01-09 19:50:22
I'm a total noob on this. Just wanted to update my old foobar config and changed from WSH Panel to WSH Panel Mod but my scripts aren't running properly. My seekbar won't compile and the console says it's getting stuck at the following line:

Code: [Select]
gr.DrawImage(g_btn_img1,pos-3,7,8,8,0,0,8,8);

Think this is an easy one for you out there!

Thank you in advance!

EDIT:

Got it working!

Variable g_btn_img1 wasn't properly set, because of old components-folder!
Title: WSH Panel Mod script discussion/help
Post by: dolphi on 2011-01-15 04:15:35
there is an item "remove played tracks" in my main menu - playback. it is quite tedious to go there all the time just to have a look whether a tick is on or off right now. moreover, my main menu is hidden, so here i have some additional difficulties. checking the state of this item from context menu is more acceptable, but still it is not so convenient as it could be

is it possible to make a script that would allow me to create a button (with 2 different images for 2 states) for toggling the setting "remove played tracks"?
(i have such a script for "stop after current" and it is convenient and graphic as hell)

(i use: foo-bar 0.9.6.4; columns ui 0.3.6.4; remove played files 1.4.0; wsh panel (uie) 0.7.2; wsh panel mod 1.2.1)
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-01-15 18:33:30
there is an item "remove played tracks" in my main menu - playback. it is quite tedious to go there all the time just to have a look whether a tick is on or off right now. moreover, my main menu is hidden, so here i have some additional difficulties. checking the state of this item from context menu is more acceptable, but still it is not so convenient as it could be

is it possible to make a script that would allow me to create a button (with 2 different images for 2 states) for toggling the setting "remove played tracks"?
(i have such a script for "stop after current" and it is convenient and graphic as hell)

(i use: foo-bar 0.9.6.4; columns ui 0.3.6.4; remove played files 1.4.0; wsh panel (uie) 0.7.2; wsh panel mod 1.2.1)


This would be awesome.... You could make buttons for other functions like this as well like "Stop after current," "Playback follows cursor" etc.
Title: WSH Panel Mod script discussion/help
Post by: dolphi on 2011-01-15 18:59:11
You could make buttons for other functions like this as well like "Stop after current," "Playback follows cursor" etc.

yea, i know that it is possible to create these 3 buttons (stop after current, playback follows cursor, cursor follows playback). the point is that i never needed them at all (except for "stop after current"). i wanted to say that it would be nice to have a button for "remove played tracks" as well. unfortunately, i cannot make a script, so i would be grateful to a person who decides to write it
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-01-15 19:11:22
You could make buttons for other functions like this as well like "Stop after current," "Playback follows cursor" etc.

yea, i know that it is possible to create these 3 buttons (s


Wait, has a script already been written for these?
Title: WSH Panel Mod script discussion/help
Post by: dolphi on 2011-01-15 20:16:59
Wait, has a script already been written for these?

the possibility to make buttons for them is provided by component "foo_uie_ptb" (i have version 0.2)

so i don't know about scripts for those 2 items, but i have JScript for "stop after current" (taken from this site)
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-01-15 23:13:54
Wait, has a script already been written for these?

the possibility to make buttons for them is provided by component "foo_uie_ptb" (i have version 0.2)

so i don't know about scripts for those 2 items, but i have JScript for "stop after current" (taken from this site)


Mind directing me to that?
Title: WSH Panel Mod script discussion/help
Post by: dolphi on 2011-01-16 01:16:55
it's easier for me to post the script than to search for it. JScript for "stop after current":

Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_drag = 0;
var imgname;
var img;
function on_init(bool) {
imgname =bool ? "stop-after-current-on.png" : "stop-after-current-off.png";
img = gdi.image(fb.FoobarPath + "Images\\" + imgname);
window.Repaint();
};

on_init(fb.StopAfterCurrent);

function on_paint(gr){

gr.DrawImage(img, 0, 3, 20, 16, 0, 0, 20, 16);
}

function on_mouse_leave() {
if (g_drag==1) {

on_init(fb.StopAfterCurrent);
g_drag = 0;
}
}
function on_mouse_lbtn_up(x,y){

fb.StopAfterCurrent = !fb.StopAfterCurrent;
window.Repaint();

// g_drag = 0;
}


function on_playlist_stop_after_current_changed(state) {on_init(fb.StopAfterCurrent);}

//EOF
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-01-16 02:25:33
Hm, I'm getting a script error on that.

edit: I probably need the images, lol
Title: WSH Panel Mod script discussion/help
Post by: dolphi on 2011-01-16 04:39:08
i only have 2 very unpretentious images (both - 21x20) that i drew myself:

1) stop-after-current-off.png - contains nothing but a grey background (my aim was to draw exactly the same grey colour as we can see, for example, around standard buttons like play, pause...)

2) stop-after-current-on.png - there is merely a simple thin black cross here (thus, when i see it, i immediately understand that "stop after current" is enabled; and when i don't see this cross near to my standard buttons, it is clear that "stop after current" is disabled)
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-01-16 06:23:47
Yeah, I just made some myself... So what's preventing this sort of script from working with "remove track after playback" and the like? Would it also work with "Stop After Current Album?" Isn't it just a matter of rewriting the commands?
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2011-01-16 18:11:55
Are all usermade content for WSH Panels Mod now following the new guidelines with regards to where components and associated files should be place? I.e in the foobar2000 user profile folder.
I would hate having to put junk in c:\program files\foobar2000 again.
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2011-01-16 18:53:50
Not all I think, mine is. IMO, profile path should be used because that would be the foobar folder for portable install anyway.
Title: WSH Panel Mod script discussion/help
Post by: saivert on 2011-01-16 21:09:05
Just my mediainfo panel.
Needs Safe mode turned off I guess since it calls new ActiveXObject();
Also requires the wonderful scrollbar.js library.

Code: [Select]
// scrollbar_demo.js: totally useless and stupid demo of my scrollbar.
// written by r0lZ September 2003
//
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%\wsh_scripts\scrollbar.js"
// ==/PREPROCESSOR==

// Our own global variables

// the text that we display in the viewport
var g_text = "Shit";

//var g_font = g_dui == 1 ? window.GetFontDUI(0) : window.GetFontCUI(0);
var g_font = gdi.Font("Consolas", 12, 0);

// the bitmap that will be displayed in the viewport
var g_bitmap = null;

// flag set to true when the window size changes, as we will need to compute
// a new viewport size and redraw the bitmap.
var g_need_vp_refresh = true;


// font flags
DT_TOP = 0x00000000;
DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_BOTTOM = 0x00000008;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;


// Configuration options for the scrollbar and the viewport

// foreground color of the scrollbar (alpha supported)
var sb_fg = window.InstanceType == 1 ? window.GetColorDUI(0) : window.GetColorCUI(0);

// background color of the scrollbar (alpha supported)
var sb_bg = 0x40FFFFFF; // transluscent white background

// scroll increment, in pixels, for the scrollbar arrows, the mouse wheel and the Up/Down keys
var sb_small_inc = g_font.Height * 3;

// allow drag the viewport with the mouse?
var sb_drag_enabled = true;

// allow scroll with the mouse wheel?
var sb_mouse_wheel_enabled = true;

// allow scroll with PageUp/Down and Cursor Up/Down?
var sb_keyboard_enabled = true;

// hide the scrollbar when the whole bitmap fits in the viewport?
var sb_hide_useless_scrollbar = true;

// hide the scrollbar when the mouse is not over it?
var sb_auto_hide_scrollbar = true;

// place the scrollbar at the left side of the viewport?
var sb_scrollbar_at_left_side = false;

// draw a 1 pixel border using the sb_fg color in the viewport?
var sb_draw_border = true;



////////////////// Example code ///////////////

function on_size()
{
    // sets the flag telling that the viewport and bitmap must be reinitialized.
    g_need_vp_refresh = true;
}

function on_paint(gr)
{
    // compute the dimentions of our viewport
    var x = 2;
    var y = 2;
    var w = window.Width-4;
    var h = window.Height-4;

    // draw elements that are outside the viewport
    var bg = window.InstanceType == 1 ? window.GetColorDUI(1) : window.GetColorCUI(3);
    gr.FillSolidRect(0,0, window.Width,window.Height, bg);

    if (g_need_vp_refresh) {
        // if necessary, create the bitmap and init the viewport
        g_bitmap = draw_bitmap(x, y, w, h);
        sb_init_viewport(x, y, w, h, g_bitmap);
    }
    // paint the viewport (without the scrollbar)
    sb_paint_viewport(gr);

    // and finally, draw the scrollbar
    sb_paint_scrollbar(gr);
}

function getmediainfo(filename) {
    //var fso = new ActiveXObject("Scripting.FileSystemObject");
    var wsh = new ActiveXObject("WScript.Shell");
    var pp = "cmd.exe /C\"\"H:\\codecs and players\\mediainfo_cli\\MediaInfo.exe\" \""+filename+"\" > h:\\out.txt\"";
    //fb.trace(pp);
    var app = wsh.Run(pp, 0, 1);
    return utils.ReadTextFile("h:\\out.txt");
}

function on_selection_changed(metadb) {
    if (metadb) {
    g_text = getmediainfo(metadb.Path);
    g_need_vp_refresh = true;
    window.Repaint();
    }
}

function init() {
    var mdb = fb.GetSelection();
    if (mdb) {
        g_text = getmediainfo(mdb.Path);
        g_need_vp_refresh = true;
        window.Repaint();
    }
}

// create and draw in the bitmap
function draw_bitmap(x, y, w, h)
{
    var bg = window.InstanceType == 1 ? window.GetColorDUI(1) : window.GetColorCUI(3);
    g_need_vp_refresh = false;
    // compute the height of the bitmap that will be scrolled through the viewport
    var bitmapheight = sb_MeasureStringHeight(g_text, g_font, w)+8;
    if (bitmapheight == -1) return;
    if (bitmapheight < h) bitmapheight = h;

    // create the bitmap
    g_bitmap && g_bitmap.Dispose();
    g_bitmap = gdi.CreateImage(w, bitmapheight);

    // (the bitmap may be null when foobar starts, so we need to check it)
    if (g_bitmap) {
        // fill the bitmap with some colourful graphics
        var bitmap_gr = g_bitmap.GetGraphics();
        bitmap_gr.FillGradRect(x,y, w, bitmapheight, 0, 0xFFFFFFFF, 0xFF808080);

        bitmap_gr.DrawString(g_text, g_font, 0xFF000000, 4, 4, w-8, DT_NOPREFIX);

        // Do not forget to release the graphics!
      g_bitmap.ReleaseGraphics(bitmap_gr);
    }
    return(g_bitmap);
}

// Page Down with middle mouse button
// Demonstrates how to use sb_set_bitmap_pos() and sb_set_bitmap_pos_percent()
function on_mouse_mbtn_down(x, y, mask)
{
    if (! sb_bitmap) return;
    var curpos = sb_offset/(g_bitmap.Height-sb_vp_h);
    if (curpos > 0.999) {
        sb_set_bitmap_pos(0, 1);
    } else {
        sb_set_bitmap_pos_percent(curpos + sb_vp_h / g_bitmap.Height * 0.8, 1);
    }
}

// clean exit
function on_script_unload()
{
    g_bitmap && g_bitmap.Dispose();  // Is it really necessary?

}
init();

Scrollbar.js (put in profile folder\wsh_scripts):
Code: [Select]
// scrollbar.js v0.1
// WSH script for foobar2000, written by r0lZ, september 2010.
// Requires foobar v1.0 with WSH Panel Mod v1.3.6 or greater.
//
// Define a viewport in your WSH window and a larger bitmap.  This script generates a
// vertical scrollbar that you can draw in the viewport, and automatically scrolls the bitmap
// in the viewport according to the user actions.
// Additionnaly, the viewport can also be dragged with the mouse, and scrolled with the mouse
// wheel or the keyboard.  Horizontal scrolling is not supported.
//
//
// Functions that you should use:
//
// function sb_init_viewport(x, y, width, height, bitmap, reset_scrollbar_position)
// Initialize the internal variables.  You should call it each time you need to refresh the
// bitmap that is drawn in the viewport, or if you need to change the viewport position or size.
// The x, y, width and height parameters define the viewport window.
// The height of the viewport must be >= 30, or the slider is not drawn.
// The width of the bitmap should be identical (or greater but that's useless) than the width
// of the viewport.
// The height of the bitmap is normally greater than the height of the viewport (as otherwise
// the scrollbar is useless).
// If reset_scrollbar_position is true, the top of the bitmap will be shown.  Otherwise,
// the previous position will be kept.
// The function returns true if the bitmap is not null.
//
// function sb_paint_viewport(gr)
// Paint the viewport.  This function should be called from the on_paint() callback.
// sb_init_viewport() should have been called BEFORE this function.
//
// function sb_paint_scrollbar(gr)
// Paint the scrollbar (if it is currently visible)
// This function should be called from the on_paint() callback, after sb_paint_viewport().
//
// function sb_set_bitmap_pos(y_position, mode)
// change the Y position of the bitmap in the viewport
// y_position (in pixels): 0 = top, bitmap.Height-1 = bottom
// mode: 1=place specified bitmap position on top of the viewport,
// -1=on bottom, 0=center
// Return true if the bitmap has been moved.
//
// function sb_set_bitmap_pos_percent(y_percent, mode)
// same as sb_set_bitmap_pos(), but here the position is a float
// between 0 (top) and 1 (bottom)
//
// function sb_CenterStringHorizontally(gr, str, font, color, x, y, maxwidth, fontflags)
// Simple helper function, to draw multi-line text with word wrapping centered in the bitmap.
// It is necessary to use that function, as strings written with GdiDrawText() look horrible
// when they are drawn in a bitmap.
// The function returns the latest Y position, so you can use the return value to draw another
// string.
//
// function sb_MeasureStringHeight(str, font, maxwidth)
// This is a simple helper function that returns the height of a string to draw with the previous
// function.  It can be used to compute the height of the bitmap.
//
//
// Callback functions used by this script:
//
// Several standard callback functions are used by this script, and are therefore not available
// directly in your own script.  However, you can still use them (with some minor limitations),
// but you have to replace "on_" with "on_sb_" in the function name.  For example, if you need
// to be notified when the mouse moves, you should define the function on_sb_mouse_move(x, y)
// instead of on_mouse_move(x, y).
//
// on_sb_mouse_lbtn_down(x, y, mask)    // You will not recieve the mouse clicks on the scrollbar
//                                      // (and on the viewport if sb_drag_enabled == true)
// on_sb_mouse_lbtn_up(x, y, mask)      // No limitations
// on_sb_mouse_move(x, y)              // No limitation, except when the user scrolls the bitmap
// on_sb_mouse_leave()                  // No limitation
// on_sb_mouse_wheel(offset)            // Available only if sb_mouse_wheel_enabled == false
// on_sb_key_down(vkey)                // The Up, Down, PgUp, PgDown, Home and End keys are not
//                                      // available when sb_keyboard_enabled == true
// on_sb_timer(timerid)                // No limitations
//
// It is your responsibility to rebuild the bitmap when needed.  In most cases, it is sufficient
// to rebuild it when you have to change its content and when the WSH window size changes.
// Then, you should call sb_init_viewport().  Call sb_paint_viewport() and sb_paint_scrollbar()
// from on_paint() to draw the viewport and the slider.
//
// Notes:
//
// - The behavior of the scrollbar is determined by global variables.  See below.
//
// - All functions and global variables defined in this script begin with "sb_".
//
// - The width of the scrollbar is 16 pixels.  If you do not use the option to hide it automatically,
//  You should not draw important things in the area occupied by the scrollbar.
//
// - You can define only one viewport and scrollbar per WSH window.
//
// - Unfortunately, GdiDrawText() doesn't work well when it writes in a bitmap.  Use DrawString() or
//  the helper functions above.


////// configuration variables that you can overwrite in your script (Do not modify them here!):

// foreground color of the scrollbar (alpha supported)
var sb_fg = window.InstanceType == 1 ? window.GetColorDUI(0) : window.GetColorCUI(0);

// background color of the scrollbar (alpha supported)
var sb_bg = window.InstanceType == 1 ? window.GetColorDUI(1) : window.GetColorCUI(3);

// scroll increment, in pixels, for the scrollbar arrows, the mouse wheel and the Up/Down keys
var sb_small_inc = 40;

// allow drag the viewport with the mouse?
var sb_drag_enabled = true;

// allow scroll with the mouse wheel?
var sb_mouse_wheel_enabled = true;

// allow scroll with Up, Down, PgUp, PgDown, Home and End keys?
var sb_keyboard_enabled = true;

// hide the scrollbar when the whole bitmap fits in the viewport?
var sb_hide_useless_scrollbar = true;

// hide the scrollbar when the mouse is not over it?
var sb_auto_hide_scrollbar = true;

// place the scrollbar at the left side of the viewport?
var sb_scrollbar_at_left_side = false;

// draw a 1 pixel border using the sb_fg color in the viewport?
var sb_draw_border = false;

// if the bitmap is smaller than the viewport, center it
var sb_center_small_bitmaps = true;

////// end of configuration variables section


// Read-only global variables that you can examine.  Do NOT overwrite them directly!

var sb_bitmap = null;  // the bitmap
var sb_offset = 0;  // Height of the bitmap zone that is above the top border of the viewport.
var sb_vp_x = 0;    // Position of the viewport in the WSH window
var sb_vp_y = 0;
var sb_vp_w = window.Width;    // Size of the viewport
var sb_vp_h = window.Height;
var sb_sb_x = window.Width-16;    // X position of the scrollbar in the WSH window.


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

// Other global variables.  You should not need them.
var sb_slider_y = sb_slider_h = 0;
var sb_drag_slider = sb_drag_bitmap = false;
var sb_drag_y = sb_mouse_y = 0;
var sb_is_hidden = sb_mouse_is_outside = true;
var sb_timer = null;
var sb_timer_increment = 0;
var sb_timer_big_jumps = false;


/////////////////////// main scrollbar functions ////////////////////////

// initialize the internal variables
function sb_init_viewport(x, y, width, height, bitmap, reset_scrollbar_position)
{
    sb_bitmap = bitmap;
    sb_vp_x = x;
    sb_vp_y = y;
    sb_vp_w = width;
    sb_vp_h = height;
    if (sb_scrollbar_at_left_side) {
        sb_sb_x = sb_vp_x;
    } else {
        sb_sb_x = sb_vp_x+sb_vp_w-15;
    }
    if (sb_bitmap && (sb_bitmap.Height == 0 || sb_bitmap.Width == 0)) sb_bitmap = null;
    if (reset_scrollbar_position || ! bitmap) {
        sb_offset = 0;
    } else if (sb_offset > sb_bitmap.Height-sb_vp_h) {
        sb_offset = sb_bitmap.Height-sb_vp_h;
        if (sb_offset < 0) {
            if  (sb_center_small_bitmaps) {
                sb_offset = Math.floor(sb_offset/2);
            } else {
                sb_offset = 0;
            }
        }
    }
    return sb_bitmap ? true : false;
}

// paint the content of the viewport
function sb_paint_viewport(gr)
{
    //gr.FillSolidRect(sb_vp_x,sb_vp_y, sb_vp_w,sb_vp_h, sb_bg);
    if (sb_bitmap) {
        var x = sb_vp_x;
        var sbw = (sb_hide_useless_scrollbar && sb_bitmap.Height <= sb_vp_h) || sb_auto_hide_scrollbar ? 0:16;
        if (sb_bitmap.Width < sb_vp_w-sbw && sb_center_small_bitmaps) {
            x += Math.round((sb_vp_w-sbw - sb_bitmap.Width)/2);
        }
    gr.DrawImage(sb_bitmap, x,sb_vp_y, sb_vp_w,sb_vp_h, 0,sb_offset, sb_vp_w,sb_vp_h, 0, 255);
    }
    if (sb_draw_border) {
        gr.DrawRect(sb_vp_x,sb_vp_y, sb_vp_w-1,sb_vp_h-1, 1,sb_fg);
    }
}

// paint the scrollbar (if it is currently visible)
function sb_paint_scrollbar(gr)
{
    var arrow;
    if (!sb_bitmap || (sb_hide_useless_scrollbar && sb_bitmap.Height <= sb_vp_h) || (sb_auto_hide_scrollbar && sb_mouse_is_outside) || sb_vp_h <= 30) {
        sb_is_hidden = true;
        return;
    }
    sb_is_hidden = false;
    gr.FillSolidRect(sb_sb_x,sb_vp_y, 14,sb_vp_h, sb_bg);
    gr.DrawRect(sb_sb_x,sb_vp_y, 14,sb_vp_h-1, 1,sb_fg);
    gr.DrawLine(sb_sb_x,sb_vp_y+12, sb_sb_x+13,sb_vp_y+12, 1,sb_fg);
    gr.DrawLine(sb_sb_x,sb_vp_y+sb_vp_h-13, sb_sb_x+14,sb_vp_y+sb_vp_h-13, 1,sb_fg);
    arrow = new Array(sb_sb_x+2,sb_vp_y+9, sb_sb_x+12,sb_vp_y+9, sb_sb_x+7,sb_vp_y+3);
    gr.FillPolygon(sb_fg,0,arrow);
    arrow = new Array(sb_sb_x+3,sb_vp_y+sb_vp_h-9, sb_sb_x+12,sb_vp_y+sb_vp_h-9, sb_sb_x+7,sb_vp_y+sb_vp_h-4);
    gr.FillPolygon(sb_fg,0,arrow);
    sb_draw_slider(gr);
}

// change y position of the bitmap in the viewport
function sb_set_bitmap_pos(y_position, mode)
{
    if (!sb_bitmap) return(false);
    if (mode == -1) {
        y_position -= sb_vp_h-1;
    } else if (mode == 0) {
        y_position -= Math.round(sb_vp_h/2);
    }
    if (y_position < 0) {
        y_position = 0;
    } else if (y_position > sb_bitmap.Height-sb_vp_h) {
        y_position = sb_bitmap.Height-sb_vp_h;
    }
    if (y_position != sb_offset) {
        sb_offset = y_position;
        window.Repaint();
        return(true);
    }
    return(false);
}

// same as sb_set_bitmap_pos(), in percent
function sb_set_bitmap_pos_percent(y_percent, mode)
{
    if (!sb_bitmap) return(false);
    return(sb_set_bitmap_pos(Math.round(sb_bitmap.Height*y_percent), mode));
}

//////////////// the functions below should not be called directly

// scroll the bitmap by big increrment
function sb_big_increment(dir)
{
    if (! sb_bitmap) return;
    var incr;
    var pc_shown = sb_vp_h/sb_bitmap.Height;
    if (pc_shown >= 1) {
        return;
    } else {
        incr = dir*sb_slider_h*1/pc_shown*Math.abs(sb_vp_h/(sb_vp_h-32));
        if (incr > 0 && incr > sb_small_inc) incr -= sb_small_inc;
        if (incr < 0 && incr < sb_small_inc) incr += sb_small_inc;
        sb_increment_bitmap_pos(incr);

        sb_timer_increment = incr;
        sb_timer_big_jumps = true;
        sb_timer = window.CreateTimerTimeout(500);
    }
}

// scroll the bitmap by any number of pixels
function sb_increment_bitmap_pos(increment)
{
    if (!sb_bitmap) return(false);
    var tmp = sb_offset + Math.round(increment) * -1;
    if (tmp < 0) {
        tmp = 0;
    } else if (tmp > sb_bitmap.Height-sb_vp_h) {
        tmp = sb_bitmap.Height-sb_vp_h;
    }
    if (tmp != sb_offset) {
        sb_offset = tmp;
        window.Repaint();
        return(true);
    }
    return(false);
}

// Called when the user moves the scrollbar slider
function sb_apply_scroll(y)
{
    if (! sb_bitmap) return;
    var pc_shown = sb_vp_h/sb_bitmap.Height;
    if (pc_shown >= 1) {
        return;
    } else {
        delta = y - sb_drag_y;
        if (sb_increment_bitmap_pos(delta*-1/pc_shown*Math.abs(sb_vp_h/(sb_vp_h-32)))) {
            sb_drag_y = y;
        }
    }
}

// draw the slider in the scrollbar
function sb_draw_slider(gr)
{
    if (!sb_bitmap || sb_is_hidden || (sb_hide_useless_scrollbar && sb_bitmap.Height <= sb_vp_h)) return;
    var pc_shown, pc_offset;
    var s_max = sb_vp_h-32;

    pc_shown = sb_vp_h/sb_bitmap.Height;
    if (pc_shown >= 1) {
        pc_shown = 1;
        pc_offset = 0;
    } else {
        pc_offset = sb_offset/sb_bitmap.Height;
        if (pc_offset < 0) {pc_offset = 0};  // not necessary?
    }
    sb_slider_y = sb_vp_y + s_max * pc_offset + 14;
    sb_slider_h = s_max * pc_shown + 4;
    if (sb_vp_h > 50) {
        gr.FillSolidRect(sb_sb_x+2,sb_slider_y, 11,sb_slider_h, sb_fg);
    }
}

/////////////////////////// callbacks //////////////////////

function on_mouse_lbtn_down(x, y, mask)
{
    sb_timer && window.KillTimer(sb_timer);
    if (! sb_is_hidden && sb_bitmap && sb_bitmap.Height > sb_vp_h && x > sb_sb_x && x < sb_sb_x+15 && y > sb_vp_y && y < sb_vp_y+sb_vp_h) {
        if (y < sb_vp_y+12) {
            sb_timer_increment = sb_small_inc;
            sb_timer_big_jumps = false;
            sb_increment_bitmap_pos(sb_timer_increment);
            sb_timer = window.CreateTimerTimeout(500);
            return;
        }
        if (y >= sb_vp_y+sb_vp_h-12) {
            sb_timer_increment = sb_small_inc*-1;
            sb_timer_big_jumps = false;
            sb_increment_bitmap_pos(sb_timer_increment);
            sb_timer = window.CreateTimerTimeout(500);
            return;
        }
        if (sb_vp_h > 50) {
            if (y >= sb_slider_y && y < sb_slider_y+sb_slider_h) {
                sb_drag_slider = true;
                sb_drag_y = y;
                return;
            }
            if (y >= sb_vp_y+12 && y < sb_slider_y) {
                sb_big_increment(1);
                return;
            }
            if (y < sb_vp_y+sb_vp_h-12 && y > sb_slider_y + sb_slider_h) {
                sb_big_increment(-1);
                return;
            }
        } else {
            sb_timer_increment = sb_vp_h * -0.9;
            sb_timer_big_jumps = false;
            if (sb_offset + sb_vp_h + 1 >= sb_bitmap.Height) {
                sb_set_bitmap_pos(0, 1);
            } else {
                sb_increment_bitmap_pos(sb_timer_increment);
            }
            sb_timer = window.CreateTimerTimeout(500);
            return;
        }
    }
    if (sb_drag_enabled && x > sb_vp_x && x < sb_vp_x+sb_vp_w && y > sb_vp_y && y < sb_vp_y+sb_vp_h) {
        if (sb_bitmap && sb_bitmap.Height > sb_vp_h) {
            sb_drag_bitmap = true;
            sb_drag_y = y;
            window.SetCursor(32645);  // IDC_SIZENS
        }
        return;
    }
    // call user's callback function
    try {on_sb_mouse_lbtn_down(x, y, mask)} catch(e) {}
    return;
}

function on_mouse_lbtn_up(x, y, mask)
{
    sb_timer && window.KillTimer(sb_timer);
    sb_drag_slider = false;
    if (sb_drag_bitmap) {
        window.SetCursor(32512);    // IDC_ARROW
        sb_drag_bitmap = false;
    }
    try {on_sb_mouse_lbtn_up(x, y, mask)} catch(e) {}
}

function on_mouse_move(x, y)
{
    sb_mouse_y = y;
    if (sb_drag_slider) {
        sb_apply_scroll(y);
        return;
    }
    if (sb_drag_bitmap) {
        sb_increment_bitmap_pos(y - sb_drag_y);
        sb_drag_y = y;
        return;
    }
    if (sb_is_hidden && sb_auto_hide_scrollbar && sb_bitmap && sb_bitmap.Height > sb_vp_h && x >= sb_sb_x && x <= sb_sb_x+15 && y >= sb_vp_y && y <= sb_vp_y+sb_vp_h) {
        window.Repaint();
        sb_mouse_is_outside = false;
    }
    try {on_sb_mouse_move(x, y)} catch(e) {}
}

function on_mouse_leave()
{
    if (! sb_is_hidden && sb_auto_hide_scrollbar) {
        window.Repaint();
    }
    sb_mouse_is_outside = true;
    try {on_sb_mouse_leave()} catch(e) {}
}

function on_mouse_wheel(offset)
{
    if (sb_mouse_wheel_enabled && sb_bitmap && sb_bitmap.Height > sb_vp_h) {
        sb_increment_bitmap_pos(offset*sb_small_inc);
    } else {
        try {on_sb_mouse_wheel(offset)} catch(e) {}
    }
}

function on_key_down(vkey)
{
    if (sb_keyboard_enabled && sb_bitmap && sb_bitmap.Height > sb_vp_h) {
        switch(vkey) {
            case 33:
                // PgUp
                sb_big_increment(1);
                break;
            case 34:
                // PgDn
                sb_big_increment(-1);
                break;
            case 35:
                // End
                sb_increment_bitmap_pos(sb_bitmap.Height*-1);
                break;
            case 36:
                // Home
                sb_increment_bitmap_pos(sb_bitmap.Height);
                break;
            case 38:
                // Up
                sb_increment_bitmap_pos(sb_small_inc);
                break;
            case 40:
                // Down
                sb_increment_bitmap_pos(sb_small_inc*-1);
                break;
        }
        return;
    }
    try {on_sb_key_down(vkey)} catch(e) {}
}

function on_timer(timerid)
{
    if (sb_timer && timerid == sb_timer.ID) {
        sb_timer && window.KillTimer(sb_timer);
        if (sb_timer_big_jumps && sb_mouse_y >= sb_slider_y && sb_mouse_y < sb_slider_y+sb_slider_h) return;
        if (sb_increment_bitmap_pos(sb_timer_increment)) {
            sb_timer = window.CreateTimerTimeout(100);
        }
        return;
    }
    try {on_sb_timer(timerid)} catch(e) {}
}


//////////////////////////// helper functions ///////////////////////////////
// These functions are not necessary for the scrollbar.  You can remove them.

// Draw multi-line text with word wrapping centered in the bitmap.
function sb_CenterStringHorizontally(gr, str, font, color, x, y, maxwidth, fontflags)
{
    if (window.Height == 0) return(-1);  // safety check: foobar enters in an infinite loop if bitmap.GetGraphics() is called when foobar is initializing.
    var i, j, xpos, ypos, arr2;
    var arr1 = str.split("\n");
    ypos = y;
    for (i=0; i<arr1.length; i++) {
        arr2 = gr.EstimateLineWrap(arr1[i], font, maxwidth).toArray();
        for (j=0; j<arr2.length; j+=2) {
            xpos = x+(maxwidth-arr2[j+1])/2;
            gr.DrawString(arr2[j], font, color, xpos, ypos, maxwidth, font.Height+50, fontflags);
            ypos = ypos + font.Height;
        }
    }
    return(ypos);
}

// Returns the height of a string to draw with the previous function.
function sb_MeasureStringHeight(str, font, maxwidth)
{
    var temp_bmp = gdi.CreateImage(1, 1);
    var temp_gr = temp_bmp.GetGraphics();

    var i, arr2;
    var arr1 = str.split("\n");
    var h = 0;

    for (i=0; i<arr1.length; i++) {
        arr2 = temp_gr.EstimateLineWrap(arr1[i], font, maxwidth).toArray();
        h = h + font.Height*arr2.length/2;
    }

    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();

    return(h);
}


Too bad using wsh.Exec() shows the console dialog when running console applications and wanting to capture the output.
So the solution is to use wsh.Run() with cmd.exe to redirect the output to a temporary text file which you can then read with utils.ReadTextFile()
I struggled with getting this to work because cmd.exe requries a lot of quoting for the > character to be parsed correctly.
So I ended up with this:
cmd.exe /C""H:\codecs and players\mediainfo_cli\MediaInfo.exe" "E:\music\Above & Beyond - Trance Around The World\Above & Beyond - Trance Around the World 353 (2010-12-31).mka" > h:\out.txt"

as you can see the entire string after /C is quoted. then you got quotes for the long filenames. When escaped for use in javascript it looks even worse:
Code: [Select]
var pp = "cmd.exe /C\"\"H:\\codecs and players\\mediainfo_cli\\MediaInfo.exe\" \""+filename+"\" > h:\\out.txt\"";
No wonder it is so easy to get tripped up here.

Someone ought to have made this simpler to do. Basically what I'm requesting is for a function in WSH panels mod that lets you run and capture output of console apps without this ugly code.

Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-01-19 17:31:45
Hi!

I'm trying to create a very simple button to toggle on/off  the Stop after Album function of the... Stop after album component http://www.hydrogenaudio.org/forums/index....c=83743&hl= (http://www.hydrogenaudio.org/forums/index.php?showtopic=83743&hl=)

I can toggle the value with
Code: [Select]
fb.RunMainMenuCommand("Control/Stop after album");

But how to access its value (which should be 0 or 1) ? I would like to change the state of the button depending of its value (if it's on, do blablabla, ... if it's off, do blablabla)


Thanks in advance for your help,

Decalicatan Decalicatan
Title: WSH Panel Mod script discussion/help
Post by: arabeh on 2011-01-19 17:55:20
hi everyone!
I'm really bad at scripting. just wanted to ask, can i get this panel to show cover art dimensions?? (if not, any alternative solution will be really appreciated)
Title: WSH Panel Mod script discussion/help
Post by: ilvmudkips on 2011-01-19 22:27:23
samples updated.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

contains a new script called "thumbs3". exactly the same as thumbs2 except the thumbnail strip is vertical instead of horizontal.

(http://public.blu.livefilestore.com/y1pJ0UJCJex2NcUyhYzgHy8LueH8cQh7Tlc0EwOoqtdUmPbasEwW7gz7mv3cDQCr5aFjfmFGVNTTm3GnpJlw56aBQ/thumbs3.png)

I have a few quick questions about your layout, I'd be glad if you answered them.
Is that tab stack on top made directly on WSH? I'm assuming since the toolbar looks like it was. Oh, and it looks awesome, by the way. And the Last.fm stuff was put on a Panel Stack, right? And is that tab stack a regular tab stack containing WSH panels?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-19 22:42:33
But how to access its value (which should be 0 or 1) ? I would like to change the state of the button depending of its value (if it's on, do blablabla, ... if it's off, do blablabla)


i'm guessing that would require an SDK for the component to be opened up and then included in WSH panel mod. in short, not likely...

can i get this panel to show cover art dimensions?? (if not, any alternative solution will be really appreciated)


yup, what ever variable contains your image, you can get dimensions like this...

my_img.height
my_img.width

Is that tab stack on top made directly on WSH? I'm assuming since the toolbar looks like it was. Oh, and it looks awesome, by the way. And the Last.fm stuff was put on a Panel Stack, right? And is that tab stack a regular tab stack containing WSH panels?


nope, the top "tabs" are buttons in Panel Stack Splitter. and yup, the WSH panels are in a standard tab stack (inside a parent PSS with a 10px margin around the edge).
Title: WSH Panel Mod script discussion/help
Post by: ilvmudkips on 2011-01-19 23:24:55
Is that tab stack on top made directly on WSH? I'm assuming since the toolbar looks like it was. Oh, and it looks awesome, by the way. And the Last.fm stuff was put on a Panel Stack, right? And is that tab stack a regular tab stack containing WSH panels?


nope, the top "tabs" are buttons in Panel Stack Splitter. and yup, the WSH panels are in a standard tab stack (inside a parent PSS with a 10px margin around the edge).

Thanks for the reply. Buttons... I got Panel Stack today, I'm still playing with this a little bit.
Would you mind showing me the Library tab? I'm kinda curious to see what have you done with it since I really liked your previous designs.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-19 23:41:48
erm ok. click (http://k5sbdw.blu.livefilestore.com/y1p4PSJwc8jsYXCwuSvXDieK7b1TZHMh1KCPXWUZAXOfYbbU9gtDeqzcCB_oDlkBDi8fMl1Ugid7B9drvHc0PJescQ4drXNw9ni/library%20tab.png)
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-01-20 08:44:44
i'm guessing that would require an SDK for the component to be opened up and then included in WSH panel mod. in short, not likely...


Thank you for your answer. I was afraid of something like that. I guess I will try to create my own "stop after album" WSH panel mod script from scratch.

Decalicatan Decalicatan
Title: WSH Panel Mod script discussion/help
Post by: arabeh on 2011-01-20 10:02:56
can i get this panel to show cover art dimensions?? (if not, any alternative solution will be really appreciated)

yup, what ever variable contains your image, you can get dimensions like this...
my_img.height
my_img.width

thx! jscript seems can do many things... must learn!)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-20 10:11:18
must learn!


a good place to start is the documentation that comes with the component. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-20 10:32:47
Are all usermade content for WSH Panels Mod now following the new guidelines with regards to where components and associated files should be place? I.e in the foobar2000 user profile folder.
I would hate having to put junk in c:\program files\foobar2000 again.


good point. i've decided to move all my shared files in to the profile folder.

samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

Title: WSH Panel Mod script discussion/help
Post by: ilvmudkips on 2011-01-20 12:06:05
erm ok. click (http://k5sbdw.blu.livefilestore.com/y1p4PSJwc8jsYXCwuSvXDieK7b1TZHMh1KCPXWUZAXOfYbbU9gtDeqzcCB_oDlkBDi8fMl1Ugid7B9drvHc0PJescQ4drXNw9ni/library%20tab.png)

Dude, what the fuck is wrong with the goddamn buttons? Every time I change something on them, foobar resets their parent Panel Stack and, well, its configuration on the grandparent Panel Stack too. Also, I can't have more than one button when its custom image isn't a square, right?

I know this isn't the thread but how can I change a Panel Stack border edge to grey, sunken and etc?
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-01-20 14:12:35
i'm guessing that would require an SDK for the component to be opened up and then included in WSH panel mod. in short, not likely...

Thank you for your answer. I was afraid of something like that. I guess I will try to create my own "stop after album" WSH panel mod script from scratch.

Decalicatan Decalicatan


Okey dokey this is it a basic "Stop after album" script. It is just a simple button (width 126; height 20) that can toggle on/off  the Stop After Current function for when the playback reach the last track of an album (that is when %tracknumber% = %totaltracks%)

If totaltracks is not defined it doesn't work.

As my skills in jscript are very low (I "learn" it trying to understand other people scripts) it must be written badly but it works.

If someone wants to modify it, feel free to do it but please post the modifed script here.

http://pastebin.com/K391Ksym (http://pastebin.com/K391Ksym)

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\marc2003\v2\common.js"
// @name "Stop After Album v.1.0"
// @author "Decalicatan Decalicatan"
// ==/PREPROCESSOR==


// width: 126
// height: 20

var tracknumber_tf = fb.TitleFormat("%tracknumber%");
var totaltracks_tf = fb.TitleFormat("[%totaltracks%]");
var totaltracks, tracknumber;


var SAA = "Stop after album";
var SAA_state = 0;
var font = gdi.Font("Calibri", 16, 1);
var hover = 0;





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


function on_mouse_move() {
    if (fb.IsPlaying) {
        g_metadb = fb.GetNowPlaying();
        totaltracks = totaltracks_tf.EvalWithMetadb(g_metadb);
        if (totaltracks == 0) {
            hover = 0;
        } else {
            hover = 1;
            window.Repaint();
        }
    } else hover = 1;
}


function on_mouse_leave() {
    hover = 0;
    window.Repaint();
}


function StringFormat(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 on_playlist_stop_after_current_changed(new_order_index) {
    window.Repaint();
}

function on_playback_stop(reason) {
    g_metadb = null;
    SAA_state = 0;
    if (reason != 2) window.Repaint();
}




function on_mouse_lbtn_down(x, y) {
    g_metadb = fb.GetNowPlaying();
    tracknumber = tracknumber_tf.EvalWithMetadb(g_metadb);
    if (fb.StopAfterCurrent) fb.StopAfterCurrent = 0;
    if (SAA_state !== 0) {
        SAA_state = 0;
    } else {
        SAA_state = totaltracks_tf.EvalWithMetadb(g_metadb);
        if (tracknumber == SAA_state) fb.StopAfterCurrent = 1;
    }
}



function on_playback_new_track() {
    if (SAA_state !== 0) {
        g_metadb = fb.GetNowPlaying();
        tracknumber = tracknumber_tf.EvalWithMetadb(g_metadb);
        if (tracknumber == SAA_state) fb.StopAfterCurrent = 1;
    }
}




function on_paint(gr) {
    var ww = window.Width;
    var wh = window.Height;
    totaltracks = fb.TitleFormat("[%totaltracks%]").Eval();
    tracknumber = fb.TitleFormat("[%tracknumber%]").Eval();
    if (((fb.StopAfterCurrent) && (SAA_state != tracknumber)) || ((!fb.StopAfterCurrent) && (SAA_state == tracknumber))) SAA_state = 0;
    if (hover == 0) {
        gr.FillSolidRect(0, 0, ww, wh, RGB(255, 255, 255));
        if (totaltracks == 0) {
            gr.GdiDrawText(SAA, font, RGB(205, 205, 205), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        } else {

            if (SAA_state) {
                gr.GdiDrawText(SAA, font, RGB(0, 128, 192), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
            } else {
                gr.GdiDrawText(SAA, font, RGB(105, 105, 105), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
            }
        }
    } else {
        gr.FillSolidRect(0, 0, ww, wh, RGB(0, 128, 192));
        gr.GdiDrawText(SAA, font, RGB(255, 255, 255), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
    }


}

Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-01-22 16:29:42
@ marc2003

In your last revision of samples.zip, the folder marc2003\images\2010 is missing and so is the small lastfm.png icon for the Similar Artist script

Decalicatan Decalicatan
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-22 16:46:17
oops. i was tidying up unused files and got a bit carried away. thanks for spotting that one. it should be fixed now.

Title: WSH Panel Mod script discussion/help
Post by: thuan on 2011-01-23 02:55:16
Anyone knows how to implement network connection timeout inside wsh panels with activexcontrol Microsoft.XMLHTTP (last.fm was literally down for two previous days and taking forever to respond)? I've been trying to search for a solution to this problem but to no avail. I know of an alternative by using wget, but I don't want to go that way unless there's no other way. Any help is appreciated.
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2011-01-24 08:16:31
Managed to implement network timeout with ServerXMLHTTP ActiveX component. Not the recommended way as this component is supposed to work on server not client. Side effect is user have to enter proxy settings manually if they are behind a proxy (well they did have to do this for wget anyway).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-24 18:06:29
if a user has proxy settings set in IE, couldn't you read it from the registry using WshShell.RegRead?
Title: WSH Panel Mod script discussion/help
Post by: ilvmudkips on 2011-01-24 18:11:23
Does anyone have a good Last.fm love track script, one that doesn't require that SoftPlaylist component? It seems doable on the API, since the scrobbler I got on my Symbian phone has it and it works smoothly.
That would be much appreciated.
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2011-01-24 18:38:00
Mine have love feature, inside playing track info panel (the actual code is inside the bio panel though). You can get them here (http://www.hydrogenaudio.org/forums/index.php?showtopic=84592). Beware that I will soon update the pack though, tomorrow or the day after.

@Marc: thanks will do that, but that's only half way as I can't find where to read the authentication information in case the proxy server require it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-26 17:15:02
samples updated:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

just a couple of minor changes.

simple biography -added arrows to indicate when there is more content that can fit in the panel. clicking them will scroll the text but using your mouse wheel is still the best way.

similar artists - added context menu option to remove artist name from the title (i recently added my biography panel and this panel into the same tab and i thought it looked stupid having the artist name displayed twice next to each other). i also squished a little bug where clicking on a blank area below the content would launch a browser/spotify for artists that you can't see on screen.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-27 23:29:05
samples updated. link in the above post.

new script: cd jewel case.

(http://k5sbdw.blu.livefilestore.com/y1pMKDsCtSCgCTRT6lTAy7ndm_jZzSN3z_ruM7J3JJFoLmMY3uD33FP41jimkDz0N1QL3U1c1Mcvtfd4h-0CHQISY_NYxptpLaZ/cd.png)

it displays the front cover according to your foobar display preferences. the size is fixed and it will be centered regardless of how big the panel is. background colour will be dictated by your CUI/DUI colour settings. double click the panel and it opens the image in your default viewer (or locate the music file in explorer if it's embedded)
Title: WSH Panel Mod script discussion/help
Post by: PrimulaRosea on 2011-01-29 11:36:49
Code: [Select]
WSH Panel Mod (CD Jewel Case by marc2003): Parsing file "T:\PortableApps\foobar2000 - all\\marc2003\common.js": Failed to load
Error: WSH Panel Mod (CD Jewel Case by marc2003): Microsoft JScript runtime error:
Object expected
Ln: 9, Col: 1
<source text only available in compile time>

did i miss something? i did copied your script folder...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-29 11:50:56
edit: if you saw my previous post, ignore it.

are you absolutely sure the "marc2003" folder is in the correct place? i don't think it is....

edit2: samples updated. i just tidied up the pre-processor stuff so it doesn't display 2 backslashes in the console output like the example above.

"T:\PortableApps\foobar2000 - all\\marc2003\common.js" <<bad
"T:\PortableApps\foobar2000 - all\marc2003\common.js" << good

luckily it had no effect over it working.. 
Title: WSH Panel Mod script discussion/help
Post by: PrimulaRosea on 2011-01-29 15:12:59
ah yeah, didnt saw your previous post lol
it's working now, thanks D:
Title: WSH Panel Mod script discussion/help
Post by: AEcid on 2011-01-31 18:11:59
i've got a problem with the now playing panel in default ui

it crashes when i want to load. here is the console log:

Error: WSH Panel Mod (Now Playing by marc2003): Laufzeitfehler in Microsoft JScript: (means runtime error)
Objekt erforderlich (means object required)
Ln: 307, Col: 2
<source text only available at compile time>
WSH Panel Mod: Warning: Could not load file C:\Users\Hannes\AppData\Roaming\foobar2000\user-components\foo_uie_wsh_panel_mod\jscript.api
WSH Panel Mod: Warning: Could not load file C:\Users\Hannes\AppData\Roaming\foobar2000\user-components\foo_uie_wsh_panel_mod\interface.api
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-31 18:23:40
oops, my house cleaning of old images has come back to bite me again.

change line 119 from

Code: [Select]
scale(gr, gdi.Image(images_path + "foobar.png"), 0, 0, ww, wh - 130, "min");


to

Code: [Select]
scale(gr, gdi.Image(images_path + "new foo.png"), 0, 0, ww, wh - 130, "min");


edit: fixed version uploaded also.
Title: WSH Panel Mod script discussion/help
Post by: AEcid on 2011-01-31 18:48:14
thanks, mate


btw, what do i have to change, if i want to display the playback time and length next to the title, for example: title - 0:34/3:44 ?

would be very cool if you post the lines
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-01-31 19:02:32
replace the script with this....

http://pastebin.com/T3gMhSVu (http://pastebin.com/T3gMhSVu)
Title: WSH Panel Mod script discussion/help
Post by: AEcid on 2011-01-31 19:04:35
replace the script with this....

http://pastebin.com/T3gMhSVu (http://pastebin.com/T3gMhSVu)



awesome
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-01 01:12:53
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

lastfm charts: fix last.fm radio buttons not working after other changes made last week. 
similar artists: added option to pause playback when launching spotify.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-02-03 18:14:55
WSH Tree Panel 1.0

(http://img14.imageshack.us/img14/7325/tree5.th.png) (http://img14.imageshack.us/i/tree5.png/)

Get the script from my DeviantArt account : http://br3tt.deviantart.com/art/WSH-Tree-E...r-1-0-196023730 (http://br3tt.deviantart.com/art/WSH-Tree-Explorer-1-0-196023730)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-03 18:44:19
ampersands (&) don't show in folder/file names. you can fix this by using the DT_NOPREFIX flag.

i like how you've drawn all the images in the script. nice work.

edit: using the "send found tracks to playlist and play" option doesn't appear to work?? the files get added but it doesn't play.

edit2: i've realised this is due to me setting enqueue as the default action under "shell integration" in the preferences.
Title: WSH Panel Mod script discussion/help
Post by: PrimulaRosea on 2011-02-03 18:47:50
nice one Falstaff!!
this is one feature from mediamonkey that i hope exist in foobar2k and you brought that to us, thank you!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-02-03 19:35:34
ampersands (&) don't show in folder/file names. you can fix this by using the DT_NOPREFIX flag.


thanx for the reporting, i'll fix it  Edit: done

nice one Falstaff!!
this is one feature from mediamonkey that i hope exist in foobar2k and you brought that to us, thank you!


thank you
Title: WSH Panel Mod script discussion/help
Post by: burn416 on 2011-02-06 01:28:50
Hi, I have a few questions about scripting in jscript

I dont know if this is possible, but, is there a function that is called automatically when the panel starts?

Is is possible to draw a rounded rectangle that is filled with a gradient?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-06 04:00:34
1) you can create your own function and then call it like this...

Code: [Select]
function my_func() {
//blah
}

my_func();


2) i think you'll just have to bodge it by drawing a few rounded rectangles inside each other slowly changing the colours.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-02-06 09:37:05
2) there is another solution : use a round rectangle as a Mask, draw a gradient rectangle and apply the mask on it to obtain the gradient-round-rectangle wanted ...

here is a function that do the job:

Code: [Select]
function FillGradientRoundRect(gr, x, y, w, h, arc_width, arc_height, gradient_angle, bg_colour1, bg_colour2, focus) {
    // drawing the Mask
    var Mask_img = gdi.CreateImage(w+1, h+1);
    var gb = Mask_img.GetGraphics();
    gb.FillSolidRect(0,0,w,h,0xffffffff);
    gb.SetSmoothingMode(2);
    gb.FillRoundRect(0, 0, w-2, h-2, arc_width, arc_height, 0xff000000);
    Mask_img.ReleaseGraphics(gb);
    // drawing the gradient rect
    var GradientRect_img = gdi.CreateImage(w+1, h+1);
    gb = GradientRect_img.GetGraphics();
    gb.FillGradRect(0, 0, w-2, h-2, gradient_angle, bg_colour1, bg_colour2, focus);
    GradientRect_img.ReleaseGraphics(gb);
    // resizing and applying the mask
    var Mask = Mask_img.Resize(w+1, h+1);
    GradientRect_img.ApplyMask(Mask);
    Mask.Dispose();
    // drawing the resulting image
    gr.DrawImage(GradientRect_img, x, y, w-1, h-1, 0, 0, w, h, 0, 255);
}

and this is an example of call to use in on_paint:

Code: [Select]
function on_paint(gr) {
    FillGradientRoundRect(gr, 10, 10, 100, 60, 15, 15, 90, 0xffeeee22, 0xffff5533, 1.0);
}

... and the result is like this in a panel

(http://img232.imageshack.us/img232/1271/roundgradrect.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-06 13:46:31
^nice. i really should spend some time learning that stuff. 

samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

last.fm charts now uses a fluid layout so it can fit in narrower panels.
Title: WSH Panel Mod script discussion/help
Post by: burn416 on 2011-02-06 22:22:59
Wow thanks! I'm not a coder, and just kinda bs my way through code, so I'm sure I'll be back to ask more questions about that.

Im assuming that drawing images in the manner falstaff showed is more efficient than importing a picture of the image through DrawImage() right?
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2011-02-07 16:50:06
@ marc2003, is it possible to add a scroll bar to you "simple biography" panel? removing the up and down arrows...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-07 16:57:16
i've thought about it in the past but i'm just too lazy.    i just use my mouse wheel to scroll. i only added the arrows to indicate there is more content.

if you want proper scrollbars, you could use the full blown "biography view" component: http://foo2k.chottu.net/#bv (http://foo2k.chottu.net/#bv)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-08 22:31:02
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

last.fm charts: bugfix. i must not assume last.fm will always return data in a format that i expect.
Title: WSH Panel Mod script discussion/help
Post by: burn416 on 2011-02-09 19:15:45
How can I access the main menu, and the right click menu or songs now playing, and highlighted songs?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-09 19:35:19
check the samples on the component home page.

edit: "MainMenuManager All-In-One.txt" is what you want.
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2011-02-10 20:15:02
WSH Tree Panel 1.0

Get the script from my DeviantArt account : http://br3tt.deviantart.com/art/WSH-Tree-E...r-1-0-196023730 (http://br3tt.deviantart.com/art/WSH-Tree-Explorer-1-0-196023730)


Do you plan an option for changing the background color?
I'm using DUI and would like to change the background to black.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-02-10 21:02:25
WSH Tree Panel 1.0

Get the script from my DeviantArt account : http://br3tt.deviantart.com/art/WSH-Tree-E...r-1-0-196023730 (http://br3tt.deviantart.com/art/WSH-Tree-Explorer-1-0-196023730)


Do you plan an option for changing the background color?
I'm using DUI and would like to change the background to black.


no option for a so easy thing to add, just add this line in the on_paint() function, with the desired colour : gr.FillSolidRect(0,0,ww,wh, <your back ground colour> );

example with a black background (RGB values : 0,0,0) :

function on_paint(gr) {
    gr.FillSolidRect(0,0,ww,wh,RGB(0, 0, 0));
    if(cline_counter==0 && !c_drag) {
        scan_expanded(null, root, false);
    }
... etc
Title: WSH Panel Mod script discussion/help
Post by: Gapkiller on 2011-02-10 22:10:56
Thanks
Title: WSH Panel Mod script discussion/help
Post by: burn416 on 2011-02-11 20:05:07
Whoops I didn't explain my self clearly.

I meant to ask if there was a way to execute certain commands found within the foobar menus, from WSH panel. For example, can I create a button within WSH that executes the "fullscreen" option under the View menu, or execute the "Scan per file track gain" under the ReplayGain options found when I right click a song?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-15 00:54:23
^look at fb.RunMainMenuCommand and fb.RunContextCommandWithMetadb.

samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

as foo_lastfm_radio now looks defunct, i've removed the options to launch it from the following scripts:

simple biography
lastfm charts
similar artists (this still has spotify links but you can remove them using the context menu if it's not available in your region)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-19 02:21:07
looks like my previous post was a little premature - last.fm radio is working again. the old scripts have been restored:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-02-20 23:24:38
foo_lastfm_radio is not working properly with these last.fm components created by marco. When i click the play button close to an artist name (weather in "Similar artists" or "Lastfm charts" panel), i get this error:
"Unable to launch last.fm radio! Make sure foo_lastfm_radio is installed and that you have set your username and password in the preferences. Also, check foobar is set as the default handler for the lastfm:// protocol. Use the "Set program association" tool found under File>Preferences>Shell Integration."

I have entered my username and password on foo_lastfm, and i have associated lastfm with foobar under "shell integration". Foo_lastfm is still working great when creating custom stations, but not with these components. Does anyone know a fix? Maybe i should make some changes in the script itself (such as entering my last.fm username and/or removing spotify entries)?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-21 00:03:17
as i mentioned in the other thread, i have no idea why it isn't working. all it's doing is launching foo_lastfm_radio like an external application. it's no different than you using start>run manually like this....

lastfm://artist/madonna/similarartists

what happens if you try that?

edit: i've updated the error message so it isn't so confusing. the component has it's own username/password checking/error dialog so i've removed the reference to that. i can also detect if the component is installed so all it says now is to check the file type associations.

edit2: i don't suppose you're running windows XP? at first glance, the file associations tool for the lastfm:// protocol doesn't appear to work properly.
Title: WSH Panel Mod script discussion/help
Post by: Triple Sick on 2011-02-21 00:40:37
Can someone make a script to display lyrics in a panel?

Also, there are no install instructions for the WSH Panel Mod, so I'm assuming I just had to install the .dll and everything else was there for no reason.
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-02-21 01:47:17
as i mentioned in the other thread, i have no idea why it isn't working. all it's doing is launching foo_lastfm_radio like an external application. it's no different than you using start>run manually like this....

lastfm://artist/madonna/similarartists

what happens if you try that?

edit: i've updated the error message so it isn't so confusing. the component has it's own username/password checking/error dialog so i've removed the reference to that. i can also detect if the component is installed so all it says now is to check the file type associations.

edit2: i don't suppose you're running windows XP? at first glance, the file associations tool for the lastfm:// protocol doesn't appear to work properly.


I am running windows xp. And i am not sure how can i run "lastfm://artist/madonna/similarartists" from inside foobar.
Thanks for helping

edit: if by "lastfm://artist/madonna/similarartists" you mean right clicking in a madonna song/Last.fm Radio/Open Madonnas Station..., this always creates a playlist automatically and everything works properly in the playlist.
Also under "Preferences/Shell integration/ File types" there is only one last.fm entry (extension:lastfm, description:Last.fm radio) and that one is ticked.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-21 02:28:12
Quote
it's no different than you using start>run manually like this....


i meant the windows start button.

anyway, it doesn't matter now. i've tested it myself on XP properly and the file association thing doesn't work at all (that's either a foobar or component problem i can't do anything about)

but you can edit the script and make it work. in last.fm charts.txt on line 194, it starts like this....

Code: [Select]
try { WshShell.run("lastfm://artist/"..........


just change it so it begins like this....

Code: [Select]
try { WshShell.run("foobar2000.exe lastfm://artist/"..................
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-02-21 10:49:06
It works PERFECTLY. Thanks a lot! 
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-02-21 11:15:52
I also wanted to ask you if there is a possibility to add Wikipedia and Rateyourmusic buttons to the script "web links" (found in your package)?
Title: WSH Panel Mod script discussion/help
Post by: thi3nki3p on 2011-02-21 14:59:53
Could someone write a script to display artworks and automatically cycle between front/back/disc/artist.
The old foo_uie_albumart did that but it's not DUI and crashs pretty bad.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2011-02-21 20:05:32
Could someone write a script to display artworks and automatically cycle between front/back/disc/artist.
The old foo_uie_albumart did that but it's not DUI and crashs pretty bad.



Take a look to my fooAero (http://browse.deviantart.com/customization/skins/media/foobar2000/?order=5&offset=24#/d30x7y5) cover panel script 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-22 00:23:44
I also wanted to ask you if there is a possibility to add Wikipedia and Rateyourmusic buttons to the script "web links" (found in your package)?


here's the script for it but you'll need to find/make your own images. (a standard image and a "hover" image)

http://pastebin.com/78JiqwtW (http://pastebin.com/78JiqwtW)

take note of the filenames and they should go inside.

%appdata%\foobar2000\marc2003\images
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2011-02-22 02:03:45
Could someone write a script to display artworks and automatically cycle between front/back/disc/artist.
The old foo_uie_albumart did that but it's not DUI and crashs pretty bad.

Or try this http://ashiato1.blog62.fc2.com/blog-entry-40.html (http://ashiato1.blog62.fc2.com/blog-entry-40.html) if you can make it work.
Title: WSH Panel Mod script discussion/help
Post by: thi3nki3p on 2011-02-22 07:35:34
Exactly what I was looking for. Thank a lot!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-23 21:51:04
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

autoplaylists.txt

i've made a new panel for storing autoplaylists as favourites. some people don't like having them active all the time so this allows you to store them using nice names. you can of course edit the names, queries and sort patterns after they've been created.

(name and query are required. you can leave the sort dialog blank if you want)



known issues:

-there is no scroll function so you're limited to the size of your panel for how many favourites you can see. i'll probably fix this at a later date.
-there is no confirmation when deleting.
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-02-23 21:56:20
I also wanted to ask you if there is a possibility to add Wikipedia and Rateyourmusic buttons to the script "web links" (found in your package)?


here's the script for it but you'll need to find/make your own images. (a standard image and a "hover" image)

http://pastebin.com/78JiqwtW (http://pastebin.com/78JiqwtW)

take note of the filenames and they should go inside.

%appdata%\foobar2000\marc2003\images

Thank You again and again!
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-02-23 22:52:15
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

autoplaylists.txt

i've made a new panel for storing autoplaylists as favourites. some people don't like having them active all the time so this allows you to store them using nice names. you can of course edit the names, queries and sort patterns after they've been created.

(name and query are required. you can leave the sort dialog blank if you want)



known issues:

-there is no scroll function so you're limited to the size of your panel for how many favourites you can see. i'll probably fix this at a later date.
-there is no confirmation when deleting.


Continually getting errors on this script, Marc:

Named: Loved Tracks
Query: LASTFM_LOVED IS 1
Sort: none


gives me a script error as soon as I try to execute playlist
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-23 22:58:49
if there's a script error, can you post what the console says?

also, you need %LASTFM_LOVED% IS 1 - not that it should crash with an invalid query, you just get blank results. well mine does anyway...

Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-02-23 23:06:46
Error: WSH Panel Mod (GUID: EAA8D0BB-9EB2-49F1-A631-2B3491B5D26A): Microsoft JScript runtime error:
Object doesn't support this property or method
Ln: 72, Col: 13
<source text only available in compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-23 23:23:16
i'm confused. what you posted shouldn't make the script crash???

can you post the contents of

%appdata%\foobar2000\wsh_settings\autoplaylists

(or foobar dir\wsh_settings\autoplaylists if running portable mode)

anyway, i've uploaded a new script that shouldn't crash (but it won't run the query either )
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-02-23 23:35:20
This is the only thing in autoplaylists: Loved Tracks!!%LASTFM_LOVED% IS 1!!
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-02-23 23:39:36
It's not giving me a script error anymore, but now am just receiving the message: "There was a problem executing that query. Please check your name/query/sort syntax."

As far as I know there should be nothing wrong with that query.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-23 23:43:13
i'm stumped- obviously there's nothing wrong with that text..... :/

what OS are you on?

irrelevant, i've just tested on windows 7 and XP.
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-02-23 23:58:04
windows 7
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-24 00:01:28
are you running the latest WSH panel mod?

Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-02-24 04:53:21
DOH that seems to have been the issue... updated to newest wsh panel mod and it worked fine.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-24 08:21:08
glad you sorted it.

however i've just uploaded a new version which breaks compatibility with the one i uploaded last night... 

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

in the old script i was using !! to separate and store stuff internally but i then i thought it could be possible that people might use that in their playlist names or queries which would then break it. i've now changed it to a ¬ instead which hopefully no one will be using.

(%appdata%\foobar2000\wsh_settings\autoplaylists can be opened in notepad and find/replace can be performed with !! and ¬)
Title: WSH Panel Mod script discussion/help
Post by: thuan on 2011-02-24 11:38:31
Marc, you might use ASCII unit and field delimiters instead http://en.wikipedia.org/wiki/Delimiter (http://en.wikipedia.org/wiki/Delimiter) . Won't ever run into problems theoretically.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-24 18:59:24
thanks. i'll stick with ¬ for now.

samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

autoplaylists: all those buttons are a bit fugly so i've updated it so they only show when hovering your mouse over each row...

(http://k5sbdw.blu.livefilestore.com/y1pFlgkw1vnYyDu4kRHLG8c_L43r2Lh9XEe7Y_r6oWLiNY0057mTqGuOjeaAnxcdXzHusDL015cDbxDD9feAnuUs4JYggUDNrpv/new%20ap2.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-24 21:49:50
autoplaylists updated again. same link as above.

-added sanity checking to prevent spawning of multiple text input windows and deletion of favourites when they are being edited.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-25 12:06:53
another update for autoplaylists

-now with scrolling support. mouse wheel is quickest but there are clickable buttons also....

(http://k5sbdw.blu.livefilestore.com/y1psBaAYn-t3kGKgqyj0pkpr-G0MSZd3NvpMXjwrwARHZtGzOrF_GRzQaGYPsy9_Hi2EWZJEYUASIFBPhhY9E9rrI8p17cDb37G/ap%20scroll.png)

Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-02-25 13:49:18
your autoplaylists script looks beautiful, but it creates a new playlist every time i click the "execute" button. is there a way to use the autosend playlist instead?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-25 14:01:48
do you mean send to the same playlist if one with the same name already exists? i'm not sure if that's possible although i should be able to delete old one before creating the new one. i'll have a play around....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-25 15:18:04
new version of autoplaylists (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

-added restore menu for deleted items. this only remains for the current session. also, anything that causes the script to re-initialise (such as cut/pasting the panel in layout editing mode or editing the script itself) will lose the history.
-added option to remove playlists with duplicate names (it's on by default, use the context menu to turn it off)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-02-25 16:00:47
wow, thanks! good solution

i have a question for anyone who has a moment.

i'm trying to replace my standard toolbar with a wsh toolbar.
i managed to modify the SimpleThemedButton sample to call functions from the main menu, but i'm wondering if it's possible to do something similar with the context menu?

i want a button that will run "ReplayGain/Scan selection as albums (by tags)" on the selected items. any hints on how to accomplish this would be appreciated
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-02-25 17:02:40
also marc2003, there is a script you published here, but it doesn't work with the lastest version of wsh_panel_mod.
http://www.hydrogenaudio.org/forums/index....mp;#entry685807 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&st=150&p=685807&#entry685807)

Microsoft JScript runtime error:
'settings_path' is undefined
Ln: 14, Col: 1


can you help me to fix it?

thanks again!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-25 18:22:09
replace lines 2&3 with

Code: [Select]
// @import "%fb2k_profile_path%marc2003\common.js"
// @import "%fb2k_profile_path%marc2003\tooltip_buttons.js"
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-02-25 18:43:55
thank you!
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2011-02-26 01:10:39
thanks. i'll stick with ¬ for now.

samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

autoplaylists: all those buttons are a bit fugly so i've updated it so they only show when hovering your mouse over each row...

(http://k5sbdw.blu.livefilestore.com/y1pFlgkw1vnYyDu4kRHLG8c_L43r2Lh9XEe7Y_r6oWLiNY0057mTqGuOjeaAnxcdXzHusDL015cDbxDD9feAnuUs4JYggUDNrpv/new%20ap2.png)


can you make it show the numbers of each playlist?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-26 01:51:00
although it is possible to fetch the item count for a given playlist i won't implement it because it could be too misleading. let's say i modify an active autoplaylist with a different query, you wouldn't want the favourite with the old query saved to show this new item count.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-26 04:24:07
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

similar artists and last.fm charts:

-added scrolling support so you can see the full 50 records pulled from each feed.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-26 12:15:44
autoplaylists updated

-mouse wheel bugfix
-new option to add favourites to beginning or end of list
-new option to do nothing or execute query when adding/editing favourites
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-02-26 12:38:05
Marco, i seem to be having problems with autoplaylist. I just installed the latest autoplaylist.txt, and all i am getting is a blank playlist.
This is how i created the playlist:

Name: Loved Tracks
Query: %LASTFM_LOVED% IS 1
Sort: None

I am on windows xp, and i have the latest WHS panel.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-02-26 12:47:59
if you're using my main last.fm playcount sync script, it should be %LASTFM_LOVED_DB%

also, if in any doubt, use Library>Search to verify your queries.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-02-26 17:28:01
from what i've read, this should act on all selected items, but it's only acting on the now playing item. what's wrong?

Code: [Select]
    ReplayGain: new SimpleButton(104, 0, 20, 20, "▣", function () {
        fb.RunContextCommandWithMetadb('ReplayGain/Scan selection as albums (by tags)', fb.GetSelections());
    }),
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-03-03 15:56:17
Another question Marco: is there a way to change the background and font color of last.fm panels?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-03-03 16:27:49
my name isn't marco... 

colours are dictated by the main foobar config found under foobar preferences>display>YOUR UI OF CHOICE>colours and fonts.

if you really want to customise them separately then you need to find the on_paint function in each script and add these as the first lines in it...

Code: [Select]
function on_paint(gr) {
    g_backcolor = RGB(0,0,0);
    g_textcolor = RGB(255,255,255);
    g_textcolor_hl = RGB(255,0,0);
    .....
}
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-03-03 16:38:52
Sorry...i thing i saw someone refering to you as Marco? Anyway, i will make sure to refer to you as marc2003 from now on 
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-03-04 11:22:56
@marc:

I modified the script you provided me with (including wikipedia and rym), and i added a discogs entry. I did my best to add the entry as accuratly as possible, and i also placed discogs.png and discogs_h.png in the "C:\Documents and Settings\*\Application Data\foobar2000\marc2003\images" directory. But i am getting this error in the console:
Code: [Select]
WSH Panel Mod (Web Links by marc2003): Parsing file "C:\Documents and Settings\*\Application Data\foobar2000\marc2003\common.js"
WSH Panel Mod (Web Links by marc2003): Parsing file "C:\Documents and Settings\*\Application Data\foobar2000\marc2003\tooltip_buttons.js"
Error: WSH Panel Mod (Web Links by marc2003): Microsoft JScript compilation error:
Expected '}'
Ln: 34, Col: 9
        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)


And here is the whole 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 = 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);
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-03-04 11:33:05
you're missing a comma at the end of the line that begins "but5:"
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-03-04 11:41:14
I added the coma at the end of the "but5:" line (right after the last bracket), but now i am getting this error:

Code: [Select]
WSH Panel Mod (Web Links by marc2003): Parsing file "C:\Documents and Settings\*\Application Data\foobar2000\marc2003\common.js"
WSH Panel Mod (Web Links by marc2003): Parsing file "C:\Documents and Settings\*\Application Data\foobar2000\marc2003\tooltip_buttons.js"
Error: WSH Panel Mod (Web Links by marc2003): Microsoft JScript compilation error:
Expected ')'
Ln: 34, Col: 73
        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)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-03-04 11:44:15
you're not using squiggly brackets around the function like the other 2 entries. open your eyes. 
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-03-04 11:54:58
 
Fixed 

<3
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-03-05 13:51:39
Is there any script available that will open up "Tagging/Discogs/Write tags" from the context menu?
Title: WSH Panel Mod script discussion/help
Post by: burn416 on 2011-03-06 01:39:51
I am trying to make an icon change based on what the current playback order is. For instance, if the playback order is on default, a certain icon will be showing, but if the playback order is on shuffle, a different icon will be showing.

I want to use something similar to this:

Code: [Select]
function genPPImageSrc() {
    return (fb.IsPlaying && !fb.IsPaused) ? pause_image : play_image;
}



I just dont know what to use instead of fb.isplaying and fb.ispaused. Is there something like this for default, shuffle, or repeat?




Alternatively I have tried using  function on_playback_order_changed(new_order_index)  but I cant get the numbers for new_order_index to return unless the playback is actually changed. Normally this would be okay, except for when foobar is first loaded. It loads the previously selected playback order, therefore, I cannot just assume that the initial playback order will always be the same.


Do any of you have any ideas or tips?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-03-06 02:05:28
Code: [Select]
var pbo = fb.PlaybackOrder;


will give an index between 0 and 6.

also, check out the samples from the component homepage. there are a couple of playback order related examples.
Title: WSH Panel Mod script discussion/help
Post by: Audiospawn on 2011-03-06 11:49:58
Does anyone have a solution to toggle the visibility of a 'dockable panel' (in my example that would be chronflow in DUI and a panel with foo_run links) with one button?
Atm I modified marcs 'weblinks buttons' with the following commands, but it needs ugly two buttons per panel so far...

Code: [Select]
		but11: new Button(left_margin,top_margin,bw,bh, {normal: images_path + "search.png", hover: images_path + "search.png"}, function(){ fb.RunMainMenuCommand("View/Dockable Panels/Activate/1 - Chronflow"); },coverflow),
but12: new Button(left_margin + bw,top_margin,bw,bh, {normal: images_path + "edit.png", hover: images_path + "edit.png"}, function () { fb.RunMainMenuCommand("View/Dockable Panels/Activate/2 - Panel Stack Splitter"); },run),
but21: new Button(left_margin,top_margin + bh,bw,bh, {normal: images_path + "cross.png", hover: images_path + "cross.png"}, function () { fb.RunMainMenuCommand("View/Dockable Panels/Collapse/Chronflow"); },coverflowoff),
but22: new Button(left_margin + bw,top_margin + bh,bw,bh, {normal: images_path + "cross.png", hover: images_path + "cross.png"}, function() { fb.RunMainMenuCommand("View/Dockable Panels/Collapse/Panel Stack Splitter"); },runoff)
Title: WSH Panel Mod script discussion/help
Post by: CerpinTaxt on 2011-03-06 19:19:19
Hey guys! Long time lurker, first time poster (let me know if I'm breaking any rules or such which I don't know of)

Anyways, on to the point. I've been using Marc2003s DUI for quite some time (it was lovely ) but now I'm trying to make something for myself, and, yes, my JScripting is horrible. Nonexistant, actually. So I tried "borrowing" from others but so far I've been unable to get anything done properly. I'm not really sure if I should ask this, but I'll go ahead! I'm trying to add a toggleable panel containing lyrics. I'm also trying to add a seekbar, play/pause/next/previous buttons. Now, the buttons I'm *fairly* certian I can manage myself. *Fairly*. But as for a toggleable panel my googling has been fruitless.

I've uploaded a picture of how I'd like it, and if someone experienced could tell me if it's possible and/or help me, that would be lovely, mmkay?
(http://data.fuskbugg.se/skalman02/WATUSAY.png)

The lyrics panel should obviously extend to the menu aswell, but such minor things I can probably manage myself. I haven't yet added the panel for the bottom buttons et.c., but that I can do myself, it's the coding I can't.

Thanks for any replies whatsoever on this topic. :>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-03-06 22:27:38
you should use panel stack splitter for toggling panels on/off. it has functions to create buttons, show/hide panels and adjust the window size.

http://foo2k.chottu.net/#pss (http://foo2k.chottu.net/#pss)
Title: WSH Panel Mod script discussion/help
Post by: jk007 on 2011-03-26 11:06:06
I'm working on seekbar. then I found out skipping repaint();
In on_timer() function , called window.RepaintRect() or window.Repaint(), but It didn't repaint in no burden program is running.

for checking, use code " bar.test = <value>; " in on_timer function, and reset variable " bar.test = 0;" in on_paint function.
next recursive on_timer function, check bar.test is empty with  " if (bar.test) echo("error"); "

within playing a song, lots of error was printed in console.

there is other window.RepaintRect(..); code in on_playback_time function. but same results popped though make it comment.

Is this a bug? or miss something?

This is whole source code
Code: [Select]
// ==PREPROCESSOR==
// @name "j-seekbar"
// @version "0.3.3b"
// @author "jk007"
// ==/PREPROCESSOR==
var pn = "js| ",
    debug = window.GetProperty("debug", 0),
    dragging = 0,
    cc=0, c0=0,
    dragging_seek = 0,
    timer, timerbar, timeout, g_now,
    fz_song=12,fz_album=12, fz_info=12, fz_time=12,
    last_x,
    ww, wh,
    bar={time:0,pos:0,interval:10},
    song={posTime:0}
;
window.GetProperty("AutoResize",0);
window.GetProperty("SkipInst", 1);
window.MinHeight = 37;
window.MaxHeight = 185;

DT_TOP = 0x00000000;
DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_BOTTOM = 0x00000008;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
    text: 0,
    selection_text: 1,
    inactive_selection_text: 2,
    background: 3,
    selection_background: 4,
    inactive_selection_background: 5,
    active_item_frame: 6
};
ColorTypeDUI = {
    text: 0,
    background: 1,
    highlight: 2,
    selection: 3
};
(function get_colors(){
    if (window.InstanceType) {
        clr_txt = window.GetColorDUI(ColorTypeDUI.text);
        clr_txt_hl = window.GetColorDUI(ColorTypeDUI.highlight);
        clr_bckgrnd = window.GetColorDUI(ColorTypeDUI.background);
    }
    else {
        clr_txt = window.GetColorCUI(ColorTypeCUI.text);
        clr_txt_hl = window.GetColorCUI(ColorTypeCUI.text);
        clr_bckgrnd = window.GetColorCUI(ColorTypeCUI.background);
    }
})();
function on_size(){
    debug && echo();
    ww = window.Width;
    wh = window.Height;

    if (window.GetProperty("AutoResize") == 1)
        window.MinHeight = window.MaxHeight = Math.max(37,ww * 185/2500);
    else {
        window.MinHeight = 37;
        window.MaxHeight = 185;
    }
    fz_song = Math.floor(Math.max(12,Math.min(0.52*wh-5,0.0345*ww+2)));
    fz_time = Math.floor(Math.max(12,Math.min(0.5*wh-5,0.0338*ww+2)));
    fz_album = Math.floor(Math.max(11,Math.min(0.26*wh,0.0175*ww+4)));
    fz_info = Math.floor(Math.max(11,Math.min(0.24*wh,0.0159*ww+4)));
    compute_timeInfoWidth();
    
    if (fb.IsPlaying) {
        compute_repaintBarInterval();
        if (!fb.IsPaused) timerbar = window.CreateTimerInterval(bar.interval);
    }
}
function parseHMS(seconds)
{
    var h, m, s;
    seconds = Math.round(seconds);
    h = Math.floor(seconds/3600);
    m = Math.floor((seconds-=h*3600)/60);
    s = seconds % 60;
    return (h ? h+":" + (m<10 ? "0"+m : m) : m) + ":" + (s<10 ? "0"+s : s);
}
function on_paint(gr)
{
    var timeInfo=song.length, pos, now;
    if (fb.IsPlaying && fb.PlaybackLength)
    {
        now = g_now || fb.PlaybackTime;
        pos = Math.round(now * bar.w);
        if (now == bar.time) {
            bar.test = 0;
            bar.pos = pos;
        } else if (pos < bar.pos) pos = bar.pos;
        gr.FillGradRect(0, 0, pos, wh, 90, 0xffff1303, 0xffbe1303);
        timeInfo = (fb.IsPaused ? "Paused  ":"") + parseHMS(now) + " / " + song.length;
        if (dragging) {
            timeInfo = "< "+parseHMS(fb.PlaybackLength * dragging_seek) +" >  "+ timeInfo;
            gr.FillGradRect(0, 0, ww*dragging_seek, wh, 90, 0xa0f000f0, 0xb04000f0);
        }
        debug && gr.FillSolidRect(song.posTime,0,song.timeInfoWidth,wh,0x304000f0)
    }
    gr.SetTextRenderingHint(5);
    gr.DrawString(timeInfo, gdi.Font("Segoe UI", fz_time, 3), clr_txt, 0, 1, ww-10, wh, 0x20000000);
    gr.DrawString(song.codec, gdi.Font("Segoe UI", fz_info, 1), song.colorCodec, 0, 0, ww-10, wh-3, 0x22000000);
    gr.gdiDrawText(song.album , gdi.Font("Segoe UI", fz_album, 2),clr_txt,20,0,ww-80, wh-2, DT_CALCRECT | DT_NOPREFIX|DT_BOTTOM);
    gr.gdiDrawText(song.title, gdi.Font("Segoe UI", fz_song, 1), clr_txt, 7, 1, ww-17-song.timeInfoWidth*2, wh, DT_CALCRECT | DT_NOPREFIX);
}
function on_timer(id)
{
    var now = fb.PlaybackTime;
    var gap = now - bar.time;
    0&&debug && echo("\t"+now.toFixed(5));
    
    if (gap > 0){
        if (bar.test) echo("Error Didn't repaint @ "+ bar.time);
        bar.test = g_now = bar.time = now;
        gap = Math.round(now*bar.w) - bar.pos;
        window.RepaintRect(bar.pos, 0, gap, wh);
    }
}
function on_playback_time(time)
{
    g_now = time;
    window.RepaintRect(song.posTime,0,song.timeInfoWidth,wh);
}
function on_playback_new_track()
{
    debug && echo();
    if (window.GetProperty("SkipInst") == 1 && fb.TitleFormat("%title%").Eval().match(/\(inst.|\(instrument|\(MR|instrumental\)/i))
        fb.Next();
    get_info();
    //if (fb.isPaused) return;
    compute_repaintBarInterval();
    start_timer();
}
function compute_repaintBarInterval()
{
    debug && echo(" +  "+/.+\)/.exec(arguments.callee)+" ~~ "+/.+\)/.exec(arguments.callee.caller));
    if (!ww || !fb.PlaybackLength) return false;
    g_now = bar.time = bar.pos = 0;
    bar.interval = Math.max(10,Math.round(fb.PlaybackLength*1000/ww));
    bar.w = ww / fb.PlaybackLength;
    debug && echo("bar.interval="+bar.interval+",  ww="+ww+",  PlaybackLength="+fb.PlaybackLength);
    debug && echo("bar.w="+bar.w+"\t"+(bar.w*bar.interval/1000));
}
function start_timer()
{
    window.Repaint();
    debug && echo(" +  "+/.+\)/.exec(arguments.callee)+" ~~ "+/.+\)/.exec(arguments.callee.caller));
    timerbar = window.CreateTimerInterval(bar.interval);
}
function get_info()
{
    song.title =  fb.TitleFormat("%artist% - %title%").Eval(true);
    song.length = fb.TitleFormat("%length%").Eval(true);
    song.album = fb.TitleFormat("%album%[  '(' %date% ')'] [Disk %discnumber%]").Eval(true);
    song.codec = fb.TitleFormat("$replace(%codec%,Monkey$char(39)s Audio,APE,PCM,WAV)[  %__codec_profile%]  %__bitrate%kbps$ifequal(16,%__bitspersample%,,[  %__bitspersample%bit])$ifequal(44100,%__samplerate%,,  %__samplerate%Hz)$if($strcmp(stereo,%channels%),,  %channels%)").Eval(true);
    song.colorCodec = (fb.TitleFormat("%__encoding%").Eval() ==  "lossy") ? 0xffff0000 : 0xff0000ff;
    compute_timeInfoWidth();
}
function compute_timeInfoWidth()
{
       // Using a temp IGdiGraphics interface
    var temp_bmp = gdi.CreateImage(1, 1);
    // Don't forget to call temp_bmp.ReleaseGraphics(temp_gr)!
    var temp_gr = temp_bmp.GetGraphics();
    song.timeInfoWidth = temp_gr.CalcTextWidth('/ '+song.length, gdi.Font("Segoe UI", fz_time, 3));
    song.posTime = ww-10-song.timeInfoWidth*2;//*2.46;
    // Free the resources
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
}
function on_item_focus_change()
{
    debug && echo();
    if (fb.IsPlaying) return true;
    get_info();
    window.Repaint();
}
function on_playback_pause(state)
{
    debug && echo();
    if (state) {
        timer && window.KillTimer(timer);
        timeout && window.KillTimer(timeout);
        timerbar && window.killTimer(timerbar);
        CollectGarbage();
        window.Repaint();
    }
    else
        start_timer();
}
function on_playback_stop()
{
    debug && echo();
    timer && window.KillTimer(timer);
    timeout && window.KillTimer(timeout);
    timerbar && window.killTimer(timerbar);
    window.Repaint();
    CollectGarbage();
}
function on_playback_seek(time)
{
    window.Repaint();
}
function on_mouse_lbtn_down(x,y)
{
    if (fb.IsPlaying && fb.PlaybackLength > 0) {
        dragging = 1;
        dragging_seek = x < 0 ? 0 : x > ww ? 1 : x / ww;
        last_x = x;
        window.Repaint();
    }
}
function on_mouse_lbtn_up(x,y)
{
    if (dragging) {
        g_now = bar.time = bar.pos = dragging = 0;
        dragging_seek = x < 0 ? 0 : x > ww ? 1 : x / ww;
        fb.PlaybackTime = fb.PlaybackLength * dragging_seek;
    }
}
function on_mouse_move(x,y)
{
    if (dragging && last_x != x) {
        last_x = x;
        dragging_seek = x < 0 ? 0 : x > ww ? 1 : x / ww;
        if (y < 0 || wh < y) dragging = 0;
        window.Repaint();
    }
}
function on_colors_changed()
{
    get_colors();
    window.Repaint();
}
function echo(txt)
{
    txt = txt || " +  "+/.+\)/.exec(arguments.callee.caller);
    fb.trace(pn+txt);
}
function on_mouse_rbtn_up(x, y)
{
    var MF_SEPARATOR = 0x00000800;
    var MF_STRING = 0x00000000;
    var _menu = window.CreatePopupMenu();
    var idx;

    _menu.AppendMenuItem(MF_STRING, 14, "Debug mode");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 1, "Auto Resize");
    _menu.AppendMenuItem(MF_STRING, 4, "Skip Instrumantal");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 2, "Properties");
    _menu.AppendMenuItem(MF_STRING, 3, "Configure...");
    _menu.CheckMenuItem(1, window.GetProperty("AutoResize")== 0 ? 0x0 : 0x8);
    _menu.CheckMenuItem(4, window.GetProperty("SkipInst")== 0 ? 0x0 : 0x8);
    _menu.CheckMenuItem(14, window.GetProperty("debug")== 0 ? 0 : 1);
    
    idx = _menu.TrackPopupMenu(x, y);
    
    switch (idx) {
    case 1:
        window.SetProperty("AutoResize", !window.GetProperty("AutoResize"));
        on_size();
        break;
    case 2:
        window.ShowProperties();
        break;
    case 3:
        window.ShowConfigure();
        break;
    case 4:
        window.SetProperty("SkipInst", !window.GetProperty("SkipInst"));
        break;
    case 14:
        window.SetProperty("debug", !window.GetProperty("debug"));
        debug = window.Getproperty('debug');
        window.RepaintRect(song.posTime,0,song.timeInfoWidth,wh);
        break;
    }
    _menu.Dispose();
    return true;
}
(function (){
    if (fb.isplaying)
        on_playback_new_track();
    else
        on_item_focus_change();
})();
Title: WSH Panel Mod script discussion/help
Post by: zhdali on 2011-03-27 22:42:24
Hi, i am new to jscript and i'm still reading script examples found on this forum.

I want write a string with gradient effect, but i'm not able to find nothing like this, can someone suggest me how to do it or in alternative where i can look ?

Perhaps something similar at "glow text sample" script ?

I need some big help for start with this panel.
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2011-04-03 07:28:14
Hey there, all!

I'm having an issue with Br3tt's "WSH Tree Explorer", version 1.7.

note: I haven't changed anything in its code.

Problem: it doesn't display all folders on my D:\ drive. As it can be seen in the image below, the folders "Music" and "Video" don't show up in the tree. There' sno problem if "Video" doesn't show, but I'd kinda need "Music". At first I thought that it simply doesn't show folders containing music files with paths already added to the Library, but I added the "Spoken" folder (which contains mp3 podcasts and audiobooks) to the Library, but that one shows just fine. Then I added only a subfolder of "Spoken", but it still works fine. Also my C:\ drive shows up correctly.

Does anyone have an idea?

Explanation image:
(http://i.imgur.com/xo1wx.png)

A few notes:
- running on Win7 32bit SP1 fully updated
- using a foobar2000 1.1.5 portable install
- path to scripts is C:\foobar2000\WSH samples
- the link to Br3tt's script (posted a few pages back): deviantART page (http://br3tt.deviantart.com/art/WSH-Tree-Explorer-1-7-196023730?q=gallery%3Abr3tt%2F3063083&qo=2)
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2011-04-03 14:31:10
Another question, for marc2003: what would be the line I should put in your "now playing" script to display a placeholder image for tracks w/out artwork (having the placeholder png of course).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-03 14:46:24
file>preferences>display>front cover>stub image path.

edit: removed "artist" from description - it doesn't use the foobar artreader 
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2011-04-03 14:48:17
Great, thanks a bunch!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-04-03 16:25:21
Hey there, all!

I'm having an issue with Br3tt's "WSH Tree Explorer", version 1.7.
...


my script doesn't show all the "kind" of folder, for example, system folder are not shown. Maybe (surely in fact!) these 2 folders have an attribut "kind" value not allowed by my script.

check function FillTreeLevel (near line #530 ...), you find this test : if(item_fld.Attributes==16 || item_fld.Attributes==17 || item_fld.Attributes==2064)

only these 3 value are allowed in my script, you can add a line above this one to display to the console the value of item_fld.Attributes for each folder browsed, to check the value of this one for Music and Videos folders, like this:
fb.trace("fld name = "+item_fld.Name+" hase an attrb value = "+item_fld.Attributes);

Once script launched, open the console (menu View->Console) and check the values of the trace method, and then modify the test in the script to add more values than 16, 17 and 2064 in order to fix the issue for you. Tell me too what's the missing value, i'm curious. Thanx.

HTH
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2011-04-03 16:36:59
Marc another question.. what parameteres should I give to Gdi.Drawtext so it would wrap text if at all possible.

@Falstaff: I'm going to read this for a while... kudos!

Edit: nevermind; got my code-monkey room-mate to help!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-03 18:10:34
replace DT_END_ELLIPSIS with DT_WORDBREAK.
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2011-04-03 18:37:56
@Falstaff

Thanks for telling where the problem lied. In my casse there was a problem with folder attributes: both Music and Videos were set as "Ready for archiving" and this gave them an attribute of 48. Remove that, they became 16 and all was OK.

However, we noticed a few values which were viewable by default, but shouldn't, for security reasons (with some examples):

18 - C:\Program Data
21 - C:\Windows\assembly
22 - $RECYCLE.BIN, System Volume Information
1046 - C:\Documents and Settings
2064 - C:\Windows\System32\DRVSTORE

This being the case, we just negated those values (maybe others will add more) and went with the modified lines 536->543 :

Quote
for (; !oFolders.atEnd(); oFolders.moveNext()) {
        item_fld = oFolders.item();
        // ajout nouveau noeud
        fb.trace("fld name = "+item_fld.Name+" hase an attrb value = "+item_fld.Attributes);
        if(item_fld.Attributes!=22&&item_fld.Attributes!=21&&item_fld.Attributes!=18&&item_fld.Attributes!=2064&&item_fld.Attributes!=1046) {
            node.addchild(item_fld.Name, item_fld.Path);
            if(recursive) {
                FillTreeLevel(item_fld.Path, node.child[node.child.length-1], true);


Sorry, I don't know how to format this ^, but I believe you'll manage it. 
In any case, if you wish to remain with a syntax for allowing parameters, include 48; I believe this is done automatically once a folder reaches >10GB (don't quote me on that)

Hope this helps!
Title: WSH Panel Mod script discussion/help
Post by: aereogramme on 2011-04-06 18:48:36
Hey

I love the uses people are finding for this component and I have a request of someone who might be able to code.  I plan on trying to learn some JavaScript this summer but You guys might be able to whip this up really quickly.

What I am looking for is a comibnation of the nowplaying.txt and the artreader.txt last.fm scripts that I do believe were written by marc2003.

Instead of displaying the artist photo, I wanted it to display the album that is in the same folder as the album and called folder.jpg.  But on top of that I want the band, track, and album.  It's pretty much the same except the artist photo and album are switched.

Is this possible.  It would be greatly appreciated.

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-06 19:28:22
http://pastebin.com/CJ4BkQKi (http://pastebin.com/CJ4BkQKi)

it still requires the files in place from my download.

Title: WSH Panel Mod script discussion/help
Post by: aereogramme on 2011-04-06 19:56:16
Holy hell!  That was such a fast reply!  Thanks.

Is there anyway I can have it so that the full album are will always be shown?  Right now it's cutting the top and bottom off the artwork.

I guess what I am looking for is the artwork to fit the window and have black bars on the side.

(http://i.imgur.com/P3CZp.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-06 20:10:56
on line 57, replace "max" with "min".

then insert this before immediately before line 57.

Code: [Select]
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);


the background will then match the default from the DUI colour preferences.
Title: WSH Panel Mod script discussion/help
Post by: aereogramme on 2011-04-06 20:15:33
on line 57, replace "max" with "min".

then insert this before immediately before line 57.

Code: [Select]
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);


the background will then match the default from the DUI colour preferences.


You are a god among men.  Thank you so much.  By the way, where is that you usually post the most up to date samples.zip.  Is it in this thread usually?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-06 20:25:10
this thread is it's home. the link doesn't change and i usually post whenever i update it - either for fixes or something new.
Title: WSH Panel Mod script discussion/help
Post by: aereogramme on 2011-04-06 21:05:22
Great!  Those samples are pretty much my whole config.
Title: WSH Panel Mod script discussion/help
Post by: Daigomi on 2011-04-09 21:44:58
Hi!

I have a what I hope will be a fairly small request. I'm using marc2003's last.fm scripts and they're great for everything except classical music. By and large, classical music is tagged in such a way that it's impossible for last.fm to keep track of the artists (for example, they can't have a page for each of the combinations of musicians that Jacqueline du Pre has performed chamber music with). So, instead of having the last.fm panels looking for information on the artist, would it be possible to have the scripts look at the last.fm page for the composer when the genre is "Classical"? Specifically, I make use of the "Now Playing", "Simple Biography" and "Similar Artists" panels, but I assume the code would be transferrable between them.

A second (but much less important) question I have is, how would I create something like a 32x32 pixel box that numerically shows what the volume level is? I rely entirely on hotkeys to change my volume, so I removed the volume slidebar, but it would be nice to have an indication of the volume somewhere. If there's an existing volume slidebar similar to the "Aero Seekbar" I wouldn't mind using that either, but I haven't been able to find one yet.

Any help or advice on how to do this would be awesome
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-11 20:12:27
i'll add an option for last.fm artist field remapping in the next few days.

as for a volume indicator, just right click your status bar and enable it.
Title: WSH Panel Mod script discussion/help
Post by: Daigomi on 2011-04-11 21:17:03
Thanks, that sounds great  Just one thing, I would prefer to have it look at composer only if the genre is classical. For everything else artist is still best. Sorry if this is extra effort.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-11 22:21:33
i'll make it so you can configure it yourself with standard foobar title formatting (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference). %artist% would be the default but you could use something like this....

Code: [Select]
$if($stricmp(%genre%,classical),%composer%,%artist%)
Title: WSH Panel Mod script discussion/help
Post by: Daigomi on 2011-04-12 01:16:12
Perfect! It took me about three hours yesterday to get a short 'if' script to work using the standard foobar title formatting, but after spending that much time working on the script I feel quite comfortable using standard foobar formatting now
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-14 19:07:19
http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

i've updated the "simple biography" script with artist field remapping. the option is on the context menu. i'm too lazy to do the other scripts just yet.

for existing users, the files from the zip must be extracted again overwriting all as one has changed.
Title: WSH Panel Mod script discussion/help
Post by: Daigomi on 2011-04-14 22:54:48
Thanks for the update  It works great so far. Sorry if it's a lot of effort (I saw the file size for simple biography increased quite a bit), I thought it would be one or two lines of code... Much appreciated!
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2011-04-20 20:20:23
Marc,
it is not possible for me to set api_key and username true the context menu it won't open, i mean it will open the menu but if i click (set your lastfm username) same for (api_key) nothing happens.
So in the console the error pops up WSH Simple Biography: Can't contact Last.fm. Check your username / API KEY settings.



I hope you can help me.,
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-22 07:59:38
when you select that option from the menu, it calls an external script with a .wsf file extension. possible reasons it's not working

-file type associations have been messed with
-machine is locked down and scripts aren't allowed to run
-you're not running windows

workaround: browse to %appdata%\foobar2000\wsh_settings and create 2 files named

username
api_key

make sure they have no file extensions at all and then edit each one in notepad and save the relevant details in each one. the script will need reloading to pick up the new details.
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2011-04-22 09:28:13
when you select that option from the menu, it calls an external script with a .wsf file extension. possible reasons it's not working

-file type associations have been messed with
-machine is locked down and scripts aren't allowed to run
-you're not running windows

workaround: browse to %appdata%\foobar2000\wsh_settings and create 2 files named

username
api_key

make sure they have no file extensions at all and then edit each one in notepad and save the relevant details in each one. the script will need reloading to pick up the new details.



Thx it is solved.
As you suggested it was the file association that was't correct.

Thanks.
Title: WSH Panel Mod script discussion/help
Post by: halocline_ on 2011-04-28 06:25:08
Hello, I have a question. I'm using many of your samples, for which I wanna say my thanks. But I'm having issue with the aero seekbar. I want to change the colour of the timer, but the only variable I can link to the timer is this:
Code: [Select]
var g_font = gdi.Font("Segoe UI", 12, 0);

which only chooses the font. How can I change the font colour?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-04-28 07:35:26
line 44:

Code: [Select]
gr.GdiDrawtext(txt, g_font, RGB(0,0,0), 0, 0, ww-10, wh, DT_VCENTER | DT_RIGHT | DT_CALCRECT | DT_NOPREFIX);


you can change the colour in the RGB function.
Title: WSH Panel Mod script discussion/help
Post by: halocline_ on 2011-04-28 12:39:19
line 44:

Code: [Select]
gr.GdiDrawtext(txt, g_font, RGB(0,0,0), 0, 0, ww-10, wh, DT_VCENTER | DT_RIGHT | DT_CALCRECT | DT_NOPREFIX);


you can change the colour in the RGB function.


Oh, FFS I've literally slept through that line. Thanks, that was a dumb question.
Title: WSH Panel Mod script discussion/help
Post by: halocline_ on 2011-04-30 21:47:31
Ok, I've got another dumb question. I'm using your simple buttons for playback. I've also configured one to be a preferences button, but I've got a question. Is there a way to make another button which when pressed the file menu would open? Here's my code for the preferences button, I guess it'd be something similar, I just don't know the exact function.

Code: [Select]
    but6: new Button((bw*17) + left_margin,top_margin,bw,bh, {normal: images_path + "pref.png", hover: images_path + "pref_h.png"}, function(){fb.ShowPreferences();}, "Preferences")
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-01 00:06:08
have a look at the samples from the component homepage. inside is an example of how to have the full menu pop out from a mouse click.
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-05-09 05:33:47
Marc, your Now Playing script doesn't appear to be downloading artist art... I've let it go while two songs were playing for an artist, and nothing ever changed from the default background.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-09 09:03:23
seems to be working ok here. perhaps a temporary glitch at the last.fm end? and have you checked art definitely exists for the artist by visiting the page?

as for your PM request, i've updated the "now playing" script so you can turn off the front cover display via the context menu,

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-05-09 11:53:40
seems to be working ok here. perhaps a temporary glitch at the last.fm end? and have you checked art definitely exists for the artist by visiting the page?

as for your PM request, i've updated the "now playing" script so you can turn off the front cover display via the context menu,

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)


Thanks! Maybe I broke something when tinkering with your script, I'll try the update.
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-05-09 12:13:44
Hmmm.... still not working after playing 4 songs for the same artist.  My settings are:

Last.fm Options: Automatically Download (check)
                        Limit: 20
                        Blacklist Deleted Images (check)

Cycle: 20 seconds

Font Cover Display: Off












I have edited things in the script (from lines 7-16), but I don't think it should make a difference:



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

var stopped_text = "foobar2000";
var title_tf =  fb.TitleFormat("[%discnumber%.]%tracknumber%'/'[%discnumber%.]%totaltracks% - %title%");
var album_tf = fb.TitleFormat("[%artist%]");
var artist_tf = fb.TitleFormat("$ifequal([%LASTFM_LOVED%],1,♥,)");
var title_font = gdi.Font("Segoe UI", 28, 1);
var album_font = gdi.Font("Segoe UI", 22, 1);
var artist_font = gdi.Font("Segoe UI", 22, 1);
var title_colour = RGB(40,179,255);
var album_colour = RGB(210, 210, 210);
var artist_colour = RGB(255,0,0);
var blacklist_file = '';
var title = '';
var artist = '';
var album = '';
var foobar_img = gdi.Image(images_path + "new foo.png");

var album_img = null;
var artist_img = null;
var arr = new Array();
var g_valid_tid = 0;

window.GetProperty("bl", true);
window.GetProperty("auto", true);
var cycle = window.GetProperty("cycle", 200) - 200;
var limit = window.GetProperty("limit", 305) - 300;
var album_img_size = window.GetProperty("album_img_size", 510) - 400;

if(fb.IsPlaying) on_playback_new_track();

function on_playback_time(time) {
    if(cycle > 0 && arr.length > 1 && (time % cycle == 0)) on_mouse_wheel(-1);
}

function on_playback_stop(reason) {
    album_img && album_img.Dispose();
    artist_img && artist_img.Dispose();
    g_metadb = album_img = artist_img = arr = null;
    if(reason != 2) window.Repaint();
}

function  on_playback_new_track() {
    g_metadb = fb.GetNowPlaying();
    artist = artist_tf.EvalWithMetadb(g_metadb);
    title = title_tf.EvalWithMetadb(g_metadb);
    album = album_tf.EvalWithMetadb(g_metadb);
    album_img && album_img.Dispose();
    album_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
    if(!album_img) utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
    folder = data_folder + fb.TitleFormat("$crc32(%artist%)").EvalWithMetadb(g_metadb);
    bl();
    arr = read_images();
    if(arr.length == 0 && window.GetProperty("auto")) {
        download_images();
    } else {
        index = Math.floor(Math.random()*arr.length);
        load_image();
    }
}

function on_mouse_wheel(delta) {
    if(!g_metadb || arr.length < 2) return;
    index += -delta;
    if(index < 0) index = arr.length - 1;
    if(index >= arr.length) index = 0;
    load_image();
}

function load_image() {
    artist_image_path = arr[index];
    g_valid_tid = gdi.LoadImageAsync(window.ID, artist_image_path);
}

function on_load_image_done(tid, image) {
    if (g_valid_tid == tid) {
        artist_img && artist_img.Dispose();
        artist_img = image;
        window.Repaint();
    }
}

function on_mouse_lbtn_dblclk() {
    try {WshShell.Run("\"" + artist_image_path + "\""); } catch(e) {}
}

function on_get_album_art_done(metadb, art_id, im, ip) {
    album_img = im;
    window.Repaint();
}

function on_size() {
    ww = window.width;
    wh = window.height;
}

function on_paint(gr) {
    gr.SetInterpolationMode(6);
    if(artist_img) {
        scale(gr, artist_img, 0, 0, ww, wh, "max");
    } else {
        gr.FillGradRect(0, 0, ww, wh, 90,g_backcolor, g_textcolor_hl);
    }
    gr.FillSolidRect(0,wh-130,ww,110,RGBA(0,0,0,156));
    if(album_img && album_img_size > 0) {
        text_x = album_img_size + 10;
        scale(gr, album_img, 0, wh-20-album_img_size, album_img_size, album_img_size, "min");
    } else {
        text_x = 10;
    }
    if(fb.IsPlaying) {
        gr.GdiDrawText(title, title_font, title_colour, text_x, wh -127, ww-text_x-10, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(album, album_font, album_colour, text_x, wh - 80, ww-text_x-10, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(artist, artist_font, artist_colour, text_x, wh - 55, ww-text_x-10, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
    } else {
        scale(gr, foobar_img, 0, 0, ww, wh - 130, "min");
        gr.GdiDrawText(stopped_text, title_font, title_colour, 0, wh - 130, ww, 110,DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
    }
}

function on_mouse_rbtn_up(x, y) {
    var _album = window.CreatePopupMenu();
    var _cycle = window.CreatePopupMenu();
    var _menu = window.CreatePopupMenu();
    var _lastfm_options = window.CreatePopupMenu();
    var _limit = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(g_metadb ? MF_STRING : MF_GRAYED, 11, "Download artist art from Last.fm");
    _lastfm_options.AppendMenuItem(MF_STRING, 1000, "Automatically download");
    _lastfm_options.CheckMenuItem(1000, window.GetProperty("auto"));
    _limit.AppendMenuItem(MF_STRING, 301, "1");
    _limit.AppendMenuItem(MF_STRING, 303, "3");
    _limit.AppendMenuItem(MF_STRING, 305, "5");
    _limit.AppendMenuItem(MF_STRING, 310, "10");
    _limit.AppendMenuItem(MF_STRING, 320, "20");
    _limit.CheckMenuRadioItem(301, 320, window.GetProperty("limit"));
    _lastfm_options.AppendMenuItem(MF_STRING | MF_POPUP, _limit.ID, "Limit");
    _lastfm_options.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _lastfm_options.AppendMenuItem(MF_STRING, 1001, "Blacklist deleted images");
    _lastfm_options.CheckMenuItem(1001, window.GetProperty("bl"));
    _lastfm_options.AppendMenuItem(fso.FileExists(blacklist_file) ? MF_STRING : MF_GRAYED, 1002, "Clear blacklist for this artist");
    _lastfm_options.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _lastfm_options.AppendMenuItem(MF_STRING, 1003, "Explain blacklisting");
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _lastfm_options.ID, "Last.fm options");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _cycle.AppendMenuItem(MF_STRING, 200, "Off");
    _cycle.AppendMenuItem(MF_STRING, 205, "5 seconds");
    _cycle.AppendMenuItem(MF_STRING, 210, "10 seconds");
    _cycle.AppendMenuItem(MF_STRING, 220, "20 seconds");
    _cycle.CheckMenuRadioItem(200, 220, window.GetProperty("cycle"));
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _cycle.ID, "Cycle");
    _album.AppendMenuItem(MF_STRING, 400, "Off");
    _album.AppendMenuItem(MF_STRING, 510, "Small");
    _album.AppendMenuItem(MF_STRING, 620, "Large");
    _album.CheckMenuRadioItem(400, 620, window.GetProperty("album_img_size"));
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _album.ID, "Front cover display");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(artist_img ? MF_STRING : MF_GRAYED, 12, "Open containing folder");
    if(artist_img) _menu.AppendMenuItem(MF_STRING, 15, "Delete this image");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    if(utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 99, "Properties");
    _menu.AppendMenuItem(MF_STRING, 100, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    switch(idx) {
        case 200:
        case 205:
        case 210:
        case 220:
            window.SetProperty("cycle", idx);
            cycle = idx - 200;
            break;
        case 301:
        case 303:
        case 305:
        case 310:
        case 320:
            window.SetProperty("limit", idx);
            limit = idx - 300;
            break;
        case 400:
        case 510:
        case 620:
            window.SetProperty("album_img_size", idx);
            album_img_size = idx - 400;
            window.Repaint();
            break;
        case 11:
            download_images();
            break;
        case 12:
            WshShell.Run("explorer /select," + artist_image_path);
            break;
        case 15:
            try {
                if(window.GetProperty("bl") == true) {
                    ts = fso.OpenTextFile(blacklist_file, 2, true, -1);
                    ts.WriteLine(blacklist + arr[index] + "|");
                    ts.close();
                }
                artist_img.Dispose();
                artist_img = null;
                fso.DeleteFile(arr[index]);
            } catch(e) {
                fb.trace("Error: Could not delete " + arr[index]);
            }
            on_playback_new_track();
            break;
        case 99:
            window.ShowProperties();
            break;
        case 100:
            window.ShowConfigure();
            break;
        case 1000:
            window.SetProperty("auto", !window.GetProperty("auto"));
            break;
        case 1001:
            window.SetProperty("bl", !window.GetProperty("bl"));
            break;
        case 1002:
            try { fso.DeleteFile(blacklist_file); } catch(e) {}
            break;
        case 1003:
            fb.ShowPopupMessage("When you delete an image, there is no way for this script to prevent it being downloaded again. As a workaround, you can \"blacklist\" images you don't want and they will be deleted after downloading is complete.", "Now Playing");
            break;
    }
    _lastfm_options.Dispose();
    _menu.Dispose();
    _cycle.Dispose();
    _limit.Dispose();
    _album.Dispose();
    return true;
}

Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-09 12:58:46
After finally realizing the power and usability of this component thanks to marc2003's samples I decided to start with a small customizable Now Playing script to get my feet wet.
The script is available here : http://dl.dropbox.com/u/3317443/wsh_now_playing_scroll.txt (http://dl.dropbox.com/u/3317443/wsh_now_playing_scroll.txt)
Sample usage (the panel marked out in red):
Also, I'm having trouble displaying dynamic bitrate. Any suggestions? I've tried reloading g_metadb through the on_playback_dynamic)info callback to no avail.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-09 12:59:39
@Fractal_Mortality

ah you can't edit "artist_tf" like that. what it displays is also used to query last.fm

edit: i've updated it so the display is completely independent of what is sent to last.fm. you can now change those fields as you like.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-05-09 13:58:09
@Fractal_Mortality

ah you can't edit "artist_tf" like that. what it displays is also used to query last.fm

edit: i've updated it so the display is completely independent of what is sent to last.fm. you can now change those fields as you like.

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)


You are the man. I'll try this when I get home.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-09 14:22:31
Also, I'm having trouble displaying dynamic bitrate. Any suggestions? I've tried reloading g_metadb through the on_playback_dynamic)info callback to no avail.


something like this....

Code: [Select]
function on_playback_dynamic_info() {
    bitrate = fb.TitleFormat("%bitrate% kbps").Eval();
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-09 14:39:07
Thanks ^.^

I'm modifying your last.fm charts sample now for use with artist top tracks and albums, excellent sample. More and more I find my config being overtaken by wsh panels.
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-10 05:30:20
marc2003, I've been looking at the Last.fm webservices and I'm interested in creating a script that downloads the album art as denoted by the 'image size="large"' tag in the album.getInfo method. I was assuming your artist art downloader script performs a similar service and your art.exe could be used to download the album art as well, but I can see that its use is limited to artist art. Can you direct me to the tools I would need to create the album art downloader script (or perhaps merely to a similar already existing script)?

I guess if there's no other feasible option I could simply provide the url for the album art in the panel.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-10 09:51:43
it is actually possible to download images directly using WSH panel mod.

http://www.hydrogenaudio.org/forums/index....mp;#entry680952 (http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&st=600&p=680952&hl=download&#entry680952)

but as i was already happily using art.exe, i saw no reason to change. after all, it's only a few kb in size.

i didn't make the art.exe program. that was made by another forum member, paradog (http://www.hydrogenaudio.org/forums/index.php?showuser=53710).

http://www.hydrogenaudio.org/forums/index....c=77425&hl= (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425&hl=)

thanks to him for providing the source code - i had to modify it slightly so it runs silently without any user intervention. and that's why i've bundled my changed source code with the .exe - i'm hopefully complying with the terms of the original license.

it's made in c# and can be modified/compiled using visual studio c# express edition. it's free but a fairly hefty download and it does install a fair amount of crap.
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-10 12:05:53
Thanks again! That piece of code works beautifully. The only problem is that the script locks up foobar while it downloads the file, a minor price to pay but is there a way to avoid this? Or possibly I'm doing something wrong?

The script: http://dl.dropbox.com/u/3317443/wsh_now_pl..._lastfm_art.txt (http://dl.dropbox.com/u/3317443/wsh_now_playing_lastfm_art.txt)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-10 12:19:13
if you read that post again, the person who orginally made that snippet has the same issue. i wouldn't know if there is any way around it.

but it should be fairly trivial to modify the art.exe program. i'll have a look later on.
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-10 12:27:27
Oh... well, if you can make that modification to art.exe it would awesome. Otherwise, the way I have it setup right now I've bound the download to a click action so I can at least decide when to download the art and be ready for the freeze. Again, a very minor price to pay.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-10 14:54:10
it took more effort than i expected. also, i don't know proper programming so it's a real hack job. it works though...

it takes 4 arguments

<artist> <album> <path> <filename with no extension>

eg

Code: [Select]
album.exe "Bat For Lashes" "Fur And Gold" "c:\music\bat for lashes\fur and gold" "folder"


it would then save as folder.jpg or folder.png depending on what it finds.

http://cid-649d3bfeaf541fbb.office.live.co...guide/album.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/album.zip)
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-10 17:23:09
Thanks a lot. That does the job perfectly  I'm still keeping the last.fm webservices code I was using earlier as an option so I can download the mega version of some art if I want to, also my earlier script gives me an indication as to whether album.exe will find anything at last.fm or not.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-10 17:31:39
it already downloads the "mega" image. with the few albums i tested, they aren't very big anyway.
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-10 17:36:50
Hah I was just about to edit my post to indicate that I meant large (300x300) and not mega  I try and avoid the really huge album arts because they make my np script cpu heavy when repainting the panel with huge images.

Also, is there a way to export embedded album art via this panel? Like open it in an image object and write it to a file. I was looking through activexobjects, but couldn't find a solution.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-10 17:39:47
i should be able to make it accept the size as an another argument on the commandline.
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-10 17:41:28
That would be great. Hope it's not too much trouble.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-10 18:08:20
done. same link as above. now takes 5 arguments with size being the last one.
Title: WSH Panel Mod script discussion/help
Post by: Dead Phoenix on 2011-05-10 18:14:34
Nice. I peeked into the fetchArt.cs too, looks good 
Title: WSH Panel Mod script discussion/help
Post by: Eveningstar on 2011-05-12 16:39:01
I have a small Request, I would like a script that  shows recently played from Last.FM and if possible
a link to the last.FM page of the song.
If this is possible would you mind writing the script ?

Thanks in advance.
Title: WSH Panel Mod script discussion/help
Post by: Wael on 2011-05-18 00:52:11
How can I make an image appear for a second? I have a panel that displays album art and now playing details and I have some basic gesture controls togo to next track, previous track, volume up, and volume down and I want an image to appear when one of these gestures is completed.
Here's my current (sloppy) code:
Code: [Select]
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));}

var artist = fb.TitleFormat("$abbr(%artist%,19)");
var title = fb.TitleFormat("$abbr(%title%,19)");
var album = fb.TitleFormat("$abbr(%album%,19)");
var codec = fb.TitleFormat("%codec% $if($strcmp(%codec%,'MP3'),%codec_profile%)");
var bitrate = fb.TitleFormat("%bitrate%");
var playcount = fb.TitleFormat("%play_count%");
var ww=window.Width;
var wh=window.Height;
var col = RGB(255, 255, 255);
var col1 = RGB(255,0,0);
var col2 = RGB(255,128,0);
var col3 = RGB(255,255,0);
var col4 = RGB(0,255,0);
var hoffset = 4;
var paused;
var btndwn;
var x1;
var y1;

function on_item_played(metadb) {window.Repaint();}
function on_playback_edited(metadb) {window.Repaint();}


function get_album_art(metadb) {
    if (metadb)
        return utils.GetAlbumArt(metadb.RawPath, 0);
}

function on_mouse_lbtn_down(x, y, mask){
    btndwn = true;
    x1 = x;
    y1 = y;
}

function on_mouse_lbtn_up(x, y, mask){
    if (btndwn){
        var tlrnce = 10;
        btndwn = false;
        if ( (x>x1 + tlrnce) && (y < y1 + tlrnce) && (y > y1 - tlrnce) ){
            fb.Next();
        }
        if ( (x<x1 - tlrnce) && (y < y1 + tlrnce) && (y > y1 - tlrnce) ){
            fb.Prev();
        }
        if ( (y<y1-tlrnce) && (x < x1 + tlrnce) && (x > x1 - tlrnce) ){
            fb.VolumeUp();
            fb.VolumeUp();
        }
        if ( (y>y1+tlrnce) && (x < x1 + tlrnce) && (x > x1 - tlrnce) ){
            fb.VolumeDown();
            fb.VolumeDown();
        }
        window.Repaint();
    }
}

var g_img = null;

on_playback_new_track(fb.GetNowPlaying());

function on_paint(gr) {
    gr.FillSolidRect(0,0,ww,wh,RGB(96,96,96));
    var font = gdi.Font("Verdana", 15, 1);
    var spacing = 15;
    var voffset = 4;
    var img_size;
    if(wh-spacing*6+10>ww){
        img_size=ww;
    }else{
        img_size=wh-spacing*6+10;
    }
    if (g_img) {
        gr.SetInterpolationMode(7); // Highest quality and also slowest
        gr.DrawImage(g_img, 0, spacing*6+10, img_size, img_size, 0, 0, g_img.Width, g_img.Height);
    }
    if (paused){gr.DrawImage(gdi.image( fb.FoobarPath+"Images\\pause.png"), 0, spacing*6+10, img_size, img_size, 0, 0, 500, 500,0,255);}
    if (fb.IsPlaying){
        gr.GdiDrawText(artist.Eval()+"&", font, col, hoffset, voffset, ww, wh);
        gr.GdiDrawText(title.Eval(), font, col, hoffset, voffset+spacing, ww, wh);
        gr.GdiDrawText(album.Eval(), font, col, hoffset, voffset+2*spacing, ww, wh);
        gr.GdiDrawText(codec.Eval(), font, col, hoffset, voffset+3*spacing, ww, wh);
        if(bitrate.Eval()<=128){
            gr.GdiDrawText(bitrate.Eval(), font, col1, hoffset, voffset+4*spacing, ww, wh);
        }else{
            if(bitrate.Eval()<=192){
                gr.GdiDrawText(bitrate.Eval()+" kbps", font, col2, hoffset, voffset+4*spacing, ww, wh);
            }else{
                if(bitrate.Eval()<320){
                    gr.GdiDrawText(bitrate.Eval()+" kbps", font, col3, hoffset, voffset+4*spacing, ww, wh);
                }else{
                    gr.GdiDrawText(bitrate.Eval()+" kbps", font, col4, hoffset, voffset+4*spacing, ww, wh);
                }
            }
        }

        if(playcount.Eval()==0){
            gr.GdiDrawText("Never played", font, col, hoffset, voffset+5*spacing, ww, wh);
        }else{
            if(playcount.Eval()==1){
                gr.GdiDrawText("Played once", font, col, hoffset, voffset+5*spacing, ww, wh);
            }else{
                if(playcount.Eval()==2){
                    gr.GdiDrawText("Played twice", font, col, hoffset, voffset+5*spacing, ww, wh);
                }else{
                    gr.GdiDrawText("Played "+playcount.Eval()+" times", font, col, hoffset, voffset+5*spacing, ww, wh);
                }
            }
        }
    }else{
        gr.DrawImage(gdi.image( fb.FoobarPath+"Images\\foobar.png"), 0, spacing*6+10, img_size, img_size, 0, 0, 500, 500);
    }
}

function on_mouse_lbtn_dblclk(x, y, mask){
    if (y>100)
        fb.Pause();
    }

function on_playback_pause(state){
    paused=state;
    window.Repaint();
}

function on_playback_time(time){
    window.Repaint();
}


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

function on_playback_new_track(metadb) {
    if (!metadb) return;
    paused=false;
    g_img = get_album_art(metadb);
    window.Repaint();    
}

function on_playback_stop(reason){
    g_img=gdi.image( fb.FoobarPath+"Images\\foobar.png");
    paused=false;
    window.Repaint();
}


Also great thread I've learned a lot by looking at your codes so thanks a lot to everyone that posted here! And I apologize if anyone already answered this question I searched around for a bit but I didn't find an explanation on how to do it.
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2011-05-18 10:57:03
I updated my scripts recently using the latest samples.zip on you Windows Live space. I am getting some odd results with the last.fm simple biography script.

Some artists the biography appears fine and all text is visible and I am able to scroll up and down. Other artists only 2 or 3 lines appear followed by ... although there is plenty of space in the window for the remaining text. If I make the WSH panel wider then some of the text appears.

(http://img805.imageshack.us/img805/1345/bio1.png)
(http://img683.imageshack.us/img683/5226/bio2i.png)
(http://img585.imageshack.us/img585/7701/bio3.png)
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2011-05-18 11:29:22
Is there a sample on how to create something which you can drag? i.e. images or text.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-18 11:31:37
@djphatic... and you haven't modified the script at all? i find it hard to believe that would happen with my original. 

)[/size]

also, right click the panel and hit update. that will force it to download the page from last.fm again (but i really don't think that could be an issue either?????  )
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-19 23:43:04
samples updated: http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip (http://cid-649d3bfeaf541fbb.office.live.com/self.aspx/.Public/foobar/guide/samples.zip)

cd jewel case: added context menu option to toggle shadow/gloss effects on or off.
Title: WSH Panel Mod script discussion/help
Post by: YoPen on 2011-05-20 09:19:26
Hi to all.
How can I open DSP component from external button instead from main menu.The following comand doesn't work for DSP only for the Equalizer :
Quote
var imgPath = configPath + "Buttons\\Control\\";

Buttons.a = new Button(0, 22, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.RunMainMenuCommand("View/Equalizer");});
Buttons.b = new Button(83, 22, 58, 14, {normal: imgPath + "AddOnLeft.png", hover: imgPath + "AddOnLeftMH.png"}, function(){fb.RunMainMenuCommand("View/DSP/Crossfader");});
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2011-05-20 10:36:25
@djphatic... and you haven't modified the script at all? i find it hard to believe that would happen with my original. 

also, right click the panel and hit update. that will force it to download the page from last.fm again (but i really don't think that could be an issue either?????  )


No, haven't modified the script at all - exactly the same from the zip. I tried the force update but it didn't make any difference.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-20 12:18:00
well sorry but i can't reproduce that at all. i know the width of the panel isn't the problem because the last.fm logo is drawn in the right place. very odd!

if you were using an older version of my scripts, did you overwrite the "marc2003" folder with files from the latest zip?
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2011-05-20 12:51:19
if you were using an older version of my scripts, did you overwrite the "marc2003" folder with files from the latest zip?


Yep, just done it again to make sure. I'll try a clean install of foobar later and let you know how I get on. It is odd how the script works fine for some artists and not others.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-20 13:08:06
Hi to all.
How can I open DSP component from external button instead from main menu.The following comand doesn't work for DSP only for the Equalizer :


what component are you using to see a "DSP" submenu on the "view" menu? because i don't see one, even when holding down shift?

EDIT: updated my samples as well.

now playing: fixed error when using foo_skip
Title: WSH Panel Mod script discussion/help
Post by: YoPen on 2011-05-20 13:42:42
Hi to all.
How can I open DSP component from external button instead from main menu.The following comand doesn't work for DSP only for the Equalizer :


what component are you using to see a "DSP" submenu on the "view" menu? because i don't see one, even when holding down shift?



I use foo_vst_0903
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-20 14:03:20
if you look at file>preferences>keyboard shortcuts, under View>DSP, you'll see each option is

DSP #1 config
DSP #2 config
etc

if you use these in WSH panel mod, it works.
Title: WSH Panel Mod script discussion/help
Post by: djphatic on 2011-05-20 14:10:44
if you were using an older version of my scripts, did you overwrite the "marc2003" folder with files from the latest zip?


Yep, just done it again to make sure. I'll try a clean install of foobar later and let you know how I get on. It is odd how the script works fine for some artists and not others.


Clean install with latest versions of everything the script appears to be working fine in DUI and CUI.
Title: WSH Panel Mod script discussion/help
Post by: YoPen on 2011-05-20 14:25:14
if you look at file>preferences>keyboard shortcuts, under View>DSP, you'll see each option is

DSP #1 config
DSP #2 config
etc

if you use these in WSH panel mod, it works.

Thanks WORK!
Title: WSH Panel Mod script discussion/help
Post by: Pintu on 2011-05-25 19:04:05
Hi marc2003, first of all thanks for your amazing scripts. They really revolutionized my Foobar2k use. I have one question/request: I am using the thumbs2 script to show artist pictures. Would it be possible to combine both Last.fm + Custom folder at the same time? I have some unique artist pictures, but would like to see them at the same time as Last.fm pictures without the need to switch manually. Thanks a lot, Pintu.
Title: WSH Panel Mod script discussion/help
Post by: Dexter_prog on 2011-05-29 00:39:29
For some reason marc2003 lastfm WSH script is producing some weird behavior in my config, does anyone know what's happening?
(http://i.imgur.com/v7eAK.jpg)
(http://i.imgur.com/OMg6Q.jpg)
(http://i.imgur.com/ybfEB.jpg)

(first screenshot if before adding the script)

I noticed that if I modify the size on this line, the size of that white box gets bigger or smaller, but I just don't know which values to use:
function on_size(){
Code: [Select]
    window.MaxHeight = window.GetProperty("mini") == 0 ? 350 : 20;
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-29 01:13:45
that last.fm script is nothing to do with me. stuff like window.MaxHeight should only be used in default UI. as you've found out, it causes strange effects in columns UI. you could just try removing the line altogether. but for anymore help, go and ask who made it.
Title: WSH Panel Mod script discussion/help
Post by: roded on 2011-05-29 15:34:04
well sorry but i can't reproduce that at all. i know the width of the panel isn't the problem because the last.fm logo is drawn in the right place. very odd!

if you were using an older version of my scripts, did you overwrite the "marc2003" folder with files from the latest zip?


Same problem here..
(http://imgur.com/TNBK3.jpg)
Tried replacing all your code with a newer version.
Let me know if there's anything I can help with.

Amazing work by the way,
Thank you very much.
Roded
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-29 16:24:09
you guys have some strange setups. 

Title: WSH Panel Mod script discussion/help
Post by: roded on 2011-05-29 18:58:18
My 2 cents are that there's something fishy about this line..

Code: [Select]
textheight = gr.MeasureString(g_text, g_font, 6, 0, ww-16, 9999999999).Height;

Doesn't seem to return the height of the entire string.
Setting textheight to a random large number fixes the issue although adds a lot of blank space at the bottom.

So I'm not sure it's the foobar setup which is causing this..
Roded
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-05-29 19:36:14
well the only variable there that can differ between setups is the font. it uses whatever is set in the default UI/columns UI main font preferences???
Title: WSH Panel Mod script discussion/help
Post by: roded on 2011-05-29 21:14:07
well the only variable there that can differ between setups is the font. it uses whatever is set in the default UI/columns UI main font preferences???


Tried playing with the font, didn't change much.
Another wild guess I can make is that there's a mixup somehow in the interface between the PageUnit/PageScale units being read with MeasureString and those being used to draw the rect.
But that's really just an uneducated guess.

The MeasureString call returns a height of 95.765625 for a 1044 character string using the Segoe UI font (9pt) with "ww" equaling 303.
It returns the chars member to be 151 and lines to 6.

Roded
Title: WSH Panel Mod script discussion/help
Post by: WizzyKid on 2011-05-31 21:13:06
Hey again Marc,

Firstly big thanks for providing all the examples. They're really helpful!

I am using the code you provided for the DUI buttons script, and it works just fine. I have two buttons which when clicked, will set track skip on or off in my custom database, which in turn I have a playlist column which displays a ♪ when a track is to be played and displays nothing when it to be skipped.

Is it possible to set to set up the panel so that when either of the buttons are pressed, it will update the tracks which I have selected instead of just the one that is currently playing? As if I was doing it through the legacy commands in the context menu?
Title: WSH Panel Mod script discussion/help
Post by: Dexter_prog on 2011-06-02 15:36:52
nevermind, I've just realized I don't need what I asked for.
Title: WSH Panel Mod script discussion/help
Post by: Snik4er on 2011-06-05 08:19:51
Why this is coming out:

Scripting Engine Initialization Failed (GUID: E4CCA7C1-561B-44DA-B13C-FA76F815948D, CODE: 0x80020101)
Check the console for more detailed information (Always caused by unexcepted script error).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-05 08:50:54
if only there was some way of viewing more detailed information about the error. 
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-06-06 18:26:33
Hey Marc! It's your favorite user back with an annoying question.

On your auto-playlist script, is there a title formatting I could use to limit a playlist in size? Ie if I wanted to generate a playlist that was no larger than 2000 songs?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-06 18:40:41
not possible. all it does is support the standard query syntax that you use in the normal "Library>Search".

http://wiki.hydrogenaudio.org/index.php?ti...00:Query_syntax (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Query_syntax)

i believe foo_random_pools is the only component that supports limiting of any kind.

Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2011-06-06 21:29:50
not possible. all it does is support the standard query syntax that you use in the normal "Library>Search".

http://wiki.hydrogenaudio.org/index.php?ti...00:Query_syntax (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Query_syntax)

i believe foo_random_pools is the only component that supports limiting of any kind.


Gotcha. Well, come to think of it, I can probably rig something up in random pools that will do what I want.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-06-16 13:59:04
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?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-16 14:53:13
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?
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2011-06-16 15:01:52
Works for me also.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-06-17 03:16:30
Yes, there are pictures on last.fm

An artist that isn't working is Elsiane.
http://www.last.fm/music/Elsiane (http://www.last.fm/music/Elsiane)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-17 04:58:42
i've never heard of Elsiane so i tagged a dummy file just to make sure it works from within foobar. it does....

(http://dl.dropbox.com/u/22801321/elsiane2.png)

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

(http://dl.dropbox.com/u/22801321/elsiane.png)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-06-17 13:02:22
Hrmm...

(http://lulzimg.com/i23/33903c.png)
Title: WSH Panel Mod script discussion/help
Post by: vogliadicane on 2011-06-17 13:43:05
Elsine or Elsiane?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-17 14:17:07
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= (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425&pid=684105&mode=threaded&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.

(http://dl.dropbox.com/u/22801321/elsiane3.png)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-06-19 01:55:32
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>
Title: WSH Panel Mod script discussion/help
Post by: davig on 2011-06-21 16:27:52
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?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-21 17:06:12
docs\interfaces.txt in the main component download.
Title: WSH Panel Mod script discussion/help
Post by: davig on 2011-06-21 21:34:02
docs\interfaces.txt in the main component download.


thank you for the answer 
Title: WSH Panel Mod script discussion/help
Post by: TakuSkan on 2011-06-21 23:46:46
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 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=746784) 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
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-22 00:25:34
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. 
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-06-22 00:28:38
Any thoughts on my art.exe problem, marc2003?
Title: WSH Panel Mod script discussion/help
Post by: TakuSkan on 2011-06-22 02:29:38
... 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
Title: WSH Panel Mod script discussion/help
Post by: tnnds on 2011-06-22 02:35:40
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)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-22 02:54:01
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. 
Title: WSH Panel Mod script discussion/help
Post by: TakuSkan on 2011-06-22 03:33:13
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
Title: WSH Panel Mod script discussion/help
Post by: tnnds on 2011-06-22 06:03:43
if button's width=100
1st=0
2nd=100(width)
3rd=200(width*2)
....
Title: WSH Panel Mod script discussion/help
Post by: TakuSkan on 2011-06-22 06:16:43
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
Title: WSH Panel Mod script discussion/help
Post by: tnnds on 2011-06-22 06:25:42
var bw = 32;
var bh = 32;

you can change it to 24 or 16...any size you want
Title: WSH Panel Mod script discussion/help
Post by: TakuSkan on 2011-06-22 09:07:17
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...   
Title: WSH Panel Mod script discussion/help
Post by: TakuSkan on 2011-06-25 04:24:23
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
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-26 20:45:01
^utils.FileTest can check for files.

samples updated and now using a new link: http://dl.dropbox.com/u/22801321/samples.zip (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:

(http://dl.dropbox.com/u/22801321/echonest_img.png)

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.




Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-26 21:25:40
Hello marc2003,

my dui layout consists of 4 sections: 1. all my library viewers, podcast manager, playlist manager and playlist search, 2. tabbed playlist view, 3. playback section with now playing panel, queuecontents editor, wave seekbar, visualisation, bookmark panel, playbackrelated buttons and 4. all the selection info viewers with a toolbar with many, many buttons related to context menu. What i like about the 4. section is that all is acting synchron and even the toolbar buttons are dependent of the global settings in preferences -> display so when i apply a command from button i can be sure that it will be applied on what i see and what i see is in every viewer the same.

There are a few samples you've created that i find quite amazing: similar artist, last fm biography and mainly the artist art thumbs, not to forget the last one that deals with echonest. I would like to place them in my selection info section/tab container but then the pretty synchronicity gets lost as your scripts follow a different logic than the typical dui ui-elements. I suppose that it is not realizable but i prefer to ask someone who knows.

3 points must be possible to make the scripts acting like an ui-element:


Edit: typo/comprehendibility
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-26 21:36:17
the way it currently behaves (follow now playing, follow selection when playback is stopped) is purely a selfish design choice by me for the way i use it. i guess i'll have to look at adding user options. 

it's not helped by the fact i never plan things through before i start. i get bare functionality working first and then start layering crap on top and it gets harder to change.

Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-26 21:44:16
An user option like "Dui selection info viewer" would make me ... amazingly happy? I don't know the right word in english! 

If it shouldn't be possible technically and the third point - your willingsness - exists i can request what is needed from T.P. Wand in WSH Panel Mod thread. Thanks so far!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-26 22:11:09
adding an option to prefer playing or selected track is trivial and i'll probably post an update in a few hours.

i'm not sure how to handle multiple selections though. i might look into it if i get really bored.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-26 22:15:20
adding an option to prefer playing or selected track is trivial and i'll probably post an update in a few hours.

I am not sure if you've understood what i am after. I mean following what is set in global preferences in display. I often switch this option and the dui selection info viewer are following this.

It seems to me that you are planning a way that would perfectly fit in CUI and how musicmusic implemented his viewers: different options in context menu of the viewer rather than the global one.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-26 22:26:14
it's possible to use that as well. this will take more time to test though because i need to make sure my scripts work in columns UI as well.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-26 22:28:32
Thank you so much, i am very curious to see the results.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-26 23:10:25
can you test this for me to see if it works as you expect. browse your profile\marc2003 folder and replace common.js with this.

http://dl.dropbox.com/u/22801321/common.js (http://dl.dropbox.com/u/22801321/common.js) <<this will break all other scripts

and then import this into a biography panel:

http://dl.dropbox.com/u/22801321/simple%20bio.txt (http://dl.dropbox.com/u/22801321/simple%20bio.txt)
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-26 23:52:26
Wow, except from one point it seems to fullfill every expectation. I should do more testing but i have to wake up at six for work - i will continue tomorrow in the early evening.

Let me sum up my little testing:

What works:

1. It follows the global: prefer selection or prefer playing track.
2. If selection is preferred and at same time a track is playing then playing track is displayed if selection looses focus

What not works:

3. If selection is preferred and at same time a track is not playing then [edit]on selection loosing focus[/edit] dui ui-element shows nothing and your biography shows furthermore the selection. It is the same logic like in (2.): If a selection looses focus (not sure if i am describing that behaviour in correct terms) then the selection isn't shown but either nothing or played track in case of playback. No question: that is somehow annoying and Peter already told that this is going to be changed someday but that's how it is now.

Good night!
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-06-27 01:03:25
marc2003, I updated your sample configs and the Thumbs panel still won't download album art. It displays images it got previously, but it won't get anything new. If this can't be fixed, could you tell me how to add images manually for the handful of artists in my library I don't yet have images for?

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-27 02:21:37
right click the panel>open containing folder and dump the images in explorer. then reload the script and it will display the images. i still have no idea why that program has stopped working for you.

one thing i forgot to mention about my latest update: the last.fm scripts now cache files using a different file extension meaning all the old files are now useless. you can delete all .xml files from your profile\wsh_lastfm folder. that should save a few kilobytes. the scripts now use JSON.

EDIT:

large update ahoy. the following scripts now have a new context menu option to choose "selection mode". because of large background changes, they all need re-importing.

artreader
cd jewel case
echonest
similar artists
simple biography
thumbs
thumbs2
thumbs3


by default, they will now use the main foobar display preferences but you can over ride this on a per panel basis.

(http://dl.dropbox.com/u/22801321/selection%20mode.png)

weblinks and rating now use the main foobar preference and there is no option to change it (for now).

lastfm charts and similar artists have had some little bugs squished. all other scripts unchanged.

download: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

if you use my last.fm playcount script, that will need updating to the latest version. it works exactly as before. you don't get a choice but it needed some background changes to work.

you can grab that here: http://dl.dropbox.com/u/22801321/playcount%20sync.zip (http://dl.dropbox.com/u/22801321/playcount%20sync.zip)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-27 06:52:05
updated again: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

echonest: fixed crashes with broken content. my fault for not double checking in the first place. 
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-27 18:22:15
If a selection looses focus ... then the selection isn't shown but either nothing or played track in case of playback.
That's how dui elements work. I gave expressed my complaint abut that confusing behaviour in an own thread more than one and a half ago. I was told that Peter announced that this going to be changed someday but till now nothing happened.

If it is possible and mainly not much work i would really appreciate if your scripts would show also nothing on selection focus lost in case of no playback. I can give a good reason why it is senseful to do so: If a selection info viewer doesn't show nothing then also the buttons in toolbar and all hotkeys defined by context menu commands also do nothing - the presence of information in your script can lead to confusion that buttons/hotkeys have a content to be applied on.

At last let me thank you not only for the last changes you've made but also for your effort to keep your scripts so userfriendly.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-27 21:04:53
from what i can see there is no way for me to detect when a playlist item loses focus.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-27 21:10:25
Oh, i think i should ask T.P.Wang for an function or just wait  till Peter removes this fallback for viewers, buttons and hotkeys. At friday i am in vacation for two weeks and when i come back i will decide me. 

Thanks so far!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-28 00:27:21
@q-stankovic, i now remember experimenting with this selection problem quite awhile ago. see my post here....

http://www.hydrogenaudio.org/forums/index....mp;#entry689083 (http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&st=720&p=689083&hl=getselection&#entry689083)

back then i think it worked the way you wanted it to. of course it was no good for me because i wanted to interact with the panel so T.P "fixed" it.

also, an update for echonest: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

-fix first item being highlighted on script startup.



Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-28 19:22:47
back then i think it worked the way you wanted it to. of course it was no good for me because i wanted to interact with the panel so T.P "fixed" it.
It still works so in case of playback. In very rare cases even in case of no playback there is a fallback into no display - T.P didn't fix enough. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-28 21:02:25
i don't really see what your issue is then. you say it's rare for playback to be stopped and when foobar is playing, it works like you expect....
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-28 21:18:40
I think you misunderstood me: if there is no playback then your scripts won't show the typical fallback. Just sometimes (2% of 100%) and for me not reproducable even your scripts are falling back synchron to ui-elements and doesn't show the selection which focus was lost. I wanted to make a silly joke that T.Ps fix you talked about wasn't perfect.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-28 21:52:40
you're right, i don't understand.

currently the only issue is when playback is stopped, correct?

when you select single items it behaves exactly like the selection properties/default art panel.
when you select multiple items (or browse album list etc), it shows the first item selected and we have no control over that.
when you click on an blank area of a playlist or other UI element, selection properties updates to "nothing selected". at this point the script falls back onto the last item selected. what am i missing here?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-29 06:32:18
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

similar artists: i broke the last.fm radio links with my last update a few days ago. this fixes it.

i also renamed echonest to news-reviews-blogs so people will now have some clue what it is.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-29 08:31:59
another update   

news-reviews-blogs: improved date handling. should now show original article date if it exists. beforehand it only showed the date it was indexed.
Title: WSH Panel Mod script discussion/help
Post by: TakuSkan on 2011-06-29 09:02:41
^utils.FileTest can check for files.

Hmmm.... coding... I'm really lost on that one. Could someone provide an example line of code using it that would find .html and .pdf files in the audio file's folder and link it with a button?

Thx
TS
Title: WSH Panel Mod script discussion/help
Post by: tnnds on 2011-06-29 15:50:29
Is it possible to get the shouts about current playing song or artist?
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-06-29 23:53:32
@marc2003

your last update of news-reviews-blogs does not seem to work anymore: the panel always displays "Could not read this article"

Previous versions were working fine...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-30 01:37:56
^oops, you're right, i forgot to update one of the files in the zip. 

that's now fixed and i've also drastically reduced cpu usage when moving the mouse over it.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

import the script and make sure you extract the marc2003 folder as well.

@tnds, yes it's possible. see http://www.last.fm/api (http://www.last.fm/api)
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-06-30 12:45:39
@marc

How do i change the script so i can reduce the size of this ratings "box":
(http://i.imgur.com/Gk6oA.png)

I am draging the box from both sides, but it is not getting smaller.
I think this script is missing these lines:
var top_margin = 0;
var left_margin = 0;
These are included in other scripts (playcount), but i am not sure how can incorporate them here.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-30 13:44:33
you can resize it much smaller than that. the stars are automatically centred - that's why there are no margins to set.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-30 17:56:47
more bugs squished in news-reviews-blogs 

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

it's just the script needs importing. the other files haven't changed.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-30 18:43:23
The news-revie.blog script crashes always on importing.

Here is what the console says:
Code: [Select]
WSH Panel Mod: Warning: Could not load file C:\Users\[…]\Desktop\foobar2000\user-components\foo_uie_wsh_panel_mod\jscript.api
WSH Panel Mod: Warning: Could not load file C:\Users\[…]\Desktop\foobar2000\user-components\foo_uie_wsh_panel_mod\interface.api
WSH Panel Mod (Echonest by marc2003): Parsing file "C:\Users\[…]\Desktop\foobar2000\marc2003\common.js"
WSH Panel Mod (Echonest by marc2003): initialized in 5 ms
Error: WSH Panel Mod (Echonest by marc2003): Laufzeitfehler in Microsoft JScript:
Das Objekt unterstützt diese Eigenschaft oder Methode nicht.
Ln: 161, Col: 3
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-06-30 19:08:52
try extracting the marc2003 folder again. i know i said the latest update didn't need it but the previous update did.

i suppose my standard disclaimer should be to extract the files every time but i know that's a PITA.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-06-30 19:10:47
Oh, sorry for false alarm!
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-07-01 16:28:01
Is there any good volume script available?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-02 11:56:10
@Bryter, check the samples on the component home page.

@TakuSkan, something to show a button for PDF files. first you need to import web links and then replace the on_metadb_changed function with this...

Code: [Select]
function on_metadb_changed() {
if(!g_metadb) return;
pdf_file = fb.TitleFormat("$directory_path(%path%)\\music.pdf").EvalWithMetadb(g_metadb);
if(fso.FileExists(pdf_file)) {
pdf_img = "pdf.png";
pdf_h_img = "pdf_h.png";
pdf_func = function () { try {WshShell.Run(pdf_file); } catch(e) {} }
pdf_tooltip = "Open PDF file";
} else {
pdf_img = "no_pdf.png";
pdf_h_img = "no_pdf.png";
pdf_func = null;
pdf_tooltip = "PDF file not found";
}
Buttons = {
but1: new Button(left_margin,top_margin,bw,bh, {normal: images_path + pdf_img, hover: images_path + pdf_h_img}, pdf_func, pdf_tooltip)
}
window.Repaint();
}

you need to make 3 images yourself and put them in marc2003\images

pdf.png //to show when there is a pdf file
pdf_h.png //to show when is a pdf file and you're hovering your mouse over the button
no_pdf.png //to show when is no pdf file

Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-07-02 18:47:02
@Bryter, here's the volume script from my foobar2000:

(Notes: Read the code comments)
(Settings: Script Engine: JScript | Edge Style: None | Grab Focus: checked)
Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }

// gdi.Font is changed, the last paramter is style flags
// FontStyleRegular = 0,
// FontStyleBold = 1,
// FontStyleItalic = 2,
// FontStyleBoldItalic = 3,
// FontStyleUnderline = 4,
// FontStyleStrikeout = 8
// Here is 0, means FontStyleRegular
var g_font = gdi.Font("Verdana", 10, 0);
var g_drag = 0;

function on_paint(gr){
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
   
// var pos = window.Width * ((100+volume)/100);  // <--------- Old linear calculation
        var pos = window.Width * Math.exp(0.04*volume);  // <--------- Logarithmic calculation (as used in default volume slider)
   
var txt = "volume    " + (Math.ceil(volume)) + " dB";
gr.FillGradRect(0, 0, pos, wh, 0, RGB(40,42,57), RGB(204,0,0));
gr.FillGradRect(pos, 0, ww-pos, wh, 10, RGB(102,102,102), RGB(40,42,57));
gr.DrawString(txt, g_font, RGB(128,192,255), 0, 0, ww, wh, 0x11005000);
gr.DrawRect(0,0,ww-0, wh-0, 0.0, RGB(46,48,63));
}

function on_mouse_lbtn_down(x,y){
g_drag = 1;
}

function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}

function on_mouse_move(x,y){
if(g_drag){
var v = x / window.Width;
v = (v<0) ? 0 : (v<1) ? v : 1;

        // v = -100 * (1-v);          // <--------- Old linear scaling
        v = 25 *Math.log(v+0.00001);  // <--------- Logarithmic scaling (as used in default volume slider)
       
if(fb.Volume != v)
fb.Volume = v;
}
}

function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}

function on_volume_change(val){
window.Repaint();
}
//EOF
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-07-02 19:55:31
Thank you marc and  derty2
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-07-03 10:44:10
I am getting an "Aw, crashed " message on the art panel sometimes. This is what the console says:

"Error: WSH Panel Mod (Thumbs3 by marc2003): Microsoft JScript runtime error:
'g_img[...]' is null or not an object
Ln: 107, Col: 3
<source text only available at compile time>"


I have extracted the whole folder in the application data/foobar. I'm also using the playcount script that you created and i have extracted its files in the same folder (marc2003) where i have extracted the files for this samples.zip. Could that cause any issues?
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-07-03 11:53:51
Playcount script is also crashing sometimes. Console says:

"Error: WSH Panel Mod (Playcount Sync by marc2003): Microsoft JScript runtime error:
File not found
Ln: 145, Col: 6
<source text only available at compile time>"

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-03 12:22:09
using my playcount script and these samples work fine together but you need to make sure you're using versions downloaded at the same time together. you also need make sure you merge the marc2003 folders from both zips together. you can safely overwrite any files when prompted because the common files are the same in both zips.

given your playcount script error, i'd say you haven't done that because it's missing files that are only included in the playcount script download (either that or you haven't installed foo_customdb properly).

and that image script error is very odd because there is nothing on line 107 that would cause that??? and even if there was something related, the only thing i can think of is corrupted image files or problems reading from your hard disk???
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-07-03 12:28:01
Ok than ill give it another try. I will download samples.zip that you posted on June 30th and playcount sync.zip that was posted on June 26. Are these versions compatible with one another?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-03 12:36:01
a lot of changes have been made since the 26th so you should download new versions of each one.
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-07-03 20:10:22
I re-added all the components again, and the problem hasn't appeared in the last 3-4 hours. So i guess it is ok now...
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-08 19:03:02
Marc, thanks for your efforts on some very useful scripts.

Anyone, I'm trying to modify the artreader.exe script to add a capabilty I really like in the thumb scripts, which is the ability to double click on an image that is embedded in my song and open it my default image viewer.  I think I need to add code to save out the embedded image to a folder (perhaps in my profile folder) and then launch the image viewer.

I'm trying to add code just before the else statement below:

function on_mouse_lbtn_dblclk() {
   if(!g_metadb || !g_img) return;
   if(is_embedded) {
      fb.RunContextCommandWithMetadb("Open Containing Folder", g_metadb);
   } else {
      try {WshShell.Run("\"" + g_img_path + "\""); } catch(e) {}
   }
}


But my attempts are garbage.  If this is easy to do, any suggestions on what to add would be appreciated!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-09 01:08:43
well you can't extract images from files using WSH panel mod. you could launch tagging>edit attached pictures from the context menu.

else you can maybe find an application to extract images via the command line which can be triggered via WSH panel mod. i think it's unlikely there is an app that would work with multiple formats though.....

Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-09 17:31:55
Thanks for the suggestion.  I think I can use dbpoweramp's command line features to extract the art to a convenient folder.

Assuming I figure that out (still working on it), what else would I need to add make this work?
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-14 17:48:39
While I've concluded that my current capabilites aren't sufficent to do what I want (modify the artreader script to be able to click on displayed embedded art and launch and view in my default image viewer), if there is someones else out there with both ability and interest, I've learned the following with respect to applications that can extract images via command line for multiple formats;

- dBpoweramp (reference version) can do it via command line and I have done it, with the caveat that the reference version is not free, and the invoked utility demands overwriting all tags in your file.  So one would either need to be OK with that (dBpoweramp writes and overwrites tags reliably), or change all files to read-only

- MediaInfo seems capable of doing so via command line, but is far beyond my ability to figure out exactly how to do it.  The links to this application and a post that more specifically speaks to art extraction capabilies:
http://sourceforge.net/projects/mediainfo/ (http://sourceforge.net/projects/mediainfo/)
http://sourceforge.net/projects/mediainfo/...0/topic/4495644 (http://sourceforge.net/projects/mediainfo/forums/forum/297610/topic/4495644)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-14 19:26:08
Quote
MediaInfo::Get(Stream_General, 0, "Cover_Data"); You receive the cover in Base64 format, you need then to "transform" the base64 to binary (there are a lot of functions on the net for this)


that's not exactly working with the command line, is it? 
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2011-07-15 15:30:43
I'm modifying marc's thumbs2 script to remove art.exe dependency, got it mostly working but have slight issue with keeping file names in the same format.

How would I return the bolded part of string "http://userserve-ak.last.fm/serve/_/11168693/Brendon+Moeller.jpg" with jscript? The "_" part of url varies (e.g. "http://userserve-ak.last.fm/serve/500/...")
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-15 15:43:22
that 8kb taking up too much disk space is it? 

anyway, this assumes the number will always be before the last slash.

Code: [Select]
url = "http://userserve-ak.last.fm/serve/_/11168693/Brendon+Moeller.jpg";
temp_array = url.split("/");
num = temp_array[temp_array.length - 2];
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2011-07-15 15:55:12
Wow that was quick, thanks

Problem I have with art.exe is it sometimes hangs and I have to manually close it from task manager.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-15 16:02:07
there was a problem with the original version where it would hang if the artist wasn't found. but i fixed that over a year ago.
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2011-07-15 18:14:00
I got the one from your latest samples.zip. Can't pinpoint the cause, it just seems to "time out" sometimes. Next time it happens I'll let it stay on and see if it finishes over time.
Title: WSH Panel Mod script discussion/help
Post by: Harm on 2011-07-16 11:46:45
Does anybody know any way to merge two playlists using wsh panel mod? I have tried several things, but nothing seems to work. There is no dedicated method in IFbUtils and a sequence of fb.RunMainMenuCommand("Select all"), fb.RunContextCommand("Copy") and fb.RunContextCommand("Paste") does not work. Another strange thing is that fb.GetSelections() after fb.RunMainMenuCommand("Select all") only works with some delay and then only if the window is focused. Any suggestions are very welcome!

Title: WSH Panel Mod script discussion/help
Post by: orchid on 2011-07-16 13:57:50
Marc, think I found a bug in your similar artists script. It crashes if no similar artists found. Tried fetching list for artist "Groy" (http://www.last.fm/music/Groy), which is misspelled (should be GR-OY).
Code: [Select]
Error: WSH Panel Mod (Similar Artists by marc2003): Microsoft JScript runtime error:
'artists[...].name' is null or not an object
Ln: 74, Col: 5

similar.json contains:
Code: [Select]
{"similarartists":{"#text":"\n","artist":"GrOy"}}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-16 14:50:49
fixed: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)




Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-07-16 16:42:33
I noticed that in the newest versions of your scripts scrolling with mouse wheel works nicely so that the arrow up and down buttons are not necessary anymore. Can you make them optional or at least give me a hint where to take a look in your script to remove them on my own. My first attempt resulted in crashing the script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-16 16:56:32
scrolling has always been there - the up/down arrows are a relatively new addition.

anyway, the easiest way is to find the on_size function and change the value for but_x

Code: [Select]
but_x = -50;


should do it.

also, i just fixed a typo in last.fm charts that would it to crash if you entered an invalid username - but then again it serves people right who can't spell it anyway....
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-07-16 17:34:00
Hmm, i think the problem i meant still exists and i can explain why i thought it was removed. Maybe it depends of my mouse wheel that doesn't lock or latch (sorry, don't found better words on leo dictionary) The less the speed of scrolling the bigger the probability that scrolling has no effect: I have to scroll quickly for an effect what i generally do.

Edit

It seems to be a problem with my mouse! In facets with coverview i have the same phenomen. I could swear that i didn't had the phenomen with facets coverview or with your scripts for quite a time. However, i decided to by a new one because the missing locking/latching annoys me extremely.
Title: WSH Panel Mod script discussion/help
Post by: orchid on 2011-07-17 13:05:43
Marc, having a problem with the custom folder mode of your thumbs2 script.

Absolute path that has brackets (like E:\Music\B-C\Calibre\[2010] Even If) doesn't seem to work.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-17 14:03:17
oh FFS. i did write a function to take care of reserved characters in foobar title formatting but i forgot to use it..... 

on line 111 replace this....

Code: [Select]
folder = fb.TitleFormat(cycle_tf).EvalWithMetadb(g_metadb);


with

Code: [Select]
folder = fb.TitleFormat(tf(cycle_tf)).EvalWithMetadb(g_metadb);


i'll upload fixed versions for all my image scripts soon.

EDIT: fixed versions uploaded. this change means you can't use functions in title formatting so i've updated the text dialog as follows:

Quote
Enter a path to a folder. You can use title formatting tags like %artist% but not functions.

You can specify multiple folders using | as a separator.

         

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-18 09:58:44
i've decided to reverse my decision above and go back to how it was before. that way full title formatting functions can be used and if you want to include ()[] in your path then just wrap them in single quotes.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-18 17:25:15
another update for last.fm charts. panel would crash if last.fm didn't respond as expected. i really hope i've sorted this once and for all.

in theory, no matter what last.fm does now, none of my panels should crash (i fully expect this statement to come and bite me on the behind hard  )

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

Title: WSH Panel Mod script discussion/help
Post by: orchid on 2011-07-18 20:11:12
Hehe I'm trying hard to find more bugs.  And good call on the decision with reserved chars, rather use functions than absolute paths anyways.

Btw added couple of features to my panels which you might be interested in also. An auto download conditional option (auto_download_lib) to check if the file is in media library, as I don't want to fetch for new files. Maybe add some kind of "delete last.fm data if the artist has not been seen for X days" function?
Code: [Select]
function on_playback_time(time) {
    if(cycle > 0 && arr.length > 1 && (time % cycle == 0)) on_mouse_wheel(-1);
    if(window.GetProperty("auto_download_lib") && !fb.IsMetadbInMediaLibrary(g_metadb)) return;
    if(window.GetProperty("mode") == 101 && time == 1 && arr.length == 0 && window.GetProperty("auto_download")) download_images();
}

And changed the thumbs scaling method to keep original size for small images, unless "Stretch small images to panel size" (scale) option is checked
Code: [Select]
var s = 1;
if (window.GetProperty("scale") || img.width >= width || img.height >= height)
    s = Math.min(width / img.width, height / img.height);
var nw = Math.round(img.width * s);
var nh = Math.round(img.height * s);
pos_x += Math.round((width - nw) / 2);
pos_y += Math.round((height - nh) / 2);
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-18 21:56:32
Marc, an observation and suggestion:

I noticed when playing internet radio stations in Foobar that my Artist information panel (foo_uie_biography set to display artist information from last.fm or wikipedia) and my lyrics panel (foo_uie_lyrics2 set to display lyrics from viewlyrics.com and lyrdb.com) both were able to capture information from what was playing to correctly display the proper information. 

I also had your scripts running for lyrics, thumbs3, similar artists, and news/reviews/blogs, and I did not see those display content related to what was playing.  Your scripts didn't crash, they just displayed "[no image]" for Thumbs3, "nothing found" for News etc, Lyrics displayed the song name and artist correctly but never any lyrics, and Similar Artists tried to find artists that matched with "?".

It's far beyond my abilities to revise your scripts to have them grab the appropriate information from internet radio playback to work when listening to internet radio, but it would be great if you could consider such capabilies in the future.  My optimism tells me that if the older components could do this, perhaps this is not a big deal to add to your scripts (other than Lyrics, since your script works locally and the component can download) but I'm not technically proficient in these matters.

Thanks again for some very useful scripts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-18 22:01:31
can you link me to a station so i can test?

edit: you could just try adding this function anywhere in a script and see if it works.

Code: [Select]
function on_playback_dynamic_info_track() {
    on_item_focus_change();
}
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-18 22:38:51
Thanks for the fast reply.  I inserted the code such that I'm confident I didn't put it into the middle of an existing function, and here's what I observed both after hitting "apply", and after exiting and reopening Foobar just in case that mattered:

lyrics - didn't try, since I have no local information for the script to work with
News, etc, Similar Artists, and Thumbs3 - no change - same result as before.

I could briefly see that Thumbs3 tried to fetch images because that flashes on the screen for a second before returning "no image".


How I play an internet radio station:

- in Foobar, go to File>Preferences>Shell Integration>manage file type associations>, check the box for .pls files
- go to shoutcast.com
- go to "help", "settings", and select "play shoutcast stations in default media player"
- find a radio station you want to hear, click on it, and save the .pls file locally
- in Foobar, create a playlist and load this .pls
- double click on the playlist to stream it

an example link:

http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200 (http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-19 00:47:27
test these: http://dl.dropbox.com/u/22801321/radio%20test.zip (http://dl.dropbox.com/u/22801321/radio%20test.zip)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-19 02:27:24
I tried thumbs3, Similar Artists, and News-Reviews-Blogs - all perform perfectly.  Very impressive - thanks!
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-07-19 02:52:28
i get the MonoLite Mod-Slim (http://pengspawnie.deviantart.com/art/Mono...-Slim-147924669 (http://pengspawnie.deviantart.com/art/MonoLiteMod-Slim-147924669))
and volume & playback order is crash :x
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-19 11:14:03
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

the following scripts have been updated to support dynamic info in radio streams.

news-reviews-blogs
similar artists
simple biography
thumbs
thumbs2
thumbs3


existing users make sure you extract the marc2003 folder again and overwrite all files.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-19 14:12:33
The latest updates from post #995 all crash or fail to update with radio stations.  The test scripts from post #992 still work with radio stations.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-19 14:26:58
did you extract the marc2003 folder again as my post explicitly says? i did test before uploading...

one thing i did break with the last update is the ability to switch between last.fm and custom folder mode in the thumbs/thumbs2/thumbs3 scripts.

i've now merged them all into one script (simply thumbs) where you can select the thumbnail view. it wouldn't surprise me in the slightest if i've broken a load of stuff though.



EDIT2: oh balls. samples taken offline while i fix a major balls up.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-19 15:08:03
I extracted and overwrote everything as you instructed.  I also just tried deleting everything and then extracting and importing again in case overwriting wasn't happening - same crash results.  Thanks for your efforts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-19 15:17:25
i've just taken the download offline because they are seriously messed up. they're not crashing though - but they are creating folders where they're not supposed to. if you use foobar in standard mode, check %appdata%\foobar2000 and delete all randomly numbered folders (or if portable mode, check your foobar folder).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-19 16:31:31
hopefully fixed it  http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

just to be absolutely sure of a clean setup:

extract the marc2003 folder and overwrite all files when prompted
before importing the script into a panel, first use tools>reset default and close the editor. now right click>properties and click clear
now import the script.

edit: *sigh* custom folder mode still not working as expected.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-20 12:15:34
a few more bugfixes. not particlularly serious - afterall no one has reported these issues.

simple biography
fixed panel crash if changing the api key/username/language with no file selected
fixed broken artist remapping introduced a few days back (it still worked but not instantly after changing)

similar artists
fixed panel crash if changing the api key/username with no file selected

thumbs custom folder mode now working.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

one thing i don't think i have mentioned before but it came up in the EsPlaylist thread yesterday - if you use my thumbs script in last.fm mode and have a collection of artist art built up, you can configure foobar to use it as a source for other components. file>preferences>display>artist here you need to put the full path to your foobar profile folder  (or foobar folder if running portable mode) and append wsh_lastfm\$crc32(%album artist%)\*.* to the end. examples:

Code: [Select]
C:\Users\marc\AppData\Roaming\foobar2000\wsh_lastfm\$crc32(%album artist%)\*.*
D:\applications\foobar2000\wsh_lastfm\$crc32(%album artist%)\*.*


facets and EsPlaylist are 2 components that can make great use of this.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-21 11:12:32
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

thumbs restore open/delete image options to context menu. i forgot to enable this on the new all-in-one version. and hopefully fixed the last of the custom folder mode bugs. yes, i'm useless.....
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-07-22 16:25:21
as I know nothing about WSH Panel wanted to ask maybe you could do with a seekbar nyan cat like this:

(http://ibxk.com.br/76019/164692.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-22 21:39:16
i don't normally do requests but i'm in a silly mood.... 

(http://dl.dropbox.com/u/22801321/nyan%20cat%20progress%20bar.gif)

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

zip contains new images so make sure the marc2003 folder gets extracted again.
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-07-23 00:05:38
i don't normally do requests but i'm in a silly mood.... 


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-23 15:05:55
oh yippee, a nyan cat seekbar update. 

-now shows seek time when dragging
-can change background colour via the context menu
-when dragging, you can move the mouse out of bounds along the bottom of the panel to cancel seeking

(http://dl.dropbox.com/u/22801321/seekbar%20cat%202.png)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-23 19:33:58
The Thumbs script has stopped working for me - I can't figure out what has changed in my config to cause this.  I've reinstalled the WSH component, deleted and extracted all WSH script files, and reset the panel to defaults and cleared settings before re-importing.

The symptoms:

- upon starting play of a playlist, it tries to fetch images, but neither finds any to download nor finds what I've already downloaded (and kept in the default location)
- upon track change in the playlist, the panel crashes and the console shows the following:

Error: WSH Panel Mod (Thumbs by marc2003): Microsoft JScript runtime error:
Object expected
Ln: 145, Col: 18

Any suggestions appreciated.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-23 20:45:43
that indicates it's looking for a function that doesn't exist and that can only happen if you're using the marc2003 folder from a different zip download to the script itself???

try putting this at the start of the script and check the console output....

Code: [Select]
fb.trace(typeof bl);
fb.trace(typeof my_metadb_changed);


it should say

Code: [Select]
function
function


i suggest clearing your browser cache and trying again just to make sure you're not getting any old version. FWIW the dates of the files inside the zip of the latest version:

marc2003\common.js (last modified 2011-07-21 13:02)
other WSH samples (new)\thumbs.txt (last modified 2011-07-21 15:30)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-07-23 22:58:24
I screwed up the extraction of the Marc2003 folder - instead of extracting it to the roaming/Foobar2000 folder, I extracted it in place in the wrong spot.  Thanks again - everything works great!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-23 23:15:49
i would have expected the script to fail before that error you posted if the entire folder was in the wrong place??  oh well, at least it's working now....
Title: WSH Panel Mod script discussion/help
Post by: hejiamei on 2011-07-24 07:36:51
i would have expected the script to fail before that error you posted if the entire folder was in the wrong place??  oh well, at least it's working now....

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

I can't download from this web site

why don't you use the skydrive?

you use skydrive before, why now you don't use it?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-07-24 09:19:41
skydrive recently changed making it a complete nightmare to use. you can't post links to files anymore. also, dropbox allows to me work on stuff from all my computers and i don't have to consciously think about duplicating files. i just work on a file and then save it. it's much more convenient for me this way. i'm sorry if the link didn't work - i know the uptime isn't as good as skydrive but it's not usually down for long.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-01 02:39:54
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

-high cpu usage bug fix  no scripts need re-importing but i badly bodged a shared function causing 20-30% cpu usage in image heavy scripts like thumbs

existing users just extract the marc2003 folder overwrting older files.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-02 03:45:25
samples updated again.

i've decided to implement orchid's idea of having different automatic download options for images from last.fm. this applies to the thumbs and now playing scripts.

(http://dl.dropbox.com/u/22801321/automatic%20download%20options.png)

just for info, the automatic download is only triggered when playback starts and there are no images on the system already. you can always force a manual download via the context menu.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-04 02:19:57
Well, that darn art.exe still isn't working for me.

Do you think you would have the time and inclination to make a version of your artist image downloaded that doesn't rely on it? I remember you commenting a while back that artist images can be downloaded without it.

I really miss being able to automatically fetch pictures of newly added artists

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-04 21:13:56
can you test this .exe and see if it downloads images.

http://dl.dropbox.com/u/22801321/download.exe (http://dl.dropbox.com/u/22801321/download.exe)

you feed it 2 parameters - an image url and a folder.

Code: [Select]
download.exe http://userserve-ak.last.fm/serve/500/64564809/IVY++in+2011.png c:\test


Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-05 01:54:49
That works for me just fine.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-05 02:15:13
right, stick that .exe file inside the marc2003 folder and then test this script in a panel....

http://dl.dropbox.com/u/22801321/thumbs%20download%20exe.txt (http://dl.dropbox.com/u/22801321/thumbs%20download%20exe.txt)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-05 02:35:39
I just get [No Image] for everything, even for artists that I already got images for when the art.exe used to work.

Note that the "Open containing folder" option is grayed out...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-05 02:43:55
there is absolutely no difference between the way this displays art compared to the original.  the only difference is how it downloads it.

but i've just made a change to the script that will now let you open the containing folder even when it can't find any images. try that.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-05 02:48:11
Hmmm I was using one of your older thumbs scripts, back when you had different versions for different configurations (thumbs left, bottom, etc). Has the download location for pictures changed since then? Because if I download the latest "thumbs" script, it doesn't work either...

Anyway I tried the new script (same link as last one, yes?) but nothing changed.

Thank you for taking the time to help me with this!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-05 02:58:06
the folder location has never changed since the first release. so there must be something seriously wrong with your setup. 

the original download not working is one thing but for the new versions not to display the old images is completely un-fathomable.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-05 03:03:03
Haha great. Well that's bad news

I use a portable setup if that makes any difference....

Anyway the old scripts display the images just fine. The new ones do not. None download anything, whether using art.exe or download.exe...

Maybe it's time to reformat my machine and see if that helps!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-05 03:09:21
can you paste one of the old working scripts on pastebin so i can take a look. i'm certain i haven't changed the location but i suppose i'd better double check.

and are you also saying the new script doesn't work with download.exe even though it works fine from the command line? 
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-05 03:17:33
The new script does nothing at all. It won't display existing pictures, it won't download new ones... It just sits there saying [No Image]

Here's the script I've been using - this one shows existing pictures just fine.

http://pastebin.com/1y33k4t7 (http://pastebin.com/1y33k4t7)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-05 03:30:00
just as i thought - no change in folder location. how that displays images but the new one doesn't is beyond me.

as for the new script, i've just noticed if you set the limit to 1, it doesn't work. that's something i need to look into.

new download.exe version fixed to work with a limit of 1. http://dl.dropbox.com/u/22801321/thumbs%20download%20exe.txt (http://dl.dropbox.com/u/22801321/thumbs%20download%20exe.txt)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-05 12:07:14
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

thumbs: only trigger automatic download when selection is also the playing track.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-05 12:46:13
Woah.

Wake up this morning, start up my machine, and for some reason your download.exe one is working for me just fine
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-05 14:09:19
it's either magic or PEBKAC. i know where my money is......
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-06 20:51:43
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

now playing now shows when it's fetching images
last.fm charts you can now toggle the artist display on/off when displaying track or album charts.

artist display on
(http://dl.dropbox.com/u/22801321/lastfm%20before.png)

artist display off
(http://dl.dropbox.com/u/22801321/lastfm%20after.png)

also, all other scripts cleaned up and are using a new shared file meaning the marc2003 folder must be extracted. a side effect of these changes could mean custom background colours for certain panels being lost. simply use the context menu to set them again.
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-08-10 00:54:04
Well, I wanted a script to edit the tag for the music to "%skip% 1" for use with foo_skip, again if I click "%skip% = 0", and that I can edit the button image
(Sorry google translator is bad...)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-20 03:25:21
Marc2003, any idea why some artists get redirected to other artists in your last.fm bio script?

Trentemøller redirects to Talk Talk
Husky Rescue redirects to Bad Religion
Husky redirects to Troll Scientists

There are others I can't remember right now.

Interestingly, the artists that are redirected TO are also in my library...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-20 10:08:41
if i had your computer, i'd have thrown it away by now. you always get the most unexplainable problems that i can't ever reproduce.

try using update from the context menu.
or if it's lots of artists, browse your foobar2000 profile in windows explorer and search for and delete all files named artistinfo.json - this clears the all the cached data. i really can't explain how the wrong data gets saved for an artist????

if that doesn't work, please use foo_uie_biography from here. 

http://foo2k.chottu.net/#bv (http://foo2k.chottu.net/#bv)
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-08-20 12:45:20
Update works, thanks.

And I love my computer! It has... personality
Title: WSH Panel Mod script discussion/help
Post by: Dexter_prog on 2011-08-22 15:50:35
Is anyone using the lyrics panel scritp from Br3tt? It works ok but for some reason, in some lyrics it won't respect the line breaks so I get gigantic wall of texts, making them really hard to read.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-22 16:14:56
unless you post the script and an example of an lrc/txt file you're having problems with, it's impossible for anyone to help. 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-08-22 16:59:37
Is anyone using the lyrics panel scritp from Br3tt? It works ok but for some reason, in some lyrics it won't respect the line breaks so I get gigantic wall of texts, making them really hard to read.


maybe because there is no line break in your lyrics! my panel doen't add line break itself, it just displays the lyrics as they are and some lyrics files are not correctly written (no line breaks at all), but that's not concerning me
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-22 20:55:25
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

simple biography now uses a fixed sized font instead of using foobar defaults. this makes it much more readable on windows XP and scrolling is much better.

existing users make sure the marc2003 folder is extracted from the zip as a few background changes have also been made.
Title: WSH Panel Mod script discussion/help
Post by: Chaser on 2011-08-23 08:27:58
Thank you for your effort!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-23 22:03:21
@garbanzo.bean, it looks like i owe you an apology. i did manage to stumble across a bug that can cause the online info to get saved in the wrong place. it's hopefully fixed now: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

affected scripts:

last.fm charts
news / reviews / blogs
similar artists
simple biography


make sure the marc2003 folder gets extracted again.
Title: WSH Panel Mod script discussion/help
Post by: BelleAndZEK on 2011-08-23 22:35:00
Hello.
I asked a while ago in the foo_utils thread if I could find a specific word in a text (EAC ripping log) file and copy "true" or "false" to clipboard (using context menu) if the said word exists and marc2003 suggested I post in this thread here because apparently WSH Panel Mod can do so, so here I am.

I don't know JScript  nor VBScript but know the basics of scripting so if I could get help starting my script, I could do the rest myself.
If anyone has a few minutes to help me with it, here's what I want to do:

...

Select album in library view, right click and copy basic infos (%album%, %title%, etc..) to clipboard. This would be pretty easy I'm sure.
When I right click, I want the script to look for the .log file in the album folder and search for specific words in that log file and copy some infos to clipboard depending of the text it finds.

The .log file always has this line as the first one:
Exact Audio Copy V0.99 prebeta 4 from 23. January 2008
What I'm interested in copying to clipboard is the EAC Version from that line, so V0.99 prebeta 4 in this case, but it could be another version.
The script would have get the text after Exact Audio Copy and before the first instance of from.

I would also copy to clipboard "yes" or "no" depending if the script finds specific files in the album folder. For instance, if it finds a .CUE file then it's "yes".

And is there a way to get the image dimensions (width & height) from Cover.jpg in the album folder as well?
There are a few other things I'd like the script to do, like finding in the .log file how many tracks accurately ripped and how many didn't, but what I mentionned above would be a GOOD start.

Feel free to help me out, or not.
Thanks in advance or thanks anyway
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-23 22:52:15
you might want to check that thread again. there was no mention whatsoever of using this with the windows clipboard. 

edit: i wasn't sure if it was possible to use the windows clipboard but i just found out how . i can copy/paste text just fine.

cuetools is far better suited for checking log files and verifying if rips are accurate. see the thread here: http://www.hydrogenaudio.org/forums/index....showtopic=66233 (http://www.hydrogenaudio.org/forums/index.php?showtopic=66233)

i already have an album art reading script. it did used to display image dimensions but i removed it. i guess it would be fairly trivial to add it back again.

samples updated: simple biography now has a context menu item to copy text to the clipboard. kinda pointless but meh.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-24 00:13:03
too late to edit the last post again. another update, both the artreader and cd jewel case scripts now have a tooltip to show the image dimensions.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-24 14:17:44
simple biography updated. if you set a non-english language and there is no bio found, it can check again and look for english. you can turn this behaviour off via the context menu if you don't want it.

EDIT: a few more updates:

because of the above changes, simple biography can now update automatically again. also, playback stats for the artist are back.

thumbs now has a feature where it can read a URL from the windows clipboard and download the image to the current folder. if in custom folder mode and there are multiple folders, it uses the first one. it has fairly rudimentary checking - the url must being with http:// and end with either png, jpg or gif. to use, simply right click an image in a browser and select copy image location (wording may depend on browser). now right click the panel and you should see the option Download clipboard link to this folder.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-26 11:52:19
thumbs updated.

large improvements to performance when dealing with lots of images in a folder. the initial folder scan, panel resizing and settings change could still cause foobar to choke for a second or two but scrolling now works perfectly. i did this by stitching all the thumbnails into one image. just to note, this is only an issue when using silly amounts of images. using last.fm mode at the default of 5 or even the maximum of 20 is absolutely fine. it takes a fair bit more than that before you'd notice it.
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-08-28 20:26:40
@marc2003
request: last.fm charts panel without the "bar" and play button

example:
(http://img824.imageshack.us/img824/8615/imagecbo.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-28 20:53:26
http://pastebin.com/43p5BRYN (http://pastebin.com/43p5BRYN)
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-08-28 21:05:17
http://pastebin.com/43p5BRYN (http://pastebin.com/43p5BRYN)

thanks is beautiful *-*
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-08-28 22:03:12
simple request for the news/reviews/blogs script:  if the script is still fetching, could that be displayed by f.e. "[fetching info]". Some searches take a long time (means: a few seconds) so that you can't be sure the first 4 - 5 seconds if the script is still fetching or nothing has been found.

I like this echonest stuff: it f.e. let me know that there is a movie about "a tribe called quest". Have you checked how useful the other sources are or could be? Biographies (maybe there is a better one than in last.fm), video, audio, urls and so on.

By the way: an idea for an new script (youtube videos of a certain artist): 

(http://img828.imageshack.us/img828/2576/youtubeqm.jpg) (http://img828.imageshack.us/i/youtubeqm.jpg/)
(screenshot of amarok)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-28 23:39:27
well i've never seen it take more than a second but i've added a "fetching info" message regardless...

i've looked at the echonest biographies and all they have is last.fm and wikipedia. the rest of the sources aren't even a full sentence. i won't use wikipedia as there are no line breaks. it's just a huge wall of text and is unreadable. also, i believe ssenna's proper biography view component has a built in wikipedia reader.

i might take a look at what other info i can get from echonest if i can be bothered.

as for youtube, i already have a buttons script (web links) that will open youtube in a browser with the artist/title as the search term. i see no point in previewing this within foobar because you'd have to open a browser anyway. i know this contradicts what news/reviews/blogs does but youtube is a single site and is much easier to navigate than doing a google search for all the info that echonest provides.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-08-28 23:47:52
well i've never seen it take more than a second but i've added a "fetching info" message regardless...

Thanks! (In some rare cases i have to wait indeed 4 or so seconds.)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-31 10:40:01
samples updated: bug fix for all scripts that use a text input box. it wouldn't accept double quotes (") without crashing. this probably only affects the autoplaylists script. i doubt you would need " in anything else.

the marc2003 folder needs extracting again. no changes to the scripts themselves. edit: i forgot about some other changes i've made - scripts do need re-importing.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-08-31 16:46:10
marc, your update get crashs in this panel (sry my bad english)

http://pastebin.com/43p5BRYN (http://pastebin.com/43p5BRYN)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-08-31 16:53:54
http://pastebin.com/axuWvmb4 (http://pastebin.com/axuWvmb4)
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-08-31 17:31:34
thanks 
Title: WSH Panel Mod script discussion/help
Post by: dyermaker on 2011-09-10 14:07:52
thanks alot for the samples and all the work youve put into this marc, one step closer to foobar utopia
Title: WSH Panel Mod script discussion/help
Post by: Retro on 2011-09-13 01:30:57
Hey guys, I'm having an issue with the WSH panel mod for the first time & I have no clue what's going on. The plugin gave me absolutely no problems for months and then out of the blue I get these errors:

Quote
Scripting Engine Initialization Failed (GUID: 8AB1342D-F175-43E3-82E8-4E834CEBC60C, CODE: 0x80040154): Class not registered 

Scripting Engine Initialization Failed (GUID: 91399579-7135-44E5-8F2B-327FF7E647C9, CODE: 0x80040154): Class not registered

Scripting Engine Initialization Failed (GUID: 75880344-BD08-43C4-8D12-2FFDE4EA5F0F, CODE: 0x80040154): Class not registered

Scripting Engine Initialization Failed (GUID: 2E87E20B-BC5E-4A94-8A78-F15135F3E277, CODE: 0x80040154): Class not registered 

Scripting Engine Initialization Failed (GUID: 3034F0FE-42A2-4532-A8C4-34F84A6E0B2F, CODE: 0x80040154): Class not registered


I've been using this skin - http://browse.deviantart.com/?qh=&sect...foobar#/d2lapfr (http://browse.deviantart.com/?qh=&section=&q=flex+foobar#/d2lapfr)

Again, no problems for months. I restarted my computer and these just popped up.
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2011-09-13 17:55:57
Marc2003,

Since i updated with sample.zip my playback buttons show but no hoover and action is being taken.
Hope you can help me with this.

Rhand
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-09-15 17:07:49
strange, i can't think of any changes that would make that happen. did you extract the marc2003 folder again?
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2011-09-15 20:17:48
strange, i can't think of any changes that would make that happen. did you extract the marc2003 folder again?



Yes i did, i put the old marc2003 folder back and it's working again.
Ik think it's in the tooltip_buttons.js.
But i am not shure.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-09-15 21:42:30
just checking the dates and i did update tooltip_buttons.js on the 27th august. the playback buttons script was also updated the same day. did you extract the folder to use another script but didn't import the updated playback buttons script in to your panel?
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2011-09-15 22:20:33
just checking the dates and i did update tooltip_buttons.js on the 27th august. the playback buttons script was also updated the same day. did you extract the folder to use another script but didn't import the updated playback buttons script in to your panel?


I use an modified playback button script. I added buttons to it.
Will try to use the updated playback button script, and then modify it with my one buttons.
And then i will let you now of the out coming.

Rhand
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-09-15 22:29:04
you should just need to add these 3 functions to your modified script.

Code: [Select]
function on_mouse_move(x, y) {
    buttonsMove(x, y);
}

function on_mouse_lbtn_up(x, y) {
    buttonsUp(x, y);
}

function on_mouse_leave() {
    buttonsLeave();
}
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2011-09-15 22:30:52
just checking the dates and i did update tooltip_buttons.js on the 27th august. the playback buttons script was also updated the same day. did you extract the folder to use another script but didn't import the updated playback buttons script in to your panel?


I use an modified playback button script. I added buttons to it.
Will try to use the updated playback button script, and then modify it with my one buttons.
And then i will let you now of the out coming.

Rhand


Marc2003,

Thank you for your help.
I copied all the lines with button in it from the modified script to your original script, and that worked.
Thanks

Rhand
Title: WSH Panel Mod script discussion/help
Post by: Bigbeka on 2011-09-19 14:01:23
Hi marc.
Is there anyway to use your last.fm charts to retrieve the artist/albuns/tracks in the media library instead of opening a last.fm page?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-09-19 16:11:53
nope.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-09-23 13:18:37
Is it a way to define a meaningful panel name, so that it will be displayed instead of (or in addition to) the GUID in the console?  I have many WSH panels, and when an error message occurs, I have many difficulties to find at which panel the GUID of the error message refers.

Thanks in advance!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-09-23 13:56:33
look at preprocessors.txt in the docs folder of the component download.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-09-23 16:54:30
look at preprocessors.txt in the docs folder of the component download.

Great!  Thanks!
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2011-09-24 11:36:51
So it is not possible to use the command "quicksearch for same..." that comes with the quicksearch toolbar in for example your similar artists panel? Would be really useful so if it is possible I'd be happy for some help as I am not very skilled; I am just trying to change the lastfm-radio to a wiki-link and that's proving to be hard enough for me
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-09-25 10:16:29
@Marc2003

About your Now Playing panel, do you think it is  possible to add a kind of "auto-refresh" for when the tags of the now  playing song are modified (just like with your rating panel)

I  have modded your now playing panel to add display of genre & style  but if I update them (with discogs information for example) I have then  to manually refresh your panel

Thanks in advance,
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-09-25 10:44:38
Hi WSH friends

i'm currently working on a WSH palylist viewer panel, it progress in the right way until now, so here is a preview of the actual result :

http://www.youtube.com/watch?v=7-fH6l72iXw (http://www.youtube.com/watch?v=7-fH6l72iXw)

note: support small or big playlist as well
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-09-25 16:34:16
So the rating works only for selected tracks? Is there a way to make it rate songs that are playing now?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-09-25 17:27:41
So the rating works only for selected tracks? Is there a way to make it rate songs that are playing now?


you talk about my wsh playlist viewer? no, live rating always works, regardless of the status of the rated line (playing, selected, normal), check the video more accurately, i show that point
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-09-25 17:54:44
About your Now Playing panel, do you think it is  possible to add a kind of "auto-refresh" for when the tags of the now  playing song are modified (just like with your rating panel)


add this function to the panel

Code: [Select]
function on_playback_edited() {
    on_playback_new_track();
}


i'll update the zip file later.

@Falstaff, are you using the official WSH panel mod to do that playlist viewer or does it require a further modded version?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-09-25 18:44:08
...
@Falstaff, are you using the official WSH panel mod to do that playlist viewer or does it require a further modded version?


not the official one, because it still not provide the required API to do it, which are :

GetAnItem(index);
> Get a metadb handle of any item in the active playlist determined by it's position.

SetFocusedItem(index);
> Set the currently focused item in the active playlist.

SetSelectionSingle(index,selected);
> Set a track either selected or not. The selected parameter should be either true or false.

ClearSelection();
> Clear selection on the active playlist.

I hope T.P.Wang will add these features in the official one ASAP !
Title: WSH Panel Mod script discussion/help
Post by: Bryter on 2011-09-25 18:49:42
So the rating works only for selected tracks? Is there a way to make it rate songs that are playing now?


you talk about my wsh playlist viewer? no, live rating always works, regardless of the status of the rated line (playing, selected, normal), check the video more accurately, i show that point

No i was talking about the original rating script from marc2003.
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-09-25 19:01:16
add this function to the panel


Thank you. It's so simple I feel really dumb. I guess I should have read docs for WHS Panel Mod more carefully.

I have found a way to do it with on_metadb_changed() as in your rating panel but your solution is more appropriate.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-09-25 19:16:07
No i was talking about the original rating script from marc2003.


add

Code: [Select]
selection_mode = 1;


along with the other variables near the top of the script. it will now stick with the playing track while playing but follow the selection when playback is stopped.

@Falstaff, ah right, i was just wondering. i'm far too lazy to attempt this myself.
Title: WSH Panel Mod script discussion/help
Post by: LeoMessi on 2011-09-26 07:18:49
version 1.4.4 seem no longer support function gethwnd and CreateGlass?
So anyone show me other way to create aero glass?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-09-26 11:44:03
version 1.4.4 seem no longer support function gethwnd and CreateGlass?
So anyone show me other way to create aero glass?


it never supports these functions, maybe you have to use a non official version of WSH panel mod which provide these ones.
Title: WSH Panel Mod script discussion/help
Post by: LeoMessi on 2011-10-01 03:18:55
I want to add a imagebutton to panel stack splitter to sort elplaylist by artist, which command can i use in COMMAND argument of $imagebutton function?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-01 04:20:28
wrong thread. what has any of that got to do with WSH panel mod? 

but to point you in the right direction, look at using CONTEXT, not COMMAND. it's all in the readme.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-05 21:51:07
i've spent bloody hours trying to make scrollbars for panels and it's almost working perfectly.... but my dilemma is that i'm using the height of the content to base my "grabber" size on. but now i'm trying to make a playlist and the grabber gets really small. i can't change the size artificially because it then messes up the maths need to calculate when to stop/start scrolling when dragging. i'm guessing i've approached this from entirely the wrong angle. i know other people have posted snippets before but they are too complex for me to implement in my script. any ideas on what i should have done.... 
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-05 23:30:16
I have written a "Viewport" object with a vertical scrollbar (no horizontal scrollbar so far), based on my first scrollbar attempt (that was not an object).  The scrollbar is used to scroll a bitmap that is higher than the viewport.

I have exactly the same problem: when the bitmap is really big, the scrollbar's grabber becomes very small.  But there are also arrows in the top and bottom edges of the scrollbar, and the user cam also click on the "empty space" between the arrows and the grabber to scroll by a page at a time.  The keyboard and mouse wheel and drag can also be used to scroll the bitmap, so I haven't tried to solve the "grabber too small" issue.

I have used the viewport object in several panels (based on your Last.fm panels), but I have also modified completely the way they work, and they need a "global" panel to be notified of metadb or preferences changes.  I can't give them here as examples of my Viewport object, because they will not work alone.  I'll try to write a simple example when I'll have some time...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-06 00:22:12
i suppose i shouldn't really concern myself too much. it's highly unlikely this script will ever see the light of day anyway. i'm really happy with the way it works for normal panels - it's only with 1000+ tracks in a playlist that i have a problem.



edit: if anybody else uses the theme manager, i made this snippet to easily find the part and state id...

Code: [Select]
var test = window.CreateThemeManager("scrollbar");
var size = 30;

function on_paint(gr) {
    for(state = 0; state < 20; state++) {
        for(part = 0; part < 20; part++) {
            try {
                test.SetPartAndStateId(part, state);
                test.DrawThemeBackground(gr, state * size, part * size, size, size);
            } catch(e) {
            }
        }
    }
}


just change "scrollbar" to anything from this page: http://msdn.microsoft.com/en-us/library/wi...v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/bb773210%28v=vs.85%29.aspx)

now i can get the ID for what i want from this grid view.

(http://dl.dropbox.com/u/22801321/part%20and%20state.png)
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-10-06 02:48:44
(http://i305.photobucket.com/albums/nn222/neonmori/dd.png)
I made a WSH graphical browser.
The scroll bar is simple but effective enough.
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2011-10-06 17:37:55
@ marc2003, how can i change the font to your simple biography panel? i would like to switch to arial 8pt.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-06 18:33:50
anywhere at the top of the script before on_item_focus_change();

Code: [Select]
normal_font = gdi.Font("Arial", 8);


to change the font of the stats display, use

Code: [Select]
list_font = .....


and for the artist header at the top..

Code: [Select]
title_font = gdi.font("super font", 16, 1);


add the 1 if you want to make it bold.
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2011-10-06 19:54:39
Thank you
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-07 10:17:33
how do i use on_metadb_changed() with a handle list? i've looked at the callback and preprocessor docs and i can't make any sense of it at all. 
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-07 17:06:45
Marc, I've found a solution for the problem of the scrollbar grabber too small.  It is extremely simple, and I have had to add only 3 lines of code.

I'll try top explain my method with a vertical scrollbar example:
Code: [Select]
---- y1: top of the scrollbar
Up button
---- y2: top of the area containing the grabber (The height of that area is in the variable "ah")

---- y3: top of the grabber

The grabber (Its height is in the variable "gh".  It should be minimum 16.)

---- y4: bottom of the grabber


---- y5: bottom of the area containing the grabber
Down button
---- y6: bottom of the scrollbar

I suppose that, like me, you know the height of the portion of the scrollbar that is between the up and down buttons and that contains the grabber (ah, or y5-y2) and the height of the grabber (gh or y4-y3).  gh is computed relatively to ah, to the height of the window (or viewport in my case) and to the total height of the data to display.  The problem happens when the latter is too large relatively to the height of the window.

In my method, it's always the top border of the grabber (at y3) that determines the position of the data to display.
So, if y3 == y2, the first line of the data is shown on top of the display.
Similarly, if y4 == y5, the bottom line is shown on the bottom of the window.  In this case, y3 = y5 - gh.

What I do to solve the problem is this:
When gh is computed, there can be two cases:
1: its height >= 16, and in that case, there is no problem.
2: its height is < 16.  It is too small, so we must enlarge it.  I force it to 16.  But of course, if you move the grabber to the very bottom of the scrollbar, it will be drawn partially over the down button.  To avoid that, it is sufficient to shrink the area containing the grabber (ah).
Code: [Select]
        if (gh < 16) {
            ah -= 16 - gh;
            gh = 16;
        }

Now, if you move the grabber to the bottom, it will stop just where it should, and all computations based on the position of the top of the grabber and the height of the area are still correct.

The thing to understand is that the height of the area in which the grabber can move does not have to be the height of the area containing the grabber.  It can be smaller by a few pixels, and the grabber larger by that same number of pixels.

(In fact, there are still some problems to solve.  For example, if the total height of the scrollbar is less than the height of the two buttons + 16 + some space to move the grabber, you have to draw the small grabber, or remove it completely and keep only the up and down arrows.  But that's cosmetic stuff, simple enough to solve.)

If your method is similar than mine, you should be able to fix your code easily.  Good luck!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-07 19:36:00
thanks for that. it's always something simple.

edit: oops appearances can be deceiving - i might still have a problem. false alarm - scrolling works perfectly even with 100,000 items - it's my mouse click code that is broken. 
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-08 01:21:36
Well, I had also some things somewhat broken, but it's perfect now.  :-)

BTW, I have another problem.  My viewport object is defined in an include file, and it is supposed to be easily reusable in any WSH panel. But it is not easy to handle the callbacks.  For example, the scrollbar must be notified of mouse clicks and moves.  But if, for any reason (for example if there are buttons in the panel), the panel needs also that information, the main code must also define the on_mouse_...() functions.  So, the viewport object cannot steal them for its own use.

Currently, the object has on_mouse methods, and it is the responsibility of the main code to call them.  The object's method returns false when it has used the event (for example, when the user has clicked on the scrollbar), so it is relatively easy to handle the remaining events in the WSH panel.  But I'm not satisfied by that method, mainly because it is necessary to define the callbacks needed by the scrollbar in the main code, even if it doesn't need that callbacks for its own use, just to pass them to the main code.

I've tried to do the opposite: define the callback functions in the include, then pass the events to the object, and if they have not been used, call a function with a similar but somewhat different name in the main code (with try/catch so that the code will not fail if the function is not defined).  But I don't like that method either, as it is necessary to define the callback functions if the include, and they cannot be methods of the object.  Furthermore, it is necessary to define the callbacks in the main code with different names than the official ones.  Also, it is difficult to define several viewports in the same panel.

I wonder if there is a better method.  As far as I know, there is no way to receive the same callback info in the object and in the main code, without having to call one from the other.  Right?

Is it possible to define the same callback twice?  I could for example define the callbacks in the include, and they will be overwritten later if the main code redefine them (and in that case, of course, they will need to call the corresponding object methods).  So, if the main code doesn't need a callback, it will not need to define it.  But I don't know if it's possible.

How did you solve that problem?  Do you write a single callback function where you do the stuff necessary to handle the events necessary for the scrollbar as well as any other events your panel may need?

(I hope I am clear enough.  English is not my native language, and here in Belgium, it is late!)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-08 05:46:21
Quote
Currently, the object has on_mouse methods, and it is the responsibility of the main code to call them. The object's method returns false when it has used the event (for example, when the user has clicked on the scrollbar), so it is relatively easy to handle the remaining events in the WSH panel. But I'm not satisfied by that method, mainly because it is necessary to define the callbacks needed by the scrollbar in the main code, even if it doesn't need that callbacks for its own use, just to pass them to the main code.


i use true like this...

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    switch(true) {
        case obj1.trace(x, y):
            obj1.click(x, y);
            break;
        case obj2.trace(x, y):
            obj2.click(x, y);
            break;
        case ..... //neither of those objects was clicked so let's check something else....
    }
}


Quote
I've tried to do the opposite: define the callback functions in the include, then pass the events to the object, and if they have not been used, call a function with a similar but somewhat different name in the main code (with try/catch so that the code will not fail if the function is not defined).


i don't like this idea at all. i definitely prefer the proper callbacks in the panels themselves. i think it makes maintenance easier and gives you more flexibility to make changes.

as for duplicating functions, that's certainly possible as i discovered by mistake. if you declare them multiple times, only the last one gets called.
Code: [Select]
function test(a, b) {
    return a + b;
}

function test(a, b) {
    return a * b;
}

fb.trace(test(5, 5)); //displays 25 in the console


i can't say i'm keen on this idea either but i'm not particularly fussy. so long as stuff works, there is no impact on performance and it doesn't crash - that's good enough.

Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2011-10-08 08:43:40
I made a WSH graphical browser.
The scroll bar is simple but effective enough.



Could you paste your script, please ?

thanks in advance.
Decalicatan Decalicatan
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-08 08:44:17
i use true like this...
I see.  But your method implies that the code to handle the scrollbar and the code to handle the other things is in the same function.  I really want to keep the viewport/scrollbar as independent as possible.  So, I prefer this:
Code: [Select]
        if ( ! viewportobj.on_mouse_lbtn_up(x, y) ) {
                // main script stuff here...
                obj2.click(x, y);
        }
Of course, I can use switch/case too.

as for duplicating functions, that's certainly possible as i discovered by mistake. if you declare them multiple times, only the last one gets called.
[...]
i can't say i'm keen on this idea either but i'm not particularly fussy. so long as stuff works, there is no impact on performance and it doesn't crash - that's good enough.
That's great to know.  I suspected something like that.  (I could have written the test myself BTW!)

I think I will adopt that method, and add the callbacks necessary for the toolbar in the include.  If the main code doesn't need a callback, it will not need to define it, as it will already be defined in the include.  Otherwise, the callback code can be copied from the include to the main script and modified to suit the panel's needs.  That will keep the main script easier to maintain and read.

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: fbuser on 2011-10-08 09:08:12
as for duplicating functions, that's certainly possible as i discovered by mistake. if you declare them multiple times, only the last one gets called.
Code: [Select]
...

i can't say i'm keen on this idea either but i'm not particularly fussy. so long as stuff works, there is no impact on performance and it doesn't crash - that's good enough.

You might consider using the prototypal inheritance capabilities of JS for such cases:

http://javascript.crockford.com/prototypal.html (http://javascript.crockford.com/prototypal.html)
http://www.ruzee.com/blog/2008/12/javascri...es-and-closures (http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-08 09:16:54
thanks for the links. now let's see if i can i understand them. 

I really want to keep the viewport/scrollbar as independent as possible.


my scrollbar is quite separate from my content. in on_paint, the position of the grabber is determined by the position in my array of items of where i want to start looping. if i have 100 items but only room for 10 rows and i want to display the last 10, i'll be starting at 90.

Code: [Select]
sbh = wh - 34; //scrollable height
gh = Math.floor(sbh * (rows / items)); //grabber height
gy = Math.floor((sbh / items) * offset[plman.ActivePlaylist]); y-cordinate of grabber. i'll add 17 when drawing to account for the up arrow


but if the scrollbar is being dragged, i need to reverse that and set the offset based on the position of the grabber. it's only a few lines in each case so i haven't even bothered making it reusable.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-08 10:54:31
my code : http://www.hydrogenaudio.org/forums/index....st&p=771581 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=771581)

HTH
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-08 12:52:11
thanks for posting that. now to *ahem* borrow some code.

a few issues: add a file and then add the same file again. aw, crashed

also, when you finally manage to add multiple files to the same playlist, it treats them all as the same track when selected or playing. not that i ever do this but you have to account for all possible actions.

using shift+click to select a range of files doesn't behave like a standard playlist. let's say i select track 5 with shift held down. now i click track 1 and tracks 1-5 are selected. so far, so good. but now i select track 10. the range should change from 5-10. but your playlist adds to the selection keeping 1-4 selected when they should be cleared.

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-08 14:15:19
thanks for posting that. now to *ahem* borrow some code.

a few issues: add a file and then add the same file again. aw, crashed

also, when you finally manage to add multiple files to the same playlist, it treats them all as the same track when selected or playing. not that i ever do this but you have to account for all possible actions.

using shift+click to select a range of files doesn't behave like a standard playlist. let's say i select track 5 with shift held down. now i click track 1 and tracks 1-5 are selected. so far, so good. but now i select track 10. the range should change from 5-10. but your playlist adds to the selection keeping 1-4 selected when they should be cleared.


i never have a track more than once in a playlist (crazy thing for me), but it should handle it as well, i'll check that, thanx for reporting.

i know this behaviour for shift selection, but not on the top of my todo list actually

EDIT: FYI,  draw cover art just optimized, too much refresh done in the shared script, and cache engine optimized to handle a timer for each cover visible (not a full get'n draw like done in the shared script)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-08 14:43:02
preview of the new cover cache engine : http://www.youtube.com/watch?v=rpDB1xhbMjA (http://www.youtube.com/watch?v=rpDB1xhbMjA)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-08 14:50:13
for the crash issue on adding the same file, the fix is to change the function below with this (2 new lines in blue to add):

function on_playlist_items_selection_change() {
    g_metadb_playlist = plman.GetPlaylistItems(fb.ActivePlaylist);
    IC.list_total = fb.PlaylistItemCount(fb.ActivePlaylist);
    on_item_focus_change();
}
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-08 14:54:08
When I see that, I think that it should be possible to create a big WSH panel to control entirely foobar2000 with a remote (sending keystrokes to the panel).  IMO, it's something that is missing in F2k.  It's a wonderful player to be used on a PC with a mouse, but currently, as far as I know, there is no way to integrate it easily in a multimedia-only PC, that has no keyboard or mouse.

Interested?  ;-)
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-08 15:10:11
my scrollbar is quite separate from my content. in on_paint, the position of the grabber is determined by the position in my array of items of where i want to start looping. if i have 100 items but only room for 10 rows and i want to display the last 10, i'll be starting at 90.

My method is totally different.  All things to display are drawn in a bitmap (higher than the viewport), and the entire bitmap is scrolled totally automatically when needed.  The advantage is that you have just to draw your stuff once.  The viewport object does the rest automatically when the user uses the scrollbar.  That's very fast, as the object has only to scroll the bitmap and refresh the scrollbar.  There is no need to recreate all visible elements.  (Of course, you need to recreate the bitmap if the width of the window changes or if the things to show must be updated.)  Also, things that are outside the viewport (and are therefore at fixed positions) are not modified when the viewport refreshes itself.  So, you need also to draw them once.  Another advantage is that the viewport object holds constantly the X and Y mouse positions relatively to the top-left corner of the bitmap, so you don't need more or less complex calculations to find over what element the mouse is positioned: you can find it with X and Y.

My method has also some drawbacks.  You must allocate a bitmap large enough to hold the entire display.  For very big panels (such as important playlists), that could be a problem.
Also, in some cases, it is not easy to determine the height of the bitmap, and that's necessary before beginning to draw the elements.  (For example, I have created a panel to display the current track information, and it uses different (big) fonts for the artist, title, composer, performers, etc...  If a tag is missing, it must simply skip it, without leaving a blank space.  It is currently not simple to compute the height of the panel, and I will probably add a "dummy" flag to the viewport's draw method to simulate the drawing of the elements and return the total height.  It will then be sufficient to call the same function twice: once with the "dummy" flag to compute the height of the bitmap, and the second time to draw the stuff in the bitmap with the correct height.)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-08 15:44:01
...
I made a WSH graphical browser.
The scroll bar is simple but effective enough.


mind sharing script ?
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-10-08 17:58:10
...
I made a WSH graphical browser.
The scroll bar is simple but effective enough.


mind sharing script ?

Well, I am doing final debug and optimization, however, it would be a bad-efficient "component" as the original graphical browser, because it needs to evaluate all items inside a playlist.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-08 20:32:15
ok, well, keep the good work and give us an optimized versions asap
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-09 11:05:13
I've just added a cool feature (take from ELP), just look at this

http://www.youtube.com/watch?v=ic14s4ahig0 (http://www.youtube.com/watch?v=ic14s4ahig0)
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-10-09 20:49:46
Hello marc2003,

In one dui tabstack i placed 4 of your autoplaylists script. I assume that they are expected to work independently. In that sense there seems to be a bug as they are not totally independent. Here a video that shows what i mean: http://www.youtube.com/watch?v=nRgIH0RoAjE (http://www.youtube.com/watch?v=nRgIH0RoAjE)

By the way: would be nice to have the opportunity to rename the caption "Autoplaylist" to something that matches the content of one list. When you have installed your script more than one time to achieve some sort of organization of autoplaylist some names like "Statistics", "By Artist", "By Genre" and so on would be helpful. I already did that by manipulating your script but after import of new versions of the script the names are lost.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-09 21:13:29
it's not a bug - it's a feature. because i switch between columns UI and default UI regularly, they share the data file named simply autoplaylists inside a folder named wsh_settings in your profile folder. if i ever remove the panel from my layout and then add it back again later, my autoplaylists are retained. i never thought anyone would run multiple instances.

as for your video, the panel reads the file into memory. but as soon as any changes are made it gets saved immediately. there is no synchronisation between panels for the reasons i mentioned above although it is possible.

however, adding support to name your own panels with separate files for each should be fairly trivial. i'll see what i can do.

edit: actually, i won't be doing any script updates until WSH panel mod 1.5 is released. i have no idea when that will be as the developer hasn't posted on the forums for awhile although development is very active at the moment - i've been checking his google code page for updates.

if you want independent scripts right now, simply edit line 8

Code: [Select]
var autoplaylists_file = settings_path + "autoplaylists";


eg

Code: [Select]
var autoplaylists_file = settings_path + "autoplaylists_panel1";
var autoplaylists_file = settings_path + "autoplaylists_panel2";

Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-10-09 21:25:08
i never thought anyone would run multiple instances.

That was the first i was thinking when starting the usage of your script. IMO several lists gives an better overview over a large amount of autoplaylists presets than a treeview could do.

Edit
Replaced the line in the txt.file, removed the wsh ui-elements, restarted foobar2000 and added again wsh ui-elements with importing autoplaylist script. It seems to have no effect.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-09 21:38:01
well if you're editing the script before importing then of course all panels will still use the same file. i meant edit the panels.

try this instead....

Code: [Select]
var autoplaylists_file = settings_path + "autoplaylists_" + window.GetProperty("id", window.ID);


Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-10-09 21:46:04
well if you're editing the script before importing then of course all panels will still use the same file.
How could i know that! 

Much thanks, now it works: all new added autoplaylist scripts start with a blank list.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-10 21:34:30
Perf Test

http://www.youtube.com/watch?v=HyQQ7UDc5ss (http://www.youtube.com/watch?v=HyQQ7UDc5ss)
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-10-11 22:47:21
(http://i305.photobucket.com/albums/nn222/neonmori/WSHGraf.png)
95% finished.

The only question: can not easily get the position of now playing item by using IFbMetadbHandleList
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-11 22:59:35
you're kidding?

var nowplaying = plman.GetPlayingItemLocation();
var pid = nowplaying.PlaylistItemIndex;


Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-10-11 23:31:26
you're kidding?

var nowplaying = plman.GetPlayingItemLocation();
var pid = nowplaying.PlaylistItemIndex;




problem is i re-arranged the contents of the list.
you can find that the order in browser is different from the playlist.
Title: WSH Panel Mod script discussion/help
Post by: Dexter_prog on 2011-10-12 02:37:27
Hey, guys. Recently I'm getting frequent crashes in foobar and the reports point to this component. Thing is that I haven't changed anything and can't trace it to which of my panels is doing it (I have 3). Any help?

Code: [Select]
Illegal operation:
Code: 80000003h, flags: 00000000h, address: 6C81B5ACh
Additional parameters: 00000000h

Call path:
entry=>app_mainloop

Code bytes (6C81B5ACh):
6C81B56Ch:  4D F4 64 89 0D 00 00 00 00 5F 5E 5B 8B E5 5D C2
6C81B57Ch:  0C 00 8B 75 08 83 C6 64 8D 5D 8C E8 04 C4 02 00
6C81B58Ch:  8B 4D CC 8B 01 8B 50 04 FF D2 50 8B C3 50 68 18
6C81B59Ch:  11 89 6C E8 0B D6 02 00 83 C4 0C E8 84 BC FF FF
6C81B5ACh:  CC C7 45 FC FF FF FF FF B8 BA B5 81 6C C3 8B 75
6C81B5BCh:  E8 8B 16 8B 42 08 8B 7D E4 56 FF D0 8B C7 8B 4D
6C81B5CCh:  F4 64 89 0D 00 00 00 00 5F 5E 5B 8B E5 5D C2 0C
6C81B5DCh:  00 8B 75 08 83 C6 64 8D 9D 4C FF FF FF E8 A2 C3

Stack (0032E4A8h):
0032E488h:  00000000 FFFFFD34 000002E4 FFFFFD34
0032E498h:  000002CC 00000019 00000000 6C81B5AC
0032E4A8h:  6C87F0D7 0032F510 0032E748 0032E4C4
0032E4B8h:  0032F510 6C81B57E 0032F51C 0032E4F0
0032E4C8h:  6C87939D 6C81B57E 0032F510 00000100
0032E4D8h:  0032E548 6C87908B DEAF586F 6C89A954
0032E4E8h:  0032F510 00000001 0032E558 6C87E793
0032E4F8h:  0032F510 6C89A954 6C81B57E 00000000
0032E508h:  00000100 DEAF59EF 6C89A940 0032F510
0032E518h:  6C89A920 0032EB20 00000000 00000000
0032E528h:  00000000 00000000 0032E51C 0032F458
0032E538h:  6C87E581 6C81B57E 0032E50C 0032E06C
0032E548h:  0032E674 6C87AD00 B214D6FF 00000001
0032E558h:  0032E588 6C87EB1A 0032E748 0032F510
0032E568h:  00000001 6C89A954 00000000 00000100
0032E578h:  0032F510 0032E71C 6C89A954 00000000
0032E588h:  0032E5EC 6C87EEA5 0032E748 0032E798
0032E598h:  0032E71C 6C89A954 00E8297C 00000000
0032E5A8h:  00000000 E06D7363 1FFFFFFF 19930522
0032E5B8h:  77DBE0F2 00000011 00000000 6C89A940

Registers:
EAX: 00000000, EBX: 0032F4A8, ECX: 0032E4D8, EDX: 0000001D
ESI: 0764FDB4, EDI: 0032F510, EBP: 0032F51C, ESP: 0032E4A8

Crash location:
Module: foo_uie_wsh_panel_mod
Offset: B5ACh

Loaded modules:
foobar2000                       loaded at 00D00000h - 00EF2000h
ntdll                            loaded at 77D90000h - 77F10000h
kernel32                         loaded at 77090000h - 77190000h
KERNELBASE                       loaded at 77230000h - 77276000h
snxhk                            loaded at 736F0000h - 73724000h
COMCTL32                         loaded at 75330000h - 754CE000h
msvcrt                           loaded at 77510000h - 775BC000h
GDI32                            loaded at 75960000h - 759F0000h
USER32                           loaded at 77790000h - 77890000h
ADVAPI32                         loaded at 77280000h - 77320000h
sechost                          loaded at 77940000h - 77959000h
RPCRT4                           loaded at 767D0000h - 768C0000h
SspiCli                          loaded at 75900000h - 75960000h
CRYPTBASE                        loaded at 758F0000h - 758FC000h
LPK                              loaded at 767C0000h - 767CA000h
USP10                            loaded at 77190000h - 7722D000h
SHLWAPI                          loaded at 77890000h - 778E7000h
DSOUND                           loaded at 6C6B0000h - 6C722000h
ole32                            loaded at 773B0000h - 7750C000h
WINMM                            loaded at 754D0000h - 75502000h
POWRPROF                         loaded at 6C680000h - 6C6A5000h
SETUPAPI                         loaded at 76A70000h - 76C0D000h
CFGMGR32                         loaded at 76E10000h - 76E37000h
OLEAUT32                         loaded at 77670000h - 776FF000h
DEVOBJ                           loaded at 769E0000h - 769F2000h
UxTheme                          loaded at 75220000h - 752A0000h
SHELL32                          loaded at 759F0000h - 76639000h
zlib1                            loaded at 5A4C0000h - 5A4D4000h
shared                           loaded at 6DE20000h - 6DE4B000h
imagehlp                         loaded at 77640000h - 7766A000h
dbghelp                          loaded at 74130000h - 7421B000h
COMDLG32                         loaded at 775C0000h - 7763B000h
Secur32                          loaded at 739F0000h - 739F8000h
CRYPT32                          loaded at 768C0000h - 769DC000h
MSASN1                           loaded at 77D60000h - 77D6C000h
gdiplus                          loaded at 74E50000h - 74FE0000h
IMM32                            loaded at 76F10000h - 76F70000h
MSCTF                            loaded at 76E40000h - 76F0C000h
prio32                           loaded at 10000000h - 10006000h
DockShellHook                    loaded at 02BB0000h - 02C88000h
CLBCatQ                          loaded at 77700000h - 77783000h
MMDevApi                         loaded at 69F60000h - 69F99000h
PROPSYS                          loaded at 75100000h - 751F5000h
dwmapi                           loaded at 75200000h - 75213000h
foo_prettypop                    loaded at 02AC0000h - 02B11000h
MSCOREE                          loaded at 6DCC0000h - 6DD0A000h
MSVCR80                          loaded at 74B70000h - 74C0B000h
msvcm80                          loaded at 6DBD0000h - 6DC4D000h
mscoreei                         loaded at 6DB60000h - 6DBC6000h
mscorwks                         loaded at 688F0000h - 68E9A000h
profapi                          loaded at 74220000h - 7422B000h
mscorlib.ni                      loaded at 67DF0000h - 688E8000h
mscorjit                         loaded at 6DB00000h - 6DB5B000h
CRYPTSP                          loaded at 73560000h - 73576000h
rsaenh                           loaded at 73520000h - 7355B000h
foo_fileops                      loaded at 6DAB0000h - 6DAF7000h
foo_out_ks                       loaded at 02D20000h - 02D4A000h
foo_uie_lyrics3                  loaded at 06950000h - 06A50000h
WININET                          loaded at 76F90000h - 77085000h
urlmon                           loaded at 76640000h - 76776000h
iertutil                         loaded at 76C10000h - 76E0D000h
MSIMG32                          loaded at 74FF0000h - 74FF5000h
foo_quicksearch                  loaded at 6DA50000h - 6DAA7000h
WindowsCodecs                    loaded at 75000000h - 750FB000h
foo_input_std                    loaded at 6D8E0000h - 6DA49000h
foo_tagbox                       loaded at 04640000h - 046C0000h
foo_out_wasapi                   loaded at 031B0000h - 031D6000h
foo_uie_albumlist                loaded at 03460000h - 034A3000h
foo_masstag                      loaded at 04360000h - 043B4000h
foo_dsp_std                      loaded at 6D890000h - 6D8D8000h
foo_out_asio                     loaded at 044F0000h - 04526000h
foo_quicktag                     loaded at 6D780000h - 6D7B4000h
foo_rgscan                       loaded at 6D730000h - 6D77B000h
foo_discogs                      loaded at 6D6C0000h - 6D723000h
foo_audioscrobbler               loaded at 06800000h - 06833000h
foo_ui_std                       loaded at 6D4A0000h - 6D5B9000h
foo_uie_vis_peakmeter_spectrum   loaded at 06A60000h - 06A9F000h
foo_uie_wsh_panel_mod            loaded at 6C810000h - 6C8B7000h
foo_run                          loaded at 06DB0000h - 06E0F000h
foo_albumlist                    loaded at 6C7B0000h - 6C80D000h
foo_httpcontrol                  loaded at 6C610000h - 6C67D000h
WS2_32                           loaded at 76780000h - 767B5000h
NSI                              loaded at 76F70000h - 76F76000h
WSOCK32                          loaded at 75770000h - 75777000h
MPR                              loaded at 73680000h - 73692000h
foo_cdda                         loaded at 6D450000h - 6D49E000h
foo_dsp_span                     loaded at 6D690000h - 6D6BE000h
foo_wlm                          loaded at 6D610000h - 6D631000h
foo_ui_columns                   loaded at 07D00000h - 07E8E000h
foo_unpack                       loaded at 6D140000h - 6D16E000h
foo_uie_playlists_dropdown       loaded at 06E60000h - 06E9C000h
foo_queuecontents                loaded at 073C0000h - 0742D000h
foo_textdisplay                  loaded at 6CCC0000h - 6CD0B000h
foo_playcount                    loaded at 6C5D0000h - 6C60E000h
foo_freedb2                      loaded at 6C590000h - 6C5D0000h
foo_stop_after_queue             loaded at 6D870000h - 6D888000h
foo_uie_panel_splitter           loaded at 074A0000h - 074F9000h
foo_tlbRC                        loaded at 07140000h - 07167000h
foo_wave_seekbar                 loaded at 6C3F0000h - 6C58E000h
foo_keep_queue                   loaded at 6E1B0000h - 6E1BF000h
MSVCR90                          loaded at 74320000h - 743C3000h
AUDIOSES                         loaded at 69D50000h - 69D86000h
apphelp                          loaded at 736A0000h - 736EB000h
DropboxExt.14                    loaded at 07610000h - 07627000h
MSVCP71                          loaded at 7C3A0000h - 7C41B000h
MSVCR71                          loaded at 7C340000h - 7C396000h
EhStorShell                      loaded at 727C0000h - 727F1000h
GROOVEEX                         loaded at 72D00000h - 7310A000h
MSVCP90                          loaded at 74290000h - 7431E000h
ATL90                            loaded at 74640000h - 7466B000h
office                           loaded at 701A0000h - 705AF000h
GrooveIntlResource               loaded at 6F930000h - 70194000h
ntshrui                          loaded at 6F850000h - 6F8BF000h
srvcli                           loaded at 73950000h - 73969000h
cscapi                           loaded at 740B0000h - 740BB000h
slc                              loaded at 72980000h - 7298A000h
SXS                              loaded at 6F700000h - 6F75F000h
frontend_direct2d                loaded at 6C190000h - 6C1E7000h
d2d1                             loaded at 6B8F0000h - 6B9BF000h
frontend_direct3d9               loaded at 6B880000h - 6B8E3000h
d3d9                             loaded at 6AB20000h - 6ACE3000h
VERSION                          loaded at 75760000h - 75769000h
d3d8thk                          loaded at 6E1A0000h - 6E1A6000h
d3dx9_42                         loaded at 6A680000h - 6A865000h
SciLexer                         loaded at 6B500000h - 6B591000h
AhAScr                           loaded at 6CCA0000h - 6CCC0000h
aswCmnBS                         loaded at 757A0000h - 757EE000h
aswCmnOS                         loaded at 75780000h - 7579A000h
aswCmnIS                         loaded at 743D0000h - 743F9000h
Aavm4h                           loaded at 73E80000h - 73ED2000h
PSAPI                            loaded at 76F80000h - 76F85000h
AavmRpch                         loaded at 73E60000h - 73E73000h
ashBase                          loaded at 74260000h - 7428F000h
aswEngLdr                        loaded at 74250000h - 7425D000h
USERENV                          loaded at 74230000h - 74247000h
ashTask                          loaded at 73FD0000h - 73FF6000h
aswAux                           loaded at 74000000h - 740A8000h
aswProperty                      loaded at 73EE0000h - 73F13000h
jscript                          loaded at 6CBE0000h - 6CC92000h
aswJsFlt                         loaded at 6CBC0000h - 6CBD9000h
RpcRtRemote                      loaded at 73DF0000h - 73DFE000h
wshom                            loaded at 6C3C0000h - 6C3E1000h
ScrRun                           loaded at 6C390000h - 6C3BA000h
tiptsf                           loaded at 745E0000h - 74638000h
System.ni                        loaded at 664F0000h - 66C89000h
System.Drawing.ni                loaded at 6A4F0000h - 6A677000h
System.Windows.Forms.ni          loaded at 652F0000h - 65ECE000h
mswsock                          loaded at 73850000h - 7388C000h
wshtcpip                         loaded at 73730000h - 73735000h
explorerframe                    loaded at 6C220000h - 6C38F000h
DUser                            loaded at 6C1F0000h - 6C21F000h
DUI70                            loaded at 6ACF0000h - 6ADA2000h
avrt                             loaded at 6C160000h - 6C167000h
wship6                           loaded at 745A0000h - 745A6000h
DNSAPI                           loaded at 73800000h - 73844000h
IPHLPAPI                         loaded at 737E0000h - 737FC000h
WINNSI                           loaded at 737D0000h - 737D7000h
rasadhlp                         loaded at 737C0000h - 737C6000h
msxml3                           loaded at 6C020000h - 6C152000h
fwpuclnt                         loaded at 73740000h - 73778000h
ntmarta                          loaded at 752E0000h - 75301000h
WLDAP32                          loaded at 778F0000h - 77935000h
RASAPI32                         loaded at 728D0000h - 72922000h
rasman                           loaded at 73160000h - 73175000h
rtutils                          loaded at 73150000h - 7315D000h
sensapi                          loaded at 74550000h - 74556000h
Normaliz                         loaded at 76A00000h - 76A03000h
NLAapi                           loaded at 73890000h - 738A0000h
winrnr                           loaded at 737B0000h - 737B8000h
mlang                            loaded at 72790000h - 727BE000h
napinsp                          loaded at 737A0000h - 737B0000h
pnrpnsp                          loaded at 73780000h - 73792000h
msls31                           loaded at 72A20000h - 72A4A000h
XmlLite                          loaded at 6CAB0000h - 6CADF000h
LINKINFO                         loaded at 6CAE0000h - 6CAE9000h
SearchFolder                     loaded at 6AA80000h - 6AB1F000h
StructuredQuery                  loaded at 6F5F0000h - 6F64C000h
thumbcache                       loaded at 66C90000h - 66CA6000h
SHDOCVW                          loaded at 73120000h - 7314E000h
ieframe                          loaded at 71AD0000h - 7254F000h
OLEACC                           loaded at 74560000h - 7459C000h
samcli                           loaded at 74420000h - 7442F000h
SAMLIB                           loaded at 6B860000h - 6B872000h
netutils                         loaded at 73970000h - 73979000h
NetworkExplorer                  loaded at 6A100000h - 6A298000h
drprov                           loaded at 705C0000h - 705C8000h
WINSTA                           loaded at 739A0000h - 739C9000h
ntlanman                         loaded at 6AE20000h - 6AE34000h
davclnt                          loaded at 6AE00000h - 6AE16000h
DAVHLPR                          loaded at 6E0A0000h - 6E0A8000h
wkscli                           loaded at 740C0000h - 740CF000h
NetworkItemFactory               loaded at 6DE90000h - 6DE9D000h
dtsh                             loaded at 6D680000h - 6D68B000h
FirewallAPI                      loaded at 746F0000h - 74766000h
PortableDeviceApi                loaded at 6A920000h - 6A9A9000h
wbemprox                         loaded at 6D180000h - 6D18A000h
wbemcomn                         loaded at 6A3E0000h - 6A43C000h
WINTRUST                         loaded at 77960000h - 7798D000h
PortableDeviceTypes              loaded at 6A8F0000h - 6A91B000h
npmproxy                         loaded at 6F8C0000h - 6F8C8000h
EhStorAPI                        loaded at 6A3B0000h - 6A3D2000h
FunDisc                          loaded at 6A330000h - 6A35B000h
ATL                              loaded at 6ADE0000h - 6ADF4000h
msxml6                           loaded at 6C8C0000h - 6CA17000h
fdproxy                          loaded at 6C7A0000h - 6C7AA000h
fdwcn                            loaded at 6A310000h - 6A327000h
wcnapi                           loaded at 6A2F0000h - 6A309000h
fdWNet                           loaded at 6B830000h - 6B839000h
dfscli                           loaded at 6B4F0000h - 6B4FD000h
browcli                          loaded at 6AA70000h - 6AA7D000h
ieproxy                          loaded at 6F650000h - 6F67B000h
dhcpcsvc6                        loaded at 745D0000h - 745DD000h
dhcpcsvc                         loaded at 745B0000h - 745C2000h
actxprxy                         loaded at 6E030000h - 6E07E000h
zipfldr                          loaded at 6A0A0000h - 6A0F2000h
IconCodecService                 loaded at 72970000h - 72976000h
nvd3dum                          loaded at 64940000h - 652E9000h

Stack dump analysis:
Address: 6C87F0D7h (foo_uie_wsh_panel_mod+6F0D7h), symbol: "foobar2000_get_interface" (+36A37h)
Address: 6C81B57Eh (foo_uie_wsh_panel_mod+B57Eh)
Address: 6C87939Dh (foo_uie_wsh_panel_mod+6939Dh), symbol: "foobar2000_get_interface" (+30CFDh)
Address: 6C81B57Eh (foo_uie_wsh_panel_mod+B57Eh)
Address: 6C87908Bh (foo_uie_wsh_panel_mod+6908Bh), symbol: "foobar2000_get_interface" (+309EBh)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 6C87E793h (foo_uie_wsh_panel_mod+6E793h), symbol: "foobar2000_get_interface" (+360F3h)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 6C81B57Eh (foo_uie_wsh_panel_mod+B57Eh)
Address: 6C89A940h (foo_uie_wsh_panel_mod+8A940h), symbol: "foobar2000_get_interface" (+522A0h)
Address: 6C89A920h (foo_uie_wsh_panel_mod+8A920h), symbol: "foobar2000_get_interface" (+52280h)
Address: 6C87E581h (foo_uie_wsh_panel_mod+6E581h), symbol: "foobar2000_get_interface" (+35EE1h)
Address: 6C81B57Eh (foo_uie_wsh_panel_mod+B57Eh)
Address: 6C87AD00h (foo_uie_wsh_panel_mod+6AD00h), symbol: "foobar2000_get_interface" (+32660h)
Address: 6C87EB1Ah (foo_uie_wsh_panel_mod+6EB1Ah), symbol: "foobar2000_get_interface" (+3647Ah)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 6C87EEA5h (foo_uie_wsh_panel_mod+6EEA5h), symbol: "foobar2000_get_interface" (+36805h)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 00E8297Ch (foobar2000+18297Ch)
Address: 77DBE0F2h (ntdll+2E0F2h), symbol: "RtlAllocateHeap" (+ACh)
Address: 6C89A940h (foo_uie_wsh_panel_mod+8A940h), symbol: "foobar2000_get_interface" (+522A0h)
Address: 00E8297Ch (foobar2000+18297Ch)
Address: 6C89A950h (foo_uie_wsh_panel_mod+8A950h), symbol: "foobar2000_get_interface" (+522B0h)
Address: 6C89A920h (foo_uie_wsh_panel_mod+8A920h), symbol: "foobar2000_get_interface" (+52280h)
Address: 6C87F09Eh (foo_uie_wsh_panel_mod+6F09Eh), symbol: "foobar2000_get_interface" (+369FEh)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 6C87907Bh (foo_uie_wsh_panel_mod+6907Bh), symbol: "foobar2000_get_interface" (+309DBh)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 77E00AE5h (ntdll+70AE5h), symbol: "WinSqmSetIfMaxDWORD" (+35h)
Address: 6C89A954h (foo_uie_wsh_panel_mod+8A954h), symbol: "foobar2000_get_interface" (+522B4h)
Address: 77DD6AC9h (ntdll+46AC9h), symbol: "RtlDosSearchPath_Ustr" (+ADAh)
Address: 77DD6ADDh (ntdll+46ADDh), symbol: "RtlDosSearchPath_Ustr" (+AEEh)
Address: 77DD6A9Bh (ntdll+46A9Bh), symbol: "RtlDosSearchPath_Ustr" (+AACh)
Address: 6C88A5C0h (foo_uie_wsh_panel_mod+7A5C0h), symbol: "foobar2000_get_interface" (+41F20h)
Address: 77DD6A3Dh (ntdll+46A3Dh), symbol: "RtlDosSearchPath_Ustr" (+A4Eh)
Address: 6C88A5C0h (foo_uie_wsh_panel_mod+7A5C0h), symbol: "foobar2000_get_interface" (+41F20h)
Address: 69D59E29h (AUDIOSES+9E29h), symbol: "DllGetClassObject" (+5401h)
Address: 69D59E40h (AUDIOSES+9E40h), symbol: "DllGetClassObject" (+5418h)
Address: 69D56350h (AUDIOSES+6350h), symbol: "DllGetClassObject" (+1928h)
Address: 77DA010Fh (ntdll+1010Fh), symbol: "KiUserExceptionDispatcher" (+Fh)
Address: 7723B9BCh (KERNELBASE+B9BCh), symbol: "RaiseException" (+58h)
Address: 00E82C94h (foobar2000+182C94h)
Address: 00D08335h (foobar2000+8335h)
Address: 00E38CE1h (foobar2000+138CE1h)
Address: 00D0848Fh (foobar2000+848Fh)
Address: 6C892308h (foo_uie_wsh_panel_mod+82308h), symbol: "foobar2000_get_interface" (+49C68h)
Address: 7723B9BCh (KERNELBASE+B9BCh), symbol: "RaiseException" (+58h)
Address: 7723B9BCh (KERNELBASE+B9BCh), symbol: "RaiseException" (+58h)
Address: 00E82C94h (foobar2000+182C94h)
Address: 00D08335h (foobar2000+8335h)
Address: 00E38CE1h (foobar2000+138CE1h)
Address: 00D0848Fh (foobar2000+848Fh)
Address: 00E3D30Dh (foobar2000+13D30Dh)
Address: 00E82C94h (foobar2000+182C94h)
Address: 00D22A54h (foobar2000+22A54h)
Address: 00E82C94h (foobar2000+182C94h)
Address: 07E011C4h (foo_ui_columns+1011C4h), symbol: "foobar2000_get_interface" (+4B7B4h)
Address: 00E6C830h (foobar2000+16C830h)
Address: 00D99646h (foobar2000+99646h)
Address: 00DAB995h (foobar2000+AB995h)
Address: 00D2DD58h (foobar2000+2DD58h)
Address: 6C848C3Eh (foo_uie_wsh_panel_mod+38C3Eh), symbol: "foobar2000_get_interface" (+59Eh)
Address: 6C848C99h (foo_uie_wsh_panel_mod+38C99h), symbol: "foobar2000_get_interface" (+5F9h)
Address: 00D9A3AEh (foobar2000+9A3AEh)
Address: 6C82C6D9h (foo_uie_wsh_panel_mod+1C6D9h)
Address: 00EA6CD8h (foobar2000+1A6CD8h)
Address: 6C888FD8h (foo_uie_wsh_panel_mod+78FD8h), symbol: "foobar2000_get_interface" (+40938h)
Address: 77683E75h (OLEAUT32+13E75h), symbol: "DispCallFunc" (+A6h)
Address: 77683CEFh (OLEAUT32+13CEFh), symbol: "LoadRegTypeLib" (+AC1h)
Address: 7767F958h (OLEAUT32+F958h), symbol: "VarBstrCmp" (+A0h)
Address: 77684037h (OLEAUT32+14037h), symbol: "DispCallFunc" (+268h)
Address: 77683D76h (OLEAUT32+13D76h), symbol: "LoadRegTypeLib" (+B48h)
Address: 7767F958h (OLEAUT32+F958h), symbol: "VarBstrCmp" (+A0h)
Address: 6C81EC6Bh (foo_uie_wsh_panel_mod+EC6Bh)
Address: 6CBFDB58h (jscript+1DB58h), symbol: "DllGetClassObject" (+CA64h)
Address: 6CBF0B04h (jscript+10B04h)
Address: 6CBFDAACh (jscript+1DAACh), symbol: "DllGetClassObject" (+C9B8h)
Address: 6CBFDA1Fh (jscript+1DA1Fh), symbol: "DllGetClassObject" (+C92Bh)
Address: 77685D03h (OLEAUT32+15D03h), symbol: "LHashValOfNameSysA" (+35Eh)
Address: 6CBFE0D0h (jscript+1E0D0h), symbol: "DllGetClassObject" (+CFDCh)
Address: 6CBFDBAAh (jscript+1DBAAh), symbol: "DllGetClassObject" (+CAB6h)
Address: 6CBFD8E8h (jscript+1D8E8h), symbol: "DllGetClassObject" (+C7F4h)
Address: 6CBF51BAh (jscript+151BAh), symbol: "DllGetClassObject" (+40C6h)
Address: 6CBE9B9Eh (jscript+9B9Eh)
Address: 64CDEE9Ah (nvd3dum+39EE9Ah), symbol: "QueryOglResource" (+F25Ah)
Address: 64CE4752h (nvd3dum+3A4752h), symbol: "QueryOglResource" (+14B12h)
Address: 6CBF0001h (jscript+10001h)
Address: 6CBFF1DEh (jscript+1F1DEh), symbol: "DllGetClassObject" (+E0EAh)
Address: 64CF00F4h (nvd3dum+3B00F4h), symbol: "QueryOglResource" (+204B4h)
Address: 6CC76BA4h (jscript+96BA4h), symbol: "DllRegisterServer" (+19B83h)
Address: 6CBF5CBDh (jscript+15CBDh), symbol: "DllGetClassObject" (+4BC9h)
Address: 773F37D9h (ole32+437D9h), symbol: "CoGetComCatalog" (+458h)
Address: 6CBF5C1Bh (jscript+15C1Bh), symbol: "DllGetClassObject" (+4B27h)
Address: 773F8863h (ole32+48863h), symbol: "CoRevokeInitializeSpy" (+5C9h)
Address: 773F393Eh (ole32+4393Eh), symbol: "CoGetComCatalog" (+5BDh)
Address: 6CBF79C1h (jscript+179C1h), symbol: "DllGetClassObject" (+68CDh)
Address: 6CBF5E31h (jscript+15E31h), symbol: "DllGetClassObject" (+4D3Dh)
Address: 6CC76BA4h (jscript+96BA4h), symbol: "DllRegisterServer" (+19B83h)
Address: 6CBEF416h (jscript+F416h)
Address: 77DBE38Ch (ntdll+2E38Ch), symbol: "RtlInitUnicodeString" (+164h)
Address: 6CC064FDh (jscript+264FDh), symbol: "DllGetClassObject" (+15409h)
Address: 6CC76BA4h (jscript+96BA4h), symbol: "DllRegisterServer" (+19B83h)
Address: 6CC76BA4h (jscript+96BA4h), symbol: "DllRegisterServer" (+19B83h)
Address: 6CBEEA52h (jscript+EA52h)
Address: 77DBE38Ch (ntdll+2E38Ch), symbol: "RtlInitUnicodeString" (+164h)
Address: 6CC76BA4h (jscript+96BA4h), symbol: "DllRegisterServer" (+19B83h)
Address: 6CBEA1BCh (jscript+A1BCh)
Address: 6CBEA107h (jscript+A107h)
Address: 6CBEF620h (jscript+F620h)
Address: 6CC76BA4h (jscript+96BA4h), symbol: "DllRegisterServer" (+19B83h)
Address: 6CBE966Eh (jscript+966Eh)
Address: 6C81B558h (foo_uie_wsh_panel_mod+B558h)
Address: 6C894790h (foo_uie_wsh_panel_mod+84790h), symbol: "foobar2000_get_interface" (+4C0F0h)

Environment:
App: foobar2000 v1.1.8
OS: Windows 6.1.7600 x64
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 5200+, features: 3DNow!ex MMX SSE SSE2 SSE3
Audio: Speakers (Saffire Audio)
UI: Columns UI 0.3.8.7

Components:
Core (2011-09-14 09:11:28 UTC)
    foobar2000 core 1.1.8
foo_albumlist.dll (2011-09-14 09:09:52 UTC)
    Album List 4.5
foo_audioscrobbler.dll (2011-05-02 23:48:11 UTC)
    Audioscrobbler 1.4.7
foo_cdda.dll (2011-09-14 09:09:40 UTC)
    CD Audio Decoder 3.0
foo_discogs.dll (2011-08-13 15:44:57 UTC)
    Discogs Tagger 1.30
foo_dsp_span.dll (2011-02-18 18:51:02 UTC)
    Surround Pan 1.3
foo_dsp_std.dll (2011-09-14 09:10:12 UTC)
    Standard DSP Array 1.0
foo_fileops.dll (2011-09-14 09:08:24 UTC)
    File Operations 2.1.3
foo_freedb2.dll (2011-09-14 09:08:22 UTC)
    freedb Tagger 0.6.4
foo_httpcontrol.dll (2011-08-22 13:14:20 UTC)
    HTTP Control 0.97.12
foo_input_std.dll (2011-09-20 17:21:14 UTC)
    Standard Input Array 1.0
foo_keep_queue.dll (2011-05-18 02:29:12 UTC)
    Keep Queue 0.3.5
foo_masstag.dll (2011-02-09 19:18:10 UTC)
    Masstagger 1.8.4
foo_out_asio.dll (2011-02-09 19:18:16 UTC)
    ASIO support 1.2.7
foo_out_ks.dll (2011-09-05 01:16:23 UTC)
    Kernel Streaming Output 1.2.2
foo_out_wasapi.dll (2011-02-09 19:18:25 UTC)
    WASAPI output support 2.1
foo_playcount.dll (2011-07-14 14:02:18 UTC)
    Playback Statistics 3.0.2
foo_prettypop.dll (2011-08-28 16:34:35 UTC)
    Pretty Popup 1.2.5
foo_queuecontents.dll (2011-09-15 14:48:30 UTC)
    Queue Contents Editor 0.4.5
foo_quicksearch.dll (2011-06-03 19:51:15 UTC)
    Quick Search Toolbar 3.2
foo_quicktag.dll (2011-02-09 19:18:33 UTC)
    Quick Tagger 1.0.3
foo_rgscan.dll (2011-09-14 09:09:32 UTC)
    ReplayGain Scanner 2.1.2
foo_run.dll (2011-06-07 17:38:41 UTC)
    Run services 0.3.7
foo_stop_after_queue.dll (2011-04-18 20:19:55 UTC)
    Stop After Queue 0.1
foo_tagbox.dll (2011-03-17 21:47:47 UTC)
    TagBox 0.212
foo_textdisplay.dll (2011-06-03 20:13:44 UTC)
    Text Display UI Element 1.1 beta 1
foo_tlbRC.dll (2009-05-04 23:44:34 UTC)
    TLB Remote Control 3.0
foo_ui_columns.dll (2011-02-09 19:18:43 UTC)
    Columns UI 0.3.8.7
foo_ui_std.dll (2011-09-14 09:09:46 UTC)
    Default User Interface 0.9.5
foo_uie_albumlist.dll (2011-02-28 22:30:56 UTC)
    Album list panel 0.3.5
foo_uie_lyrics3.dll (2011-10-09 23:50:57 UTC)
    Lyric Show Panel 3 0.1.4
foo_uie_panel_splitter.dll (2011-02-19 19:39:04 UTC)
    Panel Stack Splitter 0.3.8.3(alpha)
foo_uie_playlists_dropdown.dll (2011-05-25 02:20:44 UTC)
    Playlists Dropdown 0.7.6
foo_uie_vis_peakmeter_spectrum.dll (2011-02-19 22:31:09 UTC)
    Peakmeter Spectrum Visualisation 0.2.0.0 beta
foo_uie_wsh_panel_mod.dll (2010-06-19 15:52:06 UTC)
    WSH Panel Mod 1.3.6
foo_unpack.dll (2011-09-14 09:09:06 UTC)
    ZIP/GZIP/RAR Reader 1.6
foo_wave_seekbar.dll (2011-09-30 12:42:42 UTC)
    Waveform seekbar 0.2.13.13
foo_wlm.dll (2011-02-27 22:01:51 UTC)
    Windows Live Messenger Notifier 1.1.8a

Recent events:
Audioscrobbler: Submission succeeded.
Opening track for playback: "D:\Desktop\Mp3\Alice In Chains\Mp3\Albums\1992 - Dirt\Alice In Chains - 13. Would.mp3"
Audioscrobbler: Submitting track...
Audioscrobbler: Submission succeeded.
Opening track for playback: "D:\Desktop\Mp3\Alice In Chains\Mp3\Albums\1995 - Alice In Chains\Alice In Chains - 01. Grind.mp3"
Audioscrobbler: Submitting track...
Audioscrobbler: Submission succeeded.
Wave cache: finished analysis of "D:\Desktop\Mp3\Alice In Chains\Mp3\Albums\1995 - Alice In Chains\Alice In Chains - 02. Brush Away.mp3"
WSH Panel Mod (GUID: AE664E54-40B4-4288-9423-88FEB9A327FA): Unhandled C++ Exception: "The handle is invalid.   (0x80070006)", will crash now...
Additional Info:
==> IDispatch::Invoke: flag="DISPATCH_PROPERTYPUT", name="Volume", uuid="BAE2E084-6545-4A17-9795-1496A4EE2741"
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-12 07:20:51
hi,

first, you pollute the thread with such long post, the good way is to use [ codebox ] ... [ /codebox ] balises instead of [ code ] [ /code ]

bad topic, you should post that to the WSH panel mod developer topic : http://www.hydrogenaudio.org/forums/index....c=70363&hl= (http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&hl=)

then i see :

foo_uie_wsh_panel_mod.dll (2010-06-19 15:52:06 UTC)
    WSH Panel Mod 1.3.6


so, you should try the last version v1.4.4 which may fix your issue?

HTH
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-10-12 13:36:07
Sorry, i`m a newbie in wsh coding, but i learning

i wrote some function:
Code: [Select]
function HomePage() {
   
    var icon_test;
    icon_test = gdi.CreateImage(60, 60);
    gp = icon_test.GetGraphics();
    gp.fillroundrect(1,1,58,58,3,3,RGB(0,0,0));
    icon_test.ReleaseGraphics(gp);
    CollectGarbage();
   
    var icon_test_h;
    icon_test_h = gdi.CreateImage(60, 60);
    gp = icon_test_h.GetGraphics();
    gp.fillroundrect(1,1,58,58,3,3,RGB(50,50,50));
    icon_test_h.ReleaseGraphics(gp);
    CollectGarbage();
   
    var icon_test_c;
    icon_test_h = gdi.CreateImage(60, 60);
    gp = icon_test_h.GetGraphics();
    gp.fillroundrect(1,1,58,58,3,3,RGB(150,150,150));
    icon_test_h.ReleaseGraphics(gp);
    CollectGarbage();

    function btn_image(regular,hover,click) {
        this.regular=regular;
        this.hover=hover;
        this.click=click;
    }

   
    hp_buttons_temp={
        b1:new btn_image(icon_test,icon_test_h,icon_test_c),
        b2:new btn_image(icon_test,icon_test_h,icon_test_c)
    }
   
    my_hp_buttons_temp=new Array(
        hp_buttons_temp.b1,
        hp_buttons_temp.b2
        )

    hp_buttons=[];
   
    for (var i in my_hp_buttons_temp ) {
    hp_buttons.push(my_hp_buttons_temp[i]);
    }
   
    return hp_buttons;

}



could anybody explain me, why in other function, like on_paint, i cant draw like "hp_buttons[0].regular" or "hp_buttons[0].hover"?
is there some way to put this image in function Button(x,y,function etc)?

and one more question: i need to run some script when some usb-drive or cd is inserted, have wsh any callback for it, or some way to create it?
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-16 12:13:33
I have discovered v1.5 and I think it's really wonderful!  I wanted to do a script to play the content of the active playlist in "Shuffle Sets" mode, and v1.5 contains everything needed to do it!  :-)

The difference between the native Shuffle Albums and my Shuffle Sets mode is that Shuffle Sets uses a special "MEDLEY" tag that must be set to true when the track continues seamlessly with the next track (ie when there is no silence at the end of the current track and it is not the last track of a disc).

When the tracks are correctly tagged and Shuffle Sets is enabled, the script builds a temporary IFbMetadbHandleList containing the first track of each set.  In on_playback_new_track, it verifies if the current track is the last one in a set, and if it's the case, it selects another set in the temp list, and adds it to the playback queue.  When a set is played, it is removed from the temp list, and when the list is empty, the playback stops.

I have 3 questions.

1. My script works already well, but I would like to be able to save the temp list to disc when foobar is closed, to be able to continue the shuffle when it is restarted.  I haven't found a way to save a IFbMetadbHandleList to disc (and to reload it, of course).  Is it possible?

2. Also, currently, to begin the playback of a specific item of the current playlist when foobar is not already playing something, I have to clear the playback queue, add the item to the queue, and call fb.Play().  That works well, but I wonder if it is possible to play an item from the active playlist without having to add it to the playback queue first.  I would like something like plman.PlayItem(playlist, item), but afaik that command doesn't exist.  Is it a way to do it?
(BTW, I suppose it is possible to set fb.PlayingPlaylist=playlist, and change the currently focussed item to the item to play, and finally call Play().  But it's not a better solution, as I don't like to change the focus.)

3. My script has a function that tries to add automatically the "MEDLEY" tags in the items of the active playlist.  It works relatively well, but the method I use is somewhat cumbersome.  It is necessary to add and configure the Skip Silence DSP manually, and the script plays the last 5 seconds of each track, and detects in on_playback_time() if the DSP has skipped some seconds.  I don't like the fact that it is necessary to reconfigure the DSP chain, and, more importantly, the function fails to detect the silence if it is too short.  Furthermore, when the playlist contains many tracks, foobar2000 crashes sometimes.  I don't know why.
Do you think there is a better method?  Do you know a DSP or extension that could tag the currently playing item when the overall volume of the last second is below a certain threshold?

Thanks in advance.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-16 12:27:07
you can get the path of a metadb handle so use that to build an m3u playlist and save it to file. (look at the interfaces doc)

i don't know about the other stuff.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-16 12:36:52
you can get the path of a metadb handle so use that to build an m3u playlist and save it to file. (look at the interfaces doc)

Good idea.  Thanks!
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-16 13:03:17
Good idea.  Thanks!

Hum, sorry, but IMO that doesn't work.  I can save the paths to a m3u (or an INI or text file) and reload them when I need them, but I have no way to rebuild a new IFbMetadbHandleList from the paths.  Have I missed something?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-16 14:48:21
you need to use the standard foobar methods of loading a playlist. i don't know what else you were thinking.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-16 16:52:40
Well, I don't want to load the items in the GUI.  The list is not a playlist accessible by the user, but just a "variable" maintained by my script internally.  In other words, I just need the handles.  I want to recreate the temp IFbMetadbHandleList from the path stored in the file, to remember what sets of the active playlist have not been played during the last foobar session, and continue to play them randomly.

I could of course load the m3u in a playlist, copy the playlist in the IFbMetadbHandleList, and delete the playlist.  But it's slow, the playlist will probably appear in the GUI for a short time, and the method is not clean.

I was thinking that it should be possible to load some files from disc directly to an IFbMetadbHandleList.  But I think now that it's probably not possible, as the files tags and properties must be parsed by foobar to create the handles.  If that means that creating a playlist in the GUI is necessary, then there is no good solution, and I will have to create a temp playlist.

Anyway, thanks again for your suggestion.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-17 12:52:37
I'm now trying to add a "Sort Playlist: Randomize by Sets" function to my script, but I can't get InsertPlaylistItems() to work.

The function gets the content of the current playlist in a IFbMetadbHandleList, then reorder that list by sets, empties the current playlist, and use InsertPlaylistItems() to replace the items of the IFbMetadbHandleList in the playlist.  The first part works as expected, but when I use InsertPlaylistItems(), I have always a type mismatch error.

What are exactly the types of the arguments of InsertPlaylistItems(playlistIndex, base, handles, select = false) ?
I assume this:
UINT playlistIndex
UINT base
IFbMetadbHandleList handles
bool select

The comment about InsertPlaylistItems() in the doc says "Inserts new items into specified playlist, at specified position.", so I assume that base is the "specified position".

You can check the problem with this simplified code, that should duplicate all elements of the active playlist, but crashes:
Code: [Select]
var pl = plman.ActivePlaylist;
var all_handles = plman.GetPlaylistItems(pl);
plman.InsertPlaylistItems(pl, 0, all_handles);

Error message:
Code: [Select]
[13:51:37] Error: WSH Panel Mod ({8B5414E5-92F3-4BE8-BBB3-A7CF680847A7}): Microsoft JScript runtime error:
Type mismatch
Ln: 3, Col: 1
<source text only available at compile time>

What am I doing wrong?
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2011-10-17 14:06:48
I have a few "requests" or how to say, I think these would be useful, and lack the knowledge to write them myself.

- last.fm tag cloud, or just listing of tags. Would be useful to quickly see what genre or subgenre to tag music by.
- last.fm comments, maybe with the option to choose between song, artist and album comments.
- last.fm recommended artists, listed with links to google or wiki pages.
- songmeanings.net comments?

I don't know though if these are even possible to do, or if they've already been done. If so I cannot find them, and would be happy to be pointed to the code.
Title: WSH Panel Mod script discussion/help
Post by: T.P Wang on 2011-10-17 14:38:32
@r0lZ:
What a shame, it's a bug, thanks for reporting...
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-17 15:00:13
@r0lZ:
What a shame, it's a bug, thanks for reporting...

Don't be ashamed; it's still a beta!
Anyway, I'm glad to help.

BTW, to remove all items in the playlist, currently, I do this:
Code: [Select]
    plman.ClearPlaylistSelection(pl);
    plman.SetPlaylistSelectionSingle(pl, 0, true);
    plman.RemovePlaylistSelection(pl, true);
    plman.RemovePlaylistSelection(pl, false);

Seems a bit complicated!
Can you add the functions RemovePlaylistItemRange(playlistIndex, from, num) and RemovePlaylistAllItems(playlistIndex) ?
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-17 15:22:33
Oh, another thing.  I need to create an empty IFbMetadbHandleList, but I haven't found the way to do it.  Currently, I need to retrieve the list from any playlist, and remove all elements from the list.

Is this supposed to work?
Code: [Select]
handles = new IFbMetadbHandleList();

It produces the error: 'IFbMetadbHandleList' is undefined

[EDIT] Sorry, I've found the way to create an empty list:
Code: [Select]
handles = fb.GetSelections(0);
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2011-10-17 19:09:58
Yo marc2003!!!
I have a question for the thumbs WHS script from your samples.
I want to add an custom folder but it doesn't work...
...i tryed

E:\foobar 2000\lastfm\artist\%artist%*.*
.\lastfm\artist\%artist%*.*

...please help me 
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-10-17 22:31:14
Oh, another thing.  I need to create an empty IFbMetadbHandleList, but I haven't found the way to do it.  Currently, I need to retrieve the list from any playlist, and remove all elements from the list.

Is this supposed to work?
Code: [Select]
handles = new IFbMetadbHandleList();

It produces the error: 'IFbMetadbHandleList' is undefined

[EDIT] Sorry, I've found the way to create an empty list:
Code: [Select]
handles = fb.GetSelections(0);


Code: [Select]
handles = fb.GetSelections(0);

will not always create a empty list, it might include the now playing item inside this list.
Code: [Select]
handles = fb.GetSelections(1);

is more reasonable.
Title: WSH Panel Mod script discussion/help
Post by: Zageron on 2011-10-18 03:44:35
Quote
Looking for a simple script to list the playback queue in a WSH panel.
I've found 2 components but they kinda suck. Any suggestions solutions?


Never mind. I'm sorry, my friend is silly. Ignore me.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-18 09:10:04
Code: [Select]
handles = fb.GetSelections(1);

is more reasonable.

You're right.  fb.GetSelections(0) returns the playing item.  I've tested the function when foobar was not playing.  Thanks for the tip!

But GetSelections(1) returns the active playlist selection, and therefore the playing item, or more items!  It is not suitable either.

So, it seems that is not possible to create an empty list with a single instruction.  I will have to use my old and cumbersome method.  :-(
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-18 11:45:00
@Jango, it's just the path to a folder. don't use wildcards as it automatically reads all images.

Code: [Select]
E:\foobar 2000\lastfm\artist\%artist%


should work.
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2011-10-18 21:50:50
Sorry i explained it wrong to you. 
I use the Biography View 0.4.2.4 (foo_uie_biography) to download my bio and the artist pictures.
everything is downloadet in to one folder in the foobar directory...
... E:\foobar 2000\lastfm\artist\

ACDC.jpg
ACDC_01.bmp
ACDC_02.jpg
ACDC_03.jpg
ACDC_04.png
ACDC_05.jpg

...would it be possible to edit the script a litle bit to support the  foo_uie_biography
grouping and naming scheme.
Thank You!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-19 12:17:20
i'm not modifying the script to use the same filename patterns as the biography component. it can already download images from last.fm by itself so it seems rather pointless using the 2 in combination. pick one or the other.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-19 13:41:19
I need to retrieve the handle of the first item in the playback queue, but currently I can't do it.

Not sure how to use GetPlaybackQueueContents(), but this code prints nothing in the console, even when there are items in the queue.
Code: [Select]
    if (plman.IsPlaybackQueueActive()) {
        var arr = plman.GetPlaybackQueueContents();
        fb.trace(arr.length);
    }

The returned VBArray seems always undefined or empty.

What's wrong with that code?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-19 17:06:46
you typically need to use toArray() whenever VBarray is mentioned in the docs. try this....

Code: [Select]
var arr = plman.GetPlaybackQueueContents().toArray();
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-19 17:22:55
you typically need to use toArray() whenever VBarray is mentioned in the docs. try this....

Code: [Select]
var arr = plman.GetPlaybackQueueContents().toArray();

Yeah, that works!  Thanks! 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-19 17:29:57
not tested yet, but according to the doc, it's maybe an array of handles, so you can't display the content, it will always display nothing. Use APi from the doc to get idenx of an handle or try to browse the array to find an handle by using .Compare() method.

Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-19 17:38:46
Thanks for the precision, but it's exactly what I had the intention to do.
ie, my code will be something like this:
Code: [Select]
if (plman.IsPlaybackQueueActive()) {
        var handle = plman.GetPlaybackQueueContents().toArray()[0].Handle;
        // then I use fb.TitleFormat to get the content of the handle.
}

Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-20 14:49:16
Marc2003, maximum respect for the CD Jewel Case script for WSH  Panel Mod. Is there a similar script to show the rear CD artwork in a case?

Many thanks

Dan
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-22 09:50:15
i don't have any back images so it's not something i've ever considered.
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-22 09:56:16
Fair enough. I have rear images for most of my music. Would you be willing to tweak the script and create a rear image one too?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-22 10:23:40
well i don't have a CD back template. if you can find one i might take a look.

and it won't be for a week or so. i'm away from home and don't really have the time at the moment.

if you don't need the template, simply use my artreader script (or default artwork panel) as they both have options to display the back image.
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-22 11:28:54
Hi Marc,

How about something like this:

(http://i54.tinypic.com/31775uu.jpg)

It's fairly basic but would nicely complement your front CD case script, and would look good when viewed together on the screen. The rear artwork would just sit inside the edges of the box. The user would be able to "trim" the spines of the image or have them showing.

Thanks

Dan
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-22 20:09:41
You can check the problem with this simplified code, that should duplicate all elements of the active playlist, but crashes:
Code: [Select]
var pl = plman.ActivePlaylist;
var all_handles = plman.GetPlaylistItems(pl);
plman.InsertPlaylistItems(pl, 0, all_handles);

Error message:
Code: [Select]
[13:51:37] Error: WSH Panel Mod ({8B5414E5-92F3-4BE8-BBB3-A7CF680847A7}): Microsoft JScript runtime error:
Type mismatch
Ln: 3, Col: 1
<source text only available at compile time>

The InsertPlaylistItems() bug seems still present in beta 1, although the error message has changed:
Code: [Select]
[21:02:43] Error: WSH Panel Mod ({8B5414E5-92F3-4BE8-BBB3-A7CF680847A7}): Microsoft JScript runtime error:
Variable uses an Automation type not supported in JScript
Ln: 3, Col: 1
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-23 12:35:52
I still need some help.

I need to call fb.RunMainMenuCommand("Sort by File Path") to sort the whole playlist.  But currently, the function launches the command from the Edit -> Selection -> Sort menu, instead of the same command from the Edit -> Sort menu (probably because WSHPM stops searching the command in the menus as soon as it is found).

Is it a way to specify from which menu the command should be launched?
For example with a path like this:
Code: [Select]
fb.RunMainMenuCommand("Edit/Sort/Sort by File Path");

I know that I can select everything before calling Sort by File Path, but I would prefer to leave the selection unchanged.  Is it possible?

[EDIT]  Forgive me!
Code: [Select]
fb.RunMainMenuCommand("Edit/Sort/Sort by File Path");

It works just as I suggested!
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-23 17:55:31
For the "thumbs" script, can I get it to show images in the directory from the selected music file, rather than from a specified directory?

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-23 20:14:32
Code: [Select]
$directory_path(%path%)
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-23 23:55:39
Excellent, many thanks! Is it possible to enlarge the images by clicking on them? At the moment it only enlarges them within the confines of the panel (which is fairly small). I'd like the ability to view them full size (without having to open containing folder and then click on them again).

Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-24 00:12:06
when thumbnails are set to either left or bottom, single clicking the main image opens it in your default external viewer -when in grid mode you can right click and select "open this image".
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-24 00:36:21
Thanks. I don't get "open this image" - only "open containing folder" (in grid mode).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-24 00:44:11
it only works on an enlarged image, not thumbnails.

also, when an image is enlarged, you can scroll using your mouse wheel to save clicking back and forth between thumbnails and enlarged images.
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-24 17:54:43
I see, thanks! It would be nice to be able to open the image without having to enlarge it first, maybe an option to add to the list

BW

Dan
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-25 12:51:40
just a note to say my samples now require WSH panel mod 1.5.0 or above.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

@danhackley, middle clicking a thumbnail in grid mode now opens it in an external viewer. middle click does not have any affect in any other mode.
Title: WSH Panel Mod script discussion/help
Post by: Joffi on 2011-10-25 20:04:26
I searched "amperstamp" but came up empty.

Just wondering where the fault is in parsing the & sign in artist names (and elsewhere). When using scripts which access last.fm or google, the amperstamp and anything after is dropped. So, as an example, Angus & Julia Stone becomes Angus and the wrong band shows up.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-25 20:11:23
the term you wanted was ampersandedit: i had a quick google and it seems amperstamp is a genuine term - sorry but i'd never heard of it before.

anyway, you want to be using encodeURIComponent on your variable.

edit2: just uploaded a fix for my samples. some panels would crash with radio streams (this only applies to the new version i uploaded earlier today- previous versions should be fine)
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-26 22:33:36
Quick question re. the show images in a directory script. When I add more images to the directory, the thumbnails listed do not update. Do I have to do anything to get them to update? Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-26 23:01:21
there wasn't a practical way - you either had to open the editor and close it again or switch to a track with a different artist and back again. but i've just added a "re-scan folder" option to the context menu which should be easier.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 08:20:38
Marc, I've stolen your InputBox code for one of my scripts, but I can't get it to work properly:
Code: [Select]
var vb = new ActiveXObject('ScriptControl');
vb.Language = 'VBScript';

function InputBox(message, title, value) {
    message = message.replace(/"/g, '" + Chr(34) + "');
    message = message.replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    value = value.replace(/"/g, '" + Chr(34) + "');
    var temp_value = vb.eval("InputBox" + "(\"" + message + "\", \"" + title + "\", \"" + value + "\")");
    return typeof temp_value == "undefined" ? value : temp_value.trim();
}

val = InputBox("This is a test", "test", "");

The temp_value.trim() instruction crashes with the "Object doesn't support this property or method" error message.  Seems the string returned by vb.eval() is not a regular string object.
However, InputBox() works fine in your autoplaylists script, so I suppose I've missed something in your code (or in common2.js), but I don't know what.  Can you help?

And BTW, have you noticed that InputBox lets you type as many characters as you want, but it silently truncates the string after 254 characters?  It's a real problem with some of my playlists.  For example, the autoplaylist "Related to Hatfield and the North" needs this query (312 characters):
Code: [Select]
ARTIST HAS "Hatfield and the North" OR ALBUM ARTIST HAS "Hatfield and the North" OR COMPOSER HAS "Hatfield and the North" OR PERFORMER HAS "Hatfield and the North" OR COMMENT HAS "Hatfield and the North" OR DISCOGS_ALBUM_CREDITS HAS "Hatfield and the North" OR DISCOGS_TRACK_CREDITS HAS "Hatfield and the North"

Do you know a solution, or is it a VisualBasic limitation?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 08:28:27
add this somewhere. (it's in the common file, you must have missed it)

Code: [Select]
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
}


as for your 2nd question, sorry i have no idea. as a workaround, maybe you could just add Hatfield and the North via the input box and have the script build the query to check all those different fields?
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 08:59:05
add this somewhere. (it's in the common file, you must have missed it)

Code: [Select]
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
}

Thanks a lot!  Yes, I've missed the prototype.

as for your 2nd question, sorry i have no idea. as a workaround, maybe you could just add Hatfield and the North via the input box and have the script build the query to check all those different fields?

It's exactly what I am doing.  I have a "New 'Related to artist' autoplaylist" menu that duilds the playlist properties automatically.  But if the user wants to edit it after its creation, the InputBox function truncates the query, and the playlist doesn't work any more.

I think I will create a GUI to get the playlist properties with AutoHotkey.  It will need to read and write the arguments to a file (like your old input function did), but at least, there will be a single dialog for all parameters (and I can add "Force-sorted" and the options to add the playlist to the top or bottom of the list, to run it immediately and to remove the dupes in the same dialog).  If you are interested, I can post it here when it will be ready...
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-27 09:20:58
Thats great thanks marc - what do I need to do to reinstall with that option - just re-load the new script or add other stuff as well? PS any further thoughts on the rear album jewel case?

BW

D
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 09:40:22
just re-importing the script should work in most cases. but if you ever see an error, always extract the marc2003 folder, overwrite the existing files and restart foobar before coming back here to report it.

as for this CD case thing, i'm not sure about it really. my main problem is the fact i have no idea what aspect the images are going to be. with the front it's easy to assume they're all square but i can't do that with the back. call me lazy but i find it hard to get motivated for something i'll never use myself.

@r0lZ, yup i'd be interested in seeing what you do.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 10:02:45
@r0lZ, yup i'd be interested in seeing what you do.

OK, I will port the dialog and WSH script here, when they will be ready.

BTW, I have a new problem.  I need to parse the file created by the autoplaylist dialog to put the playlist name, query, sort pattern and force-sorted flag in an array.  The file has one line per argument.  That works fine when the sort pattern is not empty, but when it is empty, this code doesn't work:
Code: [Select]
arr = filecontent.split(/\r?\n/g);

The empty line that corresponds to the sort pattern is skipped, the force-sorted flag is stored in arr[2] instead of arr[3] and arr[3] is undefined.
I have never really studied the regular expressions, and I have been unable to modify it to include empty elements in the array.  Can you give me the correct regexpr syntax?
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-27 10:10:52
No worries marc. If you did consider it, you could assume that the rear covers are standard CD rear jewel case sizes. Maybe even have an option to choose CD (rectangular) or vinyl (square) rear art size.

WSH 1.4.4 is still listed as the current version (you say your scripts now need WSH panel mod v1.5).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 10:21:16
@r0lZ, you're asking the wrong person. i don't know regex at all. everything used in my scripts was courtesy of mr google.

maybe ReadLine would work?

http://msdn.microsoft.com/en-us/library/h7...v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/h7se9d4f%28v=vs.85%29.aspx)

@danhackley, i assume you're looking at the first post in the WSH panel mod thread? just follow the download link and you'll see 1.5.0 beta3 is available.

direct link: http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-27 10:23:31
marc, just tried your updated thumbs script. It crashes the window (error "scripting engine initialisation failed  ... CODE 0x80020101).

Is this to do with the WSH panel mod version I have installed? Thanks!
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 10:25:32
@r0lZ, you're asking the wrong person. i don't know regex at all. everything used in my scripts was courtesy of mr google.

maybe ReadLine would work?

http://msdn.microsoft.com/en-us/library/h7...v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/h7se9d4f%28v=vs.85%29.aspx)

Yes, ReadLine will certainly work, but split() is so smart! I would prefer it.
Another solution would be to swap the 3rd and 4th arguments.  Only the sort pattern argument can be empty, and it will be easy to check if the last element of the array is undefined.

Thanks anyway.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 10:26:53
my latest scripts absolutely require 1.5.0 beta3. it's not optional.

Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-27 10:27:36
Thanks again marc - I installed the latest WSH panel mod (1.5.0 beta3 showing in list of installed components).

Still get the same error with your new thumbs script - error "scripting engine initialisation failed ... CODE 0x80020101.

Edit: works now, but i had to copy the new marc2003 folder to the foobar profile directory after all !

One other request - is it possible to have the script scan one folder higher if it doesn't find any art in the colder? E.g. if there is a folder structure

Arist - Album
  - Disc 1
  - Disc 2

And the images are in the root directory artist-album, could the script look there IF there are no images in the disc folders?

Thanks 
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-27 11:30:37
Marc - I've just figured out what was wrong with the thumbs script - it recognises only .jpg files, not .jpeg. Could you fix it to recognise .jpeg also? Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 12:10:51
support for jpeg files added. this time the script hasn't changed - just files inside the marc2003 folder. so extract that and make sure you restart foobar.

you can use foobar title formatting to get to the parent folder

Code: [Select]
$replace($directory_path(%path%),\%directory%,)
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-27 13:24:45
Thanks again marc 2003. Where do I put that code?
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 14:10:12
Marc, I've finished the Autoplaylist Properties Dialog exe.  You can download the source code and the exe here: http://www.4shared.com/file/Ufb_EfTk/Autop...tiesDialog.html (http://www.4shared.com/file/Ufb_EfTk/AutoplaylistPropertiesDialog.html)

(http://img208.imageshack.us/img208/4702/autoplprop.png) (http://imageshack.us/photo/my-images/208/autoplprop.png/)

The archive contains also a working WSH script, that demonstrates its usage, but currently, it displays only a simple menu when you left-click the panel.  It should be easy to bind it to a button.

Note that the script uses hardcoded paths.  The exe file must be placed in fb.ProfilePath\wsh_scripts\, and it saves the autoplaylist file in fb.ProfilePath\wsh_settings\ (but the script filename can be changed with the windows properties, for users who want to implement it in several panels).
Also, the autoplaylist file format is not compatible with your file format, because my script saves the force-sorted flag too.  Anyway, the default filename is different.

Look at GetAutoplaylistProperties() in the WSH panel code and the comments in f2k_autoplaylist_dialog.ahk if you want to use the exe for your own code.  If you need some minor modifications (such as removing the "do not add to list" option), let me know.  I can recompile the exe easily...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 16:04:51
@danhackley. you are kidding, right? i haven't told you to edit anything so where do you think it should go? 

@r0lZ, thanks. that autohotkey thing looks interesting. i might have to learn that myself.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 16:26:36
@r0lZ, thanks. that autohotkey thing looks interesting. i might have to learn that myself.

Well, it is wonderful to automate repetitive tasks that you cannot do easily manually, as it can control most application windows (and simulate clicks on precise controls, independently of the position and size of the window - something that most automation tools cannot do), but building GUIs is not as easy as it sounds (because they use fixed positions for everything), and the AutoHotkey language is terrible (with many discrepancies in the syntax, missing flow-control instructions, and so on).  I much prefer jscript, but I use AutoHotkey to build simple GUIs and for its automation power.

Luckily, AutoHotkey_L is born.  It is a new project, based on the source code of AutoHotkey, but maintained by other guys.  They have already added the objects and real arrays, and there are plans to completely revamp the syntax of the language.  Maybe one day it will become a really good language.  Anyway, if you want to try it, be sure to download the AutoHotkey_L installer (here (http://www.autohotkey.net/~Lexikos/AutoHotkey_L/)).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 16:32:39
well to be honest, i was only interested in making a unified input for Last.fm username and API key at the same time. i'm hoping that will be easy enough if i can dissect what you've done.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 18:01:40
Yes, that should be easy.  Feel free to ask for some help.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-27 21:09:37
(http://dl.dropbox.com/u/22801321/lfm%20ahk.png)

done. here's the source if you wouldn't mind giving a quick look over. no comments but it's simple enough.

http://pastie.org/2769555 (http://pastie.org/2769555)

Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 21:24:47
Seems OK.  You learn quickly!

But you don't check if the user has typed something in both editboxes.  IMO, you should add, in ButtonOK, something like this:
Code: [Select]
ButtonOK:
Gui, Submit, NoHide; get the content of the GUI, but do not hide it
if (username == "" || api_key == "") return

Of course, you can do better tests, for example test the length of the API key.

If you want to display easily simple error messages, you can add a status bar to your window, or use MsgBox.

In my script, I've opted for another solution: the OK button becomes active only when all required fields have some contents.  Look at CheckGui:

And I've also used a powerful feature of AutoHotkey to force the window to be always on top of the Foobar window: DialogAlwaysOnTop:

But your script should work fine as it is.

[EDIT]
#SingleInstance force
is used to force a new instance to silently REPLACE the already running instance.  Not sure it's what you want.  It could be better to use
#SingleInstance ignore
With ignore, the first instance continues to run, and the second one doesn't open its window and exits immediately.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-27 21:51:49
BTW, I wonder if it is possible to run an external app and grab what it writes to stdout from WSH.  That would make the temp_file thing useless.  (I know that, for your last.fm scripts, you need to write the two output files anyway, but for a more general usage, the possibility to grab the stdout channel could permit to write complex input dialogs with AutoHotkey, and get the values in your panel easily.)
Do you think it's possible?  With WshShell.Exec() ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 10:58:24
i've had to ditch that autohotkey thing. it doesn't always write to file when clicking OK so it has to go.

as for capturing stdout with WSH, if you google i think you'll find pretty much everyone says write to file. i checked this ages ago - before i discovered the VBscript thing i'm currently using and that's fine for the simple values i use.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-28 14:15:55
i've had to ditch that autohotkey thing. it doesn't always write to file when clicking OK so it has to go.

Strange.  Are you sure it's an AutoHotkey problem?  I have never had problems when writing a file (except the usual and normal 'access denied' or 'disc full' problems).
Oh, another thing: when passing the path to the wsh_settings dir via the command line, be sure to remove the tailing slash, or it will be interpreted as an escape character, and therefore removed, and replaced by the closing quotes.  Another way to handle it is to double the backslash.  For example:
Code: [Select]
"\"" + fb.FoobarPath + "\\\""

BTW, maybe you could change your output files to an unified INI file.  Autohotkey and WSHPM have the functions to read and write them.

as for capturing stdout with WSH, if you google i think you'll find pretty much everyone says write to file. i checked this ages ago - before i discovered the VBscript thing i'm currently using and that's fine for the simple values i use.

The VBscript method is elegant, but unfortunately, I had to find another way to edit the arguments, due to the 254 characters limitation of the InputBox.  (And it's why I can't use INI files either, as the INI values are also limited to 256 characters or so.  Pity!)
I'll stick with the current "temp file" method.

Oh, I have discovered several bugs in my Autoplaylist Properties Dialog script and in the demo script.  I think I've fixed most of them, and I have improved the dialog (now, the edit boxes are ComboBoxes, with a dropdown menu with some useful default values) but this time I will check it carefully before updating the new version...

I have also a question about the Autoplaylist query syntax.  I have an autoplaylists panel (foo_softplaylists, not written with WSHPM) that can maintain autoplaylists with a query that changes dynamically when the now playing track changes.  For example, it can generates an autoplaylist with all titles in CDs by the currently playing artist, with this query:
Code: [Select]
%artist% HAS $nowplaying{%artist%} OR %album artist% HAS $nowplaying{%artist%} OR %artist% HAS $nowplaying{%album artist%} OR %album artist% HAS $nowplaying{%album artist%}

I can't get $nowplaying{%artist%} to work with fb.CreateAutoPlaylist().  Also, there is no mention of that  $nowplaying{} function in the title formatting help page, and the syntax with {} instead of () is strange, so I suppose that that syntax is handled specifically by the foo_softplaylists panel, and is not "official".  Note also that foo_softplaylists doesn't really create the autoplaylist, but it stores it in its own panel, and I can see the number of hits changing when the nowplaying artist changes.  However, when the real playlist is created, a normal (not auto) playlist is created.

Anyway, I wonder if it is possible to create real autoplaylists that change dynamically when the currently playing (or focussed) artist, album, track or whatever changes.  A playlist that shows constantly, for example, all albums by the currently playing artist would be nice.  But I wonder if the autoplaylist syntax is powerful enough, or if it's the responsibility of the panel to update the playlist query when it's necessary.  (BTW, I think that currently, it is not possible to change the query of an existing autoplaylist from WSH without having to delete and recreate the playlist.  Correct?)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 14:28:35
well you've seen my source. there is no validation on input and the files should get written to if OK is clicked no matter what. but it's failed a good few times today. re-running again afterwards works so i'm pretty sure it can't be a problem with the code/path to files. maybe it is a permissions problem but i really can't be arsed to troubleshoot it because a) i'm not familiar with it and b) i'm lazy 

as for that $nowplaying thing, i have no idea what that is. i'm guessing you can't put it into Library>Search. whatever works there should work in WSH panel mod.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-28 16:44:25
Hum, I will try to find what's wrong with your ahk script.
Do you run if from WSH in compiled (exe) form?  If it's the case, perhaps the parsing of the command line doesn't work the same way than with the source version.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 16:55:53
yup, i'm running an exe version. it's reading the command line parameters just fine because it's loading the old values from the files and populating the input fields just like it should. i also pass a variable to be used as the window title and that also works perfectly.

it works most of the time when clicking OK by writing the new values. but the fact it's failed several times randomly means it's not fit for other people to use.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-28 17:08:39
but the fact it's failed several times randomly means it's not fit for other people to use.
Of course, I agree.  But I wonder what's happening. As far as I know, there are some bugs in AutoHotkey, but not in the file I/O functions.  It's why I want to check your script here...

I suppose you are sure that the files are not being read or accessed by your WSH panels when the dialog is running.  Right?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 17:42:04
well i do know for sure my other scripts aren't trying to access the files. they only read them after the .exe has completely exited with no exit code - i copied that part from your script. i wouldn't bother wasting your time. what i have now is perfectly fine. it's come a long way since i was getting people to edit the script with their preferences.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-10-28 17:52:59
what i have now is perfectly fine. it's come a long way since i was getting people to edit the script with their preferences.
Right, but I'm puzzled.  I don't understand the problem and I don't like that.  I have also to be sure that the same problem doesn't happen with my autoplaylist dialog.  So, I'll have a look anyway...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 18:17:41
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

bugfix for simple biography, similar artists and last.fm charts. it would still let you click stuff you can't see when no username/api key was set.

autoplaylists
updated to support multiple instances. use the context menu to set it to use either a common file (default) or a unique file per panel. you can also change the panel title.

@q-stankovic, i see you're reading the thread just as i posted this. spooky. 

all the seekbar scripts require WSH panel mod 1.5.0 beta 4. all the other scripts require beta 3 as a minimum.

latest WSH panel mod beta 4 is available here: http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)

edit: just uploaded again to fix a silly problem with autoplaylists. doh!
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-28 21:31:10
Does it go under the "configure" bit where you have to paste the scripts ? Sorry for not understanding
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 21:35:17
right click the panel>image source>set custom folder.
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-28 22:09:24
Thanks. That code doesn't seem to work if the images are in the same directory as the music files though?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 22:17:56
well yes, that code only works for the parent folder. but you can use it together with the code for the current folder. the dialog tells you how.
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-10-28 22:32:06
Thanks for your patience! And one final request - code also to look in subfolders?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-28 22:44:56
you'd have to specify them manually by name (or title formatting). eg

Code: [Select]
$directory_path(%path%)\images


tiny little bugfix for my autoplaylists script. http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-30 00:56:32
samples updated. link as above.

nyan cat seekbar and simple seekbar now use a tooltip to show the seek time. thanks to T.P for the new tooltip tracking code.

requires WSH panel mod 1.5.0 beta4 (http://code.google.com/p/foo-wsh-panel-mod/downloads/list) (or later)

edit: forgot to mention for existing users, the marc2003 folder needs extracting again as background changes have been made.
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2011-10-30 01:47:55
nyan cat seekbar 
Title: WSH Panel Mod script discussion/help
Post by: jeremija on 2011-10-30 18:32:10
After a few days of playing with JScript and WSH panel, I've created a simple playlist switcher with the following features:(http://www.deviantpics.com/images/NIeuO.png)

http://pastie.org/2783951 (http://pastie.org/2783951)

Feel free to comment/reuse/modify!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-10-30 18:42:49
i'll give it a try asap, to compare it with mine which provides same features. Thanx for sharing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-10-31 09:42:21
simple text reader added to samples. it only has 2 options on the context menu: the path to the file which can be full foobar title formatting and selection mode (now playing or selected track). file extension doesn't matter so long as it is plain text. colours and font come from your UI preferences. although it has buttons to scroll, using the mouse wheel is far quicker.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)


Title: WSH Panel Mod script discussion/help
Post by: jeremija on 2011-11-02 08:26:39
How can I get the playlist context menu (with options to change autoplaylist options, save, etc)? I guess it has something to do with the InitContext() function, but I don't know how to use it.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-02 08:44:47
How can I get the playlist context menu (with options to change autoplaylist options, save, etc)? I guess it has something to do with the InitContext() function, but I don't know how to use it.


here is an example used under WSHPanelMod v1.5.0  to get context on the selection (one or more item selected), it should help you with InitContext

Code: [Select]
//=========// Item Context Menu
function new_context_menu(x, y, id, array_id) {
    var MF_STRING = 0x00000000;
    var MF_SEPARATOR = 0x00000800;
    var MF_GRAYED = 0x00000001;
    var MF_DISABLED = 0x00000002;
          
    var _menu = window.CreatePopupMenu();
    var Context = fb.CreateContextMenuManager();
    Context.InitContext(plman.GetPlaylistSelectedItems(fb.ActivePlaylist));
    Context.BuildMenu(_menu, 1, -1);

    var ret = _menu.TrackPopupMenu(x, y);
    Context.ExecuteByID(ret - 1);

    }
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-02 09:30:24
falstaff, i think you've mis-understood the question although he has confused things by mentioning InitContext . i believe jermija wants the context menu you get when right clicking on playlist tabs or the playlist manager view. you''ll just have to build that menu manually.
Title: WSH Panel Mod script discussion/help
Post by: jeremija on 2011-11-02 09:34:27
Thank you both! Yes, marc2003 is right, but what's bothering me is that I don't know how to access/launch the autoplaylist options dialog.
(http://www.giantpygmy.net/sections/pause/archive/img/DAR_v1.6.2_autoplaylist_properties.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-02 09:39:30
read the docs.  you can tell if a playlist is an autoplaylist by using

Code: [Select]
var active = plman.ActivePlaylist; 
if (fb.IsAutoplaylist(active)) _menu.AppendMenuItem(MF_STRING, 10, "Autoplaylist properties");


then later on....

Code: [Select]
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
    case 10:
        fb.ShowAutoPlaylistUI(active);
        break;


edit: i just realised you probably won't be using the active playlist like my example but you'll have your own mouse tracking code to get the selected playlist.
Title: WSH Panel Mod script discussion/help
Post by: jeremija on 2011-11-02 14:04:40
Thank you very much!  Didn't know about the ShowAutoPlaylistUI() method...
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-11-03 13:26:32
Thank you Marc for all these samples, I use many of them and love them a lot. Especially the thumbs script is so great!

Now, I'm a totally newbie at jscript and most of the things I can accomplish are done with copy & paste from scripts and a lot of trial and error...but now I have a question I simply cannot find a step into the right direction.

I would love to display the filename of the image (main image) from the thumbs plugin. Or even all, doesnt matter. Now I'd need a hint into the right direction...I know how to write a string (I guess) but as to how to retrieve the filename, I am totally lost.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-03 13:47:56
well the full path to the main image is stored in arr[index]. you'll want to grab this value in on_paint because the value of index can change whenever the mouse is moved. then to get the filename we can get the string from the last backslash to the end.

Code: [Select]
file_path = arr[index];
file_name = file_path.substring(file_path.lastIndexOf("\\") + 1);

Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-11-03 13:51:05
Thanks so much for your reply, I will try this out now!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-05 11:57:14
first video preview of my actual WIP : a WSH playlist viewer

http://www.youtube.com/watch?v=d-9L8DcsriE (http://www.youtube.com/watch?v=d-9L8DcsriE)

script release should be for this month, i have to add some features that are missing
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-11-08 13:27:56
Uhm. Okay, I have to admit I couldnt get the filename stuff done. It seems, wherever I put that second line, the script returns an error.
But Marc, you don't have to do it for me, I read somewhere you are about to move house, and I can imagine you have your hands pretty full.
I should really start trying to learn at least basics of Jscript, but right now it is no good timing (too much real life stuff going on).

But I have another request 
I would really really love a very simple recent tracks script. Right now I am using an old one from someone else; the code is not compliant with the wsh mod changes and I *think* it might be part of a problem I currently have with refresh of the scripts - they dont load at start of foobar. I have the wsh scripts in a PSS with custom code, but I had the author of the PSS script look into the code again to see if I messed something up and he couldnt find a mistake. It is no big deal really, as soon as I right-click the PSS, click settings and hit okay (without changing anything) the wsh scripts load fine.
Maybe you get the chance to write something like that after your move?
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-11-08 19:26:11
Hello! I have some questions:

i need for a callback, which will execute some script when i put in my usb player or cd. I havant any idea, except to check number of drives on timer, but i think it bery busy for cpu.

i need to new a cpu`s count (with hyper threading)

for example i launch the lame.exe encoder. how could i now that he already done his task?

is it possible to get a list of javascript files (js) in some folder and include them?

i will be very glad if this issues have any way to solve
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-11-09 07:09:55
also, i want to ask: is it possible to read and edit foobars core cfg-files through wsh?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-09 16:41:08
@Emerelle, those lines i gave need to go inside the switch statement when it's established there is at least one image in the array. one that beings case thumbnails == would be good.

or if you don't want it inside the switch statement, check the arr array contains at least one value...

Code: [Select]
if(arr.length > 0) {
//do something
}
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2011-11-10 07:49:46
Can someone help me using the new AppendTo method?

This is a sample code:
Code: [Select]
function CustomMenu(x, y) {
var a = window.CreatePopupMenu();
var idx;

a.AppendMenuItem(0, 1, "Keep aspect ratio");
a.AppendMenuItem(0, 2, "Noexpansion");
a.AppendMenuItem(0, 3, "Stretch");
a.CheckMenuRadioItem(1, 3, ar + 1);
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 4, at ? "Album Art" : "Custom Pictures");
a.AppendMenuItem(2048, 0, 0);

if (!ac) {
for (var i = 0; i < c_arr.length; i++) {
a.AppendMenuItem(0, 5 + i, c_arr[i]);
}
a.CheckMenuRadioItem(5, 9, g_state + 5);
a.AppendMenuItem(2048, 0, 0);
}

a.AppendMenuItem(ac ? 8 : 0, 10, "Auto Cycle Image");
ac && a.AppendMenuItem(ct ? 8 : 0, 11, "Faded Transition");
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 12, "Properties");
a.AppendMenuItem(0, 13, "Configure...");

idx = a.TrackPopupMenu(x, y);

switch (true) {
case (idx >= 1 && idx <= 3):
window.SetProperty("Aspect ratio", idx - 1);
aspectRatio();
window.Repaint();
break;

case (idx == 4):
switchType();
break;

case (idx >= 5 && idx <= 9):
g_state = idx - 5;
getRightImage(false);
getTimer();
break;

case (idx == 10):
window.SetProperty("Auto Cycle Image", ac ? false : true);
ac = window.GetProperty("Auto Cycle Image");
break;

case (idx == 11):
window.SetProperty("Auto Cycle Transition Fader on", ct ? false : true);
ct = window.GetProperty("Auto Cycle Transition Fader on");
break;

case (idx == 12):
window.ShowProperties();
break;

case (idx == 13):
window.ShowConfigure();
break;
}

a.Dispose();
}
How to rewrite it now by using AppendTo instead of AppendMenuItem?
Or is this new method only needed for the MainMenuManager (since its the only sample script that uses it now) to create the main menu?
I'm confused...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-10 13:26:06
you only use AppendTo when creating sub-menus.

an example:

Code: [Select]
old:
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _child.ID, "Background");

new:
_child.AppendTo(_menu, MF_STRING, "Background");
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-10 13:34:06
Code: [Select]
_child.AppendTo(_menu, MF_STRING, "Background");

BTW, MF_STRING seems not necessary.  This works fine too:
Code: [Select]
_child.AppendTo(_menu, 0, "Background");

Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2011-11-10 16:06:33
Ok, so in my script sample there's no need to replace. Thanks!

EDIT:
Again a question...

How to use the new window.SetInterval() and window.SetTimeout()?
I tried replacing window.CreateTimerInterval(50) with window.SetInterval(50) but got a crash...
What's wrong?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 16:40:54
How to use the new window.SetInterval() and window.SetTimeout()?
I tried replacing window.CreateTimerInterval(50) with window.SetInterval(50) but got a crash...
What's wrong?


here is an example that works, it refresh the display (paint) only after 50 ms when used, i use this to optimize refresh in the callback on_mouse_wheel() ;-)

Code: [Select]
    // Globals
    var mousewheel_timerID = false;


Code: [Select]
...
    if(!mousewheel_timerID) {
        mousewheel_timerID = window.SetTimeout(function() {
            window.Repaint();
            mousewheel_timerID = false;
        }, 25);
    }
...
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2011-11-10 16:44:03
Thanks, i just found the "timer" sample in the samples-folder 
Wow, have to rewrite my scripts now.

EDIT:
Is function on_timer(timer_id) now obsolete, too, since the function is called inside SetInterval/Timeout now?
I'm way more confused... 
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-11-10 17:26:42
Thank you once again Marc, I will see if I can get it done!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 17:39:05
Is function on_timer(timer_id) now obsolete, too, since the function is called inside SetInterval/Timeout now?


afaik, yep it is!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 17:57:09
Time to share my 2 new scripts : a Tabbed Playlist Manager panel and a Simple Playlist Viewer panel

[Requirements]
* foobar2000 v1.1 or better ( >> http://foobar2000.org) (http://foobar2000.org))
* WSH panel Mod v1.5.0 or better ( >> http://http://code.google.com/p/foo-wsh-pa...downloads/list) (http://http://code.google.com/p/foo-wsh-panel-mod/downloads/list))
* Fonts :
  - guifx v2 transports ( >> http://http://blog.guifx.com/2009/04/02/gu...transport-font) (http://http://blog.guifx.com/2009/04/02/guifx-v2-transport-font))
  - lucida console (bundled with Windows)
  - tahoma (bundled with Windows)

Get them by importing this DefaultUI theme file: [link] (http://br3tt.online.fr/files/WSH/foo_WSH_test_v0.7.0.fth.zip)

Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-11-10 19:58:10
Falstaff, one question -
I am using CUI and I would love to try your playlist viewer; can I get it via importing the above file wiithout loosing my layout? If not, could you possibly offer that one seperately?
Title: WSH Panel Mod script discussion/help
Post by: piment666 on 2011-11-10 19:58:28
Bravo Falstaff, it work like a charm!

Very impressive.
Title: WSH Panel Mod script discussion/help
Post by: piment666 on 2011-11-10 20:22:01
Falstaff, the tabbed playlist manager don't populate in CUI.
How come?
thanks.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 20:55:03
Falstaff, one question -
I am using CUI and I would love to try your playlist viewer; can I get it via importing the above file wiithout loosing my layout? If not, could you possibly offer that one seperately?


right click panel (columns header for the playlist viewer / a button for the taabed playlist manager) > Configure

it will open the edit window, there is a button 'Tools' on bottom left, use it to export/import script or just select the text of the script and copy/past it to another new WSH panel to one of your config, CUI or DUI

nothing more to do
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 20:58:26
Falstaff, the tabbed playlist manager don't populate in CUI.
How come?
thanks.


of course it does, you maybe haven't right copied/pasted it into you WSH panel in your CUI config, try again please

EDIT: have you the last version of WSH panel Mod installed (v1.5.0 final) ?
Title: WSH Panel Mod script discussion/help
Post by: chiwou on 2011-11-10 21:13:53
small bug, if you use the mouse wheel up even if the playlist is already on top, it starts to scroll down, weird  but funny
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 21:18:01
small bug, if you use the mouse wheel up even if the playlist is already on top, it starts to scroll down, weird  but funny


not a bug due to my script, i've encountered a such bug on a laptop, it's the mouse driver that is missing, the default driver of windows is not enough. apparently, it seems that WSH panel mod requires you install the good mouse driver of your mouse model.

try, (i've fixed it this way), it will fix your issue
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-11-10 21:18:12
Uhm, I thought the fth files go into the DUI dialog...importing a script into wsh panel mod is no problem - anyway, will look into that now, thanks.

EDIT: My problem is, the zip only contains the fth file, so I cant get the script out of it without loading that, hence the question
Title: WSH Panel Mod script discussion/help
Post by: piment666 on 2011-11-10 21:31:00

EDIT: have you the last version of WSH panel Mod installed (v1.5.0 final) ?
[/quote]


Yes,  I do (just re-installed it, to be sure), and I also re-export both your scripts from a DUI to my CUI, both scripts works well in DUI, but the tab won't populated in CUI.

Too bad for me.
Title: WSH Panel Mod script discussion/help
Post by: fbuser on 2011-11-10 21:56:01
Code: [Select]
_child.AppendTo(_menu, MF_STRING, "Background");

BTW, MF_STRING seems not necessary.  This works fine too:
Code: [Select]
_child.AppendTo(_menu, 0, "Background");

It works because MF_STRING = 0x00000000, but it is really not a good idea to replace constants by their value.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 22:05:19
Yes,  I do (just re-installed it, to be sure), and I also re-export both your scripts from a DUI to my CUI, both scripts works well in DUI, but the tab won't populated in CUI.

Too bad for me.


it works fine for me under CUI, i can't reproduce your problem.

Has somebody else tested the script under CUI ?
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-11-10 22:27:19
Yes,  I do (just re-installed it, to be sure), and I also re-export both your scripts from a DUI to my CUI, both scripts works well in DUI, but the tab won't populated in CUI.

Too bad for me.


it works fine for me under CUI, i can't reproduce your problem.

Has somebody else tested the script under CUI ?


I can not even make the tabs work under DUI. fb says there is something wrong in line
when i import the fth file, a message pops out:

Scripting Engine Initialization Failed (WSH Tabbed Playlist Manager v3.0 by Br3tt, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

####
solved!!
line 227 should be:

    pad_right : bt_w * 2, scroll : false, scroll_step : 40, pos : 0

delete the comma at last.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-10 22:55:36
.zip updated with original scripts ! the ones shared before have been compressed to remove comments and to adjust indentations .... that coukd brought some bug apparently !

so, for those who had problem, download the new .zip to fix your issues, they should be gone!

or here is direct link to the script :

* tabbed playlist manager : http://pastebin.com/Lf3uqjaz (http://pastebin.com/Lf3uqjaz)

* simple playlist viewer : http://pastebin.com/k87s135g (http://pastebin.com/k87s135g)
Title: WSH Panel Mod script discussion/help
Post by: chiwou on 2011-11-11 06:45:12
small bug, if you use the mouse wheel up even if the playlist is already on top, it starts to scroll down, weird  but funny


not a bug due to my script, i've encountered a such bug on a laptop, it's the mouse driver that is missing, the default driver of windows is not enough. apparently, it seems that WSH panel mod requires you install the good mouse driver of your mouse model.

try, (i've fixed it this way), it will fix your issue

well I use the latest Intellipoint driver (microsoft mouse), but I'll test it later on my PC (no trackball/touchpad)

thanks
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-11-11 10:21:20
can anybody answer me? i writed below. its important to me
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-11 11:00:08
i need for a callback, which will execute some script when i put in my usb player or cd. I havant any idea, except to check number of drives on timer, but i think it bery busy for cpu.
i need to new a cpu`s count (with hyper threading)
for example i launch the lame.exe encoder. how could i now that he already done his task?


i dunno

is it possible to get a list of javascript files (js) in some folder and include them?


yes, it's possible to check content of a folder and read/write text files with jscript, and so, with WSH panel Mod, check msdn javascript for examples, i'm not at home and i haven't samples on the hand right now.

also, i want to ask: is it possible to read and edit foobars core cfg-files through wsh?


.cfg are binaries files, so afaik, it's not possible to read/write them from WSH panel mod.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-11-11 11:07:15
very sad. Id like to write something like ipod manager for foobar, but for converting music to regular usb player, because inner foobars converter isnt handy. seems, i need to learn how to write a dll-plugins
Title: WSH Panel Mod script discussion/help
Post by: piment666 on 2011-11-11 17:38:42
Falstaff: just to be sure, I try both your scripts on a fresh fb installation, with the correct WSH panel mod and the proper interface.api and jscript.api, both script works very well with DUI, but the tabbed playlist still don't work with CUI and there is no error message on the console.
Anyways, your simple playlist did became my default playlist.

Great work.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-11 21:17:42
Falstaff: just to be sure, I try both your scripts on a fresh fb installation, with the correct WSH panel mod and the proper interface.api and jscript.api, both script works very well with DUI, but the tabbed playlist still don't work with CUI and there is no error message on the console.
Anyways, your simple playlist did became my default playlist.

Great work.


very weird, i'm curious to find another case for who it doesn't work too under CUI ...?? you should be more accurate please
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-12 09:47:21
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

bugfix: simple biography & simple text reader row height is now dynamic dependent on font instead of the fixed size it was before.

(existing users need to extract the marc2003 folder again and import the updated script)
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-12 10:39:34
Firstly, I must say I have no clue how to script with this component, and I've been scratching my head for a long time thinking it might be nice to learn. Unfortunately I find no structured way of 'learning'. All the documentation I have ever found seems to be like looking at the 'Oxford English Dictionary'; it's useful if you know how to use the English language, otherwise there is no structured guidance.

Having said that, here is my problem...

One of the "essential" panels in my foobar2000 layout is a fantastic WSH artwork viewer which has auto-scrolling and other built-in functions. This script has been part of my layout for a long time. I copied the script from someone else's foobar2000 skin (named EIKO).

A few days ago I updated "WSH_Panel_Mod.dll" to version 1.5.0, and when I view the console output after foobar2000 has started I now see these lines:
WSH Panel Mod: Warning: Obsolete: window.CreateTimerInterval() is now obsolete, please use window.SetInterval() in new script.
WSH Panel Mod: Warning: Obsolete: window.CreateTimerTimeout() is now obsolete, please use window.SetTimeout() in new script.
WSH Panel Mod: Warning: Obsolete: Please use AppendTo() method to create sub menu instead of AppendMenuItem()


I opened the config of my WSH Artwork Viewer panel and conducted a text search. I found references to the "old" WSH Panel Mod methods !

What do I do now? There is no way I am ever going to remove my WSH Artwork Viewer, and I have no capability to edit the script !

Do I simply replace all instances of  the text window.CreateTimerInterval() with window.SetInterval() ...is that it?  ...or does the function need to be re-written?

It seems to me that unless I somehow learn how to edit WSH Panel Mod scripts on my own, I am going to have to NOT update this component anymore !!??
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-12 10:59:32
Do I simply replace all instances of  the text window.CreateTimerInterval() with window.SetInterval() ...is that it?  ...or does the function need to be re-written?

Replace window.CreateTimerInterval(delay) with window.SetInterval(on_timer, delay)
For example, if the delay is 500 ms, replace window.CreateTimerInterval(500) with window.SetInterval(on_timer, 500)
It will work, at least if there is only one timer used in your script.
(You can also rename on_timer and the on_timer() function to something else, but it's not necessary.)

For AppendMenuItem(), see here: http://www.hydrogenaudio.org/forums/index....st&p=773643 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=773643)
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-12 11:36:02
@r0lz,
thanks for the guidance +++
What about window.SetTimeout() . Do you have info on that one?

@ marc2003,
I just added your Autoplaylists script to a tabbed panel ...it is brilliant ...much nicer than loading these things at foobar2000 startup.
Unfortunately, it is taking the background color of my general display preferences, but I have a different custom color scheme for my tabbed panel.
I right-click on your WSH Panel, but I don't see a Properties page entry. How do I edit the colors?
The background color I want is BROWN-BLACK (RGB: 28,28,28), with WHITE Foreground/Font (RGB: 255,255,255)
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-12 11:51:24
What about window.SetTimeout() . Do you have info on that one?

Same thing: replace CreateTimerTimeout(timeout) with SetTimeout(on_timer, timeout)

Have a look at Interfaces.txt.  The syntax for each function is listed (but without much explanation).

Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-12 14:30:36
So I tried to edit one of the three obsolete methods   --->   CreateTimerInterval

One line in my script contained:   this.ChangeTimer = window.CreateTimerInterval(Prop.ChangeAnimation.RefreshInterval);
Nine other lines in my script contained:   this.GetImageTimer = window.CreateTimerInterval(200);    (the integer varied between 200, 120, 50)

I changed One line to:   this.ChangeTimer = window.SetInterval(on_timer, Prop.ChangeAnimation.RefreshInterval);
I changed Nine other lines to:   this.GetImageTimer = window.SetInterval(on_timer, 200);    (the integer varied between 200, 120, 50)

--------------------------------------------------------------------------------------------------------------------------------
WSH Panel Mod:      Aw, crashed ):

Console:      Error: WSH Panel Mod ({FFF2B498-2C93-4683-9C3B-504C9370EC6B}): Microsoft JScript runtime error:
Console:      Object doesn't support this property or method
Console:      File: <main>
Console:      Ln: 1233, Col: 3
Console:      <source text only available at compile time>
--------------------------------------------------------------------------------------------------------------------------------

It seems like the info by r0lz is not enough ... any other suggestions?

Line 1233 in the script looks like this:
Code: [Select]
1231    function KillGetImageTimer (){
1232        if (Image.GetImageTimer){
1233            Image.GetImageTimer.Dispose();
1234            Image.GetImageTimer = null;
1235            CollectGarbage();
1236        }
1237    }
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2011-11-12 14:45:58
Falstaff i tried your WSH playlist on a fresh install (CUI) with the latest WSH Panel Mod installed. It displays everything fine, but double-clicking a track does nothing. Any ideas?
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-12 14:55:23
I don't know why your changes do not work.  Can you post the original script somewhere?
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-12 15:25:36
r0lz, I appreciate your effort for trying get my script to work +++

Here is an upload of my original script with all its support files, so you can make it work 'out of the box' (make sure to read the README):
WSH_Artwork_Viewer uploaded at filebeam (500 KB) (http://filebeam.com/209586a9b235a19e57066545e991fa97)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-12 16:06:33
Falstaff i tried your WSH playlist on a fresh install (CUI) with the latest WSH Panel Mod installed. It displays everything fine, but double-clicking a track does nothing. Any ideas?


no. it should play the track. it does for me (CUI and DUI)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-12 16:13:55
@derty2, you can set those colours right at the start of the on_paint() function

Code: [Select]
g_backcolor = RGB(28, 28, 28); //background
g_textcolor = RGB(255, 255, 255); //text
g_textcolor_hl = RGB(255, 255, 255); //title text
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-11-12 17:17:47
Thank you very much! 

I just noticed the new autoplaylist script with abilty to change name - somehow i missed it two weeks ago. I won't use the common file panel mode but it should be mentioned that it can be quite confusing that changes in one panel aren't reflected suddenly in the other ones. I mean confusing in that sense that if a new user don't know this feature and starts using several panels he will be wondering that after restarting foobar2000 all panels will be overwritten with last saved panel. Mabe it is a good idea to make unique file mode the default one (after importing script)

A little request for convenience: it would be nice to have all settings for autoplaylist: name, query, sorting and option for force-sorting in one window rather than clicking from window to window and having global option for force-sorting.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-12 18:02:23
ah yes, i forgot to implement synchronisation between common autoplaylist panels. that's now fixed.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-12 19:12:26
marc2003, Thanks for the color code +++

I just created 12 Autoplaylists for myself, and I ended up with 12 extra playlists...
I tried restarting foobar2000 and it took a long time to start. I would like to have only one Autoplaylist existing at any point in time; this means I would prefer if all new Autoplaylist queries overwrote each other. Is it possible to have a preference for this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-12 19:22:30
i won't be adding more options but you can stop the panel automatically generating playlists. right click>on successful creation/edit>do nothing.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-11-12 21:31:43
right click>on successful creation/edit>do nothing.

By the way: i have this option enabled and because of that the option "replace existing playlists with same name" is greyed out and hence not available although it makes sense to have it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-12 22:06:51
you've completely lost me. 

obviously that option is grayed out for a reason. you've explicitly chosen the option do nothing so how can that action even be performed? you do know what replace means, right?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-11-13 10:39:06
My scripts are now centralized here : http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

new versions uploaded of my playlist viewer and tabbed playlist manager

Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2011-11-13 12:14:07
@marc2003
well, when you execute a query from icon with option "do nothing" enabled then the created autoplaylist will replace or not replace already existing ones with same name - depending from check state of grayed out option "replace ..."
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-13 12:45:02
ok, i see what you mean now. clicking that button doesn't really fit in with those options. anyway, the option is no longer grayed out and i might look into re-arranging the menu sometime.
Title: WSH Panel Mod script discussion/help
Post by: Takaji on 2011-11-15 01:21:03
After doing a fresh install of foobar on a new Windows install, I'm met with this error which seems to be coming from my WSH panel script. Keep in mind that I've altered nothing in this script between installs.

Code: [Select]
Illegal operation:
Code: C0000005h, flags: 00000000h, address: 64E93A43h
Access violation, operation: read, address: 00000050h

Call path:
entry=>app_mainloop

Code bytes (64E93A43h):
64E93A03h:  00 00 0F 84 90 56 0A 00 8B 55 C4 8D 45 C0 50 6A
64E93A13h:  00 8D 4D B8 51 52 E8 41 48 FD FF 89 45 E8 8B 45
64E93A23h:  0C 85 C0 74 15 8B 8B 5C 01 00 00 8B 51 50 8B 4D
64E93A33h:  C0 50 E8 54 4C FD FF 89 45 E0 8B 83 5C 01 00 00
64E93A43h:  8B 48 50 85 F6 8B 75 E8 0F 95 C2 88 91 74 05 00
64E93A53h:  00 85 F6 0F 88 A2 4E 04 00 8D 47 04 50 FF 15 68
64E93A63h:  13 E6 64 85 C0 0F 85 35 87 FD FF 8B 47 34 C7 07
64E93A73h:  FC C7 E6 64 85 C0 0F 85 C2 56 0A 00 8B 47 0C 8B

Stack (0040EA9Ch):
0040EA7Ch:  00000000 FFFFFD34 000002E4 FFFFFD34
0040EA8Ch:  000002CC 00000019 00000000 0040EAD0
0040EA9Ch:  483ADF8E 00000000 0040EB40 0012EF48
0040EAACh:  07D45CB0 00000000 00000000 0012E640
0040EABCh:  07D45CB0 0012E640 00000000 00000000
0040EACCh:  00000000 07D4F120 08E45BE0 082D6E00
0040EADCh:  0012A994 025D3278 00000008 00000000
0040EAECh:  00000004 00000000 025D2420 80020101
0040EAFCh:  0012EF48 0040EA9C 0040EBA4 64FFC075
0040EB0Ch:  00000001 0040EBB4 64E938B7 0012EF48
0040EB1Ch:  00000000 00000000 483ADFB6 08DA5960
0040EB2Ch:  00000000 08DA5962 77281ECD 00000000
0040EB3Ch:  0012DD88 00000000 00000000 00000000
0040EB4Ch:  00000000 00000000 00000000 00000000
0040EB5Ch:  00000000 08DA5960 00000000 0040EBFC
0040EB6Ch:  0012A450 64E922D4 00000000 00000000
0040EB7Ch:  00000009 00000000 00000000 00000000
0040EB8Ch:  00000000 00001D68 00000000 00000001
0040EB9Ch:  483ADFAA 00000000 0040EC74 64FFC0C9
0040EBACh:  00000000 75ED14DD 0040EC00 64E84915

Registers:
EAX: 00000000, EBX: 0012EF48, ECX: 0040EAC8, EDX: 07D4F120
ESI: 00000000, EDI: 025D2420, EBP: 0040EB10, ESP: 0040EA9C

Crash location:
Module: jscript9
Offset: 33A43h
Symbol: "DllGetClassObject" (+A337h)

Loaded modules:
foobar2000                      loaded at 00BA0000h - 00D92000h
ntdll                            loaded at 77210000h - 77390000h
kernel32                        loaded at 75EC0000h - 75FD0000h
KERNELBASE                      loaded at 76280000h - 762C6000h
COMCTL32                        loaded at 6CF00000h - 6D09E000h
msvcrt                          loaded at 762D0000h - 7637C000h
GDI32                            loaded at 765F0000h - 76680000h
USER32                          loaded at 75890000h - 75990000h
ADVAPI32                        loaded at 76540000h - 765E0000h
sechost                          loaded at 76790000h - 767A9000h
RPCRT4                          loaded at 75990000h - 75A80000h
SspiCli                          loaded at 74900000h - 74960000h
CRYPTBASE                        loaded at 748F0000h - 748FC000h
LPK                              loaded at 74AE0000h - 74AEA000h
USP10                            loaded at 75FD0000h - 7606D000h
SHLWAPI                          loaded at 76190000h - 761E7000h
DSOUND                          loaded at 6DD40000h - 6DDB2000h
ole32                            loaded at 75B10000h - 75C6C000h
WINMM                            loaded at 72F20000h - 72F52000h
POWRPROF                        loaded at 6C980000h - 6C9A5000h
SETUPAPI                        loaded at 75CF0000h - 75E8D000h
CFGMGR32                        loaded at 74990000h - 749B7000h
OLEAUT32                        loaded at 75A80000h - 75B0F000h
DEVOBJ                          loaded at 74B00000h - 74B12000h
UxTheme                          loaded at 6CA80000h - 6CB00000h
SHELL32                          loaded at 74BE0000h - 7582A000h
zlib1                            loaded at 5A4C0000h - 5A4D4000h
shared                          loaded at 6DE20000h - 6DE4B000h
imagehlp                        loaded at 75E90000h - 75EBA000h
dbghelp                          loaded at 641E0000h - 642CB000h
COMDLG32                        loaded at 75C70000h - 75CEB000h
Secur32                          loaded at 70100000h - 70108000h
CRYPT32                          loaded at 749C0000h - 74ADD000h
MSASN1                          loaded at 74AF0000h - 74AFC000h
gdiplus                          loaded at 6C630000h - 6C7C0000h
IMM32                            loaded at 75830000h - 75890000h
MSCTF                            loaded at 76840000h - 7690C000h
CLBCatQ                          loaded at 761F0000h - 76273000h
MMDevApi                        loaded at 6C400000h - 6C439000h
PROPSYS                          loaded at 6C300000h - 6C3F5000h
dwmapi                          loaded at 6C9D0000h - 6C9E3000h
foo_input_std                    loaded at 68490000h - 685FD000h
foo_channel_mixer                loaded at 6DDE0000h - 6DE1F000h
foo_discogs                      loaded at 6B2E0000h - 6B343000h
WININET                          loaded at 76070000h - 7618A000h
Normaliz                        loaded at 765E0000h - 765E3000h
iertutil                        loaded at 76380000h - 76538000h
urlmon                          loaded at 76680000h - 76790000h
foo_uie_albumlist                loaded at 10000000h - 10043000h
foo_burninate                    loaded at 6DC30000h - 6DC6E000h
foo_playcount                    loaded at 6AFC0000h - 6AFFE000h
foo_uie_playlists_dropdown      loaded at 00410000h - 0044C000h
foo_jesus                        loaded at 6DE60000h - 6DE7A000h
foo_out_ks                      loaded at 00450000h - 0047A000h
foo_input_tak                    loaded at 6AF10000h - 6AF54000h
tak_deco_lib                    loaded at 004C0000h - 004E0000h
foo_rgscan                      loaded at 69C50000h - 69C9B000h
foo_input_dvda                  loaded at 699C0000h - 69A1B000h
foo_dsp_resampler                loaded at 02FD0000h - 03095000h
foo_masstag_addons              loaded at 005D0000h - 005EF000h
foo_input_dsdiff                loaded at 00600000h - 0062D000h
foo_skip                        loaded at 69990000h - 699BD000h
foo_facets                      loaded at 661D0000h - 66385000h
MSIMG32                          loaded at 69900000h - 69905000h
foo_uie_peakmeter                loaded at 00B50000h - 00B83000h
foo_dop                          loaded at 07820000h - 079F3000h
WS2_32                          loaded at 76910000h - 76945000h
NSI                              loaded at 771E0000h - 771E6000h
QUARTZ                          loaded at 68270000h - 683E7000h
foo_dsp_effect                  loaded at 027A0000h - 027DA000h
foo_uie_typefind                loaded at 02D70000h - 02DA0000h
foo_simplaylist                  loaded at 66400000h - 6654C000h
foo_simplaylist_manager          loaded at 660F0000h - 661C8000h
foo_ac3                          loaded at 02DF0000h - 02E20000h
foo_cdda                        loaded at 69940000h - 6998E000h
foo_uie_panel_splitter          loaded at 031C0000h - 03219000h
foo_input_ht                    loaded at 07BC0000h - 07CC8000h
foo_freedb2                      loaded at 69880000h - 698C0000h
foo_out_asio                    loaded at 06CE0000h - 06D16000h
foo_out_wasapi                  loaded at 06F70000h - 06F96000h
foo_audioscrobbler              loaded at 070C0000h - 070F3000h
foo_input_ds                    loaded at 07100000h - 0712D000h
foo_random                      loaded at 07190000h - 071CD000h
foo_masstag                      loaded at 07280000h - 072D4000h
foo_input_reverse                loaded at 07150000h - 07176000h
foo_uie_tabs                    loaded at 071D0000h - 071F8000h
foo_fileops                      loaded at 68440000h - 68487000h
foo_input_tta                    loaded at 072E0000h - 07322000h
foo_autoupdate                  loaded at 67340000h - 6738C000h
foo_ui_std                      loaded at 652E0000h - 653F9000h
foo_ui_columns                  loaded at 08470000h - 08600000h
foo_input_sacd                  loaded at 66390000h - 663FC000h
foo_input_alac                  loaded at 07340000h - 0735D000h
foo_converter                    loaded at 66070000h - 660EC000h
foo_albumlist                    loaded at 66010000h - 6606D000h
foo_unpack                      loaded at 69910000h - 6993E000h
foo_texttools                    loaded at 67300000h - 67334000h
foo_chacon                      loaded at 68240000h - 68264000h
foo_dsp_crossfeed                loaded at 07770000h - 07798000h
foo_input_monkey                loaded at 07B00000h - 07B49000h
foo_verifier                    loaded at 07CD0000h - 07D13000h
foo_dsp_xgeq                    loaded at 652A0000h - 652D4000h
foo_dsp_std                      loaded at 65250000h - 65298000h
foo_uie_wsh_panel_mod            loaded at 65170000h - 65243000h
foo_input_dtshd                  loaded at 65020000h - 6516A000h
AUDIOSES                        loaded at 6C2A0000h - 6C2D6000h
SXS                              loaded at 6C9F0000h - 6CA4F000h
jscript9                        loaded at 64E60000h - 6501B000h
VERSION                          loaded at 73270000h - 73279000h
WindowsCodecs                    loaded at 747B0000h - 748AB000h
apphelp                          loaded at 6E7D0000h - 6E81C000h
EhStorShell                      loaded at 64160000h - 64191000h
ntshrui                          loaded at 64080000h - 640F0000h
srvcli                          loaded at 6B2A0000h - 6B2B9000h
cscapi                          loaded at 67390000h - 6739B000h
slc                              loaded at 641D0000h - 641DA000h
IconCodecService                loaded at 748B0000h - 748B6000h
sud                              loaded at 64C20000h - 64CDB000h
ADVPACK                          loaded at 68410000h - 6843E000h
DUI70                            loaded at 64B60000h - 64C12000h
WINTRUST                        loaded at 74960000h - 7498D000h
CFNetwork                        loaded at 72790000h - 729F0000h
iphlpapi                        loaded at 72C30000h - 72C4C000h
WINNSI                          loaded at 72C20000h - 72C27000h
CoreFoundation                  loaded at 72FD0000h - 730D9000h
MSVCR80                          loaded at 73130000h - 731CB000h
pthreadVC2                      loaded at 72FC0000h - 72FD0000h
WSOCK32                          loaded at 72FB0000h - 72FB7000h
objc                            loaded at 72F90000h - 72FAD000h
MSVCP80                          loaded at 731D0000h - 73257000h
libdispatch                      loaded at 72F80000h - 72F8E000h
libicuin                        loaded at 72DE0000h - 72F1A000h
libicuuc                        loaded at 72CF0000h - 72DD3000h
icudt46                          loaded at 4AD00000h - 4BC8B000h
ASL                              loaded at 72C90000h - 72CA1000h
SQLite3                          loaded at 720B0000h - 7211F000h
libxml2                          loaded at 71F70000h - 720A3000h
iTunesMobileDevice              loaded at 62A40000h - 62B8E000h
dnssd                            loaded at 72BF0000h - 72C05000h
icuin40                          loaded at 6DE50000h - 6DE56000h
profapi                          loaded at 73100000h - 7310B000h
mswsock                          loaded at 72B80000h - 72BBC000h
wshtcpip                        loaded at 72B70000h - 72B75000h
CRYPTSP                          loaded at 72F60000h - 72F76000h
rsaenh                          loaded at 72CB0000h - 72CEB000h

Stack dump analysis:
Address: 64FFC075h (jscript9+19C075h), symbol: "DllUnregisterServer" (+7D369h)
Address: 64E938B7h (jscript9+338B7h), symbol: "DllGetClassObject" (+A1ABh)
Address: 77281ECDh (ntdll+71ECDh), symbol: "WinSqmSetIfMaxDWORD" (+35h)
Address: 64E922D4h (jscript9+322D4h), symbol: "DllGetClassObject" (+8BC8h)
Address: 64FFC0C9h (jscript9+19C0C9h), symbol: "DllUnregisterServer" (+7D3BDh)
Address: 75ED14DDh (kernel32+114DDh), symbol: "HeapFree" (+14h)
Address: 64E84915h (jscript9+24915h), symbol: "JsVarToScriptDirect" (+22CA9h)
Address: 64E9230Ah (jscript9+3230Ah), symbol: "DllGetClassObject" (+8BFEh)
Address: 64E922D4h (jscript9+322D4h), symbol: "DllGetClassObject" (+8BC8h)
Address: 65179DA5h (foo_uie_wsh_panel_mod+9DA5h)
Address: 65210FF4h (foo_uie_wsh_panel_mod+A0FF4h), symbol: "foobar2000_get_interface" (+5CA34h)
Address: 65208058h (foo_uie_wsh_panel_mod+98058h), symbol: "foobar2000_get_interface" (+53A98h)
Address: 651799C4h (foo_uie_wsh_panel_mod+99C4h)
Address: 758B12A5h (USER32+212A5h), symbol: "PostMessageW" (+0h)
Address: 65210FF4h (foo_uie_wsh_panel_mod+A0FF4h), symbol: "foobar2000_get_interface" (+5CA34h)
Address: 652080CAh (foo_uie_wsh_panel_mod+980CAh), symbol: "foobar2000_get_interface" (+53B0Ah)
Address: 651ABFD9h (foo_uie_wsh_panel_mod+3BFD9h)
Address: 758A6D91h (USER32+16D91h), symbol: "GetThreadDesktop" (+12Eh)
Address: 758A6D51h (USER32+16D51h), symbol: "GetThreadDesktop" (+EEh)
Address: 758A6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758A6D51h (USER32+16D51h), symbol: "GetThreadDesktop" (+EEh)
Address: 758A965Eh (USER32+1965Eh), symbol: "GetWindow" (+3F0h)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 758CD0F5h (USER32+3D0F5h), symbol: "SendDlgItemMessageW" (+0h)
Address: 6517F518h (foo_uie_wsh_panel_mod+F518h)
Address: 6517F39Bh (foo_uie_wsh_panel_mod+F39Bh)
Address: 65205FC8h (foo_uie_wsh_panel_mod+95FC8h), symbol: "foobar2000_get_interface" (+51A08h)
Address: 652082AAh (foo_uie_wsh_panel_mod+982AAh), symbol: "foobar2000_get_interface" (+53CEAh)
Address: 651ABED5h (foo_uie_wsh_panel_mod+3BED5h)
Address: 758CD0F5h (USER32+3D0F5h), symbol: "SendDlgItemMessageW" (+0h)
Address: 65197E52h (foo_uie_wsh_panel_mod+27E52h)
Address: 6520FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 652083D0h (foo_uie_wsh_panel_mod+983D0h), symbol: "foobar2000_get_interface" (+53E10h)
Address: 65197747h (foo_uie_wsh_panel_mod+27747h)
Address: 651AB797h (foo_uie_wsh_panel_mod+3B797h)
Address: 65214D0Ch (foo_uie_wsh_panel_mod+A4D0Ch), symbol: "foobar2000_get_interface" (+6074Ch)
Address: 65199200h (foo_uie_wsh_panel_mod+29200h)
Address: 758A62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 758CF943h (USER32+3F943h), symbol: "GetCursor" (+263h)
Address: 758CF8FBh (USER32+3F8FBh), symbol: "GetCursor" (+21Bh)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758CF784h (USER32+3F784h), symbol: "GetCursor" (+A4h)
Address: 758CF860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 758CF889h (USER32+3F889h), symbol: "GetCursor" (+1A9h)
Address: 758A62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 758CF860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 758CF860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 758A6D3Ah (USER32+16D3Ah), symbol: "GetThreadDesktop" (+D7h)
Address: 758CF860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 758A6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758A965Eh (USER32+1965Eh), symbol: "GetWindow" (+3F0h)
Address: 758A9679h (USER32+19679h), symbol: "SendMessageW" (+0h)
Address: 758A96C5h (USER32+196C5h), symbol: "SendMessageW" (+4Ch)
Address: 6CFA4601h (COMCTL32+A4601h), symbol: "GetEffectiveClientRect" (+3409h)
Address: 6CFA4663h (COMCTL32+A4663h), symbol: "GetEffectiveClientRect" (+346Bh)
Address: 6CFA44EDh (COMCTL32+A44EDh), symbol: "GetEffectiveClientRect" (+32F5h)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 768439F5h (MSCTF+39F5h)
Address: 76843F35h (MSCTF+3F35h), symbol: "TF_GetAppCompatFlags" (+16Dh)
Address: 758A62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 758A6D3Ah (USER32+16D3Ah), symbol: "GetThreadDesktop" (+D7h)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 758A6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758A77C4h (USER32+177C4h), symbol: "CharPrevW" (+138h)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758A788Ah (USER32+1788Ah), symbol: "DispatchMessageW" (+Fh)
Address: 6CF2B495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 758CC81Fh (USER32+3C81Fh), symbol: "IsDialogMessageW" (+11Eh)
Address: 758CCDE7h (USER32+3CDE7h), symbol: "DialogBoxIndirectParamW" (+1F4h)
Address: 758CCF5Ch (USER32+3CF5Ch), symbol: "DialogBoxIndirectParamAorW" (+108h)
Address: 758CCE8Ah (USER32+3CE8Ah), symbol: "DialogBoxIndirectParamAorW" (+36h)
Address: 65170000h (foo_uie_wsh_panel_mod+0h)
Address: 65233B38h (foo_uie_wsh_panel_mod+C3B38h), symbol: "foobar2000_get_interface" (+7F578h)
Address: 651992B0h (foo_uie_wsh_panel_mod+292B0h)
Address: 758CD009h (USER32+3D009h), symbol: "DialogBoxParamW" (+3Fh)
Address: 65170000h (foo_uie_wsh_panel_mod+0h)
Address: 65233B38h (foo_uie_wsh_panel_mod+C3B38h), symbol: "foobar2000_get_interface" (+7F578h)
Address: 651992B0h (foo_uie_wsh_panel_mod+292B0h)
Address: 651AF02Dh (foo_uie_wsh_panel_mod+3F02Dh)
Address: 65170000h (foo_uie_wsh_panel_mod+0h)
Address: 651992B0h (foo_uie_wsh_panel_mod+292B0h)
Address: 651AC548h (foo_uie_wsh_panel_mod+3C548h)
Address: 65214D0Ch (foo_uie_wsh_panel_mod+A4D0Ch), symbol: "foobar2000_get_interface" (+6074Ch)
Address: 65214D30h (foo_uie_wsh_panel_mod+A4D30h), symbol: "foobar2000_get_interface" (+60770h)
Address: 758A6DE8h (USER32+16DE8h), symbol: "GetThreadDesktop" (+185h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 651C10CFh (foo_uie_wsh_panel_mod+510CFh), symbol: "foobar2000_get_interface" (+CB0Fh)
Address: 758A6DF3h (USER32+16DF3h), symbol: "GetThreadDesktop" (+190h)
Address: 6520FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 6520FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 65214D40h (foo_uie_wsh_panel_mod+A4D40h), symbol: "foobar2000_get_interface" (+60780h)
Address: 6520FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 6520FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 651ADC67h (foo_uie_wsh_panel_mod+3DC67h)
Address: 65208956h (foo_uie_wsh_panel_mod+98956h), symbol: "foobar2000_get_interface" (+54396h)
Address: 651ADC76h (foo_uie_wsh_panel_mod+3DC76h)
Address: 651AC9FFh (foo_uie_wsh_panel_mod+3C9FFh)
Address: 758B0D4Dh (USER32+20D4Dh), symbol: "CallWindowProcW" (+1Bh)
Address: 00440406h (foo_uie_playlists_dropdown+30406h), symbol: "foobar2000_get_interface" (+23966h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A6F9Eh (USER32+16F9Eh), symbol: "GetThreadDesktop" (+33Bh)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A6F9Eh (USER32+16F9Eh), symbol: "GetThreadDesktop" (+33Bh)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A702Ch (USER32+1702Ch), symbol: "GetWindowLongW" (+2Eh)
Address: 65208A34h (foo_uie_wsh_panel_mod+98A34h), symbol: "foobar2000_get_interface" (+54474h)
Address: 651B225Fh (foo_uie_wsh_panel_mod+4225Fh)
Address: 0043FBA8h (foo_uie_playlists_dropdown+2FBA8h), symbol: "foobar2000_get_interface" (+23108h)
Address: 651F1AE1h (foo_uie_wsh_panel_mod+81AE1h), symbol: "foobar2000_get_interface" (+3D521h)
Address: 0043FBA8h (foo_uie_playlists_dropdown+2FBA8h), symbol: "foobar2000_get_interface" (+23108h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 75910230h (USER32+80230h), symbol: "ShutdownBlockReasonDestroy" (+59A2h)
Address: 758A62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 0043FBA8h (foo_uie_playlists_dropdown+2FBA8h), symbol: "foobar2000_get_interface" (+23108h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A6D3Ah (USER32+16D3Ah), symbol: "GetThreadDesktop" (+D7h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 0043FBA8h (foo_uie_playlists_dropdown+2FBA8h), symbol: "foobar2000_get_interface" (+23108h)
Address: 0043FBA8h (foo_uie_playlists_dropdown+2FBA8h), symbol: "foobar2000_get_interface" (+23108h)
Address: 758A6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758A90C9h (USER32+190C9h), symbol: "LoadStringW" (+210h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 0043FBA8h (foo_uie_playlists_dropdown+2FBA8h), symbol: "foobar2000_get_interface" (+23108h)
Address: 758A6E57h (USER32+16E57h), symbol: "GetThreadDesktop" (+1F4h)
Address: 758B291Fh (USER32+2291Fh), symbol: "GetKeyState" (+0h)
Address: 75910230h (USER32+80230h), symbol: "ShutdownBlockReasonDestroy" (+59A2h)
Address: 7722011Ah (ntdll+1011Ah), symbol: "KiUserCallbackDispatcher" (+2Eh)
Address: 77220080h (ntdll+10080h), symbol: "KiUserApcDispatcher" (+48h)
Address: 758A6A8Ch (USER32+16A8Ch), symbol: "gapfnScSendMessage" (+AC4h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A6AE9h (USER32+16AE9h), symbol: "gapfnScSendMessage" (+B21h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 651ACC2Dh (foo_uie_wsh_panel_mod+3CC2Dh)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 6CA90D73h (UxTheme+10D73h)
Address: 758A62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A6F9Eh (USER32+16F9Eh), symbol: "GetThreadDesktop" (+33Bh)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A702Ch (USER32+1702Ch), symbol: "GetWindowLongW" (+2Eh)
Address: 65208A34h (foo_uie_wsh_panel_mod+98A34h), symbol: "foobar2000_get_interface" (+54474h)
Address: 651B225Fh (foo_uie_wsh_panel_mod+4225Fh)
Address: 651F1AE1h (foo_uie_wsh_panel_mod+81AE1h), symbol: "foobar2000_get_interface" (+3D521h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 6646EC2Fh (foo_simplaylist+6EC2Fh)
Address: 758A62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A6D3Ah (USER32+16D3Ah), symbol: "GetThreadDesktop" (+D7h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758A6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758A77C4h (USER32+177C4h), symbol: "CharPrevW" (+138h)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 7590A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 758A788Ah (USER32+1788Ah), symbol: "DispatchMessageW" (+Fh)
Address: 651F1950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 758CC81Fh (USER32+3C81Fh), symbol: "IsDialogMessageW" (+11Eh)
Address: 65382667h (foo_ui_std+A2667h)
Address: 00C0D9C7h (foobar2000+6D9C7h)
Address: 758A78E2h (USER32+178E2h), symbol: "GetMessageW" (+0h)
Address: 75ED11A9h (kernel32+111A9h), symbol: "SetLastError" (+0h)
Address: 00CEBDD8h (foobar2000+14BDD8h)
Address: 00C0DB06h (foobar2000+6DB06h)

Environment:
App: foobar2000 v1.1.9
OS: Windows 6.1.7601 Service Pack 1 x64
CPU: Intel® Core™ i7 CPU      M 640  @ 2.80GHz, features: MMX SSE SSE2 SSE3 SSE4.1 SSE4.2
Audio: SPDIF Interface (MUSILAND Monitor 03 US); Speakers (MUSILAND Monitor 03 US); Line 1 (Virtual Audio Cable); Speakers (USB PnP Sound Device); Speaker/HP (Realtek High Definition Audio)
UI: Default User Interface 0.9.5

Components:
Core (2011-11-04 14:08:40 UTC)
    foobar2000 core 1.1.9
foo_ac3.dll (2011-11-10 00:29:34 UTC)
    AC3 decoder 0.9.5
foo_albumlist.dll (2011-11-04 14:07:12 UTC)
    Album List 4.5
foo_audioscrobbler.dll (2011-11-10 00:29:34 UTC)
    Audioscrobbler 1.4.7
foo_autoupdate.dll (2011-11-10 00:29:34 UTC)
    Automatic Updater 1
foo_burninate.dll (2011-11-10 00:29:34 UTC)
    Audio CD Writer 3.0.3
foo_cdda.dll (2011-11-04 14:07:04 UTC)
    CD Audio Decoder 3.0
foo_chacon.dll (2011-11-10 00:29:34 UTC)
    Chacon 3
foo_channel_mixer.dll (2011-11-10 00:29:34 UTC)
    Channel Mixer 0.9.6.7
foo_converter.dll (2011-11-04 14:06:48 UTC)
    Converter 1.5
foo_discogs.dll (2011-11-10 00:29:34 UTC)
    Discogs Tagger 1.30
foo_dop.dll (2011-11-10 00:29:34 UTC)
    iPod manager 0.6.9.7
foo_dsp_crossfeed.dll (2011-11-10 00:29:34 UTC)
    Crossfeed 1.01
foo_dsp_effect.dll (2011-11-10 00:29:34 UTC)
    Effect DSP 0.9.2
foo_dsp_resampler.dll (2011-11-03 14:05:14 UTC)
    SoX Resampler 0.7.6
foo_dsp_std.dll (2011-11-04 14:07:12 UTC)
    Standard DSP Array 1.0
foo_dsp_xgeq.dll (2011-11-10 00:29:34 UTC)
    Graphic Equalizer 0.2.1
foo_facets.dll (2011-11-10 00:29:34 UTC)
    Facets 1.0
foo_fileops.dll (2011-11-04 14:06:12 UTC)
    File Operations 2.1.3
foo_freedb2.dll (2011-11-04 14:06:12 UTC)
    freedb Tagger 0.6.4
foo_input_alac.dll (2011-11-10 00:29:34 UTC)
    ALAC Decoder 1.0.7
foo_input_ds.dll (2011-11-10 00:29:34 UTC)
    DirectShow input 0.1
foo_input_dsdiff.dll (2011-11-10 00:29:34 UTC)
    DSDIFF Decoder 1.4
foo_input_dtshd.dll (2011-11-10 00:29:34 UTC)
    DTS-HD Decoder 0.1.3
foo_input_dvda.dll (2011-11-10 00:29:34 UTC)
    DVD-Audio Decoder and Watermark Detector 0.4.8
foo_input_ht.dll (2011-11-10 00:29:34 UTC)
    Highly Theoretical 2.0.7
foo_input_monkey.dll (2011-11-10 00:29:34 UTC)
    Monkey's Audio Decoder 2.1.5
foo_input_reverse.dll (2011-11-10 00:29:34 UTC)
    Reverse Playback 0.1.4 (SSE)
foo_input_sacd.dll (2011-11-11 11:11:10 UTC)
    Super Audio CD Decoder 0.4.2
foo_input_std.dll (2011-11-04 14:06:56 UTC)
    Standard Input Array 1.0
foo_input_tak.dll (2011-11-10 00:29:34 UTC)
    TAK Decoder 0.4.4
foo_input_tta.dll (2011-11-10 00:29:34 UTC)
    TTA Audio Decoder 3.1
foo_jesus.dll (2011-11-10 00:29:34 UTC)
    Autosave & Autobackup 10
foo_masstag.dll (2011-11-10 00:29:34 UTC)
    Masstagger 1.8.4
foo_masstag_addons.dll (2011-11-10 00:29:34 UTC)
    Masstagger Addons 0.3.4 (SSE)
foo_out_asio.dll (2011-11-10 00:29:34 UTC)
    ASIO support 1.2.7
foo_out_ks.dll (2011-11-10 00:29:34 UTC)
    Kernel Streaming Output 1.2.2
foo_out_wasapi.dll (2011-11-10 00:29:34 UTC)
    WASAPI output support 2.1
foo_playcount.dll (2011-11-10 00:29:34 UTC)
    Playback Statistics 3.0.2
foo_random.dll (2011-11-10 00:29:34 UTC)
    Randomized Playlist Entry 1.2.3
foo_rgscan.dll (2011-11-04 14:06:54 UTC)
    ReplayGain Scanner 2.1.2
foo_simplaylist.dll (2011-11-10 00:29:34 UTC)
    SimPlaylist 1.0
foo_simplaylist_manager.dll (2011-11-10 00:29:34 UTC)
    SimPlaylist Manager 1.0
foo_skip.dll (2011-11-10 00:29:34 UTC)
    Skip Track 1.7.4
foo_texttools.dll (2011-11-10 00:29:34 UTC)
    Text Tools 1.0.5
foo_ui_columns.dll (2011-11-10 00:29:34 UTC)
    Columns UI 0.3.8.8
foo_ui_std.dll (2011-11-04 14:07:18 UTC)
    Default User Interface 0.9.5
foo_uie_albumlist.dll (2011-11-10 00:29:34 UTC)
    Album list panel 0.3.5
foo_uie_panel_splitter.dll (2011-11-10 00:29:34 UTC)
    Panel Stack Splitter 0.3.8.2(alpha)
foo_uie_peakmeter.dll (2011-11-10 00:29:34 UTC)
    Peakmeter Panel 0.0.4.2 beta
foo_uie_playlists_dropdown.dll (2011-11-10 00:29:34 UTC)
    Playlists Dropdown 0.7.6
foo_uie_tabs.dll (2011-11-10 00:29:34 UTC)
    Tabbed Panel Modified 0.2.7
foo_uie_typefind.dll (2011-11-10 00:29:34 UTC)
    Typefind 0.2 beta 2
foo_uie_wsh_panel_mod.dll (2011-11-15 01:14:42 UTC)
    WSH Panel Mod 1.5.0
foo_unpack.dll (2011-11-04 14:06:26 UTC)
    ZIP/GZIP/RAR Reader 1.6
foo_verifier.dll (2011-11-10 00:29:34 UTC)
    File Integrity Verifier 1.1

Recent events:
iPod manager: USB AMD enumerator: Found USB\VID_05AC&PID_1297\3FBF80AAA36084853D8114BEF797B08C9C58B596
iPod manager: Device properties: DBVersion: 5, SQLiteDB
iPod manager: 172 post process SQL commands, version 8
iPod manager: Apple iPod/iPhone connected. Device Instance Path: USB\VID_05AC&PID_1297\3FBF80AAA36084853D8114BEF797B08C9C58B596
WSH Panel Mod ({0E88C1C9-B018-4157-9403-14028A8D3B6A}): Parsing file "C:\Program Files (x86)\foobar2000\scripts\Helpers.txt"
WSH Panel Mod ({0E88C1C9-B018-4157-9403-14028A8D3B6A}): Parsing file "C:\Program Files (x86)\foobar2000\scripts\Flags.txt"
WSH Panel Mod ({0E88C1C9-B018-4157-9403-14028A8D3B6A}): Parsing file "C:\Program Files (x86)\foobar2000\scripts\getColoursFonts.js"
WSH Panel Mod ({0E88C1C9-B018-4157-9403-14028A8D3B6A}): Parsing file "C:\Program Files (x86)\foobar2000\scripts\buttons.js"
WSH Panel Mod ({0E88C1C9-B018-4157-9403-14028A8D3B6A}): Parsing file "C:\Program Files (x86)\foobar2000\scripts\menus.js"
Error: WSH Panel Mod ({0E88C1C9-B018-4157-9403-14028A8D3B6A}): Microsoft JScript runtime error:
Automation server can't create object
File: C:\Program Files (x86)\foobar2000\scripts\menus.js
Ln: 1, Col: 1
<source text only available at compile time>

And this is the script:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\Helpers.txt"
// @import "%fb2k_path%scripts\Flags.txt"
// @import "%fb2k_path%scripts\getColoursFonts.js"
// @import "%fb2k_path%scripts\buttons.js"
// @import "%fb2k_path%scripts\menus.js"
// ==/PREPROCESSOR==

window.MaxHeight = tpad+bth;
window.MinHeight = tpad+bth;

function on_size()
{
ww = window.Width;
wh = window.Height;
    buttons = {
        back: new button('back', function(){fb.Prev();},"Previous",lpad),
        stop: new button('stop', function(){fb.Stop();},"Stop",lpad+btw),
        pop:  new button((fb.IsPlaying&&!fb.IsPaused)?'pause':'play',function(){fb.PlayOrPause();},(fb.IsPlaying&&!fb.IsPaused)?"Pause":"Play",lpad+2*btw),
        sac:  new button(fb.StopAfterCurrent?'sac_on':'sac',function(){fb.StopAfterCurrent=!fb.StopAfterCurrent;},"Stop After Current "+(fb.StopAfterCurrent?"(On)":"(Off)"),lpad+3*btw),
        next: new button('fwd', function(){fb.Next();},"Next",lpad+4*btw),
        //
        cfp:  new button(fb.CursorFollowPlayback?'cfp_on':'cfp',function() { fb.CursorFollowPlayback=!fb.CursorFollowPlayback; },"Cursor Follows Playback "+(fb.CursorFollowPlayback?"(On)":"(Off)"), ww-rpad-5*btw),
        pfc:  new button(fb.PlaybackFollowCursor?'pfc_on':'pfc',function() { fb.PlaybackFollowCursor=!fb.PlaybackFollowCursor; },"Playback Follows Cursor "+(fb.PlaybackFollowCursor?"(On)":"(Off)"), ww-rpad-4*btw),
        pbo:  new button(PBOArray[fb.PlayBackOrder],function() { playbackorder(); },"Playback Order ("+PBOArray[fb.PlayBackOrder]+")", ww-rpad-3*btw),
        lfm:  new button('lfm',  function(){lastfm();},"Last.fm", ww-rpad-2*btw),
        menu: new button('menu', function(){runmenu();},"Run", ww-rpad-btw)
    }
}

function on_paint(gr)
{
    gr.FillSolidRect(0,0,ww,wh,utils.GetSysColor(15));
    //bg_theme = window.CreateThemeManager("BUTTON");
    //try { bg_theme.SetPartAndStateId(1, 1); }catch(e) {}
//try { bg_theme.DrawThemeBackground(gr, lpad, tpad, ww-lpad-rpad, bth); } catch(e) {}
    gr.SetSmoothingMode(4);
    gr.FillGradRect(lpad+1, tpad+1, ww-lpad-rpad-2, bth-3, 90, 0xfff4f4f4, 0xffe1e1e1, 1);
    gr.DrawRoundRect(lpad, tpad, ww-lpad-rpad-1, bth-1, 3, 3, 1, 0xffb2b2b2);
    gr.DrawRoundRect(lpad+1, tpad+1, ww-lpad-rpad-3, bth-3, 3, 3, 1, 0xfffafafa);
    drawAllButtons(gr);
   
    ///Seekbar

gr.SetTextRenderingHint(5);
//For normal playback
if(fb.PlaybackLength>0)
{
        gap = gr.CalcTextWidth(len.Eval(),font_labels)+8;
        if(fb.PlaybackLength > fb.PlaybackTime)
        {
            if(g_drag)
                pos = (ww-(2*lpad+2*rpad+10*btw)-2*gap) * g_drag_seek;
            else
                pos = (ww-(2*lpad+2*rpad+10*btw)-2*gap) * (fb.PlaybackTime / fb.PlaybackLength);
}
        else
        {
            pos=0;   
        }
        seekbg.DrawThemeBackground(gr,2*lpad+5*btw+gap-2,6,ww-(2*lpad+2*rpad+10*btw)-2*gap+4,18);
gr.GdiDrawText(elap.Eval(),  font_labels, txtcol, 2*lpad+5*btw, 7, gap, wh-1, DT_CENTER);
gr.GdiDrawText(remain.Eval(), font_labels, txtcol, ww-gap-2*rpad-5*btw, 7, gap, wh-1, DT_CENTER);
seekfill.DrawThemeBackground(gr,2*lpad+5*btw+gap,8,pos,14);
}
//For streams
else if(fb.IsPlaying && (fb.PlaybackLength < 0 || filetype_eval == "mms"))
{
seekbg.DrawThemeBackground(gr,2*lpad+5*btw+2,6,ww-(2*lpad+2*rpad+10*btw)-4,18);
gr.GdiDrawText(elap.Eval()+" (continuous)", font_labels, txtcol, 0, 9, ww, wh, DT_CENTER);
}

}

function on_playback_stop()
{
if(g_timer){window.KillTimer(g_timer);}
buttons.pop.icon=gdi.Image(dir+"play"+".png");
buttons.pop.tooltiptxt="Play";
window.Repaint();
}

function on_playback_pause(is_paused)
{
buttons.pop.icon=is_paused?gdi.Image(dir+"play"+".png"):gdi.Image(dir+"pause"+".png");
buttons.pop.tooltiptxt=is_paused?"Play":"Pause";
window.Repaint();
}
function on_playback_starting(cmd, is_paused)
{
g_timer = window.CreateTimerInterval(40);
buttons.pop.icon=is_paused?gdi.Image(dir+"play"+".png"):gdi.Image(dir+"pause"+".png");
buttons.pop.tooltiptxt=is_paused?"Play":"Pause";
window.Repaint();
}
function on_playlist_stop_after_current_changed(state)
{
buttons.sac.icon=state?gdi.Image(dir+"sac_on"+".png"):gdi.Image(dir+"sac"+".png");
buttons.sac.tooltiptxt="Stop After Current "+(state?"(On)":"(Off)");
window.Repaint();
}
function on_cursor_follow_playback_changed(state)
{
buttons.cfp.icon=state?gdi.Image(dir+"cfp_on"+".png"):gdi.Image(dir+"cfp"+".png");
buttons.cfp.tooltiptxt="Cursor Follows Playback "+(state?"(On)":"(Off)");
window.Repaint();
}

function on_playback_follow_cursor_changed(state)
{
buttons.pfc.icon=state?gdi.Image(dir+"pfc_on"+".png"):gdi.Image(dir+"pfc"+".png");
buttons.pfc.tooltiptxt="Playback Follows Cursor "+(state?"(On)":"(Off)");
window.Repaint();
}

function on_playback_order_changed(new_order_index)
{
buttons.pbo.icon=gdi.Image(dir+PBOArray[fb.PlayBackOrder]+".png");
buttons.pbo.tooltiptxt = "Playback Order ("+PBOArray[fb.PlayBackOrder]+")";
    window.Repaint();
}

function on_playback_seek(time)
{
window.Repaint();
}

function on_playback_time(time)
{
if(!g_timer){g_timer = window.CreateTimerInterval(40);}
window.Repaint();
}

function on_playback_new_track(metadb)
{
filetype_eval = filetype.Eval();
window.Repaint();
}

function on_timer(id)
{
window.RepaintRect(2*lpad+5*btw,0,ww-(2*lpad+2*rpad+10*btw),wh);
}

////Seekbar

var g_drag = 0;
var g_drag_seek = 0;

//Titleformatting
var len = fb.Titleformat("%length%");
var elap = fb.TitleFormat("%playback_time%");
var remain = fb.TitleFormat("$if2(%playback_time_remaining%,continuous)");

var pos = 0;
var gap = 0;

var g_timer;
var filetype = fb.TitleFormat("$left(%path%,3)");
var filetype_eval;

var seekbg = window.CreateThemeManager("Progress");
try { seekbg.SetPartAndStateID(1,1); }
catch(e){}
var seekfill = window.CreateThemeManager("Progress");
try { seekfill.SetPartAndStateID(3,1); }
catch(e){}

function on_item_focus_change() { window.Repaint(); }

Any ideas?
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-11-15 03:04:04
Hi guys, i just read something interesting about the powershell.

Windows Powershell could realize the aero effect on any window rendered by DWM with calling dwmapi.dll.

We can use Powershell in WSH script (which i had tested, successfully.)

So....
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-11-15 19:02:06
Marc 2003, is there a way to get the thumbs script to show all non-audio files, rather than just the images? I'd like to have thumbnails of the images though also icons for other files such as .txt, which I could click on to open.

Thanks
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2011-11-16 06:37:48
(Back to the timer...)

Just to ensure (to don't create a "memory leak" in my scripts ):
Does window.ClearInterval(g_timer) have the same effect as g_timer.Dispose() in older scripts?
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-16 12:48:08
r0lz, I appreciate your effort for trying get my script to work +++

Well, I have finished to convert the obsolete timer methods to the new ones, and the script works fine.

But I haven't converted AppendMenuItem(MF_POPUP...) to the new AppendTo() method, as this would require too many changes, due to the way the menu is built.  (The method, based on arrays containing the menu items, is elegant but very complex and extremely difficult to change!)  Anyway, IMO, changing that is not really necessary, as the old method continues to work as expected.

Also, I have noticed that the reflection of the image is not drawn in the panel.  I have tried to find why, but without success.  This line (near the end of the script) doesn't work:
Code: [Select]
Rimg.ApplyMask(mask);

I don't understand why, as it works fine with the original mask.png image if I extract the code that build the reflexion and I draw it directly in a panel.  Also, I have verified that the original image and the mask are correctly loaded and that they can be displayed independently.  It's only when the mask is applied to the image that the problem occurs.

Maybe it's because the script uses a strange approach: it draws the folder image and the reflection in a new bitmap, and the bitmap is finally drawn in the panel.  Not sure why the original author has adopted that complex method.  Could it be the problem?  Anyway, again, the script is too complex to fix that problem easily.

Can you confirm that the reflection has never been visible, even with old versions of the wsh panel mod extension?  If it worked in the past, that would mean that there is a new (undocumented) incompatibility in the current version.

[EDIT] Uploaded the new version here (http://www.4shared.com/file/jTKjPJaS/WSH_Artwork_Viewer_new.html), so you can test it...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-16 13:22:25
Marc 2003, is there a way to get the thumbs script to show all non-audio files, rather than just the images?


it's certainly possible..... if you do it yourself.

sorry but i won't be adding that feature as i'd never use it. i only use it for last.fm artist images so extending the functionality of the custom folder mode doesn't really appeal to me.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-16 13:35:07
r0lZ, a picture is worth a thousand words...
Screenshot with added comments -->                    (http://img88.imageshack.us/img88/2544/20111117002340.th.png) (http://img88.imageshack.us/img88/2544/20111117002340.png)
Hey, thanks again for your efforts +++

_________________________________________________________________________

EDIT: I tried the exact same thing in  foobar2000 v1.1.7 with WSH Panel Mod 1.5.0 and... you are right, Reflection function no longer works !
Shucks, that's a let down... such a brilliant Artwork Viewer as this should not become abandonware !

__________________________________________________________________________
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-16 14:59:26
r0lZ, I installed your new version of the WSH Artwork Viewer (v1.1). Here is feedback...

- The script was accepted and the panel updated .

- I cleared the Console, restarted foobar2000, then viewed the Console:
  WSH Panel Mod (WSH Artwork Viewer v1.1 by EIKO, mod by r0lZ): initialized in 8 ms
  No more "obsolete" WSH errors reported !

- I played a track from an album group containing multiple artworks...
  the Artwork Viewer did its thing and auto-scrolled,
 
    Further enquiry revealed these problems:
 
    - the "Reflection" function no longer works !

    - If I play a new track, then hover and scroll with my mouse over the Artwork Viewer, WSH Panel Mod crashes:
    WSH Panel Mod: Warning: Obsolete: Please use AppendTo() method to create sub menu instead of AppendMenuItem()
    Error: WSH Panel Mod (WSH Artwork Viewer v1.1 by EIKO, mod by r0lZ): Microsoft JScript runtime error:
    Object doesn't support this property or method
    File: <main>
    Ln: 1173, Col: 3
    <source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-16 15:20:49
Read my post above.  I know that the reflection doesn't work.  But it does not work with the original script either.  I don't understand why.  Are you sure it works with the script you have uploaded?  Do you have another version of the script?

As I've explained in my previous post, the "obsolete" message about AppendTo() is normal.  I have not fixed that.  (Not sure why that message is only displayed when the panel crashes, but the crash is not related to that point.)

The crash is my fault.  I forgot to change a timer (CursorFollowAutoTimer).  There are many timers in that script!  I have already fixed that bug.  I will upload the new version when you will reply to my question about the reflection.  If it's possible, I'll try to fix it too.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-16 18:03:07
r0lZ, continuing the enquiry...

- I exited foobar2000 v1.1.7 (and components:  WSH Panel Mod v1.5.0 | WSH Artwork Viewer mod by r0lZ v1.1 )

- I replaced WSH Panel Mod 1.5.0 with version 1.4.3

- I restarted foobar2000 and WSH Artwork Viewer panel is permanently crashed. Refreshing the config does nothing. Console reports this:
   WSH Panel Mod (WSH Artwork Viewer v1.1 by EIKO, mod by r0lZ): initialized in 8 ms
  WSH Panel Mod ({56B397C4-98BA-4D69-A7B2-D58FC88697AB}): initialized in 0 ms
  WSH Panel Mod ({970889CB-C7C8-4B6B-8307-E732076A7340}): initialized in 4 ms
  Error: WSH Panel Mod (WSH Artwork Viewer v1.1 by EIKO, mod by r0lZ): Microsoft JScript runtime error:
  Object doesn't support this property or method
  Ln: 474, Col: 5
  <source text only available at compile time>


- Right-click crashed WSH Artwork Viewer panel > Configure > replaced the code with "WSH Artwork Viewer_original.txt" (from your .7z archive)
  .... everything works fine again
  .... "Reflection" function works
  .... "Hover and scroll with mouse" function works

So, the "original" code inside your .7z package works using WSH Panel Mod v1.4.3. There is no other code; this "old" code is the only code I ever used in this panel.
To try and replicate my "fully working" old panel, here is an export of my "Properties" page for the panel:
"WSH Artwork Viewer_original.properties.wsp" uploaded at filebeam (http://filebeam.com/53572537a80cd30af79fd5bc59b69866)
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-16 18:28:18
Of course, the new version of the script cannot work with WSHPM 1.4, since I use the new methods available only in v1.5.

I would like to know if you can see the reflections with the old version of the script running in WSHPM 1.5.  Please test that configuration.  Here, I can't get them to work.  I think therefore that v1.5 has introduced some kind of incompatibility.  But I'm not sure.  The problem could be on my side.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-16 19:21:38
r0lZ, continuing my previous action...

- I am running foobar2000 v1.1.7 (and components:  WSH Panel Mod v1.4.3 | WSH Artwork Viewer original script )
  ... everything works as expected, including the "Reflection" function.

- I exit foobar2000, and I replace WSH Panel Mod v1.4.3 with v1.5.0, and I restart foobar2000.
   WSH Panel Mod ({FFF2B498-2C93-4683-9C3B-504C9370EC6B}): initialized in 8 ms
  WSH Panel Mod ({56B397C4-98BA-4D69-A7B2-D58FC88697AB}): initialized in 0 ms
  WSH Panel Mod ({970889CB-C7C8-4B6B-8307-E732076A7340}): initialized in 0 ms
  WSH Panel Mod: Warning: Obsolete: window.CreateTimerInterval() is now obsolete, please use window.SetInterval() in new script.
  WSH Panel Mod: Warning: Obsolete: window.CreateTimerTimeout() is now obsolete, please use window.SetTimeout() in new script.
  WSH Panel Mod: Warning: Obsolete: Please use AppendTo() method to create sub menu instead of AppendMenuItem()


"Reflection" function DOES NOT WORK any more (using "WSH Artwork Viewer original script" and "WSH Panel Mod v1.5.0")
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-11-16 19:31:25
i got a question again: maybe its possible to get items names in main menu? for example, i have menu->item 1, item 2... i dont need to get a submenu as popup, i need items. if its possible, i could make a fast dsp switcher as i dreamed.

also, previously i asked about query for transcoding files. i just forget thats windows shell waits until one process will be closed before starting new one. so i think its possible to create some poor script for transcoding.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-17 00:07:32
"Reflection" function DOES NOT WORK any more (using "WSH Artwork Viewer original script" and "WSH Panel Mod v1.5.0")

OK, same thing here.  So, that confirms that there is a bug somewhere in WSHPM 1.5.0 with ApplyMask().  I will try to isolate the problem to demonstrate the bug.

T.P Wang, any idea?
Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2011-11-17 02:17:52
About Reflection:
use gr.DrawImage and set the height to a negative integer, you'll find the image has been reflected.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-17 07:55:23
About Reflection:
use gr.DrawImage and set the height to a negative integer, you'll find the image has been reflected.

I know how to turn an image upside down.  That part of the script works well.  The problem is that the image is fully transparent (or disappears somehow) when a mask is applied.

Here is the code that worked fine in WSHPM 1.4:
Code: [Select]
var Mimg = gdi.CreateImage(width, height);
var g = Mimg.GetGraphics();
Rimg = img.Clone(0, 0, img.Width, img.Height);
Rimg.RotateFlip(RotateFlipType.RotateNoneFlipY);
var mask = ReflectionMask.Resize(Rimg.Width, Rimg.Height);    
Rimg.ApplyMask(mask);
g.DrawImage(Rimg, Rimgpos.x, Rimgpos.y, Rimgpos.w, Rimgpos.h, 0, 0, Rimg.Width, Rimg.Height, 0, Opacity);
RawBitmap = Mimg.CreateRawBitmap();

With the code above, nothing is drawn in the RawBitmap!

If I comment out the line Rimg.ApplyMask(mask);, everything works as expected, but of course, the reflection is not "faded out" by the mask.

Also, if I comment out the same line and I replace g.DrawImage(Rimg, ...); with g.DrawImage(mask, ...);, then the gray mask is shown instead of the inverted image.

So, everything is correct, except that ApplyMask() doesn't work.  However, it works fine if the image is drawn directly in the panel instead of in the temp bitmap.

Since the code above works perfectly in WSHPM 1.4, my conclusion is that there is a bug in v1.5.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-17 09:36:56
OK, I have isolated the problem.  I was wrong.  It is not related to the fact that the image is drawn in a bitmap and the bitmap applied to the panel.  It seems related to the fact that the image is resized before applying the mask.

I have written a little demo script.  (It crashes if you minimize foobar or hide the panel somehow, but that's not the problem.  I just wanted to keep the code as simple and short as possible.)

This code works as expected:
Code: [Select]
var g_img  = gdi.Image(fb.ProfilePath + "\\wsh_scripts\\samples\\images\\image.jpg");
var g_mask = gdi.Image(fb.ProfilePath + "\\wsh_scripts\\samples\\images\\mask.png");

function on_paint(gr) {
    var ww = window.Width;
    var wh = window.Height;

    var Rimg  = g_img;    // this line is OK
    var Rmask = g_mask.Resize(Rimg.Width, Rimg.Height);
    Rimg.ApplyMask(Rmask);

    gr.DrawImage(Rimg, 0, 0, ww, wh, 0, 0, Rimg.Width, Rimg.Height);
    Rimg.Dispose();
    Rmask.Dispose();
}

Note that the original image is simply copied to the local variable Rimg, then the mask is resized and applied.

This code doesn't work:
Code: [Select]
var g_img  = gdi.Image(fb.ProfilePath + "\\wsh_scripts\\samples\\images\\image.jpg");
var g_mask = gdi.Image(fb.ProfilePath + "\\wsh_scripts\\samples\\images\\mask.png");

function on_paint(gr) {
    var ww = window.Width;
    var wh = window.Height;

    var Rimg  = g_img.Resize(ww, wh);    // this line causes the bug!
    var Rmask = g_mask.Resize(Rimg.Width, Rimg.Height);
    Rimg.ApplyMask(Rmask);

    gr.DrawImage(Rimg, 0, 0, ww, wh, 0, 0, Rimg.Width, Rimg.Height);
    Rimg.Dispose();
    Rmask.Dispose();
}

The only difference is that the image is resized when it is placed in the Rimg variable.
If you remove the Rimg.ApplyMask(Rmask); line, the image is correctly drawn, without transparency.
The conclusion is that there is a bug in the ApplyMask() or Resize() method, that makes them incompatible.
That bug was not present in WSHPM v1.4.

T.P. Wang, can you have a look?
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-17 10:56:09
"Reflection" function DOES NOT WORK any more (using "WSH Artwork Viewer original script" and "WSH Panel Mod v1.5.0")

@derty2:

I've found a workaround for the current ApplyMask() bug, so the reflection is visible again.  :-)  (Technical note: I do the resize after having applied the mask.)

I have also fixed the change I forgot to do in v1.1 and that caused the crashes.

You can download WSH_Artwork_Viewer v1.2 here (http://www.4shared.com/file/jTKjPJaS/WSH_Artwork_Viewer.html).

Note that the menus have not been modified (and I don't think I'll do it), so you might still have the warning "Please use AppendTo() method to create sub menu instead of AppendMenuItem()".  I'm sure you can live with it!  ;-)

Enjoy!
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-11-17 11:22:42
r0lZ, you are a real champion...
I can't concentrate real hard right now, my eyes are welling up.
My cat Astro... I had him put down and I can't concentrate.
He liked coming into my room and listening to music with me; I feel a bit lost.
Thanks.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2011-11-17 12:08:45
r0lZ, you are a real champion...
I can't concentrate real hard right now, my eyes are welling up.
My cat Astro... I had him put down and I can't concentrate.
He liked coming into my room and listening to music with me; I feel a bit lost.
Thanks.

I'm really sorry, man.  I have a cat too, and I understand.

BTW, the ApplyMask() bug has been confirmed by T.P Wang (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=775955), and will be fixed soon...
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2011-11-19 16:30:29
Hey all! I have a question about Marc's Web Links panel.

I'm trying to align 4 buttons relative to window.Width on the X-axis so they would remain centred on resize, but nothing I tried was successful:

Try #1:
I tried entering ww directly in their X coordinate:
Quote
but1: new Button(ww/2-bw*2,.....
but2: new Button(ww/2-bw,.....
but3: new Button(ww/2+bw,.....
but4: new Button(ww/2+bw*2,.....
etc.


Try #2:
define var left_margin as ww and then positioning from there:
Quote
var left_margin=ww/2


Try #3:
Similarly to the one above, I tried to use a flag to center the whole thing and then position them as
Quote
but1: new Button(-(bw*2),.....
but2: new Button(-bw,.....
but3: new Button(bw,.....

but I haven't yet managed to find the correct flag to use for them.

Could anyone help?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-11-19 17:28:16
change your on_size function to this...

Code: [Select]
function on_size() {
    ww = window.Width;
    wh = window.Height;
    left_margin = Math.round((ww - (bw * 4)) / 2); //4 is the number of buttons.
    on_metadb_changed();
}


you shouldn't need to edit the x value where the buttons are defined except for any new buttons you've added.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-11-19 17:43:59
(OT so pls ignore me....)
Derty; Im also very sorry - I have 3 cats  That pain tears your heart out, awful.
Title: WSH Panel Mod script discussion/help
Post by: mastema on 2011-11-19 18:14:34
Brilliant, Marc, thanks! 
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-12-01 12:07:45
nobody can help me?

if thing i asking before is impossible, can i call a part of main menu? for example, i need only possible methods of sort from "Edit/Sort" menu

thanks in advance

p.s. sorry for my english - i`m from russia, our biggest foobar forum isnt exist anymore, so i rely on your help
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-01 12:48:33
that's not possible.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2011-12-04 13:05:35
very sad. but i got a new idea: maybe its possible to read core.cfg with cmd.exe? find the string with dsp names (i saw them, there a string with them separeted by commas). but i havent imagination how to read these files throu cmd. could anybody help?
Title: WSH Panel Mod script discussion/help
Post by: suaff on 2011-12-04 14:00:32
I've got a question: Is it possible to change groups and columns in SimPlaylist or default playlist (DUI) after switch to another playlist? Is it possible to change size of columns?

Thanks a lot
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-04 16:05:09
@romka18, not possible
@suaff, it looks like you're in the wrong thread

Title: WSH Panel Mod script discussion/help
Post by: suaff on 2011-12-04 16:25:23
@suaff, it looks like you're in the wrong thread

This is thread about scripts for WSH Panel Mod? Is it possible to write script for WSH Panel Mod plugin to change group/columns in playlist after switch to another playlist? (SimPlaylist or default playlist)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-04 16:27:03
in that case, no.

the only way you can interact with other components is through main menu or playlist context menu commands (plus the documented core functions).
Title: WSH Panel Mod script discussion/help
Post by: suaff on 2011-12-05 23:37:08
What about playlist header contex menu? Is it possible to interact with it?

Thanks
Title: WSH Panel Mod script discussion/help
Post by: stanleyguan on 2011-12-07 09:18:12
r0lZ, you are a real champion...
I can't concentrate real hard right now, my eyes are welling up.
My cat Astro... I had him put down and I can't concentrate.
He liked coming into my room and listening to music with me; I feel a bit lost.
Thanks.

I'm really sorry, man.  I have a cat too, and I understand.

BTW, the ApplyMask() bug has been confirmed by T.P Wang (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=775955), and will be fixed soon...


Hi r0lZ,

Many thanks for the script. Is it possible to draw a shadow around the album art?
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-12-07 10:16:15
What is the point of copying that quote in full !!?? Why didn't you just ask r0lZ a question !!??
Title: WSH Panel Mod script discussion/help
Post by: stanleyguan on 2011-12-07 10:21:51
What is the point of copying that quote in full !!?? Why didn't you just ask r0lZ a question !!??


I just clicked the reply button on the right but forgot to delete the quotes 
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-12-13 00:30:29
                                                       [!--sizeo:3--][span style=\"font-size:12pt;line-height:100%\"][!--/sizeo--]— WSH TextFile Viewer —[/size]

A script for displaying a text file in a WSH panel
View a screenshot of my own foobar2000 rendering the script (upper right side): (http://img440.imageshack.us/img440/8417/screenshotaqp.th.png) (http://img440.imageshack.us/img440/8417/screenshotaqp.png)
!!Read this before using the script...

+                                                 "WSH TextFile Viewer"
+
+  Displays a specified text file found in the same folder as the playing track in a foobar2000 panel.
+  When a track is played and the text file is not found, rather than display nothing, your panel will display:

+           _____________________________________________________
+           folder.txt
+
+
+  - To create the panel in your foobar2000 layout, use "WSH Panel Mod" component, and import this script.
+    It works with "Default User Interface" (DUI) or "Columns UI" (CUI).
+
+  - To display a text file with EVERY album one needs a very disciplined attitude to the presentation of his music collection;
+    it is time consuming, and essentially you are training yourself to be a professional librarian.
+    Personally, I find it highly educational and constructive.
+
+  - It is a good idea to create a standard name for your text file and stick to it;
+    My standard name for the text file is "folder.txt", which matches well with my standard name for all coverart "folder.jpg".
+    Also, for consistent display in foobar2000, try to create a standard template for your text file and stick to it;
+    To get you started, I have included a few sample templates further down this page.
+
+    Furthermore: If you discipline yourself to keep a TXT file in every album folder, it will be useful if
+    one day, filenames and tags are somehow all screwed up ...you have lost track of something,
+    you need to find where it is buried in your music collection...
+
+           So you fire up the Windows Command Prompt and type (example):
+              FINDSTR /I /S /P /M /C:"some string" "F:\my music" folder.txt
+           or for multiple items (example):
+              FINDSTR /I /S /P /M /C:"the beatles" "vinyl" "F:\my music" *.txt *.cue
+           and you have found your lost item(s) !!
+
+  - ALL text files MUST be saved with ANSI encoding (ie. not Unicode etc).
+    If you see wierd characters being rendered in your Panel, open the text file in "Notepad" and go to the menu: 
+    File -> Save As... -> and choose "ANSI" from the Encoding drop-down.
+
+  - If your panel continues to show wierd characters instead of rendering the text file,
+    there may be more than one text file in the containing folder. Remove the other text files.
+
+  - You MUST use a Monospace Font if you want correct text indenting.
+    I chose "Arial monospace" as my personal favourite. Therefore, the default font in this script is set to "Arial monospace - size 10". 
+    If it is not found, your Panel will default to your system font. To edit, go to the code section named "FONT SETTINGS".
+
+  - You can tweak text margins and alignments, if you wish. To edit, go to the code section named "DISPLAY PARAMETERS".
+
+  - I have edited this script to ONLY display text files named "folder.txt" ...ALL OTHER TEXT FILES WILL BE IGNORED !!!
+    If you prefer to change this to reading of ANY text file, then go to the code section named  "TEXT FILE PARAMETERS"



WSH_TextFile_Viewer.txt — Note: I have made this really easy and user friendly; guided comments and explanations are placed all through the script.
Code: [Select]
/* :::::::::::::::::::::: Script Engine: JScript :::::::::::::::::::::::::::::::
================================================================================
================================================================================
================================================================================
================================================================================
+
+                        "WSH TextFile Viewer"
+
+  Displays a specified text file found in the same folder as the playing track in a foobar2000 panel.
+  When a track is played and the text file is not found, rather than display nothing, your panel will display:

+      _____________________________________________________
+      folder.txt
+
+
+  - To create the panel in your foobar2000 layout, use "WSH Panel Mod" component, and import this script.
+    It works with "Default User Interface" (DUI) or "Columns UI" (CUI).
+
+  - To display a text file with EVERY album one needs a very disciplined attitude to the presentation of his music collection;
+    it is time consuming, and essentially you are training yourself to be a professional librarian.
+    Personally, I find it highly educational and constructive.
+
+  - It is a good idea to create a standard name for your text file and stick to it;
+    My standard name for the text file is "folder.txt", which matches well with my standard name for all coverart "folder.jpg".
+    Also, for consistent display in foobar2000, try to create a standard template for your text file and stick to it;
+    To get you started, I have included a few sample templates further down this page.
+
+    Furthermore: If you discipline yourself to keep a TXT file in every album folder, it will be useful if
+    one day, filenames and tags are somehow all screwed up ...you have lost track of something,
+    you need to find where it is buried in your music collection...
+
+        So you fire up the Windows Command Prompt and type (example):
+          FINDSTR /I /S /P /M /C:"some string" "F:\my music" folder.txt
+        or for multiple items (example):
+          FINDSTR /I /S /P /M /C:"the beatles" "vinyl" "F:\my music" *.txt *.cue
+        and you have found your lost item(s) !!
+
+  - ALL text files MUST be saved with ANSI encoding (ie. not Unicode etc).
+    If you see wierd characters being rendered in your Panel, open the text file in "Notepad" and go to the menu: 
+    File -> Save As... -> and choose "ANSI" from the Encoding drop-down.
+
+  - If your panel continues to show wierd characters instead of rendering the text file,
+    there may be more than one text file in the containing folder. Remove the other text files.
+
+  - You MUST use a Monospace Font if you want correct text indenting.
+    I chose "Arial monospace" as my personal favourite. Therefore, the default font in this script is set to "Arial monospace - size 10". 
+    If it is not found, your Panel will default to your system font. To edit, go to the code section named "FONT SETTINGS".
+
+  - You can tweak text margins and alignments, if you wish. To edit, go to the code section named "DISPLAY PARAMETERS".
+
+  - I have edited this script to ONLY display text files named "folder.txt" ...ALL OTHER TEXT FILES WILL BE IGNORED !!!
+    If you prefer to change this to reading of ANY text file, then go to the code section named  "TEXT FILE PARAMETERS" 
+
+
+    -- Enjoy ~derty2
+
+    -- This script is a modification of (".nfoo Viewer 1.1" ©2010 by Matthijs Brobbel). All credits go to him.     
+      [http://code.google.com/p/foobar-silk/][http://matthijsb.deviantart.com/art/nfoo-Viewer-1-1-170638369]
+
================================================================================
================================================================================
 


  // ------------------------------------------------------------------------
  // --- Useful Characters For Composing Your Text File  (Keyboard Mappings)
  // ------------------------------------------------------------------------


        —            Em Dash                    Alt+0151
        •            Bullet                    Alt+0149
        ©            Copyright Sign            Alt+0169

 


================================================================================
================================================================================



  // ---------------------------------------------------------------------
  // --- Useful Template for a Classical Music album - START TEXT FILE
  // ---------------------------------------------------------------------



Chicago Symphony Orchestra - Fritz Reiner, conductor

SERGEI PROKOFIEV (1891-1953): Lieutenant Kije, film score and symphonic suite for orchestra, Op.60 (1957)

IGOR STRAVINSKY (1882-1971): Song Of The Nightingale, symphonic poem for orchestra (1956)

• Composed, Classical, 20th Century, Orchestral Suite, Folk Tune, Tone Poem

• Most older listeners agree that Prokofiev's "Lieutenant Kije" suite was ideal repertoire for Fritz Reiner and the Chicago Symphony Orchestra. In this superb recording, Reiner and the Chicago were at the top of their form and their Kiji is witty, sassy, brave, ironic, and altogether hilarious. It was originally written for a movie. Contrastingly, Reiner and the Chicago were seemingly out of their element with Stravinsky's tone poem "Song of the Nightingale". With its spiky motifs, its primary colors, its hard harmonies, and its relentless rhythms, the repetoire did not seem a correct fit. But although their approach is essentially Straussian, Reiner and the Chicago still excel at Stravinsky's Nightingale. It was written as a tribute to Hans Christian Anderson.
____________________________________________________________________________________________________
_____
Vinyl LP 180g, RCA/Chesky #RC10, USA, Reissue from original 3-track master tape ~ Rip by NETTZ (Nov 2011)

———————— TRACKS ———————

Side 1
  01. Prokofiev — Lieutenant Kije, Op.60
        : The Birth of Kije
        : Romance
        : Kije's Wedding
        : Troika
        : The Burial of Kije

        • Recorded: 1957
        • Written: 1934; Paris, France

Side 2
  02. Stravinsky — Song Of The Nightingale
        : Presto
        : Chinese March
        : Song of The Nightingale
        : The Mechanical Nightingale
        : The Emperor's Displeasure at the departure of the real nightingale
        : The Emperor's sickroom
        : The real nightingale returns to thwart Death
        : Funeral march and Finale

        • Recorded: 1956
        • Written: 1917; Switzerland

———————— CREDITS ———————

**Composed By – Igor Stravinsky, Sergei Prokofiev      **Conductor – Fritz Reiner      **Orchestra – Chicago Symphony Orchestra      **Produced by - Richard Mohr      **Recording Engineer - Lewis Layton      |||      **Mastering Engineer – Jack Adelman      **Executive Producers - David and Norman Chesky      **Design [Photo] – Ben Rose      **Liner Notes – Irving Kolodin

———————— NOTES ———————

Premium Vinyl Pressing HQ-180 (180 gram vinyl)
Audiophile re-issue of RCA LSC-2150
"Master Recordings Owned Exclusively by RCA Records, a label of BMG Music"
Prokofiev has alternative spelling of "Prokofieff" on this album.

This record was reproduced from the original three-track master session tape. The playback machine was an Ampex 300 series three track tape recorder totally retubed and rebuilt to the highest standards available today. The three tracks were mixed to two, using a modified Perfectionist Audio Components Pro Reference Tube Preamp. The signal was fed from the preamp directly into the lathe, bypassing the mixing console and all equalizers, thus eliminating one more set of electronic coloration.

———————— COMMENTS ———————

"..This (RC10) is one of Chesky’s best efforts, I like it better than the newer Classic Records version, and it's the LP that got me interested in RCA Living Stereo! Bravo Chesky.." ---vinylfanatics.com/analoglovers/page26.html

———————— RIP LOG ———————

Ripped by NETTZ | Nov 2011

Technical Info:
• Turntable: Roksan Radius III
• Tonearm: Audioquest PT-9
• Cartridge: Ortofon X5-MC (Moving Coil)
• Phono Cable: Van den Hul D-502 Hybrid
• Pre-amplifier: Counterpoint SA 5.1 (vacuum tube Sovtek 6922)
• Interconnect: balanced, Belden 1813A cable with Neutrik XLR connectors
• Analog to Digital Converter: EMU 1212M (configured for balanced input +4dBu, 0 dB Gain)
• Capture software: Goldwave 5.58
• Post processing: ClickRepair, setting: 20, reverse, wavelet x2




  // -------------------------------------------------------------------
  // --- Useful Template for a Classical Music album - END TEXT FILE
  // -------------------------------------------------------------------




       
================================================================================
================================================================================




  // -------------------------------------------------------------------
  // --- Useful Template for a Popular Music album - START TEXT FILE
  // -------------------------------------------------------------------
 


 
The Romantics  —  The Romantics  (1980)

• Popular, Pop Rock, Power Pop, USA
• The Romantics didn't exactly reinvent the wheel with this album, but they sure knew how to make it roll, and for sheer party enhancing energy, this album is hard to beat. The songs are a glorious pastiche of period pop styles (think the Kinks and the Easybeats with a bit of the Hollies thrown in for melodic appeal) played with a hard-stomping energy and a genuine love for the vintage style that doesn't reek of nostalgia. The production is simple but smart enough to put the hooks at the energy end up front where they belong, and the Romantics never had a set of tunes this strong again.
____________________________________________________________________________
CD Album, Nemperor/Epic(Sony) #ZK 36273, USA, ©1993 ~ Exact Audio Copy 1.0b2

———————— TRACKS ————————

01. When I Look In Your Eyes
02. Tell It To Carrie
03. First In Line
04. Keep In Touch
05. Girl Next Door
06. What I Like About You
07. She's Got Everything
08. Till I See You Again
09. Hung On You
10. Little White Lies
11. Gimme One More Chance

———————— CREDITS ————————

**Bass, Vocals – Rich Cole      **Drums, Vocals – Jimmy Marinos      **Lead Guitar, Vocals – Mike Skill      **Rhythm Guitar, Vocals – Wally Palmar      **Producer – Peter Solley      **Engineer – Steve Brown      **Mastered By – Greg Calbi

———————— RIP LOG ————————

*** CD Rip by "JOHN CITIZEN" | Nov 2011 ***

Exact Audio Copy V1.0 beta 2 from 29. April 2011

EAC extraction logfile from 15. July 2011, 20:20

Used drive  : TDK    CDRW4800B  Adapter: 2  ID: 1

Read mode              : Secure
Utilize accurate stream : Yes
Defeat audio cache      : Yes
Make use of C2 pointers : No

Read offset correction                      : 6
Overread into Lead-In and Lead-Out          : No
Fill up missing offset samples with silence : Yes
Delete leading and trailing silent blocks  : No
Null samples used in CRC calculations      : Yes
Used interface                              : Native Win32 interface for Win NT & 2000

Used output format : Internal WAV Routines
Sample format      : 44.100 Hz; 16 Bit; Stereo


TOC of the extracted CD

    Track |  Start  |  Length  | Start sector | End sector
    ---------------------------------------------------------
        1  |  0:00.00 |  3:01.10 |        0    |    13584 
        2  |  3:01.10 |  3:23.55 |    13585    |    28864 
        3  |  6:24.65 |  2:38.00 |    28865    |    40714 
        4  |  9:02.65 |  3:42.02 |    40715    |    57366 
        5  | 12:44.67 |  4:41.65 |    57367    |    78506 
        6  | 17:26.57 |  2:55.30 |    78507    |    91661 
        7  | 20:22.12 |  2:35.40 |    91662    |  103326 
        8  | 22:57.52 |  3:53.70 |    103327    |  120871 
        9  | 26:51.47 |  3:25.50 |    120872    |  136296 
      10  | 30:17.22 |  2:39.65 |    136297    |  148286 
      11  | 32:57.12 |  4:28.08 |    148287    |  168394 

 
 


  // -----------------------------------------------------------------
  // --- Useful Template for a Popular Music album - END TEXT FILE
  // -----------------------------------------------------------------
 
 
 
 
================================================================================
================================================================================
================================================================================
================================================================================
*/





function readTXT(){
displaytext = ""; 
    txt = "————————————————————————————————————————————————————————\nfolder.txt";
    if (! fb.IsPlaying) return;
    try{
        var xpath = fb.TitleFormat("%path%").EvalWithMetadb(fb.GetNowPlaying());
        var path = xpath.substring(0, xpath.lastIndexOf("\\")) + "\\";
        var Folder = fso.GetFolder(path);
        var filelist = new Enumerator(Folder.Files);
        for (i=0;!filelist.atEnd();filelist.moveNext()) {
if (filelist.item().name.match(/.*\.txt$/)) {

// ================================================================================================= TEXT FILE PARAMETERS - START
   
//txtfile = fso.OpenTextFile(path + filelist.item().name, 1, -1);  // <---------- THIS IS THE ORIGINAL CODE --- Enables reading of ANY text file found in folder of playing track --- !!KNOWN PROBLEM: it opens text files from wrong location in some instances, such as when opening URL STREAMS from a playlist ------------>

//txtfile = fso.OpenTextFile(path + "folder.txt", 1, -1);  <---------- "-1" PARAMETER --- Always auto-creates a blank specified text file (if not exist) in the same folder as the track being played ------------>

// --- MY PREFERENCE:  If specified text file (folder.txt) exists in folder of playing track, display it, ELSE show specified characters (at line 273).
txtfile = fso.OpenTextFile(path + "folder.txt", 1, 1); 

// ================================================================================================= TEXT FILE PARAMETERS - END

txt = txtfile.ReadALL() + "\n\n";
txtfile.Close();
//displaytext = displaytext + txt;
}
            displaytext = txt;                 
        }
    }
    catch(e){
        try {
            txtfile.Close();
        }
        catch(f) {
        }
    }
    calc();
    window.Repaint();
}

// ================================================================================================= DISPLAY PARAMETERS - START

// <---------- You can tweak the text margins and alignments in the panel by adjusting the parameters here ---------->
// <---------- FYI: Centering text can be done with DT_CENTER . add it to the line like this:  "gr.GdiDrawText(displaytext ... DT_NOPREFIX | DT_CENTER);" ---------->

function on_paint(gr){
    gr.FillGradRect( 0, 0, ww, wh, 90, backcolor, backcolor);
    gr.GdiDrawText(displaytext, gfont, txtcolor, 5, offset + 10, ww-10, 60*wh,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
}

// <------------------------------------- Backup of Original Script -------------------------------------------------------->
// function on_paint(gr){
//    gr.FillGradRect( 0, 0, ww, wh, 90, backcolor, backcolor);
//    gr.GdiDrawText(displaytext, gfont, txtcolor, 10, offset + 10, ww-20, 50*wh,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
// }
// <------------------------------------------------------------------------------------------------------------------------->

// ================================================================================================= DISPLAY PARAMETERS - END

function on_mouse_rbtn_up(x, y){
    var _backgroundcolor = window.CreatePopupMenu();
    var _textcolor = window.CreatePopupMenu();
    var _menu = window.CreatePopupMenu();
    var idx;
   
    _menu.AppendMenuItem(MF_STRING, 1, "Update");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
   
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _textcolor.ID, "Text Color");
    _textcolor.AppendMenuItem(MF_STRING, 98, "Foobar Text");
    _textcolor.AppendMenuItem(MF_STRING, 99, "Foobar Highlight");
    _textcolor.AppendMenuItem(MF_STRING, 101, "White");
    _textcolor.AppendMenuItem(MF_STRING, 102, "Red");
    _textcolor.AppendMenuItem(MF_STRING, 103, "Green");
    _textcolor.AppendMenuItem(MF_STRING, 104, "Blue");
    _textcolor.AppendMenuItem(MF_STRING, 105, "Yellow");
    _textcolor.AppendMenuItem(MF_STRING, 106, "Black");
   
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _backgroundcolor.ID, "Background Color");
    _backgroundcolor.AppendMenuItem(MF_STRING, 210, "Foobar Background");
    _backgroundcolor.AppendMenuItem(MF_STRING, 211, "White");
    _backgroundcolor.AppendMenuItem(MF_STRING, 212, "Red");
    _backgroundcolor.AppendMenuItem(MF_STRING, 213, "Green");
    _backgroundcolor.AppendMenuItem(MF_STRING, 214, "Blue");
    _backgroundcolor.AppendMenuItem(MF_STRING, 215, "Brown-Black");
    _backgroundcolor.AppendMenuItem(MF_STRING, 216, "Black");

   
    if(window.GetProperty("textcolor")==101){
        _textcolor.CheckMenuItem(101, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==102)
        {_textcolor.CheckMenuItem(102, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==103)
        {_textcolor.CheckMenuItem(103, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==104)
        {_textcolor.CheckMenuItem(104, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==105)
        {_textcolor.CheckMenuItem(105, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==106)
        {_textcolor.CheckMenuItem(106, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==98)
        {_textcolor.CheckMenuItem(98, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==99)
        {_textcolor.CheckMenuItem(99, window.GetProperty("textcolor"));}
       
    if(window.GetProperty("backgroundcolor")==211){
        _backgroundcolor.CheckMenuItem(211, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==212)
        {_backgroundcolor.CheckMenuItem(212, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==213)
        {_backgroundcolor.CheckMenuItem(213, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==214)
        {_backgroundcolor.CheckMenuItem(214, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==215)
        {_backgroundcolor.CheckMenuItem(215, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==216)
        {_backgroundcolor.CheckMenuItem(216, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==210)       
        {_backgroundcolor.CheckMenuItem(210, window.GetProperty("backgroundcolor"));}

    _menu.AppendMenuItem(MF_STRING, 8, "Configure");
       
    idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
            case 1:readTXT();calc();window.Repaint();break;
            case 8:window.ShowConfigure();break;       
            case 98:window.SetProperty("textcolor", 98);txtcolor  = g_textcolor;window.Repaint();break;
            case 99:window.SetProperty("textcolor", 99);txtcolor  = g_textcolor_hl;window.Repaint();break;
            case 101:window.SetProperty("textcolor", 101);txtcolor  = RGB(255,255,255);window.Repaint();break;
            case 102:window.SetProperty("textcolor", 102);txtcolor = RGB(255,50,50);window.Repaint();break;
            case 103:window.SetProperty("textcolor", 103);txtcolor = RGB(50,255,50);window.Repaint();break;
            case 104:window.SetProperty("textcolor", 104);txtcolor = RGB(150,150,250);window.Repaint();break;
            case 105:window.SetProperty("textcolor", 105);txtcolor = RGB(255,255,50);window.Repaint();break;
            case 106:window.SetProperty("textcolor", 105);txtcolor = RGB(10,10,10);window.Repaint();break;
            case 210:window.SetProperty("backgroundcolor", 210);backcolor= g_backcolor;window.Repaint();break;
            case 211:window.SetProperty("backgroundcolor", 211);backcolor= RGB(255,255,255);window.Repaint();break;
            case 212:window.SetProperty("backgroundcolor", 212);backcolor= RGB(255,50,50);window.Repaint();break;
            case 213:window.SetProperty("backgroundcolor", 213);backcolor= RGB(50,255,50);window.Repaint();break;
            case 214:window.SetProperty("backgroundcolor", 214);backcolor= RGB(10,36,106);window.Repaint();break;
            case 215:window.SetProperty("backgroundcolor", 215);backcolor= RGB(28,28,28);window.Repaint();break;
            case 216:window.SetProperty("backgroundcolor", 216);backcolor= RGB(0,0,0);window.Repaint();break;}
         
           
    _menu.Dispose();_textcolor.Dispose();_backgroundcolor.Dispose();return true;
}

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
MF_SEPARATOR = 0x00000800;
MF_ENABLED = 0x00000000;
MF_UNCHECKED = 0x00000000;
MF_CHECKED = 0x00000008;
MF_STRING = 0x00000000;
MF_POPUP = 0x00000010;

var fso = new ActiveXObject("Scripting.FileSystemObject");
var dui = window.InstanceType;
var displaytext = "";

// ================================================================================================= FONT SETTINGS - START

// <---------- gdi.Font is changed, the last paramter is style flags ---------->

// <---------- Style Flags Reference:  FontStyleRegular = 0  |  FontStyleBold = 1  |  FontStyleItalic = 2  |  FontStyleBoldItalic = 3  |  FontStyleUnderline = 4  |  FontStyleStrikeout = 8 ---------->

// <---------- Choose Font:  Un-comment the font you want to use  !! Make sure the target font exists  !! You MUST use a monospace font if you want correct text indenting  ---------->

            // --- MY PREFERENCE:  Arial monospace has a good overall feature set. It renders a large set of characters, It displays well at small sizes, is easy to read, and has a dotted zero.
            var gfont =gdi.Font("Arial monospaced for SAP", 10, 0);
           
            // --- MY SECOND PREFERENCE:  They are nearly identical. Have unembelished zero (No slashes or dots) which is quite nice.
            // var gfont =gdi.Font("OCRBLetM", 10, 0);
            // var gfont =gdi.Font("OCR-BczykNorm", 11, 0);

// ================================================================================================= FONT SETTINGS - END

var offset =0;
var ColorTypeDUI = {text: 0,background: 1,highlight: 2,selection: 3};
var ColorTypeCUI = {text: 0,selection_text: 1,inactive_selection_text: 2,background: 3,selection_background: 4,inactive_selection_background: 5,active_item_frame: 6};
String.prototype.count=function(s1){return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;}

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

function get_colors() {
if (dui) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
} else {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
}
}
function on_size(){
    ww = window.Width;
    wh = window.Height;
    calc();
    window.Repaint();
}
function calc(){
    temp_bmp = gdi.CreateImage(1, 1);
    temp_gr = temp_bmp.GetGraphics();
    arr = temp_gr.GdiDrawText(displaytext, gfont, g_textcolor, 0, 0, ww, wh-40,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
    textheight = arr[3] - arr[1] + (wh)  + (displaytext.count("\n") * 3);
    temp_bmp.ReleaseGraphics(temp_gr);
    temp_bmp.Dispose();
    temp_gr = null;
    temp_bmp = null;offset = 0;
}
function on_mouse_wheel(delta){
    step = gfont.height * 5;
    offset += (delta * step);
    if(offset > 0 || textheight < wh) {
        offset = 0;}
        else {
            temp = -textheight + wh;
            if(offset < temp) offset = Math.round(temp / step) * step;
    }
    window.Repaint();
}
function on_playback_new_track(){
    readTXT();calc();
    window.Repaint();
}

get_colors();
on_size();

tc = window.GetProperty("textcolor",98);
if(tc==98){txtcolor = g_textcolor}else if(tc==99){txtcolor=g_textcolor_hl}else if(tc ==101){txtcolor = RGB(255,255,255);}else if(tc==102){txtcolor=RGB(255,50,50)}else if(tc==103){txtcolor=RGB(50,255,50)}else if(tc==104){txtcolor=RGB(150,150,250)}else if(tc==105){txtcolor=RGB(255,255,50)}else if(tc==106){txtcolor=RGB(10,10,10)};

bc = window.GetProperty("backgroundcolor",210);
if(bc==210){backcolor = g_backcolor}else if(bc ==211){backcolor = RGB(255,255,255);}else if(bc==212){backcolor=RGB(255,50,50)}else if(bc==213){backcolor=RGB(50,255,50)}else if(bc==214){backcolor=RGB(10,36,106)}else if(bc==215){backcolor=RGB(28,28,28)}else if(bc==216){backcolor=RGB(0,0,0)};

readTXT();
window.Repaint();
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2011-12-13 11:59:59
Marc, i hope this question to you is in the right place:

I have been enjoying your "thumbs" script for WSH panel mod, and it has been showing thumbnails of the pictures in the directories where the music files are. So, if I click on an album, I can see the artwork in the same directory as that album - great!

Question - I have noticed that this has been slowing down browsing through my collection, in particular the loading of front & rear album artwork (the front is displayed in a CD jewel case using your script, and the back is just in an album art window). Any thoughts on how to improve this performance. Alternatively, could the script not scan the directory by default, but only when that particular tab is selected (or a button in the tab to scan is pressed)?

Thanks
Title: WSH Panel Mod script discussion/help
Post by: Mooe on 2011-12-13 20:04:03
Sorry for hijacking the thread, sort of, but is it possible to merge two consistent panels with each other so they are viewed together, using WSH Panel Mod?

What I want to do is that I want the panel "Item details" displayed above "Channel spectrum panel", like this:

(http://filesmelt.com/dl/foobar2000itemdetailsplusspectrumpanel.png)

I'm quite new to scripting and all but I just wanted to know if it is possible or if there already is a script for this.
Title: WSH Panel Mod script discussion/help
Post by: endlesslyonline on 2011-12-14 09:23:27
Marc, back once again for your help and guidance.

I have been using your last.fm similar artist script, and it works like a charm.

One thing, that i would like to know, how easy would it be, to change the output from

artist1
artist2
artist3
artist4
artist5
artist6
artist7
artist8
artist9

to this

artist1  artist2  artist3  artist4
artist5  artist6  artist7  artist8
artist9

And if it is possible, which function should i go scratch around in.

Thanks in advance,

Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-12-14 13:55:35
Marc, I continue to enjoy your scripts - thanks very much!  A question that I can't figure out: is there a way to configure your thumbs script to have a custom folder location for images to be saved and still have the script automatically download images from lastfm if there are no images found for that artist in the custom location?  I have several portable installations of Foobar2000 around the house and only one standard installation, and I'd like all of the installations to share a common storage location for lastfm art without only having this custom location as the only source for all images (I still want the script to download images if it can't find any in the custom location).  I could be misunderstanding how the current thumbs script works, but it seems to only allow automatic download of images for the default storage location.

Thanks for any thoughts.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-15 02:17:15
@extracampine, i don't think i can do anything about performance. i suppose not re-drawing on artist change/panel refresh and triggering it manually could be done but i'm not very motivated to do it at the moment. sorry.

@endlesslyonline, to add support for columns would require tweaking several functions. there's on_paint which controls the display but you'd also need to track the mouse pointer in on_mouse_move and on_mouse_lbtn_up

@godrick. you can browse the marc2003 folder you extracted and edit the file named common4.js find

Code: [Select]
var data_folder = fb.ProfilePath + "wsh_lastfm\\";


you can edit this path to a common network share. note the double backslash to separate folder names. i'm not sure if UNC paths would work. you can test that.

Code: [Select]
var data_folder = "g:\\foobar stuff\\wsh_lastfm\\";


this affects all my scripts that display artist info so be aware of that. obviously you need to make sure the network share is writeable.
Title: WSH Panel Mod script discussion/help
Post by: shakesify on 2011-12-16 03:06:36
Hi,

I'm trying to install the xch4nge skin and right now I'm receiving an error on opening foobar. The error messages are:

Scripting Engine Initialization Failed ({05B7045B-7957-4F5C-9D6D-28ECC5B7EE1E}, CODE: 0x800401f3): Invalid class string 
and
Scripting Engine Initialization Failed ({3CF6B331-FD65-4FE2-A0CA-03BE6480BD13}, CODE: 0x800401f3): Invalid class string 

I was wondering what I could do to fix this? I'm currently running WSH panel mod 1.5.0 and foobar 1.1.10


Thanks in advance
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2011-12-16 07:24:27
Hi,

I'm trying to install the xch4nge skin and right now I'm receiving an error on opening foobar. The error messages are:

Scripting Engine Initialization Failed ({05B7045B-7957-4F5C-9D6D-28ECC5B7EE1E}, CODE: 0x800401f3): Invalid class string 
and
Scripting Engine Initialization Failed ({3CF6B331-FD65-4FE2-A0CA-03BE6480BD13}, CODE: 0x800401f3): Invalid class string 

I was wondering what I could do to fix this? I'm currently running WSH panel mod 1.5.0 and foobar 1.1.10


Thanks in advance


bad topic! but answer is that Xch4nge is not compliant with any official WSH panel Mod component, you have to use the one provided in the archive, nothing else.
Title: WSH Panel Mod script discussion/help
Post by: Tigermess on 2011-12-17 21:58:04
Hi, I made few customizations to marc's web links script, most notably added Google, Discogs & Wikipedia search and improved title formating for Google & Dg (album aimed) search to optimize search results. Icons similar to icons already existing are included too. Panel is now alignable.

Feel free to download and share any part in your own builds, scripts packs etc, no credits needed

http://www.mediafire.com/?rpiuuxwcio4xhsr (http://www.mediafire.com/?rpiuuxwcio4xhsr)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2011-12-18 00:32:35
@Marc2003, your advice on how to create a single image save location in #1310 shared across several Foobar2000 installations was perfect - everything works great with the changes. Since I have spotty internet connectivity in some of my locations throughout the house, this is a big improvement for me.  Thanks very much!
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-12-19 01:58:44
@Tigermess, I downloaded your mod of marc2003's 'web links' script...

It failed to load and crashed   AND   it crashed my 'autoplaylists' script by marc2003.
You included 'common4.js' and 'tooltip_buttons.js' in your package; are they modified? marc2003 already provides these in his packages!
I compared the JS files in Beyond Compare and I see differences.

Thankfully, I made backups of marc2003's JS files and I restored my system. Therefore I am WARNING any potential user of Tigermess' mod ...be careful, do not just overwrite your foobar2000/marc2003 config with what Tigermess has provided.

In my opinion, you should have taken the time to include a README.TXT and documented, what exactly you did and what exactly you modified; what lines, what files.

What you could have done is isolated your path from marc2003's path like this (for example): var script_path = fb.ProfilePath + "scripts\\Tigermess\\";
and added your whole package in there. That way users don't have to destroy their marc2003 configurations just to test your "mod".
Title: WSH Panel Mod script discussion/help
Post by: Tigermess on 2011-12-19 09:31:45
Hi, Derty, thanks for report. I apologize for causing you any trouble.

I'm not aware of including any modified files else than script itself. The *.js files shall be from latest marc2003 scripts pack which he ocassionally publishes via DropBox. I included them only for the sake of users who don't have marc's pack yet. If I included any other version, it's regretful mistake. Once I'll be at home, I'll check it and report.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-19 10:13:46
@derty2, you're the one in the wrong here. those files match mine so it's your files that must be out of date. also the script runs without any errors so perhaps an apology is in order.

just checking the dates, i last made changes to mine on the 11th november.

edit: i do see a little problem with the google and discogs links. if your files have no album tag, the search query is blank. perhaps it could just search for the artist in these instances.
Title: WSH Panel Mod script discussion/help
Post by: Tigermess on 2011-12-19 11:26:29
I'm glad if it is so.... thanks. Just to be sure I'll still compare the content of the files, 'coz I don't want to screw other people configs. I learned my lesson too, next time I'll include only modified files and include URL to your scripts repository. It will be up to the user if he already has the files or he chooses to download the latest version.

if your files have no album tag, the search query is blank. perhaps it could just search for the artist in these instances.

Is definitely good point. I can do that in next release. Actually I was thinking about creating some onClick content menu letting user choose if he wants to search for artist, artist+album or artist+title for each of the services.

Out of curiosity, I'd prefer to let it work with current selection instead of the now playing track. I am not sure if I have seen WSH script displaying anything for the current selection... OTOH you guys do marvelous playlist scripts which have to work with selections somehow. Before I'll spend hours trying, I want to ask just if there's no problem for WSH script to work with current selection instead of what's now playing?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-19 11:36:44
just edit line 25 of your script....

Code: [Select]
selection_mode = 1;


0 uses the setting found under file>preferences>display>selection viewers
1 uses now playing but follows selection if playback is stopped.
2 always follows the selected item

edit: i should mention that my other scripts don't need editing like this. all the last.fm scripts, cd jewel case, artreader and news-reviews-blogs all default to 0 and have context menu items allowing the user to change the option. under no circumstances should people edit my last.fm playcount sync as changing this setting will break it. it's stuck on now playing whether you like it or not.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2011-12-19 13:33:20
This is my marc2003 JS support script setup:
    foobar2000\scripts\marc2003\common4.js ===> Date Modified: 2011-11-12 10:07 PM — CRC32: 425EE6C0
     foobar2000\scripts\marc2003\common.js ===> Date Modified: 2011-04-14 7:21 PM — CRC32: B95550E7
     foobar2000\scripts\marc2003\tooltip_buttons.js ===> Date Modified: 2011-10-30 11:34 PM — CRC32: 7B643F3F


So why did your "Autoplaylists" program script work without a hitch when I installed it?
     foobar2000\scripts\marc2003\wsh_samples\autoplaylists.txt ===> 2011-11-12 8:46 PM — CRC32: F0065D32[/font]

So how am I supposed to "know" what are the exact requirements for running the modded script by Tigermess? He didn't leave any documentation with the download package. He didn't specify anything.

Is it not possible that my "test case" above could easily have happened to many other "ignorant" users. I think it is easily possible; and I think I have done ALL such users a BIG favour by outlining my experiences.

Since there is such a critical relationship between your JS support scripts and your program scripts, then why do you FAIL to provide clear verbose preamble comments in the headers of your JS support scripts and your program scripts?

Why don't you have a link to your file repository in your avatar, so people can easily find your "latest" stuff?

Don't you like cultivating an ongoing and updated README.TXT with your packages?

Would you like me to download and try Tigermess' script again? If yes, then point me to ALL NECESSARY REQUIREMENTS and I will try again.

Is it possible for a user to prefix/paste all the lines from the JS support scripts ("common4.js", "tooltip_buttons.js") into a program script such as ("web links.txt")? This way, your program script becomes self-contained and non-dependent on external support files. I would prefer to have things that way.

Thankyou.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-19 14:05:33
ok, perhaps Tigermess should have said you need to be running my very latest scripts for it to be compatible. but you should have thought of this before throwing around accusations that he/she somehow broke it when they haven't made any changes at all.

now because the latest common files seemingly breaks your autoplaylists script, all you need to do is update it to the latest. i know it's a PITA when i change stuff but i do guarantee that if you have common files and scripts from the same zip, they do work.
Title: WSH Panel Mod script discussion/help
Post by: Tigermess on 2011-12-19 19:22:56
I checked files... they matched. "Safe" pack is here - marc's web links+ (http://www.mediafire.com/?3elre0z4k9zl0b4).

Code: [Select]
selection_mode = 1;

I don't mind undocumented features.. thanks  For me, it works perfectly in playlist, unfortunately not anywhere else. Is it supposed to work also with media library viewers? I use facets - and it ignores everything I select there.
[I have latest foobar (1.10), WSH Mod (1.5). I don't see file>preferences>display>selection viewers. Checked twice.]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-19 19:37:05
it only works with library viewers if set to 0 and the foobar display preferences set to prefer current selection

as i mentioned above, i provide a nice menu option for most of my scripts. this is the only one that doesn't use it.

(http://dl.dropbox.com/u/22801321/selection%20mode.png)
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2011-12-22 17:10:01
Just got a chance to play with Tigermess' script
From the first tries, I found that in certain cases and when the album contaiins more than one word, discogs does not recognize it as one album name.
What I get in the search box is a little odd:
6 <omm Content="" With="" Blood="">

Where 6 <omm is the actual artist name, and Content With Blood the album title. Maybe this is due to the odd chars in the artist name? It is from taging via discogs though.
Title: WSH Panel Mod script discussion/help
Post by: Koyber on 2011-12-25 12:31:51
Hi marc2003,
I have a problem in your Simple Biography script that I think it might be a bug (a strange one). It was working all fine and then I played some music from Shlohmo (http://www.last.fm/music/Shlohmo), and then the script just crashed, and if you try to reload id while playing the same song then it crashes the entire Foobar.
I thought it could be a problem in my tags but it seems that it you just change the artist field with "Shlohmo" in any other artist then it reproduces the problem.
I suppose it's something coming from last.fm, but I don't know that 

Thanks in advance!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-28 13:43:55
Quote
crashes the entire Foobar


i'm pretty sure it doesn't. the content for that artist from last.fm is indeed broken but it should only cause the panel to stop working, not bring down foobar entirely.... 

anyway, i've updated it so it displays an error instead.... http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

just import the simple biogaphy.txt file. no other changes.
Title: WSH Panel Mod script discussion/help
Post by: Koyber on 2011-12-28 20:49:31
Yeah sometimes it crashed the entire foobar, other times just the panel. Here is the error report I got from the last crash if you want to see it, but anyway, it works like a charm now.
Thanks!!

Code: [Select]
Illegal operation:
Code: C0000005h, flags: 00000000h, address: 704B3A23h
Access violation, operation: read, address: 00000050h

Call path:
entry=>app_mainloop

Code bytes (704B3A23h):
704B39E3h:  00 00 0F 84 FC 57 0A 00 8B 55 C4 8D 45 C0 50 6A
704B39F3h:  00 8D 4D B8 51 52 E8 61 48 FD FF 89 45 E8 8B 45
704B3A03h:  0C 85 C0 74 15 8B 8B 5C 01 00 00 8B 51 50 8B 4D
704B3A13h:  C0 50 E8 74 4C FD FF 89 45 E0 8B 83 5C 01 00 00
704B3A23h:  8B 48 50 85 F6 8B 75 E8 0F 95 C2 88 91 74 05 00
704B3A33h:  00 85 F6 0F 88 B2 4E 04 00 8D 47 04 50 FF 15 68
704B3A43h:  13 48 70 85 C0 0F 85 3D 87 FD FF 8B 47 34 C7 07
704B3A53h:  E4 C7 48 70 85 C0 0F 85 2E 58 0A 00 8B 47 0C 8B

Stack (002FE3C4h):
002FE3A4h:  00000000 FFFFFD34 000002E4 FFFFFD34
002FE3B4h:  000002CC 00000019 00000000 002FE3F8
002FE3C4h:  68C6806F 00000000 002FE468 00FDB198
002FE3D4h:  04645CB0 00000000 00000000 0104B4E0
002FE3E4h:  04645CB0 0104B4E0 00000000 00000000
002FE3F4h:  00000000 049DCB40 049D0700 04798918
002FE404h:  01085C94 0106871C 00000008 00000000
002FE414h:  00000001 00000000 0A8B4780 80020101
002FE424h:  00FDB198 002FE3C4 002FE4CC 7061C165
002FE434h:  00000001 002FE4DC 704B3897 00FDB198
002FE444h:  00000000 00000000 68C68007 0395FF98
002FE454h:  00000000 0395FF9A 00000017 00000000
002FE464h:  010BE618 00000000 00000000 00000000
002FE474h:  00000000 00000000 00000000 00000000
002FE484h:  00000000 0395FF98 00000000 002FE524
002FE494h:  01085750 704B22B4 00000000 00000000
002FE4A4h:  00000003 00000000 00000000 00000000
002FE4B4h:  00000000 000028E5 00000000 00000001
002FE4C4h:  68C6800B 03CA0000 002FE5BC 7061C1B9
002FE4D4h:  00000000 0393F6E8 002FE528 704A48F5

Registers:
EAX: 00000000, EBX: 00FDB198, ECX: 002FE3F0, EDX: 049DCB40
ESI: 00000000, EDI: 0A8B4780, EBP: 002FE438, ESP: 002FE3C4

Crash location:
Module: jscript9
Offset: 33A23h
Symbol: "DllGetClassObject" (+A337h)

Loaded modules:
foobar2000                      loaded at 011D0000h - 013CB000h
ntdll                            loaded at 77340000h - 774C0000h
kernel32                        loaded at 75000000h - 75110000h
KERNELBASE                      loaded at 76610000h - 76656000h
COMCTL32                        loaded at 746D0000h - 7486E000h
msvcrt                          loaded at 74A80000h - 74B2C000h
GDI32                            loaded at 76430000h - 764C0000h
USER32                          loaded at 74ED0000h - 74FD0000h
ADVAPI32                        loaded at 76300000h - 763A0000h
sechost                          loaded at 74FE0000h - 74FF9000h
RPCRT4                          loaded at 75110000h - 75200000h
SspiCli                          loaded at 74A20000h - 74A80000h
CRYPTBASE                        loaded at 74A10000h - 74A1C000h
LPK                              loaded at 75200000h - 7520A000h
USP10                            loaded at 76150000h - 761ED000h
SHLWAPI                          loaded at 764C0000h - 76517000h
DSOUND                          loaded at 72DD0000h - 72E42000h
ole32                            loaded at 76920000h - 76A7C000h
WINMM                            loaded at 731B0000h - 731E2000h
POWRPROF                        loaded at 72DA0000h - 72DC5000h
SETUPAPI                        loaded at 75E60000h - 75FFD000h
CFGMGR32                        loaded at 76520000h - 76547000h
OLEAUT32                        loaded at 76850000h - 768DF000h
DEVOBJ                          loaded at 76000000h - 76012000h
UxTheme                          loaded at 732A0000h - 73320000h
SHELL32                          loaded at 75210000h - 75E5A000h
zlib1                            loaded at 5A4C0000h - 5A4D4000h
shared                          loaded at 73410000h - 7343B000h
imagehlp                        loaded at 76550000h - 7657A000h
dbghelp                          loaded at 72CB0000h - 72D9B000h
COMDLG32                        loaded at 74C90000h - 74D0B000h
gdiplus                          loaded at 72E80000h - 73010000h
Secur32                          loaded at 73730000h - 73738000h
CRYPT32                          loaded at 76730000h - 7684D000h
MSASN1                          loaded at 74B60000h - 74B6C000h
IMM32                            loaded at 762A0000h - 76300000h
MSCTF                            loaded at 76660000h - 7672C000h
guard32                          loaded at 10000000h - 1004D000h
VERSION                          loaded at 73330000h - 73339000h
fltlib                          loaded at 73320000h - 73327000h
HsSrv                            loaded at 001B0000h - 001E7000h
CLBCatQ                          loaded at 76580000h - 76603000h
MMDevApi                        loaded at 749B0000h - 749E9000h
PROPSYS                          loaded at 748B0000h - 749A5000h
dwmapi                          loaded at 731F0000h - 73203000h
foo_albumlist                    loaded at 72A60000h - 72ABD000h
foo_fileops                      loaded at 73350000h - 73397000h
foo_uie_biography                loaded at 72A00000h - 72A58000h
foo_cdda                        loaded at 729B0000h - 729FE000h
foo_scheduler                    loaded at 728D0000h - 729AC000h
foo_abx                          loaded at 028D0000h - 02902000h
foo_uie_wsh_panel_mod            loaded at 727F0000h - 728C3000h
Msimg32                          loaded at 743B0000h - 743B5000h
foo_ui_std                      loaded at 726D0000h - 727E9000h
foo_ui_columns                  loaded at 03AD0000h - 03C60000h
urlmon                          loaded at 76030000h - 76141000h
iertutil                        loaded at 74D10000h - 74EC8000h
WININET                          loaded at 74B70000h - 74C8B000h
Normaliz                        loaded at 74FD0000h - 74FD3000h
foo_audioscrobbler              loaded at 02AA0000h - 02AD3000h
foo_rgscan                      loaded at 72680000h - 726CB000h
foo_masstag                      loaded at 03020000h - 03074000h
foo_converter                    loaded at 72600000h - 7267C000h
foo_wave_seekbar                loaded at 72460000h - 725FE000h
WS2_32                          loaded at 768E0000h - 76915000h
NSI                              loaded at 76020000h - 76026000h
foo_uie_console                  loaded at 02920000h - 0293A000h
foo_discogs                      loaded at 722E0000h - 72343000h
foo_uie_albumlist                loaded at 03280000h - 032C3000h
foo_freedb2                      loaded at 73450000h - 73490000h
foo_dsp_std                      loaded at 72290000h - 722D8000h
foo_input_std                    loaded at 72120000h - 72290000h
foo_burninate                    loaded at 720E0000h - 7211E000h
foo_dsp_xgeq                    loaded at 720A0000h - 720D4000h
foo_deskband_controls            loaded at 73710000h - 7371F000h
MSVCR100                        loaded at 71FE0000h - 7209E000h
foo_uie_panel_splitter          loaded at 03A10000h - 03A69000h
foo_uie_vis_peakmeter_spectrum  loaded at 03A80000h - 03ABF000h
foo_dsp_crossfader              loaded at 03DB0000h - 03DE2000h
foo_keep_queue                  loaded at 73960000h - 7396F000h
MSVCR90                          loaded at 71F30000h - 71FD3000h
foo_uie_graphical_browser        loaded at 71E90000h - 71F24000h
AUDIOSES                        loaded at 74870000h - 748A6000h
WindowsCodecs                    loaded at 72B80000h - 72C7B000h
apphelp                          loaded at 73E70000h - 73EBC000h
DropboxExt.14                    loaded at 04110000h - 04127000h
MSVCP71                          loaded at 7C3A0000h - 7C41B000h
MSVCR71                          loaded at 7C340000h - 7C396000h
EhStorShell                      loaded at 73DF0000h - 73E21000h
ntshrui                          loaded at 73D10000h - 73D80000h
srvcli                          loaded at 73E50000h - 73E69000h
cscapi                          loaded at 73E40000h - 73E4B000h
slc                              loaded at 73E30000h - 73E3A000h
SXS                              loaded at 71E30000h - 71E8F000h
frontend_direct2d                loaded at 71DD0000h - 71E27000h
d2d1                            loaded at 73B50000h - 73C0A000h
frontend_direct3d9              loaded at 71D60000h - 71DC3000h
d3d9                            loaded at 708A0000h - 70A63000h
d3d8thk                          loaded at 73400000h - 73406000h
d3dx9_42                        loaded at 706B0000h - 70895000h
SciLexer                        loaded at 71CC0000h - 71D51000h
jscript                          loaded at 71C00000h - 71CB2000h
CRYPTSP                          loaded at 73DD0000h - 73DE6000h
rsaenh                          loaded at 73D90000h - 73DCB000h
RpcRtRemote                      loaded at 73D80000h - 73D8E000h
wshom                            loaded at 70C10000h - 70C31000h
MPR                              loaded at 70BF0000h - 70C02000h
ScrRun                          loaded at 70BC0000h - 70BEA000h
msxml3                          loaded at 70A80000h - 70BB3000h
mshtml                          loaded at 6F170000h - 6FD2B000h
PSAPI                            loaded at 77310000h - 77315000h
ntmarta                          loaded at 740B0000h - 740D1000h
WLDAP32                          loaded at 761F0000h - 76235000h
msscript                        loaded at 73020000h - 7303A000h
vbscript                        loaded at 70640000h - 706AA000h
jscript9                        loaded at 70480000h - 7063B000h
IEFRAME                          loaded at 6E1E0000h - 6EB26000h
OLEACC                          loaded at 70440000h - 7047C000h
mscms                            loaded at 738D0000h - 73949000h
USERENV                          loaded at 738B0000h - 738C7000h
profapi                          loaded at 738A0000h - 738AB000h
icm32                            loaded at 70400000h - 70438000h
nvd3dum                          loaded at 6D830000h - 6E1D9000h
avrt                            loaded at 746C0000h - 746C7000h
MLANG                            loaded at 736E0000h - 7370E000h
explorerframe                    loaded at 73040000h - 731AF000h
DUser                            loaded at 73740000h - 7376F000h
DUI70                            loaded at 72AC0000h - 72B72000h
mswsock                          loaded at 74040000h - 7407C000h
wshtcpip                        loaded at 74030000h - 74035000h
wship6                          loaded at 73890000h - 73896000h
DNSAPI                          loaded at 73970000h - 739B4000h
IPHLPAPI                        loaded at 74090000h - 740AC000h
WINNSI                          loaded at 74080000h - 74087000h
rasadhlp                        loaded at 73880000h - 73886000h
fwpuclnt                        loaded at 73840000h - 73878000h

Stack dump analysis:
Address: 7061C165h (jscript9+19C165h), symbol: "DllUnregisterServer" (+7D173h)
Address: 704B3897h (jscript9+33897h), symbol: "DllGetClassObject" (+A1ABh)
Address: 704B22B4h (jscript9+322B4h), symbol: "DllGetClassObject" (+8BC8h)
Address: 7061C1B9h (jscript9+19C1B9h), symbol: "DllUnregisterServer" (+7D1C7h)
Address: 704A48F5h (jscript9+248F5h), symbol: "JsVarToScriptDirect" (+22C89h)
Address: 704B22EAh (jscript9+322EAh), symbol: "DllGetClassObject" (+8BFEh)
Address: 704B22B4h (jscript9+322B4h), symbol: "DllGetClassObject" (+8BC8h)
Address: 727F9A51h (foo_uie_wsh_panel_mod+9A51h)
Address: 74EF12A5h (USER32+212A5h), symbol: "PostMessageW" (+0h)
Address: 72890FF4h (foo_uie_wsh_panel_mod+A0FF4h), symbol: "foobar2000_get_interface" (+5CA34h)
Address: 012FE6CCh (foobar2000+12E6CCh)
Address: 728880CAh (foo_uie_wsh_panel_mod+980CAh), symbol: "foobar2000_get_interface" (+53B0Ah)
Address: 7282BFD9h (foo_uie_wsh_panel_mod+3BFD9h)
Address: 74F0D0F5h (USER32+3D0F5h), symbol: "SendDlgItemMessageW" (+0h)
Address: 74F0D0F5h (USER32+3D0F5h), symbol: "SendDlgItemMessageW" (+0h)
Address: 74F0F212h (USER32+3F212h), symbol: "GetDlgItem" (+58h)
Address: 100344AFh (guard32+344AFh), symbol: "Exported" (+A5BFh)
Address: 74F0D127h (USER32+3D127h), symbol: "SendDlgItemMessageW" (+32h)
Address: 10019C3Ah (guard32+19C3Ah)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74F0D0F5h (USER32+3D0F5h), symbol: "SendDlgItemMessageW" (+0h)
Address: 727FF518h (foo_uie_wsh_panel_mod+F518h)
Address: 727FF39Bh (foo_uie_wsh_panel_mod+F39Bh)
Address: 72885FC8h (foo_uie_wsh_panel_mod+95FC8h), symbol: "foobar2000_get_interface" (+51A08h)
Address: 728882AAh (foo_uie_wsh_panel_mod+982AAh), symbol: "foobar2000_get_interface" (+53CEAh)
Address: 7282BED5h (foo_uie_wsh_panel_mod+3BED5h)
Address: 74F0D0F5h (USER32+3D0F5h), symbol: "SendDlgItemMessageW" (+0h)
Address: 72817E52h (foo_uie_wsh_panel_mod+27E52h)
Address: 7288FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 728883D0h (foo_uie_wsh_panel_mod+983D0h), symbol: "foobar2000_get_interface" (+53E10h)
Address: 72817747h (foo_uie_wsh_panel_mod+27747h)
Address: 7282B797h (foo_uie_wsh_panel_mod+3B797h)
Address: 72894D0Ch (foo_uie_wsh_panel_mod+A4D0Ch), symbol: "foobar2000_get_interface" (+6074Ch)
Address: 72819200h (foo_uie_wsh_panel_mod+29200h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74EE62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 74F0F943h (USER32+3F943h), symbol: "GetCursor" (+263h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74F0F8FBh (USER32+3F8FBh), symbol: "GetCursor" (+21Bh)
Address: 74F4A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 74F0F784h (USER32+3F784h), symbol: "GetCursor" (+A4h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74F0F860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 74EE7038h (USER32+17038h), symbol: "GetWindowLongW" (+3Ah)
Address: 746FB4C9h (COMCTL32+2B4C9h), symbol: "ImageList_GetIcon" (+59Bh)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74F0F889h (USER32+3F889h), symbol: "GetCursor" (+1A9h)
Address: 74EE62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74F0F860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 74F0F860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 74EE6D3Ah (USER32+16D3Ah), symbol: "GetThreadDesktop" (+D7h)
Address: 74F0F860h (USER32+3F860h), symbol: "GetCursor" (+180h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74EE6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 74F4A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 74EE965Eh (USER32+1965Eh), symbol: "GetWindow" (+3F0h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74EE9679h (USER32+19679h), symbol: "SendMessageW" (+0h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74EE96C5h (USER32+196C5h), symbol: "SendMessageW" (+4Ch)
Address: 1001B1D6h (guard32+1B1D6h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74EE9679h (USER32+19679h), symbol: "SendMessageW" (+0h)
Address: 74EE9679h (USER32+19679h), symbol: "SendMessageW" (+0h)
Address: 74EF0F91h (USER32+20F91h), symbol: "GetParent" (+29h)
Address: 74EF0FDBh (USER32+20FDBh), symbol: "GetParent" (+73h)
Address: 100344AFh (guard32+344AFh), symbol: "Exported" (+A5BFh)
Address: 74774601h (COMCTL32+A4601h), symbol: "GetEffectiveClientRect" (+3409h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74774663h (COMCTL32+A4663h), symbol: "GetEffectiveClientRect" (+346Bh)
Address: 747744EDh (COMCTL32+A44EDh), symbol: "GetEffectiveClientRect" (+32F5h)
Address: 746FB495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 74EF21B1h (USER32+221B1h), symbol: "IsChild" (+0h)
Address: 03B33F9Eh (foo_ui_columns+63F9Eh)
Address: 74EE62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 746FB495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 746FB495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 74EE6D3Ah (USER32+16D3Ah), symbol: "GetThreadDesktop" (+D7h)
Address: 746FB495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 74EE6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 74F4A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 74EE77C4h (USER32+177C4h), symbol: "CharPrevW" (+138h)
Address: 746FB495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 74F4A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 74EE788Ah (USER32+1788Ah), symbol: "DispatchMessageW" (+Fh)
Address: 746FB495h (COMCTL32+2B495h), symbol: "ImageList_GetIcon" (+567h)
Address: 74F0C81Fh (USER32+3C81Fh), symbol: "IsDialogMessageW" (+11Eh)
Address: 74F0CDE7h (USER32+3CDE7h), symbol: "DialogBoxIndirectParamW" (+1F4h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74F0CF5Ch (USER32+3CF5Ch), symbol: "DialogBoxIndirectParamAorW" (+108h)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 74F0CE8Ah (USER32+3CE8Ah), symbol: "DialogBoxIndirectParamAorW" (+36h)
Address: 727F0000h (foo_uie_wsh_panel_mod+0h)
Address: 728B3B38h (foo_uie_wsh_panel_mod+C3B38h), symbol: "foobar2000_get_interface" (+7F578h)
Address: 728192B0h (foo_uie_wsh_panel_mod+292B0h)
Address: 74F0D009h (USER32+3D009h), symbol: "DialogBoxParamW" (+3Fh)
Address: 727F0000h (foo_uie_wsh_panel_mod+0h)
Address: 728B3B38h (foo_uie_wsh_panel_mod+C3B38h), symbol: "foobar2000_get_interface" (+7F578h)
Address: 728192B0h (foo_uie_wsh_panel_mod+292B0h)
Address: 7282F02Dh (foo_uie_wsh_panel_mod+3F02Dh)
Address: 727F0000h (foo_uie_wsh_panel_mod+0h)
Address: 728192B0h (foo_uie_wsh_panel_mod+292B0h)
Address: 7282C548h (foo_uie_wsh_panel_mod+3C548h)
Address: 72894D0Ch (foo_uie_wsh_panel_mod+A4D0Ch), symbol: "foobar2000_get_interface" (+6074Ch)
Address: 001D0926h (HsSrv+20926h), symbol: "removeCOMHook" (+1E286h)
Address: 72894D30h (foo_uie_wsh_panel_mod+A4D30h), symbol: "foobar2000_get_interface" (+60770h)
Address: 74EE80A9h (USER32+180A9h), symbol: "GetUserObjectInformationW" (+41h)
Address: 728410CFh (foo_uie_wsh_panel_mod+510CFh), symbol: "foobar2000_get_interface" (+CB0Fh)
Address: 74EE80BBh (USER32+180BBh), symbol: "GetUserObjectInformationW" (+53h)
Address: 7288FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 7288FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 72894D40h (foo_uie_wsh_panel_mod+A4D40h), symbol: "foobar2000_get_interface" (+60780h)
Address: 7288FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 7288FDECh (foo_uie_wsh_panel_mod+9FDECh), symbol: "foobar2000_get_interface" (+5B82Ch)
Address: 7282DC67h (foo_uie_wsh_panel_mod+3DC67h)
Address: 72888956h (foo_uie_wsh_panel_mod+98956h), symbol: "foobar2000_get_interface" (+54396h)
Address: 7282DC76h (foo_uie_wsh_panel_mod+3DC76h)
Address: 7282C9FFh (foo_uie_wsh_panel_mod+3C9FFh)
Address: 10034204h (guard32+34204h), symbol: "Exported" (+A314h)
Address: 03A8AE2Bh (foo_uie_vis_peakmeter_spectrum+AE2Bh)
Address: 764485C9h (GDI32+185C9h), symbol: "PolyPatBlt" (+EEh)
Address: 764485A2h (GDI32+185A2h), symbol: "PolyPatBlt" (+C7h)
Address: 72888A34h (foo_uie_wsh_panel_mod+98A34h), symbol: "foobar2000_get_interface" (+54474h)
Address: 72831146h (foo_uie_wsh_panel_mod+41146h)
Address: 72888A34h (foo_uie_wsh_panel_mod+98A34h), symbol: "foobar2000_get_interface" (+54474h)
Address: 72831146h (foo_uie_wsh_panel_mod+41146h)
Address: 7644DFB5h (GDI32+1DFB5h), symbol: "GetCharWidthA" (+2A4h)
Address: 7644DF8Ch (GDI32+1DF8Ch), symbol: "GetCharWidthA" (+27Bh)
Address: 7644DF13h (GDI32+1DF13h), symbol: "GetCharWidthA" (+202h)
Address: 7644DFC4h (GDI32+1DFC4h), symbol: "GetCharWidthA" (+2B3h)
Address: 74EE60E2h (USER32+160E2h), symbol: "gapfnScSendMessage" (+11Ah)
Address: 74EE7468h (USER32+17468h), symbol: "ReleaseDC" (+22h)
Address: 03A8C3E1h (foo_uie_vis_peakmeter_spectrum+C3E1h)
Address: 001E077Ah (HsSrv+3077Ah), symbol: "removeCOMHook" (+2E0DAh)
Address: 03A8E173h (foo_uie_vis_peakmeter_spectrum+E173h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74EE6F9Eh (USER32+16F9Eh), symbol: "GetThreadDesktop" (+33Bh)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74EE6F9Eh (USER32+16F9Eh), symbol: "GetThreadDesktop" (+33Bh)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74EE702Ch (USER32+1702Ch), symbol: "GetWindowLongW" (+2Eh)
Address: 74EE7038h (USER32+17038h), symbol: "GetWindowLongW" (+3Ah)
Address: 72888BF2h (foo_uie_wsh_panel_mod+98BF2h), symbol: "foobar2000_get_interface" (+54632h)
Address: 72871AE1h (foo_uie_wsh_panel_mod+81AE1h), symbol: "foobar2000_get_interface" (+3D521h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74F50230h (USER32+80230h), symbol: "ShutdownBlockReasonDestroy" (+59A2h)
Address: 74EE62FAh (USER32+162FAh), symbol: "gapfnScSendMessage" (+332h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74EE6D3Ah (USER32+16D3Ah), symbol: "GetThreadDesktop" (+D7h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74EE6CE9h (USER32+16CE9h), symbol: "GetThreadDesktop" (+86h)
Address: 74F4A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 74EE90C9h (USER32+190C9h), symbol: "LoadStringW" (+210h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74EE6E57h (USER32+16E57h), symbol: "GetThreadDesktop" (+1F4h)
Address: 74EF291Fh (USER32+2291Fh), symbol: "GetKeyState" (+0h)
Address: 7735011Ah (ntdll+1011Ah), symbol: "KiUserCallbackDispatcher" (+2Eh)
Address: 77350080h (ntdll+10080h), symbol: "KiUserApcDispatcher" (+48h)
Address: 74EE6A8Ch (USER32+16A8Ch), symbol: "gapfnScSendMessage" (+AC4h)
Address: 72871950h (foo_uie_wsh_panel_mod+81950h), symbol: "foobar2000_get_interface" (+3D390h)
Address: 74EE6AE9h (USER32+16AE9h), symbol: "gapfnScSendMessage" (+B21h)
Address: 74F50230h (USER32+80230h), symbol: "ShutdownBlockReasonDestroy" (+59A2h)
Address: 74F4A61Eh (USER32+7A61Eh), symbol: "VTagOutput" (+54h)
Address: 7282CC2Dh (foo_uie_wsh_panel_mod+3CC2Dh)
Address: 74EE6B00h (USER32+16B00h), symbol: "gapfnScSendMessage" (+B38h)
Address: 03A8F1DBh (foo_uie_vis_peakmeter_spectrum+F1DBh)
Address: 001E077Ah (HsSrv+3077Ah), symbol: "removeCOMHook" (+2E0DAh)
Address: 001E077Ah (HsSrv+3077Ah), symbol: "removeCOMHook" (+2E0DAh)
Address: 03A8F1ECh (foo_uie_vis_peakmeter_spectrum+F1ECh)
Address: 001E077Ah (HsSrv+3077Ah), symbol: "removeCOMHook" (+2E0DAh)
Address: 77373472h (ntdll+33472h), symbol: "RtlImageNtHeader" (+30Eh)
Address: 70A3A661h (d3d9+19A661h), symbol: "DebugSetLevel" (+F1DB0h)
Address: 708A7641h (d3d9+7641h)
Address: 72888A34h (foo_uie_wsh_panel_mod+98A34h), symbol: "foobar2000_get_interface" (+54474h)
Address: 72831146h (foo_uie_wsh_panel_mod+41146h)

Environment:
App: foobar2000 v1.1.10
OS: Windows 6.1.7601 Service Pack 1 x64
CPU: Intel® Core™2 Duo CPU    E8400  @ 3.00GHz, features: MMX SSE SSE2 SSE3 SSE4.1
Audio: Altavoces (ASUS Xonar DX Audio Device)
UI: Columns UI 0.3.8.8

Components:
Core (2011-12-02 15:07:36 UTC)
    foobar2000 core 1.1.10
foo_abx.dll (2009-04-25 14:44:30 UTC)
    ABX Comparator 1.3.4
foo_albumlist.dll (2011-12-02 15:06:12 UTC)
    Album List 4.5
foo_audioscrobbler.dll (2010-06-04 07:27:04 UTC)
    Audioscrobbler 1.4.7
foo_burninate.dll (2011-03-02 22:43:13 UTC)
    Audio CD Writer 3.0.3
foo_cdda.dll (2011-12-02 15:06:00 UTC)
    CD Audio Decoder 3.0
foo_converter.dll (2011-12-02 15:05:44 UTC)
    Converter 1.5
foo_deskband_controls.dll (2011-07-14 13:09:28 UTC)
    Deskband Controls 0.2.0.0
foo_discogs.dll (2011-08-13 14:04:32 UTC)
    Discogs Tagger 1.30
foo_dsp_crossfader.dll (2010-12-30 14:56:21 UTC)
    Gapless Crossfader 1.3.4.1
foo_dsp_std.dll (2011-12-02 15:06:12 UTC)
    Standard DSP Array 1.0
foo_dsp_xgeq.dll (2011-10-09 22:49:27 UTC)
    Graphic Equalizer 0.2.1
foo_fileops.dll (2011-12-02 15:05:08 UTC)
    File Operations 2.1.3
foo_freedb2.dll (2011-02-27 19:40:56 UTC)
    freedb Tagger 0.6.3
foo_input_std.dll (2011-12-02 15:05:54 UTC)
    Standard Input Array 1.0
foo_keep_queue.dll (2010-11-12 14:01:49 UTC)
    Keep Queue 0.3.5
foo_masstag.dll (2010-08-24 21:09:39 UTC)
    Masstagger 1.8.4
foo_rgscan.dll (2011-12-02 15:05:48 UTC)
    ReplayGain Scanner 2.1.2
foo_scheduler.dll (2011-12-08 13:23:31 UTC)
    Scheduler 4.09
foo_ui_columns.dll (2011-03-17 21:03:02 UTC)
    Columns UI 0.3.8.8
foo_ui_std.dll (2011-12-02 15:06:24 UTC)
    Default User Interface 0.9.5
foo_uie_albumlist.dll (2009-06-13 22:49:19 UTC)
    Album list panel 0.3.5
foo_uie_biography.dll (2010-12-16 22:31:03 UTC)
    Biography View 0.4.2.4
foo_uie_console.dll (2009-08-29 16:06:24 UTC)
    Console panel 0.4
foo_uie_graphical_browser.dll (2008-04-20 03:37:54 UTC)
    Graphical Browser rev015
foo_uie_panel_splitter.dll (2011-05-03 18:22:58 UTC)
    Panel Stack Splitter 0.3.8.3(alpha)
foo_uie_vis_peakmeter_spectrum.dll (2008-04-19 19:18:50 UTC)
    Peakmeter Spectrum Visualisation 0.2.0.0 beta
foo_uie_wsh_panel_mod.dll (2011-11-29 19:52:42 UTC)
    WSH Panel Mod 1.5.0
foo_wave_seekbar.dll (2011-12-15 21:30:38 UTC)
    Waveform seekbar 0.2.14.2

Recent events:
Autoplaylists initialized in: 0:00.265743
"AP: Added" : 0:00.213486
"AP: Cola" : 0:00.052238
Opening track for playback: "E:\Musica\Coleccion\Clams Casino\2011 - Instrumental Mixtape\06 - What You Doin'.mp3"
Startup time : 0:02.388927
Audioscrobbler: Handshake successful.
Opening track for playback: "E:\Musica\Coleccion\Shlohmo\2011 - Bad Vibes\05 - Parties.mp3"
Error: WSH Panel Mod (Simple Biography by marc2003): Error en tiempo de ejecución de Microsoft JScript:
No se puede obtener valor de la propiedad 'name': el objeto es nulo o está sin definir
File: <main>
Ln: 117, Col: 5
<source text only available at compile time>
WSH Panel Mod (Simple Biography by marc2003): Parsing file "E:\foobar2000\marc2003\common4.js"
Error: WSH Panel Mod (Simple Biography by marc2003): Error en tiempo de ejecución de Microsoft JScript:
No se puede obtener valor de la propiedad 'name': el objeto es nulo o está sin definir
File: <main>
Ln: 117, Col: 5
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2011-12-29 10:47:07
ah, i see the problem now. i couldn't reproduce the problem before because in the WSH panel mod editor, i only had jscript selected in the script engine dropdown box. if i select jscript9, then it really does cause foobar to crash. i think this is a bug in the component itself. it really should only generate script errors and not bomb out completely.
Title: WSH Panel Mod script discussion/help
Post by: bionx on 2012-01-04 23:57:13
how can i make this transparent?

Code: [Select]
    // background
    gr.FillSolidRect(0, 0, ww, wh, RGBA(0, 0, 0, 255));
    gr.DrawLine(0,0,ww,0,1.0,RGBA(20, 22, 25, 255));
    gr.FillGradRect(0, 2, ww, wh-3, 90, RGB(000, 000, 000), RGB(20, 20, 20));


i tried rgba but didnt work..
Title: WSH Panel Mod script discussion/help
Post by: audioclaudio on 2012-01-05 08:46:27
After reading this post:

@Bryter, here's the volume script from my foobar2000:

(Notes: Read the code comments)
(Settings: Script Engine: JScript | Edge Style: None | Grab Focus: checked)
Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }

// gdi.Font is changed, the last paramter is style flags
// FontStyleRegular = 0,
// FontStyleBold = 1,
// FontStyleItalic = 2,
// FontStyleBoldItalic = 3,
// FontStyleUnderline = 4,
// FontStyleStrikeout = 8
// Here is 0, means FontStyleRegular
var g_font = gdi.Font("Verdana", 10, 0);
var g_drag = 0;

function on_paint(gr){
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
   
// var pos = window.Width * ((100+volume)/100);  // <--------- Old linear calculation
        var pos = window.Width * Math.exp(0.04*volume);  // <--------- Logarithmic calculation (as used in default volume slider)
   
var txt = "volume    " + (Math.ceil(volume)) + " dB";
gr.FillGradRect(0, 0, pos, wh, 0, RGB(40,42,57), RGB(204,0,0));
gr.FillGradRect(pos, 0, ww-pos, wh, 10, RGB(102,102,102), RGB(40,42,57));
gr.DrawString(txt, g_font, RGB(128,192,255), 0, 0, ww, wh, 0x11005000);
gr.DrawRect(0,0,ww-0, wh-0, 0.0, RGB(46,48,63));
}

function on_mouse_lbtn_down(x,y){
g_drag = 1;
}

function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}

function on_mouse_move(x,y){
if(g_drag){
var v = x / window.Width;
v = (v<0) ? 0 : (v<1) ? v : 1;

        // v = -100 * (1-v);          // <--------- Old linear scaling
        v = 25 *Math.log(v+0.00001);  // <--------- Logarithmic scaling (as used in default volume slider)
       
if(fb.Volume != v)
fb.Volume = v;
}
}

function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}

function on_volume_change(val){
window.Repaint();
}
//EOF
... I decided to bounce together a volume control script which can be used to limit the fb2k volume control for safety protection against the risk of permanent hearing damage.

Because my new stereo system doesn't have any volume control whatsoever (except the one of fb2k) I needed some way to prevent big bad accidents. I could have bought a real preamp instead, but didn't. Preamps, and the interconnects they require, will be typically very expensive if you want them to be any good and besides, if all you do is play 24-bit files on a DAC unit which has 24-bit input then IMHO the volume control of fb2k is much better at keeping up the sound quality than an affordable analogue volume control would be, anyway.

The script I made is based on the script I quoted above. Thanks alot to derty2 and to the people who posted other examples, including the ones posted in the original thread:
http://www.hydrogenaudio.org/forums/index....showtopic=70363 (http://www.hydrogenaudio.org/forums/index.php?showtopic=70363)

Please note my modified version of the script is only considered "still a work in progress" and may slow down fb2k Visualization components (I think I have already pinned down the cause, however).
Please also note my volume control script changes the way the fb2k volume control should be handled by the user. The mouse scrollwheel should be used to adjust the safety limit of the volume control while hovering the mouse over the panel window. The safety limit is shown as a bar inside the volume bar and ranges from 5% up to 60% (these values can be edited manually in the script if needed, but anything below 5% will cause a bug). The safety limit is also shown as a percentage value, to the left. It's set to 25% by default at startup (again, this can be changed by manually editing it in the script if needed).

The fb2k volume itself can only be mousedragged and snaps to the mouse pointer only if the mouse pointer is positioned close enough to the edge of the volume bar while pressing left mouse button. The left panel border represents -100 dB (0%) and the right panel border represents the maximum allowed volume. The fb2k volume is set to -50 dB by default at startup (changeable by editing the script, but it has to be below the default safety limit to prevent a bug) and is also shown as a percentage value and a dB value, to the right.

Code: [Select]
var g_drag=0;
var sc1=173/170;
var sc2=7/384;
var p=25;
var pos=0;
var g_font=gdi.Font("Consolas",12,1);
var g_textrender=gdi.CreateStyleTextRender();

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 on_paint(gr){
var ww=window.Width;
var wh=window.Height;
var volume=fb.Volume;
pos=ww*sc1*Math.exp(0.04*volume)-sc2*ww;
pos=pos/(p/100);
gr.FillGradRect(0,0,pos,wh,0,RGB(40,42,57),RGB(p*2+55*g_drag,200-p*2+55*g_drag,Math.abs(100-p*2)+45*g_drag));
gr.FillGradRect(pos,0,ww-pos,wh,40,RGB(48,52,68),RGB(18,18,18));
gr.DrawLine(pos-1,0,pos-1,wh,2,RGB(55+p*2,200-p*2,Math.abs(50-p)));
gr.FillGradRect(0,wh/3,p/100*ww,wh/3,0,RGB(p*1.5,100-p/2,0),RGB(p+50,100-p,50-p/2));
gr.FillGradRect(p/100*ww,wh/3,(1-p/100)*ww+1,wh/3,350,RGB(68,74,82),RGB(48,48,48));
gr.DrawRect(-1,wh/3,ww+1,wh/3,1,RGB(55+p*2,200-p*2,Math.abs(50-p)));
gr.DrawLine(p/100*ww-2,wh/3+2,p/100*ww-2,wh*2/3-2,4,RGB(55+p*2,150-p*1.5,Math.abs(50-p)));
gr.SetTextRenderingHint(5);
gr.SetSmoothingMode(4);
gr.SetInterpolationMode(4);
g_textrender.GlowText(RGB(240,240,255),RGBA(55+p*2,200-p*2,Math.abs(50-p),30),12);
g_textrender.EnableShadow(true);
g_textrender.ResetShadow();
var p2=Math.round(pos/ww*p);
var str_p=(p2<10?"  ":p2<100?" ":"")+p2;
var v=fb.Volume;
var vol=-Math.ceil(-v)+1;
var voldec=""+Math.ceil(-Math.round((v-vol)*100)+100);
var str_vol=v==-100?"-100.00":" "+vol+"."+voldec.substr(1,2);
g_textrender.RenderStringRect(gr,str_p+" %  "+str_vol+" dB",g_font,ww/2-80,0,ww,wh,0x11005000);
g_textrender.RenderStringRect(gr,(p<10?"  ":p<100?" ":"")+p+" %",g_font,-ww/2+25,0,ww,wh,0x11005000);
}

function on_mouse_lbtn_down(x,y){
if (Math.abs(pos-x)<window.Width/75) g_drag=1;
window.Repaint();
}

function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag=0;
window.Repaint();
}

function on_mouse_move(x,y){
var ww=window.Width;
if(g_drag){
var xpos=x>ww?ww:x;
xpos=xpos*(p/100);
var v=(xpos+sc2*ww)/sc1/ww;
v=25*Math.log((v<0?0:v<1?v:1)+0.00001);
if (fb.Volume!=v)fb.Volume=v;
}
}

function on_mouse_wheel(delta){
if(!g_drag){
if(delta>0){
p=p+1;
p=(p>60)?60:p;
}else{
p=(pos<window.Width*4/5)?p-1:p;
p=(p<5)?5:p;
}
}
window.Repaint();
}

function on_volume_change(val){
window.Repaint();
}

window.MinHeight=32;
window.MinWidth=320;
fb.Volume=-50.001;

I know, especially the calculations need some serious tidying up but I'm lazy, just like Marc2003.
Your suggestions to help me improve the script will be greatly appreciated, thanks in advance for that.
Title: WSH Panel Mod script discussion/help
Post by: audioclaudio on 2012-01-07 20:11:35
New and improved version of the adjustable volume control:
Code: [Select]
var g_drag=0;
var sc1=173/170;
var sc2=7/384;
var p=25;
var pos=0;
var g_font=gdi.Font("Consolas",14,1);
var g_font2=gdi.Font("Consolas",20,1);
var g_textrender=gdi.CreateStyleTextRender();
var col1=RGB(205,205,205);
var col2=RGB(255,255,255);

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 on_paint(gr){
var ww=window.Width;
var wh=window.Height;
var v=fb.Volume;
pos=ww*sc1*Math.exp(0.04*v)-sc2*ww;
pos=pos/(p/100);
gr.FillGradRect(0,0,pos,wh,0,RGB(40,42,57),RGB(p*2+55*g_drag,200-p*2+55*g_drag,Math.abs(100-p*2)+45*g_drag));
gr.FillGradRect(pos,0,ww-pos,wh,40,RGB(88,82,98),RGB(18,18,18));
gr.DrawLine(pos-1,0,pos-1,wh,2,RGB(55+p*2,200-p*2,Math.abs(50-p)));
gr.FillGradRect(0,wh/3,p/100*ww,wh/3,0,RGB(p*1.5,100-p/2,0),RGB(p+50,100-p,50-p/2));
gr.FillGradRect(p/100*ww,wh/3,(1-p/100)*ww+1,wh/3,350,RGB(68,74,82),RGB(48,48,48));
gr.DrawRect(-1,wh/3,ww+1,wh/3,1,RGB(55+p*2,200-p*2,Math.abs(50-p)));
gr.DrawLine(p/100*ww-2,wh/3+2,p/100*ww-2,wh*2/3-2,4,RGB(55+p*2,150-p*1.5,Math.abs(50-p)));
gr.SetTextRenderingHint(5);
var p2=Math.round(pos/ww*p);
var str_p=(p2<10?"  ":p2<100?" ":"")+p2;
var vol=Math.ceil(Math.round(v*100)/100);
var voldec=""+Math.ceil(-Math.round((v+Math.ceil(-v)-1)*100)+100);
var str_vol=v==-100?"-100.00":" "+vol+"."+voldec.substr(1,2);
var xr=ww-144;
var xl=5;
gr.DrawString(str_p+" %  "+str_vol+" dB",g_font2,RGB(0,0,0),xr+2,2,62,wh,0x11005000);
gr.DrawString((p<10?"  ":p<100?" ":"")+p+" %",g_font2,RGB(0,0,0),xl-2,2,62,wh,0x11005000);
gr.DrawString(str_p+" %  "+str_vol+" dB",g_font2,g_drag?col2:col1,xr,0,62,wh,0x11005000);
gr.DrawString((p<10?"  ":p<100?" ":"")+p+" %",g_font2,g_drag?col2:col1,xl,0,62,wh,0x11005000);
}

function on_mouse_lbtn_down(x,y){
if (Math.abs(pos-x)<window.Width/75) g_drag=1;
window.Repaint();
}

function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag=0;
window.Repaint();
}

function on_mouse_move(x,y){
var ww=window.Width;
if(g_drag){
var xpos=x>ww?ww:x;
xpos=xpos*(p/100);
var v=(xpos+sc2*ww)/sc1/ww;
v=25*Math.log((v<0?0:v<1?v:1)+0.00001);
if (fb.Volume!=v)fb.Volume=v;
}
}

function on_mouse_wheel(delta){
if(!g_drag){
if(delta>0){
p=p+1;
p=(p>60)?60:p;
}else{
p=(pos<window.Width*4/5)?p-1:p;
p=(p<5)?5:p;
}
}
window.Repaint();
}

function on_volume_change(val){
window.Repaint();
}

window.MinHeight=32;
window.MinWidth=320;
fb.Volume=-50;

Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-01-11 14:37:15
anybody can explain me how get playlist item info, using new interface plman? for example, i need title. i knew about fb.titleformat, i need it for playlist. i just cant understand code of Br3tt
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2012-01-11 15:20:33
function on_paint(gr) {

var playlist = plman.GetPlaylistItems(plman.ActivePlaylist);
var playlist_item_count = plman.PlaylistItemCount(plman.ActivePlaylist);

for (var i = 0; i < playlist_item_count; ++i) {
   
var item = playlist.Item(i);

gr.GdiDrawText(fb.TitleFormat("%title%").EvalWithMetadb(item), gdi.font("Segoe Ui", 14, 0), RGBA(100, 100, 100), 0, 20*i, 500, 20, DT_CALCRECT | DT_VCENTER)

}

}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-01-11 15:24:02
Code: [Select]
var handles = plman.GetPlaylistItems(plman.ActivePlaylist); //puts all playlist items into an array called handles.
fb.trace(handles.count); //output how many items in playlist
fb.trace(fb.TitleFormat("%title%").EvalWithMetadb(handles.item(0))); //output title of first item in playlist
fb.trace(fb.TitleFormat("%title%").EvalWithMetadb(handles.item(2))); //output title of third item in playlist


edit: bah, too slow.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-01-11 17:18:55
anybody can explain me how get playlist item info, using new interface plman? for example, i need title. i knew about fb.titleformat, i need it for playlist. i just cant understand code of Br3tt


i'm sad ...
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-01-11 17:43:21
thanks to everyone! heh, resuming my work
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-01-11 18:40:51
another one newbie question: i need for a groups? for example by artists. so i need to create a %artist% called massive. can anybody give me an example of thing like that?

edit: i jast want create a grouping like artist\album\track, i cant imaginehow create massive "artist" with undermassive "albums" with undermassive songs
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-01-17 07:45:20
is there any way to create a playlist from a folder or known path? folder isnt in library
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-01-18 19:06:24
I modified this modified version of Marc2003:s similar artists code a bit, but don't really understand the code. It works perfectly, but crashes when I select a track with multiple artists (seperated by ";"). Thought someone here might see what the problem is directly?

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

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);
var lfm_img = gdi.Image(images_path + "lastfm_red_small.gif");
var spotify_img = gdi.Image(images_path + "spotify.png");
var lastfm_play_img = gdi.Image(images_path + "what.ico");
var lastfm_small_img = gdi.Image(images_path + "lastfm small.png");
var up_img = gdi.Image(images_path + "up.png");
var down_img = gdi.Image(images_path + "down.png");
var but_x = 0;
var offset = 0;
var rows = 0;
var title_font = gdi.Font(font, 12, 1);
var normal_font = gdi.Font(font, 11);
var artist = '';
var genre = '';
var g_text = '';
var toptags = new Array();
var g_tooltip = window.CreateTooltip();

var spotify = window.GetProperty("spotify", true);
window.GetProperty("show_artist", true);
window.GetProperty("pause", true);

on_item_focus_change();

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

function get() {
    if(username.length == 0 || api_key.length != 32) return(fb.trace("Top tags: Can't contact Last.fm. Check your username / API KEY settings."));
    lastfm("&method=artist.getTopTags&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_similar", function() {save(xmlhttp.responsetext, filename); load(); });
}

function on_size() {
    ww = window.Width;
    wh = window.Height;
    but_x = Math.round((ww - 15) / 2);
    offset = 0;
    rows = Math.floor((wh - 56) / 20);
}

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    gr.GdiDrawText("Tags" + (window.GetProperty("show_artist") ? " for " + artist : ''), title_font, g_textcolor_hl, 6, 6, ww-77, 24, DT_VCENTER  | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
    gr.DrawImage(lfm_img, ww-60, 8, 50, 18, 0, 0, 50, 18);
    gr.DrawLine(5, 29, ww-10, 29, 1, g_textcolor_hl);
    switch(true) {
        case (username.length == 0):
        case (api_key.length != 32):
            gr.GdiDrawText("Please use the context menu to set your Last.fm username and API KEY.", g_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
            break;
        case (!g_metadb):
            gr.GdiDrawText("[no selection]", g_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
            break;
        case (toptags.length == 0):
            gr.GdiDrawText("[no data]", g_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
            break;
        default:
            for(l = 0; l < Math.min(rows, toptags.length); l++) {
                gr.DrawImage(lastfm_small_img, 26, 45 + (l * 20), 20, 20, 0, 0, 20, 20);
                gr.GdiDrawText(toptags[l + offset].name + " (" + toptags[l + offset].count + ")", normal_font, g_textcolor, 50, 46 + (l * 20), ww-66, 18, DT_VCENTER  | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
            }
            if(offset > 0) gr.DrawImage(up_img, but_x, 32, 15, 15, 0, 0, 20, 20);
            if(toptags.length > rows && offset < toptags.length - rows) gr.DrawImage(down_img, but_x, wh - 15, 15, 15, 0, 0, 20, 20);
    }
}

function on_mouse_wheel(delta) {
    if(toptags.length < rows) return;
    offset -= delta * 3;
    if(offset < 0) offset = 0;
    if(rows + offset > toptags.length) offset = toptags.length - rows;
    window.Repaint();
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_metadb_changed() {
    if(artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
    load();
}

function load(gr) {
    toptags = new Array();
    if(!g_metadb) return(window.Repaint());
    artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
    artist_folder = data_folder + fb.TitleFormat("$crc32(%artist%)").EvalWithMetadb(g_metadb);
    if(!fso.FolderExists(artist_folder)) fso.CreateFolder(artist_folder);
    filename = artist_folder + "\\toptags.json";
    limit = 0;
    offset = 0;
    if(fso.fileExists(filename)) {
        file = fso.Getfile(filename);
        ts = fso.OpenTextFile(filename,1, false, -1);
        g_text = ts.ReadAll();
        ts.close();
        parsed_data = JSON.parse(g_text);
        if(parsed_data.error != 6) toptags = parsed_data.toptags.tag;
        if(Date.parse(Date()) - Date.parse(file.DateLastModified) > 86400000) get();
    } else {
        get();
    }
    window.Repaint();
}

function on_mouse_move(x,y) {
    index = Math.floor((y - 45 ) / 20) + offset;
    switch(true) {
 
        case (toptags.length > 0 && x > 26 && x < 46 && index >= offset && index < offset + Math.min(rows,toptags.length)):
            tt(toptags[index].url);
            window.SetCursor(IDC_HAND);
            break;
        case (offset > 0 && x > but_x && x < but_x + 15 && y > 32 && y < 47):
        case (toptags.length > rows && offset < toptags.length - rows && x > but_x && x < but_x + 15 && y > wh -15):
            window.SetCursor(IDC_HAND);
            break;
        default:
            window.SetCursor(IDC_ARROW);
            g_tooltip.Text = '';
            g_tooltip.Deactivate();
            break;
    }
}

function on_mouse_lbtn_up(x, y) {
    index = Math.floor((y - 45) / 20) + offset;
    switch(true) {

        case (toptags.length > 0 && x > 26 && x < 46 && index >= offset && index < offset + Math.min(rows,toptags.length)):
            try { WshShell.run(toptags[index].url); } catch(e) {}
            break;
        case (offset > 0 && x > but_x && x < but_x + 15 && y > 32 && y < 47):
            on_mouse_wheel(1);
            break;
        case (toptags.length > rows && offset < toptags.length - rows && x > but_x && x < but_x + 15 && y > wh -15):
            on_mouse_wheel(-1);
            break;
    }
}

function on_mouse_rbtn_up(x, y) {
    var _menu = window.CreatePopupMenu();
    var _links = window.CreatePopupMenu();
    var _selection = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(username.length > 0 && api_key.length == 32 && g_metadb ? MF_STRING : MF_GRAYED, 1, "Update");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 6, "Show artist name");
    _menu.CheckMenuItem(6, window.GetProperty("show_artist"));
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(spotify ? MF_STRING : MF_GRAYED, 7, "Pause playback when launching Spotify");
    _menu.CheckMenuItem(7, window.GetProperty("pause"));
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _links.AppendMenuItem(MF_STRING, 4, "Spotify");
    _links.AppendMenuItem(MF_STRING, 5, "Last.fm radio");
    _links.CheckMenuRadioItem(4, 5, window.GetProperty("spotify") ? 4 : 5);
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _links.ID, "Links");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _selection.ID, "Selection mode");
    _selection.AppendMenuItem(MF_STRING, 900, "Use display preferences");
    _selection.AppendMenuItem(MF_STRING, 901, "Prefer now playing");
    _selection.AppendMenuItem(MF_STRING, 902, "Follow selected track");
    _selection.CheckMenuRadioItem(900, 903, selection_mode + 900);
    _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");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    if(utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 9, "Properties");
    _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    switch(idx) {
        case 1:
            get();
            break;
        case 2:
            username = text_input_box("Similar Artists", "Please enter your Last.fm username", username_file);
            window.NotifyOthers("lastfm_update", 1);
            load();
            break;
        case 3:
            api_key = text_input_box("Similar Artists", "Please enter your Last.fm API KEY\n\nhttp://www.last.fm/api/account", api_key_file);
            window.NotifyOthers("lastfm_update", 1);
            load();
            break;
        case 4:
        case 5:
            window.SetProperty("spotify", idx ==  4 ? true : false);
            spotify = window.GetProperty("spotify");
            window.Repaint();
            break;
        case 6:
            window.SetProperty("show_artist", !window.GetProperty("show_artist"));
            window.Repaint();
            break;
        case 7:
            window.SetProperty("pause", !window.GetProperty("pause"));
            break;
        case 9:
            window.ShowProperties();
            break;
        case 10:
            window.ShowConfigure();
            break;
        case 900:
        case 901:
        case 902:
            window.SetProperty("selection_mode", idx - 900);
            selection_mode = window.GetProperty("selection_mode");
            on_item_focus_change();
            break;
}
    _selection.Dispose();
    _menu.Dispose();
    _links.Dispose();
    return true;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-01-19 02:30:59
it doesn't crash for me.

also, it might help if you posted what the console says.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-01-19 11:16:10
it doesn't crash for me.

also, it might help if you posted what the console says.


Seems like it happens for any artist not on Last.fm. I've got a panel with the original version of your script too, and that one works just fine.
Code: [Select]
Error: WSH Panel Mod (Similar Artists by marc2003): Körningsfel i Microsoft JScript: (error in Microsoft JScript)
'toptags.length' är null eller inte ett objekt (is null or not an object)
Ln: 68, Col: 9

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-01-19 11:50:25
replace line 113:

Code: [Select]
if(parsed_data.error != 6) toptags = parsed_data.toptags.tag;

with

Code: [Select]
if (parsed_data.error > 0) fb.trace("Top tags: " + g_text);
else if (typeof parsed_data.toptags.tag == "object") toptags = parsed_data.toptags.tag;
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-01-19 12:50:49
i got some strange thing in wsh. i have the code:

Code: [Select]
function drawpl() {
this.traceplaylist = function (x,y) {
if (x>this.x && y>this.y && x<this.x+this.w && y<this.y+(this.h+5)*plcount) {
  hh= Math.floor((y-this.y)/(this.h+5));
}
else hh= null;
return hh;
}
}

var prevplh=null;

function on_mouse_move(x,y) {
if (x<=window.width && y<=window.height) {
hplaylist=traceplaylist(x,y);
//fb.trace("traceplaylist"+traceplaylist(x,y));
if (prevplh != hplaylist) {
window.Repaint();
fb.trace("repaint by changing highlighted playlist!"+Math.random());
prevplh=hplaylist;
}
}
}

function on_paint(gr) {
drawpl();
}
some time ago this code works fine, but i tried to change assemblies location (for ui hacks). after that this code crashes on foobars start. before this crashes he redraws the panel without a window.repaint command (there was no messege in console ' repaint by ..."). now on start he crashes on line "hplaylist=traceplaylist(x,y);" in on_mouse_move - says <source text only available at compile time> and "suppose have an object" (i dont know how this string looks like in english, sorry if this not right). but after configure/apply this code works fine, just after replacements begin to work like he must - window redraws by repaint command.

this is not a whole code, just part which causes this crash

i would be very glad if somebody helps me - i really dont know why it crashes
Title: WSH Panel Mod script discussion/help
Post by: Lapis Lazuli on 2012-01-19 16:42:03
jscript doesn't support static method.
javascript is much more similar to C++ instead of java.

you should instantiate a drawpl object, then use

hplaylist=obj.traceplaylist(x,y);

because traceplaylist is a member of class drawpl.

however you didn't post any more valuable information, it's a bit hard to determine what really happened.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-01-19 16:45:57
i just noticed a typo in my previous reply. it should be

Code: [Select]
if (parsed_data.error > 0) fb.trace("Top tags: " + g_text);
else if (typeof parsed_data.toptags.tag == "object") toptags = parsed_data.toptags.tag;

Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-01-19 22:57:32
Thanks marc, it works perfectly now. I wouldn't be able to fix it myself, and it was extra kind of you to help since the code was altered.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-01-21 15:22:43
to Lapis Lazuli
thanks, but how to do this? im newbie in coding, and learn jscript by codes for wsh.
can you explain why object better than function and where better use function or object.

about information - thats all i got about this error. this code works fine utill i change location of assamblies and change path to it in ui hacks. i dont understand how it relate with my problem
Title: WSH Panel Mod script discussion/help
Post by: prateek88 on 2012-01-21 20:30:23
hi there....i m a newbie and want to learn to code wsh panel using jscript...but dont know how to start actually i read a lot of references about jscript but dont got any references like onpaint() function and the gr parameter inside it....  . So, is there any good writter reference for these type of scripts. U guyz there really rock, kindly give me the appropriate direction...



onpaint() function is just an example i gave, theres lot more i dont know....
Title: WSH Panel Mod script discussion/help
Post by: prateek88 on 2012-01-22 04:19:47
eagerly w8ing for a reponse........
Title: WSH Panel Mod script discussion/help
Post by: vapkse on 2012-01-27 00:06:16
Hello.

First thanks for this panel and the great job.

Someone can explain me how to debug with the version 1.5.1, because after the 1.4.4 the debug check box disapear.

Thanks for answer
Serge
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2012-01-27 00:11:38
here's another script. this is for DUI only. it allows you to create your own buttons of any size, using any images you like. by default it uses the DUI background colour (it changes colour as you change theme).

(http://k5sbdw.blu.livefilestore.com/y1pnSC1mxAv6zhmAM9tfE2dwzsyFDhkqYGiuFMesBndW9eoZHe5qxCOF5yc8mNhFPclrKdUihbbhFwnKRIm9kqrQBlCbLdfhstS/buttons1.png)

but it also has an option to set the background to the same colour as the splitter or your own custom colour which you can specify in the script.

(http://k5sbdw.blu.livefilestore.com/y1pJxLDqo4xDIfZw7SeL2pG3laazoPtzxyubTBVq5ROMGuWuTLukt86QIh4o4ZTRdRJUv27cmgxN9J9C89OPv2tKvIiOMrNkWU-/buttons2.png)

it does require a little tinkering to get going so here's a guide. […]

Hey marc2003, any chance you have a similar script for CUI?

Also, how hard would it be to replace the play button with pause while tracks are playing?

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-01-27 07:38:10
that post is very out of date now. the current version is included in my pack of sample scripts here.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

it's imaginatively named playback buttons.
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2012-01-28 00:04:34
Thanks!!

Can you tell me what this script (Playback Buttons) uses from your external JS files (common4.js and tooltip_buttons.js) other then the location of the images?

Would it be possible to make it so it doesn't require the two external files?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-01-28 01:20:15
if the presence of 2 files that take up 17kb of space bothers you, i suggest you turn off your computer and don't bother using it again. :/
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2012-01-28 02:14:28
Funny, but I have no issue with the presence of the files. I'm teaching myself how to code by understanding your scripts. I can follow your WSH script and make sense of it but when I start trying to connect the dots to the other two JS files, I get lost.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-01-28 02:30:34
just copy the contents of both the files into the panel and remove the the preprocessor bit at the start that references them. the whole of tooltips.js is needed but admittedly a lot of functions in common4.js aren't used in playback buttons. try removing them one by one, clicking the apply button in the editor to see if the panel crashes or not. if it does, then undo the deletion you've just made.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-01-31 09:07:07
i have a string. i need to know, on which language it written. it is possible to do that? for example, by chars or something like that.

to marc2003
your examples are great, but i think there a lack of examples about javascript, not wsh functions. could you make some? i think it will be very helpfull for newbies and begginers. examples which you could see in foobars wsh panel, just for easy understanding. if you, or someone make it, it will very great

p.s. i asked previously, is it possible to add to playlist folder by path string? anybody know? is there some simple method or i need script which searches files in deep of folder tree?
Title: WSH Panel Mod script discussion/help
Post by: nixda on 2012-02-04 12:26:39
Hello,

I'm playing with the CD Jewel Case Code and have modified it to some extent. It works more or less now, but my knowledge in coding is limited, and I have to ask some things about the following section:

Code: [Select]
function update_image() {
    if (!g_metadb) return;
    is_embedded = null;
    g_img && g_img.Dispose();
    g_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
    if (g_img) {
        is_embedded = true;
        window.Repaint();
    } else {
        utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
    }
}


-Does this code prefer embedded artwork to image-files in the folder?
-What does 'g_img && g_img.Dispose();' do? My panel crashes, the console gives an error in this line. If i deactivate it the crash does not happen and the code seems to work fine without it, so what is it for?
-why is 'utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);' assigned to g_img, but 'utils.GetAlbumArtAsync(window.ID, g_metadb, 0);' is not?


sorry to ask this, but I just cannot work it out...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-02-04 12:53:00
-yes it does prefer embedded artwork. it falls back on whatever patterns you have set in the display preferences if none is found. i find this better than the random nature of letting the foobar core decide for itself. it's supposed to work on quality but it doesn't always appear to do that. also, if your files have artwork embedded in them, why wouldn't you want it to show? if the better artwork is to be found in the folder, then strip the images from your files and free up some space.

-i'm not sure g_img.Dispose() is necessary but it only runs if g_img is set so it shouldn't ever crash. mine never has. it frees up memory i think. i copied it from one of T.P Wang's samples.

-that last function invokes this callback and that is where the image gets assigned to g_img.

Code: [Select]
function on_get_album_art_done(metadb, art_id, im, ip) {
    g_img_path = ip;
    g_img = im;
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: nixda on 2012-02-04 15:05:34
thanks for your post, I could work out some of my issues.

I don't know why but I always preferred artwork files in the folder. Right now my mobile phone uses only embedded art, so i have scaled down images embedded in the files and full scale images in the folder.

I see I cannot attach files here? I wanted to share my modified code here, but a png file will be needed, so is there any way to attach a file to a post here?

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-02-04 15:14:15
you just replace the function with this then....

Code: [Select]
function update_image() {
    if (!g_metadb) return;
    utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
}
Title: WSH Panel Mod script discussion/help
Post by: nixda on 2012-02-04 15:19:54
thanks!

but could it be made optional, just like the original code, just with changed priorities? So it will fall back to embedded art if possible, in case that no image file is present?

that's what I did to your original code:

Code: [Select]
function update_image() {
    if (!g_metadb) return;
    is_embedded = null;
    g_img && g_img.Dispose();
    utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
    if (g_img) {
        } else {
        g_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
        if (g_img) {
            is_embedded = true;
        }
    }
}


Is this OK or do you see a problem?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-02-04 15:29:37
that's not needed. my snippet above it all you need. utils.GetAlbumArtAsync will still read embedded album art if the foobar core decides that is best quality (or no other art exists).

edit: i just realised that will break my double click code for finding the source file in explorer. replace the on_mouse_lbtn_dblclk()  function with this.

Code: [Select]
function on_mouse_lbtn_dblclk() {
    if (!g_metadb || !g_img) return;
    WshShell.Run("explorer /select," + g_img_path);
}
Title: WSH Panel Mod script discussion/help
Post by: nixda on 2012-02-04 15:56:23
great! thanks!!!
Title: WSH Panel Mod script discussion/help
Post by: nixda on 2012-02-05 00:43:31

In case someone might be interested i have uploaded my modified version of the CD-Jewel-Case Panel.

http://www.file-upload.net/download-408795...ified-.zip.html (http://www.file-upload.net/download-4087959/cd-jewel-case--modified-.zip.html)


It seems to work, but I don't really know how to code so it is not elegant and probably not error-free.

It is auto-resizing and it provides a 'DigiPak'-feature:
'DigiPak' On: a cover art image that is non square (the threshold can be adjusted in the code) will be shown WITHOUT the CD-Case. A subtle 'gloss'-effect (highlight and shadow) will be added to the edges to support the impression of a DigiPak box.
'DigiPak' Off: the cover art image will always be shown in the CD-Case. Images below a certain threshold (the threshold can be adjusted in the code) will be stretched, images beyond that threshold will be shown in their original aspect ratio (which will leave part of the CD-Case image uncovered.)

in the attached zip is the code example and the 'digipak_gloss.png'-file which will be needed. place the 'digipak_gloss.png'-file into the marc2003/images folder.

Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-02-05 15:02:14
I have been using this themed progress bar code for a while, I got it here someplace. Can someone please tell me how to change the background color - or to just force it to use my theme's background color?

Thanks!

Code: [Select]
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// This is just a demo so is buggy.
var g_theme = window.CreateThemeManager("PROGRESS");
var g_bar_height = 15;
var g_cycles = 0;
var ww = 0,
wh = 0;
var top = 0;
var g_pos = 0;
var g_drag = false;
var g_length = 1;

function clamp(x, l, h) {
return (x < l) ? l : ((x > h) ? h : x);
}


function on_size() {
ww = window.Width;
wh = window.Height;
top = (wh - g_bar_height) >> 1;
}

function on_paint(gr) {
g_theme.SetPartAndStateID(1, 0);
g_theme.DrawThemeBackground(gr, 0, top, ww, g_bar_height);

if (fb.IsPlaying && g_length > 0) {
g_theme.SetPartAndStateID(5, fb.IsPaused ? 3 : 1);
g_theme.DrawThemeBackground(gr, 0, top, g_pos, g_bar_height);
}
}

function on_mouse_lbtn_down(x, y) {
if (g_length > 0) {
g_drag = true;
on_mouse_move(x, y);
}
}

function on_mouse_lbtn_up(x, y) {
if (g_length > 0 && g_drag) {
g_drag = false;
fb.PlaybackTime = g_length * g_pos / ww;
on_mouse_move(x, y);
}
}

function on_mouse_move(x, y) {
if (g_drag) {
g_pos = clamp(x, 0, ww);
window.Repaint();
}
}

function on_mouse_wheel(delta) {
fb.PlaybackTime = fb.PlaybackTime + delta * 2;
}

function on_playback_time(time) {
if (!g_drag) {
if (g_length > 0) g_pos = ww * time / g_length;
window.Repaint();
}
}

function on_playback_seek() {
if (!g_drag && g_length > 0) window.Repaint();
}

function on_playback_pause() {
window.Repaint();
}

function on_playback_stop() {
g_length = 0;
g_pos = 0;
g_drag = false;
window.Repaint();
}

function on_playback_new_track() {
g_length = fb.PlaybackLength;
g_pos = 0;
g_drag = false;
window.Repaint();
}

if (fb.IsPlaying) on_playback_new_track();
Title: WSH Panel Mod script discussion/help
Post by: audioclaudio on 2012-02-07 22:14:52
Found another bug in my adjustable volume control script, which occurred on right-click while left mouse button was being held down. The following code should be added to my script:
Code: [Select]
function on_mouse_rbtn_down(x,y){
g_drag=0;
window.Repaint();
}

function on_mouse_rbtn_up(x,y){
g_drag=0;
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: audioclaudio on 2012-02-11 15:22:16
At last, I have eliminated (most of) the problems in my adjustable volume control script.
I hope this helps anyone who might be looking to avoid the thermal noise typically caused by analogue volume control and / or the cost of adding a decent preamp.
Any suggestions to further improve my script are still always welcome. 

Code: [Select]
var g_drag=0;
var sc1=1.01865;
var sc2=0.01865;
var p=25;
var pos=0;
var g_font=gdi.Font("Consolas",16,1);
var g_font2=gdi.Font("Consolas",18,1);
var g_textrender=gdi.CreateStyleTextRender();
var col1=RGB(205,205,205);
var col2=RGB(255,255,255);

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 on_paint(gr){
var ww=window.Width-1;
var wh=window.Height;
var v=fb.Volume;
pos=ww*sc1*Math.exp(0.04*v)-sc2*ww;
var pos2=pos/(p/100);
if(!g_drag) p=pos2>ww+1?Math.ceil(pos*100/ww): p;
pos=pos/(p/100);
gr.FillGradRect(0,0,pos,wh,0,RGB(40,42,57),RGB(p*2+55*g_drag,200-p*2+55*g_drag,Math.abs(100-p*2)+45*g_drag));
gr.FillGradRect(pos,0,ww-pos+1,wh,40,RGB(88,82,98),RGB(18,18,18));
gr.DrawLine(pos-1,0,pos-1,wh,2,RGB(55+p*2,200-p*2,Math.abs(50-p)));
gr.FillGradRect(0,wh/3,p/100*ww,wh/3,0,RGB(p*1.5,100-p/2,0),RGB(p+50,100-p,50-p/2));
gr.FillGradRect(p/100*ww,wh/3,(1-p/100)*ww+2,wh/3,350,RGB(68,74,82),RGB(48,48,48));
gr.DrawRect(-1,wh/3,ww+2,wh/3,1,RGB(55+p*2,200-p*2,Math.abs(50-p)));
gr.DrawLine(p/100*ww-2,wh/3+2,p/100*ww-2,wh*2/3-2,4,RGB(55+p*2,150-p*1.5,Math.abs(50-p)));
gr.SetTextRenderingHint(5);
var p2=-Math.ceil(-p*pos/ww);
var str_p=(p2<10?"  ":p2<100?" ":"")+p2;
var vol=Math.ceil(Math.round(v*100)/100);
var voldec=""+Math.ceil(-Math.round((v+Math.ceil(-v)-1)*100)+100);
var str_vol=vol+"."+voldec.substr(1,2);
str_vol=v<-99.99?"-100.00":v>-0.01?"  0.00":" "+(vol>-10?" ":"")+(vol==0?"-":"")+str_vol;
var xr=ww-126;
var xl=-1;
gr.DrawString(str_p+" % "+str_vol+" dB",g_font2,RGB(0,0,0),xr+2,2,62,wh,0x11005000);
gr.DrawString((p<10?"  ":p<100?" ":"")+p+" %",g_font,RGB(0,0,0),xl-2,2,62,wh,0x11005000);
gr.DrawString(str_p+" % "+str_vol+" dB",g_font2,g_drag?col2:col1,xr,0,62,wh,0x11005000);
gr.DrawString((p<10?"  ":p<100?" ":"")+p+" %",g_font,g_drag?col2:col1,xl,0,62,wh,0x11005000);
}

function on_mouse_lbtn_down(x,y){
if (Math.abs(pos-x)<window.Width/75) g_drag=1;
window.Repaint();
}

function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag=0;
window.Repaint();
}

function on_mouse_rbtn_down(x,y){
g_drag=0;
window.Repaint();
}

function on_mouse_rbtn_up(x,y){
g_drag=0;
window.Repaint();
}

function on_mouse_move(x,y){
var ww=window.Width-1;
if(g_drag){
//var xpos=x>ww?ww:x;
var xpos=x>ww?ww:x;
xpos=xpos*(p/100);
var v=(xpos+sc2*ww)/sc1/ww;
v=25*Math.log((v<0?0:v<1?v:1)+0.00001);
v=v>-0.01?0:v<-99.99?-100:v;
if (fb.Volume!=v)fb.Volume=v;
}
}

function on_mouse_wheel(delta){
if(!g_drag){
if(delta>0){
p=p+1;
p=(p>100)?100:p;
}else{
p=(pos<window.Width-1)?p-1:p;
p=(p<1)?1:p;
}
}
window.Repaint();
}

function on_volume_change(val){
window.Repaint();
}

window.MinHeight=32;
window.MinWidth=320;
fb.Volume=-50;
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-02-20 19:18:11
I am trying to add another item ("Open containing folder") to the right-click context menu of my "WSH TextFile Viewer" panel ...but I can't do it :-(

I tried editing my script by adding a few lines to this function group: (my additions are in red)
Code: [Select]
function on_mouse_rbtn_up(x, y){
    var _backgroundcolor = window.CreatePopupMenu();
    var _textcolor = window.CreatePopupMenu();
    var _menu = window.CreatePopupMenu();
    var idx;
   
    _menu.AppendMenuItem(MF_STRING, 1, "Update");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
   
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _textcolor.ID, "Text Color");
    _textcolor.AppendMenuItem(MF_STRING, 98, "Foobar Text");
    _textcolor.AppendMenuItem(MF_STRING, 99, "Foobar Highlight");
    _textcolor.AppendMenuItem(MF_STRING, 101, "White");
    _textcolor.AppendMenuItem(MF_STRING, 102, "Off-White");
    _textcolor.AppendMenuItem(MF_STRING, 103, "Green");
    _textcolor.AppendMenuItem(MF_STRING, 104, "Blue");
    _textcolor.AppendMenuItem(MF_STRING, 105, "Yellow");
    _textcolor.AppendMenuItem(MF_STRING, 106, "Black");
   
    _menu.AppendMenuItem(MF_STRING | MF_POPUP, _backgroundcolor.ID, "Background Color");
    _backgroundcolor.AppendMenuItem(MF_STRING, 210, "Foobar Background");
    _backgroundcolor.AppendMenuItem(MF_STRING, 211, "White");
    _backgroundcolor.AppendMenuItem(MF_STRING, 212, "Red");
    _backgroundcolor.AppendMenuItem(MF_STRING, 213, "Green");
    _backgroundcolor.AppendMenuItem(MF_STRING, 214, "Blue");
    _backgroundcolor.AppendMenuItem(MF_STRING, 215, "Brown-Black");
    _backgroundcolor.AppendMenuItem(MF_STRING, 216, "Black");

   
    if(window.GetProperty("textcolor")==101){
        _textcolor.CheckMenuItem(101, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==102)
        {_textcolor.CheckMenuItem(102, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==103)
        {_textcolor.CheckMenuItem(103, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==104)
        {_textcolor.CheckMenuItem(104, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==105)
        {_textcolor.CheckMenuItem(105, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==106)
        {_textcolor.CheckMenuItem(106, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==98)
        {_textcolor.CheckMenuItem(98, window.GetProperty("textcolor"));}
    else if (window.GetProperty("textcolor")==99)
        {_textcolor.CheckMenuItem(99, window.GetProperty("textcolor"));}
       
    if(window.GetProperty("backgroundcolor")==211){
        _backgroundcolor.CheckMenuItem(211, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==212)
        {_backgroundcolor.CheckMenuItem(212, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==213)
        {_backgroundcolor.CheckMenuItem(213, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==214)
        {_backgroundcolor.CheckMenuItem(214, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==215)
        {_backgroundcolor.CheckMenuItem(215, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==216)
        {_backgroundcolor.CheckMenuItem(216, window.GetProperty("backgroundcolor"));}
    else if (window.GetProperty("backgroundcolor")==210)       
        {_backgroundcolor.CheckMenuItem(210, window.GetProperty("backgroundcolor"));}

    _menu.AppendMenuItem(MF_STRING, 8, "Configure");
   
  [color=#FF0000] _menu.AppendMenuItem(MF_STRING, 9, "Open containing folder");[/color]
       
    idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
            case 1:readTXT();calc();window.Repaint();break;
            case 8:window.ShowConfigure();break;
            [color=#FF0000]case 9:
            if (! fb.IsPlaying) return;
                    var xpath = fb.TitleFormat("%path%").EvalWithMetadb(fb.GetNowPlaying());
                    var path = xpath.substring(0, xpath.lastIndexOf("\\")) + "\\";
                    var Folder = fso.GetFolder(path);
                    try { WshShell.Run("explorer \"" + Folder + "\""); }
                    catch(e) {}[/color]       
            case 98:window.SetProperty("textcolor", 98);txtcolor  = g_textcolor;window.Repaint();break;
            case 99:window.SetProperty("textcolor", 99);txtcolor  = g_textcolor_hl;window.Repaint();break;
            case 101:window.SetProperty("textcolor", 101);txtcolor  = RGB(255,255,255);window.Repaint();break;
            case 102:window.SetProperty("textcolor", 102);txtcolor = RGB(255,255,227);window.Repaint();break;
            case 103:window.SetProperty("textcolor", 103);txtcolor = RGB(50,255,50);window.Repaint();break;
            case 104:window.SetProperty("textcolor", 104);txtcolor = RGB(150,150,250);window.Repaint();break;
            case 105:window.SetProperty("textcolor", 105);txtcolor = RGB(255,255,50);window.Repaint();break;
            case 106:window.SetProperty("textcolor", 105);txtcolor = RGB(10,10,10);window.Repaint();break;
            case 210:window.SetProperty("backgroundcolor", 210);backcolor= g_backcolor;window.Repaint();break;
            case 211:window.SetProperty("backgroundcolor", 211);backcolor= RGB(255,255,255);window.Repaint();break;
            case 212:window.SetProperty("backgroundcolor", 212);backcolor= RGB(255,50,50);window.Repaint();break;
            case 213:window.SetProperty("backgroundcolor", 213);backcolor= RGB(50,255,50);window.Repaint();break;
            case 214:window.SetProperty("backgroundcolor", 214);backcolor= RGB(10,36,106);window.Repaint();break;
            case 215:window.SetProperty("backgroundcolor", 215);backcolor= RGB(34,28,28);window.Repaint();break;
            case 216:window.SetProperty("backgroundcolor", 216);backcolor= RGB(0,0,0);window.Repaint();break;}
 
                 
    _menu.Dispose();_textcolor.Dispose();_backgroundcolor.Dispose();return true;
}

The context menu item ("Open containing folder") is showing but nothing happens when I choose it.
I'm sure the answer is a simple one, unfortunately I am not knowledgeable enough in JS syntax to analyse this for myself.
Thanks for any help +++

(by the way, that code I added is copy/paste from other example scripts; I have no idea basically speaking)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-02-20 19:31:43
Code: [Select]
fb.RunContextCommandWithMetadb("Open Containing Folder", fb.GetNowPlaying());
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-02-20 19:37:34
Thanks, I'll try that marc +++

should I replace all lines at case 9: with  your line, or just one of the lines?
does anything there look redundant to you?

--- EDIT (1) ---

Thanks marc, it works +++
Code: [Select]
             case 9:
             if (! fb.IsPlaying) return;
                    var xpath = fb.TitleFormat("%path%").EvalWithMetadb(fb.GetNowPlaying());
                    var path = xpath.substring(0, xpath.lastIndexOf("\\")) + "\\";
                    var Folder = fso.GetFolder(path);
                    try { fb.RunContextCommandWithMetadb("Open Containing Folder", fb.GetNowPlaying()); }
                    catch(e) {}
                    break;


--- EDIT (2) ---

OK, you don't need to answer my first question, I got the answer...

The code was redundant; this works too:
Code: [Select]
            case 9:
                try { fb.RunContextCommandWithMetadb("Open Containing Folder", fb.GetNowPlaying()); }
                catch(e) {}
                break;


Can you advise me some more please...

The code will only work if the track is Playing or Paused.
What do I need to do to make it work for track Stopped as well ?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2012-02-21 11:22:39
fb.RunContextCommandWithMetadb("Open Containing Folder", fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem());
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-02-21 21:37:34
Excellent, it works, thankyou ExtremeHunter +++

Thanks again for the help guys 
Title: WSH Panel Mod script discussion/help
Post by: motorhorst on 2012-02-22 11:24:51
Hi marc2003,

first of all thanks for all your work and excellent scripts.

A question out of curiousity (and little knowledge so far) concerning the lastfm charts script.

Would it be possible to select/change the properties
- either by using a context menu
- or by an easier dialogue in the properties e.g. the selection of the period by a drop down menu with explaining text (0 = "Overall", 1 = "Last 7 days", 2 = "3 month", etc.)

Thanks for an answer in advance and keep up the good work!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-02-22 18:49:31
from the readme:

Quote
Click the Last.fm logo to select the different chart types and time periods.


(http://dl.dropbox.com/u/22801321/charts%20menu.png)
Title: WSH Panel Mod script discussion/help
Post by: motorhorst on 2012-02-22 19:36:11
I always wonder what these strange readme files' purpose was...   

Thanks a lot. Awesome.
Title: WSH Panel Mod script discussion/help
Post by: joaotavela on 2012-02-26 23:07:02
Is there a way to use similar artists panel to add artists that are in my collection to my playlist?
Title: WSH Panel Mod script discussion/help
Post by: motorhorst on 2012-02-28 09:20:14
To extent this question:

Is it possible to use the main menu command "Quicksearch" and send a parameter or query to use in this quicksearch?

I think we both have the same aim: To find e.g. similar artists (or most played albums or tracks from last.fm charts, etc.) in our libraries.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-02-28 12:03:49
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

similar artists now has a 3rd option under links and that is to create an autoplaylist based on the artist name.

(http://dl.dropbox.com/u/22801321/similar%20auto.png)

(edit: if your preference was for last.fm radio with the old script, this will get reset back to spotify as i had to change the way settings are stored. this only happens once. your setting should stick after that.)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-02-29 16:12:55
similar artists now has a 3rd option under links and that is to create an autoplaylist based on the artist name.

I really like this function. I will try to change it so that it is the text that creates the autoplaylist, and make an assigned playlist for this instead of a new for every artist.

Another idea I got, but that I don't think I'm able to do myself, is a panel with the same layout as "lastfm charts", but with the artist charts instead, and with the same autoplaylist-functionality. Then you could easily see what the most popular tracks are by a certain artist, and play them if they are in your library.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-02-29 17:51:46
you can't edit an existing autoplaylist but if you have a set name, you can loop through all playlists and delete it if the name matches before creating a new one.

on line 187, replace this....
Code: [Select]
        case link == "auto" && in_range && x > 6 && x < 26:
            fb.CreateAutoPlaylist(fb.PlaylistCount, artists[index].name, "artist HAS " + artists[index].name);
            fb.ActivePlaylist = fb.PlaylistCount - 1;
            break;


with

Code: [Select]
        case link == "auto" && in_range && x > 6 && x < 26:
            playlist_name = "similar";
            i = 0;
            while(i < fb.PlaylistCount) {
                if (fb.GetPlaylistName(i) == playlist_name) fb.RemovePlaylist(i);
                else i++;
            }
            fb.CreateAutoPlaylist(fb.PlaylistCount, playlist_name, "artist HAS " + artists[index].name);
            fb.ActivePlaylist = fb.PlaylistCount - 1;
            break;

Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-02-29 22:56:10
Thanks! Works a charm, and as usual, I realise I wouldn't be able to do that myself...

I think some of your other scripts would benefit from having similar functions... External links are nice, but I find it's even nicer to be able to browse my own library using information that's taken from for instance last.fm.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-03-01 10:18:49
the reason i only put last.fm/spotify links on my scripts was to help me easily find new stuff to listen to. i'd find using it to locate music i already have a bit redundant - but maybe that is because my collection is so tiny.
Title: WSH Panel Mod script discussion/help
Post by: joaotavela on 2012-03-03 05:02:12
Many , many Thanks !!! This is exactly what I wanted....
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2012-03-04 08:22:32
Hello everyone, I modified Mar2003's similar artist script to display top artist tracks instead. I'm not familiar with scripting but I took a look at the script's code and last.fm api and figured it out.
This is the code in the modified lines:

Line 102
Code: [Select]
    filename = folder + "\\toptracks.json";

Line 110
Code: [Select]
        else if (typeof parsed_data.toptracks.track == "object") artists = parsed_data.toptracks.track;

Line 120
Code: [Select]
    lastfm("&method=artist.gettoptracks&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_toptracks", function() { save(xmlhttp.responsetext, fn); load(); });

Line 9
Code: [Select]
var script_name = "Top Tracks";


I've been using this for almost 2 weeks with no issues other than the last.fm/spotify search links not working, I'm not familiar with regular expressions...

If I may ask, some questions regarding excellent Marc's scripts:
1- how can I use a complex titleformatting string for defining the path and name of the stored scripts data; json files for both biography view and similar artist?
2- how can I display the number of listeners before the artist name.

I also noted that while playing mp4 files the last.fm panels crashed, and when setting a very long string in the remapping artist field option of the bio script, it gets trimmed. I worked-around it by adding the setting directly in the properties panel dialog.

Similar to Motorhorst, I thought if it was possible to add a search button for the displayed artist to run a query in the media library search component, is it possible or not tooo tricky? I've used the similar artist panel to discover new music as well though unlucky for me, it always reports that is unable to open the default browser, which means that I have to type everytime the search url /name of the artist in last.fm for each artist. If is not too much to ask perhaps just like in the biography panel, there could be an option to copy the artist names to clipboard, which would save me some steps 
Title: WSH Panel Mod script discussion/help
Post by: gxavz1 on 2012-03-04 14:07:35
Hello everyone, I modified Mar2003's similar artist script to display top artist tracks instead. I'm not familiar with scripting but I took a look at the script's code and last.fm api and figured it out.
This is the code in the modified lines:

Line 102
Code: [Select]
    filename = folder + "\\toptracks.json";

Line 110
Code: [Select]
        else if (typeof parsed_data.toptracks.track == "object") artists = parsed_data.toptracks.track;

Line 120
Code: [Select]
    lastfm("&method=artist.gettoptracks&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_toptracks", function() { save(xmlhttp.responsetext, fn); load(); });

Line 9
Code: [Select]
var script_name = "Top Tracks";


I've been using this for almost 2 weeks with no issues other than the last.fm/spotify search links not working, I'm not familiar with regular expressions...

If I may ask, some questions regarding excellent Marc's scripts:
1- how can I use a complex titleformatting string for defining the path and name of the stored scripts data; json files for both biography view and similar artist?
2- how can I display the number of listeners before the artist name.

I also noted that while playing mp4 files the last.fm panels crashed, and when setting a very long string in the remapping artist field option of the bio script, it gets trimmed. I worked-around it by adding the setting directly in the properties panel dialog.

Similar to Motorhorst, I thought if it was possible to add a search button for the displayed artist to run a query in the media library search component, is it possible or not tooo tricky? I've used the similar artist panel to discover new music as well though unlucky for me, it always reports that is unable to open the default browser, which means that I have to type everytime the search url /name of the artist in last.fm for each artist. If is not too much to ask perhaps just like in the biography panel, there could be an option to copy the artist names to clipboard, which would save me some steps 


Also I modified this script, I removed the button spotify, last.fm, auto playlist

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common4.js"
// @name "Top Tracks"
// @author "marc2003"
// @feature "v1.0"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var script_name = "Top Tracks";
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);
var lfm_img = gdi.Image(images_path + "lastfm_red_small.gif");
var spotify_img = gdi.Image(images_path + "spotify.png");
var lastfm_play_img = gdi.Image(images_path + "lastfm_play.png");
var auto_img = gdi.Image(images_path + "search_small.png");
var lastfm_small_img = gdi.Image(images_path + "lastfm small.png");
var up_img = gdi.Image(images_path + "up.png");
var down_img = gdi.Image(images_path + "down.png");
var but_x = 0;
var offset = 0;
var rows = 0;
var artist = "";
var folder = "";
var g_text = "";
var artists = [];
var g_tooltip = window.CreateTooltip();
var link = window.GetProperty("link", "spotify");
var show_artist = window.GetProperty("show_artist", true);
var pause = window.GetProperty("pause", true);

on_item_focus_change();

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

function on_size() {
    ww = window.Width;
    wh = window.Height;
    but_x = Math.round((ww - 15) / 2);
    offset = 0;
    rows = Math.floor((wh - 58) / 20);
    up_btn = new sb(but_x, 32, 15, 15, up_img, "offset > 0", function () { on_mouse_wheel(1); });
    down_btn = new sb(but_x, wh - 15, 15, 15, down_img, "offset < artists.length - rows", function () { on_mouse_wheel(-1); });
}

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
    switch(true) {
        case username.length == 0:
        case api_key.length != 32:
            gr.GdiDrawText("Please use the context menu to set your Last.fm username and API KEY.", normal_font, g_textcolor, 10, 0, ww - 20, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
            break;
        case !g_metadb:
            gr.GdiDrawText("[no selection]", normal_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
            break;
        default:
            gr.GdiDrawText(script_name + (show_artist ? " to " + artist : ""), title_font, g_textcolor_hl, 6, 6, ww - 77, 24, DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
            gr.DrawImage(lfm_img, ww - 60, 8, 50, 18, 0, 0, 50, 18);
            gr.DrawLine(5, 29, ww - 10, 29, 1, g_textcolor_hl);
            if (artists.length == 0) {
                gr.GdiDrawText("[no data]", normal_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
            } else {
                for (l = 0; l < Math.min(rows, artists.length); l++) {
                    gr.DrawImage(lastfm_small_img, 5, 45 + (l * 20), 20, 20, 0, 0, 20, 20);
                    gr.GdiDrawText(artists[l + offset].name, list_font, g_textcolor, 30, 46 + (l * 20), ww - 66, 18, DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
                }
                up_btn.draw(gr);
                down_btn.draw(gr);
            }
    }
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_playback_dynamic_info_track() {
    on_item_focus_change();
}

function on_playback_stop() {
    on_item_focus_change();
}

function on_metadb_changed() {
    if (!g_metadb) return;
    my_metadb_changed("%artist%", function() { load(); });
}

function load() {
    artists = [];
    offset = 0;
    if (!fso.FolderExists(folder)) fso.CreateFolder(folder);
    filename = folder + "\\toptracks.json";
    if (fso.fileExists(filename)) {
        file = fso.Getfile(filename);
        ts = fso.OpenTextFile(filename, 1, false, -1);
        g_text = ts.ReadAll();
        ts.close();
        parsed_data = JSON.parse(g_text);
        if (parsed_data.error > 0) fb.trace(script_name + ": " + g_text);
        else if (typeof parsed_data.toptracks.track == "object") artists = parsed_data.toptracks.track;
        if (Date.parse(Date()) - Date.parse(file.DateLastModified) > 86400000) get();
    } else {
        get();
    }
    window.Repaint();
}

function get() {
    var fn = filename;
    lastfm("&method=artist.gettoptracks&artist=" + encodeURIComponent(artist), "foo_wsh_lastfm_toptracks", function() { save(xmlhttp.responsetext, fn); load(); });
}

function on_mouse_wheel(delta) {
    if (artists.length < rows) return;
    offset -= delta * 3;
    if (offset < 0) offset = 0;
    if (rows + offset > artists.length) offset = artists.length - rows;
    window.Repaint();
}

function on_mouse_move(x, y) {
    index = Math.floor((y - 45 ) / 20) + offset;
    in_range = index >= offset && index < Math.min(offset + rows, artists.length);
    switch(true) {
        case !g_metadb:
        case username.length == 0:
        case api_key.length != 32:
            return;

        case in_range && x > 5 && x < 25:
            var url = (artists[index].url.indexOf("www.") == 0 ? "http://" : "") + artists[index].url;
            tt(url);
            window.SetCursor(IDC_HAND);
            break;
        case up_btn.trace(x, y):
        case down_btn.trace(x, y):
            window.SetCursor(IDC_HAND);
            break;
        default:
            window.SetCursor(IDC_ARROW);
            g_tooltip.Text = "";
            g_tooltip.Deactivate();
            break;
    }
}

function on_mouse_lbtn_up(x, y) {
    switch(true) {
        case !g_metadb:
        case username.length == 0:
        case api_key.length != 32:
            return;

        case in_range && x > 5 && x < 25:
            try { WshShell.run(artists[index].url); } catch(e) { MsgBox("Unable to launch your default browser.", 0, script_name); }
            break;
        case up_btn.trace(x, y):
            up_btn.click(x, y);
            break;
        case down_btn.trace(x, y):
            down_btn.click(x, y);
            break;
    }
}

function on_mouse_rbtn_up(x, y) {
    var _menu = window.CreatePopupMenu();
    var _links = window.CreatePopupMenu();
    var _selection = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(username.length > 0 && api_key.length == 32 && g_metadb ? MF_STRING : MF_GRAYED, 1, "Update");
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(MF_STRING, 11, "Show artist name in heading");
    _menu.CheckMenuItem(11, show_artist);
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(link == "spotify" ? MF_STRING : MF_GRAYED, 7, "Pause playback when launching Spotify");
    _menu.CheckMenuItem(7, pause);
    _menu.AppendMenuSeparator();
    _links.AppendMenuItem(MF_STRING, 4, "Spotify");
    _links.AppendMenuItem(MF_STRING, 5, "Last.fm radio");
    _links.AppendMenuItem(MF_STRING, 6, "Autoplaylist");
    _links.CheckMenuRadioItem(4, 6, link == "spotify" ? 4 : link == "lastfm" ? 5 : 6);
    _links.AppendTo(_menu, MF_STRING, "Links");
    _menu.AppendMenuSeparator();
    _selection.AppendMenuItem(MF_STRING, 900, "Use display preferences");
    _selection.AppendMenuItem(MF_STRING, 901, "Prefer now playing");
    _selection.AppendMenuItem(MF_STRING, 902, "Follow selected track");
    _selection.CheckMenuRadioItem(900, 903, selection_mode + 900);
    _selection.AppendTo(_menu, MF_STRING, "Selection mode");
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(MF_STRING, 2, "Set your Last.fm username...");
    _menu.AppendMenuItem(MF_STRING, 3, "Set your API KEY...");
    _menu.AppendMenuSeparator();
    if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 9, "Properties");
    _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    switch(idx) {
        case 1:
            get();
            break;
        case 2:
            set_username();
            artist = Date();
            on_item_focus_change();
            break;
        case 3:
            set_api_key();
            artist = Date();
            on_item_focus_change();
            break;
        case 4:
        case 5:
        case 6:
            link = idx == 4 ? "spotify" : idx == 5 ? "lastfm" : "auto";
            window.SetProperty("link", link);
            window.Repaint();
            break;
        case 11:
            show_artist = !show_artist;
            window.SetProperty("show_artist", show_artist);
            window.Repaint();
            break;
        case 7:
            pause = !pause;
            window.SetProperty("pause", pause);
            break;
        case 9:
            window.ShowProperties();
            break;
        case 10:
            window.ShowConfigure();
            break;
        case 900:
        case 901:
        case 902:
            selection_mode = idx - 900;
            window.SetProperty("selection_mode", selection_mode);
            on_item_focus_change();
            break;
    }
    _selection.Dispose();
    _menu.Dispose();
    _links.Dispose();
    return true;
}

Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-03-05 00:01:07
the reason i only put last.fm/spotify links on my scripts was to help me easily find new stuff to listen to. i'd find using it to locate music i already have a bit redundant - but maybe that is because my collection is so tiny.


Possibly  My library is quite large and can be hard to browse sometimes, and for me it's more often "what should I listen to now" than "what should I get to listen to later". So the info is great for me in cases where there are connections between artists/tracks that are not apparent through the %tags%, but my lazy side wants to be able to directly browse the library by clicking this info...

We will never be able to use commands like "quicksearch for same..." or soft playlists in these lists right? It would be great to get a list of all popular tags for a specific song, and then click on one to create a playlist with other songs in the library with the same tag.
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2012-03-05 00:04:46
Ok, the silence is deafening. In my newbiness I looked into the common file.js it seems that here I should change the folder where the data is stored. The $CRC32 string may account for the folder names while the var data_folder line for the parent folder wsh_lastfm.
I've attempted using "fb.TitleFormat("")" strings for a custom path, it returns error in the console.
Edit: In the last.fm scripts there's "var folder = "";" line, attempted as well to add title formatting syntax.

Edit2: @gxavz1 I guess that's a way to fix it or the spartan version!
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2012-03-05 02:00:18
So far what I've got trying to display the number of listeners

Code: [Select]
var artists = [];
var listeners = [];


Line 111
Code: [Select]
        else if (typeof parsed_data.toptracks.track == "object") artists = parsed_data.toptracks.track;
        listeners = parsed_data.toptracks.listeners;


What I haven't figured out yet is how to append the listeners value to the beginning of the artist value.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-03-05 05:43:52
why do you care where the cached file is saved? it's not like any it has any use for anything else. the best place for it is under one subfolder in your foobar profile. if you really feel the need to change the path, you need to make sure the folders exist first.

as for trying to access listener data, you need to see if the toptracks feed even contains it. i recommend using notepad++ and the jsmin plugin. this allows you to make JSON files readable. when you open a JSON file, it's just a single line of text but pressing ctrl+alt+m expands it so you can see how it's structured like this.....

(http://dl.dropbox.com/u/22801321/listeners.png)


Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2012-03-05 07:37:40
I prefer to keep artist/album related info into it's artist/album directory, in the same way I store album art, cue and log files. Tracks from artists/albums that are organized in a defined directory structure will already have existing directories, in case a track whos artist/album is not present, can't a directory be created using the same scheme? via titleformatting anyone can adequate their script to match their music structure, if desired.

It does contain it (in the whole feed duh, not in the node, thanks for the hint!), quite cool and useful plugin to view the data structure. Looking at the screenshot and the listeners data tree looks like parsed_data.toptracks.tracks.listeners Anyway I'll take a second look with the plugin.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-03-05 08:40:50
of course you'd keep cue/log files in your own organised structure because they actually are of some use to you and once created they (usually) don't change.

but outside of these panels, these JSON files serve no purpose at all. remember they are only temporary -they get updated if more than 24 hours old. there simply is no reason to store these files alongside your music.

if you really must persist then you need to look at using the FolderExists and CreateFolder jscript functions. there are examples in the script already. also, if a folder doesn't exist, you can't create it unless the parent folder exists so you need to check the existence of that and so on.
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2012-03-06 00:36:50
I guess it comes down to some work philosophy, I prefer to work whenever possible with offline files & data. Even if they are updated regulary I know I have a copy in case something unlikely happens, or I can no longer access the service, etc. That gives more freedom to do/use that data in other forms too. Sometimes month happens till I get an idea/use for some data I have been keeping a record of. Overall, I grant you the point that is a crazy philosophy, but for me it pays off in sometimes very unexpected ways.

Now I started using Notepad++ with the java language view for the scripts, the biography script shows listener's data along with some other, but the code is quite different. I'm not feeling that I'm doing some huge progress but anyways... Hum in other words it has to recursively check the directories. So it seems that the place I should insert the custom title formatting string is in the line 406 in common.js, after line 407 I should check if the folder exists (that includes if the folder didn't exist but it was successfully created). In the case it didn't exist and it wasn't created, create a folder using the same custom path but with one upper directory level. Repeat this process. And there's the folder name specified in the lines 72 and 81, maybe I can just strip it to the data folder var.
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2012-03-07 12:03:04
I would like to send one ore more files to an external application.
I do this with foo_run like this...

Label: Mp3 Tag File (for the active file only one)
Path: "E:\MiniFoo\Applications\Mp3tag\Mp3tagPortable.exe" "%path%"

and...

Label: Mp3 Tag Folder (for the active folder)
Path: "E:\MiniFoo\Applications\Mp3tag\Mp3tagPortable.exe" "$substr(%_path%,0,$strrchr(%_path%,'\'))"

I want to make this only with WHS Pannel and no longer with foo_run.
I tested many variations in my WHS Script (Pop Up Menue) but nothing is working propper...

case 1:

try {WshShell.Run("\"" + (fb.FoobarPath + "themes\\" +name+ "\\Applications\\Mp3tag\\Mp3tagPortable.exe") + "\"");} catch (e)
try {WshShell.Run("\"" + (fb.FoobarPath + "themes\\" +name+ "\\Applications\\Mp3tag\\Mp3tagPortable.exe") + fb.TitleFormat("%_path%"));} catch (e)
try {WshShell.Run("\"" + (fb.FoobarPath + "themes\\" +name+ "\\Applications\\Mp3tag\\Mp3tagPortable.exe") + fb.TitleFormat("$directory(%path%,2)"));} catch (e)
try {WshShell.Run(fb.FoobarPath + "themes\\" +name+ "\\Applications\\Mp3tag\\Mp3tagPortable.exe");} catch (e)
try {WshShell.Run("\"" + (fb.FoobarPath + "themes\\" +name+ "\\Applications\\Mp3tag\\Mp3tagPortable.exe") + fb.TitleFormat("%path%"));} catch (e)
try {WshShell.Run("E:\MiniFoo\minifoo8\themes\TURBO\Applications\Mp3tag\Mp3tagPortable.exe");} catch (e)
try {WshShell.run("E:\\MiniFoo\\minifoo8\\themes\\TURBO\\Applications\\Mp3tag\\Mp3tagPortable.exe" + fb.TitleFormat("%path%").Eval(true));} catch (e) {};
try {WshShell.run("E:\\MiniFoo\\minifoo8\\themes\\TURBO\\Applications\\Mp3tag\\Mp3tagPortable.exe" + fb.TitleFormat("%path%"));} catch (e) {};

break;

Any Idea??
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-10 14:04:39
Hi,

Here is a first sharing of my new WSH playlist viewer v2, just for testing and have some feedback about performances and possible issues (that explain the packed version for now)
This new version is optimized compare to my previous one and has a behaviour pretty close of a classic playlist viewer now. Note that group header are now well handled

get script here: http://pastebin.com/BQWjjYqM (http://pastebin.com/BQWjjYqM)

then paste it in a WSH panel Mod panel (version 1.5.2 minimum is required)

(http://img845.imageshack.us/img845/8157/newwshplaylistv2preview.png)

use jscript and not jscript9 engine
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-03-11 09:48:23
to Falstaff
can you describe what have you do for optimization?

where in this script anything about playlist?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-11 10:22:33
to Falstaff
can you describe what have you do for optimization?

where in this script anything about playlist?


script is packed because i want to finish it before publish it. optimization are everywhere, i've started from scratch the playlist populate, i can't describe it here. the best way is you wait for the final script

but for now you can play with this demo
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-03-11 11:42:56
what is the point of trying to obfuscate your script? all you have to do is put it into a site like http://jsbeautifier.org (http://jsbeautifier.org) to read it again. 
Title: WSH Panel Mod script discussion/help
Post by: danielkza on 2012-03-11 21:19:16
A simple rating panel script using text instead of images. It uses the CUI/DUI configured fonts and colors by default. Font options, what characters to use for the ratings, text alignment ('left', 'center' or 'right' for the X axis, 'top', 'center' and 'bottom' for the Y axis) can be changed in properties. Ratings show a nice little visual feedback (glow) when the rating is changed and a new track comes in. Some screenshots:

(http://i.imgur.com/zotk0.png)

Now the script:

http://pastebin.com/s2ByGKtF (http://pastebin.com/s2ByGKtF)

EDIT: Forgot to mention, this script is in the public domain, do as you want with it, no restrictions.
EDIT2: It obviously requires the Playback Statistics component if you want to change the ratings.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-03-14 13:01:07
i have this function

Code: [Select]
function Function() {
var draw_x;
this.Draw = Function(x) {
      this.x=x;
      draw_x=this.x;
}
//using draw_x;
}
Function()

function on_paint(gr) {
Function().Draw(x);
}


i need to use draw_x after it draws, but it returns nothing. How can i do that?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-03-16 18:21:28
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

-very minor bugfixes/tidy up. existing users should overwrite the marc2003 folder in their profile folder.
-similar artists remove last.fm button from each artist. click the text to open the last.fm website.
-autoplaylists remove lightning button. clicking the text runs the query.
-rating if foo_playcount is not found, your browser will open on the download page automatically

the mouse pointer changes to a hand when hovering and there are tooltips so you can't really miss these changes.

edit: i just a made a boo boo. if anybody downloaded this in the 30 minutes since i posted, please download and extract the marc2003 folder again.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-17 15:11:20
WSH CoverFlow v1 beta1 now available here : [LINK] (http://br3tt.deviantart.com/art/foobar2000-WSH-CoverFlow-v1-beta1-290788027)

(http://img846.imageshack.us/img846/5251/wshcoverflowpreview001.png)
Title: WSH Panel Mod script discussion/help
Post by: BunnyHoover on 2012-03-17 19:37:45
WSH CoverFlow v1 beta1 now available here : [LINK] (http://br3tt.deviantart.com/art/foobar2000-WSH-CoverFlow-v1-beta1-290788027)


Good Attempt !  I tried it and it works well, just a little slow.

(I want something like the good-old 'Album Art Panel' for scanned artworks.
I use it,this source codes :
$replace(%path%,%filename_ext%,)*.*\*.*\*
$replace(%path%,%filename_ext%,)*.*
$replace(%path%,%filename_ext%,)*.*\*.*  ..........)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-17 20:13:41
thanx for feedback, but what do you mean by "slow" ? maybe if you make the panel too big, but it's a panel, not a screen
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-18 17:41:02
WSH CoverFlow v1 beta2

(http://img85.imageshack.us/img85/2602/wshcoverflowpreview003.png) (http://imageshack.us/photo/my-images/85/wshcoverflowpreview003.png/)

jscript:

[code]// ==PREPROCESSOR==
// @name "WSH CoverFlow v1"
// @version "0.0.2.20120318.1815"
// @author "Br3tt"
// @feature "v1.4"
// @feature "watch-metadb"
// @feature "dragdrop"
// ==/PREPROCESSOR==
// [Requirements]
// * foobar2000 v1.1 or better  >> http://foobar2000.org (http://foobar2000.org)
// * WSH panel Mod v1.5.2 or better  >> http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
// [/Requirements]
// [Informations]
// * change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI
// * Some Settings can be changed in window Properties (right click empty space > Properties)
// * double click on album text infos > Show Now Playing album
// * middle click on centered cover > Send album tracks to specific playlist "WSH CoverFlow"
// * keyboard keys : left/right arrows, Home/End, page up/down, spacebar to set focus on the centered album
// [/Informations]
SM_CXVSCROLL = 2;
SM_CYHSCROLL = 3;
DLGC_WANTARROWS = 0x0001;
DLGC_WANTALLKEYS = 0x0004;
MF_STRING = 0x00000000;
MF_SEPARATOR = 0x00000800;
MF_GRAYED = 0x00000001;
MF_DISABLED = 0x00000002;
MF_POPUP = 0x00000010;
IDC_ARROW = 32512;
IDC_IBEAM = 32513;
IDC_WAIT = 32514;
IDC_CROSS = 32515;
IDC_UPARROW = 32516;
IDC_SIZE = 32640;
IDC_ICON = 32641;
IDC_SIZENWSE = 32642;
IDC_SIZENESW = 32643;
IDC_SIZEWE = 32644;
IDC_SIZENS = 32645;
IDC_SIZEALL = 32646;
IDC_NO = 32648;
IDC_APPSTARTING = 32650;
IDC_HAND = 32649;
IDC_HELP = 32651;
DT_LEFT = 0x00000000;
DT_RIGHT = 0x00000002;
DT_TOP = 0x00000000;
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_SINGLELINE = 0x00000020;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_EDITCONTROL = 0x00002000;
DT_END_ELLIPSIS = 0x00008000;
VK_BACK = 0x08;
VK_RETURN = 0x0D;
VK_SHIFT = 0x10;
VK_CONTROL = 0x11;
VK_ALT = 0x12;
VK_ESCAPE = 0x1B;
VK_PGUP = 0x21;
VK_PGDN = 0x22;
VK_END = 0x23;
VK_HOME = 0x24;
VK_LEFT = 0x25;
VK_UP = 0x26;
VK_RIGHT = 0x27;
VK_DOWN = 0x28;
VK_INSERT = 0x2D;
VK_DELETE = 0x2E;
VK_SPACEBAR = 0x20;
KMask = {
  none: 0,
  ctrl: 1,
  shift: 2,
  ctrlshift: 3,
  ctrlalt: 4,
  ctrlaltshift: 5,
  alt: 6
};

function GetKeyboardMask() {
  var c = utils.IsKeyPressed(VK_CONTROL) ? true : false;
  var a = utils.IsKeyPressed(VK_ALT) ? true : false;
  var s = utils.IsKeyPressed(VK_SHIFT) ? true : false;
  var b = KMask.none;
  if (c && !a && !s) b = KMask.ctrl;
  if (!c && !a && s) b = KMask.shift;
  if (c && !a && s) b = KMask.ctrlshift;
  if (c && a && !s) b = KMask.ctrlalt;
  if (c && a && s) b = KMask.ctrlaltshift;
  if (!c && a && !s) b = KMask.alt;
  return b
};
ColorTypeCUI = {
  text: 0,
  selection_text: 1,
  inactive_selection_text: 2,
  background: 3,
  selection_background: 4,
  inactive_selection_background: 5,
  active_item_frame: 6
};
FontTypeCUI = {
  items: 0,
  labels: 1
};
ColorTypeDUI = {
  text: 0,
  background: 1,
  highlight: 2,
  selection: 3
};
FontTypeDUI = {
  defaults: 0,
  tabs: 1,
  lists: 2,
  playlists: 3,
  statusbar: 4,
  console: 5
};

function StringFormat() {
  var a = 0,
    v_align = 0,
    trimming = 0,
    flags = 0;
  switch (arguments.length) {
  case 3:
    trimming = arguments[2];
  case 2:
    v_align = arguments[1];
  case 1:
    a = arguments[0];
    break;
  default:
    return 0
  };
  return ((a << 28) | (v_align << 24) | (trimming << 20) | flags)
};
StringAlignment = {
  Near: 0,
  Centre: 1,
  Far: 2
};
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);

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 getAlpha(a) {
  return ((a >> 24) & 0xff)
}

function getRed(a) {
  return ((a >> 16) & 0xff)
}

function getGreen(a) {
  return ((a >> 8) & 0xff)
}

function getBlue(a) {
  return (a & 0xff)
}

function num(a, b) {
  var i;
  var c = a.toString();
  var k = b - c.length;
  if (k > 0) {
    for (i = 0; i < k; i++) {
      c = "0" + c
    }
  };
  return c.toString()
};

function TrackType(a) {
  var b;
  var c;
  switch (a) {
  case "file":
    b = 1;
    c = 0;
    break;
  case "cdda":
    b = 1;
    c = 1;
    break;
  case "FOO_":
    b = 0;
    c = 2;
    break;
  case "http":
    b = 0;
    c = 3;
    break;
  case "mms:":
    b = 0;
    c = 3;
    break;
  case "unpa":
    b = 0;
    c = 4;
    break;
  default:
    b = 0;
    c = 5
  };
  return c
};
ButtonStates = {
  normal: 0,
  hover: 1,
  down: 2
};
button = function (d, e, f) {
  this.img = Array(d, e, f);
  this.w = this.img[0].Width;
  this.h = this.img[0].Height;
  this.state = ButtonStates.normal;
  this.update = function (a, b, c) {
    this.img = Array(a, b, c)
  };
  this.draw = function (a, x, y, b) {
    this.x = x;
    this.y = y;
    this.img[this.state] && a.DrawImage(this.img[this.state], this.x, this.y, this.w, this.h, 0, 0, this.w, this.h, 0, b)
  };
  this.display_context_menu = function (x, y, a) {};
  this.repaint = function () {
    window.RepaintRect(this.x, this.y, this.w, this.h)
  };
  this.checkstate = function (a, x, y) {
    this.ishover = (x > this.x && x < this.x + this.w - 1 && y > this.y && y < this.y + this.h - 1);
    this.old = this.state;
    switch (a) {
    case "down":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.down : ButtonStates.normal;
        break
      };
      break;
    case "up":
      this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
      break;
    case "right":
      if (this.ishover) this.display_context_menu(x, y, id);
      break;
    case "move":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
        break
      };
      break;
    case "leave":
      this.state = this.isdown ? ButtonStates.down : ButtonStates.normal;
      break
    };
    if (this.state != this.old) this.repaint();
    return this.state
  }
};

function get_system_scrollbar_width() {
  var a = utils.GetSystemMetrics(SM_CXVSCROLL);
  return a
};

function get_system_scrollbar_height() {
  var a = utils.GetSystemMetrics(SM_CYHSCROLL);
  return a
};
var nocover;
var nocover_img;
var streamcover;
var star_img_off;
var star_img_on;
var star_img_hov;
var star_img_kill;
var toggle_scrollbar;
var menu_button;
cover2load = function () {
  this.create = function (a, b) {
    this.item = a;
    this.timer = window.SetInterval(function () {
      window.ClearInterval(mycover2load[0].timer);
      mycover2load[0].item.cover_img = g_image_cache.getit(mycover2load[0].item);
      mycover2load.shift();
      if (a.show) {
        window.RepaintRect(0, cover.pad_top_mid, ww, wh - cover.pad_top_mid)
      } else {
        a.show = true
      }
    }, b)
  }
};
var mycover2load = Array();
image_cache = function () {
  this._cachelist = {};
  this.hit = function (a) {
    var b = this._cachelist[a.cover_path + a.album];
    if (typeof b == "undefined") {
      mycover2load.push(new cover2load);
      mycover2load[mycover2load.length - 1].create(a, (75 + mycover2load.length * 1) * mycover2load.length)
    };
    return b
  };
  this.getit = function (a) {
    var b = refresh_cover(a);
    this._cachelist[a.cover_path + a.album] = b;
    return b
  }
};
var g_image_cache = new image_cache;

function FormatCover(a, w, h) {
  if (!a || w <= 0 || h <= 0) return a;
  return a.Resize(w, h, 2)
};

function refresh_cover(a) {
  var b = 0;
  var c;
  var d = (cover.w - cover.margin * 2) * cover.quality / 100;
  var e = (cover.h - cover.margin * 2) * cover.quality / 100;
  if (a.track_type != 3) {
    if (a.metadb) {
      c = FormatCover(utils.GetAlbumArtEmbedded(a.metadb.rawpath, b), d, e);
      if (!c) {
        c = FormatCover(utils.GetAlbumArtV2(a.metadb, b), d, e);
        if (!c) {
          c = FormatCover(nocover, d, e);
          a.cover_type = 0
        } else {
          a.cover_type = 1
        }
      } else {
        a.cover_type = 2
      }
    }
  } else if (fb.IsPlaying && fb.PlaybackLength) {
    c = FormatCover(streamcover, d, e);
    a.cover_type = 3
  } else {
    c = FormatCover(nocover, d, e);
    a.cover_type = 0
  };
  return c
};

function reset_cover_timers() {
  for (var i in mycover2load) {
    mycover2load.timer && window.ClearInterval(mycover2load.timer)
  };
  mycover2load.splice(0, mycover2load.length)
};
ItemStates = {
  normal: 0,
  hover: 1,
  selected: 2
};
item = function (g, h, j) {
  var i;
  if (typeof this.id == "undefined") {
    if (g < 0) {
      this.id = g;
      this.idx = h;
      this.gh_id = j;
      this.metadb = false;
      this.albumartist = "";
      this.album = "";
      this.track_type = null;
      this.cover_path = "";
      this.date = "";
      this.genre = ""
    } else {
      this.id = g;
      this.idx = h;
      this.gh_id = j;
      this.metadb = list.handlelist.Item(this.id);
      if (this.metadb) {
        this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
        this.album = tf_album.EvalWithMetadb(this.metadb);
        this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
        this.cover_path = tf_cover_path.EvalWithMetadb(this.metadb);
        this.date = tf_date.EvalWithMetadb(this.metadb);
        this.genre = tf_genre.EvalWithMetadb(this.metadb)
      }
    }
  };
  this.update_infos = function () {
    if (this.metadb) {
      this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
      this.album = tf_album.EvalWithMetadb(this.metadb);
      this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
      this.cover_path = tf_cover_path.EvalWithMetadb(this.metadb);
      this.date = tf_date.EvalWithMetadb(this.metadb);
      this.genre = tf_genre.EvalWithMetadb(this.metadb)
    } else {
      this.albumartist = "";
      this.album = "";
      this.track_type = null;
      this.cover_path = "";
      this.date = "";
      this.genre = ""
    }
  };
  this.draw = function (a, b, c, d, e) {
    this.show = e;
    if (list.mid == c) {
      this.w = cover.w;
      this.h = this.w;
      this.y = cover.pad_top_mid;
      this.x = Math.floor((ww / 2) - (cover.w / 2));
      this.cut = 1
    } else {
      this.w = Math.abs(d) == 1 ? cover.w - cover.normal_delta * 1 : cover.w - cover.normal_delta * 2;
      this.h = this.w;
      this.x = Math.abs(d) == 1 ? Math.floor((ww / 2) - (this.w / 2)) - (d * (this.w - 5)) : Math.floor((ww / 2) - (this.w / 2)) - (d * this.w);
      this.y = Math.abs(d) == 1 ? cover.pad_top_mid + Math.ceil(cover.normal_delta / 2) : cover.pad_top_mid + cover.normal_delta;
      this.cut = Math.abs(d) == 1 ? 1 : 0
    };
    if (this.id >= 0 && cover.show && cover.visible) {
      this.cover_img = g_image_cache.hit(this);
      if (e && this.cover_img) {
        a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y + this.h * 2 - 2, this.w, -1 * this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255));
        a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w + 0 - this.cut, this.h + 1, 90, g_backcolor & 0xccffffff, g_backcolor, 1.0);
        a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w + 0 - this.cut, this.h + 1, 90, g_backcolor & 0x66ffffff, g_backcolor, 1.0);
        a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
      } else {
        a.DrawImage(nocover_img, Math.floor(cover.margin / 2) + this.x, this.y + this.h * 2 - 2, this.w, -1 * this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255));
        a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w + 0 - this.cut, this.h + 1, 90, g_backcolor & 0xccffffff, g_backcolor, 1.0);
        a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w + 0 - this.cut, this.h + 1, 90, g_backcolor & 0x66ffffff, g_backcolor, 1.0);
        a.DrawImage(nocover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
        a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
      };
      if (this.gh_id == list.selected_gh_id) {
        a.SetSmoothingMode(2);
        a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 1, this.y - 1, this.w - cover.margin * 2 + 2, this.h - cover.margin * 2 + 2, 2, 2, 3.0, g_backcolor_sel);
        a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 2, this.y - 2, this.w - cover.margin * 2 + 4, this.h - cover.margin * 2 + 4, 3, 3, 1.0, RGBA(255, 255, 255, 60));
        a.SetSmoothingMode(0);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, g_backcolor_sel);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, RGBA(0, 0, 0, 40))
      }
    }
  };
  this.checkstate = function (a, x, y, b) {
    if (this.id >= 0 && y > cover.pad_top_mid) {
      this.ishover = (x > this.x && x < this.x + this.w && y >= this.y && y < this.y + this.h)
    } else {
      this.ishover = false
    };
    switch (a) {
    case "down":
      if (!list.down_timerID && this.id >= 0) {
        if (plman.IsPlaylistItemSelected(fb.ActivePlaylist, this.id)) {
          if (this.ishover) {
            SelectGroupItems(this.id, this.gh_id);
            g_saved = this
          }
        } else {
          if (this.ishover) {
            if (utils.IsKeyPressed(VK_SHIFT)) {
              if (list.focus_id != this.id) {
                if (list.SHIFT_start_id != null) {
                  SelectAtoB(list.SHIFT_start_id, this.id)
                } else {
                  SelectAtoB(list.focus_id, this.id)
                }
              }
            } else if (utils.IsKeyPressed(VK_CONTROL)) {
              plman.SetPlaylistFocusItem(fb.ActivePlaylist, this.id);
              plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, this.id, true)
            } else {
              SelectGroupItems(this.id, this.gh_id);
              g_saved = this
            }
          }
        }
      };
      break;
    case "dblclk":
      if (this.id >= 0 && g_saved != null) {
        if (plman.IsPlaylistItemSelected(fb.ActivePlaylist, this.id)) {
          if (this.id == g_saved.id) {
            plman.ExecutePlaylistDefaultAction(fb.ActivePlaylist, list.hlist[g_saved.gh_id]);
            g_saved = null;
            window.Repaint()
          }
        }
      };
      break;
    case "mid":
      if (this.ishover && this.idx == list.mid) {
        if (plman.GetPlaylistName(plman.ActivePlaylist) != "WSH CoverFlow") {
          SelectGroupItems(this.id, this.gh_id);
          var c = false;
          var d = 0;
          var e = plman.ActivePlaylist;
          for (var i = 0; i < plman.PlaylistCount; i++) {
            if (plman.GetPlaylistName(i) == "WSH CoverFlow") {
              c = true;
              d = i;
              break
            }
          };
          if (!c) {
            d = plman.PlaylistCount;
            plman.CreatePlaylist(plman.PlaylistCount, "WSH CoverFlow")
          };
          plman.ActivePlaylist = d;
          fb.ClearPlaylist();
          var f = fb.PlaylistItemCount(d);
          plman.InsertPlaylistItems(d, f, plman.GetPlaylistSelectedItems(e), false);
          plman.SetPlaylistFocusItem(d, 0)
        }
      };
      break;
    case "right":
      if (this.ishover && this.idx == list.mid) {
        SelectGroupItems(this.id, this.gh_id);
        new_context_menu(x, y, this.id, this.idx)
      };
      break;
    case "up":
      break;
    case "move":
      if (this.ishover) {}
      break;
    case "leave":
      break
    };
    return this.state
  }
};
var tf_path = fb.TitleFormat("$left(%_path_raw%,4)");
var tf_cover_path = fb.TitleFormat("$replace(%path%,%filename_ext%,)");
var tf_tracknumber = fb.TitleFormat("$num($if2(%tracknumber%,1),2)");
var tf_artist = fb.TitleFormat("$if(%length%,%artist%,'Stream')");
var tf_title = fb.TitleFormat("%title%");
var tf_albumartist = fb.TitleFormat("$if(%length%,%album artist%,'Stream')");
var tf_album = fb.TitleFormat("$if2(%album%,$if(%length%,'Single','web radios'))");
var tf_disc = fb.TitleFormat("$if2(%discnumber%,0)");
var tf_disc_info = fb.TitleFormat("$if(%discnumber%,$ifgreater(%totaldiscs%,1,' - [disc '%discnumber%$if(%totaldiscs%,'/'%totaldiscs%']',']'),),)");
var tf_rating = fb.TitleFormat("$if2(%rating%,0)");
var tf_playcount = fb.TitleFormat("$if2(%play_counter%,$if2(%play_count%,0))");
var tf_length = fb.TitleFormat("$if2(%length%,' 0:00')");
var tf_date = fb.TitleFormat("$if2($year(%date%),)");
var tf_genre = fb.TitleFormat("$if2(%genre%,'Other')");
var tf_playback_time = fb.TitleFormat("%playback_time%");
var tf_playback_time_remaining = fb.TitleFormat("$if(%length%,-%playback_time_remaining%,'0:00')");
var tf_group_key = fb.TitleFormat("%album artist%%album%");
var g_instancetype = window.InstanceType;
var g_font = null;
var g_font_headers = null;
var ww = 0,
  wh = 0;
var mouse_x = 0,
  mouse_y = 0;
var g_textcolor = 0,
  g_textcolor_sel = 0,
  g_textcolor_hl = 0,
  g_backcolor = 0,
  g_backcolor_sel = 0;
var g_metadb;
var bool_on_size = false;
var g_search_string = "";
var incsearch_font = gdi.Font("lucida console", 9, 0);
var incsearch_font_big = gdi.Font("lucida console", 20, 1);
var clear_incsearch_timer = false;
var incsearch_timer = false;
var g_saved = null;
panel = {
  max_height: window.GetProperty("panel.maximum.height", 300),
  arr_buttons: Array(),
  button_total: 2,
  show_text: window.GetProperty("panel.album.info.visible", true),
  custom_textcolor: window.GetProperty("panel.custom.text.color.normal", ""),
  custom_textcolor_selection: window.GetProperty("panel.custom.text.color.selection", ""),
  custom_backcolor: window.GetProperty("panel.custom.background.color", ""),
  custom_textcolor_highlight: window.GetProperty("panel.custom.text.color.hightlight", "")
};
list = {
  first_launch: true,
  total: 0,
  total_gh: 0,
  start_id: 0,
  nbvis: 0,
  mid: 0,
  item: Array(),
  hlist: Array(),
  handlelist: null,
  metadblist_selection: plman.GetPlaylistSelectedItems(fb.ActivePlaylist),
  focus_id: 0,
  selected_gh_id: 0,
  gh_id: 0,
  mousewheel_timer_value: 50,
  key_timer_value: 60,
  nowplaying: 0,
  SHIFT_start_id: null,
  SHIFT_count: 0,
  inc_search_noresult: false,
  nb_cover_to_draw: 0,
  buttonclicked: false
};
hscrollbar = {
  theme: false,
  themed: window.GetProperty("list.hscrollbar.themed", true),
  show: window.GetProperty("list.hscrollbar.visible", true),
  visible: true,
  hover: false,
  x: 0,
  y: 0,
  default_h: get_system_scrollbar_height(),
  h: get_system_scrollbar_height(),
  w: 0,
  button_total: 2,
  step: 3,
  arr_buttons: Array(),
  letter: null,
  timerID: false
};
button_up = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  timerID: false
};
button_down = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  timerID: false
};
cursor = {
  bt: null,
  img_normal: null,
  img_hover: null,
  img_down: null,
  popup: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h + 3,
  h: hscrollbar.default_h,
  default_w: hscrollbar.default_h + 3,
  hover: false,
  drag: false,
  grap_x: 0,
  timerID: false,
  last_x: 0
};
cover = {
  show: true,
  visible: true,
  margin: 2,
  w: 0,
  h: 0,
  top_offset: 0,
  pad_top_mid: 35,
  pad_bot_mid: 30,
  normal_delta: 20,
  quality: window.GetProperty("list.covers.quality.percent", 100)
};

function refresh_spv_cursor(a) {
  var b = (cursor.x - hscrollbar.x) / (hscrollbar.w - cursor.w);
  if (b > 1) b = 1;
  if (b < 0) b = 0;
  var r = Math.round(b * list.total_gh);
  set_gh_id(a, list.hlist[r - 1]);
  window.Repaint()
}

function set_gh_id(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(b);
  if (list.gh_id == null) {
    list.gh_id = 0
  }
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  }
};

function scrollup_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r > 0) {
    var s = list.item[0].gh_id;
    if (s > 0) {
      list.item.unshift(new item(list.hlist[s - 1], 0, s - 1))
    } else {
      list.item.unshift(new item(-1, 0, -1))
    };
    list.item.pop()
  };
  for (var i = 0; i < list.item.length; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function scrolldown_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r < list.total_gh - 1) {
    var s = list.item[list.item.length - 1].gh_id;
    if (s > 0 && s < list.total_gh - 1) {
      list.item.push(new item(list.hlist[s + 1], 0, s + 1))
    } else {
      list.item.push(new item(-1, 0, -1))
    };
    list.item.shift()
  };
  for (var i = 0; i < list.item.length; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function refresh_spv(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(list.focus_id);
  if (list.gh_id == null) {
    init_active_pls();
    return true
  }
  list.selected_gh_id = list.gh_id;
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  };
  if (hscrollbar.show) {
    if (list.total_gh < 2) hscrollbar.visible = false;
    else hscrollbar.visible = true
  } else {
    hscrollbar.visible = false
  };
  cursor.w = Math.round(hscrollbar.w / list.total_gh);
  if (cursor.w > hscrollbar.w) cursor.w = hscrollbar.w;
  if (cursor.w < cursor.default_w) cursor.w = cursor.default_w;
  set_scroller();
  setcursorx()
};

function get_gh_id(a) {
  var b = Math.floor(list.total_gh / 2);
  if (a < list.hlist) {
    var c = 0
  } else {
    var c = b
  };
  for (var i = c; i < list.total_gh; i++) {
    if (i < list.total_gh - 1) {
      if (a >= list.hlist && a < list.hlist[i + 1]) {
        return i
      }
    } else {
      if (a >= list.hlist) {
        return i
      } else {
        fb.trace("error: gh_id not found");
        return null
      }
    }
  }
};

function setcursorx() {
  var a = Math.floor(list.item.length / 2);
  var b = list.item[a].gh_id;
  var c = b / (list.total_gh - 1);
  cursor.x = hscrollbar.x + Math.round(c * (hscrollbar.w - cursor.w))
};

function init_active_pls() {
  var a;
  var b;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(fb.ActivePlaylist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
    if (a != b) {
      list.hlist.push(i);
      a = b
    }
  };
  list.total_gh = list.hlist.length
};

function on_font_changed() {
  get_font();
  window.Repaint()
};

function on_colors_changed() {
  get_colors();
  init_icons();
  nocover_img = FormatCover(nocover, (cover.w - cover.margin * 2) * cover.quality / 100, (cover.h - cover.margin * 2) * cover.quality / 100);
  init_hscrollbar_buttons();
  set_scroller();
  g_image_cache = new image_cache;
  CollectGarbage();
  window.Repaint()
};

function on_init() {};

function on_size() {
  if (!window.Width || !window.Height) return;
  window.DlgCode = DLGC_WANTALLKEYS;
  bool_on_size = true;
  if (g_instancetype == 0) {
    window.MinWidth = 200;
    window.MinHeight = 170;
    window.MaxHeight = panel.max_height
  } else if (g_instancetype == 1) {
    window.MinWidth = 200;
    window.MinHeight = 170;
    window.MaxHeight = panel.max_height
  };
  ww = window.Width;
  wh = window.Height;
  if (wh < 170) wh = 170;
  get_font();
  get_colors();
  init_icons();
  cover.w = wh - cover.pad_top_mid - cover.pad_bot_mid;
  cover.h = cover.w;
  list.nbvis = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2;
  if (list.nbvis / 2 == Math.floor(list.nbvis / 2)) {
    list.nbvis--
  }
  if (list.nbvis > 13) list.nbvis = 13;
  list.mid = Math.floor(list.nbvis / 2);
  list.nb_cover_to_draw = list.nbvis;
  if (hscrollbar.themed) {
    hscrollbar.theme = window.CreateThemeManager("scrollbar")
  } else {
    hscrollbar.theme = false
  };
  init_hscrollbar_buttons();
  button_up.x = 0;
  button_up.y = wh - hscrollbar.h;
  button_down.x = ww - button_down.w;
  button_down.y = wh - hscrollbar.h;
  hscrollbar.x = button_up.w;
  hscrollbar.w = ww - button_up.w - button_down.w;
  cursor.y = wh - hscrollbar.h;
  cursor.x = hscrollbar.x;
  nocover_img = FormatCover(nocover, (cover.w - cover.margin * 2) * cover.quality / 100, (cover.h - cover.margin * 2) * cover.quality / 100);
  if (list.first_launch) {
    list.first_launch = false;
    on_playlist_switch()
  } else {
    g_image_cache = new image_cache;
    CollectGarbage();
    refresh_spv(fb.ActivePlaylist, true);
    window.Repaint()
  }
};

function on_paint(a) {
  a.FillGradRect(0, 0, ww, wh, 90, g_backcolor, g_backcolor & 0xd0ffffff, 0.3);
  if (list.item.length > 0) {
    var b;
    var c = (list.nb_cover_to_draw - 1) / 2;
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    for (var d = 1; d < list.mid + 1; d++) {
      if (d > 1 && d <= c) {
        b = true
      } else {
        b = false
      };
      mid2 = list.mid - d;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, d, b)
      }
      mid2 = list.mid + d;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, d * -1, b)
      }
    };
    mid2 = list.mid - 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, 1, true)
    }
    mid2 = list.mid + 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, -1, true)
    }
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    if (panel.show_text) {
      var f = 30;
      var g = ww - 60;
      if (list.item[list.mid].id >= 0) {
        if (list.item[list.mid].date.length > 0) {
          a.GdiDrawText(list.item[list.mid].albumartist + " | " + list.item[list.mid].album + " (" + list.item[list.mid].date + ")", g_font, g_textcolor, f, 0, g, cover.pad_top_mid - 4, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
        } else {
          a.GdiDrawText(list.item[list.mid].albumartist + " | " + list.item[list.mid].album, g_font, g_textcolor, f, 0, g, cover.pad_top_mid - 4, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
        }
      }
    }
  };
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    try {
      hscrollbar.theme.SetPartAndStateId(4, 1);
      hscrollbar.theme.DrawThemeBackground(a, 0, wh - hscrollbar.h, ww, hscrollbar.h);
      a.FillSolidRect(0, wh - hscrollbar.h - 1, ww, 1, RGBA(0, 0, 0, 10))
    } catch (e) {
      a.FillSolidRect(0, wh - hscrollbar.h, ww, hscrollbar.h, g_backcolor);
      a.FillGradRect(0, wh - hscrollbar.h, ww, hscrollbar.h, 0, RGBA(0, 0, 0, 100), g_backcolor, 0.5);
      a.FillGradRect(0, wh - hscrollbar.h, ww, hscrollbar.h, 0, 0, RGBA(255, 255, 255, 25), 0.5);
      a.FillSolidRect(0, wh - hscrollbar.h - 1, ww, 1, RGBA(0, 0, 0, 10))
    };
    try {
      cursor.bt.draw(a, cursor.x, cursor.y, 255)
    } catch (e) {};
    try {
      hscrollbar.theme.SetPartAndStateId(8, 1);
      hscrollbar.theme.DrawThemeBackground(a, cursor.x, wh - hscrollbar.h + 0, cursor.w, cursor.h)
    } catch (e) {};
    for (i = 0; i < hscrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        hscrollbar.arr_buttons.draw(a, button_up.x, button_up.y, 255);
        break;
      case 1:
        hscrollbar.arr_buttons.draw(a, button_down.x, button_down.y, 255);
        break
      }
    };
    if (cursor.drag) {
      hscrollbar.letter = list.item[Math.floor(list.nb_cover_to_draw / 2)].albumartist.substring(0, 1).toUpperCase();
      cursor.popup && a.DrawImage(cursor.popup, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height, 0, 0, cursor.popup.Width, cursor.popup.Height, 0, 155);
      cursor.popup && a.GdiDrawText(hscrollbar.letter, gdi.Font("segoe ui", 14, 0), g_backcolor, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height - 5, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
    }
  };
  for (i = 0; i < panel.arr_buttons.length; i++) {
    switch (i) {
    case 0:
      panel.arr_buttons.draw(a, 5, 5, 255);
      break;
    case 1:
      panel.arr_buttons.draw(a, ww - 22 - 5, 5, 255);
      break
    }
  };
  a.FillGradRect(0, 0, ww, 1, 0, 0, g_textcolor & 0x25ffffff, 0.5)
};

function on_mouse_lbtn_down(x, y) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("down", x, y, i)
  };
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    if (cursor.bt.checkstate("down", x, y) == ButtonStates.down) {
      cursor.drag = true;
      cursor.grap_x = x - cursor.x;
      cursor.last_x = cursor.x
    };
    if (hscrollbar.hover && !cursor.drag) {
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      if (x < cursor.x) {
        if (!list.buttonclicked) {
          list.buttonclicked = true;
          on_mouse_wheel(hscrollbar.step);
          button_up.first_timerID = window.SetTimeout(function () {
            on_mouse_wheel(hscrollbar.step);
            button_up.timerID = window.SetInterval(function () {
              if (hscrollbar.hover) {
                if (mouse_y > wh - hscrollbar.h && cursor.x > mouse_x) {
                  on_mouse_wheel(hscrollbar.step)
                }
              }
            }, list.key_timer_value)
          }, 400)
        }
      } else {
        if (!list.buttonclicked) {
          list.buttonclicked = true;
          on_mouse_wheel(-1 * hscrollbar.step);
          button_down.first_timerID = window.SetTimeout(function () {
            on_mouse_wheel(-1 * hscrollbar.step);
            button_down.timerID = window.SetInterval(function () {
              if (hscrollbar.hover) {
                if (mouse_y > wh - hscrollbar.h && cursor.x + cursor.w < mouse_x) {
                  on_mouse_wheel(-1 * hscrollbar.step)
                }
              }
            }, list.key_timer_value)
          }, 400)
        }
      }
    };
    for (i = 0; i < hscrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (hscrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(1);
            window.Repaint();
            button_up.first_timerID = window.SetTimeout(function () {
              reset_cover_timers();
              button_up.timerID = window.SetInterval(function () {
                on_mouse_wheel(1);
                window.Repaint()
              }, list.key_timer_value)
            }, 400)
          }
        };
        break;
      case 1:
        if (hscrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1);
            window.Repaint();
            button_down.first_timerID = window.SetTimeout(function () {
              reset_cover_timers();
              button_down.timerID = window.SetInterval(function () {
                on_mouse_wheel(-1);
                window.Repaint()
              }, list.key_timer_value)
            }, 400)
          }
        };
        break
      }
    }
  };
  for (i = 0; i < panel.arr_buttons.length; i++) {
    switch (i) {
    case 0:
      if (panel.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
        ShowNowPlaying()
      };
      break;
    case 1:
      if (panel.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
        if (list.total_gh >= 2) {
          hscrollbar.show = !hscrollbar.show;
          if (hscrollbar.show) {
            hscrollbar.visible = true
          } else {
            hscrollbar.visible = false
          }
        } else {
          hscrollbar.visible = false
        };
        window.SetProperty("list.hscrollbar.visible", hscrollbar.show);
        window.Repaint()
      };
      break
    }
  }
};

function on_mouse_lbtn_dblclk(x, y, a) {
  if (y < cover.pad_top_mid) {} else if (y < wh - cover.pad_bot_mid) {
    for (var i = 0; i < list.item.length; i++) {
      list.item.checkstate("dblclk", x, y, i)
    }
  } else {
    on_mouse_lbtn_down(x, y)
  }
};

function on_mouse_lbtn_up(x, y) {
  list.buttonclicked = false;
  hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
  hscrollbar.timerID = false;
  button_up.first_timerID && window.ClearTimeout(button_up.first_timerID);
  button_up.first_timerID = false;
  button_down.first_timerID && window.ClearTimeout(button_down.first_timerID);
  button_down.first_timerID = false;
  button_up.timerID && window.ClearInterval(button_up.timerID);
  button_up.timerID = false;
  button_down.timerID && window.ClearInterval(button_down.timerID);
  button_down.timerID = false;
  if (list.total_gh > 0) {
    cursor.bt.checkstate("up", x, y);
    for (var i = 0; i < hscrollbar.arr_buttons.length; i++) {
      hscrollbar.arr_buttons.checkstate("up", x, y)
    };
    for (var i = 0; i < panel.arr_buttons.length; i++) {
      panel.arr_buttons.checkstate("up", x, y)
    };
    if (cursor.drag) {
      window.RepaintRect(0, wh - hscrollbar.h, ww, hscrollbar.h);
      cursor.drag = false
    } else {
      for (i = 0; i < list.item.length; i++) {
        list.item.checkstate("up", x, y, i)
      }
    };
    setcursorx();
    window.Repaint()
  }
};

function on_mouse_mbtn_down(x, y, a) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("mid", x, y, i)
  }
};

function on_mouse_rbtn_down(x, y) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("right", x, y, i)
  }
};

function on_mouse_move(x, y) {
  if (x == mouse_x && y == mouse_y) return true;
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    hscrollbar.hover = (y >= wh - hscrollbar.h && y <= wh && x >= hscrollbar.x && x <= hscrollbar.x + hscrollbar.w);
    cursor.hover = (x >= cursor.x && x <= cursor.x + cursor.w && y >= cursor.y && y <= cursor.y + cursor.h);
    cursor.bt.checkstate("move", x, y);
    for (var i = 0; i < hscrollbar.arr_buttons.length; i++) {
      hscrollbar.arr_buttons.checkstate("move", x, y)
    };
    if (cursor.drag && mouse_x != x) {
      reset_cover_timers();
      cursor.x = x - cursor.grap_x;
      if (cursor.x < hscrollbar.x) cursor.x = hscrollbar.x;
      if (cursor.x > hscrollbar.x + hscrollbar.w - cursor.w) cursor.x = hscrollbar.x + hscrollbar.w - cursor.w;
      if (!cursor.timerID) {
        cursor.timerID = window.SetTimeout(function () {
          refresh_spv_cursor(fb.ActivePlaylist);
          window.Repaint();
          cursor.timerID && window.ClearTimeout(cursor.timerID);
          cursor.timerID = false
        }, 30)
      }
    }
  };
  for (var j = 0; j < panel.arr_buttons.length; j++) {
    panel.arr_buttons[j].checkstate("move", x, y)
  };
  mouse_x = x;
  mouse_y = y
};

function on_mouse_wheel(a) {
  reset_cover_timers();
  if (!hscrollbar.timerID) {
    if (Math.abs(a) >= 1) {
      if (a > 0) {
        for (var i = 0; i < Math.abs(a); i++) {
          scrollup_spv(fb.ActivePlaylist)
        };
        hscrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
          hscrollbar.timerID = false
        }, list.mousewheel_timer_value)
      } else {
        for (var i = 0; i < Math.abs(a); i++) {
          scrolldown_spv(fb.ActivePlaylist)
        }
        hscrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
          hscrollbar.timerID = false
        }, list.mousewheel_timer_value)
      }
    }
  }
};

function on_mouse_leave() {
  for (i = 0; i < list.item.length; i++) {
    list.item.checkstate("leave", 0, 0, i)
  };
  window.Repaint()
};

function on_playlist_switch() {
  if (fb.ActivePlaylist < 0 || fb.ActivePlaylist > fb.PlaylistCount) {
    if (fb.PlaylistCount > 0) {
      fb.ActivePlaylist = 0
    }
  };
  init_active_pls();
  list.focus_id = plman.GetPlaylistFocusItemIndex(fb.ActivePlaylist);
  if (list.focus_id < 0) {
    list.focus_id = 0
  }
  refresh_spv(fb.ActivePlaylist, true);
  window.Repaint()
};

function on_playlist_items_added(a) {
  if (a == fb.ActivePlaylist) {
    on_playlist_switch()
  };
  plman.SetActivePlaylistContext()
};

function on_playlist_items_reordered(a) {
  if (a == fb.ActivePlaylist) {
    on_playlist_switch()
  }
};

function on_selection_changed(a) {};

function on_playlist_items_selection_change() {};

function on_playlists_changed() {};

function on_item_focus_change(a, b, c) {
  list.focus_id = c;
  plman.SetActivePlaylistContext();
  refresh_spv(fb.ActivePlaylist, bool_on_size);
  bool_on_size = false;
  window.Repaint()
};

function on_metadb_changed(a, b) {
  for (var i = 0; i < list.item.length; i++) {
    list.item.update_infos()
  };
  window.Repaint()
};

function on_focus(a) {};

function on_key_up(a) {};

function on_key_down(a) {
  var b = GetKeyboardMask();
  if (b == KMask.none) {
    switch (a) {
    case VK_SHIFT:
      list.SHIFT_count = 0;
      break;
    case VK_BACK:
      break;
    case VK_ESCAPE:
    case 222:
      break;
    case VK_SPACEBAR:
      var c = list.item[Math.floor(list.nb_cover_to_draw / 2)].id;
      plman.SetPlaylistFocusItem(fb.ActivePlaylist, c);
      plman.ClearPlaylistSelection(fb.ActivePlaylist);
      plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, c, true);
      break;
    case VK_LEFT:
      on_mouse_wheel(1);
      break;
    case VK_RIGHT:
      on_mouse_wheel(-1);
      break;
    case VK_PGUP:
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      on_mouse_wheel(hscrollbar.step);
      break;
    case VK_PGDN:
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      on_mouse_wheel(hscrollbar.step * -1);
      break;
    case VK_RETURN:
      plman.ExecutePlaylistDefaultAction(fb.ActivePlaylist, list.focus_id);
      break;
    case VK_END:
      plman.SetPlaylistFocusItem(fb.ActivePlaylist, list.total - 1);
      plman.ClearPlaylistSelection(fb.ActivePlaylist);
      plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, list.total - 1, true);
      break;
    case VK_HOME:
      plman.SetPlaylistFocusItem(fb.ActivePlaylist, 0);
      plman.ClearPlaylistSelection(fb.ActivePlaylist);
      plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, 0, true);
      break;
    case VK_DELETE:
      if (!fb.IsAutoPlaylist(fb.ActivePlaylist)) {
        plman.RemovePlaylistSelection(fb.ActivePlaylist, false);
        plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, plman.GetPlaylistFocusItemIndex(fb.ActivePlaylist), true)
      }
      break;
    default:
      break
    }
  } else {
    switch (b) {
    case KMask.shift:
      break;
    case KMask.ctrl:
      if (a == 65) {
        fb.RunMainMenuCommand("Edit/Select all");
        window.Repaint()
      };
      if (a == 70) {
        fb.RunMainMenuCommand("Edit/Search")
      };
      if (a == 78) {
        fb.RunMainMenuCommand("File/New playlist")
      };
      if (a == 79) {
        fb.RunMainMenuCommand("File/Open...")
      };
      if (a == 80) {
        fb.RunMainMenuCommand("File/Preferences")
      };
      if (a == 83) {
        fb.RunMainMenuCommand("File/Save playlist...")
      };
      break;
    case KMask.alt:
      if (a == 65) {
        fb.RunMainMenuCommand("View/Always on Top")
      };
      break
    }
  }
};

function on_playback_new_track(a) {
  g_metadb = fb.GetNowPlaying();
  window.Repaint()
};

function on_playback_stop(a) {
  if (a == 0) {
    g_metadb = fb.GetFocusItem();
    on_metadb_changed()
  }
};

function on_playback_pause(a) {};

function on_playback_time(a) {};

function get_font() {
  if (g_instancetype == 0) {
    g_font = window.GetFontCUI(FontTypeCUI.items);
    g_font_headers = window.GetFontCUI(FontTypeCUI.labels)
  } else if (g_instancetype == 1) {
    g_font = window.GetFontDUI(FontTypeDUI.playlists);
    g_font_headers = window.GetFontDUI(FontTypeDUI.tabs)
  }
};

function get_colors() {
  if (g_instancetype == 0) {
    g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
    g_textcolor_sel = window.GetColorCUI(ColorTypeCUI.selection_text);
    g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.active_item_frame);
    g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
    g_backcolor_sel = window.GetColorCUI(ColorTypeCUI.selection_background)
  } else if (g_instancetype == 1) {
    g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
    g_textcolor_sel = window.GetColorDUI(ColorTypeDUI.selection);
    g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
    g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
    g_backcolor_sel = g_textcolor_sel
  };
  try {
    if (panel.custom_textcolor.length > 0) g_textcolor = eval(panel.custom_textcolor);
    if (panel.custom_textcolor_selection.length > 0) g_textcolor_sel = eval(panel.custom_textcolor_selection);
    if (panel.custom_backcolor.length > 0) g_backcolor = eval(panel.custom_backcolor);
    if (panel.custom_textcolor_highlight.length > 0) g_textcolor_hl = eval(panel.custom_textcolor_highlight)
  } catch (e) {};
  g_backcolor_R = getRed(g_backcolor);
  g_backcolor_G = getGreen(g_backcolor);
  g_backcolor_B = getBlue(g_backcolor)
};

function set_scroller() {
  var a;
  try {
    cursor.img_normal = gdi.CreateImage(cursor.w, cursor.h)
  } catch (e) {
    cursor.h = cursor.default_h;
    cursor.img_normal = gdi.CreateImage(cursor.w, cursor.h)
  };
  a = cursor.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(2, 1);
    hscrollbar.theme.DrawThemeBackground(a, 0, 0, cursor.w, cursor.h)
  } catch (e) {
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, g_backcolor);
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, RGBA(0, 0, 0, 100));
    a.FillSolidRect(0, 1, cursor.w - 1, cursor.h - 3, g_textcolor & 0x77ffffff);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, g_backcolor);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, RGBA(255, 255, 255, 25))
  };
  cursor.img_normal.ReleaseGraphics(a);
  cursor.img_hover = gdi.CreateImage(cursor.w, cursor.h);
  a = cursor.img_hover.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(2, 2);
    hscrollbar.theme.DrawThemeBackground(a, 0, 0, cursor.w, cursor.h)
  } catch (e) {
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, g_backcolor);
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, RGBA(0, 0, 0, 70));
    a.FillSolidRect(0, 1, cursor.w - 1, cursor.h - 3, g_textcolor & 0x99ffffff);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, g_backcolor);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, RGBA(255, 255, 255, 50))
  };
  cursor.img_hover.ReleaseGraphics(a);
  cursor.bt = new button(cursor.img_normal, cursor.img_hover, cursor.img_hover)
};

function init_hscrollbar_buttons() {
  var i, gb;
  cursor.popup = gdi.CreateImage(22, 27);
  gb = cursor.popup.GetGraphics();
  gb.SetSmoothingMode(2);
  gb.FillRoundRect(0, 0, 22 - 1, 22 - 1, 3, 3, g_textcolor);
  gb.DrawRoundRect(0, 0, 22 - 1, 22 - 1, 3, 3, 1.0, RGBA(0, 0, 0, 150));
  var a = Array(7, 22 - 2, 11, 22 - 2 + 6, 22 - 7, 22 - 2);
  gb.FillPolygon(g_textcolor, 0, a);
  gb.DrawPolygon(RGBA(0, 0, 0, 150), 1.0, a);
  gb.SetSmoothingMode(0);
  gb.FillSolidRect(6, 22 - 4, 22 - 10, 3, g_textcolor);
  cursor.popup.ReleaseGraphics(gb);
  button_up.img_normal = gdi.CreateImage(button_up.w, button_up.h);
  gb = button_up.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 9);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_up.w, button_up.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(0, 0, button_up.w - 1, button_up.h - 1, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(".", gui_font, RGBA(255, 255, 255, 25), 0, 1, button_up.w - 0, button_up.h, cc_stringformat);
    gb.DrawString(".", gui_font, g_textcolor, 0, 0, button_up.w - 0, button_up.h, cc_stringformat)
  };
  button_up.img_normal.ReleaseGraphics(gb);
  button_up.img_hover = gdi.CreateImage(button_up.w, button_up.h);
  gb = button_up.img_hover.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 10);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_up.w, button_up.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, RGBA(0, 0, 0, 70));
    gb.FillSolidRect(0, 0, button_up.w - 1, button_up.h - 1, g_textcolor & 0x99ffffff);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, RGBA(255, 255, 255, 50));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(".", gui_font, RGBA(255, 255, 255, 50), 0, 1, button_up.w - 0, button_up.h, cc_stringformat);
    gb.DrawString(".", gui_font, g_textcolor, 0, 0, button_up.w - 0, button_up.h, cc_stringformat)
  };
  button_up.img_hover.ReleaseGraphics(gb);
  button_up.img_down = gdi.CreateImage(button_up.w, button_up.h);
  gb = button_up.img_down.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 11);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_up.w, button_up.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_up.w - 1, button_up.h - 1, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(".", gui_font, RGBA(255, 255, 255, 25), 0, 1, button_up.w - 0, button_up.h, cc_stringformat);
    gb.DrawString(".", gui_font, g_textcolor, 0, 0, button_up.w - 0, button_up.h, cc_stringformat)
  };
  button_up.img_down.ReleaseGraphics(gb);
  button_down.img_normal = gdi.CreateImage(button_down.w, button_down.h);
  gb = button_down.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 13);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_down.w, button_down.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(0, 0, button_down.w - 1, button_down.h - 1, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(",", gui_font, RGBA(255, 255, 255, 25), 0, 1, button_down.w - 0, button_down.h, cc_stringformat);
    gb.DrawString(",", gui_font, g_textcolor, 0, 0, button_down.w - 0, button_down.h, cc_stringformat)
  };
  button_down.img_normal.ReleaseGraphics(gb);
  button_down.img_hover = gdi.CreateImage(button_down.w, button_down.h);
  gb = button_down.img_hover.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 14);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_down.w, button_down.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, RGBA(0, 0, 0, 70));
    gb.FillSolidRect(0, 0, button_down.w - 1, button_down.h - 1, g_textcolor & 0x99ffffff);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, RGBA(255, 255, 255, 50));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(",", gui_font, RGBA(255, 255, 255, 50), 0, 1, button_down.w - 0, button_down.h, cc_stringformat);
    gb.DrawString(",", gui_font, g_textcolor, 0, 0, button_down.w - 0, button_down.h, cc_stringformat)
  };
  button_down.img_hover.ReleaseGraphics(gb);
  button_down.img_down = gdi.CreateImage(button_down.w, button_down.h);
  gb = button_down.img_down.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 15);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_down.w, button_down.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_down.w - 1, button_down.h - 1, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 1, g_backcolor);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 1, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(",", gui_font, RGBA(255, 255, 255, 25), 0, 1, button_down.w - 0, button_down.h, cc_stringformat);
    gb.DrawString(",", gui_font, g_textcolor, 0, 0, button_down.w - 0, button_down.h, cc_stringformat)
  };
  button_down.img_down.ReleaseGraphics(gb);
  hscrollbar.arr_buttons.splice(0, hscrollbar.arr_buttons.length);
  for (i = 0; i < hscrollbar.button_total; i++) {
    switch (i) {
    case 0:
      hscrollbar.arr_buttons.push(new button(button_up.img_normal, button_up.img_hover, button_up.img_down));
      break;
    case 1:
      hscrollbar.arr_buttons.push(new button(button_down.img_normal, button_down.img_hover, button_down.img_down));
      break
    }
  }
};

function init_icons() {
  var a;
  var b = gdi.Font("guifx v2 transports", 15, 0);
  nocover = gdi.CreateImage(200, 200);
  a = nocover.GetGraphics();
  a.SetSmoothingMode(2);
  a.FillSolidRect(0, 0, 200, 200, g_textcolor);
  a.FillGradRect(0, 0, 200, 200, 90, g_backcolor & 0xbbffffff, g_backcolor, 1.0);
  a.SetTextRenderingHint(3);
  b = gdi.Font("guifx v2 transports", 132, 0);
  a.DrawString("x", b, RGB(0, 0, 0), 1, -2, 200, 200, cc_stringformat);
  a.DrawString("x", b, RGB(255, 255, 255), 1, 2, 200, 200, cc_stringformat);
  a.DrawString("x", b, g_backcolor, 1, 0, 200, 200, cc_stringformat);
  a.DrawString("x", b, g_textcolor & 0x88ffffff, 1, 0, 200, 200, cc_stringformat);
  nocover.ReleaseGraphics(a);
  streamcover = gdi.CreateImage(200, 200);
  a = streamcover.GetGraphics();
  a.SetSmoothingMode(2);
  a.FillSolidRect(0, 0, 200, 200, g_textcolor);
  a.FillGradRect(0, 0, 200, 200, 90, g_backcolor & 0xbbffffff, g_backcolor, 1.0);
  a.SetTextRenderingHint(3);
  b = gdi.F
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-03-20 16:52:23
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

thumbs: the thumbnails in grid mode are now horizontally centred. also added new thumbnail size: 250px.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-20 19:21:18
WSH CoverFlow v1 beta3 (optimized and new settings in properties!)

[code]// ==PREPROCESSOR==
// @name "WSH CoverFlow v1"
// @version "0.0.3.20120320.2015"
// @author "Br3tt"
// @feature "v1.4"
// @feature "watch-metadb"
// @feature "dragdrop"
// ==/PREPROCESSOR==

// [Requirements]
// * foobar2000 v1.1 or better  >> http://foobar2000.org (http://foobar2000.org)
// * WSH panel Mod v1.5.2 or better  >> http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
// [/Requirements]

// [Informations]
// * change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI
// * Some Settings can be changed in window Properties (right click empty space > Properties)
// * for custom colors in Properties, use e.g. RGB(255,255,255) for white color, RGB(0,0,0) for black color, ...
// * double click on album text infos > Show Now Playing album
// * middle click on centered cover > Send album tracks to specific playlist "WSH CoverFlow"
// * keyboard keys : left/right arrows, Home/End, page up/down, spacebar to set focus on the centered album
// [/Informations]

SM_CXVSCROLL = 2;
SM_CYHSCROLL = 3;
DLGC_WANTARROWS = 0x0001;
DLGC_WANTALLKEYS = 0x0004;
MF_STRING = 0x00000000;
MF_SEPARATOR = 0x00000800;
MF_GRAYED = 0x00000001;
MF_DISABLED = 0x00000002;
MF_POPUP = 0x00000010;
IDC_ARROW = 32512;
IDC_IBEAM = 32513;
IDC_WAIT = 32514;
IDC_CROSS = 32515;
IDC_UPARROW = 32516;
IDC_SIZE = 32640;
IDC_ICON = 32641;
IDC_SIZENWSE = 32642;
IDC_SIZENESW = 32643;
IDC_SIZEWE = 32644;
IDC_SIZENS = 32645;
IDC_SIZEALL = 32646;
IDC_NO = 32648;
IDC_APPSTARTING = 32650;
IDC_HAND = 32649;
IDC_HELP = 32651;
var DT_LEFT = 0x00000000;
var DT_RIGHT = 0x00000002;
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_EDITCONTROL = 0x00002000;
var DT_END_ELLIPSIS = 0x00008000;
var VK_BACK = 0x08;
var VK_RETURN = 0x0D;
var VK_SHIFT = 0x10;
var VK_CONTROL = 0x11;
var VK_ALT = 0x12;
var VK_ESCAPE = 0x1B;
var VK_PGUP = 0x21;
var VK_PGDN = 0x22;
var VK_END = 0x23;
var VK_HOME = 0x24;
var VK_LEFT = 0x25;
var VK_UP = 0x26;
var VK_RIGHT = 0x27;
var VK_DOWN = 0x28;
var VK_INSERT = 0x2D;
var VK_DELETE = 0x2E;
var VK_SPACEBAR = 0x20;
var KMask = {
  none: 0,
  ctrl: 1,
  shift: 2,
  ctrlshift: 3,
  ctrlalt: 4,
  ctrlaltshift: 5,
  alt: 6
};

function GetKeyboardMask() {
  var c = utils.IsKeyPressed(VK_CONTROL) ? true : false;
  var a = utils.IsKeyPressed(VK_ALT) ? true : false;
  var s = utils.IsKeyPressed(VK_SHIFT) ? true : false;
  var b = KMask.none;
  if (c && !a && !s) b = KMask.ctrl;
  if (!c && !a && s) b = KMask.shift;
  if (c && !a && s) b = KMask.ctrlshift;
  if (c && a && !s) b = KMask.ctrlalt;
  if (c && a && s) b = KMask.ctrlaltshift;
  if (!c && a && !s) b = KMask.alt;
  return b
};
ColorTypeCUI = {
  text: 0,
  selection_text: 1,
  inactive_selection_text: 2,
  background: 3,
  selection_background: 4,
  inactive_selection_background: 5,
  active_item_frame: 6
};
FontTypeCUI = {
  items: 0,
  labels: 1
};
ColorTypeDUI = {
  text: 0,
  background: 1,
  highlight: 2,
  selection: 3
};
FontTypeDUI = {
  defaults: 0,
  tabs: 1,
  lists: 2,
  playlists: 3,
  statusbar: 4,
  console: 5
};

function StringFormat() {
  var a = 0,
    v_align = 0,
    trimming = 0,
    flags = 0;
  switch (arguments.length) {
  case 3:
    trimming = arguments[2];
  case 2:
    v_align = arguments[1];
  case 1:
    a = arguments[0];
    break;
  default:
    return 0
  };
  return ((a << 28) | (v_align << 24) | (trimming << 20) | flags)
};
StringAlignment = {
  Near: 0,
  Centre: 1,
  Far: 2
};
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);

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 getAlpha(a) {
  return ((a >> 24) & 0xff)
}
function getRed(a) {
  return ((a >> 16) & 0xff)
}
function getGreen(a) {
  return ((a >> 8) & 0xff)
}
function getBlue(a) {
  return (a & 0xff)
}
function num(a, b) {
  var i;
  var c = a.toString();
  var k = b - c.length;
  if (k > 0) {
    for (i = 0; i < k; i++) {
      c = "0" + c
    }
  };
  return c.toString()
};

function TrackType(a) {
  var b;
  var c;
  switch (a) {
  case "file":
    b = 1;
    c = 0;
    break;
  case "cdda":
    b = 1;
    c = 1;
    break;
  case "FOO_":
    b = 0;
    c = 2;
    break;
  case "http":
    b = 0;
    c = 3;
    break;
  case "mms:":
    b = 0;
    c = 3;
    break;
  case "unpa":
    b = 0;
    c = 4;
    break;
  default:
    b = 0;
    c = 5
  };
  return c
};
ButtonStates = {
  normal: 0,
  hover: 1,
  down: 2
};
button = function (d, e, f) {
  this.img = Array(d, e, f);
  this.w = this.img[0].Width;
  this.h = this.img[0].Height;
  this.state = ButtonStates.normal;
  this.update = function (a, b, c) {
    this.img = Array(a, b, c)
  };
  this.draw = function (a, x, y, b) {
    this.x = x;
    this.y = y;
    this.img[this.state] && a.DrawImage(this.img[this.state], this.x, this.y, this.w, this.h, 0, 0, this.w, this.h, 0, b)
  };
  this.display_context_menu = function (x, y, a) {};
  this.repaint = function () {
    window.RepaintRect(this.x, this.y, this.w, this.h)
  };
  this.checkstate = function (a, x, y) {
    this.ishover = (x > this.x && x < this.x + this.w - 1 && y > this.y && y < this.y + this.h - 1);
    this.old = this.state;
    switch (a) {
    case "down":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.down : ButtonStates.normal;
        break
      };
      break;
    case "up":
      this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
      break;
    case "right":
      if (this.ishover) this.display_context_menu(x, y, id);
      break;
    case "move":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
        break
      };
      break;
    case "leave":
      this.state = this.isdown ? ButtonStates.down : ButtonStates.normal;
      break
    };
    if (this.state != this.old) this.repaint();
    return this.state
  }
};

function get_system_scrollbar_width() {
  var a = utils.GetSystemMetrics(SM_CXVSCROLL);
  return a
};

function get_system_scrollbar_height() {
  var a = utils.GetSystemMetrics(SM_CYHSCROLL);
  return a
};
var nocover;
var nocover_img;
var streamcover;
var star_img_off;
var star_img_on;
var star_img_hov;
var star_img_kill;
var toggle_scrollbar;
var menu_button;
cover2load = function (a, b) {
  this.item = a;
  this.timer = window.SetTimeout(function () {
    if (mycover2load.length > 0) {
      mycover2load[0].timer && window.ClearTimeout(mycover2load[0].timer);
      utils.GetAlbumArtAsync(window.ID, mycover2load[0].item.metadb, 0, true, false, false)
    }
  }, b)
};
var mycover2load = Array();
image_cache = function () {
  this._cachelist = {};
  this.hit = function (a) {
    var b = this._cachelist[a.cover_path + a.album];
    if (typeof b == "undefined") {
      mycover2load.push(new cover2load(a, (80 * (mycover2load.length > 0 ? 1 : 0)) + (10 * mycover2load.length)))
    };
    return b
  };
  this.getit = function (a) {
    var b = refresh_cover(a);
    this._cachelist[a.cover_path + a.album] = b;
    return b
  }
};
var g_image_cache = new image_cache;

function FormatCover(a, w, h) {
  if (!a || w <= 0 || h <= 0) return a;
  return a.Resize(w, h, 2)
};

function refresh_cover(a) {
  var b = 0;
  var c;
  var d = (cover.w - cover.margin * 2) * cover.quality / 100;
  var e = (cover.h - cover.margin * 2) * cover.quality / 100;
  if (a.track_type != 3) {
    if (a.metadb) {
      c = FormatCover(utils.GetAlbumArtEmbedded(a.metadb.rawpath, b), d, e);
      if (!c) {
        c = FormatCover(utils.GetAlbumArtV2(a.metadb, b), d, e);
        if (!c) {
          c = FormatCover(nocover, d, e);
          a.cover_type = 0
        } else {
          a.cover_type = 1
        }
      } else {
        a.cover_type = 2
      }
    }
  } else if (fb.IsPlaying && fb.PlaybackLength) {
    c = FormatCover(streamcover, d, e);
    a.cover_type = 3
  } else {
    c = FormatCover(nocover, d, e);
    a.cover_type = 0
  };
  return c
};

function reset_cover_timers() {
  for (var i in mycover2load) {
    mycover2load.timer && window.ClearInterval(mycover2load.timer)
  };
  mycover2load.splice(0, mycover2load.length)
};

function on_get_album_art_done(a, b, c, d) {
  for (var i = 0; i < mycover2load.length; i++) {
    if (mycover2load[0].item.metadb.Compare(a)) {
      mycover2load.item.cover_img = g_image_cache.getit(mycover2load.item, c, d);
      if (mycover2load.item.show) {
        window.RepaintRect(mycover2load.item.x - 15, cover.pad_top_mid, mycover2load.item.w + 30, wh - cover.pad_top_mid)
      } else {
        mycover2load.item.show = true
      };
      mycover2load.splice(i, 1);
      break
    }
  }
};
ItemStates = {
  normal: 0,
  hover: 1,
  selected: 2
};
item = function (g, h, k) {
  var i;
  if (typeof this.id == "undefined") {
    if (g < 0) {
      this.id = g;
      this.idx = h;
      this.gh_id = k;
      this.metadb = false;
      this.albumartist = "";
      this.album = "";
      this.track_type = null;
      this.cover_path = "";
      this.group_info = ""
    } else {
      this.id = g;
      this.idx = h;
      this.gh_id = k;
      this.metadb = list.handlelist.Item(this.id);
      if (this.metadb) {
        this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
        this.album = tf_album.EvalWithMetadb(this.metadb);
        this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
        this.cover_path = tf_cover_path.EvalWithMetadb(this.metadb);
        this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
      }
    }
  };
  this.update_infos = function () {
    if (this.metadb) {
      this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
      this.album = tf_album.EvalWithMetadb(this.metadb);
      this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
      this.cover_path = tf_cover_path.EvalWithMetadb(this.metadb);
      this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
    } else {
      this.albumartist = "";
      this.album = "";
      this.track_type = null;
      this.cover_path = "";
      this.group_info = ""
    }
  };
  this.draw = function (a, b, c, d, e) {
    this.show = e;
    if (list.mid == c) {
      this.w = cover.w;
      this.h = this.w;
      this.y = cover.pad_top_mid;
      this.x = Math.floor((ww / 2) - (cover.w / 2));
      this.cut = 1
    } else {
      this.w = Math.abs(d) == 1 ? cover.w - cover.normal_delta * 1 : cover.w - cover.normal_delta * 2;
      this.h = this.w;
      this.x = Math.abs(d) == 1 ? Math.floor((ww / 2) - (this.w / 2)) - (d * (this.w - 5)) : Math.floor((ww / 2) - (this.w / 2)) - (d * this.w);
      this.y = Math.abs(d) == 1 ? cover.pad_top_mid + Math.ceil(cover.normal_delta / 2) : cover.pad_top_mid + cover.normal_delta;
      this.cut = Math.abs(d) == 1 ? 1 : 0
    };
    if (this.id >= 0) {
      this.cover_img = g_image_cache.hit(this);
      if (this.show && typeof (this.cover_img) != "undefined") {
        var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
        if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
          a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y + this.h * 2 - cover.margin - 1, this.w, -1 * this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
          if (cover.draw_border) {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
          } else {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
          };
          a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w - this.cut, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
        };
        a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        if (cover.draw_border) {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
        } else {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
        };
        if (cover.draw_shadows) {
          if (d == 0 || d == 1 || d == -1) {
            for (var j = 0; j < 7; j++) {
              if (this.gh_id > 0) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              };
              if (this.gh_id < list.total_gh - 1) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              }
            }
          }
        }
      } else {
        var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
        if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
          a.DrawImage(nocover_img, Math.floor(cover.margin / 2) + this.x, this.y + this.h * 2 - cover.margin - 1, this.w, -1 * this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
          if (cover.draw_border) {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
          } else {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
          };
          a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w - this.cut, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
        };
        a.DrawImage(nocover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        if (cover.draw_border) {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
        } else {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
        };
        if (cover.draw_shadows) {
          if (d == 0 || d == 1 || d == -1) {
            for (var j = 0; j < 7; j++) {
              if (this.gh_id > 0) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              };
              if (this.gh_id < list.total_gh - 1) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              }
            }
          }
        }
      };
      if (cover.draw_focus_border && this.gh_id == list.selected_gh_id) {
        a.SetSmoothingMode(2);
        a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 1, this.y - 1, this.w - cover.margin * 2 + 2, this.h - cover.margin * 2 + 2, 2, 2, 3.0, g_backcolor_sel);
        a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 2, this.y - 2, this.w - cover.margin * 2 + 4, this.h - cover.margin * 2 + 4, 3, 3, 1.0, RGBA(255, 255, 255, 60));
        a.SetSmoothingMode(0);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, g_backcolor_sel);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, RGBA(0, 0, 0, 40))
      }
    }
  };
  this.checkstate = function (a, x, y, b) {
    if (this.id >= 0 && y > cover.pad_top_mid) {
      this.ishover = (x > this.x && x < this.x + this.w && y >= this.y && y < this.y + this.h)
    } else {
      this.ishover = false
    };
    switch (a) {
    case "down":
      if (!list.down_timerID && this.id >= 0) {
        if (plman.IsPlaylistItemSelected(fb.ActivePlaylist, this.id)) {
          if (this.ishover) {
            SelectGroupItems(this.id, this.gh_id);
            g_saved = this
          }
        } else {
          if (this.ishover) {
            if (utils.IsKeyPressed(VK_SHIFT)) {
              if (list.focus_id != this.id) {
                if (list.SHIFT_start_id != null) {} else {}
              }
            } else if (utils.IsKeyPressed(VK_CONTROL)) {
              plman.SetPlaylistFocusItem(fb.ActivePlaylist, this.id);
              plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, this.id, true)
            } else {
              SelectGroupItems(this.id, this.gh_id);
              g_saved = this
            }
          }
        }
      };
      break;
    case "dblclk":
      if (this.id >= 0 && g_saved != null) {
        if (plman.IsPlaylistItemSelected(fb.ActivePlaylist, this.id)) {
          if (this.id == g_saved.id) {
            plman.ExecutePlaylistDefaultAction(fb.ActivePlaylist, list.hlist[g_saved.gh_id]);
            g_saved = null;
            window.Repaint()
          }
        }
      };
      break;
    case "mid":
      if (this.ishover && this.idx == list.mid) {
        if (plman.GetPlaylistName(plman.ActivePlaylist) != "WSH CoverFlow") {
          SelectGroupItems(this.id, this.gh_id);
          var c = false;
          var d = 0;
          var e = plman.ActivePlaylist;
          for (var i = 0; i < plman.PlaylistCount; i++) {
            if (plman.GetPlaylistName(i) == "WSH CoverFlow") {
              c = true;
              d = i;
              break
            }
          };
          if (!c) {
            d = plman.PlaylistCount;
            plman.CreatePlaylist(plman.PlaylistCount, "WSH CoverFlow")
          };
          plman.ActivePlaylist = d;
          fb.ClearPlaylist();
          var f = fb.PlaylistItemCount(d);
          plman.InsertPlaylistItems(d, f, plman.GetPlaylistSelectedItems(e), false);
          plman.SetPlaylistFocusItem(d, 0)
        }
      };
      break;
    case "right":
      if (this.ishover && this.idx == list.mid) {
        SelectGroupItems(this.id, this.gh_id);
        new_context_menu(x, y, this.id, this.idx)
      };
      break;
    case "up":
      break;
    case "move":
      if (this.ishover) {}
      break;
    case "leave":
      break
    };
    return this.state
  }
};
var tf_path = fb.TitleFormat("$left(%_path_raw%,4)");
var tf_cover_path = fb.TitleFormat("$replace(%path%,%filename_ext%,)");
var tf_albumartist = fb.TitleFormat("$if(%length%,%album artist%,'Stream')");
var tf_album = fb.TitleFormat("$if2(%album%,$if(%length%,'Single','web radios'))");
var tf_group_key = fb.TitleFormat(window.GetProperty("_group Key", "%album artist%%album%"));
var tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
var g_instancetype = window.InstanceType;
var g_font = null;
var g_font_headers = null;
var ww = 0,
  wh = 0;
var mouse_x = 0,
  mouse_y = 0;
var g_textcolor = 0,
  g_textcolor_sel = 0,
  g_textcolor_hl = 0,
  g_backcolor = 0,
  g_backcolor_sel = 0;
var g_metadb;
var bool_on_size = false;
var g_search_string = "";
var incsearch_font = gdi.Font("lucida console", 9, 0);
var incsearch_font_big = gdi.Font("lucida console", 20, 1);
var clear_incsearch_timer = false;
var incsearch_timer = false;
var g_saved = null;
panel = {
  max_height: window.GetProperty("panel.maximum.height", 300),
  arr_buttons: Array(),
  button_total: 2,
  show_text: window.GetProperty("panel.album.info.visible", true),
  custom_textcolor: window.GetProperty("panel.custom.text.color.normal", ""),
  custom_textcolor_selection: window.GetProperty("panel.custom.text.color.selection", ""),
  custom_backcolor: window.GetProperty("panel.custom.background.color", ""),
  custom_textcolor_highlight: window.GetProperty("panel.custom.text.color.hightlight", "")
};
list = {
  first_launch: true,
  total: 0,
  total_gh: 0,
  start_id: 0,
  nbvis: 0,
  mid: 0,
  item: Array(),
  hlist: Array(),
  handlelist: null,
  metadblist_selection: plman.GetPlaylistSelectedItems(fb.ActivePlaylist),
  focus_id: 0,
  selected_gh_id: 0,
  gh_id: 0,
  mousewheel_timer_value: 20,
  key_timer_value: 60,
  nowplaying: 0,
  SHIFT_start_id: null,
  SHIFT_count: 0,
  inc_search_noresult: false,
  nb_cover_to_draw: 0,
  buttonclicked: false
};
hscrollbar = {
  theme: false,
  themed: window.GetProperty("list.hscrollbar.themed", true),
  show: window.GetProperty("list.hscrollbar.visible", true),
  visible: true,
  hover: false,
  x: 0,
  y: 0,
  default_h: get_system_scrollbar_height(),
  h: get_system_scrollbar_height(),
  w: 0,
  button_total: 2,
  step: 3,
  arr_buttons: Array(),
  letter: null,
  timerID: false
};
button_up = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  timerID: false
};
button_down = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  timerID: false
};
cursor = {
  bt: null,
  img_normal: null,
  img_hover: null,
  img_down: null,
  popup: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h + 3,
  h: hscrollbar.default_h,
  default_w: hscrollbar.default_h + 3,
  hover: false,
  drag: false,
  grap_x: 0,
  timerID: false,
  last_x: 0
};
cover = {
  margin: 2,
  w: 0,
  h: 0,
  top_offset: 0,
  pad_top_mid: 35,
  pad_bot_mid: 30,
  normal_delta: 20,
  quality: window.GetProperty("list.covers.quality.percent", 100),
  draw_border: window.GetProperty("cover.draw.border", true),
  draw_reflection: window.GetProperty("cover.draw.reflection", true),
  reflect_strength_percent: window.GetProperty("cover.reflection.percent", 25),
  draw_shadows: window.GetProperty("cover.draw.shadows", true),
  draw_focus_border: window.GetProperty("cover.draw.focus.border", true)
};

function refresh_spv_cursor(a) {
  var b = (cursor.x - hscrollbar.x) / (hscrollbar.w - cursor.w);
  if (b > 1) b = 1;
  if (b < 0) b = 0;
  var r = Math.round(b * list.total_gh);
  set_gh_id(a, list.hlist[r - 1]);
  window.Repaint()
}
function set_gh_id(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(b);
  if (list.gh_id == null) {
    list.gh_id = 0
  }
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  }
};

function scrollup_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r > 0) {
    var s = list.item[0].gh_id;
    if (s > 0) {
      list.item.unshift(new item(list.hlist[s - 1], 0, s - 1))
    } else {
      list.item.unshift(new item(-1, 0, -1))
    };
    list.item.pop()
  };
  for (var i = 0; i < list.item.length; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function scrolldown_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r < list.total_gh - 1) {
    var s = list.item[list.item.length - 1].gh_id;
    if (s > 0 && s < list.total_gh - 1) {
      list.item.push(new item(list.hlist[s + 1], 0, s + 1))
    } else {
      list.item.push(new item(-1, 0, -1))
    };
    list.item.shift()
  };
  for (var i = 0; i < list.item.length; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function refresh_spv(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(list.focus_id);
  if (list.gh_id == null) {
    init_active_pls();
    return true
  }
  list.selected_gh_id = list.gh_id;
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  };
  if (hscrollbar.show) {
    if (list.total_gh < 2) hscrollbar.visible = false;
    else hscrollbar.visible = true
  } else {
    hscrollbar.visible = false
  };
  cursor.w = Math.round(hscrollbar.w / list.total_gh);
  if (cursor.w > hscrollbar.w) cursor.w = hscrollbar.w;
  if (cursor.w < cursor.default_w) cursor.w = cursor.default_w;
  set_scroller();
  setcursorx()
};

function get_gh_id(a) {
  var b = Math.floor(list.total_gh / 2);
  if (a < list.hlist) {
    var c = 0
  } else {
    var c = b
  };
  for (var i = c; i < list.total_gh; i++) {
    if (i < list.total_gh - 1) {
      if (a >= list.hlist && a < list.hlist[i + 1]) {
        return i
      }
    } else {
      if (a >= list.hlist) {
        return i
      } else {
        fb.trace("error: gh_id not found");
        return null
      }
    }
  }
};

function setcursorx() {
  var a = Math.floor(list.item.length / 2);
  var b = list.item[a].gh_id;
  var c = b / (list.total_gh - 1);
  cursor.x = hscrollbar.x + Math.round(c * (hscrollbar.w - cursor.w))
};

function init_active_pls() {
  var a;
  var b;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(fb.ActivePlaylist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
    if (a != b) {
      list.hlist.push(i);
      a = b
    }
  };
  list.total_gh = list.hlist.length
};

function on_font_changed() {
  get_font();
  window.Repaint()
};

function on_colors_changed() {
  get_colors();
  init_icons();
  nocover_img = FormatCover(nocover, (cover.w - cover.margin * 2) * cover.quality / 100, (cover.h - cover.margin * 2) * cover.quality / 100);
  init_hscrollbar_buttons();
  set_scroller();
  g_image_cache = new image_cache;
  CollectGarbage();
  window.Repaint()
};

function on_init() {};

function on_size() {
  if (!window.Width || !window.Height) return;
  window.DlgCode = DLGC_WANTALLKEYS;
  bool_on_size = true;
  if (g_instancetype == 0) {
    window.MinWidth = 200;
    window.MinHeight = 170;
    window.MaxHeight = panel.max_height
  } else if (g_instancetype == 1) {
    window.MinWidth = 200;
    window.MinHeight = 170;
    window.MaxHeight = panel.max_height
  };
  ww = window.Width;
  wh = window.Height;
  if (wh < 170) wh = 170;
  var a = window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  if (a == "") window.SetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
  get_font();
  get_colors();
  init_icons();
  cover.w = wh - cover.pad_top_mid - cover.pad_bot_mid;
  cover.h = cover.w;
  list.nbvis = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2;
  if (list.nbvis / 2 == Math.floor(list.nbvis / 2)) {
    list.nbvis--
  }
  if (list.nbvis > 23) list.nbvis = 23;
  list.mid = Math.floor(list.nbvis / 2);
  list.nb_cover_to_draw = list.nbvis;
  if (hscrollbar.themed) {
    hscrollbar.theme = window.CreateThemeManager("scrollbar")
  } else {
    hscrollbar.theme = false
  };
  init_hscrollbar_buttons();
  button_up.x = 0;
  button_up.y = wh - hscrollbar.h;
  button_down.x = ww - button_down.w;
  button_down.y = wh - hscrollbar.h;
  hscrollbar.x = button_up.w;
  hscrollbar.w = ww - button_up.w - button_down.w;
  cursor.y = wh - hscrollbar.h;
  cursor.x = hscrollbar.x;
  nocover_img = FormatCover(nocover, (cover.w - cover.margin * 2) * cover.quality / 100, (cover.h - cover.margin * 2) * cover.quality / 100);
  if (list.first_launch) {
    list.first_launch = false;
    on_playlist_switch()
  } else {
    g_image_cache = new image_cache;
    CollectGarbage();
    refresh_spv(fb.ActivePlaylist, true);
    window.Repaint()
  }
};

function on_paint(a) {
  a.FillGradRect(0, 0, ww, wh, 90, g_backcolor, g_backcolor & 0xd0ffffff, 0.3);
  if (list.item.length > 0) {
    var b, mid2;
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    for (var c = 1; c < list.mid + 1; c++) {
      if (c > 1 && c <= list.mid) {
        b = true
      } else {
        b = false
      };
      mid2 = list.mid - c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c, b)
      }
      mid2 = list.mid + c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c * -1, b)
      }
    };
    mid2 = list.mid - 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, 1, true)
    }
    mid2 = list.mid + 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, -1, true)
    }
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    if (panel.show_text) {
      var d = 30;
      var f = ww - 60;
      if (list.item[list.mid].id >= 0) {
        a.GdiDrawText(list.item[list.mid].group_info, g_font, g_textcolor, d, 0, f, cover.pad_top_mid - 4, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
      }
    }
  };
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    try {
      hscrollbar.theme.SetPartAndStateId(4, 1);
      hscrollbar.theme.DrawThemeBackground(a, 0, wh - hscrollbar.h, ww, hscrollbar.h);
      a.FillSolidRect(0, wh - hscrollbar.h - 1, ww, 1, RGBA(0, 0, 0, 10))
    } catch (e) {
      a.FillSolidRect(0, wh - hscrollbar.h, ww, hscrollbar.h, g_backcolor);
      a.FillGradRect(0, wh - hscrollbar.h, ww, hscrollbar.h, 0, RGBA(0, 0, 0, 100), g_backcolor, 0.5);
      a.FillGradRect(0, wh - hscrollbar.h, ww, hscrollbar.h, 0, 0, RGBA(255, 255, 255, 25), 0.5);
      a.FillSolidRect(0, wh - hscrollbar.h - 1, ww, 1, RGBA(0, 0, 0, 10))
    };
    try {
      cursor.bt.draw(a, cursor.x, cursor.y, 255)
    } catch (e) {};
    try {
      hscrollbar.theme.SetPartAndStateId(8, 1);
      hscrollbar.theme.DrawThemeBackground(a, cursor.x, wh - hscrollbar.h + 0, cursor.w, cursor.h)
    } catch (e) {};
    for (i = 0; i < hscrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        hscrollbar.arr_buttons.draw(a, button_up.x, button_up.y, 255);
        break;
      case 1:
        hscrollbar.arr_buttons.draw(a, button_down.x, button_down.y, 255);
        break
      }
    };
    if (cursor.drag) {
      hscrollbar.letter = list.item[Math.floor(list.nb_cover_to_draw / 2)].albumartist.substring(0, 1).toUpperCase();
      cursor.popup && a.DrawImage(cursor.popup, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height, 0, 0, cursor.popup.Width, cursor.popup.Height, 0, 155);
      cursor.popup && a.GdiDrawText(hscrollbar.letter, gdi.Font("segoe ui", 14, 0), g_backcolor, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height - 5, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
    }
  };
  for (i = 0; i < panel.arr_buttons.length; i++) {
    switch (i) {
    case 0:
      panel.arr_buttons.draw(a, 5, 5, 255);
      break;
    case 1:
      panel.arr_buttons.draw(a, ww - 22 - 5, 5, 255);
      break
    }
  };
  a.FillGradRect(0, 0, ww, 1, 0, 0, g_textcolor & 0x25ffffff, 0.5)
};

function on_mouse_lbtn_down(x, y) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("down", x, y, i)
  };
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    if (cursor.bt.checkstate("down", x, y) == ButtonStates.down) {
      cursor.drag = true;
      cursor.grap_x = x - cursor.x;
      cursor.last_x = cursor.x
    };
    if (hscrollbar.hover && !cursor.drag) {
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      if (x < cursor.x) {
        if (!list.buttonclicked) {
          list.buttonclicked = true;
          on_mouse_wheel(hscrollbar.step);
          button_up.first_timerID = window.SetTimeout(function () {
            on_mouse_wheel(hscrollbar.step);
            button_up.timerID = window.SetInterval(function () {
              if (hscrollbar.hover) {
                if (mouse_y > wh - hscrollbar.h && cursor.x > mouse_x) {
                  on_mouse_wheel(hscrollbar.step)
                }
              }
            }, list.key_timer_value)
          }, 400)
        }
      } else {
        if (!list.buttonclicked) {
          list.buttonclicked = true;
          on_mouse_wheel(-1 * hscrollbar.step);
          button_down.first_timerID = window.SetTimeout(function () {
            on_mouse_wheel(-1 * hscrollbar.step);
            button_down.timerID = window.SetInterval(function () {
              if (hscrollbar.hover) {
                if (mouse_y > wh - hscrollbar.h && cursor.x + cursor.w < mouse_x) {
                  on_mouse_wheel(-1 * hscrollbar.step)
                }
              }
            }, list.key_timer_value)
          }, 400)
        }
      }
    };
    for (i = 0; i < hscrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (hscrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(1);
            button_up.first_timerID = window.SetTimeout(function () {
              reset_cover_timers();
              button_up.timerID = window.SetInterval(function () {
                on_mouse_wheel(1)
              }, list.key_timer_value)
            }, 400)
          }
        };
        break;
      case 1:
        if (hscrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1);
            button_down.first_timerID = window.SetTimeout(function () {
              reset_cover_timers();
              button_down.timerID = window.SetInterval(function () {
                on_mouse_wheel(-1)
              }, list.key_timer_value)
            }, 400)
          }
        };
        break
      }
    }
  };
  for (i = 0; i < panel.arr_buttons.length; i++) {
    switch (i) {
    case 0:
      if (panel.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
        ShowNowPlaying()
      };
      break;
    case 1:
      if (panel.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
        if (list.total_gh >= 2) {
          hscrollbar.show = !hscrollbar.show;
          if (hscrollbar.show) {
            hscrollbar.visible = true
          } else {
            hscrollbar.visible = false
          }
        } else {
          hscrollbar.visible = false
        };
        window.SetProperty("list.hscrollbar.visible", hscrollbar.show);
        window.Repaint()
      };
      break
    }
  }
};

function on_mouse_lbtn_dblclk(x, y, a) {
  if (y < cover.pad_top_mid) {} else if (y < wh - cover.pad_bot_mid) {
    for (var i = 0; i < list.item.length; i++) {
      list.item.checkstate("dblclk", x, y, i)
    }
  } else {
    on_mouse_lbtn_down(x, y)
  }
};

function on_mouse_lbtn_up(x, y) {
  list.buttonclicked = false;
  hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
  hscrollbar.timerID = false;
  button_up.first_timerID && window.ClearTimeout(button_up.first_timerID);
  button_up.first_timerID = false;
  button_down.first_timerID && window.ClearTimeout(button_down.first_timerID);
  button_down.first_timerID = false;
  button_up.timerID && window.ClearInterval(button_up.timerID);
  button_up.timerID = false;
  button_down.timerID && window.ClearInterval(button_down.timerID);
  button_down.timerID = false;
  if (list.total_gh > 0) {
    cursor.bt.checkstate("up", x, y);
    for (var i = 0; i < hscrollbar.arr_buttons.length; i++) {
      hscrollbar.arr_buttons.checkstate("up", x, y)
    };
    for (var i = 0; i < panel.arr_buttons.length; i++) {
      panel.arr_buttons.checkstate("up", x, y)
    };
    if (cursor.drag) {
      window.RepaintRect(0, wh - hscrollbar.h, ww, hscrollbar.h);
      cursor.drag = false
    } else {
      for (i = 0; i < list.item.length; i++) {
        list.item.checkstate("up", x, y, i)
      }
    };
    setcursorx();
    window.Repaint()
  }
};

function on_mouse_mbtn_down(x, y, a) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("mid", x, y, i)
  }
};

function on_mouse_rbtn_down(x, y) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("right", x, y, i)
  }
};

function on_mouse_move(x, y) {
  if (x == mouse_x && y == mouse_y) return true;
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    hscrollbar.hover = (y >= wh - hscrollbar.h && y <= wh && x >= hscrollbar.x && x <= hscrollbar.x + hscrollbar.w);
    cursor.hover = (x >= cursor.x && x <= cursor.x + cursor.w && y >= cursor.y && y <= cursor.y + cursor.h);
    cursor.bt.checkstate("move", x, y);
    for (var i = 0; i < hscrollbar.arr_buttons.length; i++) {
      hscrollbar.arr_buttons.checkstate("move", x, y)
    };
    if (cursor.drag && mouse_x != x) {
      reset_cover_timers();
      cursor.x = x - cursor.grap_x;
      if (cursor.x < hscrollbar.x) cursor.x = hscrollbar.x;
      if (cursor.x > hscrollbar.x + hscrollbar.w - cursor.w) cursor.x = hscrollbar.x + hscrollbar.w - cursor.w;
      if (!cursor.timerID) {
        cursor.timerID = window.SetTimeout(function () {
          refresh_spv_cursor(fb.ActivePlaylist);
          window.Repaint();
          cursor.timerID && window.ClearTimeout(cursor.timerID);
          cursor.timerID = false
        }, 30)
      }
    }
  };
  for (var j = 0; j < panel.arr_buttons.length; j++) {
    panel.arr_buttons[j].checkstate("move", x, y)
  };
  mouse_x = x;
  mouse_y = y
};

function on_mouse_wheel(a) {
  reset_cover_timers();
  if (!hscrollbar.timerID) {
    if (Math.abs(a) >= 1) {
      if (a > 0) {
        for (var i = 0; i < Math.abs(a); i++) {
          scrollup_spv(fb.ActivePlaylist)
        };
        hscrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
          hscrollbar.timerID = false
        }, list.mousewheel_timer_value)
      } else {
        for (var i = 0; i < Math.abs(a); i++) {
          scrolldown_spv(fb.ActivePlaylist)
        }
        hscrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
          hscrollbar.timerID = false
        }, list.mousewheel_timer_value)
      }
    }
  }
};

function on_mouse_leave() {
  for (i = 0; i < list.item.length; i++) {
    list.item.checkstate("leave", 0, 0, i)
  };
  window.Repaint()
};

function on_playlist_switch() {
  if (fb.ActivePlaylist < 0 || fb.ActivePlaylist > fb.PlaylistCount) {
    if (fb.PlaylistCount > 0) {
      fb.ActivePlaylist = 0
    }
  };
  init_active_pls();
  list.focus_id = plman.GetPlaylistFocusItemIndex(fb.ActivePlaylist);
  if (list.focus_id < 0) {
    list.focus_id = 0
  }
  refresh_spv(fb.ActivePlaylist, true);
  window.Repaint()
};

function on_playlist_items_added(a) {
  if (a == fb.ActivePlaylist) {
    on_playlist_switch()
  };
  plman.SetActivePlaylistContext()
};

function on_playlist_items_reordered(a) {
  if (a == fb.ActivePlaylist) {
    on_playlist_switch()
  }
};

function on_selection_changed(a) {};

function on_playlist_items_selection_change() {};

function on_playlists_changed() {};

function on_item_focus_change(a, b, c) {
  list.focus_id = c;
  plman.SetActivePlaylistContext();
  refresh_spv(fb.ActivePlaylist, bool_on_size);
  bool_on_size = false;
  window.Repaint()
};

function on_metadb_changed(a, b) {
  for (var i = 0; i < list.item.length; i++) {
    list.item.update_infos()
  };
  window.Repaint()
};

function on_focus(a) {};

function on_key_up(a) {};

function on_key_down(a) {
  var b = GetKeyboardMask();
  if (b == KMask.none) {
    switch (a) {
    case VK_SHIFT:
      list.SHIFT_count = 0;
      break;
    case VK_BACK:
      break;
    case VK_ESCAPE:
    case 222:
      break;
    case VK_SPACEBAR:
      var c = list.item[Math.floor(list.nb_cover_to_draw / 2)].id;
      plman.SetPlaylistFocusItem(fb.ActivePlaylist, c);
      plman.ClearPlaylistSelection(fb.ActivePlaylist);
      plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, c, true);
      break;
    case VK_LEFT:
      on_mouse_wheel(1);
      break;
    case VK_RIGHT:
      on_mouse_wheel(-1);
      break;
    case VK_PGUP:
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      on_mouse_wheel(hscrollbar.step);
      break;
    case VK_PGDN:
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      on_mouse_wheel(hscrollbar.step * -1);
      break;
    case VK_RETURN:
      plman.ExecutePlaylistDefaultAction(fb.ActivePlaylist, list.focus_id);
      break;
    case VK_END:
      plman.SetPlaylistFocusItem(fb.ActivePlaylist, list.total - 1);
      plman.ClearPlaylistSelection(fb.ActivePlaylist);
      plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, list.total - 1, true);
      break;
    case VK_HOME:
      plman.SetPlaylistFocusItem(fb.ActivePlaylist, 0);
      plman.ClearPlaylistSelection(fb.ActivePlaylist);
      plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, 0, true);
      break;
    case VK_DELETE:
      if (!fb.IsAutoPlaylist(fb.ActivePlaylist)) {
        plman.RemovePlaylistSelection(fb.ActivePlaylist, false);
        plman.SetPlaylistSelectionSingle(fb.ActivePlaylist, plman.GetPlaylistFocusItemIndex(fb.ActivePlaylist), true)
      }
      break;
    default:
      break
    }
  } else {
    switch (b) {
    case KMask.shift:
      break;
    case KMask.ctrl:
      if (a == 65) {
        fb.RunMainMenuCommand("Edit/Select all");
        window.Repaint()
      };
      if (a == 70) {
        fb.RunMainMenuCommand("Edit/Search")
      };
      if (a == 78) {
        fb.RunMainMenuCommand("File/New playlist")
      };
      if (a == 79) {
        fb.RunMainMenuCommand("File/Open...")
      };
      if (a == 80) {
        fb.RunMainMenuCommand("File/Preferences")
      };
      if (a == 83) {
        fb.RunMainMenuCommand("File/Save playlist...")
      };
      break;
    case KMask.alt:
      if (a == 65) {
        fb.RunMainMenuCommand("View/Always on Top")
      };
      break
    }
  }
};

function on_playback_new_track(a) {
  g_metadb = fb.GetNowPlaying();
  window.Repaint()
};

function on_playback_stop(a) {
  if (a == 0) {
    g_metadb = fb.GetFocusItem();
    on_metadb_changed()
  }
};

function on_playback_pause(a) {};

function on_playback_time(a) {};

function get_font() {
  if (g_instancetype == 0) {
    g_font = window.GetFontCUI(FontTypeCUI.items);
    g_font_headers = window.GetFontCUI(FontTypeCUI.labels)
  } else if (g_instancetype == 1) {
    g_font = window.GetFontDUI(FontTypeDUI.playlists);
    g_font_headers = window.GetFontDUI(FontTypeDUI.tabs)
  }
};

function get_colors() {
  if (g_instancetype == 0) {
    g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
    g_textcolor_sel = window.GetColorCUI(ColorTypeCUI.selection_text);
    g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.active_item_frame);
    g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
    g_backcolor_sel = window.GetColorCUI(ColorTypeCUI.selection_background)
  } else if (g_instancetype == 1) {
    g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
    g_textcolor_sel = window.GetColorDUI(ColorTypeDUI.selection);
    g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
    g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
    g_backcolor_sel = g_textcolor_sel
  };
  try {
    if (panel.custom_textcolor.length > 0) g_textcolor = eval(panel.custom_textcolor);
    if (panel.custom_textcolor_selection.length > 0) g_textcolor_sel = eval(panel.custom_textcolor_selection);
    if (panel.custom_backcolor.length > 0) g_backcolor = eval(panel.custom_backcolor);
    if (panel.custom_textcolor_highlight.length > 0) g_textcolor_hl = eval(panel.custom_textcolor_highlight)
  } catch (e) {};
  g_backcolor_R = getRed(g_backcolor);
  g_backcolor_G = getGreen(g_backcolor);
  g_backcolor_B = getBlue(g_backcolor)
};

function set_scroller() {
  var a;
  try {
    cursor.img_normal = gdi.CreateImage(cursor.w, cursor.h)
  } catch (e) {
    cursor.h = cursor.default_h;
    cursor.img_normal = gdi.CreateImage(cursor.w, cursor.h)
  };
  a = cursor.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(2, 1);
    hscrollbar.theme.DrawThemeBackground(a, 0, 0, cursor.w, cursor.h)
  } catch (e) {
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, g_backcolor);
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, RGBA(0, 0, 0, 100));
    a.FillSolidRect(0, 1, cursor.w - 1, cursor.h - 3, g_textcolor & 0x77ffffff);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, g_backcolor);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, RGBA(255, 255, 255, 25))
  };
  cursor.img_normal.ReleaseGraphics(a);
  cursor.img_hover = gdi.CreateImage(cursor.w, cursor.h);
  a = cursor.img_hover.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(2, 2);
    hscrollbar.theme.DrawThemeBackground(a, 0, 0, cursor.w, cursor.h)
  } catch (e) {
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, g_backcolor);
    a.FillSolidRect(0, 1, cursor.w - 0, cursor.h - 2, RGBA(0, 0, 0, 70));
    a.FillSolidRect(0, 1, cursor.w - 1, cursor.h - 3, g_textcolor & 0x99ffffff);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, g_backcolor);
    a.FillSolidRect(1, 2, cursor.w - 2, cursor.h - 4, RGBA(255, 255, 255, 50))
  };
  cursor.img_hover.ReleaseGraphics(a);
  cursor.bt = new button(cursor.img_normal, cursor.img_hover, cursor.img_hover)
};

function init_hscrollbar_buttons() {
  var i, gb;
  cursor.popup = gdi.CreateImage(22, 27);
  gb = cursor.popup.GetGraphics();
  gb.SetSmoothingMode(2);
  gb.FillRoundRect(0, 0, 22 - 1, 22 - 1, 3, 3, g_textcolor);
  gb.DrawRoundRect(0, 0, 22 - 1, 22 - 1, 3, 3, 1.0, RGBA(0, 0, 0, 150));
  var a = Array(7, 22 - 2, 11, 22 - 2 + 6, 22 - 7, 22 - 2);
  gb.FillPolygon(g_textcolor, 0, a);
  gb.DrawPolygon(RGBA(0, 0, 0, 150), 1.0, a);
  gb.SetSmoothingMode(0);
  gb.FillSolidRect(6, 22 - 4, 22 - 10, 3, g_textcolor);
  cursor.popup.ReleaseGraphics(gb);
  button_up.img_normal = gdi.CreateImage(button_up.w, button_up.h);
  gb = button_up.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 9);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_up.w, button_up.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(0, 0, button_up.w - 1, button_up.h - 1, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(".", gui_font, RGBA(255, 255, 255, 25), 0, 1, button_up.w - 0, button_up.h, cc_stringformat);
    gb.DrawString(".", gui_font, g_textcolor, 0, 0, button_up.w - 0, button_up.h, cc_stringformat)
  };
  button_up.img_normal.ReleaseGraphics(gb);
  button_up.img_hover = gdi.CreateImage(button_up.w, button_up.h);
  gb = button_up.img_hover.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 10);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_up.w, button_up.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, RGBA(0, 0, 0, 70));
    gb.FillSolidRect(0, 0, button_up.w - 1, button_up.h - 1, g_textcolor & 0x99ffffff);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, RGBA(255, 255, 255, 50));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(".", gui_font, RGBA(255, 255, 255, 50), 0, 1, button_up.w - 0, button_up.h, cc_stringformat);
    gb.DrawString(".", gui_font, g_textcolor, 0, 0, button_up.w - 0, button_up.h, cc_stringformat)
  };
  button_up.img_hover.ReleaseGraphics(gb);
  button_up.img_down = gdi.CreateImage(button_up.w, button_up.h);
  gb = button_up.img_down.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 11);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_up.w, button_up.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(0, 0, button_up.w - 0, button_up.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_up.w - 1, button_up.h - 1, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_up.w - 2, button_up.h - 2, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(".", gui_font, RGBA(255, 255, 255, 25), 0, 1, button_up.w - 0, button_up.h, cc_stringformat);
    gb.DrawString(".", gui_font, g_textcolor, 0, 0, button_up.w - 0, button_up.h, cc_stringformat)
  };
  button_up.img_down.ReleaseGraphics(gb);
  button_down.img_normal = gdi.CreateImage(button_down.w, button_down.h);
  gb = button_down.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 13);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_down.w, button_down.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(0, 0, button_down.w - 1, button_down.h - 1, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(",", gui_font, RGBA(255, 255, 255, 25), 0, 1, button_down.w - 0, button_down.h, cc_stringformat);
    gb.DrawString(",", gui_font, g_textcolor, 0, 0, button_down.w - 0, button_down.h, cc_stringformat)
  };
  button_down.img_normal.ReleaseGraphics(gb);
  button_down.img_hover = gdi.CreateImage(button_down.w, button_down.h);
  gb = button_down.img_hover.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 14);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_down.w, button_down.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, RGBA(0, 0, 0, 70));
    gb.FillSolidRect(0, 0, button_down.w - 1, button_down.h - 1, g_textcolor & 0x99ffffff);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, g_backcolor);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 2, RGBA(255, 255, 255, 50));
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString(",", gui_font, RGBA(255, 255, 255, 50), 0, 1, button_down.w - 0, button_down.h, cc_stringformat);
    gb.DrawString(",", gui_font, g_textcolor, 0, 0, button_down.w - 0, button_down.h, cc_stringformat)
  };
  button_down.img_hover.ReleaseGraphics(gb);
  button_down.img_down = gdi.CreateImage(button_down.w, button_down.h);
  gb = button_down.img_down.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 15);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_down.w, button_down.h)
  } catch (e) {
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_textcolor & 0x77ffffff);
    gb.FillSolidRect(0, 0, button_down.w - 0, button_down.h - 0, g_backcolor);
    gb.FillSolidRect(0, 0, button_down.w - 1, button_down.h - 1, RGBA(0, 0, 0, 100));
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 1, g_backcolor);
    gb.FillSolidRect(1, 1, button_down.w - 2, button_down.h - 1, RGBA(255, 255, 255, 25));
    gb.SetTextRenderingHint(4);
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2012-03-21 00:13:21
Falstaff, is your coverflow script horizontal scrolling only?  If so, any chance for a vertical scrolling one?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-21 07:18:47
only horizontal for now. maybe a vertical one later, i can't say when.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-24 19:04:42
WSH CoverFlow v1 beta4

What's New in beta4:
- lock current playlist button: allow you to use the coverflow as an album browser, in your playlist, when lock is on, you only have the tracks of the selected cover album!
- scrollbar button replaced by a menu button
- cover loading engine modded to get better perfs.
- new scrollbar style (not themed one)
- many tweaks ... i can't remember all the changes since beta3

(http://img849.imageshack.us/img849/3716/wshcoverflowpreview005.png) (http://fav.me/d4t4lh7)

[code]// ==PREPROCESSOR==
// @name "CoverFlow View v1"
// @version "0.0.4.20120324.1412"
// @author "Br3tt"
// @feature "v1.4"
// @feature "watch-metadb"
// @feature "dragdrop"
// ==/PREPROCESSOR==

// [Requirements]
// * foobar2000 v1.1 or better  >> http://foobar2000.org (http://foobar2000.org)
// * WSH panel Mod v1.5.2 or better  >> http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
// [/Requirements]

// * !!! Keep a reasonable size for the panel to avoid bad perf! Loading and Displaying too big or too much covers can be a nightmare for your CPU!

// [Informations]
// * change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI
// * Some Settings can be changed in window Properties (right click empty space > Properties)
// * for custom colors in Properties, use e.g. RGB(255,255,255) for white color, RGB(0,0,0) for black color, ...
// * double click on album text infos > Show Now Playing album
// * middle click on centered cover > Send album tracks to specific playlist "CoverFlow View"
// * keyboard keys : left/right arrows, Home/End, page up/down, spacebar to set focus on the centered album
// [/Informations]

SM_CXVSCROLL = 2;
SM_CYHSCROLL = 3;
DLGC_WANTARROWS = 0x0001;
DLGC_WANTALLKEYS = 0x0004;
MF_STRING = 0x00000000;
MF_SEPARATOR = 0x00000800;
MF_GRAYED = 0x00000001;
MF_DISABLED = 0x00000002;
MF_POPUP = 0x00000010;
IDC_ARROW = 32512;
IDC_IBEAM = 32513;
IDC_WAIT = 32514;
IDC_CROSS = 32515;
IDC_UPARROW = 32516;
IDC_SIZE = 32640;
IDC_ICON = 32641;
IDC_SIZENWSE = 32642;
IDC_SIZENESW = 32643;
IDC_SIZEWE = 32644;
IDC_SIZENS = 32645;
IDC_SIZEALL = 32646;
IDC_NO = 32648;
IDC_APPSTARTING = 32650;
IDC_HAND = 32649;
IDC_HELP = 32651;
var DT_LEFT = 0x00000000;
var DT_RIGHT = 0x00000002;
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_EDITCONTROL = 0x00002000;
var DT_END_ELLIPSIS = 0x00008000;
var VK_BACK = 0x08;
var VK_RETURN = 0x0D;
var VK_SHIFT = 0x10;
var VK_CONTROL = 0x11;
var VK_ALT = 0x12;
var VK_ESCAPE = 0x1B;
var VK_PGUP = 0x21;
var VK_PGDN = 0x22;
var VK_END = 0x23;
var VK_HOME = 0x24;
var VK_LEFT = 0x25;
var VK_UP = 0x26;
var VK_RIGHT = 0x27;
var VK_DOWN = 0x28;
var VK_INSERT = 0x2D;
var VK_DELETE = 0x2E;
var VK_SPACEBAR = 0x20;
var KMask = {
  none: 0,
  ctrl: 1,
  shift: 2,
  ctrlshift: 3,
  ctrlalt: 4,
  ctrlaltshift: 5,
  alt: 6
};

function GetKeyboardMask() {
  var c = utils.IsKeyPressed(VK_CONTROL) ? true : false;
  var a = utils.IsKeyPressed(VK_ALT) ? true : false;
  var s = utils.IsKeyPressed(VK_SHIFT) ? true : false;
  var b = KMask.none;
  if (c && !a && !s) b = KMask.ctrl;
  if (!c && !a && s) b = KMask.shift;
  if (c && !a && s) b = KMask.ctrlshift;
  if (c && a && !s) b = KMask.ctrlalt;
  if (c && a && s) b = KMask.ctrlaltshift;
  if (!c && a && !s) b = KMask.alt;
  return b
};
ColorTypeCUI = {
  text: 0,
  selection_text: 1,
  inactive_selection_text: 2,
  background: 3,
  selection_background: 4,
  inactive_selection_background: 5,
  active_item_frame: 6
};
FontTypeCUI = {
  items: 0,
  labels: 1
};
ColorTypeDUI = {
  text: 0,
  background: 1,
  highlight: 2,
  selection: 3
};
FontTypeDUI = {
  defaults: 0,
  tabs: 1,
  lists: 2,
  playlists: 3,
  statusbar: 4,
  console: 5
};

function StringFormat() {
  var a = 0,
    v_align = 0,
    trimming = 0,
    flags = 0;
  switch (arguments.length) {
  case 3:
    trimming = arguments[2];
  case 2:
    v_align = arguments[1];
  case 1:
    a = arguments[0];
    break;
  default:
    return 0
  };
  return ((a << 28) | (v_align << 24) | (trimming << 20) | flags)
};
StringAlignment = {
  Near: 0,
  Centre: 1,
  Far: 2
};
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);

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 getAlpha(a) {
  return ((a >> 24) & 0xff)
}
function getRed(a) {
  return ((a >> 16) & 0xff)
}
function getGreen(a) {
  return ((a >> 8) & 0xff)
}
function getBlue(a) {
  return (a & 0xff)
}
function num(a, b) {
  var i;
  var c = a.toString();
  var k = b - c.length;
  if (k > 0) {
    for (i = 0; i < k; i++) {
      c = "0" + c
    }
  };
  return c.toString()
};

function TrackType(a) {
  var b;
  var c;
  switch (a) {
  case "file":
    b = 1;
    c = 0;
    break;
  case "cdda":
    b = 1;
    c = 1;
    break;
  case "FOO_":
    b = 0;
    c = 2;
    break;
  case "http":
    b = 0;
    c = 3;
    break;
  case "mms:":
    b = 0;
    c = 3;
    break;
  case "unpa":
    b = 0;
    c = 4;
    break;
  default:
    b = 0;
    c = 5
  };
  return c
};
ButtonStates = {
  normal: 0,
  hover: 1,
  down: 2
};
button = function (d, e, f) {
  this.img = Array(d, e, f);
  this.w = this.img[0].Width;
  this.h = this.img[0].Height;
  this.state = ButtonStates.normal;
  this.update = function (a, b, c) {
    this.img = Array(a, b, c)
  };
  this.draw = function (a, x, y, b) {
    this.x = x;
    this.y = y;
    this.img[this.state] && a.DrawImage(this.img[this.state], this.x, this.y, this.w, this.h, 0, 0, this.w, this.h, 0, b)
  };
  this.display_context_menu = function (x, y, a) {};
  this.repaint = function () {
    window.RepaintRect(this.x, this.y, this.w, this.h)
  };
  this.checkstate = function (a, x, y) {
    this.ishover = (x > this.x && x < this.x + this.w - 1 && y > this.y && y < this.y + this.h - 1);
    this.old = this.state;
    switch (a) {
    case "down":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.down : ButtonStates.normal;
        break
      };
      break;
    case "up":
      this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
      break;
    case "right":
      if (this.ishover) this.display_context_menu(x, y, id);
      break;
    case "move":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
        break
      };
      break;
    case "leave":
      this.state = this.isdown ? ButtonStates.down : ButtonStates.normal;
      break
    };
    if (this.state != this.old) this.repaint();
    return this.state
  }
};

function get_system_scrollbar_width() {
  var a = utils.GetSystemMetrics(SM_CXVSCROLL);
  return a
};

function get_system_scrollbar_height() {
  var a = utils.GetSystemMetrics(SM_CYHSCROLL);
  return a
};
var nocover;
var nocover_img;
var streamcover;
var star_img_off;
var star_img_on;
var star_img_hov;
var star_img_kill;
var toggle_scrollbar;
var menu_button;
cover2load = function (a, b) {
  this.item = a;
  this.timer = window.SetTimeout(function () {
    if (mycover2load.length > 0) {
      mycover2load[0].timer && window.ClearTimeout(mycover2load[0].timer);
      utils.GetAlbumArtAsync(window.ID, mycover2load[0].item.metadb, 0, true, false, false)
    }
  }, b)
};
var mycover2load = Array();
image_cache = function () {
  this._cachelist = {};
  this.hit = function (a) {
    var b = this._cachelist[a.cover_path + a.album];
    if (list.drag_stop && typeof b == "undefined") {
      mycover2load.push(new cover2load(a, (80*(mycover2load.length>0?1:0))+(9*mycover2load.length)));
    };
    return b
  };
  this.getit = function (a, b) {
    var c;
    var d = (cover.w - cover.margin * 2) * cover.quality / 100;
    var e = (cover.h - cover.margin * 2) * cover.quality / 100;
    if (a.track_type != 3) {
      if (a.metadb) {
        c = FormatCover(b, d, e);
        if (!c) {
          c = FormatCover(nocover, d, e);
          a.cover_type = 0
        } else {
          a.cover_type = 1
        }
      }
    } else if (fb.IsPlaying && fb.PlaybackLength) {
      c = FormatCover(streamcover, d, e);
      a.cover_type = 3
    } else {
      c = FormatCover(nocover, d, e);
      a.cover_type = 0
    };
    this._cachelist[a.cover_path + a.album] = c;
    return c
  }
};
var g_image_cache = new image_cache;

function FormatCover(a, w, h) {
  if (!a || w <= 0 || h <= 0) return a;
  if (cover.draw_glass_effect) {
    var b = a.Resize(w, h, 2);
    var c = b.GetGraphics();
    c.FillGradRect(0, 0, w, h, 90, RGBA(255, 255, 255, 60), RGBA(255, 255, 255, 10), 1.0);
    c.SetSmoothingMode(2);
    c.FillEllipse(-20, 25, w * 2 + 40, h * 2, RGBA(0, 0, 0, 30));
    b.ReleaseGraphics©;
    return b
  } else {
    return a.Resize(w, h, 2)
  }
};

function refresh_cover(a, b) {
  var c = 0;
  var d;
  var e = (cover.w - cover.margin * 2) * cover.quality / 100;
  var f = (cover.h - cover.margin * 2) * cover.quality / 100;
  if (a.track_type != 3) {
    if (a.metadb) {
      d = FormatCover(b, e, f);
      if (!d) {
        d = FormatCover(nocover, e, f);
        a.cover_type = 0
      } else {
        a.cover_type = 1
      }
    }
  } else if (fb.IsPlaying && fb.PlaybackLength) {
    d = FormatCover(streamcover, e, f);
    a.cover_type = 3
  } else {
    d = FormatCover(nocover, e, f);
    a.cover_type = 0
  };
  return d
};

function reset_cover_timers() {
  for (var i in mycover2load) {
    mycover2load.timer && window.ClearTimeout(mycover2load.timer)
  };
  mycover2load.splice(0, mycover2load.length)
};

function on_get_album_art_done(a, b, c, d) {
  for (var i = 0; i < mycover2load.length; i++) {
    if (mycover2load.item.metadb.Compare(a)) {
      mycover2load.item.cover_img = g_image_cache.getit(mycover2load.item, c);
      if (mycover2load.item.show) {
        window.RepaintRect(mycover2load.item.x - 2, cover.pad_top_mid, mycover2load.item.w + 4, wh - cover.pad_top_mid)
      } else {
        mycover2load.item.show = true
      };
      mycover2load.splice(i, 1);
      break
    }
  }
};
ItemStates = {
  normal: 0,
  hover: 1,
  selected: 2
};
item = function (g, h, k) {
  var i;
  if (typeof this.id == "undefined") {
    if (g < 0) {
      this.id = g;
      this.idx = h;
      this.gh_id = k;
      this.metadb = false;
      this.albumartist = "";
      this.album = "";
      this.track_type = null;
      this.cover_path = "";
      this.group_info = ""
    } else {
      this.id = g;
      this.idx = h;
      this.gh_id = k;
      this.metadb = list.handlelist.Item(this.id);
      if (this.metadb) {
        this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
        this.album = tf_album.EvalWithMetadb(this.metadb);
        this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
        this.cover_path = tf_cover_path.EvalWithMetadb(this.metadb);
        this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
      }
    }
  };
  this.update_infos = function () {
    if (this.metadb) {
      this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
      this.album = tf_album.EvalWithMetadb(this.metadb);
      this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
      this.cover_path = tf_cover_path.EvalWithMetadb(this.metadb);
      this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
    } else {
      this.albumartist = "";
      this.album = "";
      this.track_type = null;
      this.cover_path = "";
      this.group_info = ""
    }
  };
  this.draw = function (a, b, c, d, e) {
    this.show = e;
    if (list.mid == c) {
      this.w = cover.w;
      this.h = this.w;
      this.y = cover.pad_top_mid;
      this.x = Math.floor((ww / 2) - (cover.w / 2));
      this.cut = 1
    } else {
      this.w = Math.abs(d) == 1 ? cover.w - cover.normal_delta * 1 : cover.w - cover.normal_delta * 2;
      this.h = this.w;
      this.x = Math.abs(d) == 1 ? Math.floor((ww / 2) - (this.w / 2)) - (d * (this.w - 5)) : Math.floor((ww / 2) - (this.w / 2)) - (d * this.w);
      this.y = Math.abs(d) == 1 ? cover.pad_top_mid + Math.ceil(cover.normal_delta / 2) : cover.pad_top_mid + cover.normal_delta;
      this.cut = Math.abs(d) == 1 ? 1 : 0
    };
    if (this.id >= 0) {
      this.cover_img = g_image_cache.hit(this);
      if (this.show && typeof (this.cover_img) != "undefined") {
        var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
        if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
          a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y + this.h * 2 - cover.margin - 1, this.w, -1 * this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
          if (cover.draw_border) {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
          } else {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
          };
          a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w - this.cut, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
        };
        a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        if (cover.draw_border) {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
        } else {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
        };
        if (cover.draw_shadows) {
          if (d == 0 || d == 1 || d == -1) {
            for (var j = 0; j < 7; j++) {
              if (this.gh_id > 0) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              };
              if (this.gh_id < list.total_gh - 1) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              }
            }
          }
        }
      } else {
        var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
        if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
          a.DrawImage(nocover_img, Math.floor(cover.margin / 2) + this.x, this.y + this.h * 2 - cover.margin - 1, this.w, -1 * this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
          if (cover.draw_border) {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
          } else {
            a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h + 1, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
          };
          a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w - this.cut, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
        };
        a.DrawImage(nocover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
        if (cover.draw_border) {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2 + 1, this.h - cover.margin * 2 + 1, 2.0, RGB(0, 0, 0));
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(255, 255, 255))
        } else {
          a.DrawRect(Math.floor(cover.margin / 2) + this.x, this.y, this.w - cover.margin * 2, this.h - cover.margin * 2, 1.0, RGB(127, 127, 127))
        };
        if (cover.draw_shadows) {
          if (d == 0 || d == 1 || d == -1) {
            for (var j = 0; j < 7; j++) {
              if (this.gh_id > 0) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              };
              if (this.gh_id < list.total_gh - 1) {
                a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
              }
            }
          }
        }
      };
      if (cover.draw_focus_border && this.gh_id == list.selected_gh_id) {
        list.focus_id_item_idx = this.idx;
        a.SetSmoothingMode(2);
        a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 1, this.y - 1, this.w - cover.margin * 2 + 2, this.h - cover.margin * 2 + 2, 2, 2, 3.0, g_backcolor_sel);
        a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 2, this.y - 2, this.w - cover.margin * 2 + 4, this.h - cover.margin * 2 + 4, 3, 3, 1.0, RGBA(255, 255, 255, 60));
        a.SetSmoothingMode(0);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, g_backcolor_sel);
        a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, RGBA(0, 0, 0, 40))
      }
    }
  };
  this.checkstate = function (a, x, y, b) {
    if (this.id >= 0 && y > cover.pad_top_mid) {
      this.ishover = (x > this.x && x < this.x + this.w && y >= this.y && y < this.y + this.h)
    } else {
      this.ishover = false
    };
    switch (a) {
    case "down":
      if (!list.down_timerID && this.id >= 0) {
        if (plman.IsPlaylistItemSelected(panel.active_playlist, this.id)) {
          if (this.ishover) {
            if (panel.lock_playlist) {
              this.checkstate("mid", x, y, b)
            };
            SelectGroupItems(this.id, this.gh_id, true);
            g_saved = this;
            refresh_spv(panel.active_playlist, bool_on_size)
          }
        } else {
          if (this.ishover) {
            if (utils.IsKeyPressed(VK_SHIFT)) {
              if (list.focus_id != this.id) {
                if (list.SHIFT_start_id != null) {} else {}
              }
            } else if (utils.IsKeyPressed(VK_CONTROL)) {
              if (panel.lock_playlist) {
                this.checkstate("mid", x, y, b)
              } else {
                SelectGroupItems(this.id, this.gh_id, true)
              }
            } else {
              SelectGroupItems(this.id, this.gh_id, true);
              g_saved = this;
              if (panel.lock_playlist) {
                g_saved.checkstate("mid", x, y, b)
              }
            }
          }
        }
      };
      break;
    case "dblclk":
      if (this.id >= 0 && g_saved != null) {
        if (plman.IsPlaylistItemSelected(panel.active_playlist, this.id)) {
          if (panel.lock_playlist) {
            if (this.id == g_saved.id) {
              plman.ExecutePlaylistDefaultAction(panel.active_playlist, list.hlist[g_saved.gh_id]);
              g_saved = null
            }
          } else {
            if (this.id == g_saved.id) {
              plman.ExecutePlaylistDefaultAction(panel.active_playlist, list.hlist[g_saved.gh_id]);
              g_saved = null;
              window.Repaint()
            }
          }
        }
      };
      break;
    case "mid":
      if (this.ishover) {
        if (plman.GetPlaylistName(panel.active_playlist) != "CoverFlow View") {
          SelectGroupItems(this.id, this.gh_id, true);
          var c = false;
          var d = 0;
          var e = panel.active_playlist;
          for (var i = 0; i < plman.PlaylistCount; i++) {
            if (plman.GetPlaylistName(i) == "CoverFlow View") {
              c = true;
              d = i;
              break
            }
          };
          if (!c) {
            d = plman.PlaylistCount;
            plman.CreatePlaylist(plman.PlaylistCount, "CoverFlow View")
          };
          plman.ActivePlaylist = d;
          fb.ClearPlaylist();
          var f = fb.PlaylistItemCount(d);
          plman.InsertPlaylistItems(d, f, plman.GetPlaylistSelectedItems(e), false);
          plman.SetPlaylistFocusItem(d, 0)
        }
      };
      break;
    case "right":
      if (this.ishover) {
        SelectGroupItems(this.id, this.gh_id, false);
        new_context_menu(x, y, this.id, this.idx)
      };
      break;
    case "up":
      break;
    case "move":
      if (this.ishover) {}
      break;
    case "leave":
      break
    };
    return this.state
  }
};
var tf_path = fb.TitleFormat("$left(%_path_raw%,4)");
var tf_cover_path = fb.TitleFormat("$replace(%path%,%filename_ext%,)");
var tf_albumartist = fb.TitleFormat("$if(%length%,%album artist%,'Stream')");
var tf_album = fb.TitleFormat("$if2(%album%,$if(%length%,'Single','web radios'))");
var tf_group_key = fb.TitleFormat(window.GetProperty("_group Key", "%album artist%%album%"));
var tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
var g_instancetype = window.InstanceType;
var g_font = null;
var g_font_headers = null;
var ww = 0,
  wh = 0;
var mouse_x = 0,
  mouse_y = 0;
var g_textcolor = 0,
  g_textcolor_sel = 0,
  g_textcolor_hl = 0,
  g_backcolor = 0,
  g_backcolor_sel = 0;
var g_metadb;
var bool_on_size = false;
var g_search_string = "";
var incsearch_font = gdi.Font("lucida console", 9, 0);
var incsearch_font_big = gdi.Font("lucida console", 20, 1);
var clear_incsearch_timer = false;
var incsearch_timer = false;
var g_saved = null;
panel = {
  max_height: window.GetProperty("panel.maximum.height", 300),
  arr_buttons: Array(),
  button_total: 3,
  show_text: window.GetProperty("panel.album.info.visible", true),
  custom_textcolor: window.GetProperty("panel.custom.text.color.normal", ""),
  custom_textcolor_selection: window.GetProperty("panel.custom.text.color.selection", ""),
  custom_backcolor: window.GetProperty("panel.custom.background.color", ""),
  custom_textcolor_highlight: window.GetProperty("panel.custom.text.color.hightlight", ""),
  lock_playlist: window.GetProperty("panel.lock.playlist.enabled", false),
  active_playlist: window.GetProperty("panel.active.playlist", 0)
};
list = {
  first_launch: true,
  total: 0,
  total_gh: 0,
  start_id: 0,
  nbvis: 0,
  mid: 0,
  item: Array(),
  hlist: Array(),
  handlelist: null,
  metadblist_selection: plman.GetPlaylistSelectedItems(panel.active_playlist),
  focus_id: 0,
  focus_id_item_idx: 0,
  selected_gh_id: 0,
  gh_id: 0,
  mousewheel_timer_value: 20,
  key_timer_value: 60,
  nowplaying: 0,
  SHIFT_start_id: null,
  SHIFT_count: 0,
  inc_search_noresult: false,
  nb_cover_to_draw: 0,
  buttonclicked: false,
  drag_stop: true,
  drag_timer: false
};
hscrollbar = {
  theme: false,
  themed: window.GetProperty("list.hscrollbar.themed", true),
  show: window.GetProperty("list.hscrollbar.visible", true),
  visible: true,
  hover: false,
  x: 0,
  y: 0,
  default_h: get_system_scrollbar_height(),
  h: get_system_scrollbar_height(),
  w: 0,
  button_total: 2,
  step: 3,
  arr_buttons: Array(),
  letter: null,
  timerID: false
};
button_up = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  timerID: false
};
button_down = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  timerID: false
};
cursor = {
  bt: null,
  img_normal: null,
  img_hover: null,
  img_down: null,
  popup: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h + 3,
  h: hscrollbar.default_h,
  default_w: hscrollbar.default_h + 3,
  hover: false,
  drag: false,
  grap_x: 0,
  timerID: false,
  last_x: 0
};
cover = {
  margin: 2,
  w: 0,
  h: 0,
  top_offset: 0,
  default_pad_top_mid: 35,
  default_pad_bot_mid: 30,
  pad_top_mid: 35,
  pad_bot_mid: 30,
  normal_delta: 20,
  quality: window.GetProperty("list.covers.quality.percent", 100),
  draw_border: window.GetProperty("cover.draw.contrasted.border", false),
  draw_reflection: window.GetProperty("cover.draw.ground.reflection", true),
  reflect_strength_percent: window.GetProperty("cover.ground.reflection.percent", 20),
  draw_shadows: window.GetProperty("cover.draw.shadows", true),
  draw_focus_border: window.GetProperty("cover.draw.focus.border", true),
  draw_glass_effect: window.GetProperty("cover.draw.glass.effect", false)
};

function refresh_spv_cursor(a) {
  var b = (cursor.x - hscrollbar.x) / (hscrollbar.w - cursor.w);
  if (b > 1) b = 1;
  if (b < 0) b = 0;
  var r = Math.round(b * list.total_gh);
  set_gh_id(a, list.hlist[r - 1]);
  window.Repaint()
}
function set_gh_id(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(b);
  if (list.gh_id == null) {
    list.gh_id = 0
  }
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  }
};

function scrollup_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r > 0) {
    var s = list.item[0].gh_id;
    if (s > 0) {
      list.item.unshift(new item(list.hlist[s - 1], 0, s - 1))
    } else {
      list.item.unshift(new item(-1, 0, -1))
    };
    list.item.pop()
  };
  for (var i = 0; i < list.item.length; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function scrolldown_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r < list.total_gh - 1) {
    var s = list.item[list.item.length - 1].gh_id;
    if (s > 0 && s < list.total_gh - 1) {
      list.item.push(new item(list.hlist[s + 1], 0, s + 1))
    } else {
      list.item.push(new item(-1, 0, -1))
    };
    list.item.shift()
  };
  for (var i = 0; i < list.item.length; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function refresh_spv(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(list.focus_id);
  if (list.gh_id == null) {
    init_active_pls();
    return true
  }
  list.selected_gh_id = list.gh_id;
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  };
  if (hscrollbar.show) {
    if (list.total_gh < 2) hscrollbar.visible = false;
    else hscrollbar.visible = true
  } else {
    hscrollbar.visible = false
  };
  cursor.w = Math.round(hscrollbar.w / list.total_gh);
  if (cursor.w > hscrollbar.w) cursor.w = hscrollbar.w;
  if (cursor.w < cursor.default_w) cursor.w = cursor.default_w;
  set_scroller();
  setcursorx()
};

function get_gh_id(a) {
  var b = Math.floor(list.total_gh / 2);
  if (a < list.hlist) {
    var c = 0
  } else {
    var c = b
  };
  for (var i = c; i < list.total_gh; i++) {
    if (i < list.total_gh - 1) {
      if (a >= list.hlist && a < list.hlist[i + 1]) {
        return i
      }
    } else {
      if (a >= list.hlist) {
        return i
      } else {
        return null
      }
    }
  }
};

function setcursorx() {
  if (list.item.length > 0) {
    var a = Math.floor(list.item.length / 2);
    var b = list.item[a].gh_id;
    var c = b / (list.total_gh - 1);
    cursor.x = hscrollbar.x + Math.round(c * (hscrollbar.w - cursor.w))
  } else {
    cursor.x = hscrollbar.x
  }
};

function init_active_pls() {
  var a;
  var b;
  var c;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(panel.active_playlist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    if (i > 0 && i < list.total - 1) {
      i++;
      b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
      if (a != b) {
        if (i > 0) {
          c = tf_group_key.EvalWithMetadb(list.handlelist.Item(i - 1));
          if (a != c) {
            list.hlist.push(i - 1)
          };
          if (c != b) {
            list.hlist.push(i)
          }
        } else {
          list.hlist.push(i)
        };
        a = b
      }
    } else {
      b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
      if (a != b) {
        list.hlist.push(i);
        a = b
      }
    }
  };
  list.total_gh = list.hlist.length
};

function old_init_active_pls() {
  var a;
  var b;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(panel.active_playlist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
    if (a != b) {
      list.hlist.push(i);
      a = b
    }
  };
  list.total_gh = list.hlist.length
};

function on_font_changed() {
  get_font();
  on_playlist_switch()
};

function on_colors_changed() {
  get_colors();
  init_icons();
  nocover_img = FormatCover(nocover, (cover.w - cover.margin * 2) * cover.quality / 100, (cover.h - cover.margin * 2) * cover.quality / 100);
  init_hscrollbar_buttons();
  set_scroller();
  g_image_cache = new image_cache;
  CollectGarbage();
  on_playlist_switch()
};

function on_init() {};

function on_size() {
  if (!window.Width || !window.Height) return;
  window.DlgCode = DLGC_WANTALLKEYS;
  bool_on_size = true;
  if (g_instancetype == 0) {
    window.MinWidth = 200;
    window.MinHeight = 170;
    window.MaxHeight = panel.max_height
  } else if (g_instancetype == 1) {
    window.MinWidth = 200;
    window.MinHeight = 170;
    window.MaxHeight = panel.max_height
  };
  ww = window.Width;
  wh = window.Height;
  if (wh < 170) wh = 170;
  var a = window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  if (a == "") window.SetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
  get_font();
  get_colors();
  init_icons();
  if (hscrollbar.show) {
    cover.pad_bot_mid = cover.default_pad_bot_mid
  } else {
    cover.pad_bot_mid = cover.default_pad_bot_mid - hscrollbar.default_h
  }
  if (panel.show_text) {
    cover.pad_top_mid = cover.default_pad_top_mid
  } else {
    cover.pad_top_mid = cover.default_pad_top_mid - 16
  };
  cover.w = wh - cover.pad_top_mid - cover.pad_bot_mid;
  cover.h = cover.w;
  list.nbvis = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2;
  if (list.nbvis / 2 == Math.floor(list.nbvis / 2)) {
    list.nbvis--
  }
  list.mid = Math.floor(list.nbvis / 2);
  list.nb_cover_to_draw = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2;
  if (hscrollbar.themed) {
    hscrollbar.theme = window.CreateThemeManager("scrollbar")
  } else {
    hscrollbar.theme = false
  };
  init_hscrollbar_buttons();
  button_up.x = 0;
  button_up.y = wh - hscrollbar.h;
  button_down.x = ww - button_down.w;
  button_down.y = wh - hscrollbar.h;
  hscrollbar.x = button_up.w;
  hscrollbar.w = ww - button_up.w - button_down.w;
  cursor.y = wh - hscrollbar.h;
  cursor.x = hscrollbar.x;
  nocover_img = FormatCover(nocover, (cover.w - cover.margin * 2) * cover.quality / 100, (cover.h - cover.margin * 2) * cover.quality / 100);
  if (list.first_launch) {
    list.first_launch = false;
    on_playlist_switch()
  } else {
    g_image_cache = new image_cache;
    CollectGarbage();
    refresh_spv(panel.active_playlist, true)
  }
};

function on_paint(a) {
  a.FillGradRect(0, 0, ww, wh, 90, g_backcolor, g_backcolor & 0xd0ffffff, 0.3);
  if (list.item.length > 0) {
    var b, mid2;
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    for (var c = 1; c < list.mid + 1; c++) {
      if (c > 1 && c <= list.mid) {
        b = true
      } else {
        b = false
      };
      mid2 = list.mid - c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c, b)
      }
      mid2 = list.mid + c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c * -1, b)
      }
    };
    mid2 = list.mid - 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, 1, true)
    }
    mid2 = list.mid + 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, -1, true)
    }
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    if (panel.show_text) {
      var d = panel.lock_playlist ? 32 : 60;
      var f = panel.lock_playlist ? ww - 64 : ww - 120;
      if (list.item[list.mid].id >= 0) {
        a.GdiDrawText(list.item[list.mid].group_info, g_font, g_textcolor, d, 0, f, cover.pad_top_mid - 4, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
      }
    }
  };
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    try {
      hscrollbar.theme.SetPartAndStateId(4, 1);
      hscrollbar.theme.DrawThemeBackground(a, 0, wh - hscrollbar.h, ww, hscrollbar.h);
      a.FillSolidRect(0, wh - hscrollbar.h - 1, ww, 1, RGBA(0, 0, 0, 10))
    } catch (e) {
      a.FillSolidRect(0, wh - hscrollbar.h, ww, hscrollbar.h, g_backcolor & 0x77ffffff);
      a.FillSolidRect(0, wh - hscrollbar.h, ww, 1, RGBA(0, 0, 0, 20))
    };
    try {
      cursor.bt.draw(a, cursor.x, cursor.y, 255)
    } catch (e) {};
    try {
      hscrollbar.theme.SetPartAndStateId(8, 1);
      hscrollbar.theme.DrawThemeBackground(a, cursor.x, wh - hscrollbar.h + 0, cursor.w, cursor.h)
    } catch (e) {};
    for (i = 0; i < hscrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        hscrollbar.arr_buttons.draw(a, button_up.x, button_up.y, 255);
        break;
      case 1:
        hscrollbar.arr_buttons.draw(a, button_down.x, button_down.y, 255);
        break
      }
    };
    if (cursor.drag) {
      hscrollbar.letter = list.item[Math.floor(list.nbvis / 2)].albumartist.substring(0, 1).toUpperCase();
      cursor.popup && a.DrawImage(cursor.popup, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height, 0, 0, cursor.popup.Width, cursor.popup.Height, 0, 155);
      cursor.popup && a.GdiDrawText(hscrollbar.letter, gdi.Font("segoe ui", 14, 0), g_backcolor, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height - 5, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
    }
  };
  for (i = 0; i < panel.arr_buttons.length; i++) {
    switch (i) {
    case 0:
      if (!panel.lock_playlist) {
        panel.arr_buttons.draw(a, 30, 5, 255)
      }
      break;
    case 1:
      panel.arr_buttons.draw(a, ww - 22 - 5, 5, 255);
      break;
    case 2:
      panel.arr_buttons.draw(a, 5, 5, 255);
      break
    }
  };
  a.FillGradRect(0, 0, ww, 1, 0, 0, g_textcolor & 0x15ffffff, 0.5)
};

function on_mouse_lbtn_down(x, y) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("down", x, y, i)
  };
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    if (cursor.bt.checkstate("down", x, y) == ButtonStates.down) {
      cursor.drag = true;
      cursor.grap_x = x - cursor.x;
      cursor.last_x = cursor.x
    };
    if (hscrollbar.hover && !cursor.drag) {
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      if (x < cursor.x) {
        if (!list.buttonclicked) {
          list.buttonclicked = true;
          on_mouse_wheel(hscrollbar.step);
          button_up.first_timerID = window.SetTimeout(function () {
            on_mouse_wheel(hscrollbar.step);
            button_up.timerID = window.SetInterval(function () {
              if (hscrollbar.hover) {
                if (mouse_y > wh - hscrollbar.h && cursor.x > mouse_x) {
                  on_mouse_wheel(hscrollbar.step)
                }
              }
            }, list.key_timer_value)
          }, 400)
        }
      } else {
        if (!list.buttonclicked) {
          list.buttonclicked = true;
          on_mouse_wheel(-1 * hscrollbar.step);
          button_down.first_timerID = window.SetTimeout(function () {
            on_mouse_wheel(-1 * hscrollbar.step);
            button_down.timerID = window.SetInterval(function () {
              if (hscrollbar.hover) {
                if (mouse_y > wh - hscrollbar.h && cursor.x + cursor.w < mouse_x) {
                  on_mouse_wheel(-1 * hscrollbar.step)
                }
              }
            }, list.key_timer_value)
          }, 400)
        }
      }
    };
    for (i = 0; i < hscrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (hscrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(1);
            button_up.first_timerID = window.SetTimeout(function () {
              reset_cover_timers();
              button_up.timerID = window.SetInterval(function () {
                on_mouse_wheel(1)
              }, list.key_timer_value)
            }, 400)
          }
        };
        break;
      case 1:
        if (hscrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1);
            button_down.first_timerID = window.SetTimeout(function () {
              reset_cover_timers();
              button_down.timerID = window.SetInterval(function () {
                on_mouse_wheel(-1)
              }, list.key_timer_value)
            }, 400)
          }
        };
        break
      }
    }
  };
  for (var i = 0; i < panel.arr_buttons.length; i++) {
    panel.arr_buttons.checkstate("down", x, y)
  }
};

function on_mouse_lbtn_dblclk(x, y, a) {
  if (y < cover.pad_top_mid) {} else if (y < wh - cover.pad_bot_mid) {
    for (var i = 0; i < list.item.length; i++) {
      list.item.checkstate("dblclk", x, y, i)
    }
  } else {
    on_mouse_lbtn_down(x, y)
  }
};

function on_mouse_lbtn_up(x, y) {
  list.buttonclicked = false;
  hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
  hscrollbar.timerID = false;
  button_up.first_timerID && window.ClearTimeout(button_up.first_timerID);
  button_up.first_timerID = false;
  button_down.first_timerID && window.ClearTimeout(button_down.first_timerID);
  button_down.first_timerID = false;
  button_up.timerID && window.ClearInterval(button_up.timerID);
  button_up.timerID = false;
  button_down.timerID && window.ClearInterval(button_down.timerID);
  button_down.timerID = false;
  if (list.drag_timer) {
    window.ClearTimeout(list.drag_timer);
    list.drag_timer = false;
    list.drag_stop = true
  }
  if (list.total_gh > 0) {
    cursor.bt.checkstate("up", x, y);
    for (var i = 0; i < hscrollbar.arr_buttons.length; i++) {
      hscrollbar.arr_buttons.checkstate("up", x, y)
    };
    for (i = 0; i < panel.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
          ShowNowPlaying()
        };
        break;
      case 1:
        if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
          settings_menu(x, y)
        };
        break;
      case 2:
        if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
          if (panel.lock_playlist) {
            panel.lock_playlist = false;
            window.SetProperty("panel.lock.playlist.enabled", panel.lock_playlist);
            plman.ActivePlaylist = panel.active_playlist
          } else {
            panel.lock_playlist = true;
            window.SetProperty("panel.lock.playlist.enabled", panel.lock_playlist);
            panel.active_playlist = plman.ActivePlaylist;
            window.SetProperty("panel.active.playlist", panel.active_playlist);
            var a = Math.floor(list.nbvis / 2);
            a = list.focus_id_item_idx;
            list.item[a].checkstate("mid", list.item[a].x + 5, list.item[a].y + 5, a)
          };
          if (panel.lock_playlist) {
            panel.arr_buttons[2].update(lock_button_normal, lock_button_hover, lock_button_down)
          } else {
            panel.arr_buttons[2].update(unlock_button_normal, unlock_button_hover, unlock_button_down)
          }
        };
        break
      }
    };
    if (cursor.drag) {
      window.RepaintRect(0, wh - hscrollbar.h, ww, hscrollbar.h);
      cursor.drag = false
    } else {
      for (i = 0; i < list.item.length; i++) {
        list.item.checkstate("up", x, y, i)
      }
    };
    setcursorx();
    window.Repaint()
  }
};

function on_mouse_mbtn_down(x, y, a) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("mid", x, y, i)
  }
};

function on_mouse_rbtn_down(x, y) {
  bool_on_size = false;
  for (var i = 0; i < list.item.length; i++) {
    list.item.checkstate("right", x, y, i)
  }
};

function on_mouse_move(x, y) {
  if (x == mouse_x && y == mouse_y) return true;
  if (cursor.drag) {
    list.drag_stop = false;
    if (list.drag_timer) {
      window.ClearTimeout(list.drag_timer);
      list.drag_timer = false
    }
    list.drag_timer = window.SetTimeout(function () {
      list.drag_stop = true;
      window.ClearTimeout(list.drag_timer);
      list.drag_timer = false;
      window.Repaint()
    }, 260)
  } else {
    list.drag_stop = true
  };
  if (list.total_gh > 0 && hscrollbar.visible && hscrollbar.show) {
    hscrollbar.hover = (y >= wh - hscrollbar.h && y <= wh && x >= hscrollbar.x && x <= hscrollbar.x + hscrollbar.w);
    cursor.hover = (x >= cursor.x && x <= cursor.x + cursor.w && y >= cursor.y && y <= cursor.y + cursor.h);
    cursor.bt.checkstate("move", x, y);
    for (var i = 0; i < hscrollbar.arr_buttons.length; i++) {
      hscrollbar.arr_buttons.checkstate("move", x, y)
    };
    if (cursor.drag && mouse_x != x) {
      reset_cover_timers();
      cursor.x = x - cursor.grap_x;
      if (cursor.x < hscrollbar.x) cursor.x = hscrollbar.x;
      if (cursor.x > hscrollbar.x + hscrollbar.w - cursor.w) cursor.x = hscrollbar.x + hscrollbar.w - cursor.w;
      if (!cursor.timerID) {
        cursor.timerID = window.SetTimeout(function () {
          refresh_spv_cursor(panel.active_playlist);
          cursor.timerID && window.ClearTimeout(cursor.timerID);
          cursor.timerID = false
        }, 30)
      }
    }
  };
  for (var j = 0; j < panel.arr_buttons.length; j++) {
    panel.arr_buttons[j].checkstate("move", x, y)
  };
  mouse_x = x;
  mouse_y = y
};

function on_mouse_wheel(a) {
  reset_cover_timers();
  if (!hscrollbar.timerID) {
    if (Math.abs(a) >= 1) {
      if (a > 0) {
        for (var i = 0; i < Math.abs(a); i++) {
          scrollup_spv(panel.active_playlist)
        };
        hscrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
          hscrollbar.timerID = false
        }, list.mousewheel_timer_value)
      } else {
        for (var i = 0; i < Math.abs(a); i++) {
          scrolldown_spv(panel.active_playlist)
        }
        hscrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          hscrollbar.timerID && window.ClearTimeout(hscrollbar.timerID);
          hscrollbar.timerID = false
        }, list.mousewheel_timer_value)
      }
    }
  }
};

function on_mouse_leave() {
  for (i = 0; i < list.item.length; i++) {
    list.item.checkstate("leave", 0, 0, i)
  };
  window.Repaint()
};

function on_playlist_switch() {
  if (!panel.lock_playlist) {
    panel.active_playlist = plman.ActivePlaylist
  };
  if (plman.ActivePlaylist < 0 || plman.ActivePlaylist > fb.PlaylistCount) {
    if (fb.PlaylistCount > 0) {
      plman.ActivePlaylist = 0
    }
  };
  init_active_pls();
  list.focus_id = plman.GetPlaylistFocusItemIndex(panel.active_playlist);
  if (list.focus_id < 0) {
    list.focus_id = 0
  }
  refresh_spv(panel.active_playlist, true);
  window.Repaint()
};

function on_playlist_items_added(a) {
  if (a == panel.active_playlist) {
    on_playlist_switch()
  };
  plman.SetActivePlaylistContext()
};

function on_playlist_items_reordered(a) {
  if (a == panel.active_playlist) {
    on_playlist_switch()
  }
};

function on_selection_changed(a) {};

function on_playlist_items_selection_change() {};

function on_playlists_changed() {
  if (panel.lock_playlist) {
    panel.lock_playlist = !panel.lock_playlist;
    window.SetProperty("panel.lock.playlist.enabled", panel.lock_playlist);
    plman.ActivePlaylist = panel.active_playlist
  }
};

function on_item_focus_change(a, b, c) {
  if (a == panel.active_playlist) {
    list.focus_id = c;
    plman.SetActivePlaylistContext();
    refresh_spv(panel.active_playlist, bool_on_size);
    bool_on_size = false;
    window.Repaint()
  }
};

function on_metadb_changed(a, b) {
  for (var i = 0; i < list.item.length; i++) {
    list.item.update_infos()
  };
  window.Repaint()
};

function on_focus(a) {};

function on_key_up(a) {};

function on_key_down(a) {
  var b = GetKeyboardMask();
  if (b == KMask.none) {
    switch (a) {
    case VK_SHIFT:
      list.SHIFT_count = 0;
      break;
    case VK_BACK:
      break;
    case VK_ESCAPE:
    case 222:
      break;
    case VK_SPACEBAR:
      if (panel.lock_playlist) {
        plman.SetPlaylistFocusItem(panel.active_playlist, d);
        plman.ClearPlaylistSelection(panel.active_playlist);
        plman.SetPlaylistSelectionSingle(panel.active_playlist, d, true);
        var c = Math.floor(list.nbvis / 2);
        list.item[c].checkstate("mid", list.item[c].x + 5, list.item[c].y + 5, c)
      } else {
        var d = list.item[Math.floor(list.nbvis / 2)].id;
        SelectGroupItems(d, get_gh_id(d), true)
      };
      break;
    case VK_LEFT:
      on_mouse_wheel(1);
      break;
    case VK_RIGHT:
      on_mouse_wheel(-1);
      break;
    case VK_PGUP:
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      on_mouse_wheel(hscrollbar.step);
      break;
    case VK_PGDN:
      hscrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
      if (hscrollbar.step < 1) hscrollbar.step = 1;
      on_mouse_wheel(hscrollbar.step * -1);
      break;
    case VK_RETURN:
      plman.ExecutePlaylistDefaultAction(panel.active_playlist, list.focus_id);
      break;
    case VK_END:
      plman.SetPlaylistFocusItem(panel.active_playlist, list.total - 1);
      plman.ClearPlaylistSelection(panel.active_playlist);
      plman.SetPlaylistSelectionSingle(panel.active_playlist, list.total - 1, true);
      break;
    case VK_HOME:
      plman.SetPlaylistFocusItem(panel.active_playlist, 0);
      plman.ClearPlaylistSelection(panel.active_playlist);
      plman.SetPlaylistSelectionSingle(panel.active_playlist, 0, true);
      break;
    case VK_DELETE:
      if (!fb.IsAutoPlaylist(panel.active_playlist)) {
        plman.RemovePlaylistSelection(panel.active_playlist, false);
        plman.SetPlaylistSelectionSingle(panel.active_playlist, plman.GetPlaylistFocusItemIndex(panel.active_playlist), true)
      }
      break;
    default:
      break
    }
  } else {
    switch (b) {
    case KMask.shift:
      break;
    case KMask.ctrl:
      if (a == 65) {
        fb.RunMainMenuCommand("Edit/Select all");
        window.Repaint()
      };
      if (a == 70) {
        fb.RunMainMenuCommand("Edit/Search")
      };
      if (a == 78) {
        fb.RunMainMenuCommand("File/New playlist")
      };
      if (a == 79) {
        fb.RunMainMenuCommand("File/Open...")
      };
      if (a == 80) {
        fb.RunMainMenuCommand("File/Preferences")
      };
      if (a == 83) {
        fb.RunMainMenuCommand("File/Save playlist...")
      };
      break;
    case KMask.alt:
      if (a == 65) {
        fb.RunMainMenuCommand("View/Always on Top")
      };
      break
    }
  }
};

function on_playback_new_track(a) {
  g_metadb = fb.GetNowPlaying();
  window.Repaint()
};

function on_playback_stop(a) {
  if (a == 0) {
    g_metadb = fb.GetFocusItem();
    on_metadb_changed()
  }
};

function on_playback_pause(a) {};

function on_playback_time(a) {};

function get_font() {
  if (g_instancetype == 0) {
    g_font = window.GetFontCUI(FontTypeCUI.items);
    g_font_headers = window.GetFontCUI(FontTypeCUI.labels)
  } else if (g_instancetype == 1) {
    g_font = window.GetFontDUI(FontTypeDUI.playlists);
    g_font_headers = window.GetFontDUI(FontTypeDUI.tabs)
  }
};

function get_colors() {
  if (g_instancetype == 0) {
    g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
    g_textcolor_sel = window.GetColorCUI(ColorTypeCUI.selection_text);
    g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.active_item_frame);
    g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
    g_backcolor_sel = window.GetColorCUI(ColorTypeCUI.selection_background)
  } else if (g_instancetype == 1) {
    g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
    g_textcolor_sel = window.GetColorDUI(ColorTypeDUI.selection);
    g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
    g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
    g_backcolor_sel = g_textcolor_sel
  };
  try {
    if (panel.custom_textcolor.length > 0) g_textcolor = eval(panel.custom_textcolor);
    if (panel.custom_textcolor_selection.length > 0) g_textcolor_sel = eval(panel.custom_textcolor_selection);
    if (panel.custom_backcolor.length > 0) g_backcolor = eval(panel.custom_backcolor);
    if (panel.custom_textcolor_highlight.length > 0) g_textcolor_hl = eval(panel.custom_textcolor_highlight)
  } catch (e) {};
  g_backcolor_R = getRed(g_backcolor);
  g_backcolor_G = getGreen(g_backcolor);
  g_backcolor_B = getBlue(g_backcolor)
};

function set_scroller() {
  var a;
  try {
    cursor.img_normal = gdi.CreateImage(cursor.w, cursor.h)
  } catch (e) {
    cursor.h = cursor.default_h;
    cursor.img_normal = gdi.CreateImage(cursor.w, cursor.h)
  };
  a = cursor.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(2, 1);
    hscrollbar.theme.DrawThemeBackground(a, 0, 0, cursor.w, cursor.h)
  } catch (e) {
    a.FillSolidRect(0, 3, cursor.w, cursor.h - 5, g_textcolor & 0x44ffffff)
  };
  cursor.img_normal.ReleaseGraphics(a);
  cursor.img_hover = gdi.CreateImage(cursor.w, cursor.h);
  a = cursor.img_hover.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(2, 2);
    hscrollbar.theme.DrawThemeBackground(a, 0, 0, cursor.w, cursor.h)
  } catch (e) {
    a.FillSolidRect(0, 3, cursor.w, cursor.h - 5, g_textcolor & 0x88ffffff)
  };
  cursor.img_hover.ReleaseGraphics(a);
  cursor.bt = new button(cursor.img_normal, cursor.img_hover, cursor.img_hover)
};

function init_hscrollbar_buttons() {
  var i, gb;
  cursor.popup = gdi.CreateImage(22, 27);
  gb = cursor.popup.GetGraphics();
  gb.SetSmoothingMode(2);
  gb.FillRoundRect(0, 0, 22 - 1, 22 - 1, 3, 3, g_textcolor);
  gb.DrawRoundRect(0, 0, 22 - 1, 22 - 1, 3, 3, 1.0, RGBA(0, 0, 0, 150));
  var a = Array(7, 22 - 2, 11, 22 - 2 + 6, 22 - 7, 22 - 2);
  gb.FillPolygon(g_textcolor, 0, a);
  gb.DrawPolygon(RGBA(0, 0, 0, 150), 1.0, a);
  gb.SetSmoothingMode(0);
  gb.FillSolidRect(6, 22 - 4, 22 - 10, 3, g_textcolor);
  cursor.popup.ReleaseGraphics(gb);
  button_up.img_normal = gdi.CreateImage(button_up.w, button_up.h);
  gb = button_up.img_normal.GetGraphics();
  try {
    hscrollbar.theme.SetPartAndStateId(1, 9);
    hscrollbar.theme.DrawThemeBackground(gb, 0, 0, button_up.w, button_up.h)
  } catch (e) {
    gb.SetTextRenderingHint(4);
    gui_font = gdi.Font("guifx v2 transports", 12, 0);
    gb.DrawString("<", gui_font, RGBA(255, 255, 255, 25), 1, 0, button_up.w, button_up.h, cc_stringformat);
    gb.DrawString("<", gui_font, g_textcolor & 0x44ffffff, 0, 0, button_up.w, button_up.h, cc_stringformat)
  };
  button_up.img_normal.ReleaseGraphics(gb);
  button_up.img_hover = gdi.CreateImage(button_up.w, button_up.h);
  gb = bu
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-03-28 01:32:10
marc2003: Could you please help me to add a little space between the stars in your ratings script?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-03-28 05:11:43
using paint.net you could make the images with a gap around the edge. you need to edit on.png and off.png in the marc2003\images folder. image menu>canvas size and make sure the anchor is in the middle. then select and delete the border so it's transparent.

then update the bw and bh variables at the top of the script to the size of these new images.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-03-28 12:57:43
That was simple. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-03-30 18:51:03
WSH CoverFlow v1 beta6

[code]// ==PREPROCESSOR==
// @name "CoverFlow View v1 beta6"
// @version "0.0.6.20120330.1917"
// @author "Br3tt"
// @feature "v1.4"
// @feature "watch-metadb"
// @feature "dragdrop"
// ==/PREPROCESSOR==

// [Requirements]
// * foobar2000 v1.1 or better  >> http://foobar2000.org (http://foobar2000.org)
// * WSH panel Mod v1.5.2 or better  >> http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
// [/Requirements]

// * !!! Keep a reasonable size for the panel to avoid bad perf! Loading and Displaying too big or too much covers can be a nightmare for your CPU!

// [Informations]
// * change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI
// * Some Settings can be changed in window Properties (right click empty space > Properties)
//  e.g. for custom colors in Properties, use e.g. RGB(255,255,255) for white color, RGB(0,0,0) for black color, ...
// * middle click on cover > Send album tracks to specific playlist "CoverFlow View"
// * keyboard keys : left/right arrows, Home/End, page up/down, spacebar to set focus on the centered album, Return key to play ...
// [/Informations]

SM_CXVSCROLL = 2;
SM_CYHSCROLL = 3;
DLGC_WANTARROWS = 0x0001;
DLGC_WANTALLKEYS = 0x0004;
MF_STRING = 0x00000000;
MF_SEPARATOR = 0x00000800;
MF_GRAYED = 0x00000001;
MF_DISABLED = 0x00000002;
MF_POPUP = 0x00000010;
IDC_ARROW = 32512;
IDC_IBEAM = 32513;
IDC_WAIT = 32514;
IDC_CROSS = 32515;
IDC_UPARROW = 32516;
IDC_SIZE = 32640;
IDC_ICON = 32641;
IDC_SIZENWSE = 32642;
IDC_SIZENESW = 32643;
IDC_SIZEWE = 32644;
IDC_SIZENS = 32645;
IDC_SIZEALL = 32646;
IDC_NO = 32648;
IDC_APPSTARTING = 32650;
IDC_HAND = 32649;
IDC_HELP = 32651;
var DT_LEFT = 0x00000000;
var DT_RIGHT = 0x00000002;
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_EDITCONTROL = 0x00002000;
var DT_END_ELLIPSIS = 0x00008000;
var VK_BACK = 0x08;
var VK_RETURN = 0x0D;
var VK_SHIFT = 0x10;
var VK_CONTROL = 0x11;
var VK_ALT = 0x12;
var VK_ESCAPE = 0x1B;
var VK_PGUP = 0x21;
var VK_PGDN = 0x22;
var VK_END = 0x23;
var VK_HOME = 0x24;
var VK_LEFT = 0x25;
var VK_UP = 0x26;
var VK_RIGHT = 0x27;
var VK_DOWN = 0x28;
var VK_INSERT = 0x2D;
var VK_DELETE = 0x2E;
var VK_SPACEBAR = 0x20;
var KMask = {
  none: 0,
  ctrl: 1,
  shift: 2,
  ctrlshift: 3,
  ctrlalt: 4,
  ctrlaltshift: 5,
  alt: 6
};

function GetKeyboardMask() {
  var c = utils.IsKeyPressed(VK_CONTROL) ? true : false;
  var a = utils.IsKeyPressed(VK_ALT) ? true : false;
  var s = utils.IsKeyPressed(VK_SHIFT) ? true : false;
  var b = KMask.none;
  if (c && !a && !s) b = KMask.ctrl;
  if (!c && !a && s) b = KMask.shift;
  if (c && !a && s) b = KMask.ctrlshift;
  if (c && a && !s) b = KMask.ctrlalt;
  if (c && a && s) b = KMask.ctrlaltshift;
  if (!c && a && !s) b = KMask.alt;
  return b
};
ColorTypeCUI = {
  text: 0,
  selection_text: 1,
  inactive_selection_text: 2,
  background: 3,
  selection_background: 4,
  inactive_selection_background: 5,
  active_item_frame: 6
};
FontTypeCUI = {
  items: 0,
  labels: 1
};
ColorTypeDUI = {
  text: 0,
  background: 1,
  highlight: 2,
  selection: 3
};
FontTypeDUI = {
  defaults: 0,
  tabs: 1,
  lists: 2,
  playlists: 3,
  statusbar: 4,
  console: 5
};

function StringFormat() {
  var a = 0,
    v_align = 0,
    trimming = 0,
    flags = 0;
  switch (arguments.length) {
  case 3:
    trimming = arguments[2];
  case 2:
    v_align = arguments[1];
  case 1:
    a = arguments[0];
    break;
  default:
    return 0
  };
  return ((a << 28) | (v_align << 24) | (trimming << 20) | flags)
};
StringAlignment = {
  Near: 0,
  Centre: 1,
  Far: 2
};
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);

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 getAlpha(a) {
  return ((a >> 24) & 0xff)
}
function getRed(a) {
  return ((a >> 16) & 0xff)
}
function getGreen(a) {
  return ((a >> 8) & 0xff)
}
function getBlue(a) {
  return (a & 0xff)
}
function num(a, b) {
  var i;
  var c = a.toString();
  var k = b - c.length;
  if (k > 0) {
    for (i = 0; i < k; i++) {
      c = "0" + c
    }
  };
  return c.toString()
};

function TrackType(a) {
  var b;
  var c;
  switch (a) {
  case "file":
    b = 1;
    c = 0;
    break;
  case "cdda":
    b = 1;
    c = 1;
    break;
  case "FOO_":
    b = 0;
    c = 2;
    break;
  case "http":
    b = 0;
    c = 3;
    break;
  case "mms:":
    b = 0;
    c = 3;
    break;
  case "unpa":
    b = 0;
    c = 4;
    break;
  default:
    b = 0;
    c = 5
  };
  return c
};
ButtonStates = {
  normal: 0,
  hover: 1,
  down: 2
};
button = function (d, e, f) {
  this.img = Array(d, e, f);
  this.w = this.img[0].Width;
  this.h = this.img[0].Height;
  this.state = ButtonStates.normal;
  this.update = function (a, b, c) {
    this.img = Array(a, b, c)
  };
  this.draw = function (a, x, y, b) {
    this.x = x;
    this.y = y;
    this.img[this.state] && a.DrawImage(this.img[this.state], this.x, this.y, this.w, this.h, 0, 0, this.w, this.h, 0, b)
  };
  this.display_context_menu = function (x, y, a) {};
  this.repaint = function () {
    window.RepaintRect(this.x, this.y, this.w, this.h)
  };
  this.checkstate = function (a, x, y) {
    this.ishover = (x > this.x && x < this.x + this.w - 1 && y > this.y && y < this.y + this.h - 1);
    this.old = this.state;
    switch (a) {
    case "down":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.down : ButtonStates.normal;
        break
      };
      break;
    case "up":
      this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
      break;
    case "right":
      if (this.ishover) this.display_context_menu(x, y, id);
      break;
    case "move":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
        break
      };
      break;
    case "leave":
      this.state = this.isdown ? ButtonStates.down : ButtonStates.normal;
      break
    };
    if (this.state != this.old) this.repaint();
    return this.state
  }
};

function get_system_scrollbar_width() {
  var a = utils.GetSystemMetrics(SM_CXVSCROLL);
  return a
};

function get_system_scrollbar_height() {
  var a = utils.GetSystemMetrics(SM_CYHSCROLL);
  return a
};
var nocover;
var nocover_img;
var streamcover;
var streamcover_img;
var loading;
var loading_img;
var star_img_off;
var star_img_on;
var star_img_hov;
var star_img_kill;
var toggle_scrollbar;
var menu_button;
image_cache = function () {
  this._cachelist = {};
  this.hit = function (a) {
    var b = this._cachelist[a.metadb.Path];
    if (list.drag_stop && typeof b == "undefined") {
      if (!cover.load_timer) {
        cover.load_timer = window.SetTimeout(function () {
          utils.GetAlbumArtAsync(window.ID, a.metadb, 0, true, false, false);
          cover.load_timer && window.ClearTimeout(cover.load_timer);
          cover.load_timer = false
        }, 35)
      }
    };
    return b
  };
  this.getit = function (a, b) {
    var c;
    var d = (cover.w - cover.margin * 2) * cover.quality / 100;
    var e = (cover.h - cover.margin * 2) * cover.quality / 100;
    if (a.track_type != 3) {
      if (a.metadb) {
        c = FormatCover(b, d, e);
        if (!c) {
          c = nocover_img;
          a.cover_type = 0
        } else {
          a.cover_type = 1
        }
      }
    } else if (fb.IsPlaying && fb.PlaybackLength) {
      c = streamcover_img;
      a.cover_type = 3
    } else {
      c = nocover_img;
      a.cover_type = 0
    };
    this._cachelist[a.metadb.Path] = c;
    return c
  }
};
var g_image_cache = new image_cache;

function FormatCover(a, w, h) {
  if (!a || w <= 0 || h <= 0) return a;
  if (cover.draw_glass_effect) {
    var b = a.Resize(w, h, 2);
    var c = b.GetGraphics();
    c.FillGradRect(0, 0, w, h, 90, RGBA(255, 255, 255, 60), RGBA(255, 255, 255, 10), 1.0);
    c.SetSmoothingMode(2);
    c.FillEllipse(-20, 25, w * 2 + 40, h * 2, RGBA(0, 0, 0, 30));
    b.ReleaseGraphics©;
    return b
  } else {
    var b = a.Resize(w, h, 2);
    var c = b.GetGraphics();
    c.DrawRect(0, 0, w, h, 2.0, RGB(110, 110, 110));
    b.ReleaseGraphics©;
    return b
  }
};

function reset_cover_timers() {
  cover.load_timer && window.ClearTimeout(cover.load_timer);
  cover.load_timer = false
};

function on_get_album_art_done(a, b, c, d) {
  var e = list.item.length;
  for (var i = 0; i < e; i++) {
    if (list.item.metadb) {
      if (list.item.metadb.Compare(a)) {
        list.item.cover_img = g_image_cache.getit(list.item, c);
        if (list.item.show) {
          if (panel.vertical_mode) {
            window.RepaintRect(cover.pad_left_mid, list.item.y - 2, ww - cover.pad_left_mid, list.item.h + 4)
          } else {
            window.RepaintRect(list.item.x - 2, cover.pad_top_mid, list.item.w + 4, wh - cover.pad_top_mid)
          }
        } else {
          list.item.show = true
        };
        break
      }
    }
  }
};
ItemStates = {
  normal: 0,
  hover: 1,
  selected: 2
};
item = function (h, k, l) {
  var i;
  if (typeof this.id == "undefined") {
    if (h < 0) {
      this.id = h;
      this.idx = k;
      this.gh_id = l;
      this.metadb = false;
      this.albumartist = "";
      this.track_type = null;
      this.group_info = ""
    } else {
      this.id = h;
      this.idx = k;
      this.gh_id = l;
      this.metadb = list.handlelist.Item(this.id);
      if (this.metadb) {
        this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
        this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
        this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
      }
    }
  };
  this.update_infos = function () {
    if (this.metadb) {
      this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
      this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
      this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
    } else {
      this.albumartist = "";
      this.track_type = null;
      this.group_info = ""
    }
  };
  this.draw = function (a, b, c, d, e) {
    if (panel.vertical_mode) {
      this.show = e;
      if (list.mid == c) {
        this.h = cover.h;
        this.w = cover.h;
        this.x = cover.pad_left_mid;
        this.y = Math.floor((wh / 2) - (cover.h / 2));
        this.cut = 1
      } else {
        this.h = Math.abs(d) == 1 ? cover.h - cover.normal_delta * 1 : cover.h - cover.normal_delta * 2;
        this.w = this.h;
        this.y = Math.abs(d) == 1 ? Math.floor((wh / 2) - (this.h / 2)) - (d * (this.h - 5)) : Math.floor((wh / 2) - (this.h / 2)) - (d * this.h);
        this.x = Math.abs(d) == 1 ? cover.pad_left_mid + Math.ceil(cover.normal_delta / 2) : cover.pad_left_mid + cover.normal_delta;
        this.cut = Math.abs(d) == 1 ? 1 : 0
      };
      if (this.id >= 0) {
        this.cover_img = g_image_cache.hit(this);
        if (this.show && typeof (this.cover_img) != "undefined") {
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y - j - cover.margin + 1, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y + this.h - cover.margin + j - 2, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          };
          a.DrawImage(this.cover_img, this.x, Math.floor(cover.margin / 2) + this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255)
        } else {
          a.DrawImage(loading_img, this.x, Math.floor(cover.margin / 2) + this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255);
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y - j - cover.margin + 1, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y + this.h - cover.margin + j - 2, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          }
        };
        if (this.gh_id == list.selected_gh_id) {
          list.focus_id_item_idx = this.idx;
          if (cover.draw_focus_border) {
            a.SetSmoothingMode(2);
            a.DrawRoundRect(this.x - 1, Math.floor(cover.margin / 2) + this.y - 1, this.w - cover.margin * 2 + 2, this.h - cover.margin * 2 + 2, 2, 2, 3.0, g_backcolor_sel);
            a.DrawRoundRect(this.x - 2, Math.floor(cover.margin / 2) + this.y - 2, this.w - cover.margin * 2 + 4, this.h - cover.margin * 2 + 4, 3, 3, 1.0, RGBA(255, 255, 255, 60));
            a.SetSmoothingMode(0);
            a.DrawRect(this.x + 1, Math.floor(cover.margin / 2) + this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, g_backcolor_sel);
            a.DrawRect(this.x + 1, Math.floor(cover.margin / 2) + this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, RGBA(0, 0, 0, 40))
          }
        }
      }
    } else {
      this.show = e;
      if (list.mid == c) {
        this.w = cover.w;
        this.h = cover.w;
        this.y = cover.pad_top_mid;
        this.x = Math.floor((ww / 2) - (cover.w / 2));
        this.cut = 1
      } else {
        this.w = Math.abs(d) == 1 ? cover.w - cover.normal_delta * 1 : cover.w - cover.normal_delta * 2;
        this.h = this.w;
        this.x = Math.abs(d) == 1 ? Math.floor((ww / 2) - (this.w / 2)) - (d * (this.w - 5)) : Math.floor((ww / 2) - (this.w / 2)) - (d * this.w);
        this.y = Math.abs(d) == 1 ? cover.pad_top_mid + Math.ceil(cover.normal_delta / 2) : cover.pad_top_mid + cover.normal_delta;
        this.cut = Math.abs(d) == 1 ? 1 : 0
      };
      if (this.id >= 0) {
        this.cover_img = g_image_cache.hit(this);
        if (this.show && typeof (this.cover_img) != "undefined") {
          var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
          if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
            a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x + this.w, this.y + this.h - cover.margin - 1, -1 * this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 180, 255);
            a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w - this.cut, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
          };
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 2, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          };
          a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255)
        } else {
          var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
          if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
            a.DrawImage(loading_img, Math.floor(cover.margin / 2) + this.x + this.w, this.y + this.h - cover.margin - 1, -1 * this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 180, 255);
            a.FillGradRect(Math.floor(cover.margin / 2) + this.x - 1, this.y + this.h - 1, this.w - this.cut, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
          };
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 2, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          };
          a.DrawImage(loading_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255)
        };
        if (this.gh_id == list.selected_gh_id) {
          list.focus_id_item_idx = this.idx;
          if (cover.draw_focus_border) {
            a.SetSmoothingMode(2);
            a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 1, this.y - 1, this.w - cover.margin * 2 + 2, this.h - cover.margin * 2 + 2, 2, 2, 3.0, g_backcolor_sel);
            a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 2, this.y - 2, this.w - cover.margin * 2 + 4, this.h - cover.margin * 2 + 4, 3, 3, 1.0, RGBA(255, 255, 255, 60));
            a.SetSmoothingMode(0);
            a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, g_backcolor_sel);
            a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, RGBA(0, 0, 0, 40))
          }
        }
      }
    }
  };
  this.checkstate = function (a, x, y, b) {
    if (this.id >= 0) {
      this.ishover = (x > this.x && x < this.x + this.w && y >= this.y && y < this.y + this.h)
    } else {
      this.ishover = false
    };
    switch (a) {
    case "down":
      if (!list.down_timerID && this.id >= 0) {
        if (plman.IsPlaylistItemSelected(panel.active_playlist, this.id)) {
          if (this.ishover) {
            if (panel.lock_playlist) {
              this.checkstate("mid", x, y, b)
            };
            SelectGroupItems(this.id, this.gh_id, true);
            g_saved = this;
            refresh_spv(panel.active_playlist, bool_on_size)
          }
        } else {
          if (this.ishover) {
            if (utils.IsKeyPressed(VK_SHIFT)) {
              if (list.focus_id != this.id) {
                if (list.SHIFT_start_id != null) {} else {}
              }
            } else if (utils.IsKeyPressed(VK_CONTROL)) {
              if (panel.lock_playlist) {
                this.checkstate("mid", x, y, b)
              } else {
                SelectGroupItems(this.id, this.gh_id, true)
              }
            } else {
              SelectGroupItems(this.id, this.gh_id, true);
              g_saved = this;
              if (panel.lock_playlist) {
                g_saved.checkstate("mid", x, y, b)
              }
            }
          }
        }
      };
      break;
    case "dblclk":
      if (this.id >= 0 && g_saved != null) {
        if (plman.IsPlaylistItemSelected(panel.active_playlist, this.id)) {
          if (panel.lock_playlist) {
            if (this.id == g_saved.id) {
              plman.ExecutePlaylistDefaultAction(panel.active_playlist, list.hlist[g_saved.gh_id]);
              g_saved = null
            }
          } else {
            if (this.id == g_saved.id) {
              plman.ExecutePlaylistDefaultAction(panel.active_playlist, list.hlist[g_saved.gh_id]);
              g_saved = null;
              window.Repaint()
            }
          }
        }
      };
      break;
    case "mid":
      if (this.ishover) {
        if (plman.GetPlaylistName(panel.active_playlist) != "CoverFlow View") {
          SelectGroupItems(this.id, this.gh_id, true);
          var c = false;
          var d = 0;
          var e = panel.active_playlist;
          var f = plman.PlaylistCount;
          for (var i = 0; i < f; i++) {
            if (plman.GetPlaylistName(i) == "CoverFlow View") {
              c = true;
              d = i;
              break
            }
          };
          if (!c) {
            panel.adding_coverflow_playlist = true;
            d = plman.PlaylistCount;
            plman.CreatePlaylist(plman.PlaylistCount, "CoverFlow View")
          };
          plman.ActivePlaylist = d;
          fb.ClearPlaylist();
          var g = fb.PlaylistItemCount(d);
          plman.InsertPlaylistItems(d, g, plman.GetPlaylistSelectedItems(e), false);
          plman.SetPlaylistFocusItem(d, 0)
        }
      };
      break;
    case "right":
      if (this.ishover) {
        SelectGroupItems(this.id, this.gh_id, false);
        new_context_menu(x, y, this.id, this.idx)
      };
      break;
    case "up":
      break;
    case "move":
      if (this.ishover) {}
      break;
    case "leave":
      break
    };
    return this.state
  }
};
var tf_path = fb.TitleFormat("$left(%_path_raw%,4)");
var tf_albumartist = fb.TitleFormat("$if(%length%,%album artist%,'Stream')");
var tf_album = fb.TitleFormat("$if2(%album%,$if(%length%,'Single','web radios'))");
var tf_group_key = fb.TitleFormat(window.GetProperty("_group Key", "%album artist%%album%"));
var tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
var g_instancetype = window.InstanceType;
var g_font = null;
var g_font_headers = null;
var ww = 0,
  wh = 0;
var mouse_x = 0,
  mouse_y = 0;
var g_textcolor = 0,
  g_textcolor_sel = 0,
  g_textcolor_hl = 0,
  g_backcolor = 0,
  g_backcolor_sel = 0;
var g_metadb;
var bool_on_size = false;
var g_search_string = "";
var incsearch_font = gdi.Font("lucida console", 9, 0);
var incsearch_font_big = gdi.Font("lucida console", 20, 1);
var clear_incsearch_timer = false;
var incsearch_timer = false;
var g_saved = null;
panel = {
  max_width: 250,
  max_height: 250,
  arr_buttons: Array(),
  button_total: 3,
  show_text: window.GetProperty("panel.album.info.visible", true),
  custom_textcolor: window.GetProperty("panel.custom.text.color.normal", ""),
  custom_textcolor_selection: window.GetProperty("panel.custom.text.color.selection", ""),
  custom_backcolor: window.GetProperty("panel.custom.background.color", ""),
  custom_textcolor_highlight: window.GetProperty("panel.custom.text.color.hightlight", ""),
  lock_playlist: window.GetProperty("panel.lock.playlist.enabled", false),
  active_playlist: window.GetProperty("panel.active.playlist", 0),
  adding_coverflow_playlist: false,
  vertical_mode: true
};
list = {
  first_launch: true,
  total: 0,
  total_gh: 0,
  start_id: 0,
  nbvis: 0,
  mid: 0,
  item: Array(),
  hlist: Array(),
  handlelist: null,
  metadblist_selection: plman.GetPlaylistSelectedItems(panel.active_playlist),
  focus_id: 0,
  focus_id_item_idx: 0,
  selected_gh_id: 0,
  marker_id: 0,
  gh_id: 0,
  mousewheel_timer_value: 20,
  key_timer_value: 60,
  nowplaying: 0,
  SHIFT_start_id: null,
  SHIFT_count: 0,
  inc_search_noresult: false,
  nb_cover_to_draw: 0,
  buttonclicked: false,
  drag_stop: true,
  drag_timer: false
};
scrollbar = {
  theme: false,
  themed: window.GetProperty("list.scrollbar.themed", false),
  show: window.GetProperty("list.scrollbar.visible", true),
  visible: true,
  default_step: window.GetProperty("list.scrollbar.step", 3),
  step: 3,
  letter: null,
  button_total: 2,
  arr_buttons: Array(),
  timerID: false
}
hscrollbar = {
  hover: false,
  x: 0,
  y: 0,
  default_h: get_system_scrollbar_height(),
  h: get_system_scrollbar_height(),
  w: 0
};
vscrollbar = {
  hover: false,
  x: 0,
  y: 0,
  default_w: get_system_scrollbar_width(),
  w: get_system_scrollbar_width(),
  h: 0
};
scrollbarbt = {
  timerID1: false,
  timerID2: false,
  timer1_value: 400,
  timer2_value: 60
};
button_up = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h
};
button_down = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h
};
cursor = {
  bt: null,
  img_normal: null,
  img_hover: null,
  img_down: null,
  popup: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  default_w: hscrollbar.default_h + 3,
  hover: false,
  drag: false,
  grap_x: 0,
  timerID: false,
  last_x: 0
};
cover = {
  margin: 2,
  w: 0,
  h: 0,
  top_offset: 0,
  default_pad_top_mid: 35,
  default_pad_bot_mid: 30,
  pad_top_mid: 35,
  pad_bot_mid: 30,
  default_pad_left_mid: 15,
  default_pad_right_mid: 28,
  pad_left_mid: 15,
  pad_right_mid: 28,
  normal_delta: 20,
  quality: window.GetProperty("list.covers.quality.percent", 100),
  draw_reflection: window.GetProperty("cover.draw.ground.reflection", true),
  reflect_strength_percent: window.GetProperty("cover.ground.reflection.percent", 20),
  draw_shadows: window.GetProperty("cover.draw.shadows", true),
  draw_focus_border: window.GetProperty("cover.draw.focus.border", true),
  draw_glass_effect: window.GetProperty("cover.draw.glass.effect", false),
  load_timer: false
};

function refresh_spv_cursor(a) {
  if (panel.vertical_mode) {
    var b = (cursor.y - vscrollbar.y) / (vscrollbar.h - cursor.h)
  } else {
    var b = (cursor.x - hscrollbar.x) / (hscrollbar.w - cursor.w)
  }
  if (b > 1) b = 1;
  if (b < 0) b = 0;
  var r = Math.round(b * list.total_gh);
  set_gh_id(a, list.hlist[r - 1]);
  window.Repaint()
}
function set_gh_id(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(b);
  if (list.gh_id == null) {
    list.gh_id = 0
  }
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  }
};

function scrollup_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r > 0) {
    var s = list.item[0].gh_id;
    if (s > 0) {
      list.item.unshift(new item(list.hlist[s - 1], 0, s - 1))
    } else {
      list.item.unshift(new item(-1, 0, -1))
    };
    list.item.pop()
  };
  var b = list.item.length;
  for (var i = 0; i < b; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function scrolldown_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r < list.total_gh - 1) {
    var s = list.item[list.item.length - 1].gh_id;
    if (s > 0 && s < list.total_gh - 1) {
      list.item.push(new item(list.hlist[s + 1], 0, s + 1))
    } else {
      list.item.push(new item(-1, 0, -1))
    };
    list.item.shift()
  };
  var b = list.item.length;
  for (var i = 0; i < b; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function refresh_spv(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(list.focus_id);
  if (list.gh_id == null) {
    init_active_pls();
    return true
  }
  list.selected_gh_id = list.gh_id;
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  };
  if (scrollbar.show) {
    if (list.total_gh < 2) scrollbar.visible = false;
    else scrollbar.visible = true
  } else {
    scrollbar.visible = false
  };
  if (panel.vertical_mode) {
    cursor.h = Math.round(vscrollbar.h / list.total_gh);
    if (cursor.h > vscrollbar.h) cursor.h = vscrollbar.h;
    if (cursor.h < cursor.default_w) cursor.h = cursor.default_w
  } else {
    cursor.w = Math.round(hscrollbar.w / list.total_gh);
    if (cursor.w > hscrollbar.w) cursor.w = hscrollbar.w;
    if (cursor.w < cursor.default_w) cursor.w = cursor.default_w
  };
  set_scroller();
  setcursorx()
};

function get_gh_id(a) {
  var b = Math.floor(list.total_gh / 2);
  if (a < list.hlist) {
    var c = 0
  } else {
    var c = b
  };
  for (var i = c; i < list.total_gh; i++) {
    if (i < list.total_gh - 1) {
      if (a >= list.hlist && a < list.hlist[i + 1]) {
        return i
      }
    } else {
      if (a >= list.hlist) {
        return i
      } else {
        return null
      }
    }
  }
};

function setcursorx() {
  if (list.item.length > 0) {
    var a = Math.floor(list.item.length / 2);
    var b = list.item[a].gh_id;
    var c = b / (list.total_gh - 1);
    if (panel.vertical_mode) {
      cursor.y = vscrollbar.y + Math.round(c * (vscrollbar.h - cursor.h))
    } else {
      cursor.x = hscrollbar.x + Math.round(c * (hscrollbar.w - cursor.w))
    }
  } else {
    if (panel.vertical_mode) {
      cursor.y = vscrollbar.y
    } else {
      cursor.x = hscrollbar.x
    }
  }
};

function init_active_pls() {
  var a;
  var b;
  var c;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(panel.active_playlist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    if (i > 0 && i < list.total - 1) {
      i++;
      b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
      if (a != b) {
        if (i > 0) {
          c = tf_group_key.EvalWithMetadb(list.handlelist.Item(i - 1));
          if (a != c) {
            list.hlist.push(i - 1)
          };
          if (c != b) {
            list.hlist.push(i)
          }
        } else {
          list.hlist.push(i)
        };
        a = b
      }
    } else {
      b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
      if (a != b) {
        list.hlist.push(i);
        a = b
      }
    }
  };
  list.total_gh = list.hlist.length
};

function old_init_active_pls() {
  var a;
  var b;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(panel.active_playlist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
    if (a != b) {
      list.hlist.push(i);
      a = b
    }
  };
  list.total_gh = list.hlist.length
};

function on_font_changed() {
  get_font();
  on_playlist_switch()
};

function on_colors_changed() {
  get_colors();
  init_icons();
  redraw_stub_images();
  init_hscrollbar_buttons();
  set_scroller();
  g_image_cache = new image_cache;
  CollectGarbage();
  on_playlist_switch()
};

function on_init() {};

function on_size() {
  if (!window.Width || !window.Height) return;
  window.DlgCode = DLGC_WANTALLKEYS;
  bool_on_size = true;
  if (g_instancetype == 0) {
    window.MinWidth = 170;
    window.MinHeight = 170
  } else if (g_instancetype == 1) {
    window.MinWidth = 170;
    window.MinHeight = 170
  };
  ww = window.Width;
  wh = window.Height;
  if (ww > wh) {
    panel.vertical_mode = false;
    window.MaxHeight = panel.max_height;
    window.MaxWidth = 2000;
    if (wh < 170) wh = 170
  } else {
    panel.vertical_mode = true;
    window.MaxWidth = panel.max_width;
    window.MaxHeight = 2000;
    if (ww < 170) ww = 170
  };
  var a = window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  if (a == "") window.SetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
  get_font();
  get_colors();
  init_icons();
  if (panel.vertical_mode) {
    if (scrollbar.show) {
      cover.pad_right_mid = cover.default_pad_right_mid
    } else {
      cover.pad_right_mid = cover.default_pad_right_mid - vscrollbar.default_w
    }
    cover.h = ww - cover.pad_left_mid - cover.pad_right_mid;
    cover.w = cover.h;
    list.nbvis = Math.floor(wh / (cover.h - cover.normal_delta * 2)) + 2;
    if (list.nbvis / 2 == Math.floor(list.nbvis / 2)) {
      list.nbvis--
    }
    list.mid = Math.floor(list.nbvis / 2);
    list.nb_cover_to_draw = Math.floor(wh / (cover.h - cover.normal_delta * 2)) + 2;
    if (scrollbar.themed) {
      scrollbar.theme = window.CreateThemeManager("scrollbar")
    } else {
      scrollbar.theme = false
    };
    init_vscrollbar_buttons();
    button_up.x = ww - button_up.w;
    button_up.y = 0;
    button_down.x = ww - button_down.w;
    button_down.y = wh - button_down.h;
    vscrollbar.y = button_up.h;
    vscrollbar.h = wh - button_up.h - button_down.h;
    cursor.x = ww - vscrollbar.w;
    cursor.y = vscrollbar.y;
    cursor.w = vscrollbar.w
  } else {
    if (scrollbar.show) {
      cover.pad_bot_mid = cover.default_pad_bot_mid
    } else {
      cover.pad_bot_mid = cover.default_pad_bot_mid - hscrollbar.default_h
    }
    if (panel.show_text) {
      cover.pad_top_mid = cover.default_pad_top_mid
    } else {
      cover.pad_top_mid = cover.default_pad_top_mid - 16
    };
    cover.w = wh - cover.pad_top_mid - cover.pad_bot_mid;
    cover.h = cover.w;
    list.nbvis = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2;
    if (list.nbvis / 2 == Math.floor(list.nbvis / 2)) {
      list.nbvis--
    }
    list.mid = Math.floor(list.nbvis / 2);
    list.nb_cover_to_draw = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2;
    if (scrollbar.themed) {
      scrollbar.theme = window.CreateThemeManager("scrollbar")
    } else {
      scrollbar.theme = false
    };
    init_hscrollbar_buttons();
    button_up.x = 0;
    button_up.y = wh - hscrollbar.h;
    button_down.x = ww - button_down.w;
    button_down.y = wh - hscrollbar.h;
    hscrollbar.x = button_up.w;
    hscrollbar.w = ww - button_up.w - button_down.w;
    cursor.y = wh - hscrollbar.h;
    cursor.x = hscrollbar.x;
    cursor.h = hscrollbar.h
  };
  redraw_stub_images();
  if (list.first_launch) {
    list.first_launch = false;
    on_playlist_switch()
  } else {
    g_image_cache = new image_cache;
    CollectGarbage();
    refresh_spv(panel.active_playlist, true)
  }
};

function on_paint(a) {
  a.FillSolidRect(0, 0, ww, wh, g_backcolor);
  if (list.item.length > 0) {
    var b, mid2;
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    for (var c = 1; c < list.mid + 1; c++) {
      if (c > 1 && c <= list.mid) {
        b = true
      } else {
        b = false
      };
      mid2 = list.mid - c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c, b)
      }
      mid2 = list.mid + c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c * -1, b)
      }
    };
    mid2 = list.mid - 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, 1, true)
    }
    mid2 = list.mid + 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, -1, true)
    }
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    if (!panel.vertical_mode) {
      if (panel.show_text) {
        var d = panel.lock_playlist ? 32 : 60;
        var f = panel.lock_playlist ? ww - 64 : ww - 120;
        if (list.item[list.mid].id >= 0) {
          a.GdiDrawText(list.item[list.mid].group_info, g_font, g_textcolor, d, 0, f, cover.pad_top_mid - 4, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
        }
      }
    }
  };
  if (list.total_gh > 0 && scrollbar.visible && scrollbar.show) {
    if (panel.vertical_mode) {
      try {
        scrollbar.theme.SetPartAndStateId(6, 1);
        scrollbar.theme.DrawThemeBackground(a, ww - vscrollbar.w, 0, vscrollbar.w, wh)
      } catch (e) {
        a.FillSolidRect(ww - vscrollbar.w, 0, vscrollbar.w, wh, g_backcolor & 0x77ffffff);
        a.FillSolidRect(ww - vscrollbar.w, 0, 1, wh, RGBA(0, 0, 0, 20))
      };
      cursor.bt.draw(a, ww - vscrollbar.w, cursor.y, 255);
      try {
        scrollbar.theme.SetPartAndStateId(9, 1);
        scrollbar.theme.DrawThemeBackground(a, ww - vscrollbar.w, cursor.y, cursor.w, cursor.h)
      } catch (e) {};
      for (i = 0; i < scrollbar.arr_buttons.length; i++) {
        switch (i) {
        case 0:
          scrollbar.arr_buttons.draw(a, ww - vscrollbar.w, button_up.y, 255);
          break;
        case 1:
          scrollbar.arr_buttons.draw(a, ww - vscrollbar.w, button_down.y, 255);
          break
        }
      };
      if (cursor.drag) {
        scrollbar.letter = list.item[Math.floor(list.nbvis / 2)].albumartist.substring(0, 1).toUpperCase();
        cursor.popup && a.DrawImage(cursor.popup, ww - vscrollbar.w - cursor.popup.Width - 00, cursor.y + Math.floor(cursor.h / 2) - Math.floor(cursor.popup.Height / 2), cursor.popup.Width, cursor.popup.Height, 0, 0, cursor.popup.Width, cursor.popup.Height, 0, 155);
        cursor.popup && a.GdiDrawText(scrollbar.letter, gdi.Font("segoe ui", 14, 0), g_backcolor, ww - vscrollbar.w - cursor.popup.Width - 00, cursor.y + Math.floor(cursor.h / 2) - Math.floor(cursor.popup.Height / 2), cursor.popup.Width - 5, cursor.popup.Height, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
      }
    } else {
      try {
        scrollbar.theme.SetPartAndStateId(4, 1);
        scrollbar.theme.DrawThemeBackground(a, 0, wh - hscrollbar.h, ww, hscrollbar.h);
        a.FillSolidRect(0, wh - hscrollbar.h - 1, ww, 1, RGBA(0, 0, 0, 10))
      } catch (e) {
        a.FillSolidRect(0, wh - hscrollbar.h, ww, hscrollbar.h, g_backcolor & 0x77ffffff);
        a.FillSolidRect(0, wh - hscrollbar.h, ww, 1, RGBA(0, 0, 0, 20))
      };
      try {
        cursor.bt.draw(a, cursor.x, cursor.y, 255)
      } catch (e) {};
      try {
        scrollbar.theme.SetPartAndStateId(8, 1);
        scrollbar.theme.DrawThemeBackground(a, cursor.x, wh - hscrollbar.h + 0, cursor.w, cursor.h)
      } catch (e) {};
      for (i = 0; i < scrollbar.arr_buttons.length; i++) {
        switch (i) {
        case 0:
          scrollbar.arr_buttons.draw(a, button_up.x, button_up.y, 255);
          break;
        case 1:
          scrollbar.arr_buttons.draw(a, button_down.x, button_down.y, 255);
          break
        }
      };
      if (cursor.drag) {
        scrollbar.letter = list.item[Math.floor(list.nbvis / 2)].albumartist.substring(0, 1).toUpperCase();
        cursor.popup && a.DrawImage(cursor.popup, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height, 0, 0, cursor.popup.Width, cursor.popup.Height, 0, 155);
        cursor.popup && a.GdiDrawText(scrollbar.letter, gdi.Font("segoe ui", 14, 0), g_backcolor, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height - 5, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
      }
    }
  };
  for (i = 0; i < panel.arr_buttons.length; i++) {
    switch (i) {
    case 0:
      if (!panel.lock_playlist) {
        if (panel.vertical_mode) {
          panel.arr_buttons.draw(a, 5, 30, 255)
        } else {
          panel.arr_buttons.draw(a, 30, 5, 255)
        }
      };
      break;
    case 1:
      if (panel.vertical_mode) {
        panel.arr_buttons.draw(a, 5, wh - 22 - 5, 255)
      } else {
        panel.arr_buttons.draw(a, ww - 22 - 5, 5, 255)
      };
      break;
    case 2:
      panel.arr_buttons.draw(a, 5, 5, 255);
      break
    }
  };
  if (!panel.vertical_mode) {
    a.FillGradRect(0, 0, ww, 1, 0, 0, g_textcolor & 0x15ffffff, 0.5)
  }
};

function on_mouse_lbtn_down(x, y) {
  bool_on_size = false;
  var a = list.item.length;
  for (var i = 0; i < a; i++) {
    list.item.checkstate("down", x, y, i)
  };
  if (list.total_gh > 0 && scrollbar.visible && scrollbar.show) {
    if (panel.vertical_mode) {
      if (cursor.bt.checkstate("down", x, y) == ButtonStates.down) {
        cursor.drag = true;
        cursor.grap_y = y - cursor.y;
        cursor.last_y = cursor.y
      };
      if (vscrollbar.hover && !cursor.drag) {
        scrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
        if (scrollbar.step < 1) scrollbar.step = 1;
        if (y < cursor.y) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_x > ww - vscrollbar.w && cursor.y > mouse_y) {
                    on_mouse_wheel(scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        } else {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1 * scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(-1 * scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_x > ww - vscrollbar.w && cursor.y + cursor.h < mouse_y) {
                    on_mouse_wheel(-1 * scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        }
      }
    } else {
      if (cursor.bt.checkstate("down", x, y) == ButtonStates.down) {
        cursor.drag = true;
        cursor.grap_x = x - cursor.x;
        cursor.last_x = cursor.x
      };
      if (hscrollbar.hover && !cursor.drag) {
        scrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
        if (scrollbar.step < 1) scrollbar.step = 1;
        if (x < cursor.x) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_y > wh - hscrollbar.h && cursor.x > mouse_x) {
                    on_mouse_wheel(scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        } else {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1 * scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(-1 * scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_y > wh - hscrollbar.h && cursor.x + cursor.w < mouse_x) {
                    on_mouse_wheel(-1 * scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        }
      }
    };
    for (i = 0; i < scrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (scrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(1);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              reset_cover_timers();
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                on_mouse_wheel(1)
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        };
        break;
      case 1:
        if (scrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              reset_cover_timers();
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                on_mouse_wheel(-1)
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        };
        break
      }
    }
  };
  for (var i = 0; i < panel.arr_buttons.length; i++) {
    panel.arr_buttons.checkstate("down", x, y)
  }
};

function on_mouse_lbtn_dblclk(x, y, a) {
  if (panel.vertical_mode) {
    if (x < cover.pad_left_mid) {} else if (x < ww - cover.pad_right_mid) {
      var b = list.item.length;
      for (var i = 0; i < b; i++) {
        list.item.checkstate("dblclk", x, y, i)
      }
    } else {
      on_mouse_lbtn_down(x, y)
    }
  } else {
    if (y < cover.pad_top_mid) {} else if (y < wh - cover.pad_bot_mid) {
      var b = list.item.length;
      for (var i = 0; i < b; i++) {
        list.item.checkstate("dblclk", x, y, i)
      }
    } else {
      on_mouse_lbtn_down(x, y)
    }
  }
};

function on_mouse_lbtn_up(x, y) {
  list.buttonclicked = false;
  scrollbar.timerID && window.ClearTimeout(scrollbar.timerID);
  scrollbar.timerID = false;
  scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
  scrollbarbt.timerID1 = false;
  scrollbarbt.timerID2 && window.ClearTimeout(scrollbarbt.timerID2);
  scrollbarbt.timerID2 = false;
  if (list.drag_timer) {
    window.ClearTimeout(list.drag_timer);
    list.drag_timer = false;
    list.drag_stop = true
  }
  if (list.total_gh > 0) {
    cursor.bt.checkstate("up", x, y);
    for (var i = 0; i < scrollbar.arr_buttons.length; i++) {
      scrollbar.arr_buttons.checkstate("up", x, y)
    };
    for (i = 0; i < panel.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
          ShowNowPlaying()
        };
        break;
      case 1:
        if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
          settings_menu(x, y)
        };
        break;
      case 2:
        if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
          if (panel.lock_playlist) {
            panel.lock_playlist = false;
            window.SetProperty("panel.lock.playlist.enabled", panel.lock_playlist);
            plman.ActivePlaylist = panel.active_playlist
          } else {
            panel.lock_playlist = true;
            window.SetProperty("panel.lock.playlist.enabled", panel.lock_playlist);
            panel.active_playlist = plman.ActivePlaylist;
            window.SetProperty("panel.active.playlist", panel.active_playlist);
            var a = Math.floor(list.nbvis / 2);
            a = list.focus_id_item_idx;
            list.item[a].checkstate("mid", list.item[a].x + 5, list.item[a].y + 5, a)
          };
          if (panel.lock_playlist) {
            panel.arr_buttons[2].update(lock_button_normal, lock_button_hover, lock_button_down)
          } else {
            panel.arr_buttons[2].update(unlock_button_normal, unlock_button_hover, unlock_button_down)
          }
        };
        break
      }
    };
    if (cursor.drag) {
      window.RepaintRect(0, wh - hscrollbar.h, ww, hscrollbar.h);
      cursor.drag = false
    } else {
      var b = list.item.length;
      for (i = 0; i < b; i++) {
        list.item.checkstate("up", x, y, i)
      }
    };
    setcursorx();
    window.Repaint()
  }
};

function on_mouse_mbtn_down(x, y, a) {
  bool_on_size = false;
  var b = list.item.length;
  for (var i = 0; i < b; i++) {
    list.item.checkstate("mid", x, y, i)
  }
};

function on_mouse_rbtn_down(x, y) {
  bool_on_size = false;
  var a = list.item.length;
  for (var i = 0; i < a; i++) {
    list.item.checkstate("right", x, y, i)
  }
};

function on_mouse_move(x, y) {
  if (x == mouse_x && y == mouse_y) return true;
  if (cursor.drag) {
    list.drag_stop = false;
    if (list.drag_timer) {
      window.ClearTimeout(list.drag_timer);
      list.drag_timer = false
    }
    list.drag_timer = window.SetTimeout(function () {
      list.drag_stop = true;
      window.ClearTimeout(list.drag_timer);
      list.drag_timer = false;
      window.Repaint()
    }, 25)
  } else {
    list.drag_stop = true
  };
  if (list.total_gh > 0 && scrollbar.visible && scrollbar.show) {
    if (panel.vertical_mode) {
      vscrollbar.hover = (x >= ww - vscrollbar.w && x <= ww && y >= vscrollbar.y && y <= vscrollbar.y + vscrollbar.h);
      cursor.hover = (x >= cursor.x && x <= cursor.x + cursor.w && y >= cursor.y && y <= cursor.y + cursor.h);
      cursor.bt.checkstate("move", x, y);
      for (var i = 0; i < scrollbar.arr_buttons.length; i++) {
        scrollbar.arr_buttons.checkstate("move", x, y)
      };
      if (cursor.drag && mouse_y != y) {
        reset_cover_timers();
        cursor.y = y - cursor.grap_y;
        if (cursor.y < vscrollbar.y) cursor.y = vscrollbar.y;
        if (cursor.y > vscrollbar.y + vscrollbar.h - cursor.h) cursor.y = vscrollbar.y + vscrollbar.h - cursor.h;
        if (!cursor.timerID) {
          cursor.timerID = window.SetTimeout(function () {
            refresh_spv_cursor(fb.ActivePlaylist);
            window.Repaint();
            cursor.timerID = false
          }, 30)
        }
      }
    } else {
      hscrollbar.hover = (y >= wh - hscrollbar.h && y <= wh && x >= hscrollbar.x && x <= hscrollbar.x + hscrollbar.w);
      cursor.hover = (x >= cursor.x && x <= cursor.x + cursor.w && y >= cursor.y && y <= cursor.y + cursor.h);
      cursor.bt.checkstate("move", x, y);
      for (var i = 0; i < scrollbar.arr_buttons.length; i++) {
        scrollbar.arr_buttons.checkstate("move", x, y)
      };
      if (cursor.drag && mouse_x != x) {
        reset_cover_timers();
        cursor.x = x - cursor.grap_x;
        if (cursor.x < hscrollbar.x) cursor.x = hscrollbar.x;
        if (cursor.x > hscrollbar.x + hscrollbar.w - cursor.w) cursor.x = hscrollbar.x + hscrollbar.w - cursor.w;
        if (!cursor.timerID) {
          cursor.timerID = window.SetTimeout(function () {
            refresh_spv_cursor(panel.active_playlist);
            window.Repaint();
            cursor.timerID && window.ClearTimeout(cursor.timerID);
            cursor.timerID = false
          }, 30)
        }
      }
    }
  };
  for (var j = 0; j < panel.arr_buttons.length; j++) {
    panel.arr_buttons[j].checkstate("move", x, y)
  };
  mouse_x = x;
  mouse_y = y
};

function on_mouse_wheel(a) {
  var b = Math.abs(a);
  reset_cover_timers();
  if (!scrollbar.timerID) {
    if (b >= 1) {
      if (a > 0) {
        for (var i = 0; i < b; i++) {
          scrollup_spv(panel.active_playlist)
        };
        scrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          scrollbar.timerID && window.ClearTimeout(scrollbar.timerID);
          scrollbar.timerID = false
        }, list.mousewheel_timer_value)
      } else {
        for (var i = 0; i < b; i++) {
          scrolldown_spv(panel.active_playlist)
        }
        scrollbar.timerID = window.SetTimeout(function () {
          window.Repaint();
          scrollbar.timerID && window.ClearTimeout(scrollbar.timerID);
          scrollbar.timerID = false
        }, list.mousewheel_timer_value)
      }
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-01 18:35:42
WSH CoverFlow v1 beta7

(http://img600.imageshack.us/img600/7755/capturewsh.png) (http://www.youtube.com/watch?v=1ELS0DmkntY)
[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]click me![/size]

[code]// ==PREPROCESSOR==
// @name "CoverFlow View v1 beta7"
// @version "0.0.7.20120401.1646"
// @author "Br3tt"
// @feature "v1.4"
// @feature "watch-metadb"
// @feature "dragdrop"
// ==/PREPROCESSOR==

// [Requirements]
// * foobar2000 v1.1 or better  >> http://foobar2000.org (http://foobar2000.org)
// * WSH panel Mod v1.5.2 or better  >> http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
// [/Requirements]

// * !!! Keep a reasonable size for the panel to avoid bad perf!

// [Informations]
// * change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI
// * Some Settings can be changed in window Properties (right click empty space > Properties)
//  e.g. for custom colors in Properties, use e.g. RGB(255,255,255) for white color, RGB(0,0,0) for black color, ...
// * middle click on cover > Send album tracks to specific playlist "CoverFlow View"
// * keyboard keys : left/right arrows, Home/End, page up/down, spacebar to set focus on the centered album, Return key to play ...
// [/Informations]

SM_CXVSCROLL = 2;
SM_CYHSCROLL = 3;
DLGC_WANTARROWS = 0x0001;
DLGC_WANTALLKEYS = 0x0004;
MF_STRING = 0x00000000;
MF_SEPARATOR = 0x00000800;
MF_GRAYED = 0x00000001;
MF_DISABLED = 0x00000002;
MF_POPUP = 0x00000010;
IDC_ARROW = 32512;
IDC_IBEAM = 32513;
IDC_WAIT = 32514;
IDC_CROSS = 32515;
IDC_UPARROW = 32516;
IDC_SIZE = 32640;
IDC_ICON = 32641;
IDC_SIZENWSE = 32642;
IDC_SIZENESW = 32643;
IDC_SIZEWE = 32644;
IDC_SIZENS = 32645;
IDC_SIZEALL = 32646;
IDC_NO = 32648;
IDC_APPSTARTING = 32650;
IDC_HAND = 32649;
IDC_HELP = 32651;
var DT_LEFT = 0x00000000;
var DT_RIGHT = 0x00000002;
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_EDITCONTROL = 0x00002000;
var DT_END_ELLIPSIS = 0x00008000;
var VK_BACK = 0x08;
var VK_RETURN = 0x0D;
var VK_SHIFT = 0x10;
var VK_CONTROL = 0x11;
var VK_ALT = 0x12;
var VK_ESCAPE = 0x1B;
var VK_PGUP = 0x21;
var VK_PGDN = 0x22;
var VK_END = 0x23;
var VK_HOME = 0x24;
var VK_LEFT = 0x25;
var VK_UP = 0x26;
var VK_RIGHT = 0x27;
var VK_DOWN = 0x28;
var VK_INSERT = 0x2D;
var VK_DELETE = 0x2E;
var VK_SPACEBAR = 0x20;
var KMask = {
  none: 0,
  ctrl: 1,
  shift: 2,
  ctrlshift: 3,
  ctrlalt: 4,
  ctrlaltshift: 5,
  alt: 6
};

function GetKeyboardMask() {
  var c = utils.IsKeyPressed(VK_CONTROL) ? true : false;
  var a = utils.IsKeyPressed(VK_ALT) ? true : false;
  var s = utils.IsKeyPressed(VK_SHIFT) ? true : false;
  var b = KMask.none;
  if (c && !a && !s) b = KMask.ctrl;
  if (!c && !a && s) b = KMask.shift;
  if (c && !a && s) b = KMask.ctrlshift;
  if (c && a && !s) b = KMask.ctrlalt;
  if (c && a && s) b = KMask.ctrlaltshift;
  if (!c && a && !s) b = KMask.alt;
  return b
};
ColorTypeCUI = {
  text: 0,
  selection_text: 1,
  inactive_selection_text: 2,
  background: 3,
  selection_background: 4,
  inactive_selection_background: 5,
  active_item_frame: 6
};
FontTypeCUI = {
  items: 0,
  labels: 1
};
ColorTypeDUI = {
  text: 0,
  background: 1,
  highlight: 2,
  selection: 3
};
FontTypeDUI = {
  defaults: 0,
  tabs: 1,
  lists: 2,
  playlists: 3,
  statusbar: 4,
  console: 5
};

function StringFormat() {
  var a = 0,
    v_align = 0,
    trimming = 0,
    flags = 0;
  switch (arguments.length) {
  case 3:
    trimming = arguments[2];
  case 2:
    v_align = arguments[1];
  case 1:
    a = arguments[0];
    break;
  default:
    return 0
  };
  return ((a << 28) | (v_align << 24) | (trimming << 20) | flags)
};
StringAlignment = {
  Near: 0,
  Centre: 1,
  Far: 2
};
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);

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 getAlpha(a) {
  return ((a >> 24) & 0xff)
}
function getRed(a) {
  return ((a >> 16) & 0xff)
}
function getGreen(a) {
  return ((a >> 8) & 0xff)
}
function getBlue(a) {
  return (a & 0xff)
}
function num(a, b) {
  var i;
  var c = a.toString();
  var k = b - c.length;
  if (k > 0) {
    for (i = 0; i < k; i++) {
      c = "0" + c
    }
  };
  return c.toString()
};

function TrackType(a) {
  var b;
  var c;
  switch (a) {
  case "file":
    b = 1;
    c = 0;
    break;
  case "cdda":
    b = 1;
    c = 1;
    break;
  case "FOO_":
    b = 0;
    c = 2;
    break;
  case "http":
    b = 0;
    c = 3;
    break;
  case "mms:":
    b = 0;
    c = 3;
    break;
  case "unpa":
    b = 0;
    c = 4;
    break;
  default:
    b = 0;
    c = 5
  };
  return c
};
ButtonStates = {
  normal: 0,
  hover: 1,
  down: 2
};
button = function (d, e, f) {
  this.img = Array(d, e, f);
  this.w = this.img[0].Width;
  this.h = this.img[0].Height;
  this.state = ButtonStates.normal;
  this.update = function (a, b, c) {
    this.img = Array(a, b, c)
  };
  this.draw = function (a, x, y, b) {
    this.x = x;
    this.y = y;
    this.img[this.state] && a.DrawImage(this.img[this.state], this.x, this.y, this.w, this.h, 0, 0, this.w, this.h, 0, b)
  };
  this.display_context_menu = function (x, y, a) {};
  this.repaint = function () {
    window.RepaintRect(this.x, this.y, this.w, this.h)
  };
  this.checkstate = function (a, x, y) {
    this.ishover = (x > this.x && x < this.x + this.w - 1 && y > this.y && y < this.y + this.h - 1);
    this.old = this.state;
    switch (a) {
    case "down":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.down : ButtonStates.normal;
        break
      };
      break;
    case "up":
      this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
      break;
    case "right":
      if (this.ishover) this.display_context_menu(x, y, id);
      break;
    case "move":
      switch (this.state) {
      case ButtonStates.normal:
      case ButtonStates.hover:
        this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
        break
      };
      break;
    case "leave":
      this.state = this.isdown ? ButtonStates.down : ButtonStates.normal;
      break
    };
    if (this.state != this.old) this.repaint();
    return this.state
  }
};

function get_system_scrollbar_width() {
  var a = utils.GetSystemMetrics(SM_CXVSCROLL);
  return a
};

function get_system_scrollbar_height() {
  var a = utils.GetSystemMetrics(SM_CYHSCROLL);
  return a
};
var nocover;
var nocover_img;
var streamcover;
var streamcover_img;
var loading;
var loading_img;
var star_img_off;
var star_img_on;
var star_img_hov;
var star_img_kill;
var toggle_scrollbar;
var menu_button;
image_cache = function () {
  this._cachelist = {};
  this.hit = function (a) {
    var b = this._cachelist[a.metadb.Path];
    if (list.drag_stop && typeof b == "undefined") {
      if (!cover.load_timer) {
        cover.load_timer = window.SetTimeout(function () {
          utils.GetAlbumArtAsync(window.ID, a.metadb, 0, true, false, false);
          cover.load_timer && window.ClearTimeout(cover.load_timer);
          cover.load_timer = false
        }, 35)
      }
    };
    return b
  };
  this.getit = function (a, b) {
    var c;
    var d = (cover.w - cover.margin * 2) * cover.quality / 100;
    var e = (cover.h - cover.margin * 2) * cover.quality / 100;
    if (a.track_type != 3) {
      if (a.metadb) {
        c = FormatCover(b, d, e);
        if (!c) {
          c = nocover_img;
          a.cover_type = 0
        } else {
          a.cover_type = 1
        }
      }
    } else {
      c = streamcover_img;
      a.cover_type = 3
    };
    this._cachelist[a.metadb.Path] = c;
    return c
  }
};
var g_image_cache = new image_cache;

function FormatCover(a, w, h) {
  if (!a || w <= 0 || h <= 0) return a;
  if (cover.draw_glass_effect) {
    var b = a.Resize(w, h, 2);
    var c = b.GetGraphics();
    c.FillGradRect(0, 0, w, h, 90, RGBA(255, 255, 255, 60), RGBA(255, 255, 255, 10), 1.0);
    c.SetSmoothingMode(2);
    c.FillEllipse(-20, 25, w * 2 + 40, h * 2, RGBA(0, 0, 0, 30));
    b.ReleaseGraphics©;
    return b
  } else {
    var b = a.Resize(w, h, 2);
    var c = b.GetGraphics();
    c.DrawRect(0, 0, w, h, 2.0, g_backcolor);
    c.DrawRect(0, 0, w, h, 2.0, g_textcolor & 0x33ffffff);
    b.ReleaseGraphics©;
    return b
  }
};

function reset_cover_timers() {
  cover.load_timer && window.ClearTimeout(cover.load_timer);
  cover.load_timer = false
};

function on_get_album_art_done(a, b, c, d) {
  var e = list.item.length;
  for (var i = 0; i < e; i++) {
    if (list.item.metadb) {
      if (list.item.metadb.Compare(a)) {
        list.item.cover_img = g_image_cache.getit(list.item, c);
        if (list.item.show) {
          if (panel.vertical_mode) {
            window.RepaintRect(cover.pad_left_mid, list.item.y - 2, ww - cover.pad_left_mid, list.item.h + 4)
          } else {
            window.RepaintRect(list.item.x - 2, cover.pad_top_mid, list.item.w + 4, wh - cover.pad_top_mid)
          }
        } else {
          list.item.show = true
        };
        break
      }
    }
  }
};
ItemStates = {
  normal: 0,
  hover: 1,
  selected: 2
};
item = function (h, k, l) {
  var i;
  if (typeof this.id == "undefined") {
    if (h < 0) {
      this.id = h;
      this.idx = k;
      this.gh_id = l;
      this.metadb = false;
      this.albumartist = "";
      this.track_type = null;
      this.group_info = ""
    } else {
      this.id = h;
      this.idx = k;
      this.gh_id = l;
      this.metadb = list.handlelist.Item(this.id);
      if (this.metadb) {
        this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
        this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
        this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
      }
    }
  };
  this.update_infos = function () {
    if (this.metadb) {
      this.albumartist = tf_albumartist.EvalWithMetadb(this.metadb);
      this.track_type = TrackType(this.metadb.rawpath.substring(0, 4));
      this.group_info = tf_group_info.EvalWithMetadb(this.metadb)
    } else {
      this.albumartist = "";
      this.track_type = null;
      this.group_info = ""
    }
  };
  this.draw = function (a, b, c, d, e) {
    if (panel.vertical_mode) {
      this.show = e;
      if (list.mid == c) {
        this.h = cover.h;
        this.w = cover.h;
        this.x = cover.pad_left_mid;
        this.y = Math.floor((wh / 2) - (cover.h / 2));
        this.cut = 1
      } else {
        this.h = Math.abs(d) == 1 ? cover.h - cover.normal_delta * 1 : cover.h - cover.normal_delta * 2;
        this.w = this.h;
        this.y = Math.abs(d) == 1 ? Math.floor((wh / 2) - (this.h / 2)) - (d * (this.h - 5)) : Math.floor((wh / 2) - (this.h / 2)) - (d * this.h);
        this.x = Math.abs(d) == 1 ? cover.pad_left_mid + Math.ceil(cover.normal_delta / 2) : cover.pad_left_mid + cover.normal_delta;
        this.cut = Math.abs(d) == 1 ? 1 : 0
      };
      a.FillSolidRect(this.x + 1, this.y + 1, this.w - 4, this.h - 4, g_backcolor);
      if (this.id >= 0) {
        this.cover_img = g_image_cache.hit(this);
        if (this.show && typeof (this.cover_img) != "undefined") {
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y - j - cover.margin + 1, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y + this.h - cover.margin + j - 2, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          };
          a.DrawImage(this.cover_img, this.x, Math.floor(cover.margin / 2) + this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255)
        } else {
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y - j - cover.margin + 1, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(this.x + cover.normal_delta / 2, Math.floor(cover.margin / 2) + this.y + this.h - cover.margin + j - 2, this.w - cover.normal_delta - cover.margin - 1, 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          };
          a.DrawImage(loading_img, this.x, Math.floor(cover.margin / 2) + this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255)
        };
        if (this.gh_id == list.selected_gh_id) {
          list.focus_id_item_idx = this.idx;
          if (cover.draw_focus_border) {
            a.SetSmoothingMode(2);
            a.DrawRoundRect(this.x - 1, Math.floor(cover.margin / 2) + this.y - 1, this.w - cover.margin * 2 + 2, this.h - cover.margin * 2 + 2, 2, 2, 3.0, g_backcolor_sel);
            a.DrawRoundRect(this.x - 2, Math.floor(cover.margin / 2) + this.y - 2, this.w - cover.margin * 2 + 4, this.h - cover.margin * 2 + 4, 3, 3, 1.0, RGBA(255, 255, 255, 60));
            a.SetSmoothingMode(0);
            a.DrawRect(this.x + 1, Math.floor(cover.margin / 2) + this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, g_backcolor_sel);
            a.DrawRect(this.x + 1, Math.floor(cover.margin / 2) + this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, RGBA(0, 0, 0, 40))
          }
        }
      }
    } else {
      this.show = e;
      if (list.mid == c) {
        this.w = cover.w;
        this.h = cover.w;
        this.y = cover.pad_top_mid;
        this.x = Math.floor((ww / 2) - (cover.w / 2));
        this.cut = 1
      } else {
        this.w = Math.abs(d) == 1 ? cover.w - cover.normal_delta * 1 : cover.w - cover.normal_delta * 2;
        this.h = this.w;
        this.x = Math.abs(d) == 1 ? Math.floor((ww / 2) - (this.w / 2)) - (d * (this.w - 5)) : Math.floor((ww / 2) - (this.w / 2)) - (d * this.w);
        this.y = Math.abs(d) == 1 ? cover.pad_top_mid + Math.ceil(cover.normal_delta / 2) : cover.pad_top_mid + cover.normal_delta;
        this.cut = Math.abs(d) == 1 ? 1 : 0
      };
      a.FillSolidRect(this.x + 1, this.y + 1, this.w - 4, this.h - 4, g_backcolor);
      if (this.id >= 0) {
        this.cover_img = g_image_cache.hit(this);
        if (this.show && typeof (this.cover_img) != "undefined") {
          var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
          if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
            a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x + this.w, this.y + this.h - cover.margin - 1, -1 * this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 180, 255);
            a.FillGradRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h, this.w - cover.margin * 2 + 2, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
          };
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 2, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          };
          a.DrawImage(this.cover_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255)
        } else {
          var f = 255 - Math.floor(cover.reflect_strength_percent * 2.55);
          if (cover.draw_reflection && f > 0 && cover.reflect_strength_percent > 0) {
            a.DrawImage(loading_img, Math.floor(cover.margin / 2) + this.x + this.w, this.y + this.h - cover.margin - 1, -1 * this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 180, 255);
            a.FillGradRect(Math.floor(cover.margin / 2) + this.x, this.y + this.h, this.w - cover.margin * 2 + 2, this.h + 1, 90, RGBA(g_backcolor_R, g_backcolor_G, g_backcolor_B, f), g_backcolor, 1.0)
          };
          if (cover.draw_shadows) {
            if (d == 0 || d == 1 || d == -1) {
              for (var j = 0; j < 7; j++) {
                if (d != -1 && this.gh_id > 0) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x - j - cover.margin + 1, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                };
                if (d != 1 && this.gh_id < list.total_gh - 1) {
                  a.FillSolidRect(Math.floor(cover.margin / 2) + this.x + this.w - cover.margin + j - 2, this.y + cover.normal_delta / 2, 1, this.h - cover.normal_delta - cover.margin - 1, RGBA(0, 0, 0, 150 - j * 25))
                }
              }
            }
          };
          a.DrawImage(loading_img, Math.floor(cover.margin / 2) + this.x, this.y, this.w, this.h, 0, 0, cover.w * cover.quality / 100, cover.h * cover.quality / 100, 0, 255)
        };
        if (this.gh_id == list.selected_gh_id) {
          list.focus_id_item_idx = this.idx;
          if (cover.draw_focus_border) {
            a.SetSmoothingMode(2);
            a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 1, this.y - 1, this.w - cover.margin * 2 + 2, this.h - cover.margin * 2 + 2, 2, 2, 3.0, g_backcolor_sel);
            a.DrawRoundRect(Math.floor(cover.margin / 2) + this.x - 2, this.y - 2, this.w - cover.margin * 2 + 4, this.h - cover.margin * 2 + 4, 3, 3, 1.0, RGBA(255, 255, 255, 60));
            a.SetSmoothingMode(0);
            a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, g_backcolor_sel);
            a.DrawRect(Math.floor(cover.margin / 2) + this.x + 1, this.y + 1, this.w - cover.margin * 2 - 2, this.h - cover.margin * 2 - 2, 1.0, RGBA(0, 0, 0, 40))
          }
        }
      }
    }
  };
  this.checkstate = function (a, x, y, b) {
    if (this.id >= 0) {
      this.ishover = (x > this.x && x < this.x + this.w && y >= this.y && y < this.y + this.h)
    } else {
      this.ishover = false
    };
    switch (a) {
    case "down":
      if (this.id >= 0) {
        if (plman.IsPlaylistItemSelected(panel.active_playlist, this.id)) {
          if (this.ishover) {
            if (panel.lock_playlist) {
              this.checkstate("mid", x, y, b)
            } else {
              SelectGroupItems(this.id, this.gh_id, true)
            };
            g_saved = this;
            refresh_spv(panel.active_playlist, bool_on_size)
          }
        } else {
          if (this.ishover) {
            if (utils.IsKeyPressed(VK_SHIFT)) {
              if (list.focus_id != this.id) {
                if (list.SHIFT_start_id != null) {} else {}
              }
            } else if (utils.IsKeyPressed(VK_CONTROL)) {
              if (panel.lock_playlist) {
                this.checkstate("mid", x, y, b)
              } else {
                SelectGroupItems(this.id, this.gh_id, true)
              }
            } else {
              SelectGroupItems(this.id, this.gh_id, true);
              g_saved = this;
              if (panel.lock_playlist) {
                g_saved.checkstate("mid", x, y, b)
              }
            }
          }
        }
      };
      break;
    case "dblclk":
      if (this.id >= 0 && g_saved != null) {
        if (plman.IsPlaylistItemSelected(panel.active_playlist, this.id)) {
          if (panel.lock_playlist) {
            if (this.id == g_saved.id) {
              plman.ExecutePlaylistDefaultAction(panel.active_playlist, list.hlist[g_saved.gh_id]);
              g_saved = null
            }
          } else {
            if (this.id == g_saved.id) {
              plman.ExecutePlaylistDefaultAction(panel.active_playlist, list.hlist[g_saved.gh_id]);
              g_saved = null;
              window.Repaint()
            }
          }
        }
      };
      break;
    case "mid":
      if (this.ishover) {
        if (plman.GetPlaylistName(panel.active_playlist) != "CoverFlow View") {
          SelectGroupItems(this.id, this.gh_id, true);
          var c = false;
          var d = 0;
          var e = panel.active_playlist;
          var f = plman.PlaylistCount;
          for (var i = 0; i < f; i++) {
            if (plman.GetPlaylistName(i) == "CoverFlow View") {
              c = true;
              d = i;
              break
            }
          };
          if (!c) {
            bypass.on_playlists_changed = true;
            d = plman.PlaylistCount;
            plman.CreatePlaylist(plman.PlaylistCount, "CoverFlow View")
          };
          plman.ActivePlaylist = d;
          fb.ClearPlaylist();
          var g = fb.PlaylistItemCount(d);
          plman.InsertPlaylistItems(d, g, plman.GetPlaylistSelectedItems(e), false);
          plman.SetPlaylistFocusItem(d, 0)
        }
      };
      break;
    case "right":
      if (this.ishover) {
        if (panel.lock_playlist) {
          list.selected_gh_id = this.gh_id;
          list.focus_id = this.id;
          bypass.on_item_focus_change = true;
          this.checkstate("mid", x, y, b)
        } else {
          list.selected_gh_id = this.gh_id;
          list.focus_id = this.id;
          bypass.on_item_focus_change = true;
          SelectGroupItems(this.id, this.gh_id, true)
        }
      };
      break;
    case "up":
      break;
    case "move":
      break;
    case "leave":
      break
    };
    return this.ishover
  }
};
var tf_path = fb.TitleFormat("$left(%_path_raw%,4)");
var tf_albumartist = fb.TitleFormat("$if(%length%,%album artist%,'Stream')");
var tf_album = fb.TitleFormat("$if2(%album%,$if(%length%,'Single','web radios'))");
var tf_group_key = fb.TitleFormat(window.GetProperty("_group Key", "%album artist%%album%"));
var tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
var g_instancetype = window.InstanceType;
var g_font = null;
var g_font_headers = null;
var ww = 0,
  wh = 0;
var mouse_x = 0,
  mouse_y = 0;
var g_textcolor = 0,
  g_textcolor_sel = 0,
  g_textcolor_hl = 0,
  g_backcolor = 0,
  g_backcolor_sel = 0;
var g_metadb;
var bool_on_size = false;
var g_search_string = "";
var incsearch_font = gdi.Font("lucida console", 9, 0);
var incsearch_font_big = gdi.Font("lucida console", 20, 1);
var clear_incsearch_timer = false;
var incsearch_timer = false;
var incsearch_timer_lock = false;
var g_saved = null;
var hand = false;
bypass = {
  on_item_focus_change: false,
  on_playlists_changed: false
};
panel = {
  max_width: 250,
  max_height: 250,
  arr_buttons: Array(),
  button_total: 3,
  show_text: window.GetProperty("panel.album.info.visible", true),
  custom_textcolor: window.GetProperty("panel.custom.text.color.normal", ""),
  custom_textcolor_selection: window.GetProperty("panel.custom.text.color.selection", ""),
  custom_backcolor: window.GetProperty("panel.custom.background.color", ""),
  lock_playlist: window.GetProperty("panel.lock.playlist.enabled", false),
  active_playlist: window.GetProperty("panel.active.playlist", 0),
  vertical_mode: false
};
list = {
  first_launch: true,
  total: 0,
  total_gh: 0,
  start_id: 0,
  nbvis: 0,
  mid: 0,
  item: Array(),
  hlist: Array(),
  handlelist: null,
  metadblist_selection: plman.GetPlaylistSelectedItems(panel.active_playlist),
  focus_id: 0,
  focus_id_item_idx: 0,
  selected_gh_id: 0,
  marker_id: 0,
  gh_id: 0,
  mousewheel_timer_value: 20,
  key_timer_value: 60,
  nowplaying: 0,
  SHIFT_start_id: null,
  SHIFT_count: 0,
  inc_search_noresult: false,
  nb_cover_to_draw: 0,
  buttonclicked: false,
  drag_stop: true,
  drag_timer: false
};
scrollbar = {
  theme: false,
  themed: window.GetProperty("list.scrollbar.themed", false),
  show: window.GetProperty("list.scrollbar.visible", true),
  visible: true,
  default_step: window.GetProperty("list.scrollbar.step", 3),
  step: 3,
  letter: null,
  button_total: 2,
  arr_buttons: Array(),
  timerID: false
}
hscrollbar = {
  hover: false,
  x: 0,
  y: 0,
  default_h: get_system_scrollbar_height(),
  h: get_system_scrollbar_height(),
  w: 0
};
vscrollbar = {
  hover: false,
  x: 0,
  y: 0,
  default_w: get_system_scrollbar_width(),
  w: get_system_scrollbar_width(),
  h: 0
};
scrollbarbt = {
  timerID1: false,
  timerID2: false,
  timer1_value: 400,
  timer2_value: 60
};
button_up = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h
};
button_down = {
  img_normal: null,
  img_hover: null,
  img_down: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h
};
cursor = {
  bt: null,
  img_normal: null,
  img_hover: null,
  img_down: null,
  popup: null,
  x: 0,
  y: 0,
  w: hscrollbar.default_h,
  h: hscrollbar.default_h,
  default_w: hscrollbar.default_h + 3,
  hover: false,
  drag: false,
  grap_x: 0,
  timerID: false,
  last_x: 0
};
cover = {
  margin: 2,
  w: 0,
  h: 0,
  top_offset: 0,
  default_pad_top_mid: 35,
  default_pad_bot_mid: 30,
  pad_top_mid: 35,
  pad_bot_mid: 30,
  default_pad_left_mid: 24,
  default_pad_right_mid: 20,
  pad_left_mid: 24,
  pad_right_mid: 20,
  normal_delta: 20,
  quality: window.GetProperty("list.covers.quality.percent", 100),
  draw_reflection: window.GetProperty("cover.draw.ground.reflection", true),
  reflect_strength_percent: window.GetProperty("cover.ground.reflection.percent", 20),
  draw_shadows: window.GetProperty("cover.draw.shadows", true),
  draw_focus_border: window.GetProperty("cover.draw.focus.border", true),
  draw_glass_effect: window.GetProperty("cover.draw.glass.effect", false),
  load_timer: false
};

function refresh_spv_cursor(a) {
  if (panel.vertical_mode) {
    var b = (cursor.y - vscrollbar.y) / (vscrollbar.h - cursor.h)
  } else {
    var b = (cursor.x - hscrollbar.x) / (hscrollbar.w - cursor.w)
  }
  if (b > 1) b = 1;
  if (b < 0) b = 0;
  var r = Math.round(b * list.total_gh);
  set_gh_id(a, list.hlist[r - 1]);
  window.Repaint()
}
function set_gh_id(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(b);
  if (list.gh_id == null) {
    list.gh_id = 0
  }
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  }
};

function scrollup_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r > 0) {
    var s = list.item[0].gh_id;
    if (s > 0) {
      list.item.unshift(new item(list.hlist[s - 1], 0, s - 1))
    } else {
      list.item.unshift(new item(-1, 0, -1))
    };
    list.item.pop()
  };
  var b = list.item.length;
  for (var i = 0; i < b; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function scrolldown_spv(a) {
  var r = list.item[list.mid].gh_id;
  if (r < list.total_gh - 1) {
    var s = list.item[list.item.length - 1].gh_id;
    if (s > 0 && s < list.total_gh - 1) {
      list.item.push(new item(list.hlist[s + 1], 0, s + 1))
    } else {
      list.item.push(new item(-1, 0, -1))
    };
    list.item.shift()
  };
  var b = list.item.length;
  for (var i = 0; i < b; i++) {
    list.item.idx = i
  };
  setcursorx()
};

function refresh_spv(a, b) {
  reset_cover_timers();
  list.item.splice(0, list.item.length);
  if (list.total_gh <= 0) return true;
  list.gh_id = get_gh_id(list.focus_id);
  if (list.gh_id == null) {
    init_active_pls();
    return true
  }
  list.selected_gh_id = list.gh_id;
  var r = list.gh_id - list.mid;
  if (r < 0) {
    list.start_id = Math.abs®;
    r = 0
  } else {
    list.start_id = 0
  };
  for (var k = 0; k < list.nbvis; k++) {
    if (k >= list.start_id && r < list.total_gh) {
      list.item.push(new item(list.hlist[r], k, r));
      r++
    } else {
      list.item.push(new item(-1, k, -1))
    }
  };
  if (scrollbar.show) {
    if (list.total_gh < 2) scrollbar.visible = false;
    else scrollbar.visible = true
  } else {
    scrollbar.visible = false
  };
  if (panel.vertical_mode) {
    cursor.h = Math.round(vscrollbar.h / list.total_gh);
    if (cursor.h > vscrollbar.h) cursor.h = vscrollbar.h;
    if (cursor.h < cursor.default_w) cursor.h = cursor.default_w
  } else {
    cursor.w = Math.round(hscrollbar.w / list.total_gh);
    if (cursor.w > hscrollbar.w) cursor.w = hscrollbar.w;
    if (cursor.w < cursor.default_w) cursor.w = cursor.default_w
  };
  set_scroller();
  setcursorx()
};

function get_gh_id(a) {
  var b = Math.floor(list.total_gh / 2);
  if (a < list.hlist) {
    var c = 0
  } else {
    var c = b
  };
  for (var i = c; i < list.total_gh; i++) {
    if (i < list.total_gh - 1) {
      if (a >= list.hlist && a < list.hlist[i + 1]) {
        return i
      }
    } else {
      if (a >= list.hlist) {
        return i
      } else {
        return null
      }
    }
  }
};

function setcursorx() {
  if (list.item.length > 0) {
    var a = Math.floor(list.item.length / 2);
    var b = list.item[a].gh_id;
    var c = b / (list.total_gh - 1);
    if (panel.vertical_mode) {
      cursor.y = vscrollbar.y + Math.round(c * (vscrollbar.h - cursor.h))
    } else {
      cursor.x = hscrollbar.x + Math.round(c * (hscrollbar.w - cursor.w))
    }
  } else {
    if (panel.vertical_mode) {
      cursor.y = vscrollbar.y
    } else {
      cursor.x = hscrollbar.x
    }
  }
};

function init_active_pls() {
  var a;
  var b;
  var c;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(panel.active_playlist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    if (i > 0 && i < list.total - 1) {
      i++;
      b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
      if (a != b) {
        if (i > 0) {
          c = tf_group_key.EvalWithMetadb(list.handlelist.Item(i - 1));
          if (a != c) {
            list.hlist.push(i - 1)
          };
          if (c != b) {
            list.hlist.push(i)
          }
        } else {
          list.hlist.push(i)
        };
        a = b
      }
    } else {
      b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
      if (a != b) {
        list.hlist.push(i);
        a = b
      }
    }
  };
  list.total_gh = list.hlist.length
};

function old_init_active_pls() {
  var a;
  var b;
  list.hlist.splice(0, list.hlist.length);
  list.handlelist = plman.GetPlaylistItems(panel.active_playlist);
  list.total = list.handlelist.Count;
  for (var i = 0; i < list.total; i++) {
    b = tf_group_key.EvalWithMetadb(list.handlelist.Item(i));
    if (a != b) {
      list.hlist.push(i);
      a = b
    }
  };
  list.total_gh = list.hlist.length
};

function on_font_changed() {
  get_font();
  on_playlist_switch()
};

function on_colors_changed() {
  get_colors();
  init_icons();
  redraw_stub_images();
  init_hscrollbar_buttons();
  set_scroller();
  g_image_cache = new image_cache;
  CollectGarbage();
  on_playlist_switch()
};

function on_init() {};

function on_size() {
  if (!window.Width || !window.Height) return;
  window.DlgCode = DLGC_WANTALLKEYS;
  bool_on_size = true;
  if (g_instancetype == 0) {
    window.MinWidth = 170;
    window.MinHeight = 170
  } else if (g_instancetype == 1) {
    window.MinWidth = 170;
    window.MinHeight = 170
  };
  ww = window.Width;
  wh = window.Height;
  if (ww > wh) {
    panel.vertical_mode = false;
    window.MaxHeight = panel.max_height;
    window.MaxWidth = 2000;
    if (wh < 170) wh = 170
  } else {
    panel.vertical_mode = true;
    window.MaxWidth = panel.max_width;
    window.MaxHeight = 2000;
    if (ww < 170) ww = 170
  };
  var a = window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  if (a == "") window.SetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]");
  tf_group_info = fb.TitleFormat(window.GetProperty("_group TF text info", "%album artist%[ | %album%][ | %date%]"));
  get_font();
  get_colors();
  init_icons();
  if (panel.vertical_mode) {
    if (scrollbar.show) {
      cover.pad_right_mid = cover.default_pad_right_mid + vscrollbar.default_w
    } else {
      cover.pad_right_mid = cover.default_pad_right_mid
    }
    cover.h = ww - cover.pad_left_mid - cover.pad_right_mid;
    cover.w = cover.h;
    list.nbvis = Math.floor(wh / (cover.h - cover.normal_delta * 2)) + 2 + 10;
    if (list.nbvis / 2 == Math.floor(list.nbvis / 2)) {
      list.nbvis--
    }
    list.mid = Math.floor(list.nbvis / 2);
    list.nb_cover_to_draw = Math.floor(wh / (cover.h - cover.normal_delta * 2)) + 2;
    if (scrollbar.themed) {
      scrollbar.theme = window.CreateThemeManager("scrollbar")
    } else {
      scrollbar.theme = false
    };
    init_vscrollbar_buttons();
    button_up.x = ww - button_up.w;
    button_up.y = 0;
    button_down.x = ww - button_down.w;
    button_down.y = wh - button_down.h;
    vscrollbar.y = button_up.h;
    vscrollbar.h = wh - button_up.h - button_down.h;
    cursor.x = ww - vscrollbar.w;
    cursor.y = vscrollbar.y;
    cursor.w = vscrollbar.w
  } else {
    if (scrollbar.show) {
      cover.pad_bot_mid = cover.default_pad_bot_mid
    } else {
      cover.pad_bot_mid = cover.default_pad_bot_mid - hscrollbar.default_h
    }
    if (panel.show_text) {
      cover.pad_top_mid = cover.default_pad_top_mid
    } else {
      cover.pad_top_mid = cover.default_pad_top_mid - 16
    };
    cover.w = wh - cover.pad_top_mid - cover.pad_bot_mid;
    cover.h = cover.w;
    list.nbvis = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2 + 10;
    if (list.nbvis / 2 == Math.floor(list.nbvis / 2)) {
      list.nbvis--
    }
    list.mid = Math.floor(list.nbvis / 2);
    list.nb_cover_to_draw = Math.floor(ww / (cover.w - cover.normal_delta * 2)) + 2;
    if (scrollbar.themed) {
      scrollbar.theme = window.CreateThemeManager("scrollbar")
    } else {
      scrollbar.theme = false
    };
    init_hscrollbar_buttons();
    button_up.x = 0;
    button_up.y = wh - hscrollbar.h;
    button_down.x = ww - button_down.w;
    button_down.y = wh - hscrollbar.h;
    hscrollbar.x = button_up.w;
    hscrollbar.w = ww - button_up.w - button_down.w;
    cursor.y = wh - hscrollbar.h;
    cursor.x = hscrollbar.x;
    cursor.h = hscrollbar.h
  };
  redraw_stub_images();
  if (list.first_launch) {
    list.first_launch = false;
    on_playlist_switch()
  } else {
    g_image_cache = new image_cache;
    CollectGarbage();
    refresh_spv(panel.active_playlist, true)
  }
};

function on_paint(a) {
  a.FillSolidRect(0, 0, ww, wh, g_backcolor);
  if (list.item.length > 0) {
    var b, mid2;
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    for (var c = 1; c < list.mid + 1; c++) {
      if (c > 1 && c <= list.mid) {
        b = true
      } else {
        b = false
      };
      mid2 = list.mid - c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c, b)
      }
      mid2 = list.mid + c;
      if (mid2 >= 0 && mid2 <= list.item.length - 1) {
        list.item[mid2].draw(a, list.item[mid2].id, mid2, c * -1, b)
      }
    };
    mid2 = list.mid - 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, 1, true)
    }
    mid2 = list.mid + 1;
    if (mid2 >= 0 && mid2 <= list.item.length - 1) {
      list.item[mid2].draw(a, list.item[mid2].id, mid2, -1, true)
    }
    list.item[list.mid].draw(a, list.item[list.mid].id, list.mid, 0, true);
    if (!panel.vertical_mode) {
      if (panel.show_text) {
        var d = 32;
        var f = ww - 64;
        if (list.item[list.mid].id >= 0) {
          a.GdiDrawText(list.item[list.mid].group_info, g_font, g_textcolor, d, 0, f, cover.pad_top_mid - 4, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
        }
      }
    }
  } else {
    if (fb.PlaylistCount > 0) {
      var g = fb.GetPlaylistName(fb.ActivePlaylist);
      var h = "This playlist is empty"
    } else {
      var g = "Br3tt's WSH CoverFlow";
      var h = "Create a playlist to start!"
    };
    a.SetTextRenderingHint(5);
    a.DrawString(g, gdi.Font("Tahoma", 17, 0), g_textcolor, 0, -20, ww, wh, cc_stringformat);
    a.DrawString(h, gdi.Font("Tahoma", 13, 0), g_textcolor, 0, 20, ww, wh, cc_stringformat);
    a.FillGradRect(40, Math.floor(wh / 2), ww - 80, 1, 0, 0, g_textcolor, 0.5);
    a.FillSolidRect(0, 0, ww, wh, g_backcolor & 0xbbffffff)
  };
  if (list.total_gh > 0 && scrollbar.visible && scrollbar.show) {
    if (panel.vertical_mode) {
      try {
        scrollbar.theme.SetPartAndStateId(6, 1);
        scrollbar.theme.DrawThemeBackground(a, ww - vscrollbar.w, 0, vscrollbar.w, wh)
      } catch (e) {
        a.FillSolidRect(ww - vscrollbar.w, 0, vscrollbar.w, wh, g_backcolor & 0x77ffffff);
        a.FillSolidRect(ww - vscrollbar.w, 0, 1, wh, RGBA(0, 0, 0, 20))
      };
      cursor.bt.draw(a, ww - vscrollbar.w, cursor.y, 255);
      try {
        scrollbar.theme.SetPartAndStateId(9, 1);
        scrollbar.theme.DrawThemeBackground(a, ww - vscrollbar.w, cursor.y, cursor.w, cursor.h)
      } catch (e) {};
      for (i = 0; i < scrollbar.arr_buttons.length; i++) {
        switch (i) {
        case 0:
          scrollbar.arr_buttons.draw(a, ww - vscrollbar.w, button_up.y, 255);
          break;
        case 1:
          scrollbar.arr_buttons.draw(a, ww - vscrollbar.w, button_down.y, 255);
          break
        }
      };
      if (cursor.drag) {
        scrollbar.letter = list.item[Math.floor(list.nbvis / 2)].albumartist.substring(0, 1).toUpperCase();
        cursor.popup && a.DrawImage(cursor.popup, ww - vscrollbar.w - cursor.popup.Width - 00, cursor.y + Math.floor(cursor.h / 2) - Math.floor(cursor.popup.Height / 2), cursor.popup.Width, cursor.popup.Height, 0, 0, cursor.popup.Width, cursor.popup.Height, 0, 155);
        cursor.popup && a.GdiDrawText(scrollbar.letter, gdi.Font("segoe ui", 14, 0), g_backcolor, ww - vscrollbar.w - cursor.popup.Width - 00, cursor.y + Math.floor(cursor.h / 2) - Math.floor(cursor.popup.Height / 2), cursor.popup.Width - 5, cursor.popup.Height, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
      }
    } else {
      try {
        scrollbar.theme.SetPartAndStateId(4, 1);
        scrollbar.theme.DrawThemeBackground(a, 0, wh - hscrollbar.h, ww, hscrollbar.h);
        a.FillSolidRect(0, wh - hscrollbar.h - 1, ww, 1, RGBA(0, 0, 0, 10))
      } catch (e) {
        a.FillSolidRect(0, wh - hscrollbar.h, ww, hscrollbar.h, g_backcolor & 0x77ffffff);
        a.FillSolidRect(0, wh - hscrollbar.h, ww, 1, RGBA(0, 0, 0, 20))
      };
      try {
        cursor.bt.draw(a, cursor.x, cursor.y, 255)
      } catch (e) {};
      try {
        scrollbar.theme.SetPartAndStateId(8, 1);
        scrollbar.theme.DrawThemeBackground(a, cursor.x, wh - hscrollbar.h + 0, cursor.w, cursor.h)
      } catch (e) {};
      for (i = 0; i < scrollbar.arr_buttons.length; i++) {
        switch (i) {
        case 0:
          scrollbar.arr_buttons.draw(a, button_up.x, button_up.y, 255);
          break;
        case 1:
          scrollbar.arr_buttons.draw(a, button_down.x, button_down.y, 255);
          break
        }
      };
      if (cursor.drag) {
        scrollbar.letter = list.item[Math.floor(list.nbvis / 2)].albumartist.substring(0, 1).toUpperCase();
        cursor.popup && a.DrawImage(cursor.popup, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height, 0, 0, cursor.popup.Width, cursor.popup.Height, 0, 155);
        cursor.popup && a.GdiDrawText(scrollbar.letter, gdi.Font("segoe ui", 14, 0), g_backcolor, cursor.x + Math.floor(cursor.w / 2) - Math.floor(cursor.popup.Width / 2), wh - hscrollbar.h - cursor.popup.Height, cursor.popup.Width, cursor.popup.Height - 5, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX)
      }
    }
  };
  for (i = 0; i < panel.arr_buttons.length; i++) {
    switch (i) {
    case 0:
      if (!panel.lock_playlist) {
        panel.arr_buttons.draw(a, 4, 4, (list.total_gh > 0) ? 255 : 80)
      };
      break;
    case 1:
      if (panel.vertical_mode) {
        panel.arr_buttons.draw(a, 4, wh - 22 - 4, (list.total_gh > 0) ? 255 : 80)
      } else {
        panel.arr_buttons.draw(a, ww - 22 - 4, 4, (list.total_gh > 0) ? 255 : 80)
      };
      break;
    case 2:
      if (panel.lock_playlist) {
        if (panel.vertical_mode) {
          panel.arr_buttons.draw(a, 4, 4, 255)
        } else {
          panel.arr_buttons.draw(a, 4, 4, 255)
        }
      };
      break
    }
  };
  if (!panel.vertical_mode) {
    a.FillGradRect(0, 0, ww, 1, 0, 0, g_textcolor & 0x15ffffff, 0.5)
  };
  if (g_search_string.length > 0) {
    a.SetSmoothingMode(2);
    var j = Math.floor((ww / 2) - ((g_search_string.length * 13) + (10 * 2)) / 2);
    var k = Math.floor(wh / 2) - 30;
    var l = ((g_search_string.length * 13) + (10 * 2));
    var m = 60;
    a.FillRoundRect(j, k, l, m, 5, 5, RGBA(0, 0, 0, 150));
    a.DrawRoundRect(j, k, l, m, 5, 5, 2.0, RGBA(255, 255, 255, 200));
    a.DrawRoundRect(j + 2, k + 2, l - 4, m - 4, 3, 3, 1.0, RGBA(0, 0, 0, 150));
    a.GdiDrawText(g_search_string, incsearch_font_big, RGB(0, 0, 0), j + 1, k + 1, l, m, DT_CENTER | DT_NOPREFIX | DT_CALCRECT | DT_VCENTER);
    a.GdiDrawText(g_search_string, incsearch_font_big, list.inc_search_noresult ? RGB(255, 75, 75) : RGB(250, 250, 250), j, k, l, m, DT_CENTER | DT_NOPREFIX | DT_CALCRECT | DT_VCENTER)
  }
};

function on_mouse_lbtn_down(x, y) {
  bool_on_size = false;
  var a = list.item.length;
  var b = 0;
  if (!list.item[list.mid].checkstate("down", x, y, list.mid)) {
    for (var i = 1; i < list.mid + 1; i++) {
      b = list.mid - i;
      if (b >= 0 && b <= a - 1) {
        if (list.item.checkstate("down", x, y, b)) {
          break
        }
      };
      b = list.mid + i;
      if (b >= 0 && b <= a - 1) {
        if (list.item.checkstate("down", x, y, b)) {
          break
        }
      }
    }
  };
  if (list.total_gh > 0 && scrollbar.visible && scrollbar.show) {
    if (panel.vertical_mode) {
      if (cursor.bt.checkstate("down", x, y) == ButtonStates.down) {
        cursor.drag = true;
        cursor.grap_y = y - cursor.y;
        cursor.last_y = cursor.y
      };
      if (vscrollbar.hover && !cursor.drag) {
        scrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
        if (scrollbar.step < 1) scrollbar.step = 1;
        if (y < cursor.y) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_x > ww - vscrollbar.w && cursor.y > mouse_y) {
                    on_mouse_wheel(scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        } else {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1 * scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(-1 * scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_x > ww - vscrollbar.w && cursor.y + cursor.h < mouse_y) {
                    on_mouse_wheel(-1 * scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        }
      }
    } else {
      if (cursor.bt.checkstate("down", x, y) == ButtonStates.down) {
        cursor.drag = true;
        cursor.grap_x = x - cursor.x;
        cursor.last_x = cursor.x
      };
      if (hscrollbar.hover && !cursor.drag) {
        scrollbar.step = Math.floor(list.nb_cover_to_draw / 2);
        if (scrollbar.step < 1) scrollbar.step = 1;
        if (x < cursor.x) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_y > wh - hscrollbar.h && cursor.x > mouse_x) {
                    on_mouse_wheel(scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        } else {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1 * scrollbar.step);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              on_mouse_wheel(-1 * scrollbar.step);
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                if (hscrollbar.hover) {
                  if (mouse_y > wh - hscrollbar.h && cursor.x + cursor.w < mouse_x) {
                    on_mouse_wheel(-1 * scrollbar.step)
                  }
                }
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        }
      }
    };
    for (i = 0; i < scrollbar.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (scrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(1);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              reset_cover_timers();
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                on_mouse_wheel(1)
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        };
        break;
      case 1:
        if (scrollbar.arr_buttons.checkstate("down", x, y) == ButtonStates.down) {
          if (!list.buttonclicked) {
            list.buttonclicked = true;
            on_mouse_wheel(-1);
            scrollbarbt.timerID1 = window.SetTimeout(function () {
              reset_cover_timers();
              scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
              scrollbarbt.timerID1 = false;
              scrollbarbt.timerID2 && window.ClearInterval(scrollbarbt.timerID2);
              scrollbarbt.timerID2 = window.SetInterval(function () {
                on_mouse_wheel(-1)
              }, scrollbarbt.timer2_value)
            }, scrollbarbt.timer1_value)
          }
        };
        break
      }
    }
  };
  if (list.total_gh > 0) {
    for (var i = 0; i < panel.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (!panel.lock_playlist) {
          panel.arr_buttons.checkstate("down", x, y)
        };
        break;
      default:
        panel.arr_buttons.checkstate("down", x, y)
      }
    }
  }
};

function on_mouse_lbtn_dblclk(x, y, a) {
  if (panel.vertical_mode) {
    if (x < cover.pad_left_mid) {} else if (x < ww - cover.pad_right_mid) {
      var b = list.item.length;
      for (var i = 0; i < b; i++) {
        list.item.checkstate("dblclk", x, y, i)
      }
    } else {
      on_mouse_lbtn_down(x, y)
    }
  } else {
    if (y < cover.pad_top_mid) {} else if (y < wh - cover.pad_bot_mid) {
      var b = list.item.length;
      for (var i = 0; i < b; i++) {
        list.item.checkstate("dblclk", x, y, i)
      }
    } else {
      on_mouse_lbtn_down(x, y)
    }
  }
};

function on_mouse_lbtn_up(x, y) {
  list.buttonclicked = false;
  scrollbar.timerID && window.ClearTimeout(scrollbar.timerID);
  scrollbar.timerID = false;
  scrollbarbt.timerID1 && window.ClearTimeout(scrollbarbt.timerID1);
  scrollbarbt.timerID1 = false;
  scrollbarbt.timerID2 && window.ClearTimeout(scrollbarbt.timerID2);
  scrollbarbt.timerID2 = false;
  if (list.drag_timer) {
    window.ClearTimeout(list.drag_timer);
    list.drag_timer = false;
    list.drag_stop = true
  }
  if (list.total_gh > 0) {
    cursor.bt.checkstate("up", x, y);
    for (var i = 0; i < scrollbar.arr_buttons.length; i++) {
      scrollbar.arr_buttons.checkstate("up", x, y)
    };
    for (i = 0; i < panel.arr_buttons.length; i++) {
      switch (i) {
      case 0:
        if (!panel.lock_playlist) {
          if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
            ShowNowPlaying()
          }
        };
        break;
      case 1:
        if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
          settings_menu(x, y)
        };
        break;
      case 2:
        if (panel.lock_playlist) {
          if (panel.arr_buttons.checkstate("up", x, y) == ButtonStates.hover) {
            panel.lock_playlist = false;
            window.SetProperty("panel.lock.playlist.enabled", panel.lock_playlist);
            plman.ActivePlaylist = panel.active_playlist
          }
        };
        break
      }
    };
    if (cursor.drag) {
      window.RepaintRect(0, wh - hscrollbar.h, ww, hscrollbar.h);
      cursor.drag = false
    } else {
      var a = list.item.length;
      for (i = 0; i < a; i++) {
        list.item.checkstate("up", x, y, i)
      }
    };
    setcursorx();
    window.Repaint()
  }
};

function on_mouse_mbtn_down(x, y, a) {
  bool_on_size = false;
  var b = list.item.length;
  for (var i = 0; i < b; i++) {
    list.item.checkstate("mid", x, y, i)
  }
};

function on_mouse_rbtn_down(x, y) {
  bool_on_size = false;
  var a = list.item.length;
  var b = false;
  var c = list.mid;
  if (list.item[list.mid].checkstate("right", x, y, list.mid)) {
    b = true
  } else {
    for (var i = 1; i < list.mid + 1; i++) {
      c = list.mid - i;
      if (c >= 0 && c <= a - 1) {
        if (list.item[c].checkstate("right", x, y, c) == true) {
          b = true;
          break
        }
      };
      c = list.mid + i;
      if (c >= 0 && c <= a - 1) {
        if (list.item[c].checkstate("right", x, y, c) == true) {
          b = true;
          break
        }
      }
    }
  };
  if (b) {
    new_context_menu(x, y, list.item[c].id, list.item[c].idx)
  }
};

function on_mouse_rbtn_up(x, y) {
  if (!utils.IsKeyPressed(VK_SHIFT)) {
    return true
  }
};

function on_mouse_move(x, y) {
  if (x == mouse_x && y == mouse_y) return true;
  hand = false;
  if (cursor.drag) {
    list.drag_stop = false;
    if (list.drag_timer) {
      window.ClearTimeout(list.drag_timer);
      list.drag_timer = false
    }
    list.drag_timer = window.SetTimeout(function () {
      list.drag_stop = true;
      window.ClearTimeout(list.drag_timer);
      list.drag_timer = false;
      window.Repaint()
    }, 25)
  } else {
    list.drag_stop = true
  };
  if (list.total_gh > 0 && scrollbar.visible && scrollbar.show) {
    if (panel.vertical_mode) {
      vscrollbar.hover = (x >= ww - vscrollbar.w && x <= ww && y >= vscrollbar.y && y <= vscrollbar.y + vscrollbar.h);
      cursor.hover = (x >= cursor.x && x <= cursor.x + cursor.w && y >= cursor.y && y <= cursor.y + cursor.h);
      cursor.bt.checkstate("move", x, y);
      for (var i = 0; i < scrollbar.arr_buttons.length; i++) {
        scrollbar.arr_buttons
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2012-04-01 20:57:50
The panel crashes when 1. playlist is empty and 2. the option button (upper right corner) is pressed.

Edit
The size of the ui-elemnt is locked when it reaches a certain size: i can't make it bigger. Therefore (when it is placed in a tabstack) all other tabs are limited to coverflow maximum size. Somehow annoying!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-01 21:25:12
The panel crashes when 1. playlist is empty and 2. the option button (upper right corner) is pressed.

Edit
The size of the ui-elemnt is locked when it reaches a certain size: i can't make it bigger. Therefore (when it is placed in a tabstack) all other tabs are limited to coverflow maximum size. Somehow annoying!


it seems the paste in this forum has added unwanted characters, that's weird, so, download this script from here: http://fav.me/d4t4lh7 (http://fav.me/d4t4lh7)

e.g: "if ( c ) {" is translated "if © {", that make the script crashing of course.

all is fine there.

yep, i've limited size to 300 pixel height.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-01 21:28:30
The panel crashes when 1. playlist is empty and 2. the option button (upper right corner) is pressed.

Edit
The size of the ui-elemnt is locked when it reaches a certain size: i can't make it bigger. Therefore (when it is placed in a tabstack) all other tabs are limited to coverflow maximum size. Somehow annoying!


it seems the paste in this forum has added unwanted characters, that's weird, so, download this script from here: http://fav.me/d4t4lh7 (http://fav.me/d4t4lh7)

e.g: "if ( c ) {" is translated "if © {", that make the script crashing of course.

all is fine there.

yep, i've limited size to 300 pixel height.

Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2012-04-01 21:33:10
I downloaded it from your link and did it once again, but still crashes!

edit
Any chance to make the panel sizeable again but without making the thumbnails larger than necessary, means: than in 300 pixel panel? I have no space to place it outside a tabstack.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2012-04-01 21:37:34
I seem to get a lot of crashes on line 378 (vertical mode) and line 380 (horizontal mode) in CUI when switching between layouts with and without the panel. But I haven't encountered them yet in DUI when switching between tabs. Otherwise it's excellent work & fast too.

Code: [Select]
Error: WSH Panel Mod (CoverFlow View v1 beta7 v0.0.7.20120401.1646 by Br3tt): Microsoft JScript runtime error:
Overflow
File: <main>
Ln: 378, Col: 13
<source text only available at compile time>

Error: WSH Panel Mod (CoverFlow View v1 beta7 v0.0.7.20120401.1646 by Br3tt): Microsoft JScript runtime error:
Overflow
File: <main>
Ln: 380, Col: 13
<source text only available at compile time>

***EDIT***
Also it doesn't always identify the correct now playing cover, especially if minimise foobar2000, use another program and then return to foobar2000 after a track change. It sometimes gets stuck on the previous track's cover. Even pressing the music note button causes it to highlight the wrong cover.  Again CUI & seen in horizontal mode.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2012-04-01 21:46:38
Ah, sorry: forgot the console output

Code: [Select]
Error: WSH Panel Mod (CoverFlow View v1 beta7 v0.0.7.20120401.1646 by Br3tt): Laufzeitfehler in Microsoft JScript:
'list.item[...]' ist Null oder kein Objekt
File: <main>
Ln: 1329, Col: 3
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-01 22:11:52
thanx for feedback, i've mainly tested it on DUI, i'll check your reports to see what's the issue.

EDIT: with the paste problem on this topic, i'd be sure every use the same script, so, please, thanx to test it again from here this time (i've made a little fix about the lines pointed by WilB):

http://pastebin.com/X8xdSZkA (http://pastebin.com/X8xdSZkA)

btw, i can't reproduce any crash on DUI or CUI from my side.

thanx by advance.

Any chance to make the panel sizeable again but without making the thumbnails larger than necessary, means: than in 300 pixel panel? I have no space to place it outside a tabstack.

i will remove this limitation, asap all your issues will be fixed
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2012-04-01 22:43:47
Thanks for your fast response. Unfortunately, the crashes are still occurring (e.g. line 380 when in vertical mode). I also spotted another issue added as an edit to my previous post.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-01 23:04:53
Thanks for your fast response. Unfortunately, the crashes are still occurring (e.g. line 380 when in vertical mode). I also spotted another issue added as an edit to my previous post.


before getting further, i'd like to know if you test my panel in a config that conatins other WSH panels? i ask that because if timers are badly handled in them, it can (often) affect other WSH panels as the CoverFlow panel that use timers too.

could you tell me what's your situation please?

btw, replacing line 380 by these 3 lines:
Code: [Select]
                        try {
                            window.RepaintRect(cover.pad_left_mid, list.item[i].y - 2, ww - cover.pad_left_mid, list.item[i].h + 4);
                        } catch(e) {};

and line 384 by these 3 lines:
Code: [Select]
                        try {
                            window.RepaintRect(list.item[i].x - 2, cover.pad_top_mid, list.item[i].w + 4, wh - cover.pad_top_mid);
                        } catch (e) {};


should avoid crash for you... at least at these lines

EDIT: any other feedback from new user would be really appreciated, especially when it works fine too. So thanx by advance.
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2012-04-01 23:41:41
here the console output with the script from pastebin:

Error: WSH Panel Mod (CoverFlow View v1 beta7.1 v0.0.7.20120401.2320 by Br3tt): Laufzeitfehler in Microsoft JScript:
'list.item[...]' ist Null oder kein Objekt
File: <main>
Ln: 1333, Col: 2
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-01 23:45:08
here the console output with the script from pastebin:

Error: WSH Panel Mod (CoverFlow View v1 beta7.1 v0.0.7.20120401.2320 by Br3tt): Laufzeitfehler in Microsoft JScript:
'list.item[...]' ist Null oder kein Objekt
File: <main>
Ln: 1333, Col: 2
<source text only available at compile time>


ok for this bug, fixed in this new version normally:

http://pastebin.com/WdkYVzrn (http://pastebin.com/WdkYVzrn)

thanx for the feedback
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-02 12:18:12
WSH CoverFlow v1 beta 8 : http://pastebin.com/2srRwRXp (http://pastebin.com/2srRwRXp)

maximum height/width limit removed.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-04-02 12:46:48
Falstaff

In my configuration (foo_playlist_attributes) played tracks removed from playlist after playing.

But covers of this tracks not deleted automatically from WSH Coverflow panel. It is possible add this future in next version of coverflow script.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2012-04-02 14:46:52
@Falstaff
I am pleased to say that I am no longer experiencing crashes with beta 8; the catch (e) seems to have solved the problem.

I have troubleshooted the sticking cover issue further. Essentially it's a similar problem to that reported by pIv above. The problem occurs when using foo_lastfm_radio but not when playing tracks in the media library. foo_lastfm_radio removes played tracks from the playlist, but covers of these tracks remain in coverflow and so coverflow is not updating to reflect the changed playlist. If I remain in foobar2000 when a track change occurs the correct cover is nonetheless highlighted. If I toggle away from foobar2000 while a track change occurs the incorrect previous cover is often highlighted as the now playing cover (not corrected by pressing the music note button).

Thanks for your hard work on this. Previously I have been using a wsh coverflow based on the Grimes code but yours automatically updates and is visually an improvement.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-02 17:49:32
Falstaff
...But covers of this tracks not deleted automatically from WSH Coverflow panel. It is possible add this future in next version of coverflow script.

I have troubleshooted the sticking cover issue further. Essentially it's a similar problem to that reported by pIv above. The problem occurs when using foo_lastfm_radio but not when playing tracks in the media library. foo_lastfm_radio removes played tracks from the playlist, but covers of these tracks remain in coverflow and so coverflow is not updating to reflect the changed playlist. If I remain in foobar2000 when a track change occurs the correct cover is nonetheless highlighted. If I toggle away from foobar2000 while a track change occurs the incorrect previous cover is often highlighted as the now playing cover (not corrected by pressing the music note button).


i'll check that, should not be a big deal to fix ....

Thanks for your hard work on this. Previously I have been using a wsh coverflow based on the Grimes code but yours automatically updates and is visually an improvement.


Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-02 19:16:28
...The problem occurs when using foo_lastfm_radio but not when playing tracks in the media library. foo_lastfm_radio removes played tracks from the playlist, but covers of these tracks remain in coverflow and so coverflow is not updating to reflect the changed playlist.


are you sure of that, i've just tested lastfm_radio component (lastest version) and coverflow updates as well the tracks change!
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2012-04-02 19:36:12
I have just retested under DUI & CUI with foo_lastfm_radio 0.5.7e which I believe is the latest. On track change I see the track and cover of the played track disappear from the playlist but the cover remains in coverflow (the only exception to this is if there are less than ~4 tracks in the playlist and the playlist updates by adding new tracks, then coverflow updates correctly). This behaviour is confirmed on 2 different PCs. Clicking refresh coverflow on the menu will, however, update coverflow.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-02 20:10:19
I have just retested under DUI & CUI with foo_lastfm_radio 0.5.7e which I believe is the latest. On track change I see the track and cover of the played track disappear from the playlist but the cover remains in coverflow. This behaviour is confirmed on 2 different PCs. Clicking refresh coverflow on the menu will, however, update coverflow.


v 0.5.7e here too but different behaviour here, weird, i'll try on another PC...
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2012-04-02 20:36:37
New simplified and revised map only version of WSH-Script FooTour.

Download: http://pastebin.de/24891 (http://pastebin.de/24891)

Screenshot:
(http://www.abload.de/img/foobar2000_2012-04-02dqd7h.png) (http://www.abload.de/image.php?img=foobar2000_2012-04-02dqd7h.png)

Installation: Download world map and FooTour banner from
http://eoimages.gsfc.nasa.gov/images/image...w_topo_2048.jpg (http://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_2048.jpg)
http://www.abload.de/image.php?img=footouro74r.png (http://www.abload.de/image.php?img=footouro74r.png)
credits: NASA
http://foobar-users.de/index.php?topic=200...g17454#msg17454 (http://foobar-users.de/index.php?topic=2000.msg17454#msg17454)

rename to world-map.jpg and footour.png
and put pictures in new created (profile)\foobar2000\pictures folder
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2012-04-02 21:34:32
@falstaff

no more crashes! 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-02 21:56:24
@q-stankovic

thanx for the feedback
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-02 22:41:47
I have just retested under DUI & CUI with foo_lastfm_radio 0.5.7e which I believe is the latest. On track change I see the track and cover of the played track disappear from the playlist but the cover remains in coverflow. This behaviour is confirmed on 2 different PCs. Clicking refresh coverflow on the menu will, however, update coverflow.


ok, i see what you mean now, i've not understood, because coverflow refresh when lastfm radio add a new track to the playlist, and so, your issue is when a track is played, it should be removed immediatly. i'll see if i can catch this event! well see.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2012-04-02 23:45:26
Yes there's that plus the presumably knock-on effect with foo_lastfm_radio (may be also when foo_playlist_attributes is set to remove tracks as posted above) that the cover highlighted/centred & the displayed information soon get out of sync with the playing track. For example, with foo_lastfm_radio, in my hands pressing play next track a few times soon results in it sticking on the wrong cover/info.

HTH
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-03 07:34:15
WSH CoverFlow v1 beta 8.1 : http://pastebin.com/Etr6TkDG (http://pastebin.com/Etr6TkDG)

What's New in beta8.1:
- added coverflow refresh on track removed
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2012-04-03 13:45:03
@Falstaff

Thanks for beta 8.1. All is now working well. 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-03 15:27:44
@WilB

ok, thank you for the tests and feedback
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-03 17:58:45
In my configuration (foo_playlist_attributes) played tracks removed from playlist after playing.
But covers of this tracks not deleted automatically from WSH Coverflow panel. It is possible add this future in next version of coverflow script.


is this fixed for you with beta 8.1 ? thanx by advance for your feedback about the use of foo_playlist_attributes with my script now (should be ok)
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-04-03 18:41:50
In my configuration (foo_playlist_attributes) played tracks removed from playlist after playing.
But covers of this tracks not deleted automatically from WSH Coverflow panel. It is possible add this future in next version of coverflow script.


is this fixed for you with beta 8.1 ? thanx by advance for your feedback about the use of foo_playlist_attributes with my script now (should be ok)


New version beta 8.1 work now very good!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-03 20:08:53
@pIv

thank you
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-04-03 20:18:00
Maybe it makes sence to add mouse gestures to scroll ? It works, it is convenient. I made it very easy (in other script) :


Code: [Select]
var gest_x1, gest_y1, gest_x2, gest_y2;

function on_mouse_lbtn_down(x, y) {
    gest_x1 = x;
    gest_y1 = y;
}

function on_mouse_lbtn_up (x, y) {
gest_x2 = x;
                gest_y2 = y;
        if ( (gest_y2 - gest_y1 < 10) && (gest_y2 - gest_y1 > -10))  {
        if (gest_x2 - gest_x1 > 30) {Cover.NextCover(); window.Repaint();};
        if (gest_x2 - gest_x1 < -30) {Cover.PrevCover(); window.Repaint();}
                                                                                                  }
                                                }
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-04 14:22:47
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

news / reviews / blogs: fix condition where artist pages with no info would never get checked for updates.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-05 19:02:34
WSH CoverFlow v1 beta 9 : http://pastebin.com/uEcgtjq6 (http://pastebin.com/uEcgtjq6)

What's New in beta9:
- added a transition effect (scroll) on cover change (option in settings, top/right button of the panel)

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-06 11:11:03
WSH CoverFlow v1 beta 9.1 : http://pastebin.com/ANFNNA3Q (http://pastebin.com/ANFNNA3Q)

What's New in beta9.1:
- transition effect enhanced on cover change, and propagated to mousewheel and keys now
- small glitch on cover reflection fixed
Title: WSH Panel Mod script discussion/help
Post by: grimes on 2012-04-06 11:17:45
@Falstaff

I'am enjoying your WSH Coverflow very much. thanks for that.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-06 11:26:24
@grimes

you're welcome
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-06 19:21:43
WSH CoverFlow v1 beta 10 : http://pastebin.com/5wKb799f (http://pastebin.com/5wKb799f)

What's New in beta 10:
- transition effect enhanced
- bugs fixed (transition, reflection, behaviour, ...)
- new FLAT MODE added
- Settings Menu enhanced
- tweaks

(http://img703.imageshack.us/img703/4221/wshcoverflowpreview019.png) (http://imageshack.us/photo/my-images/703/wshcoverflowpreview019.png/)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-07 18:52:28
WSH CoverFlow v1 beta 11 (latest beta before final) : http://pastebin.com/rfe2B6K4 (http://pastebin.com/rfe2B6K4)

What's New in beta 11:
- keep aspect ratio added (can be disabled in Properties)
- Properties reordered, users can modify those than begin with *USER_xxx ... other ones SYSTEM_xxx are to not change!
- new properties to change default images by custom ones (for stream, nocover and loading)
- tweaks


Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-08 19:45:15
WSH CoverFlow v1.0.0 final : http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

[a href="http://pastebin.com/u/Br3tt" target="_blank"]

enjoy!
Title: WSH Panel Mod script discussion/help
Post by: MaCs on 2012-04-12 18:36:25
WSH CoverFlow v1.0.0 final :

Thanks for this nice script. Is it possible to take the whole music library as source, instead of the playlist?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-12 21:00:29
WSH CoverFlow v1.0.0 final :

Thanks for this nice script. Is it possible to take the whole music library as source, instead of the playlist?


no. but just create an autoplaylist of your library (query like that: %path% PRESENT), and lock it in the coverflow, so, you'll be able to browse your full library with this panel  regardless of the playlist activated
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-14 11:04:06
WSH Playlist Viewer v2 beta 2 : http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

first "true" beta of this jscript for WSH Panel Mod component (v1.5.2)

(http://i.imgur.com/9I7MU.png) (http://fav.me/d4se96u)
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-04-14 15:38:52
WSH Playlist Viewer v2 beta 2 : http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

first "true" beta of this jscript for WSH Panel Mod component (v1.5.2)


Don't remember the state of "Show scrollbar". Hiding the scrollbar does not work after restart.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-14 16:11:16
@onv

ty, will be fixed for next beta
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-14 22:06:59
WSH Playlist Viewer v2 beta 3 : http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

What's new in beta3:
- aspect ratio on covers (can be disabled in properties)
- playcount info added
- drag an item in the playslit to reorder it manually
- optimization around the display of the rating
- bugs fixing
- tweaks

video: http://youtu.be/gse_017s2hk (http://youtu.be/gse_017s2hk)
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-04-15 11:59:19
i found a new for me callback in documentation "on_tooltip_custom_paint(gr)", but i dont understand when it calls. in preprocessor tooltip set as "custom-paint-no-background". could anybody explain how it works and what i can get?
Title: WSH Panel Mod script discussion/help
Post by: NoiseAround on 2012-04-16 08:32:05
I'm very new to WSH Mod, and have never really programmed before (but I can read code and learn and try and draw conclusions).

I just want a plugin for the DUI which allows me to view a slideshow of Artist pictures stored on the computer, under H:\Music\%Artist%\01.jpg, 02.jpg, 03.jpg  - etc.
I think WSH panel mod would be able to help me with this but I might be in way over my head. I've had a look at the few samples and LoadImageASync would be great except that the path is absolute and not relative (I have no idea how to tell it how to look at the relative artist that is playing's folder). Before I go too deep into this, is something like what I want possible?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-16 11:55:23
@NoiseAround

it's looks very possible to do 

You can try to mod my WSH Coverflow script to browse "%artist% image folder" instead of the content of the current playlist... should not be too difficult if the path pattern for artist images has to be always the same e.g. H:\Music\%artist%\

i'll try to give it a try when possible.
Title: WSH Panel Mod script discussion/help
Post by: NoiseAround on 2012-04-17 05:50:56
Hey thanks man!
I actually ended up finding a neat solution though, so don't worry about it!

Here it is:
http://www.hydrogenaudio.org/forums/index....showtopic=92685 (http://www.hydrogenaudio.org/forums/index.php?showtopic=92685)


But I'm completely addicted to WSH Panel Mod. Going to try working in your Coverflow into my foobar! It looks amazing.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-04-17 08:49:59
anybody knows something about my question?
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-17 17:45:01
(my 1st post on HA, but using foo since 09.4.3.1)

I really love all this amazing WSH stuff, it's ... euhm making foobar even more IFF foo, bar, foo.

Marc, i noticed the autoplaylist script in your samples has a 255 character limit. Any chance this can be expanded? Or could you warn users by doing a stringlength check? It did cost me at least two cups of coffee to restore my playlists.

Falstaff, your coverflow is almost too sweet, maybe some artistflow would make the sugarlevels rise even more... (subtle hinting) 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-17 18:51:03
sorry but 255 characters is the limit of the inputbox i use. i don't know how else to get user input into a script.

an ugly workaround would to be to edit the data file in a text editor. close foobar2000 and then browse to your foobar2000 profile folder and then open the file named autoplaylists in the wsh_settings folder. if you already have some autoplaylists you'll see it takes this format...

Code: [Select]
name¬query¬sort pattern


if there is no sort pattern, it will look like this

Code: [Select]
name¬query¬


just make sure each query is on it's own line.
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-17 19:12:55
sorry but 255 characters is the limit of the inputbox i use. i don't know how else to get user input into a script...
an ugly workaround...


Hehe, skipping the input box ain't that ugly, great workaround. Thx alot for the quick and solid respons.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-17 19:55:02
Does somebody know why popup menu always expand to the left ?? it drives me mad, it should be to the right when there is enough place to display it right, as the arrow point...

but maybe i miss something ... if not maybe a weird behaviour due to WSH panel mod?

(http://i.imgur.com/3fqAi.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-17 20:22:05
i've never seen that happen before when there is room for it. this screenshot is against the right side of my screen with just enough space...

(http://dl.dropbox.com/u/22801321/menu%20ok.png)

EDIT: i downloaded your script and the console says you're using obsolete method (this changed in 1.5.0)

Quote
WSH Panel Mod: Warning: Obsolete: Please use AppendTo() method to create sub menu instead of AppendMenuItem()
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-17 21:50:39
will try to use the new method. thank you.

EDIT: AppendTo method used for creating Popup, but popup still appears to the left

any idea or any sample that work, i can't figure out what's wrong, example below:
Code: [Select]
function sort_group_menu(x, y) {
    var idx;
    var _menu = window.CreatePopupMenu();
    var _sort = window.CreatePopupMenu();
    var _groupby = window.CreatePopupMenu();
 
    _sort.AppendTo(_menu, MF_STRING, "Sort");
    _sort.AppendMenuItem(MF_STRING, 100, "Sort by album");
    _sort.AppendMenuItem(MF_STRING, 110, "Sort by file path");
    _sort.AppendMenuItem(MF_STRING, 120, "Sort by artist");
    _groupby.AppendTo(_menu, MF_STRING, "Group by");
    _groupby.AppendMenuItem(MF_STRING, 200, "Group by album");
    _groupby.AppendMenuItem(MF_STRING, 210, "Group by file path");
    _groupby.AppendMenuItem(MF_STRING, 220, "Group by artist");
    idx = _menu.TrackPopupMenu(x, y);
    switch(idx) {
        case 100:
            fb.RunMainMenuCommand("Edit/Sort/Sort by album");
            break;
        case 110:
            fb.RunMainMenuCommand("Edit/Sort/Sort by file path");
            break;
        case 120:
            fb.RunMainMenuCommand("Edit/Sort/Sort by artist");
            break;
        case 200:
            panel.sort_group_mode = 0;
            window.SetProperty("SYSTEM.sortgroup.mode", panel.sort_group_mode);
            var new_group_key = "%album artist%%album%%discnumber%";
            window.SetProperty("SYSTEM.group Key", new_group_key);
            tf_group_key = fb.TitleFormat(new_group_key);
            break;
        case 210:
            panel.sort_group_mode = 1;
            window.SetProperty("SYSTEM.sortgroup.mode", panel.sort_group_mode);
            var new_group_key = "$replace(%path%,%filename_ext%,)";
            window.SetProperty("SYSTEM.group Key", new_group_key);
            tf_group_key = fb.TitleFormat(new_group_key);
            break;
        case 220:
            panel.sort_group_mode = 2;
            window.SetProperty("SYSTEM.sortgroup.mode", panel.sort_group_mode);
            var new_group_key = "$replace(%path%,%filename_ext%,)";
            window.SetProperty("SYSTEM.group Key", new_group_key);
            tf_group_key = fb.TitleFormat(new_group_key);
            break;
    };
    _sort.Dispose();
    _groupby.Dispose();
    _menu.Dispose();
    return true;
};

thanx by advance

EDIT 2:
hmm weird, just tested on another PC (my laptop), and it's working on it! will try again on my desktop PC tomorrow...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-17 22:34:05
a windows theme issue??
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-17 22:36:29
maybe, but theme used on both PC is the same : Shine 2.0 for 7
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-17 22:39:49
using the same theme on both machines rules that out. so.... i have no idea.

your snippet works for me ok. what about context menus in other components such as a standard playlist? i'm guessing they use the same "system" functions for making menus (i could be talking out of my backside - i have no idea about "proper" windows programming  )
Title: WSH Panel Mod script discussion/help
Post by: Dennis68 on 2012-04-18 04:21:07
I may be able to help, I've had that problem on Vista before.

http://www.askvg.com/how-to-change-menu-po...-windows-vista/ (http://www.askvg.com/how-to-change-menu-position-from-left-to-right-in-windows-vista/)

Hope that helps!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-18 07:26:50
@Dennis68

Thanx a bunch, that has fixed the problem, i'd to chose Left-Handed instead of Right :S
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-19 19:10:03
anybody knows something about my question?


not me, can't make it working better than you, not changes if PREPROCESSOR feature used or not
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-04-22 02:52:22
Hi there,

I've written a script which displays a vertical volume bar with a tooltip showing the volume (based on "Simple Seekbar" by marc2003 and "Volbar with GdiDrawText" by T.P. Wang). The code is below if anyone is interested 

Code: [Select]
// ==PREPROCESSOR==
// @name "Volume-bar with tooltip"
// @author "rawny"
// ==/PREPROCESSOR==

// Based somewhat on:
// -> "Volbar with GdiDrawText" by T.P Wang
// -> "Simple Seekbar" by marc2003

var a = 25;
var g_drag = 0;
var g_drag_seek = 0;
var g_tooltip = window.CreateTooltip();
var g_trackingMouse = false;
var old_x;
var old_y;

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 on_size() {
    ww = window.Width;
    wh = window.Height;
}

function on_paint(gr){
    var ww = window.Width;
    var wh = window.Height;
    var pos = 0;
    var volume = fb.Volume;
    if(g_drag){
        pos = wh * g_drag_seek;
    }else{
        pos = wh * Math.exp(fb.Volume/a);
    }
    gr.FillGradRect(0, wh-pos, ww, wh, 90, RGB(0,0,255), RGB(70,90,200));
    gr.FillGradRect(0, 0, ww, wh-pos, 90, RGB(0,0,0), RGB(50,50,50));
    gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(100,100,100));
}

function on_mouse_move(x,y){
    g_drag_seek = 1-y/wh;
    g_drag_seek = (g_drag_seek<Math.exp(-100/a)) ? Math.exp(-100/a) : (g_drag_seek<1) ? g_drag_seek : 1;
    if(x > ww){
        g_drag = 0;
    }
    if(g_drag){
        window.Repaint();
    }
    if(!g_trackingMouse){
        g_tooltip.Activate();
        g_tooltip.TrackActivate = true;
        g_trackingMouse = true;
    }
    if(x != old_x || y != old_y){
        txt = Math.ceil(a*Math.log(g_drag_seek))+"dB ("+Math.ceil(g_drag_seek*100)+"%)";
        g_tooltip.Text = txt;
        g_tooltip.TrackPosition(x,y-20);
        old_x = x;
        old_y = y;
    }
}

function on_mouse_leave(){
    g_trackingMouse = false;
    g_tooltip.TrackActivate = false;
}

function on_mouse_lbtn_down(x,y){
    g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
    if(!g_drag){
        return;
    }
    g_drag = 0;
    var v = 1-y/wh;
    v = (v<Math.exp(-100/a)) ? Math.exp(-100/a) : (v<1) ? v : 1;
    fb.Volume = a*Math.log(v);
}
function on_mouse_wheel(delta){
    if(delta>0){
        fb.VolumeUp();
    }else{
        fb.VolumeDown();
    }
}

function on_volume_change(val){
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-04-22 03:31:29
Also, does anyone know how to produce glowing text with GdiDrawText?

As in this sample (but with GdiDrawText):
Code: [Select]
// ==PREPROCESSOR==
// @name "Glow Text Sample"
// @author "T.P Wang"
// ==/PREPROCESSOR==

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));
}

var g_font = gdi.Font("Segoe UI", 22, 1);
var g_drag = false;
var g_textrender = gdi.CreateStyleTextRender();
var g_bkclr = RGB(0, 0, 0);

function on_paint(gr) {
    gr.SetTextRenderingHint(5);
    gr.SetSmoothingMode(4);
    gr.SetInterpolationMode(7);

    var ww = window.Width;
    var wh = window.Height;

    // Draw background first
    gr.FillSolidRect(0, 0, ww, wh, g_bkclr);

    g_textrender.GlowText(RGB(0, 0, 64), RGBA(255, 255, 0, 30), 12);

    // Clear previous shadow setting
    g_textrender.EnableShadow(true);
    g_textrender.ResetShadow();

    g_textrender.RenderStringRect(gr, "Glow Text Sample", g_font, 0, 0, ww, wh, 0x11005000);
}
My current poor-man's version is to draw multiple copies of the text in the glow colour underneath the actual text:
Code: [Select]
// ==PREPROCESSOR==
// @name "Poor-man's glowing Gdi text"
// @author "rawny"
// ==/PREPROCESSOR==

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));
}

var text = "foobar2000";

var textFont = gdi.Font("Tahoma", 50, 1);

var textX = 100;
var textY = 100;

var glowSpacing = 4;

var rightGlowTextX = textX+glowSpacing;
var rightGlowTextY = textY+glowSpacing;

var actualTextX = textX+(glowSpacing/2);
var actualTextY = textY+(glowSpacing/2);

var bgColour = RGB(0,0,0);
var glowColour = RGBA(0, 0, 255, 222);
var textColour = RGBA(255, 255, 255, 222);

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, bgColour);
    gr.GdiDrawText(text, textFont, glowColour, textX, textY, ww, wh);
    gr.GdiDrawText(text, textFont, glowColour, textX, rightGlowTextY, ww, wh);
    gr.GdiDrawText(text, textFont, glowColour, rightGlowTextX, textY, ww, wh);
    gr.GdiDrawText(text, textFont, glowColour, rightGlowTextX, rightGlowTextY, ww, wh);
    gr.GdiDrawText(text, textFont, textColour, actualTextX, actualTextY, ww, wh);
}
I'm fairly happy with this effect, but I was wondering if there was a way to do it properly?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-22 17:03:17
WSH Playlist Viewer v2 beta 5 : http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

example of use in a CUI config (opacity set to 0 in Properties of the panel in order to see the background which is a PanelStack Splitter that display the artist image of the current track)
(http://i.imgur.com/PQcuN.jpg)
Title: WSH Panel Mod script discussion/help
Post by: amalone on 2012-04-23 17:13:30
Playlist Viewer Beta 5. I would like to have a 1 line group header. This is what I get -

Streaming Radio - Streaming | undefinedundefined

FLAC Files - Artist | undefinedundefined

Is this how it should be? Beautiful playlist. Thank you.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-23 18:31:10
Playlist Viewer Beta 5. I would like to have a 1 line group header. This is what I get -

Streaming Radio - Streaming | undefinedundefined

FLAC Files - Artist | undefinedundefined

Is this how it should be? Beautiful playlist. Thank you.


nope, a small bug, sorry  will be fixed in next beta
Title: WSH Panel Mod script discussion/help
Post by: amalone on 2012-04-24 03:02:11
Playlist Viewer Beta 6. Group header bug fixed, thank you. In the Appearance settings I have turned off the light shadow border. But there is still a shadow border after last item in playlist. Is it possible to turn that off also? Thank you.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-24 07:15:52
Playlist Viewer Beta 6. Group header bug fixed, thank you. In the Appearance settings I have turned off the light shadow border. But there is still a shadow border after last item in playlist. Is it possible to turn that off also? Thank you.


no. but you can edit the script to fit your needs, just remove the lines of code that draw this shadow (near line 622)

Code: [Select]
            if (this.id == list.total - 1) {
                gr.FillSolidRect(this.x, this.y + this.h + 0, this.w - vscrollbar.w, 1, RGBA(0, 0, 0, 75));
                gr.FillSolidRect(this.x, this.y + this.h + 1, this.w - vscrollbar.w, 1, RGBA(0, 0, 0, 35));
                gr.FillSolidRect(this.x, this.y + this.h + 2, this.w - vscrollbar.w, 1, RGBA(0, 0, 0, 12))
            };
Title: WSH Panel Mod script discussion/help
Post by: amalone on 2012-04-24 08:16:08
Thank you, that worked perfectly. Excellent playlist.
Title: WSH Panel Mod script discussion/help
Post by: kareha on 2012-04-24 17:36:24
Whenever I try to sort either by Album or Artist using Playlistviewer Beta 6 it keeps crashing, this is what's coming up in the console:

Code: [Select]
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 6 v0.0.6.20120423.2349 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
Object doesn't support property or method 'SortByFormat'
File: <main>
Ln: 3482, Col: 3
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-24 19:00:16
try updating WSH panel mod to the latest version. http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
Title: WSH Panel Mod script discussion/help
Post by: kareha on 2012-04-24 19:18:25
try updating WSH panel mod to the latest version. http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)


Awesome that's fixed it, many thanks
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-24 19:44:42
don't forget to read Informations in the top of the script, like :

// [Requirements]
// * foobar2000 v1.1 or better  >> http://foobar2000.org (http://foobar2000.org)
// * WSH panel Mod v1.5.3.1 or better >> http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
...

Title: WSH Panel Mod script discussion/help
Post by: kareha on 2012-04-24 19:56:09
don't forget to read Informations in the top of the script, like :

// [Requirements]
// * foobar2000 v1.1 or better  >> http://foobar2000.org (http://foobar2000.org)
// * WSH panel Mod v1.5.3.1 or better >> http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
...



Doh
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-25 00:10:50
Falstaff, i get an error at startup (with a filled autoplaylist selected):


Code: [Select]
Foobar2000 v1.1.11 + Windows Scripting Host Panel Modded v1.5.3.1 (Build: 19:48:41, Apr 20 2012)
W7x64

Console:
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 6 v0.0.6.20120423.2349 by Br3tt aka Falstaff >> [url=http://br3tt.deviantart.com):]http://br3tt.deviantart.com):[/url]
Microsoft JScript runtime error:
Object doesn't support this property or method
File: <main>
Ln: 541, Col: 4
<source text only available at compile time>

something goin' wrong at:
if (typeof this.id == "undefined") {
if (this.metadb) {
541 this.group_key = tf_group_key.EvalWithMetadb(this.metadb);


But after that is seems to run ok.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-25 07:15:13
thanx Mod-Ular, it has already be reported to me (same bug), it should be fixed for the next beta
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-25 11:39:21
WSH Playlist Viewer v2 beta 7 : http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

- bug on launch (for who's encountered it) fixed (i hope, tell me about it)
- queue info added for queued tracks + special "Queue content playlist" added to see the queued tracks as a special playlist (check settings menu from the toolbar)
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-25 14:38:18
Code: [Select]
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7 v0.0.7.20120424.2339 by Br3tt aka Falstaff >> [url=http://br3tt.deviantart.com):]http://br3tt.deviantart.com):[/url] Microsoft JScript runtime error:
'list.item[...].id' is null or not an object
File: <main>
Ln: 1814, Col: 3
<source text only available at compile time>

Still getting an error..  .
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-04-25 15:16:58
Still getting an error..  .

The same, with 1.5.3.1 & with 1.5.2.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-25 18:03:59
Code: [Select]
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7 v0.0.7.20120424.2339 by Br3tt aka Falstaff >> [url=http://br3tt.deviantart.com):]http://br3tt.deviantart.com):[/url] Microsoft JScript runtime error:
'list.item[...].id' is null or not an object
File: <main>
Ln: 1814, Col: 3
<source text only available at compile time>

Still getting an error..  .

yep, but not the same

could you gimme more info on how it happens ? (playlist content (large, small number of items), action you where doing, ... all that could help me because i can't reproduce this bug, thanx)
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-25 21:02:48
Fallstaff,
In my case the script only fails at fb2k startup. (with a huge Media Library, not tested otherwise)

Medium sized Autoplaylists containing 75-125Gig and 5,000-7500 items.
Everything autosorted by %path_sort%

I see u added queueing functions. Maybe worthwhile to mention the related components i use?
foo_keep_queue: Keep Queue 0.3.5 (by Andreas "Qtax" Zetterlund, Prevents the playback queue from being removed when changing song manually or exiting)
foo_queuecontents: Queue Contents Editor 0.5.1 (by Sami Salonen)

Good luck bug-hunting
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-25 22:21:27
@Mod-Ular

thanx for the reply, i've tried both (foo_queuecontents and foo_keep_queue) but i can't make it crashes ...

have you installed the last version of WSH panel mod at least? v1.5.3.1 ?

have you try to clear the panel Properties ?
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-25 22:45:04
Yes, Windows Scripting Host Panel Modded v1.5.3.1 (Build: 19:48:41, Apr 20 2012)

I've reset the properties. (I only adjusted a few settings in the USER-fields.)
But i'm getting the same error at Foobar Startup as mentioned above.

In console i see the script initialising without problems:
WSH Panel Mod (WSH Playlist Viewer v2 beta 7 v0.0.7.20120424.2339 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) initialized in 10 ms

After console shows startup time (everything is loaded), it crashes:
Startup time : 0:37.911965
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7 v0.0.7.20120424.2339 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
'list.item[...].id' is null or not an object
File: <main> Ln: 1814, Col: 3 <source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-25 23:01:42
could you try with this debug version it adds some info to the console before the crash. thanx for reporting to me the content of the console with this version please.

http://br3tt.free.fr/files/WSH/v2_wsh_play...beta7_DEBUG.zip (http://br3tt.free.fr/files/WSH/v2_wsh_playlist_859_shared_beta7_DEBUG.zip)

Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-25 23:10:36
Fallstaff,  I cannot open that zip-archive. Downloaded it 3 times but it seems to be corrupted...
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-25 23:16:37
sorry, fixed, try again
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-25 23:36:56
DEBUG: list.total=4094/list.item.length=1/list.tocut=1/from=refresh_spv
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7 v0.0.7.20120424.2339 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
'list.item[...].id' is null or not an object
File: <main>
Ln: 1819, Col: 3
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-04-26 05:14:48
I use last DEBUG version:

DEBUG: list.total=82/list.item.length=1/list.tocut=1/from=refresh_spv
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7 v0.0.7.20120424.2339 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Ошибка выполнения Microsoft JScript:
'list.item[...].id' -  есть null или не является объектом
File: <main>
Ln: 1819, Col: 3
<source text only available at compile time>

This error appears only if foobar  (when it start) open  autoplaylist.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 07:28:07
thanx for the reports, i still can't reproduced the issue, but it may be fixed in beta 7.1: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

let me know...
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-04-26 08:06:28
Falstaff
In v. 7.1  foobar  started with autoplaylist selected -  WSH Playlist Viewer  not crash more.

Thanx  for new version.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 08:43:49
Falstaff
In v. 7.1  foobar  started with autoplaylist selected -  WSH Playlist Viewer  not crash more.

Thanx  for new version.


good
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2012-04-26 10:08:22
Br3tt, regarding the RemoveAccents function:

-- Why does "Æ" translate to "A" and not "Ae"?
-- Why does "Õ" translate to "0" (zero) and not an "O"?
-- Why does "ß" translate to a single "S" instead of double "Ss" (as it is in German)?

By the way, I really, really like this, and I think that you should continue working on this (and other WSH) scripts instead of configurations that utilize ELPlaylist and that Panel Stack thingy (which have been left without updates for quite some time).
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 11:17:09
Falstaff, confirmed 7.1 starts without errors. Good work.   
(I always wondered how to fix bugs you cant reproduce, I imagine it has something to do with skills & magical wizardry ^^)
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 11:34:45
Damn. 
On track change i get that bug again:

Startup was okee, first track played fine,
then a track was skipped (no error),
the third track opens with an error:

Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7.1 v0.0.7.20120426.0820 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
'list.item[...].id' is null or not an object
File: <main>
Ln: 1674, Col: 3
<source text only available at compile time>

Crashing on startup was 'somehow' better...
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 12:05:25
ok, the fix was just a workaround and this new bug is close from the previous one, but NOW i may have found the source of the problem

beta 7.2 this evening, should fix these crash issues
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 15:07:27
WSH Playlist Viewer v2 beta 7.2: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

let me know if it fixes the reported crash... (it should) ... thanx.

* bug fixes
* new toolbar's button look

Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 15:37:01
Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7.2 v0.0.7.20120426.1300 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
'list.item[...].id' is null or not an object
File: <main> Ln: 1675, Col: 3 <source text only available at compile time>


Same circumstance. Startup OK, 1st track OK, skipping a second track, and ERROR at third track.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 15:42:40
@Mod-Ular

#@!  ... you have a special thing or do a special thing that i don't, now i'd like to find what ...

is queue list empty or not when it crashes? what are the components installed on your system, and what panels are used in your config (is there other wsh panel mod?)

thank you
Title: WSH Panel Mod script discussion/help
Post by: einstein on 2012-04-26 16:17:00
@Mod-Ular / Falstaff

for reproducing or understanding what someone does a picture is worth more than thousand words ... even better: i prefer a short video.
Perfect for my recent needs is a neat little tool named Jing ... uploads pictures or short (flv) videos (5 mins), no special player for viewing req.
http://www.techsmith.com/jing.html (http://www.techsmith.com/jing.html)

No advertising intended ... there are other similar tools, just wanna help u guys
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 16:41:52
This is going to be a long reply.

Code: [Select]
Core (2012-02-04 13:05:48 UTC)
    foobar2000 core 1.1.11
foo_albumlist.dll (2012-02-04 13:04:12 UTC)
    Album List 4.5
foo_audioscrobbler.dll (2012-02-18 20:01:21 UTC)
    Audioscrobbler 1.4.7
foo_cdda.dll (2012-02-04 13:03:52 UTC)
    CD Audio Decoder 3.0
foo_converter.dll (2012-02-04 13:04:00 UTC)
    Converter 1.5
foo_discogs 1.30.dll (2012-02-18 20:01:21 UTC)
    Discogs Tagger 1.30
foo_dsp_std.dll (2012-02-04 13:04:14 UTC)
    Standard DSP Array 1.0
foo_dsp_xgeq.dll (2012-04-05 19:13:11 UTC)
    Graphic Equalizer 0.3.7
foo_fileops.dll (2012-02-04 13:03:02 UTC)
    File Operations 2.1.3
foo_freedb2.dll (2012-02-04 13:03:02 UTC)
    freedb Tagger 0.6.4
foo_input_monkey.dll (2012-02-18 20:01:21 UTC)
    Monkey's Audio Decoder 2.1.5
foo_input_shorten.dll (2012-02-18 20:01:21 UTC)
    Shorten decoder 0.4.2.2
foo_input_std.dll (2012-02-04 13:05:10 UTC)
    Standard Input Array 1.0
foo_keep_queue.dll (2012-03-02 03:55:28 UTC)
    Keep Queue 0.3.5
foo_masstag.dll (2012-02-18 20:01:21 UTC)
    Masstagger 1.8.4
foo_musicbrainz.dll (2012-03-02 03:55:37 UTC)
    MusicBrainz Tagger 0.3 beta 2
foo_playcount.dll (2012-02-18 20:01:21 UTC)
    Playback Statistics 3.0.2
foo_queuecontents.dll (2012-03-14 20:09:57 UTC)
    Queue Contents Editor 0.5.1
foo_quicksearch.dll (2012-02-18 20:01:21 UTC)
    Quick Search Toolbar 3.2
foo_rgscan.dll (2012-02-04 13:03:48 UTC)
    ReplayGain Scanner 2.1.2
foo_run.dll (2012-02-18 20:01:21 UTC)
    Run services 0.3.7
foo_runcmd.dll (2012-02-18 20:01:21 UTC)
    Run Command 1.1
foo_skip.dll (2012-02-18 20:01:21 UTC)
    Skip Track 1.7.4
foo_ui_columns.dll (2012-02-18 20:01:21 UTC)
    Columns UI 0.3.8.8
foo_ui_std.dll (2012-02-04 13:04:08 UTC)
    Default User Interface 0.9.5
foo_uie_albumlist.dll (2012-02-18 20:01:21 UTC)
    Album list panel 0.3.5
foo_uie_biography.dll (2012-02-18 20:01:38 UTC)
    Biography View 0.4.2.4
foo_uie_console.dll (2012-02-18 20:01:21 UTC)
    Console panel 0.4
foo_uie_elplaylist.dll (2012-02-18 20:01:38 UTC)
    ELPlaylist 0.6.9.1.2(beta)
foo_uie_esplaylist.dll (2012-02-18 20:01:38 UTC)
    EsPlaylist 0.1.3.9
foo_uie_library_tree.dll (2012-02-18 20:01:38 UTC)
    Library Tree 0.3.4.6
foo_uie_lyrics3.dll (2012-04-24 20:32:23 UTC)
    Lyric Show Panel 3 0.3.2
foo_uie_panel_splitter.dll (2012-02-18 20:01:38 UTC)
    Panel Stack Splitter 0.3.8.3(alpha)
foo_uie_playlists_dropdown.dll (2012-02-18 20:01:21 UTC)
    Playlists Dropdown 0.7.6
foo_uie_wsh_panel_mod.dll (2012-04-24 08:36:03 UTC)
    WSH Panel Mod 1.5.3.1
foo_utils.dll (2012-02-18 20:01:38 UTC)
    Playlist Tools 0.6.2 beta 6
foo_vis_shpeck.dll (2012-02-18 20:01:38 UTC)
    Shpeck - Winamp vis plugins wrapper 0.3.7
foo_whatsnew.dll (2012-02-18 20:01:21 UTC)
    Feature Watcher 1.0.7

I have build myself a nice but HUMONGOUS pss CUI. Over 200 splitters in it. 

WSH MODs:
In this i am using some of marc2003's samples (Autoplaylist, his LastFM-Scripts and Thumbs) your own Coverflow & this nice new Playlist, all without major adjustments on my side,
and i modded a sample Seekbar + your own (old) Round-Volume Knob. I only made visual changes, no real codehacks.
(+ i have different themed versions of each panel, so a lot of WSH panels. Some have 6 versions, nite/day x3 automatic color-accent modes.)
I've tempered a bit with marc's preproccessor, but only some custom path and again appearance stuff, never expierenced any problems with it. My foobar runs 12-16h-a-day, and has been flawwless for ages.

PROBLEMATIC COMPONENTS: (see component list in codebox to see them all)
Furthermore on the side of 'not recommended' components, aside from the Panel Stacker Splitters I am also using a bunch of Es-playlists. Ssenna also provides me with Library Tree and the Biography panel.
I know these have to name to be unstable but they don't give me any problems if i take account of stuff that make them unstable (like handling my large library)
You can also see EL, but this config isn't using it at this moment.
LIBRARY:
As mentioned before I also have a rather big Media Library +/-2TB atm. Thx to Marc's WSH-Autoplaylists i recently been able to reduce my playlistfolder from 1gig+ to roundabout 200MB, wich is very reasonable imo. In total i have 70 playlists (has been +350), all autosorted, most by %path_sort%.

PLAYBACK:
I use foobar as a private inhouse radiostation. So playback order is always on Random.
The autoplaylist give me the right mood by filtering by category, genre and style. The right tracks come by rating, playcount and lastplay filters.
On top of that there is a skip script running for additional filtering.

TESTING:
I have no real testsetup where i can test what is goin' wrong. Been to much absorbed by my own config and all kind of side-configs that i kind of lost control.
Restarting foobar can be a real pain. It takes 10-15mins before my library is completetly initialized.
I've been struggling with my mammoth library and should configure myself a lighter library for this purpose... to begin with...
I really like your scripts so i don't mind putting a little effort in it myself, glad to be able to help a bit by testing.

Okee, i hope this provides you with some useable info, i am goin to provide my with some fresh coffee..

/edit, forgot about the queue. No tracks queued.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 16:51:49
thank you for the reply

you told previously "skipping track #2 .... then crash on track #3" ==> i see you have foo_skip component, is it this kind of skip you're talking about ? it's a clue for me, i'll test track skipping with this foo_skip component to check if my script handle well this kind of feature...

more news asap ... i'm going to prepare more coffee
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 16:56:09
Yup, foo_skip. Can't live without it. As addicting as coffee. ^^
Atm i use:
(%rating% LESS 3) OR (((%rating% LESS 4) AND (((%play_count% GREATER 5) AND (%last_played% DURING LAST 39 WEEKS)) OR ((%play_count% GREATER 4) AND (%last_played% DURING LAST 26 WEEKS)) OR ((%play_count% GREATER 3) AND (%last_played% DURING LAST 13 WEEKS)))) OR ((%rating% LESS 5) AND (((%play_count% GREATER 14) AND (%last_played% DURING LAST 13 WEEKS)) OR ((%play_count% GREATER 11) AND (%last_played% DURING LAST 8 WEEKS)) OR ((%play_count% GREATER 9) AND (%last_played% DURING LAST 4 WEEKS)))) OR ((%rating% IS 5) AND (((%play_count% GREATER 19) AND (%last_played% DURING LAST 4 WEEKS)) OR ((%play_count% GREATER 15) AND (%last_played% DURING LAST 2 WEEKS)) OR ((%play_count% GREATER 11) AND (%last_played% DURING LAST 7 DAYS)))))

as skip setting.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-26 18:11:56
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

autoplaylists
now you can specify "force sort" on a per playlist basis (the old version had a global setting which affected all playlists)

IMPORTANT NOTE FOR EXISTING USERS WITH MULTIPLE PANELS/SAVE FILES
there are now 8 slots which you can choose from the context menu. this has nothing do with how many autoplaylist queries that can be saved per panel - i'm sure it can far exceed any number you can think of.
you need to take some steps to rename the files. with foobar not running, browse your foobar2000 profile and then the wsh_settings folder. all files begin with "autoplaylists". number these between 1 and 8 with no spaces like this.

Code: [Select]
autoplaylists1
...
autoplaylists8
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 18:21:11
@Mod-Ular or someone who encoutered such crash ...

beta 7.3 uploaded, it's a version based on beta6 that do not include the playlist queue content feature, could you test it please, that could help me... thanx

http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

EDIT: if problem still present, a cool thing from you would be to test the playlist in your config without any other WSH panel script, this wouls assure me that the problem is not due to a memory overflow caused by another wsh script, so if you could make a copy of your config, and for each wsh panel mod (except playlist), reset it to the default or just clear its script... Would be great to do because i've already encoutered a such issue in the past with another wsh panel mod that has nothing to do with playlist, but has a bad handle of timers or using old methods outdated....
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 19:04:54
Hmm, Falstaff okee.

I loaded last version. Let it play for 15 mins while i did the dishes. No errors so far
Gonna restart foobar after a few more songs, btw skipping goes fine, always did before the error surfaced.

If i get the error i'll save my config as is and start removing the WSH-mod panels (most supicious 1st, my own seekbar and volumeknob hacks, i updated the timing methods myself, so they are very prown for errors..  You might be right with you're intuition on the issue.
I 'll remove them all if needed but gonna do it step by step so it might take some time.
I'll report back as soon as i get some results.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 19:06:13
*waits* but sounds already good
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 19:28:21
list.item[...].id' is null or not an object File: <main> Ln: 1678, Col: 3
Gonna start dumping all other WSH-panels
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 19:32:32
@Mod-Ular: sorry about that, i hope it will help ... something specific to your config is in fault ... another option is that you zip me your config, that could help me if i could reproduce the crash to find the source of the problem. as you want.

@everyone: WSH CoverFlow View v1.1 released, minor changes but better version than v1.0 >>> http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 19:46:57
It is very possible that my seekbar or volumeknob have some problem.
Somehow i hope the problems can be eliminated be removing my WSH stuff.

Zipping my config ain't gonna be a simple solution as i never coded it to be useable elsewhere. (Read my config probably is heavily gonna search paths it cannot find and criple foobars efficiency)
It's a standalone setup so that part is easy. But nevertheless gonna be one big file due to all my images (backgrounds 200+, and loads of selfmade icons, for almost everything) I can prepare it a bit, but hope we can avoid that. (All my slick graphics in your hands can be dangerous for the foobar community ^^)

Removed my seekbar and still get the same error, same situation, startup ok, 1st playback okee, 2nd playback ERROR (no skip this time)
WSH Removal Stage 1 complete. It was not my seekbar.
Removing the old volumeknob is next.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 20:01:22
not sure that images à required, just the components and the configuration folder should be enough for me, shouldn't be so big ...
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 20:15:56
Testing without my volumeknob atm. That should eliminate all 'clumsy' n00b-WSH-scripts, the rest is clean stuff from you or marc2003, so i am afraid they're not gonna make a big difference.

  'list.item[...].id' is null or not an object File: <main> Ln: 1678, Col: 3

I think further removal of all the WSH-panels is not gonna solve it as those scripts should be fine. What do you think? Just do it, or start prepping my config to send?

I thought u needed my complete setup. Total foo folder is 'round 200MB zipped. Database.dat is 80 MB  But yeah noprob. I'm not afraid of sharing my artwork, that is no prob, but really component and config folders are enough? Just tell me what u need and i'll send you my setup.

/quickedit, BTW i noticed the script doesn't crash when i load it from scratch in a default WSHmod-panel. IT only crashes AFTER a startup on the 2nd track that plays.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-26 20:21:49
@Mod-Ular, to rule out other scripts/components, i'd install another copy of foobar in portable mode.

copy configuration and playlist folders from your existing install.
i'd also install foo_playcount and foo_skip so your autoplaylists still work.
also copy database.dat and whatever file contains foo_playcount data (index-data folder i think??)

now add a WSH panel in default UI and see if you still get errors.
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 20:27:20
Hmm, Marc good Idea. Thx
But now i know my own WSH-mods aren't causing this error, so at least i am not guilty of wasting falstaffs time due to my own bad coding
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 20:42:26
i don't know if it's another wsh panel mod that can be interact badly, or another component, for me the only way to find what's wrong with my script and your config, is to remove panels/components one by one and test it each time. As said, i don't need your database or playlist files, just the content of the components folder and the contents of the configuration folder. not so big
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 20:52:23
Falstaff, I followed Marc's advice and set up a fresh standalone install. Basic DUI just added a console and WSH-panel with your playlist. No errors so far.
/edit If this gives an error i can send you this basic setup. Otherwise no prob to send my own setup but that might take a bit more time.
/edit bis. Sorry for my slowness, indeed comp, user-comp and config folder are just 7.12MB, i can send them very quickly if you want.

/last edit: Falstafff i send you a PM to get my zip in your hands. So far i get no errors in the simple DUI config, so yes step by step removing and excluding things seems to only way to go. A tedious job if you ask me (i've had enough for the moment)  I you feel up to it, you're welcome to bore yourself with my config. But please don't do it if you want to get it working just for me. Only put your time into it if you want your script to work everywhere (including here) ^^
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 22:25:52
     reloaded my own config a while ago and guess what: no more errors... 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-26 22:59:22
PM just answered (was gone a while)
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 23:37:51
As said above all of a sudden i am unable to reproduce the error.  Even with the setup that triggered it before. I'll keep you informed if it re-appears but for now it seems to 'solved' in a non-logical way. 
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-26 23:37:51
/edit doublepost
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-27 07:18:07
Br3tt, regarding the RemoveAccents function:

-- Why does "Æ" translate to "A" and not "Ae"?
-- Why does "Õ" translate to "0" (zero) and not an "O"?
-- Why does "ß" translate to a single "S" instead of double "Ss" (as it is in German)?

By the way, I really, really like this, and I think that you should continue working on this (and other WSH) scripts instead of configurations that utilize ELPlaylist and that Panel Stack thingy (which have been left without updates for quite some time).


yep, done too quickly, i'll fix that translation, thank you
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-04-27 09:13:23
Hello.
This panel is really an  interesting tool, however it's hard to get started writing own script.
I've never scripted for WSH before. I have a basic understanding of JavaScript and a small experience with other languages. I had hoped reading the documentation and looking at some smaples would be enough to get started, but i'm having some issues and would like some clarifications.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-27 09:33:40
1) yes
2) at the start of the script...
Code: [Select]
var myvar = window.CreateTooltip();


then you typically use it within the on_mouse_move callback

Code: [Select]
myvar.Text = "blah blah";
myvar.Activate();


3) yes. i use all these...
Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var doc = new ActiveXObject("htmlfile");
var vb = new ActiveXObject("ScriptControl");


you need to disable "safe mode" under file>preferences>tools>wsh panel mod for them to work.

4) look at window.GetProperty and window.SetProperty
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-04-27 11:13:09
Thanks. I think i'll be able to better understand the examples now that i'll stop searching for function call statements 
Just one more precision.
2) at the start of the script...
Code: [Select]
var myvar = window.CreateTooltip();

Thanks for the example. If i got it right, any of the interfaces that's not in the "big 5" needs to be created as a new object first, by calling a method that's inside one of the "big 5"
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-04-27 11:20:21
@ Falstaff
Is there a way to change the sorting of albums in your coverflow script? I like having albums sorted by date rather than title. I tried changing user.Group KEY setting as it was set to %albumartist%%album% and this was the way they were sorted but this didn't work.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-27 12:11:43
@r0k

group key is the way tracks will be grouped, not sorted !

the coverflow panel has no sort option, because it's a panel that is for me in an add-on of a playlist viewer. So just sort your playlist or even without any playlist viewer, you can sort by using foobar2000 menu EDIT>Sort

if sorting pattern need to be adapted to your needs (those from File>Edit>Sort), you can modify them in foobar2000 File>Preferences>Advanced>Display>Standard Sort Pattern field

so, you can sort how you want, and group how you want too (that point you find it alone in Properties of the Coverflow panel)
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-27 14:13:36
I got some more indications Falstaff,
The crash re-occured but now i know i little bit more.
It ONLY happens after a fresh foobar startup. Doesn't matter if it's restarted in foobar or closed and re-started. Fresh boot, fresh windows login, all the same.
It does NOT happen after a fresh foobar start if i open the properties or configuration dialog of your playlist and hit OK (thus re-apply all settings?) before playback.
It does NOT happen if i use another standalone foobar before a fresh foobar start with my own config.
It does NOT happen if i've reloaded-renamed-re-imported a random or my own CUI-(pss-)config.

I recently noticed a very irritating stroboscope-like flickering when i load my setup. This could be just related to foo_uie_panel_splitter havin' some trouble reading my enormous stack. But sometimes its clearly just the WSHmod panels that go epileptic. Even without my own noobishly modded WSH-scripts. But i really suspect panelstacksplitter in bein the trigger for this behavior.
And i also suspect foo_uie_esplaylist from having some (or more) memoryleaks. (If i enable Browse Library my RAM thinks its getting free beer)

BTW, got another one for you
[14:21:11] Error: WSH Panel Mod (WSH Playlist Viewer v2 beta 7.3 v0.0.7.20120426.1900 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object expected File: <main> Ln: 2541, Col: 5 <source text only available at compile time>

This happened after updating my interface with an pss-button (no commands just an imagebutton with the REFRESH option)
The effect achieved is that all splitters are hidden/rescaled/reshown and so refreshing all the scripts they contain.
I've done this a zillion times without any problems (while using your playlist)
But this time i did queue-up some tracks, within your playlist. (via contextmenu)
The tracks played like they should. On the last queued track before trackchange to the next (end of queue so in my usercase a) random track i did the 'Refresh'.
You're script halted on opening the next track. Not been able to reproduce. Tried several times witth the same procedure and some slight variations.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-27 14:52:57
thank you for all these informations, i ain't tested your config, i will asap, but no time for now, maybe next tuesday, i'll give you feedback about my investigations!
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-04-27 15:37:05
the coverflow panel has no sort option, because it's a panel that is for me in an add-on of a playlist viewer. So just sort your playlist or even without any playlist viewer, you can sort by using foobar2000 menu EDIT>Sort

The issue is that edit->sort needs to be re-done each time the playlist is refreshed as it's not memorized by the playlist. At least i didn't found a way to have the Library Selection playlist remember sorting options (even playlist attributes does not help for sorting).
I'm using Coverflow as the final selection step after filtering my collection with Facets. I have Facets set to send selection to Library Selection and coverflow locked on Library Selection. Works great except for sorting.
Quote
if sorting pattern need to be adapted to your needs (those from File>Edit>Sort), you can modify them in foobar2000 File>Preferences>Advanced>Display>Standard Sort Pattern field

What do you mean by File>Edit>Sort? Do you mean the patterns from Edit>Sort? There is no Edit submenu in my File menu.  (i have foobar2000 v1.1.11)

EDIT : Found this method SortByFormat(playlistIndex, pattern, selOnly = false) in IFbPlaylistManager interface. I guess that's what i need to add some sorting if i can't find a built-in way to sort Library Selection playlist. Modding your Coverflow will be one of my first real exercises in JScript coding if you don't mind
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-27 15:54:34
@Falstaff Take your time, there is nothing urgent about it. I'm just trying to keep you informed and hopefully avoid some work on your bughunt:)
Meanwhile, i had the last one again. Microsoft JScript runtime error: Object expected File: <main> Ln: 2541, Col: 5 <source text only available at compile time>
Did nothing special, foobar playing in the background while surfing a bit.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-27 16:43:45
@Falstaff Take your time, there is nothing urgent about it. I'm just trying to keep you informed and hopefully avoid some work on your bughunt:)
Meanwhile, i had the last one again. Microsoft JScript runtime error: Object expected File: <main> Ln: 2541, Col: 5 <source text only available at compile time>
Did nothing special, foobar playing in the background while surfing a bit.


LOL sorry, this error is a "true" bug, my fault on beta 7.3, so try to install again beta 7.3 from here !! this bug has nothing to do with previous ones, still a mistery from now !!!!

http://pastebin.com/Cj94ZBWE (http://pastebin.com/Cj94ZBWE)

EDIT: testing your config (you're mad, you know!!) , but not crash for me
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-27 17:06:23
Thx, updated.
Yup, i know i'm mad. Even got an official certificate for it. ^^
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-27 17:12:46
@r0k

(http://i.imgur.com/F8qh9.png)

of course you can mod the coverflow panel to fit your needs
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-04-27 21:27:48
OK. That's the sort i used. As you wrote File>Edit>Sort i was unsure whether there was a hidden submenu somewhere. foobar2000 is the sort of programs where you can find new functions even after using it for a long time (and i havn't used it for such a long time actually).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-27 22:02:54
funny you should say that.... you can find many more commands on the menus if you hold down the shift key before clicking.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-28 09:41:46
WSH Playlist Viewer v2 beta 8: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

* bug fixes (cursor ain't follow focus on selection change in another panel (e.g. Coverflow))
* playlist for the queue Removed for now (not reliable engough for now, will be back later)
* 2 new sort presets (by date & by genre)
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-04-28 11:46:14
Hey, Falstaff.

I find bug  in WSH Playlist Viewer v. 2 beta 8:

Select autoplaylist created with option "Force-sorted". In this case the order of sorting is determined in the stage of the creation of playlist and cannot be changed.
That is right for "Playlist view", "ESplaylist", "Simplaylist" panels. But when I use WSH Playlist Viewer, sorting playlist is available. That is wrong.
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-28 12:13:22
@ pIv, It's not a bug, it's a feature?

I think Falstaff has put a lot of effort in making it possible.  BTW forcesorted autoplaylist can also be re-arranged by the ES-playlist aside from the default foobar fixed order. (It doesn't affect the actual order of the playlist contents, but reorders the "display order".) Don't how Falstaffs pulls this trick but to me it's really an enhancement of default foobar behavior.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-28 12:33:58
+1
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-04-28 12:52:46
@ pIv, It's not a bug, it's a feature?

I think Falstaff has put a lot of effort in making it possible.  BTW forcesorted autoplaylist can also be re-arranged by the ES-playlist aside from the default foobar fixed order. (It doesn't affect the actual order of the playlist contents, but reorders the "display order".) Don't how Falstaffs pulls this trick but to me it's really an enhancement of default foobar behavior.


This is very bad feature!
Usually I create random selection from my library.  When any song played it removed from playlist. Then I use second autoplaylist "Last 3 days". In it I can see all song played in revers order from the beginning to the end of this period.
I do not want even so that this autoplaylist would sorted out as a result negligent use by menu of sorting.

It is possible whether to hide the points of sort menu in this case, or at least ask me about this?
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-28 13:13:31
Aha, you got a little point there.
Not that it is a bad feature, it's a great feature, but it would be greater if you could exlude some playlist that needs a fixed order.
Would indeed be better for historical stuff like:
Played during last Day
More than a Year Ago
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-28 13:26:57
i think it's a limitation of the WSH panel mod component that you can't detect whether an autoplaylist is force sorted or not. it would need to be added as a new feature.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-04-28 18:48:44
I'd like to be able to create a button that disables/enables the audioscrobbler component (foo_audioscrobbler I think), however the component doesn't have any main menu commands, the only way to disable/enable it is from its preferences page.

Would it be possible for disable/enable methods (and ideally a flag for retrieving the current state) to be added to WSH panel mod, or would this require modification of the audioscrobbler component beforehand/instead?
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-29 20:14:30
@ rawny
Maybe it is possible to directly popup Preferences>Tools\Audioscrobbler with a button or shortcut. But i know nothing of the developper side of this. The only popupscreens that do this have a normal main menu command (like: Library/Configure)
It should be possible to button everything you can find under "Preferences>Keyboard Shortcuts>Action" Aside from main menu commands there are also a lot of context commands to discover in that section. But as you stated yourself there are none for audioscrobbler.

Isn't it more logical for Florian Heidenreich (foo_audioscrobbler dev) to provide them?..
And if it really should be done trough WSH-mod you could ask T.P. Wang himself in the component thread? But i think it isn't his task to solve other components shortcomings...

/edit, quick spellcheck
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-29 20:41:02
@ falstaff

As i declared in last PM i had no crashes with WSH Playlist v2 beta 8. I presume thas was because you disabled the queueplaylist like you told.
I am now running the last (not yet released here, but online) version and, If you re-implemented the disabled part Then i can confirm the bug is gone (can not reproduce).

But it's not really clear to me. What do you mean with "playlist for the queue" ?
I don't see any new playlist show up in my standard playlist switcher panel,
so if you mean the green queueindex indicator that appears instead of the tracknumber, i still had those in v2b8  Working perfectly

No errors for me since v2b8. I almost can't wait for a final so i can start tweaking it for my insane UI.
Great work, once again.

/edit: semantics
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-29 21:08:39
@Mod-Ular

green queue index wasn't the only feature around queue adds in my script! there was an entry in the settings menu (from the toolbar) to create or show a special playlist named 'queue content ' that contained only the queued tracks, that's what i've removed
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-04-30 00:23:52
@mod-ular: Yeah it is possible to open the preferences page for audioscrobbler via button/keyboard shortcut etc. which is a little quicker for enabling/disabling it.

I agree that it would be logical for Florian to provide main menu commands for audioscrobbler as opposed to T.P. providing them, yes, (and if they existed then I could create the button I want  ) but that wasn't what I was trying to say. My question was really whether Florian would need to add anything to the foo_audioscrobbler component before T.P. can expose it's enabled/disabled state as an interface property, e.g. fb.AudioscrobblerEnabled. I believe that each property has to be exposed manually by T.P. as otherwise fb.StopAfterCurrent would have been part of the interface from the beginning.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-04-30 06:44:35
given that foo_audioscrobbler hasn't been updated for nearly 2 years, i wouldn't hold your breath. simply adding a menu command wouldn't be enough either. you'd need a callback to detect when the setting has changed. this would mean an SDK for foo_audioscrobbler would have to be released AND it would then have to be implemented in WSH panel mod. in short, not very likely.

there are various ways you get foo_audioscrobbler not to scrobble your music. i personally have it set to scrobble only music in my library. for most people this is enough as they can rip/download music, listen to it without scrobbling before deciding whether it's good enough to become part of their main library.

also, you can use the field-remapping options in the preferences. through title formatting, you could set the artist to be blank for tracks with a rating of 1. eg

Code: [Select]
$ifequal(%rating%,1,,[%artist%])


tracks with a rating of 1 won't get submitted because there is no artist specified. you can adapt this with any title formatting you like.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-30 08:02:49
WSH Playlist Viewer v2 beta 8.2: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

* bug fixes

Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-04-30 10:48:56
@marc2003: Ah, I hadn't thought about the callback (although I suppose it would be possible to make a non-intelligent toggle button without it).

Yeah I already have it set to only scrobble music in my library but my library contains some stuff that shouldn't really be in my library  It's in there mostly because it's easier to manage as it's making its way into the library (i.e. I'm tagging it). I guess I could make it do some %path% matching to determine whether to scrobble, which might alleviate my need to enable/disable audioscrobbler in most cases. Cheers for the fresh angle
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-30 12:38:04
@rawny I didn't know you could popup audioscrobblers preferences, but i knew it should be possible and only one mouseclick away from what you want.
I gotta check it out soon because i also use lastFM and love making buttons myself  (Two mouseclicks is acceptable within my personal 'user-ergonomic' rules ^^)

@marc2003, nice trick, once again..  I just delete misscrobbled track on lastfm. (This has the advantage you can flipflop bad decisions by undeleting (http://playground.last.fm/demo/undelete).

@falstaff, upgraded to v2b8.2, still no errors,
but as mentioned before, still some broken features in the toolbars rightside menu.
- Sorting doesn't work for me (it did work when i checked it in v2b7-something).
- I see no blue indicator-dot that pre-b8 showed-up in the goup/order menu.
- Another strange thing is that i started losing mousescroll capabilities in all my panels. (Happened 2 times).
Not reproduceable but also occurs since v2b7.3+. I am not saying its your script that blocks mousescrolling, it's just something i thought was worth reporting.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-30 18:20:30
- Sorting doesn't work for me (it did work when i checked it in v2b7-something).


could you give details? sort or group/sort or both ? are you sure of that, just tested all, and they works, try to randomize playlist before to be sure that nothing is sorted, and could you tell wich preset seems broken and what does it do really?

- I see no blue indicator-dot that pre-b8 showed-up in the goup/order menu.


normal i've removed this indicator which has no sense because it wasn't binded to a playlist but was just a general indicator, so if you sort a group a playlist with a group present, then if you switch to another playlist with another group preset, it keeps with the last used, so that wasn't logic to display it.

- Another strange thing is that i started losing mousescroll capabilities in all my panels. (Happened 2 times).


this looks like a timer overflow in another wsh panel that freeze all other timers used in all others wsh panels. You must have a wsh panel that doesn't handle correctly timer objects (issue already encourtered for me with my wsh seekbar in my config slate. e.g. timers was never cleared on track chang ...)
so, that's not the playlist script in cause.
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-04-30 19:32:21
1. Sort doesn't re-order the playlist. Yes i tried Randomize and Reverse first. None of the presets reorder the list. Group/Sort doesn't reorder either, but it does give the different groupheaders.

CORRECTION: But only on FORCE-SORTED autoplaylists. This got me confused  If i disable the force-sorted checkbox for the active autoplaylist it DOES work perfectly.
But what were pIv and marc2003 talkin' about then?

2. Okee, that makes sense.

3. Okee, i'll try to get that fixed if i can find the cause. Clean code is euhm.. clean?  But it's not a big problem as it does not happen often & refreshing solves it.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-04-30 19:46:00
1. sure!! force sorted feature on autoplaylist, as naled, force the sort order, so no other can be applied if it's enabled, logic. so all is ok.

3. hard to find where is the bug (which other panel), but if you use timers in your wsh seekbar panels, i'd start from here
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-04 18:19:50
WSH Playlist Viewer v2 beta 9: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

What's new in beta9:
- columns options added (play icon, tracknumber)
- CTRL+C and CTRL+V now supported to copy/paste tracks from a playlist to another (e.g.)
- come back of the Queue Playlist feature!
- little bug fixed for the display of the year when tag %date% is not to the format YYYY-MM-DD but YYYY/MM/DD or YYYY.MM.DD
- tweaks

Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-04 20:46:17
While editing in a 'WSH Panel Mod Configuration' window, how do I activate the auto-dropdown list of functions when a trigger key is pressed
such as the "F" key, which should cause the fb.xxxxxxx functions drop-down list to activate next to the cursor.

In my latest foobar2000 layout, the drop-down feature is not activating !!
I started an archived foobar2000 installation on my hard drive (with WSH Panel Mod 1.4.2) and the drop-down feature works.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-04 21:10:22
looks like the interface.api and jscript.api files are missing from your component folder.

if you installed the component via the proper methods, this wouldn't happen.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-04 22:09:10
marc, thanks for answering.

In my current foobar2000, I have WSH Panel Mod files placed like so:

       ...\foobar2000\user-components\foo_uie_wsh_panel_mod\foo_uie_wsh_panel_mod.dll
       ...\foobar2000\user-components\foo_uie_wsh_panel_mod\interface.api
       ...\foobar2000\user-components\foo_uie_wsh_panel_mod\jscript.api

As I far as I know, my file placement is correct.

Does anybody here have more answers ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-04 22:22:52
file>preferences>tools>wsh panel mod>editor properties

check the value of 

api.jscript
Code: [Select]
$(dir.component)jscript.api;$(dir.component)interface.api


edit: i assume your files were in the correct place before i mentioned it. if you put them there manually, you'll probably need to restart.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-04 22:31:00
Preferences are exactly like yours marc; so no problem there.

Any more answers?
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-05 08:02:26
Hi again,

I'm trying to display the bitrate for the now playing track and would like it to change dynamically for VBR tracks. I'm trying to use the following code, but for some reason it doesn't update as the track plays. I'm not sure why it's not working - I thought that on_playback_dynamic_info() should cover the updating of the display when the bitrate changes. Anyone got any pointers?

Code: [Select]
function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

var bitrateTF = fb.TitleFormat("%bitrate%' kbit/s'");

var textFont = gdi.Font("Tahoma", 10, 1);
var textColour = RGB(255, 255, 255);

if (fb.IsPlaying){
        update();
}

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

function update() {
    g_metadb = fb.GetNowPlaying();
    if (!g_metadb) return;
    bitrate = bitrateTF.EvalWithMetadb(g_metadb);
    window.Repaint();
}

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
        gr.GdiDrawText(bitrate, textFont, textColour, 0, 0, ww, wh);
}

function on_playback_dynamic_info() {
        update();
}
function on_playback_dynamic_info_track() {
        update();
}
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-05 08:39:50
to make it work you have to eval the TF with true, just by testing if a track is playing... here is the fix (note: bitrate wasn't declared as global ==> added too)

Code: [Select]
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

var bitrateTF = fb.TitleFormat("%bitrate%' kbit/s'");
var bitrate;

var textFont = gdi.Font("Tahoma", 10, 1);
var textColour = RGB(255, 255, 255);

if (fb.IsPlaying){
update();
}

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

function update() {
if (fb.IsPlaying) bitrate = bitrateTF.Eval(true);
window.Repaint();
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
gr.GdiDrawText(bitrate, textFont, textColour, 0, 0, ww, wh);
}

function on_playback_dynamic_info() {
update();
}
function on_playback_dynamic_info_track() {
update();
}
Title: WSH Panel Mod script discussion/help
Post by: amalone on 2012-05-05 10:18:11
Using WSH Playlist Viewer Beta 9. I have the playlist, album list and album art viewer all visible. Start playing a FLAC file and correct cover art is visible in album art viewer. Highlight a different FLAC file in album list and the cover art for that file is now visible. Click back on FLAC that is playing and cover art does not change back. With ES Playlist cover art changes back to the playing FLAC cover art. It is like a disconnect with WSH Playlist Viewer after highlighting a file in album list. Not sure if that is how it has to work.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-05 10:47:17
Using WSH Playlist Viewer Beta 9. I have the playlist, album list and album art viewer all visible. Start playing a FLAC file and correct cover art is visible in album art viewer. Highlight a different FLAC file in album list and the cover art for that file is now visible. Click back on FLAC that is playing and cover art does not change back. With ES Playlist cover art changes back to the playing FLAC cover art. It is like a disconnect with WSH Playlist Viewer after highlighting a file in album list. Not sure if that is how it has to work.

sorry but it's not really clear ...

Start playing a FLAC file and correct cover art is visible in album art viewer

ok, art viewer, so not my wsh playlist... let's go next

Highlight a different FLAC file in album list and the cover art for that file is now visible.

why you say "now" wasn't ok before in playlist? "visible", where ? in art viewer or playlist or both ?

Click back on FLAC that is playing and cover art does not change back.

what do you mean by "Click back on" ? could you explain on what you click please, and when you said "cover art does not change back, yu mean in playlist or art viewer ?


*waits for details and answers*

thanks by advance
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-05 12:40:56
to make it work you have to eval the TF with true, just by testing if a track is playing... here is the fix (note: bitrate wasn't declared as global ==> added too)


Sweet that fixed it and I missed bitrate being a global when I converted it to a simpler example 

It may be worth mentioning that I had to change the on_paint function to the following:
Code: [Select]
function on_paint(gr) {
     gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
     if (fb.IsPlaying) {
         gr.GdiDrawText(bitrate, textFont, textColour, 0, 0, ww, wh);
     }
}

And I also had to add a call to the update function from an on_playback_stop handler.

Cheers for the help
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-05 12:41:28
WSH CoverFlow v1.2: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

- cover placement enhanced by adding a toolbar (like my in my WSH playlist viewer)
- tweaks

(http://i.imgur.com/CVfrX.jpg)
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-05 16:07:44
WSH CoverFlow v1.2: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

- cover placement enhanced by adding a toolbar (like my in my WSH playlist viewer)
- tweaks


I would love to be able to use this, but it massively lags foobar when I try and scroll through the album art (even if I just scroll one cover either direction). I reduced the size of the panel which helped but it's still laggy enough to disrupt the audio as the cover changes 

It may well just be a side-effect of the fact I'm running foobar under WINE, but I was wondering if anyone might have any ideas on reducing the lag in any way. No worries if not.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-05 16:22:53
@rawny:

running it under linux is for sure not a benefit for performances... you can still try to disable all effects like glass effect, scroll transition ...

but i don't think it's made for the use you make, try it under windows and you'll see the difference

EDIT: ...my script may lag too under Android with a virtualized windows partition
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-05 16:32:20
@Falstaff:

Hehe well I'm not running Linux (Ubuntu specifically) to try and get good performance from your coverflow, I'm just trying to see if I can achieve better performance in the Ubuntu that I was already running 

(And I know that this will inevitably have a bottleneck and I'll probably not be able to use it. I wanted to try and push it anyway just in case it is usable - 'cause I would love to have a coverflow if possible  )

How do I disable said effects? Should I just look for them in the code and comment them out?

Edit: I found the window.getProperty part in the code and changed all the graphics related-ones (reflection, focus rectangle, glass, scroll animation) to return false straight off (and I changed flat style to true) and it's reduced the lag a fair bit. It still lags a tad but it's nowhere near as bad as it was.
Title: WSH Panel Mod script discussion/help
Post by: amalone on 2012-05-05 19:36:46
WSH Playlist 9. Sorry, that was clear as mud. I have the cover art turned off in WSH Playlist. I strictly view cover art in the Album Art Viewer as I like to view it a little larger. On the left top is the album list, left bottom is the album art viewer, and on the right is WSH playlist. It looks really nice thanks to you.

If I start a FLAC file playing, the details are in the WSH playlist (right), and the correct cover art is in the foobar2000 art viewer (lower left). If I click, without actually starting playback, on another FLAC file in the album list (upper left), the album art changes to that file in album art viewer. Nothing changes in WSH playlist as cover art is turned off. Then I click back on a track actually playing in WSH playlist, and the cover art does not change to the playing FLAC cover. In ES playlist it does as I used that set up for a while. Thank you.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-05-06 21:22:02
@marc2003, thanks very much for your "similar artists" WSH script and others.  Concerning the "similar artists" script, I'd like to suggest a tweak or enhancement that is beyond my ability to code.  Context: I use the "artist" tag to include all of the performers for a given song.  Most of the time, it just contains a band name or the name of the person I consider the primary artist for the song, and everything integrates perfectly with your script.  But for some songs I have multiple persons or bands in a single "artist" tag to reflect featured performers, ad-hoc ensembles, etc.  In these cases, the "similar artist" script correctly searches for the string of the entire content of the "artist" tag and returns nothing.

To handle the cases where I have multiple artists in the "artist" tag, I'd like a way to manually enter which artist to search for in the "similar artist" script, perhaps from a context menu prepopulated with the current "artist" content so I can delete all but one artist for a search.  I think a method of manual entry and override of the default action would be the most efficient way to meet this need, instead of trying to identify, parse, select, and search for multiple artists, but I certainly defer to you if there is an easier way to do it.

I think many others use the "artist" tag in a simlar manner and thus this tweak would be of use to many others as well, but if that assumption is incorrect then please let me know.  Thanks again for your efforts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-06 23:38:10
you could replace %artist% on line95 with $meta(artist,0) and that would use the first artist.

changing the setting per artist isn't really feasible.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-05-07 01:05:42
That will work well enough, and I can just change the zero to another number to select another artist.  Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-07 01:13:32
if you are going to tinker with that value for different artists, you might want to comment out line 123 as that will try to fetch updated info from last.fm if the stored data is more than 1 day old. obviously it would use the current setting and not whatever was used to fetch the original data.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-05-07 08:12:43
2 Falstaff

If I want use coverflow panel for my media library now - I must create seperate playlist and load in it all song from media library.

It is possible in future use coverflow with media library without playlist with media library content?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-07 08:51:53
2 Falstaff

If I want use coverflow panel for my media library now - I must create seperate playlist and load in it all song from media library.

It is possible in future use coverflow with media library without playlist with media library content?


actually not.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2012-05-07 11:02:16
Maybe if T.P. Wang is kind enough to give us a new feature like GetLibraryItems then it would be possible. 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-08 11:47:40
updates!

WSH Playlist Viewer v2.0 (final)
WSH CoverFlow v1.4

* Scripts available at http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

* I have included them in a simple DefaultUI config (just a .fth to import), for those who are interested, get it at http://fav.me/d4z1j0w (http://fav.me/d4z1j0w)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-08 14:15:43
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

changes to news / reviews / blogs, now playing, thumbs and similar artists scripts only.

added artist field remapping option to context menu.

(http://dl.dropbox.com/u/22801321/dialog.png)

(simple biography already has this feature)

edit: added feature to news / reviews / blogs as well.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-08 14:48:24
I have added mouse hover-seek popup info to my 'WSH volume control', but it has a small problem;

This is correct:
When I mouse click-drag-seek, the text display range in the 'WSH volume control' main window goes from -100dB at left end to 0dB at right end.

This is NOT correct:
When I mouse hover-seek, the text display range in the 'WSH volume control' hover popup goes from -287dB at left end to 0dB at right end.

Is anybody here familiar with the mathematics of the volume display?
Could you please review my code for the hover info function and tell me what is wrong.
Here is the relevant function (the problem lines are in red):
Quote
function on_mouse_move(x,y) {
      window.SetCursor(32649);
      if(g_drag) {
           var v = x / window.Width;
           v = (v<0) ? 0 : (v<1) ? v : 1;
           v = 25 * Math.log(v+0.00001);
           if(fb.Volume != v)
                fb.Volume = v;
      }
      g_hover_seek = null;
           g_hover_seek = x / window.Width;
           g_hover_seek = (g_hover_seek<0) ? 0 : (g_hover_seek<1) ? g_hover_seek : 1;
           g_hover_seek = 25 * Math.log(g_hover_seek+0.00001);
           g_hover_seek = (Math.ceil(g_hover_seek)) + "dB";
   g_hover = x + 4;
   window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-08 15:10:00
i'm not really sure what you're doing there???

i took the sample Volbar with GdiDrawText.txt and added hover tooltip support here....

http://pastebin.com/j2JNZHBA (http://pastebin.com/j2JNZHBA)
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-08 16:14:09
I tried out your code there marc.
As soon as my mouse entered hover coordinates, WSH Panel Mod crashed with error: Line 39, Column 9, Object doesn't support property or method.
So I commented out line 39 and tried again.
As soon as my mouse entered hover coordinates, WSH Panel Mod crashed with error: Line 47, Column 9, Object doesn't support property or method.

I am using WSH Panel Mod version 1.4.3 .
I refuse to upgrade to newer versions because my WSH auto-cycling Artwork Viewer doesn't work perfectly with newer versions .

The function code I posted before works perfectly except for the mathematical calculation of the decibel range for the tooltip.
The mathematics of 25 * Math.log(g_hover_seek+0.00001) gives the same scaling as the built-in foobar2000 volume slider (logarithmic).

Here is the full code posted online (it works perfect except for the tooltip info calculation error): http://textsnip.com/my/wsh_volume_control/jscript (http://textsnip.com/my/wsh_volume_control/jscript)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-08 20:54:07
heh, i was using the linear example and it also uses new tooltip functions only found in 1.5.0+. yours doesn't use tooltips so your description is a bit misleading....

i'm not editing your whole script because it makes my head hurt but the main change is here....

Code: [Select]
function on_mouse_move(x,y) {  
    window.SetCursor(32649);  
    v = x / window.Width;  
    v = (v<0) ? 0 : (v<1) ? v : 1;  
    v = 25 * Math.log(v+0.00001);  
    if(g_drag && fb.Volume != v) fb.Volume = v;    
    window.Repaint();  
}


i've removed "var v=..." because it needs to be global. v needs to be used as the hover text in on_paint.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-08 23:19:33
Thanks for the help marc, but...

you've just cleaned up a subroutine which was already working (notwithsatnding the removal of "var v=...").
In fact, the "g_hover_seek" section –which you removed– was working too except for one small problem:

When moving the hovered mouse cursor to the extreme left position, the tooltip display should stop at -100dB; but it doesn't, it stops at -287dB.
Nothing else is wrong with my code; the dB display in the WSH window and the tooltip are syncing correctly when I hover seek all through '0db to -100dB';
except the dB display in the the tooltip continues to increase as I go left beyond -100dB.

The mathematics of "window width vs tooltip dB display"  are wrong somewhere in my code; my code fully works.

Your final comment "v needs to be used as the hover text in on_paint." seems to be resolving the issue.
How exactly do I use v in on_paint? Do I have to declare "v" as a variable again at "on_paint(gr)", or is it called from your new "on_mouse_move(x,y)" subroutine.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-08 23:53:02
well the maths is too much for my poor brain. but i did find some different code by fbuser. you could try it instead....

on_paint
Code: [Select]
pos = window.Width * Math.pow((100+fb.Volume)/100,2);


on_mouse_move
Code: [Select]
v = x / window.Width;
v = (v < 0) ? 0 : (v < 1) ? v : 1;
v = 100 * (Math.pow(v,1/2) - 1);
if (g_drag) fb.Volume = v;


v is the text string you want to use in on_paint

Code: [Select]
gr.GdiDrawText(v + "dB", g_font, RGB(255,255,255).....


Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-09 01:06:23
This is too much for my poor brain too marc; I'm giving up.
For all intents and purposes the code works; one has to try very hard to actually notice the tooltip problem, it is that minor.
Thanks for the help +++
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-09 15:41:12
Hey,

If possible I would like to be able to get the IFbMetadbHandle for the item that will become the playing item when playback is started.

Let's imagine that I have a playlist containing tracks A, B and C and that I also have cursor follows playback and playback follows cursor disabled. I currently have track A selected and I'm actually playing track B. Then I hit stop and, after the playback stops, I restart foobar. When I hit play, track B will be played again.

I wish to get the IFbMetadbHandle for track B on start-up. So before playback is started and regardless of whether another track, such as A, is selected - is this possible and how?

Cheers
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-05-09 16:09:35
is there any way to get info from embedded cue in playlist?
Title: WSH Panel Mod script discussion/help
Post by: amalone on 2012-05-10 00:09:22
@Falstaff

Using WSH Playlist Viewer 2.0. I have the Group Header set to 3 lines so tracks, codec, genre line shows. If the stream is WMA V2 then the codec shows as ? (question mark). Codec shows up okay in the status bar (codec & codec profile). MP3 and AAC look okay.

Is this just my computer? Also is it possible to have that line as black text instead of grey?

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-10 11:15:42
@amalone

have you and @ of WMA stream for me testing please?
Title: WSH Panel Mod script discussion/help
Post by: amalone on 2012-05-10 14:29:32
@Falstaff

These 3 radios streams do it

mms://streaming.sbsradio.se/03872_Studio_low
mms://81.173.117.102/ArrowAudio01
mms://81.173.117.102/ArrowAudio02

Thank you.
Title: WSH Panel Mod script discussion/help
Post by: matif on 2012-05-11 15:56:29
Thanks, T.P. Wang.

I am wondering if there a way to change mp3 these tags by foobar?
ex. plman.SetPlaylistSelectionTag(target, val)
or XXX.SetProperty(name, val)
(http://img232.imageshack.us/img232/4981/tagss.jpg)

Is there anyone can help me?
Thank you!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-11 16:19:18
look at UpdateFileInfoSimple in interfaces.txt
Title: WSH Panel Mod script discussion/help
Post by: matif on 2012-05-11 16:43:21
look at UpdateFileInfoSimple in interfaces.txt

Wow, you are so fast.
Thank you for help.
I should remain "docs" folder in the past. XD

Title: WSH Panel Mod script discussion/help
Post by: matif on 2012-05-11 19:24:38
look at UpdateFileInfoSimple in interfaces.txt

Is it can only be uses in one song at one time?
Can it be able to use in multi-song at one time?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-11 20:42:33
you could loop through an array of items something like this...

Code: [Select]
items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
for (i = 0; i < items.count; i++) {
    items.item(i).UpdateFileInfoSimple("title", "test");
}
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-12 08:53:22
I've updated my vertical volume bar script so that the tooltip showing the volume will update while the mouse-wheel is being scrolled on the bar. Code below 

Code: [Select]
// ==PREPROCESSOR==
// @name "Volume-bar with tooltip"
// @author "rawny"
// ==/PREPROCESSOR==

// Based somewhat on:
// -> "Volbar with GdiDrawText" by T.P Wang
// -> "Simple Seekbar" by marc2003

var a = 25;
var g_drag = 0;
var g_drag_seek = 0;
var g_tooltip = window.CreateTooltip();
var g_trackingMouse = false;
var old_x;
var old_y;

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 on_size() {
    ww = window.Width;
    wh = window.Height;
}

function on_paint(gr){
    var ww = window.Width;
    var wh = window.Height;
    var pos = 0;
    var volume = fb.Volume;
    if(g_drag){
        pos = wh * g_drag_seek;
    }else{
        pos = wh * Math.exp(fb.Volume/a);
    }
    gr.FillGradRect(0, wh-pos, ww, wh, 90, RGB(0,0,255), RGB(70,90,200));
    gr.FillGradRect(0, 0, ww, wh-pos, 90, RGB(0,0,0), RGB(50,50,50));
    gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(100,100,100));
}

function on_mouse_move(x,y){
    // Set the cursor to the hand symbol:
    window.SetCursor(32649); 
    g_drag_seek = 1-y/wh;
    g_drag_seek = (g_drag_seek<Math.exp(-100/a)) ? Math.exp(-100/a) : (g_drag_seek<1) ? g_drag_seek : 1;
    if(x > ww){
        g_drag = 0;
    }
    if(g_drag){
        window.Repaint();
    }
    if(!g_trackingMouse){
        g_tooltip.Activate();
        g_tooltip.TrackActivate = true;
        g_trackingMouse = true;
    }
    if(x != old_x || y != old_y){
        txt = Math.ceil(a*Math.log(g_drag_seek))+"dB ("+Math.ceil(g_drag_seek*100)+"%)";
        g_tooltip.Text = txt;
        g_tooltip.TrackPosition(x+10,y-10); 
        old_x = x;
        old_y = y;
    }
}

function on_mouse_leave(){
    g_trackingMouse = false;
    g_tooltip.TrackActivate = false;
}

function on_mouse_lbtn_down(x,y){
    g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
    if(!g_drag){
        return;
    }
    g_drag = 0;
    var v = 1-y/wh;
    v = (v<Math.exp(-100/a)) ? Math.exp(-100/a) : (v<1) ? v : 1;
    fb.Volume = a*Math.log(v);
}
function on_mouse_wheel(delta){
    if(delta>0){
        fb.VolumeUp();
    }else{
        fb.VolumeDown();
    }
    g_tooltip.Text = Math.ceil(fb.Volume)+"db ("+Math.ceil((Math.exp(fb.Volume/a))*100)+"%)"; 
    var ttY = wh-(wh * Math.exp(fb.Volume/a)); 
    g_tooltip.TrackPosition(10, ttY-8); 
}

function on_volume_change(val){
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: matif on 2012-05-12 09:05:06
you could loop through an array of items something like this...

Code: [Select]
items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
for (i = 0; i < items.count; i++) {
    items.item(i).UpdateFileInfoSimple("title", "test");
}

Thank you!
Can you tell me why GetPlaylistSelectedItems need to use count and item?
I have used following codes yesterday:
Code: [Select]
var items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
    for (i=0; i<items.length; i++) {
        items[i].UpdateFileInfoSimple("title", "test");
    }

But nothing happen.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-12 09:14:20
from the docs...

Code: [Select]
interface IFbMetadbHandleList
{
Properties:
    (readonly) uint Count;
    // [1.5.0 Preview 6]: Changed, now writable.
    (read, write) IFbMetadbHandle Item(idx);
...
}
Title: WSH Panel Mod script discussion/help
Post by: matif on 2012-05-12 15:59:59
from the docs...

Code: [Select]
interface IFbMetadbHandleList
{
Properties:
    (readonly) uint Count;
    // [1.5.0 Preview 6]: Changed, now writable.
    (read, write) IFbMetadbHandle Item(idx);
...
}

Thank you, and sorry for stupid questions.
I never learn programming language from teachers or books.
I even can't understand whole files in docs very well.
So, I'm very appreciate your teaching.
When I have other questions can I ask you by PM?
Thank you!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-12 18:03:32
it's better to ask questions in this thread. other people can answer and also others can learn if they get stuck doing the same kind of thing.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-13 20:45:04
Given a reference to a track (e.g. the currently playing track), is there any way to get an IFbMetadbHandleList of the group that it resides in within EsPlaylist?

Edit: I guess my best alternative option is to fake it by having the script create an autoplaylist based on the same query that forms the group. Unless anyone can think of any better ideas?
Title: WSH Panel Mod script discussion/help
Post by: matif on 2012-05-16 18:12:20
it's better to ask questions in this thread. other people can answer and also others can learn if they get stuck doing the same kind of thing.

XD But my questions are very stupid, isn't it?

The new question is:
Can we change .txt or .lrc in WSH Panel Mod script?
I want to replace some words in .txt or .lrc files.
Title: WSH Panel Mod script discussion/help
Post by: San_dr on 2012-05-17 08:33:34
@Falstaff
WSH Playlist Viewer  2.0.1
Thanks for the awful nice item for DUI very nicely in the "se7en", but in XP selected mouse line has completely white background (I have a dark theme and it is very contrasting).
(http://savepic.net/2811464.png)
what part of the code, you can assign a color to the selected row?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-17 08:48:46
@San_dr

you know there are options in my script? Just disable Themed style in settings! untick this menu item :
(http://i.imgur.com/dAuPg.png)
Title: WSH Panel Mod script discussion/help
Post by: San_dr on 2012-05-17 09:49:09
@San_dr
you know there are options in my script? Just disable Themed style in settings! untick this menu item :

(http://savepic.net/2810443.png)
Now re-unpacked wsh_playlist_viewer_v2_0_1_by_br3tt-d4se96u.zip and applied the "pure" script. But no change. This may not be related to the settings XP? In the "7" gray highlighted line (with a black background). And I want to ask - in the properties panel, the first item *USER.background.image.enabled - True
Do I understand that you can add your background picture? I can not do it. Desired image background.jpg 800x600 placed in Foobar2000\images...
Thanks for the prompt
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-17 10:30:36
on your screenshot, "USe Themed Style" is ticked, so it's normal that you have a styled lined (white), so just untick it, and show me the result please, normally, no more white background line ==> ok?
Title: WSH Panel Mod script discussion/help
Post by: San_dr on 2012-05-17 11:43:17
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-05-17 14:59:41
i need to collect some statistics, so i need a kind of database. can i somehow connect with sql base or i can store data in text files without longer search time?

toSan_dr are you russian too?
Title: WSH Panel Mod script discussion/help
Post by: San_dr on 2012-05-17 16:11:02
Quote from: romka18 link=msg=0 date=
San_dr[/b] are you russian too?

??,?????. ???????. ??????  http://foobar2000.0pk.ru/viewtopic.php?id=392 (http://foobar2000.0pk.ru/viewtopic.php?id=392)  (Yes, 'romka18', Kharkov, come in)
Title: WSH Panel Mod script discussion/help
Post by: MDMA on 2012-05-18 14:30:53
When I try and rename my playlist tabs or sort the playlist, WSH mod crashes. Using foobar 1.1.11 wsh panel mod 1.5.3.1 any help would be appreciated
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-18 14:38:03
When I try and rename my playlist tabs or sort the playlist, WSH mod crashes. Using foobar 1.1.11 wsh panel mod 1.5.3.1 any help would be appreciated


Might help to name/describe the scripts you are using, how many WSH panels you have open, which playlist components you are using etc.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-18 14:47:52
When I try and rename my playlist tabs or sort the playlist, WSH mod crashes. Using foobar 1.1.11 wsh panel mod 1.5.3.1 any help would be appreciated


for the crash on rename (i assumed you use my WSH tabbed playlist manager script), just untick (as usual) the "Safe Mode" option in WSH settings in foobar2000 Preferences pages!

for the crash issue on sort, if you talk about the search menu from my WSH playlist viewer, it should work except if you're not using the last version of WSH PAnel Mod which is 1.5.3.1, or you said you got it (verify please in Preferences> Components...), so thanx to give here more details or most of all the content of the console (error message + line number in error) ==> menu View>Console.

HTH
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-05-20 10:39:36
Hi again.
I have another issue trying to understand some examples. I'm looking at the sample scripts drawing buttons. Both the basic samples and those provided by marc2003 use the same constructor function. I'm clueless on this part :
Code: [Select]
    this.draw = function (gr) {
           if (this.state == ButtonStates.hide) return;
          
           switch (this.state)
           {
          ... <snip> ...
           }
  
           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_CENTER| DT_VCENTER | DT_CALCRECT | DT_NOPREFIX);
       }

The method defined here receives an argument called gr and uses it as an argument to g_theme.DrawThemeBackground. However, whenever a <button>.draw method is called in any sample i've seen, the argument passed to it is also simply gr. But nowhere i found a statement defining gr 
I found a reference to gr in callbacks but it states it's invalid outside of two specific callbacks : on_tooltip_custom_paint and on_paint. Here it's used by drawAllButtons(gr) function.

Surely i'm missing something. I guess i could just copy-paste working scripts without wondering how they are working but this looks like a sure-way to big mistakes later on.

Also, there is also this gr.GdiDrawText() method used in the sample. According to what i understood from the doc this method belongs to an IGdiGraphics interface that fist has to be created by the method GetGraphics() of an IGdiBitmap interface, itself created by some methods of the "first-level" interfaces window or gdi. Again, i guess i missed something.

Can someone help me understand how this works?
Title: WSH Panel Mod script discussion/help
Post by: MDMA on 2012-05-21 00:02:19
When I try and rename my playlist tabs or sort the playlist, WSH mod crashes. Using foobar 1.1.11 wsh panel mod 1.5.3.1 any help would be appreciated


for the crash on rename (i assumed you use my WSH tabbed playlist manager script), just untick (as usual) the "Safe Mode" option in WSH settings in foobar2000 Preferences pages!

for the crash issue on sort, if you talk about the search menu from my WSH playlist viewer, it should work except if you're not using the last version of WSH PAnel Mod which is 1.5.3.1, or you said you got it (verify please in Preferences> Components...), so thanx to give here more details or most of all the content of the console (error message + line number in error) ==> menu View>Console.

HTH


Thanks, I've solved both problems. Loving the scripts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-21 04:24:30
I found a reference to gr in callbacks but it states it's invalid outside of two specific callbacks : on_tooltip_custom_paint and on_paint. Here it's used by drawAllButtons(gr) function.


drawAllButtons is just a function called from within on_paint. you can pass gr to any other function you want.

as for your 2nd point, you don't reallly need to think about using GetGraphics. that's only for more complex tasks such as creating images from scratch. for displaying images frin disk or drawing text, using gr.GdiDrawText or gr.DrawImage is more than enough.

Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-05-21 08:48:20
Thanks.
OK, i managed to find the original on_paint call. Sometimes it's hard to find where the original call lies when you did not write the script 
This also means i can't use those methods outside of an on_paint call to e.g. repaint only one button rather than the whole panel. Is it an issue performance wise or am i again "over-thinking" the issue?

And something totally unrelated to those. Is there a way to update an auto-playlist query (from some jscript code i mean, not with the playlist properties pane) after it was created? Currently i'm removing the auto-playlist and then re-create it but the drawback is that a play-list view showing this auto-playlist won't update correctly and will be left empty.
I guess i could activate the playlist but i don't really like this approach as it tends to interfere with playback.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-21 09:18:52
with more complex panels, it's more efficient to use window.repaintrect() where you can supply x, y, w and h. but for the example buttons scripts, the panels are likely be to be pretty small so it's ok to repaint the whole panel. also, if you look in the code in mouse move sections, the functions exit if nothing has changed. window.repaint only gets called if it needs to be.

and no, it's not to possible to directly edit an existing autoplaylist. removing and re-creating is the way i do it.

Quote
but the drawback is that a play-list view showing this auto-playlist won't update correctly and will be left empty


i have no idea what's going on there. it works perfectly fine for me.
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-05-21 10:45:07
with more complex panels, it's more efficient to use window.repaintrect() where you can supply x, y, w and h. but for the example buttons scripts, the panels are likely be to be pretty small so it's ok to repaint the whole panel.

Thanks for pointing this one. It will perfectly fit the toolbar object i'm building to hold buttons.
Well, the example script is just that. I already borrowed/stole the code and put it in a bigger panel, thus my question about performances. 
Quote
Quote
but the drawback is that a play-list view showing this auto-playlist won't update correctly and will be left empty

i have no idea what's going on there. it works perfectly fine for me.

I have a Playlist Tab splitter with NG Playlist on it (columns UI as you have guessed). When the tab for my auto-playlist is active, if i remove-create it to change the query, the playlist view is left empty until i switch to another tab and back.
I could probably work this around using two playlists, one normal and one auto but i would prefer to use only one.

There is no method to populate a non auto playlist directly from the library is there? I didn't found a way to get a metaDbHandlesList directly from the library or more precisely, I didn't found a way to select using jscript code items from the library so i can get handles with fb.GetSelections.
I could probably make a temporary autoplaylist to get the handles and then keep the metaDbHandleList object in memory rather than dispose of it after use but i'm not sure how big it can grow
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-21 19:50:27
if you only have one playlist active and remove/re-create it, then it makes sense to switch focus to it through the script. i can't see why you wouldn't want to do this.
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-05-22 10:20:04
I have several playlists. Some are autoplaylists and others are not. I don't like the idea of activating a playlist through the script because i noticed that when some components activate a playlist, playback will jump to that playlist after the current track finishes even thought there are still tracks on the currently playing playlist. This might have something to do with the obscure playing queue (i wish i could disable it completely) but as i'm not sure why this happens, i prefer not to "activate" playlists at all.
foobar2000 is great but the way playlists interact with each other and with the playing queue is kind of confusing. 

That's why i'm (probably over-)cautious about playlist activation. I think i found a way of doing what i have in mind by storing metaHandles in an object. If what i understood of Falstaff coverflow script is right, he's keeping metaHandles in memory for it to work. If those are just what the name suggest, they shouldn't be that big.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-22 10:30:51
You could disable the playback from following the cursor, which would prevent it following the change in playlists. You could either do this manually (via toggling the playback menu -> playback follows cursor) or from your script:

Code: [Select]
fb.PlaybackFollowCursor = false;

This could also be combined with having the script to store a reference to the playing playlist when it starts and then making sure that it sets that playlist as the active one once the script finishes everything else it's doing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-22 10:33:22
I don't like the idea of activating a playlist through the script because i noticed that when some components activate a playlist, playback will jump to that playlist after the current track finishes even thought there are still tracks on the currently playing playlist.


well that's not right. where playback goes after the current track has finished depends on what playback follows cursor and cursor follows playback settings you have on the main playback menu.

edit: too slow.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-05-22 13:06:30
Hehe, only just
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-05-22 19:42:38
Thanks both. Now i know what those settings do. 
I always wondered what my mouse cursor had to do with playback 
I have both un-set by default so i guess the issue came from some component or script overwriting them.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-23 05:28:11
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

similar artists has been merged into a new panel which can fetch more feeds. as always, use the mouse wheel to scroll and the text is clickable taking you to pages on the last.fm website...

(http://dl.dropbox.com/u/22801321/new%20lastfm%20panel.png)
Title: WSH Panel Mod script discussion/help
Post by: San_dr on 2012-05-23 11:22:51
Falstaff, VU-meter specifically for your style
(http://savepic.net/2852121.png)
http://foobar2000.0pk.ru/viewtopic.php?id=392 (http://foobar2000.0pk.ru/viewtopic.php?id=392)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-23 11:44:49
@San_dr

hmm, i'm not conviced by its style ... but thank you

take care, you are off topic here, this had to be placed in the VU Meter topic : http://www.hydrogenaudio.org/forums/index....c=33939&hl= (http://www.hydrogenaudio.org/forums/index.php?showtopic=33939&hl=)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-23 21:58:33
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

new script: musicbrainz releases



-like romor's script, it will use MUSICBRAINZ_ARTISTID if it exists in your tags, otherwise it will do a simple text match
-click the text to open the musicbrainz website which will give more details
-unlike romor's script, there is no pagination because i'm lazy. i've countered this slightly by using release-group instead of release so there shouldn't be as many results.

IMPORTANT: existing users of my scripts need to extract the marc2003 folder again.
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-05-23 22:59:19
Your last update(s) are looking great marc2003. A pitty, i've no time to play with them at the moment.
Been trying to understand the json-file you pull from lastfm in your other scripts as i was planning on constructing something similar. No more need for that now by the looks of it.

I've no scripting skills higher than markuplanguage-abuse (aka. titleformatscript), but i've been reading/digging/gazing trough your scripts for some time now.
I've reached the stage in wich i can tweak some custom visual stuff and update things without crashes... & planning on really learning some jscript whenever i find the motivation (= time) for it.
It would make my foobar much more futureproof for sure.

Great work and a good job on sharing it, thanks. 
(PS, Always found it a bit tricky to keep track of your 'samples.zip' versions. As they have no version indication at all a.f.a.i.k. I rename 'samples.zip' with a timestamp when i download them which helps a bit.
So last version(s) will be  12-05-22_marc2003_samples. (...and 12-05-23_marc2003_samples, you go fast, lol) Ever considered introducing some kind of versionnumbers?)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-24 05:38:58
Quote
Ever considered introducing some kind of versionnumbers?


no. 

perhaps i should but i never keep old work. i always overwrite everything thinking newer is better. dropbox keeps backups of recent changes for 30 days so that's enough to restore files if i make catastrophic changes and need to revert.

also:

-update to musicbrainz releases just uploaded. there was a possibility the text would overlap with the date. also changed the scroll step from 1 to 3. oops...
-update to news / reviews / blogs. the main title has been changed to make it consistent with all my other panels where it now follows artist: description
Title: WSH Panel Mod script discussion/help
Post by: romor on 2012-05-24 09:41:39
i've countered this slightly by using release-group instead of release so there shouldn't be as many results.


Good idea, that is the way to go, I updated my script accordingly

Additionally I limit to Album/EP/Single
Title: WSH Panel Mod script discussion/help
Post by: MDMA on 2012-05-24 10:00:11
 marc2003 awesome new script
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-24 10:26:40
Additionally I limit to Album/EP/Single


i've shamelessly stolen that idea also. script updated.

edit: updated again.  i've now added a toggle on the context menu for 'live' releases which people can turn on or off.
Title: WSH Panel Mod script discussion/help
Post by: MDMA on 2012-05-24 11:53:11
You're also pretty shameless about admitting your shameless-ness 

Does anyone have a track details script? Something with a bit more customisation possibilities than foo_textdisplay. Custom font sizes, colours, etc. Defaultui seems to be lacking in that area, columns has track info mod as well as 'Item Details'

edit: would it be possible to sort the discography? Would be nice to have the releases displaying in date-descending order.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-25 09:30:35
dates are now sorted in reverse order.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-05-25 13:25:38
How do i determine when resizing is done?
Hello again. I hope i'm not too much of a PITA 
As there is no on_size_done() callback in WSH panel mod, I'm trying to write a function that will do it. I'd like to be able to call some methods for recalculating the layout of my panel, then repainting it after it has been resized rather than while it's being resized. I guess on_size is called many times while the user is resizing a panel, thus this note in callbacks.txt :
Code: [Select]
// NOTE: DO NOT Call window.Repaint() and such to repaint window in this function

As i don't have access to WScript object, i can't use WScript.sleep and i need some delay at some point to allow size to "stabilize" before calling "on_size_done", so i wrote this function :
Code: [Select]
function is_resizing(_callback,_timerId) {
       _timerId = true;
       __w1 = window.Width; __h1 = window.Height;
      
       function check_resizing() {
           __w2 = window.Width; __h2 = window.Height;
           if (__h2 == __h1 && __w2 == __w1) {
               _callback();
           } else {
               window.SetTimeout(is_resizing, 100);
           }
       }
       window.SetTimeout(check_resizing, 300);
   }

It's called using this statement in on_size function
Code: [Select]
function on_size() { // on_size will also run once when the script first starts.
       if (!($system.is_resizing) && ($system.panelW != window.Width || $system.panelH != window.Height))
           is_resizing(on_size_done,$system.is_resizing);
   }

And it will call on_size_done that resets $system.is_resizing back to false (and does other useful tasks).
However, some console output i added to on_size_done shows me that it will run many times, making it no better than using on_size directly. I guess i made some coding error here but really, i need better glasses to be able to see it (or a better brain) 

BTW, my first approach was to make a single function check this and call it repeatedly with window.SetInterval() but the script will crash when i try to stop it using window.ClearInterval().

If someone can help me debug my function, or give me another way of doing this, i would be grateful.
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-05-25 17:00:49
Forget previous post
I can't edit it unfortunately 
I got the function working. I had to pass the functions as anonymous functions using an ugly construct rather than simply refer them by their variable. I still didn't fully understand the logic behind passing functions as arguments to other functions.
Here are the corrected functions in case anyone wants to use them.

How to build on_size_done() function


Current WSH panel mod includes on_size callback that's called each time the panel is resized. Unfortunately, "each time the panel is resized" means while resizing as well. Just test it using fb.trace("resize") in on_size function, resize the panel or the window for a couple seconds and then look at your console 

This means that to avoid wasting CPU cycles, it's best not to use ressource hungry methods like window.redraw() in on_size. However there are times when you want your panel to adapt to changes in size, and thus redraw after resizing. An on_size_done callback that would only trigger when resizing is actually finished is what we need, but there is no such callback. Here is how to build it.

In on_size, include the following statement :
Code: [Select]
function on_size() {
      if (!($system.is_resizing)) {
         $system.is_resizing = true
         is_resizing(function() {on_size_done();});
      }
  }

Define an is_resizing function :
Code: [Select]
function is_resizing(_callback) {
      __w1 = window.Width; __h1 = window.Height;
      
      function check_resizing(_callback) {
          __w2 = window.Width; __h2 = window.Height;
          if (__h2 == __h1 && __w2 == __w1) {
              _callback();
          } else {
              window.SetTimeout(function () {is_resizing(_callback);}, 100);
          }
      }
      window.SetTimeout(function () {check_resizing(_callback);}, 300);
  }

Finally, define an on_size_done function
Code: [Select]
function on_size_done() {
      $system.is_resizing = false;
      $system.panelW = window.Width; $system.panelH = window.Height;
      ...

You can add any statements you want in this function, including window.redraw(). This function will only be called when size is stable for 300 ms, which unless you are particularily slow means you have finished resizing your panel/window.
You can use different names. Especially $system.is_resizing in this example is a property of custom object $system that in my script holds every data needed for the script to run. Just be sure to define the variable you use to check if you already called is_resizing outside any function.
Title: WSH Panel Mod script discussion/help
Post by: Mr.Duck on 2012-05-27 00:00:12
Can I contribute a script?

(http://i.imgur.com/Eh00g.png)

Not very impressive I understand, but I'm pleased with how it looks. Mouse over and scroll wheel to change the volume with a digital readout. Double click on it and it goes to full volume. The font you need is called Letters Laughing (at their Execution) (http://www.fontspace.com/glyphobet-font-foundry/letters-laughing).

Code: [Select]
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var IDC_HAND = 32649;
function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}


//-------------------------------- START
function on_paint(gr) {
    gr.SetTextRenderingHint(5);
    var ww = window.Width;
    var wh = window.Height;
    var text = Math.round(fb.Volume) + " dB  ";
    gr.FillSolidRect(0, 0, ww, wh, RGB(23,22,20));
    gr.GdiDrawText(text, gdi.Font("Letters Laughing", 18, 0), RGB(255,0,0), 0, 0, ww, wh, DT_RIGHT | DT_VCENTER | DT_SINGLELINE);
}
function on_volume_change(val) {
    window.Repaint();
    if (val < -60) fb.Volume = -60;
}
function on_mouse_lbtn_dblclk(x, y) {
    fb.Volume = 0;
}
function on_mouse_wheel(delta) {
    if (delta > 0) fb.VolumeUp();
    else fb.VolumeDown();
}
function on_mouse_move() {
    window.SetCursor(IDC_HAND);
}
//-------------------------------- END
Title: WSH Panel Mod script discussion/help
Post by: Capricorn on 2012-05-27 13:56:13
dates are now sorted in reverse order.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)


hi marc,

i tried to use your "last.fm-Similar artists" and i'm receiving this on the console:

"Error: WSH Panel Mod (Last.fm by marc2003): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Ln: 73, Col: 4
<source text only available at compile time>
WSH Panel Mod: Warning: Obsolete: Please use AppendTo() method to create sub menu instead of AppendMenuItem()
"

any ideas?
thanks a lot
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-27 14:30:36
WSH Playlist Viewer v2.0 (final)
* Scripts available at http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)


Your WSH Playlist Viewer with WSH VU-meter by DRON

http://www.youtube.com/watch?v=mJNP5QH07uI...eature=youtu.be (http://www.youtube.com/watch?v=mJNP5QH07uI&feature=youtu.be)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-27 16:12:38
a WSH VU-meter!? where can we find it ?
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-27 16:53:27
a WSH VU-meter!? where can we find it ?


http://foobar2000.org.ru/forum/viewtopic.p...;p=40213#p40213 (http://foobar2000.org.ru/forum/viewtopic.php?f=2&t=4061&p=40213#p40213)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-27 17:14:17
a WSH VU-meter!? where can we find it ?


http://foobar2000.org.ru/forum/viewtopic.p...;p=40213#p40213 (http://foobar2000.org.ru/forum/viewtopic.php?f=2&t=4061&p=40213#p40213)


thanks, first try, it crashes foobar2000 (twice) but was when adjusting the script found at the adress above, i'd to complete the missing parts, but now it seems to work, great improvment from DRON, now easy to personalize it

EDIT: now, going to code a "good looking" VU Meter WSH panel based on this, and theme compliant to fit perfectly any VS
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-27 17:48:20
a WSH VU-meter!? where can we find it ?


http://foobar2000.org.ru/forum/viewtopic.p...;p=40213#p40213 (http://foobar2000.org.ru/forum/viewtopic.php?f=2&t=4061&p=40213#p40213)


thanks, first try, it crashes foobar2000 (twice) but was when adjusting the script found at the adress above, i'd to complete the missing parts, but now it seems to work, great improvment from DRON, now easy to personalize it

EDIT: now, going to code a "good looking" VU Meter WSH panel based on this, and theme compliant to fit perfectly any VS


Yes, it deserves to be based on it to make a really beautiful thing. DRON is very knowledgeable and creative thinking programmer. I get the product from its great fun.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-27 19:27:50
WSH VU Meter : my first preview ... i think i'm on the good way

http://youtu.be/p4xVT21MtEg (http://youtu.be/p4xVT21MtEg)
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-27 21:55:52
WSH VU Meter : my first preview ... i think i'm on the good way

http://youtu.be/p4xVT21MtEg (http://youtu.be/p4xVT21MtEg)

Do you want to just first make an analog VU-meter (you're absolutely right are using L,R) ? This task is more complicated than the peak-meter in WSH (with LM & RM)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-27 22:09:44
@onv

yep, harder, but it's what i want to code first
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-27 22:20:21
@onv

yep, harder, but it's what i want to code first

The right decision, respect. But in this case it is desirable in my opinion to combine analog arrow with peak LED
P.S. It might be better to discuss it in the appropriate thread ? What do you think about this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-28 09:27:10
any ideas?


are you using the latest WSH panel mod component? 1.5.3.1 i think...
if you've used previous versions of my scripts, did you extract the marc2003 folder from the latest zip over-writing all the old files?

Title: WSH Panel Mod script discussion/help
Post by: Capricorn on 2012-05-28 15:30:01
any ideas?


are you using the latest WSH panel mod component? 1.5.3.1 i think...
if you've used previous versions of my scripts, did you extract the marc2003 folder from the latest zip over-writing all the old files?


I did, actually i re-installed  the whole shebang;  win 7 64bit, all my software, new 1T hard drive... after my old one crashed, so it is all from scratch...
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-05-28 15:41:44
I get a message that art.exe lacks a guilty digital signature, why is that? What changes has been made?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-28 15:56:07
I did, actually i re-installed the whole shebang; win 7 64bit, all my software, new 1T hard drive... after my old one crashed, so it is all from scratch...


that's odd then. i use windows 7 64bit myself and i can't make any sense of the error you posted because there's nothing on that line that would cause that.   

@sylla, art.exe hasn't changed in over 2 years and no one else has reported that problem.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-28 19:22:37
WSH VU Meter v1.0.0 jscript, to use with the last version of the component foo_vis_vumeter 2012-05-27 (ActiveX Object)

(http://i.imgur.com/007sN.png)

script available here: http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

images available here: http://br3tt.free.fr/files/R/images.zip (http://br3tt.free.fr/files/R/images.zip)
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-05-28 20:01:40
Falstaff,
does the WSH VU Meter script work with Mono (1 channel) audio as well as 2 channel (stereo)?
I am thinking of replacing the peakmeter from "foo_uie_vis_peakmeter_spectrum", but before I do I would like to know if your script can render mono audio too.
I like to collect as 1-channel Mono any albums which were originally produced as Mono, therefore I need the meter visualization to accept input from three channels:
Left-Front AND Right-Front AND Centre.
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-28 20:05:45
WSH VU Meter v1.0.0 jscript


Congratulations, good job. The speed of your programming is comparable with a machine gun
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-28 21:17:41
Falstaff,
does the WSH VU Meter script work with Mono (1 channel) audio as well as 2 channel (stereo)?
I am thinking of replacing the peakmeter from "foo_uie_vis_peakmeter_spectrum", but before I do I would like to know if your script can render mono audio too.
I like to collect as 1-channel Mono any albums which were originally produced as Mono, therefore I need the meter visualization to accept input from three channels:
Left-Front AND Right-Front AND Centre.


afaik, VU Meter component only provide Left, Right or Mixed to Mono Channels. My Scirpt use the ActiveX Object provided by the VU Meter component, it can display two VU meter for Left and Right Channels, or just one VU Meter, in this case, i calc the average value for level >> (Left level +Right level)/2 and for the Peak >> (Left Peak+Right Peak)/2. For mono tracks, Left and Right channels (level and Peak) provided by the component are the same.

HTH


WSH VU Meter v1.0.0 jscript


Congratulations, good job. The speed of your programming is comparable with a machine gun


thank you, it's just a first try, many things to adjust, and better skins to do now
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-28 21:47:04
In the non-WSH version of Dron, you can easily switch between different skins on the fly by left- and right flips. Put 10 different skins - and choose the one that is now more like 
It would be useful to implement such a possibility in WSH - version
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-28 21:56:29
to use with the last version of the component foo_vis_vumeter 2012-05-27]

Last - 2012-05-28
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-05-29 06:22:26
Falstaff

I use your CoverFlow View v1.4 script in CoverFlow tab panel. 
(http://i.imgur.com/00157.png)

Now I download new version  of this script - 1.4.2.
I replace text of script in wsh panel and that is what I see:
(http://i.imgur.com/l89VL.png)

I could not change size of CoverFlow tab panel and I return in previous state only by deleting Coverflow tab and creating it again.

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-29 07:09:42
@pIv

sorry, my bad... v1.4.3 uploaded that fix this issue.

http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2012-05-29 07:39:30
@pIv

sorry, my bad... v1.4.3 uploaded that fix this issue.

http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)


Thank you very much for the quick correction of this bug.
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-29 10:08:50
@Falstaff

In WSH VU Meter does not work Keep Aspect Ratio in CUI. You need to add transparency fields (wh -hVU)/2 to top and bottom or (ww-wVU)/2 to left and right in mono ( (ww-2wVU)/2 in stereo)
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-05-29 10:29:38
to use with the last version of the component foo_vis_vumeter 2012-05-27]

Last - 2012-05-28

The site for foo_vis_vumeter is still on 2012-05-12
The last version i could find on foobar2000.ru is from 2012-05-23.
U got a better link for us onv? Thanks
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-29 10:33:49
to use with the last version of the component foo_vis_vumeter 2012-05-27]

Last - 2012-05-28

The site for foo_vis_vumeter is still on 2012-05-12
The last version i could find on foobar2000.ru is from 2012-05-23.
U got a better link for us onv? Thanks

http://foobar2000.org.ru/forum/viewtopic.p...1&start=135 (http://foobar2000.org.ru/forum/viewtopic.php?f=2&t=4061&start=135) --> http://rghost.ru/38330606 (http://rghost.ru/38330606)
Title: WSH Panel Mod script discussion/help
Post by: kareha on 2012-05-29 11:38:15
to use with the last version of the component foo_vis_vumeter 2012-05-27]

Last - 2012-05-28


Could I get a link to the latest version of the VU Meter component, I can only find the one dated 2012-05-12.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-05-29 18:06:12
so its possible to use wsh panel as host for another panels?
Falstaff can you write how to use it for other panels?

as i understand, i need to write something like this:
Code: [Select]
Panel = new ActiveXObject("esplaylist");
Panel.RegisterWindow(window.ID);
PWindow = Panel.CreateWindow(window.ID);

PWindow.SetBounds(50,50,200,200);
PWindow.Visible=true;
PWindow.Enabled=false;


but it crashes
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-05-29 18:09:01
new script: musicbrainz releases


Marc, your scripts are like little christmas presents all year long! =)

One request - any chance to get the MusicBrainz release sorted chronologically?

thanks for your hard work!

.Mike
Title: WSH Panel Mod script discussion/help
Post by: q-stankovic on 2012-05-29 18:25:13
@mjm716

http://www.hydrogenaudio.org/forums/index....st&p=796454 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=796454)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-29 18:52:25
so its possible to use wsh panel as host for another panels?
Falstaff can you write how to use it for other panels?


1. afaik not, should be a feature to implement in the WSH Panel Mod component, ask to T.P Wang if something is possible...
2. i've nothing to explain, what you talk about is the use of an activeX object provided by a component : VU Meter... it's not a common feature for any component !
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-05-29 19:13:52
@mjm716

http://www.hydrogenaudio.org/forums/index....st&p=796454 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=796454)


Ho Ho Ho! Merry Christmas!
Title: WSH Panel Mod script discussion/help
Post by: bulletproof2k on 2012-05-29 20:09:22
Hi all Army FB2K !!!
I need Default Volume Bar script such as this: (http://img-fotki.yandex.ru/get/6110/52957509.f5/0_7e67c_d0e45717_M.jpg)
Please help, Thx.

P.S.Sorry for bad English :]
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-05-29 20:20:30
Falstaffits sad, but possible make same trick with other visualisation - channel spectrum panel?
T.P Wang i think i could make some interesting things, if there will be function or method to get name of main or context item - like "properties" or "open containing folder" in context. this items are known, but some plugins make dynamic items name, or related to settings of plugin. anyone agree with my point?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-30 09:21:49
One request - any chance to get the MusicBrainz release sorted chronologically?


on line 102, use 2 slashes to comment it out....

Code: [Select]
//temp_arr.reverse();


now it should be in ascending order.

EDIT: i missed this post.

Ho Ho Ho! Merry Christmas!


if you're happy with descending order then of course you don't have to change anything.
Title: WSH Panel Mod script discussion/help
Post by: Mr.Duck on 2012-05-30 14:24:12
What does "gr.SetTextRenderingHint" do?
Title: WSH Panel Mod script discussion/help
Post by: prateek88 on 2012-05-30 17:43:14
@marc

I downloaded the samples new but they aren't working with latest wsh panel mod, may be i am missing something. Requesting for the updated script if possible.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-05-30 18:13:35
What does "gr.SetTextRenderingHint" do?


it affects the way text is displayed with DrawString() api (smoothness, ... etc), check the doc (interface.txt) bundled with the component
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-05-30 20:03:28
Screensaver "Flying VU",  the next update from DRON

http://www.youtube.com/watch?v=ZcnQBA1DrfU...eature=youtu.be (http://www.youtube.com/watch?v=ZcnQBA1DrfU&feature=youtu.be)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-05-31 09:26:30
@marc

I downloaded the samples new but they aren't working with latest wsh panel mod, may be i am missing something. Requesting for the updated script if possible.


i always use the latest version of WSH panel mod so it's not that.

perhaps being more descriptive with your problem might help.  if you get "aw crashed" in the panel, then make sure you post the full message from the foobar console found on the view menu. if the panel appears to load ok but crashes if you do something, then post the steps to re-produce.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2012-05-31 11:51:28
 

You may grab it here:

WSH digital Vu meter

http://pastebin.com/H26MujCP (http://pastebin.com/H26MujCP)
Title: WSH Panel Mod script discussion/help
Post by: Mr.Duck on 2012-05-31 20:52:31
it affects the way text is displayed with DrawString() api (smoothness, ... etc), check the doc (interface.txt) bundled with the component

D'oh. The one place I didn't look. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Mr.Duck on 2012-06-01 02:11:53
Can "gr.SetTextRenderingHint(5);" be set globally at the beginning of the script instead of in "function on_paint(gr)" ?

Is there anything wrong with doing that?
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-06-01 02:58:40
Can "gr.SetTextRenderingHint(5);" be set globally at the beginning of the script instead of in "function on_paint(gr)" ?

Is there anything wrong with doing that?


No it can't (and therefore what's wrong with it is that it won't work unfortunately).

The reason it won't work is that you need access to the gr object in order to call the function gr.SetTextRenderingHint(...). This access is granted by gr being provided to the on_paint function as a parameter.

You could, however, set a global variable to the value you want and then refer to this in the on_paint function, but I'm not sure if that will be of any use to you.
Title: WSH Panel Mod script discussion/help
Post by: Brett289 on 2012-06-01 12:43:11
First off, if this request is in the wrong place please forgive my ignorance.
Might be best to quickly read an old post of mine dated Jan 21 2012, 13:44 to best describe my issue.
http://www.hydrogenaudio.org/forums/index....st&p=783162 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=92416&view=findpost&p=783162)

Can anyone help? Please?

Thanks in advance.

Brett.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-06-01 14:00:46
i can't be bothered to make something nice

Code: [Select]
var ww = 0;
var wh = 0;

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

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, fb.StopAfterCurrent ? RGB(255,0,0) : RGB(0,255,0));
}

function on_playlist_stop_after_current_changed() {
window.Repaint();
}

function on_mouse_lbtn_up() {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
}

green panel: stop after current disabled
red panel: stop after current enabled
click the panel to toggle the state and it will also update if you use the playback menu.
Title: WSH Panel Mod script discussion/help
Post by: Manchesterer on 2012-06-01 14:02:37
I made a small piece of code, use it as WSH panel on its own or place it into your other script. Clicking on the panel will toggle SACT mode and inform you what is going on.

Code: [Select]
var font_1 = gdi.Font("Tahoma",10,1);
var color_1 = RGB(235,235,235);
var DT_LEFT = 0x00000000;

function on_paint(gr){
    var ww,wh;
    ww = window.Width;
    wh = window.Height;
    gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
    
    if(fb.IsPlaying){
        text = (fb.IsPlaying && fb.StopAfterCurrent) ? "SACT" : "NO SACT";
        gr.GdiDrawText(text, font_1, color_1, 0, 0, 60, 10, DT_LEFT);
    }
}

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

function on_mouse_lbtn_down(x, y, mask){
    if(!fb.IsPlaying) return;
    fb.RunMainMenuCommand("Playback/Stop After Current");
}

function on_playlist_stop_after_current_changed(state){
        window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-06-01 19:04:02
@Brett (from Brett)

my contrib extracted from by fooRazor config as a stand alone panel, here is a more elaborated button than combine playback order button with Stop After Current button,

just copy/paste this script in a WSH panel, grab it here:

http://pastebin.com/gv0sWFq5 (http://pastebin.com/gv0sWFq5)

(http://img829.imageshack.us/img829/481/pbo2.png)
Title: WSH Panel Mod script discussion/help
Post by: Mr.Duck on 2012-06-01 22:47:13
The reason it won't work is that you need access to the gr object in order to call the function gr.SetTextRenderingHint(...). This access is granted by gr being provided to the on_paint function as a parameter.

I see.... So I can't put "SetTextRenderingHint(5);" instead to make it a global setting either I take it?
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-06-01 23:17:14
I see.... So I can't put "SetTextRenderingHint(5);" instead to make it a global setting either I take it?

Nope, that function would fail because it doesn't exist. What are you trying to avoid by not calling gr.SetTextRenderingHint inside on_paint?
Title: WSH Panel Mod script discussion/help
Post by: Mr.Duck on 2012-06-01 23:52:53
Nope, that function would fail because it doesn't exist. What are you trying to avoid by not calling gr.SetTextRenderingHint inside on_paint?

Nothing. Just learning.
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2012-06-01 23:54:07
Hi!

Is there a way, in a WSH panel, to get information (%title%, %album%...) about  the song to be played next in the playing playlist (assuming the playback order is default, of course) ?

I'm trying to write a panel for a "Stop after Album" button but for now all I can do is to compare the track number of the playing track with the %totaltracks% defined for the track that was playing when I triggered the button (sorry if I'm not clear)

Most of the time it works but sometimes no: if there is no %totaltracks% defined or if, in my playlist, the last song from one certain album to be played (before playing another track from another album) is not the actual last track of this album (for with %tracknumber% ==  %totaltracks%)

Thanks in advance
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-06-02 03:22:05
I've got two themes, one of which I'd like to disable the toolbar in.

I added fb.RunMainMenuCommand("View/Show Toolbars") to my on_init which works great, but there's no way to determine whether the toolbars were toggled on or off. It always just returns true. I'm assuming the answer is no, but is there any way to get the check state of the menu command first?
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-06-02 15:14:27
I have a row of buttons in a WSH panel.

One of the buttons is for opening the containing folder, and this is the line in the script:
Code: [Select]
but8: new Button((bw*7) + left_margin,top_margin,bw,bh, {normal: images_path + "open-folder.png", hover: images_path + "open-folder_h.png"}, function(){fb.RunContextCommand("Open containing folder");}, "Show the NOW PLAYING item's containing folder")


My problem is the above button ONLY works with the now-playing item in the playlist, but I also want a button which will work with my selection(s).

That is, if I select item(s) in the playlist I would like to click a button which will open the containing folder of the selected items AND NOT the playing item.

Does anybody know the right code for this 'other' containing folder action? thanks.
Title: WSH Panel Mod script discussion/help
Post by: bulletproof2k on 2012-06-02 20:32:35
Why is my requezt ignored, so you express your attitude to the Russian people?


Post #1611?

#1686
Title: WSH Panel Mod script discussion/help
Post by: Mod-Ular on 2012-06-02 21:46:11
@bulletproof2k
Post #1686 was your question. Post #1611 is your answer, read it to find what you are looking for.
Title: WSH Panel Mod script discussion/help
Post by: bulletproof2k on 2012-06-02 22:21:48
Why is my requezt ignored, so you express your attitude to the Russian people?


Post #1611?

Thanks for the answers, but I need just such as Screen Shot #1686
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2012-06-03 10:52:23
WSH digital VU meter updated!

video preview here (http://youtu.be/drsrpdOZYas)

script here (http://pastebin.com/H26MujCP)
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-03 16:08:21
WSH_Browser : first alpha

Hello. This time i'm not here for another stupid noob question  . I have finally been able to get my WSH_browser to a working state.
This is a "graphical" (well, not really for now but it will become) library browser component for WSH panel mod.
) is the most efficient way to browse the library. It works but there might be something more elegent (such as working with an autoplaylist, but then i would have to get metadbhandles several times later).
@Fallstaff i would be really happy to know what you think of my approach as you have experience with sorting lots of tracks in WSH. I had a look at your CoverFlow but didn't really understood how you are storing the handles in groups. I was unable to store handles directly in an array so i had to create several IFbMetadbHandleList objects.

Here is the script on pastebin (http://pastebin.com/phpjnkfu)
You will also need two additional files : Constructors.js (http://pastebin.com/jjxxDkf4) and Helpers.js (http://pastebin.com/XWvYSnAB)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-06-03 18:21:16
@r0k

good to see such project!

but ... first try, it doesn't work ==> foobar2000 not responding (for 5 minutes now....), my libray is big (~40k trks), i suspect your script is not for large library, but what's its maximum size to make it work?

before checking a script, i'd like to see it running well, if not, i'm not interrested ... other stuff is waiting, so i'll wait a next version of your script maybe with some restrcitions info in comments to indicate in which way somebody can test it

EDIT: hmm, works better on another try, lag just the time to populate the WSH playlist... i'll check your script asap. Careful, mousewheel make content disapear...
Title: WSH Panel Mod script discussion/help
Post by: Brett289 on 2012-06-03 19:08:01
I made a small piece of code, use it as WSH panel on its own or place it into your other script. Clicking on the panel will toggle SACT mode and inform you what is going on.

Code: [Select]
var font_1 = gdi.Font("Tahoma",10,1);
var color_1 = RGB(235,235,235);
var DT_LEFT = 0x00000000;

function on_paint(gr){
    var ww,wh;
    ww = window.Width;
    wh = window.Height;
    gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
    
    if(fb.IsPlaying){
        text = (fb.IsPlaying && fb.StopAfterCurrent) ? "SACT" : "NO SACT";
        gr.GdiDrawText(text, font_1, color_1, 0, 0, 60, 10, DT_LEFT);
    }
}

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

function on_mouse_lbtn_down(x, y, mask){
    if(!fb.IsPlaying) return;
    fb.RunMainMenuCommand("Playback/Stop After Current");
}

function on_playlist_stop_after_current_changed(state){
        window.Repaint();
}



Wow! Thanks for the speedy replies! Unfortunately for me, I have no scripting knowledge and do not fully comprehend the WSH Panel Mod.
I have a specific UI Layout and settings that never change on my player. I need to keep this layout and settings while adding the described option in this old post of mine...
** My only issue with foobar2000 is that I don't have visual notification when I have activated a "Stop After Current" command.

In my use, I have playback follows cursor. It would be great to have the highlighted cursor able to change color to red when stop after current is selected. **


If someone out there is willing to create a script for me, and walk me through the setup, I would be more than happy to make a donation for their services to their PayPal account. Please send a PM if interested.
Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Mr.Duck on 2012-06-04 02:54:02
Has anyone written a media library browser such as an expandable tree view in wsh panel mod?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2012-06-04 09:05:11
Not possible, because we cant get media library MetadbHandleList to WSH panel mod.

I hope this feature is added in the future.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-06-04 09:33:32
Not possible, because we cant get media library MetadbHandleList to WSH panel mod.

you can't say that. It's possible through another way based on a playlist that contains the library, but for sure this method is not perfect because this playlist has to be populated before being available for the script.

I hope this feature is added in the future.

yep, let's hope it's possible for T.P Wang

as we have:

    // Get all items into an instance of IFbMetadbHandleList from specified playlist
    IFbMetadbHandleList GetPlaylistItems(playlistIndex);

we'd like to have too something like this:

    // Get all items into of IFbMetadbHandleList from Media Library
    IFbMetadbHandleList GetMediaLibraryItems();

Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-04 10:53:51
@r0k

good to see such project!

but  ... first try, it doesn't work ==> foobar2000 not responding (for 5  minutes now....), my libray is big (~40k trks), i suspect your script is  not for large library, but what's its maximum size to make it work?

Not sure what the maximum size is. My library is about 4500 tracks so much smaller than yours and this script has only been tested on my computer so far. Well, that's a feedback on it's own so i know i need to improve the way i gather handles.
Quote
before  checking a script, i'd like to see it running well, if not, i'm not  interrested ... other stuff is waiting, so i'll wait a next version of  your script maybe with some restrcitions info in comments to indicate in  which way somebody can test it

EDIT: hmm, works better on  another try, lag just the time to populate the WSH playlist... i'll  check your script asap. Careful, mousewheel make content disapear...

I understand. I'll be improving it anyway. As stated i consider it an alpha, not even a beta, but i posted it anyway because a single experienced hint might improve the script more than one week of my noob work
In the current script, i have a check to prevent mousewheel from scrolling before line 1 but nothing to prevent it from scrolling past last line (this one has to be calculated first). Scrolling up should bring content back if you go too far. This will be added by the time i release the first "beta".
Not possible, because we cant get media library MetadbHandleList to WSH panel mod.

you can't say that. It's possible through another way based on a playlist that contains the library, but for sure this method is not perfect because this playlist has to be populated before being available for the script.

That's exactly the workaroud i used to gather the MetadbHandleList in my browser above. Actually, here is what i did (so you don't have to look at my code).

I have defined a MetaDB custom object constructor. In my script i create such an object. It has the following properties :

The following methods are available :
I'm quite sure i can improve this, and of course it would be nice to skip the playlist step altogether (a probable cause of some delay with big libraries).

My browser could probably be modified to show a tree view. I might add it later, but it's currently an early alpha and i won't add features until it's working smoothly on bigger libraries and the current features and interface are polished enough.
Title: WSH Panel Mod script discussion/help
Post by: bulletproof2k on 2012-06-04 16:20:37
WSH_Browser : first alpha!!!
http://www.flickr.com/photos/bulletproof2k/ (http://www.flickr.com/photos/bulletproof2k/) My genres for iTunes and foobar2000
Title: WSH Panel Mod script discussion/help
Post by: Fabio258 on 2012-06-04 19:16:49
WSH_Browser : first alpha


In my system (core2duo E7400 2GB ram winxp) and with my 57000 tracks library, it works from the first run. There is a lag of about 5 seconds switching from alphabetic and genre view, like that switching in ColumnsUI filters; only facets in DUI is faster. I like your project because i need a simple interface to easily control with a 7" touchscreen monitor, but i'm not a programmer and my last one

) is very slow and not much user-friendly...
I can't help you in programming, but if you need a beta-tester with a large library... I'm here 
Good work 
Fabio
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-07 09:46:58
Thanks for the encouragement and feedback.
Actually, i didn't even think about touchscreens but i can see how a simple visual interface can be useful for those. I'll try to keep them in mind for further developpment.
"Beta test" will be open, so you are free to participate 

Well, speaking of my script, i'm running into a bad hang currently. I'm trying to get the path that's common to all items in a group, in order to search this path for artwok to show (artist picture, album cover ...) and avoid the need to keep a copy of every artwork inside the artwok folder where non-path related artwork (eg genres will be kept). However my code is making foobar2000 hang idefinitely (like i'm running an endless loop  )

I've narrowed the hang to this part of the code :
Code: [Select]
        // Search for a common path to all items in the group.
            __path = __hnd.Path;
            if (this.groups[__groupName].path) { // if true there is already a path stored, find common path
                __path = __path.split("\\"); // Split into an array of folder names.
                __pathOld = this.groups[__groupName].path.split("\\");
                for (var i = (__path.length-1); i>=0; i--) { // Check every item, starting by the end
                    if (i >= __pathOld.length) { // if current path is longer than stored path
                        void __path.pop(); // remove last item from current path
                        continue; // begin next iteration
                    } else if (__path[i] == __pathOld[i]) { // compare last item of stored and current path
                        this.groups[__groupName].path = __pathOld.join("\\");
                        break; // break the loop and keep the path as it is now
                    } else {
                    void __path.pop(); // reduce the path one level towards the root
                    void __pathOld.pop();
                    }
                }
            } else this.groups[__groupName].path = __path; // store path of the first track

And more precisely, the for loop part. It shouldn't loop forever, i'm decresing i at each loop and the condition is i>=0.
Can someone tell me what noobish mistake i made?
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-06-07 13:19:12
Can someone tell me what noobish mistake i made?

From a quick glance I can't see an obvious problem, however you could try using a reverse while-loop instead (as you're already decrementing). Something like:

Code: [Select]
var i = __path.length - 1;
while (i--) {
   // (The stuff that was in the for loop goes here)
}

Replacing the loop should prove whether or not the problem is the loop (and a reverse while may be more efficient anyway).
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-06-07 14:44:55
adding fb.trace("i = "+i) in the loop may help you to find what's wrong with your loop ...
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-07 15:05:50
re: while loop
I try to stay away from while loops as they seem more prone to endless loop (they are easier to code badly  ) but i see the logic behind your example. I wouldn't have thought of grouping the condition and the increment/decrement. Thanks.

@Falstaff
I already have some console output, thought not at this place. But i can't look at the console as fb2k itself will hang, not just the panel 
EDIT : never mind, just found the "write log" checkbox in the console.
EDIT 2 : nay, even with  "write log" checked, i don't get any console output at all when hangs occur. Not even output from statements that are executed before the loop goes crazy  (actually : write log is not kept when fb2k restarts.

I tried to compare strings directly with what looks like simpler code, but i still have an endless hang. Got it working!

FINAL EDIT
OK, i got it working, but can someone explain me why :
Code: [Select]
        var i=0;
        do {
            if (__path.charAt(i) != __pathOld.charAt(i)) break; // path no longer common, break the loop
        } while(i++ < __pathLen);
        __path = __path.substr(0,i); // keep only the common part
        __path = __path.substr(0,__path.lastIndexOf("\\")); // don't consider path after the last backslash
        ...
Does not work, but
Code: [Select]
        var __totoIsBack=0;
        do {
            if (__path.charAt(__totoIsBack) != __pathOld.charAt(__totoIsBack)) break; // path no longer common, break the loop
        } while(__totoIsBack++ < __pathLen);
        __path = __path.substr(0,__totoIsBack); // keep only the common part
        __path = __path.substr(0,__path.lastIndexOf("\\")); // don't consider path after the last backslash
        ...

does
Title: WSH Panel Mod script discussion/help
Post by: jijoo on 2012-06-07 16:31:17
Hi!

Is there a way, in a WSH panel, to get information (%title%, %album%...) about  the song to be played next in the playing playlist (assuming the playback order is default, of course) ?

I've used the following function to add a stop-after-album feature. The important parts are plman.GetPlaylistItems(plman.PlayingPlaylist), which give you the playlist's tracks in order, and plman.GetPlayingItemLocation().PlaylistItemIndex, which gives the index of the current track.

Code: [Select]
function on_playback_new_track(current_track) {
    var next_track = current_track;
    // get next track
    if (plman.IsPlaybackQueueActive()) {
        // check first item in queue
        next_track = plman.GetPlaybackQueueContents().toArray()[0].Handle;
    } else {
        var i = plman.GetPlayingItemLocation().PlaylistItemIndex;
        var pl_items = plman.GetPlaylistItems(plman.PlayingPlaylist);
        if (i + 1 == pl_items.Count) {
            // current_track is the last item in playlist
        } else if (i > pl_items.Count) {
            // current_track is no longer in the playlist
            fb.StopAfterCurrent = true;
            return;
        } else {
            next_track = pl_items.Item(i+1);
        }
    }
   
    // ALBUM_TF is something like fb.TitleFormat(window.GetProperty("ALBUM TF", "%album artist% %album%"));
    if (ALBUM_TF.EvalWithMetadb(current_track) != ALBUM_TF.EvalWithMetadb(next_track)) {
        fb.StopAfterCurrent = true;
    } else {
        fb.StopAfterCurrent = false;
    }
}
Title: WSH Panel Mod script discussion/help
Post by: D.Sync on 2012-06-07 16:35:29
I am not really familiar with WSH coding but I was wondering whether someone could solve the delay problem in marc playcount script? The delay is when a track is submitted for loved/unloved.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-06-07 16:59:28
Got it working!


Glad to hear it 

Without seeing all of your code I can't tell for sure. Off the top of my head, the only explanation I can think of is that i is defined somewhere else (perhaps globally) and this is interfering with the loop. Beyond that...no idea...
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-07 17:37:11
... I was wondering whether someone could solve the delay problem in marc playcount script? ...

Well, delays tend to occur when the computer is busy doing something, so apart from removing some actions, i don't think it's possible.
Now, i don't find this particular script. Maybe he released a new version of his samples after i downloaded them.
Without seeing all of your code I can't tell for sure. Off the top of my head, the only explanation I can think of is that i is defined somewhere else (perhaps globally) and this is interfering with the loop. Beyond that...no idea...

Ha, i'm such a noob 
I don't use variables such as "i" globally of course, only for loops ...
But this loop was nested inside another loop ... using i as a counter of course.
I was actually resetting i in the middle of the outer loop, causing it to become endless. And i was trying to find why the inner loop was endless
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-06-07 17:58:55
Ha, i'm such a noob 
I don't use variables such as "i" globally of course, only for loops ...
But this loop was nested inside another loop ... using i as a counter of course.
I was actually resetting i in the middle of the outer loop, causing it to become endless. And i was trying to find why the inner loop was endless


Haha, I've been there before! 
It's sometimes more useful to use meaningful names for loop counters, just so when you get to the inner-loop you make sure you're using innerLoopIndex and not outerLoopIndex (although to be fair I only tend to do this when I'm coding something semi-serious, I should probably do it more often  ).

Glad you got it all figured out
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-08 09:09:19
I had the first (outer) loop coded several days ago, but only yesterday i decided to add statements to gather informations about my track groups. I totally forgot about the first loop.
What i should have done is code the comparator as an external function and take benefit of local variables.
Speaking of local variables, it's probably obvious for some people, but in case it's not, i made a test.
Code: [Select]
// ==PREPROCESSOR==                 -->    CONSOLE OUTPUT
// @name "test"                          
// ==/PREPROCESSOR==                     
                                        
var toto = "toto is Global";             
fb.trace("L6 "+toto);               -->    L6 toto is Global
                                        
function test() {                        
    var toto = "toto is Local";          
    fb.trace("L10 "+toto);          -->    L10 toto is Local
}                                        
                                        
function test2() {                       
    toto = "Heavy Metal never dies";     
    fb.trace("L15 "+toto);          -->    L15 Heavy Metal never dies
}                                        
                                        
test();                                  
fb.trace("L19 "+toto);              -->    L19 toto is Global
                                        
test2();                                 
fb.trace("L22 "+toto);              -->    L22 Heavy Metal never dies

If a local variable is defined inside a function using var statement, even if a global variable has the same name, the global will not be overwritten. However, if var is omitted, the global will be overwritten.
Furthemore, if a local variable is defined with var, then the variable is changed to another value, like in this second test
Code: [Select]
// ==PREPROCESSOR==                 -->    CONSOLE OUTPUT
// @name "test"                         
// ==/PREPROCESSOR==                    
                                        
var toto = "toto is Global";            
fb.trace("L6 "+toto);               -->    L6 toto is Global
                                        
function test() {                       
    var toto = "toto is Local";         
    fb.trace("L10 "+toto);          -->    L10 toto is Local
    toto = "Heavy Metal never dies";    
    fb.trace("L12 "+toto);          -->    L12 Heavy Metal never dies
}                                       
                                        
test();                                 
fb.trace("L16 "+toto);              -->    L16 toto is Global

The change will affect the local variable, and not the global one.
That's a good reason to get used to always use var
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2012-06-09 08:33:11
I've used the following function to add a stop-after-album feature. The important parts are plman.GetPlaylistItems(plman.PlayingPlaylist), which give you the playlist's tracks in order, and plman.GetPlayingItemLocation().PlaylistItemIndex, which gives the index of the current track.


That was exactly what  I was looking for. Thank you
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-06-10 18:26:41
Is there anyway to hide the mouse cursor using WSH Panel? I'd love to be able to add a timeout in on_mouse_move to hide it after a few seconds of inactivity in my HTPC script.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-06-10 20:44:48
Even if there is a way to do this, I'm not sure it's possible because I get continuous on_mouse_move events whether the mouse is moving or not. Is this the way it's supposed to be, because it seems like a bug. I verified that it wasn't weirdness with my mouse by turning off my mouse and not touching the trackpad on my laptop.
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-11 08:49:30
I can confirm on_mouse_move seems to trigger continually as long as the mouse is in the WSH panel area.
One way to work around this would be to store prevMouseXand prevMouseY in some variable/object and make a conditional check in on_mouse_move
Code: [Select]
 if (prevMouseX != x || prevMouseY != Y)

to know whether the mouse is actually moving or not.
Here is some working code you can use if you can find a way to actually hide the cursor. I tried window.SetCursor(...); but there is no "hidden" option.
Code: [Select]
var prevMouseX = 0;
var prevMouseY = 0;
var mouseActive = true;

function hideCursor() {
    if (mouseActive) return;
    // Add some code to hide the mouse
}

function on_mouse_move(x, y) {
     if (prevMouseX != x || prevMouseY != y) {
         prevMouseX = x;
         prevMouseY = y;
         mouseActive = true;
         // Add some code to show the mouse
     } else {
         mouseActive = false;
         window.SetTimeout(function () {hideCursor();},1000);
     }
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-06-11 09:37:45
you can use a negative number to hide it.

Code: [Select]
window.SetCursor(-1);
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2012-06-11 17:32:32
Thanks for the tip marc2003  It's much simpler than i would have imagined.

Well, while i'm here i could as well ask something. Is there a simple way of preventing on_mouse_lbtn_up() from trigerring it's effect when you double-click. Currently, if i double click, it will trigger on_mouse_lbtn_up twice and on_mouse_lbtn_dblclk once. That's logical but not very practical.
I guess know i can call a delayed function in on_mouse_lbtn_up with a conditional check that would evaluate to false if on_mouse_lbtn_dblclk have been triggered but maybe there is something easier.
EDIT : Tested the delay, it works. Still willing to learn possible alternatives
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-06-11 17:56:07
Thanks for the suggestions r0k and marc. I've got it working perfectly now. Here's my final code if anyone is interested:
Code: [Select]
var state["mouse_x"] = 0;
var state["mouse_y"] = 0;
var hideCursor = 0;

function on_mouse_move(x, y) {
    if (x != state["mouse_x"] || y != state["mouse_y"]) {
        window.SetCursor(32512);    // arrow
        state["mouse_x"] = x;
        state["mouse_y"] = y;
        window.ClearTimeout(hideCursor);
        hideCursor = window.SetTimeout(function() {
            window.SetCursor(-1);    // hide cursor
            }, 5000);
    }
}

That's how I'd handle a on_mouse_lbtn_up if forced to differentiate. I can't think of any other way right now.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-06-12 07:37:03
after WSH VU meter appears im interested in other activex objects i can add to my wsh panel. i know about shell object, vbcontrol (but dont know how to use it), httpdocument, filesystem. and now its vumeter. is anybody knows any interesting object? as i remember, marc2003 posted somewhere script showing your soundcard name. can anybody writes something about it or show me where i can read abou that?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2012-06-12 08:46:33
Well, there is AutoitX3 (http://www.autoitscript.com/site/autoit/) and DynamicWrapperX (http://www.script-coding.com/dynwrapx_eng.html) ActiveX components.

With these to components only the sky is the limit. You can send messages, get system handles, create 'AERO' glass and so on.

Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-06-12 19:27:13
thanks, im also wanted for object to control file copy and transcoding audio by SOX otherwise shell. it will be nice if i get progress of each file.
now im using autoitx3 to control window size without standart windows borders, but in same way. and near aims - transcoding and file copy operations
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-06-15 15:33:46
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

musicbrainz releases: entries with no date now appear at end of list instead of the beginning
Title: WSH Panel Mod script discussion/help
Post by: Ryoma on 2012-06-17 03:43:34
I just tried some samples by pasting and replacing the content in my WSH Panel (coverflow) already pretty working but I get this:

||Scripting Engine Initialization Failed (Playback Buttons by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).||
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-06-17 11:15:27
thank you


Also big props Falstaff - your scripting has really made my layout appealing. But now the annoying request.

Is there any way to get the playlist to collapse the album views, so tracks could be displayed or not via click (e.g. on heading/arrow/icon to expand/contract) and bonus points if the now playing album automatically expands.

I'm essentially searching for something similar to ELplaylist that works in DUI.

For example, this direction is great: http://www.hydrogenaudio.org/forums/index....st&p=799256 (http://www.hydrogenaudio.org/forums/index.php?showtopic=63984&view=findpost&p=799256)

Artist overview (& album count) with chronologically listed albums, that then would expand to display track listings on click.

Dare to dream I know, but any tips towards this direction (in DUI) would be much appreciated.

thanks,

.Mike
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-06-17 12:54:14
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

musicbrainz releases: entries with no date now appear at end of list instead of the beginning

Nice it's always those little things!

I hope you don't mind, but I added buttons for discogs & allmusic to your 'web links' (if it suits you, feel free to redistribute in your ZIP)

button preview: http://desmond.imageshack.us/Himg195/scale...amp;res=landing (http://desmond.imageshack.us/Himg195/scaled.php?server=195&filename=buttonsqu.png&res=landing)

New discogs+allmusic buttons here: http://www.mediafire.com/?kaywlua6nrtritl (http://www.mediafire.com/?kaywlua6nrtritl)

also note, the MySpace link has been updated to function correctly

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common4.js"
// @import "%fb2k_profile_path%marc2003\tooltip_buttons.js"
// @name "Web Links"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var script_name = "Web Links";
var custom_background = window.GetProperty("custom_background", "");
var bg = window.GetProperty("bg", 102);
selection_mode = 1;

on_item_focus_change();

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

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

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if (!g_metadb) return;
var myspace = fb.TitleFormat("http://www.myspace.com/search/music?q=$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 discogs = fb.TitleFormat("http://www.discogs.com/search?q=$replace(%artist%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
var allmusic = fb.TitleFormat("http://allmusic.com/search/artist/$replace(%artist%, ,+,'(',,')',,/,+,&,and)").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 * 3), top_margin, bw, bh, {normal: images_path + "discogs.png", hover: images_path + "discogs_h.png"}, function() { WshShell.run(discogs); }, discogs),
but5: new Button(left_margin + (bw * 4), top_margin, bw, bh, {normal: images_path + "allmusic.png", hover: images_path + "allmusic_h.png"}, function() { WshShell.run(allmusic); }, allmusic)
}
window.Repaint();
}

function on_mouse_move(x, y) {
buttonsMove(x, y);
}

function on_mouse_lbtn_up(x, y) {
buttonsUp(x, y);
}

function on_mouse_leave() {
buttonsLeave();
}

function on_mouse_rbtn_up(x, y) {
background_menu(x, y);
return true;
}
Title: WSH Panel Mod script discussion/help
Post by: D.Sync on 2012-06-17 14:24:59
From one of the WSH script (from musickarte skin), the following error is displayed when I updated my WSH panel mod to the latest version 1.5.2.

Error:
Code: [Select]
JScript runtime error:
Object doesn't support this property or method


WSH error line:
Code: [Select]
var hWnd       = utils.GetHWND("{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8});


It seemed that the method utils.GetHWND no longer exist in the latest version. I have no knowledge about WSH scripting and thus would need help on this issue. This issue had kept me from updating my previous WSH version (1.4.9) to the latest version
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-06-17 17:05:33
@D.Sync

official WSH Panel Mod had never used this method. It belongs to a modified version of WSH Panel Mod stuck in v1.4.x, support seems totally discontinued... to forget.
Title: WSH Panel Mod script discussion/help
Post by: trout on 2012-06-18 15:10:37
I want to have a volume control that only shows when the mouse cursor is over it. I've searched for any mouse-over examples so I could modify T.P Wang's volbar code example (http://code.google.com/p/foo-wsh-panel-mod/source/browse/samples/Volbar.txt?r=2d1014c706400e7a5240539e8228c8502cd6392f), but haven't found anything. I know next to nothing about coding, and my attempts to find javascript documentation and learn how to do this on my own have not gone well. So I'm hoping someone can point me to an example I can work from, or show how it's done.

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-06-18 15:42:49
@mjm716, thanks for those images. i've bundled them in and cleaned up the script a bit.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

@Ryoma, you should read the error you posted.....

Quote
Check the console for more information


@trout, i don't have time now but if someone else doesn't answer before tomorrow, i might be able to knock something up for you.
Title: WSH Panel Mod script discussion/help
Post by: Ryoma on 2012-06-18 18:48:17
@Ryoma, you should read the error you posted.....


Don't mind.
My mistake.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-06-19 14:39:54
@ trout, http://pastebin.com/T50gNd9A (http://pastebin.com/T50gNd9A)
Title: WSH Panel Mod script discussion/help
Post by: trout on 2012-06-19 15:58:51

marc2003 - Thanks for your gracious help. Much appreciated!



Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-06-22 22:13:33
@Falstaff

http://www.youtube.com/watch?v=zq8IpyuZZxI&feature=plcp (http://www.youtube.com/watch?v=zq8IpyuZZxI&feature=plcp)

left button down + move, without scrollbar, for CarPC & other touchscreen's
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-06-23 10:54:07
Hi Falstaff,

Any chance you can give some help trying to get your WSH playlist script to support 1/2 ratings, similar to $repeat(★,$meta(rating))$if($strchr($meta(rating),.),☆)?

Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-07-09 11:40:57
I have a WSH script which reads and displays a textfile, here is the header description inside the script:
// Draws "<dir_containing_current_audio_file>\folder.txt" in a "WSH Panel Mod" panel,
// or if "folder.txt" is not present, will draw the first text file in that directory,
// or if no text file exists, will draw some default ASCII Art text.



I always use the following template to format the textfile (folder.txt) the same way:
Quote
Artist – Album (Date)

<PRODUCT>A line of text is inserted here</PRODUCT/>

<GENRE>A line of text is inserted here</GENRE/>

<OVERVIEW>Multiple lines of text are inserted here
giving informative comments and reviews on the work</OVERVIEW/>

<TRACKS>01. Trackname
02. Trackname
03. Trackname
etc
etc</TRACKS/>

<CREDITS>JOHN SURNAME — guitar
PAUL SURNAME — vocals
GEORGE SURNAME — bass
RINGO SURNAME — drums</CREDITS/>



My script is NEARLY perfect but for one last problem. . .
I want the script to replace the "special words enclosed in angle brackets" with nothing.
That is, I would like the panel to end up displaying like this in foobar2000:
Quote
Artist – Album (Date)

A line of text is inserted here

A line of text is inserted here

Multiple lines of text are inserted here
giving informative comments and reviews on the work

01. Trackname
02. Trackname
03. Trackname
etc
etc

JOHN SURNAME — vocals, guitar
PAUL SURNAME — vocals, bass
GEORGE SURNAME — guitar
RINGO SURNAME — drums


I am pretty sure the search-and-replace method needs to be inserted into the function on_paint(gr) section.
I'm not a javascript programmer and I need some help to realize this.
Some help from one of you javascript gurus would be highly appreciated.

P.S. -- I plan on sharing the script here with everyone once it is fully completed and tested.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-07-09 17:09:59
add this to your script (safe mode needs to be disabled) -

Code: [Select]
var doc = new ActiveXObject("htmlfile");

function decode(value) {
    try {
        doc.open();
        div = doc.createElement("div");
        div.innerHTML = value.replace(/\n/g, "<br>");
        return div.innerText;
    } catch(e) {
        return "Error reading content.";
    }
}


then assuming the variable mytext contains your text....

Code: [Select]
mytext = decode(mytext);


note: you don't need to add the first code section if you're importing common4.js from my scripts.




Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-07-09 20:09:18
Thanks for that reply marc, nice stuff to know. This script is not one of yours.

____________________________________________________________________________________

Anyhow, I just finished composing a reply to my Post #1754. . .so I might as well post it:

I solved it!. . .with a bit of luck and a bit of WWW Google searching with these two terms: (1) jscript replace text, (2) regex escape forward slash.

The relevant function in my script for performing this task is at on_playback_new_track() AND NOT on_paint(gr).

So, looking at an excerpt of the function, we see the code I needed to add (in red):
Quote
function on_playback_new_track(){
   
    g_need_vp_refresh = true;
    g_metadb = get_metadb();

    if (! g_metadb) window.Repaint();
   
    var new_dir = fb.TitleFormat("$directory_path(%path%)").EvalWithMetadb(g_metadb);
    if (g_dir == new_dir) return;

    var new_title = "";
    var new_text = "";
    var filename = new_dir + "\\folder.txt";
    var filename_contents = utils.ReadTextFile(filename);
   
    if (new_text == "") {
        var arr = utils.Glob(fb.TitleFormat("$directory_path(%path%)").EvalWithMetadb(g_metadb) + "\\*.txt").toArray();
        if (arr.length > 0) {
            filename = arr[0];
            try {
                these_strings = /<(PRODUCT|\/PRODUCT\/|GENRE|\/GENRE\/|OVERVIEW|\/OVERVIEW\/|TRACKS|\/TRACKS\/|CREDITS|\/CREDITS\/)>/g;
                new_text = filename_contents.replace(these_strings,"");
            } catch(e) {
                new_text = "";
            }
        }
        window.Repaint();
    }

    ...



When I'm finished with it all, I'll share this textfile viewer with everybody.

I have tested just about every textfile viewer script made for WSH Panel Mod
and this one here is UNBELIEVABLE. It is hands down the best I ever found (and modified:-).

Some of its features:
- Looks for your preferred text file name first, else looks for any text file, else displays contents of a default text file (ASCII Art ...see screenshots)
- Pop-out vertical scrollbar on mouse hover
- Up-Down page scroll with left mouse button drag anywhere on the window
- Up-Down page scroll with keyboard arrows/PgDn/PgUp
- Top-Bottom-Top-Bottom infinite chunk scroll with middle mouse clicks
- flat color or gradient color change views
- A thin header bar showing the name of the displayed text file.
- Right click menu: Open folder | Edit text file | Refresh | Configure

Screenshots of the WSH textfile viewer in my foobar2000...(Top shot is reading a text file, Bottom shot is reading "default.txt" aka no text file found):(http://img15.imageshack.us/img15/4923/wshtextfileviewer.th.jpg) (http://img15.imageshack.us/img15/4923/wshtextfileviewer.jpg)
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-07-09 20:31:59
@derty2:

You could simplify your regular expression somewhat based on the fact that the / is repeated:
Code: [Select]
these_strings = /<\/?(PRODUCT|GENRE|OVERVIEW|TRACKS|CREDITS)\/?>/g;
? means 0 or 1 occurrences of the character before it, in this case the /

However, it's possible that this might not work unless you group the escaping \ with the / using brackets, as follows:
Code: [Select]
these_strings = /<(\/)?(PRODUCT|GENRE|OVERVIEW|TRACKS|CREDITS)(\/)?>/g;

Try it without the grouping first.

Also, is there any reason why your closing tags have / at both ends, i.e.
Code: [Select]
</GENRE/>
as opposed to
Code: [Select]
</GENRE>
which is the format of closing tags in most mark-up languages such as HTML and XML?
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-07-09 21:51:27
Thanks for the tips rawny.

The exact same contents of the text file also gets pasted into the %comment% tag field of the audio files.
I use those <special strings with angled brackets> as delimiters to retrieve string sections from the %comment% tag using foobar2000 title-formatting syntax.

I DO NOT use any other audio tags except these:
ARTIST | TRACKTITLE | ALBUM | DATE | GENRE | ALBUM ARTIST | TRACKNUMBER | DISCNUMBER | COMMENT

Therefore, I use the %comment% tag as an extra database containing custom "pseudo-tags" and "values".
The %comment% tag is a standard tag, and can be read by ANY music player.
I can create custom Playlists, Autoplaylists and Library Searches using fb2k title-formatting and selective searching inside the %comment% tag.

Given the %comment% tag and my text file (folder.txt) are the exact mirror of each other, I can extend my user-interface experience into another dimension;
If I accidentally lose the audio tags, the text file is my backup.
If I accidentally lose folder and file names, the text file contents can be read by command-line tools such as FINDSTR.
In a sense, I'm not just playing audio tracks in a music player but cultivating and indexing an audio collection like a professional librarian (from the old days...
...does anybody here remember the index cards in libraries ???)

I use forward slash at both ends of my closing tags because --after much trial and error-- I found retrieval of delimited string sections from the %comment% tag
using fb2k title-formatting syntax gave me more reliable output.

The standard syntax I use in fb2k to retrieve a delimited section of the %comment% tag looks like this example:
$if($strstr(%comment%,<PRODUCT>),$substr(%comment%,$add($strstr(%comment%,<PRODUCT>),$len(<PRODUCT>)),$sub($strstr(%comment%,</PRODUCT/>),1)),)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-07-10 22:54:21
@marc2003, I'm chasing some weird problems on my computer and setup (I have a biography component script that seems identical but behaving differently than others), so with the caveat that I don't know if the following is a result of, cause of, or unrelated to the weirdness:

When using your lastfm - similar artists - top tags - top fans - top albums - top tracks script (which I downloaded per your post #1741), every time I hit "update" in the WSH panel I get the following in the console:

Code: [Select]
Last.fm: 
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>503 Service Unavailable</title>
  </head>
  <body>
    <h1>Error 503 Service Unavailable</h1>
    <p>Service Unavailable</p>
    <h3>Guru Meditation:</h3>
    <p>XID: 564881961</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>


and sometimes I also get in the console:

Last.fm: HTTP error: 12152

I've removed all other scripts and settings related to last.fm other than this script and my last.fm username and API key.  When I remove this script I never get these console errors.  As far as the display of the WSH panel itself, the panel never crashes and frequently correctly shows the correct data.  Sometimes it fails to find similar artists for artists I know last.fm has knowledge of and has previously displayed similar artist info.

Are you seeing this or have you seen this before?  Any suggestions?  Does it really mean anything?  Thanks for any suggestions.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-07-11 13:35:59
Quote
Error 503 Service Unavailable


that one couldn't be more straightforward. it's a problem at last.fm's end and you'll just have to wait for them to fix it. you can check this page....

http://status.last.fm/ (http://status.last.fm/)

Web services is what you need to be looking at. at the time of me posting:



Quote
Last.fm: HTTP error: 12152


this one usually indicates local connectivity problems. i know i've seen it when i have no internet connection. but if your connection is fine, then it could well be linked to the above. you'll just have to wait it out.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-07-11 22:31:52
Wow - you're right, of course.  I guess I win today's genius award for not even considering the possibility of taking the error message literally.  Thanks!
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-07-15 14:45:41
I would like one more bit of help with my 'WSH Textfile Viewer' panel (see Posts: #1754, #1756, #1757, #1758).

I need a Regular Expression pattern to do this:

      If the text file has a line like this:

            <IDX>B-52's, the</IDX/>The B-52's – Wild Planet (1980)

      Then the WSH textfile viewer panel displays like this:

            The B-52's – Wild Planet (1980)

In other words, using regular expression syntax, how do I remove the "<TAGS>" and the string between them ???

In my previous posts, I solved how to remove the "<TAGS>", but this case is trickier.

If any RegEx gurus are reading this, can you show me the regex pattern which solves such a case ?
I have spent hours and hours trying to solve it but I can't !!
Thanks for your help.

Title: WSH Panel Mod script discussion/help
Post by: fbuser on 2012-07-15 16:43:47
Try something like this (won't work, if the string after </IDX/> contains a ">"):
Code: [Select]
"<IDX>B-52's, the</IDX/>The B-52's – Wild Planet (1980)".replace(/(<.+>)(.+)/,"$2")
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-07-15 17:55:39
Thanks for the reply fbuser +++, I will keep your answer for future reference.

I eventually solved it, and the RegEx pattern to do this is quite simple looking: (LEFT_DELIMITER).*(RIGHT_DELIMITER)

What solved it for me was WWW Google searching with this term:  regex remove string between delimiters
which led me to a solution at this webpage:  stackoverflow.com (http://stackoverflow.com/questions/10485903/regex-extract-value-from-the-string-between-delimiters)

So, looking at an excerpt of the relevant function in my 'WSH Textfile Viewer' script, we see the code I need (in red):
Quote
function on_playback_new_track(){

    g_need_vp_refresh = true;
    g_metadb = get_metadb();

    if (! g_metadb) window.Repaint();

    var new_dir = fb.TitleFormat("$directory_path(%path%)").EvalWithMetadb(g_metadb);
    if (g_dir == new_dir) return;

    var new_title = "";
    var new_text = "";
    var filename = new_dir + "\\folder.txt";
    var filename_contents = utils.ReadTextFile(filename);

    if (new_text == "") {
        var arr = utils.Glob(fb.TitleFormat("$directory_path(%path%)").EvalWithMetadb(g_metadb) + "\\*.txt").toArray();
        if (arr.length > 0) {
            filename = arr[0];
            try {
                these_strings = /(<IDX>).*(<\/IDX\/>)|<PRODUCT>|<\/PRODUCT\/>|<GENRE>|<\/GENRE\/>|<OVERVIEW>|<\/OVERVIEW\/>|<TRACKS>|<\/TRACKS\/>|<CREDITS>|<\/CREDITS\/>/g;
                new_text = filename_contents.replace(these_strings,"");
            } catch(e) {
                new_text = "";
            }
        }
        window.Repaint();
    }

    ...


Before any RegEx gurus comment. . .
Yes, the RegEx pattern for  these_strings = ...;  can be optimized and reduced, but I prefer it like this; a list of definite items.

The main reason I couldn't solve it is because I wasn't using parenthesis correctly while forming my RegEx pattern.

Cheers.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-07-16 04:27:03
Before any RegEx gurus comment...

Yes, the RegEx pattern for  these_strings = ...;  can be optimized and reduced, but I prefer it like this; a list of definite items.

You called? 

Your current expression won't match things like:
Code: [Select]
<PRODUCT>...</PRODUCT/>
It'll only match lines starting with <IDX>, e.g.:
Code: [Select]
<IDX>...</PRODUCT/>


This may be more useful:
Code: [Select]
these_strings = /(<IDX>|<PRODUCT>|<GENRE>|<OVERVIEW>|<TRACKS>|<CREDITS>).*(<\/IDX\/>|<\/PRODUCT\/>|<\/GENRE\/>|<\/OVERVIEW\/>|<\/TRACKS\/>|<\/CREDITS\/>)/g;


Somewhat simplified:
Code: [Select]
these_strings = /<(IDX|PRODUCT|GENRE|OVERVIEW|TRACKS|CREDITS)>.*<\/(IDX|PRODUCT|GENRE|OVERVIEW|TRACKS|CREDITS)\/>/g;


However you'll notice that the list of possible values is repeated unnecessarily. To eliminate this - and the potential nuisance of editing both lists if you ever decide to add/remove a tag - you can use a backreference, like this:
Code: [Select]
these_strings = /<(IDX|PRODUCT|GENRE|OVERVIEW|TRACKS|CREDITS)>.*<\/\1\/>/g;

So the \1 is replaced by whatever the first set of brackets in your expression matched ("PRODUCT", "GENRE", "OVERVIEW" etc.). For a better explanation of brackets and backreferencing, check this out: http://www.regular-expressions.info/brackets.html (http://www.regular-expressions.info/brackets.html)


Alternatively - although perhaps less to your liking as it doesn't involve any kind of definitive list - you could do something along the lines of what fbuser was suggesting and match any set of tags:
Code: [Select]
these_strings = /<(.+)>.*<\/\1\/>/g;
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-07-16 11:50:37
Thanks a lot for passing on your RegEx knowledge rawny +++++++ Highly informative.

In my case, the only <TAG>string</TAG/> I want fully removed from display is <IDX>string</IDX/> .
For all the other <TAG>string</TAG/> items, I remove the tags but allow the string to be displayed .

I don't have any problems with my "defined items list" RegEx pattern; everything works for me as expected. . .HOWEVER, there is a limitation which I am trying to solve
and if you would like to apply your RegEx skills to this it would help solve the final missing piece of the puzzle.

So far, the RegEx pattern I have will only work on single lines in the text file; it fails when operating over multiple lines.
I am in the process of creating another "fully removed" string section delimited by tags named <CUT> and </CUT/>, look at this example. . .

If we have these lines in the text file:
Quote
The Stone Roses were an English rock band formed in Manchester in 1983.
The band were part of<CUT> the declining punk-rock era, but changed their style
over time to alternative/indie rock. They were one of the pioneering groups of
</CUT/> the Madchester movement that was active during the late 1980s and
early 1990s.

Then the WSH Textfile Viewer panel should display this:
Quote
The Stone Roses were an English rock band formed in Manchester in 1983.
The band were part of the Madchester movement that was active during the late 1980s and
early 1990s.


BUT. . .as I stated before, the current RegEx pattern has limitations and cannot operate over multiple lines.
Any suggestions on solving this ?

*** EDIT ***

I found a solution. . .at this webpage:  delphifaq.com (http://www.delphifaq.com/faq/perl/f770.shtml)

This RegEx pattern works correctly:  (<CUT>)(\n|.)*(<\/CUT\/>)

However, if I add a second pair of CUT tags further down the text file then I remove ALL text from the first/highest <CUT> to the last/lowest </CUT/> . . .which is wrong !
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2012-07-16 19:31:15
(continuation of Post #1766)

I solved my problem !!!

This Regular Expression pattern:   (START_DELIMITER)(\n|.)*?(END_DELIMITER)   will match multiple occurrences of the expression as separate instances.

Therefore, in the case of my 'WSH Textfile Viewer' panel and the multiple occurrences of <CUT>string</CUT/> in my text file,
I offer proof-of-concept results from a test run in my foobar2000. . .

Text file contains this text:
Quote
The Stone Roses were an English rock band formed in Manchester in 1983.
The band were part of<CUT> the declining punk-rock era, but changed their style
over time to alternative/indie rock. They were one of the pioneering groups of
</CUT/> the Madchester movement that was active during the late 1980s and
early 1990s.

They would often display no interest in<CUT> promoting themselves, and many journalists
were confused, and sometimes angered, when their questions were met with complete silence
from the four Stone</CUT/> Roses.


'WSH Textfile Viewer' displays this text:
Quote
The Stone Roses were an English rock band formed in Manchester in 1983.
The band were part of the Madchester movement that was active during the late 1980s and
early 1990s.

They would often display no interest in Roses.


Well. . .that is that; I have all the RegEx I need to control display output in the 'WSH Textfile Viewer' panel .

I hope this was interesting to some of you here, and I will share the 'WSH Textfile Viewer' script and support files with all of you . . .one day soon .

Goodbye and thanks for all the help .
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-07-17 16:19:43
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

last.fm charts: you can now access 1 month charts. (this is a recent addition to the last.fm api)
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2012-07-21 10:24:00
Hi,

I'm currently refining an Album Cover panel which I started years ago.
And after learning so much from this thread and their regular posters,
I'm trying to clean up the mess I made in that code.

Anyway I wanted to share some pics:

(http://img542.imageshack.us/img542/4406/wshcoverscreen3.th.jpg) (http://imageshack.us/photo/my-images/542/wshcoverscreen3.jpg/)

(http://img268.imageshack.us/img268/7117/wshcoverscreen2.th.jpg) (http://imageshack.us/photo/my-images/268/wshcoverscreen2.jpg/)

(http://img839.imageshack.us/img839/6614/wshcoverscreen1.th.jpg) (http://imageshack.us/photo/my-images/839/wshcoverscreen1.jpg/)

I love album art so I created toggles for showing original art or the remastered version.
Further there are toggles for Gloss, Reflection, Label Icons, Progressbar & text alignment.
Also in the edit mode You can drag the different components (art, text, icon) to your favorite position.
In properties you can change that also and some additional settings.

It's still under construction though.
Title: WSH Panel Mod script discussion/help
Post by: macarych on 2012-07-29 20:39:55
Hi, I'm currently refining an Album Cover panel which I started years ago. .................It's still under construction though.

Very nice ! Do you think to share it ?
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2012-07-29 20:49:22
Hi, I'm currently refining an Album Cover panel which I started years ago. .................It's still under construction though.

Very nice ! Do you think to share it ?


When I finish it, maybe.
Title: WSH Panel Mod script discussion/help
Post by: trout on 2012-07-31 00:14:19
I have a script for a "Stop After Current" button. I've used gr.DrawLine() to draw an "X" , with the color depending on whether SAC is active. The problem is it does not display correctly when foobar2000 is started. It only draws a small portion of the line drawn top-left to bottom-right, and none of the second line. But - if I bring up the WSH panel config and just click on [Apply] or [OK], then it displays fully as expected.

Here is just the the meat of the script; enough to demonstrate the issue:
Code: [Select]
var ww = window.Width;
var wh = window.Height;
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }

function on_paint(gr) {
    gr.DrawLine(3, 3, ww-4, wh-4, 2, fb.StopAfterCurrent ? RGB(128,128,128) : RGB(188,188,188));
    gr.DrawLine(3, wh-4, ww-4, 3, 2, fb.StopAfterCurrent ? RGB(128,128,128) : RGB(188,188,188)); }
function on_mouse_lbtn_up() {
    fb.RunMainMenuCommand("Playback/Stop After Current");
    window.Repaint(); }
function on_playlist_stop_after_current_changed() {
    window.Repaint(); }

I'm using the most recent WSH Panel Mod (v1.5.3.1) (Inside a Panel Stack Splitter in Columns UI. But I checked it in a Default UI config and the problem was still present). Much appreciation for any feedback on whether it's something I've done wrong (other than drawing an X with lines instead of just using text...), or what the problem is, and how it can be solved.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-07-31 03:06:29
@trout:

You need to stick an on_size() function in there to make sure the graphical stuff is (re-)drawn relative to the panel's final size once it has finished whatever sizing calculations it's doing during foobar start-up.

Try replacing the lines defining ww and wh at the top of your code with:
Code: [Select]
var ww;
var wh;
    
function on_size() {
    ww = window.Width;
    wh = window.Height;
    window.Repaint();
}

Hope that helps
Title: WSH Panel Mod script discussion/help
Post by: trout on 2012-07-31 04:39:37
rawny,

That's very helpful, thanks!

Title: WSH Panel Mod script discussion/help
Post by: Neonphytismo on 2012-07-31 04:56:52
Code: [Select]
var ww;
var wh;
    
function on_size() {
    ww = window.Width;
    wh = window.Height;
}


is enough. It's not recommended calling window.Repaint() in on_size() function; might trigger some problems.

see Notes&hints.txt in wsh panel mod package.

Quote
3. Don't call repaint functions such as window.Repaint() in callback function on_size() {}, especially in pseudo transparent mode.
Title: WSH Panel Mod script discussion/help
Post by: trout on 2012-07-31 06:32:31
Neonphytismo, thanks for that reminder!

I actually just saw such an example in the sample scripts, and it made me wonder. But I did not remember reading that warning.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-07-31 13:26:07
Quote
3. Don't call repaint functions such as window.Repaint() in callback function on_size() {}, especially in pseudo transparent mode.

I've always found that warning odd, because I'm not sure how it ensures the on_size() call happens first and it worries me that on some occasion it might not...

Edit: However looking through all my scripts, only the one I glanced it to help trout has on_size() calling Window.Repaint() unnecessarily. I have one other (type of) script which employ this as well - via an intermediate function - so far it seems necessary to this (type of) script, i.e. I took it out and it broke...I'm going to meddle with it a bit more, although my view of the warning is still the same.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-08-16 17:41:51
I'm trying to tweak a java script to recognize each of the values in multivalue artist tag fields to generate paths to image folders that I've saved:

Currently, the script allows a user to add paths for images, and a user can add as many paths as desired.  For example, I've entered the following:

C:\\Users\\xxz\\AppData\\Roaming\\foobar2000\\wsh_lastfm\\$crc32(%artist%)\\*.jpg
C:\\Users\\xyz\\AppData\\Roaming\\foobar2000\\wsh_lastfm\\$crc32(%artist%)\\*.png

(thanks to marc2003 for your script capturing and saving last.fm images that we can use elsewhere, as I'm doing here!)

The above entries work well for single value artist tag fields, but currently don't retrieve anything for multivalue artist tag fields (the crc function generates a crc for the string of all the artists in the tag field, and there is no such folder).  But most of the time I've got image folders for each of the artists separately and I'd like to add paths to each of those artists, if possible.

Is there some kind of loop I could add that would generate the separate paths for each artist in a multivalue artist tag field, and if so what would that look like?  Whether the right answer is a loop or not, any suggestions appreciated!

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-08-20 16:11:13
something like this....

Code: [Select]
crcs = [];
num = fb.TitleFormat("$meta_num(artist)").EvalWithMetadb(g_metadb)
for(i =0; i < num; i++) {
    crcs[i] = fb.TitleFormat("$crc32($meta(artist," + i + "))").EvalWithMetadb(g_metadb);
}
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-08-21 05:40:17
Thanks, marc2003 - that code was the key to making it work!

I currently use a crude but effective way to download images for the nth artist for a track: I use your thumbs script and remap the artist field in the context menu to $meta(artist,n) and restart the song to trigger the search and download.  If there is a more elegant way to grab images for all artiists for a multivalue artist track, suggestions are appreciated, including any tweaks to put in the thumbs script or common4.js.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-08-22 13:09:11
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

i've shamelessly stolen romor's allmusic script from the foo_uie_biography thread. 

this can display either album reviews or artist bios. the reason i've put this in a WSH panel is because i can support caching which means instant panel updates and offline usage after the initial download of each item. you can also switch between reviews and bios on the fly using the context menu.

existing users of my scripts need to extract the marc2003 folder from the zip as it contains a new file required by this script.

@godrick, i'll look into it.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-08-22 14:12:01
Marc, I'm very grateful for your work. Just tried out your allmusic script - with each and everything I select I get "no text" - I am really sure I copied everything over to the appdata marc2003 folder. The console has no error at all.
Is there something I can do?
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-08-22 17:09:34
i've shamelessly stolen romor's allmusic script from the foo_uie_biography thread. 


Wow thanks for this - you rule... and I'm not just sayin' it. =D

It works fine for me - returns results as regularly as the bio panel, however throws up errors occasionally (2 times so far in 10 tracks tested):

Error: WSH Panel Mod (Allmusic by marc2003, Uses a modded version of foo_allmusic.vbs by romor): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Ln: 70, Col: 2

I can't offer more any more details than that yet as to 'causes...

UPDATE:

Different error:
further testing gives me steady script errors for %album artist% "Various Artists" (on albums that exist at Allmusic):

line 13; char 7
error Object doesn't support this property or method: 'i.firstchild.firstchild.getAttribute'
code 800A01B6
MS VBScript runtime error.

This error does not appear for albums that are not at Allmusic.
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2012-08-22 19:02:19
marc, how can I edit your .txt file reader to display preformatted text (such as EAC and CUETools logs)?

Thank you for all your work.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-08-23 13:09:58
@Emerelle, do you not even see a "fetching info" message for a few seconds? if you see that before the "no text" message, it means the info wasn't found.

also, a limitation of the script is that the album must be on the allmusic site, even in artist bio mode. if there is no album tag, then the script won't run.

@mjm716, i've managed to stop the script erroring (extract marc2003 folder again and import the allmusic.txt into your panel) but i can't fix why it won't display various artist albums that do exist. you'll have to ask romor about that. i'm assuming they also fail in the foo_uie_biography panel as well???

@Dario, right click the panel and select "path to text file". use titleformatting to enter the filename. as an example,  if the filename is "eac.log" and it sits in the same folder as the playing file then you would use

Code: [Select]
$directory_path(%path%)\eac.log

Title: WSH Panel Mod script discussion/help
Post by: Dario on 2012-08-23 15:48:15
You didn't understand my query (or perhaps I didn't phrase it well).

I'm talking about something like this:

Code: [Select]
[CUETools log; Date: 23/08/2012 02:12:15; Version: 2.1.4]
[CTDB TOCID: EbOzQZA2.F7k_wn4ygo8ZQjbXW4-] found.
Track | CTDB Status
  1  | (3/3) Accurately ripped
  2  | (3/3) Accurately ripped
  3  | (3/3) Accurately ripped
  4  | (3/3) Accurately ripped
  5  | (3/3) Accurately ripped
  6  | (3/3) Accurately ripped
[AccurateRip ID: 000a4a8e-0036c64a-4c09cd06] found.
Track  [  CRC  |  V2  ] Status
 01    [3c12ca33|d6783547] (2+2/4) Accurately ripped
 02    [ed4a2680|68c012ea] (2+2/4) Accurately ripped
 03    [5c81b1b1|2a9cc5af] (2+2/4) Accurately ripped
 04    [4a491601|508711d5] (2+2/4) Accurately ripped
 05    [99538ce0|1aff3f26] (2+2/4) Accurately ripped
 06    [24fccfc5|301d2fe3] (2+2/4) Accurately ripped

Track Peak [ CRC32  ] [W/O NULL] [  LOG  ]
 --  97.7 [82DD0EAB] [E0DDA975]  CRC32 
 01  97.7 [FC49B125] [C640A7E7]         
 02  97.7 [E1E665AD] [94E1D6EE]         
 03  97.7 [E707FB25] [B2326DDB]         
 04  97.7 [56C2CF85] [808E4293]         
 05  64.0 [F18C3285] [EE5A4EDB]
 06  97.7 [5C5D1E5E] [2C20C7EA]

The whitespaces are preserved and the text is formatted properly, but if I were to just "paste" it, it'd end up being a mess (which is what the .txt reader ends up displaying).
Title: WSH Panel Mod script discussion/help
Post by: db1989 on 2012-08-23 15:50:39
Do fixed-width fonts such as Courier New not preserve whitespace when used within the panel?
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2012-08-23 15:57:33
Do fixed-width fonts such as Courier New not preserve whitespace when used within the panel?

Awesome. They do; but what am I supposed to change the normal_font variable with:

Code: [Select]
gr.GdiDrawText(text_array[i + offset], normal_font, g_textcolor, 6, 16 + (i * row_height), ww - 16, row_height, DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);

It uses the generic font, in my case, Ubuntu Condensed, which isn't monospaced. I'd like to change it to Ubuntu Mono or Courier New (the latter preferred).
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-08-23 16:50:57
Marc yes I see that message as well - but no info gets displayed even on albums /artists that are on Allmusic (and the tags are intact).
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2012-08-23 16:53:38
Okay, I figured the way through my issue by myself. Reading the WSH Panel Mod docs can get you a long way. Thank you guys.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-08-23 19:05:59
Adding examples to my post above:
Joy Division - has text, exactly one match in the artist panel (found straight away using the webbuttons of your samples)
Infected Mushroom - also has text, exactly one match, also found through the webbutton from the sample. Still no error in console.

Is it possibly incompatible with anything like the other bio panel?

PS: Ok, now I got for the first time the very same error like a couple of posts above - error in VB Script etc. It is the same message text as posted above.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-08-24 11:49:55
the script searches for the album first and then tries to match the artist so it's no good searching for the artist on it's own. can you give some artist/album combinations to test?

also, if you're seeing script errors, that's not a good sign. but i did mention above that i updated the script so it doesn't display errors anymore. it now fails silently.

Different error:
further testing gives me steady script errors for %album artist% "Various Artists" (on albums that exist at Allmusic):


this is now fixed. the script needs re-importing and the marc2003 folder needs extracting again.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-08-24 15:17:32
I wasnt aware of an update, your post seemed not modified, I will download that again and report back. I also didnt know I should search for the album first, I will use this advance now.
PS: Ok, now I see the update
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-08-24 18:01:05
the script searches for the album first and then tries to match the artist so it's no good searching for the artist on it's own. can you give some artist/album combinations to test?

also, if you're seeing script errors, that's not a good sign. but i did mention above that i updated the script so it doesn't display errors anymore. it now fails silently.

Different error:
further testing gives me steady script errors for %album artist% "Various Artists" (on albums that exist at Allmusic):


this is now fixed. the script needs re-importing and the marc2003 folder needs extracting again.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

YES! and YES! thank you so much.

I've tried about 50 tracks, and no errors, and I've finally been getting results from 'Various Artists' items - the approximate album name matching seems very robust.

Now comes the annoying follow-up wish!  It would be fantastic to get it to scan the whole library instead of only the current track, to make a complete local data set. =D
[Hopefully that's something I can figure out if you're not interested.]

I do have one general question that doesn't make any sense to me.
The wsh script uses %album artist% (twice). I've tried changing that to %artist% instead (with the idea for example, that when it retrieves a compilation review, it could simply pull the normal artist bio). However, using %artist% returns no results, for regular albums or compilations (checked against known artists with bios).
am I missing something?
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-08-24 23:04:39
@mjm716, yes I think you are missing something 

The search string in romor's script contains "URL = "http://www.allmusic.com/search/albums/...", for a very good reason if one is looking for both an album review and the right artist bio in one elegant search.  So if you want an artist bio not linked to an album search result, you need to do a different search.  I think the code you need to borrow is already in the script.

For example, consider replacing the "then" portion of of the following "if" statement in the current script:
Code: [Select]
If Lcase(ARG(0)) = "various artists" And ARG(2) = "bio" Then Wscript.Quit() End If

to execute a search using an artist search string:
Code: [Select]
URL = "http://www.allmusic.com/search/artists/" & LCase(Replace(ARG(0), " ", "+"))

So the "then" portion of the "if" statement above would conduct an artist search.  I looked at the web page's source code for such a search result, and I believe you can use the same code as that used to assign artist_link in the current script to find an artist bio, keeping mind that the script will return the first matching search result, which may or may not be the artist you are looking for if it's a common name. 

Make sure you quit the script at the end of this "then" section, and add an "else" line after your new code and just before the existing code that follows the "if" statement above so that the script continues to work as before for album artists that are not "various artists".
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-08-25 14:32:14
@mjm716, yes I think you are missing something 

Make sure you quit the script at the end of this "then" section, and add an "else" line after your new code and just before the existing code that follows the "if" statement above so that the script continues to work as before for album artists that are not "various artists".


Thanks G - yes, for some reason, the script logic only sinks in briefly and disappears promptly again.

One other error to report:

If there is no internet  connection, it really freaks out - sends many pop-up error reports that makes the app unresponsive.

vbs script error: line 34, char 3; system cannot locate the resource specified
code 800c0005; source msxml3.dll

with no connection, it should be pulling from a saved file if it exists, or otherwise dumping gracefully?

----
thanks for the good work guys!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-08-25 14:56:39
yesterday i accidentally removed the part that hides popup errors. at the moment line 101 starts like this....

Code: [Select]
WshShell.Run(script_path....


edit it so it becomes...

Code: [Select]
WshShell.Run("cscript //nologo " + script_path...


i hope it doesn't hang in the background when it fails but i have no way to test this as i'm using a computer at my library where i have no control over any settings.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-08-25 15:38:43
marc2003, regarding your Now Playing script...

Depending on the dimensions of the panel, some artist images work quite a lot better than others. And often, one particular image looks just right.

Would it be possible to add a function to lock a certain image into place? Or to have the panel remember the last image selected?
Alternately, a "delete all but current image" function would work too.

I know this can be accomplished manually, but with thousands of artists it would take a bit of time

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-08-25 22:05:41
i hope it doesn't hang in the background when it fails but i have no way to test this as i'm using a computer at my library where i have no control over any settings.


that seemed to fix the no internet pop-ups.

however one other bug - if 'allmusic_bio.txt' exists, it's not being read.

   if (fso.fileExists(filename)) g_text = read(filename);

I tested that filename path was correct and file exists = true; but if read is a function, it's missing?
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-08-27 16:26:46
another strange issue -

the WSH version only displays & saves to allmusic_bio.txt the 1st paragraph from allmusic, while the biography panel displays the whole bio text...

=|
Title: WSH Panel Mod script discussion/help
Post by: romor on 2012-08-27 16:50:32
edit it so it becomes...

Code: [Select]
WshShell.Run("cscript //nologo " + script_path...

marc2003, can't you use WSC (http://msdn.microsoft.com/en-us/library/dd79w6c8) (wrap vbscript in XML and set parameters) then call it as object function from javascript?

I've done the opposite here (http://www.hydrogenaudio.org/forums/index.php?showtopic=86092), when needed crypto service from javascript function, not knowing that there is already crypto COM object exposed by .NET

Hope it helps instead complicate things
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-08-28 13:51:49
I tested that filename path was correct and file exists = true; but if read is a function, it's missing?

the read function is my common4.js file. it would error if missing plus no text from any cached files would display. although unlikely, it's possible the txt file is empty but it shouldn't be created unless there was something to save.

Quote
the WSH version only displays & saves to allmusic_bio.txt the 1st paragraph from allmusic, while the biography panel displays the whole bio text...

i have no idea why this is. i'll look into it. this is now fixed. just the script in the panel needs re-importing.

@romor, i'm not using your amazon script so i don't really have any idea what you're on about.  if you look at the parameters, i'm just calling your allmusic script with a file path added to the end. rather than output the text using WScript.echo, i'm saving to text file which my script then reads.

i know it should be fairly trivial to port the whole thing into a WSH panel but i've don't have much access to a computer at the moment.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2012-08-28 15:26:13
i'm not using your amazon script so i don't really have any idea what you're on about.  if you look at the parameters, i'm just calling your allmusic script with a file path added to the end. rather than output the text using WScript.echo, i'm saving to text file which my script then reads.

I was suggesting you use it as COM object instead using shell run. You could run any function from it as it was JS. Amazon script was working example
Nevermind...

Cheers
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-09-01 00:04:39
Concerning my problems with the allmusic script, I think I found out that I simply dont receive any info because that very album is not there, in spite of the artist info being there. I think that is the way it works? Its a pity though

I have another two questions for the simple text reader: Does the path to the text file need to be changed in both script and dialog? I tried to insert an if function because I wanted it to look in one level up if no info.txt is found, but that did not display anything.
Second question concerns the right margin: I managed to change both top and left text margins only the value for the right one is unclear to me which one I have to change in the script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-01 12:01:46
normally users would not need to edit the script as the dialog accepts any title formatting. your problem is that you cannot check for the existence of files using title formatting alone. i might add a hack to get around this.

as for the margins, you need to browse the marc2003 folder in your foobar profile directory. edit common4.js in a text editor. on line 286, you'll see

Code: [Select]
        lines = temp_gr.EstimateLineWrap(paragraphs[i], normal_font, ww - 16).toArray();


ww - 16 is the relevant bit. increase the number to make the margin bigger. after changes have been saved you need to reload the script in your panel for it to pick the changes up.

also i should mention that playing with the top margin may break the calculation for how many rows to display. you might need to adjust the panel script on line 25.

Code: [Select]
rows = Math.floor((wh - 32) / row_height);


just the number 32 would need tweaking.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-01 13:19:21
normally users would not need to edit the script as the dialog accepts any title formatting. your problem is that you cannot check for the existence of files using title formatting alone. i might add a hack to get around this.


samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

simple text reader you can now use multiple file paths in the path to text file dialog. it will check each one in turn until a file is found. separate each entry using | with no spaces.

unfortunately there is a limit of 255 characters for the standard input dialog. if you find yourself running into this limit, hold down shift before right clicking the panel. select Properties from the menu and then edit the value of text_file in the popup dialog.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-09-01 20:45:34
Awesome Marc, thanks so much for both your advice and the update.

EDIT - I figured it out - look in one folder up works like this
$directory_path($directory_path(%path%))\info.txt

And now it works for both the content folder plus one folder up using it like this:

$directory_path(%path%)\info.txt|$directory_path($directory_path(%path%))\info.txt

Awesome!
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2012-09-07 20:25:20
Has anyone tried Marc2003's scripts in OSX via wineskin?  I have my config working very well, but use Marc2003's scripts heavily, and am getting errors all over the place.  I have one other WSH panel working fine that doesn't any dependencies so I don't think it's a WSH panel problem.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-09-08 01:05:30
Has anyone tried Marc2003's scripts in OSX via wineskin?  I have my config working very well, but use Marc2003's scripts heavily, and am getting errors all over the place.  I have one other WSH panel working fine that doesn't any dependencies so I don't think it's a WSH panel problem.

I run them under Wine on Ubuntu and had errors at first. I basically had to comment out some parts of the common4.js script. I think I figured out which ones by looking at the line number that was causing problems in the foobar console and going from there. I can specify which bits I effectively cut out if you like, although it may be a bit different for you. Also, naturally some of the scripts won't necessarily be usable if you do cut chunks out of the common script. Personally I'd rather have some than none so that's why I went down this route
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2012-09-08 02:59:36
I run them under Wine on Ubuntu and had errors at first. I basically had to comment out some parts of the common4.js script. I think I figured out which ones by looking at the line number that was causing problems in the foobar console and going from there. I can specify which bits I effectively cut out if you like, although it may be a bit different for you. Also, naturally some of the scripts won't necessarily be usable if you do cut chunks out of the common script. Personally I'd rather have some than none so that's why I went down this route


I was going to attempt that but the console wasn't helpful.  It reads:

WSH Panel Mod (Thumbs by marc2003): Parsing file "C:\users\Sixth Street\Application Data\foobar2000\marc2003\common3.js"

The popup dialog box says:

Scripting Engine Initialization Failed (Thumbs by marc2003, CODE: 0x800a01ad): Unknown error code (2148139437)

Any help would be greatly appreciated!
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-09-08 03:37:50
I run them under Wine on Ubuntu and had errors at first. I basically had to comment out some parts of the common4.js script. I think I figured out which ones by looking at the line number that was causing problems in the foobar console and going from there. I can specify which bits I effectively cut out if you like, although it may be a bit different for you. Also, naturally some of the scripts won't necessarily be usable if you do cut chunks out of the common script. Personally I'd rather have some than none so that's why I went down this route


I was going to attempt that but the console wasn't helpful.  It reads:

WSH Panel Mod (Thumbs by marc2003): Parsing file "C:\users\Sixth Street\Application Data\foobar2000\marc2003\common3.js"

The popup dialog box says:

Scripting Engine Initialization Failed (Thumbs by marc2003, CODE: 0x800a01ad): Unknown error code (2148139437)

Any help would be greatly appreciated!

If you copy the whole of the common.js script into a panel above the script you're trying to use it for, or maybe even on its own to begin with, you should get more informative errors in the console. If your adding to a script though, make sure to remove the import line:
Code: [Select]
// @import "[...]common4.js"
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-08 13:45:57
i've had my scripts working in WINE. i found an old post where i detailed what i had to do...

save this somewhere as winetricks

http://www.kegel.com/wine/winetricks (http://www.kegel.com/wine/winetricks)

run it from a terminal

Code: [Select]
sh winetricks


select

Code: [Select]
gdiplus
ie8
wsh57


i suggest downloading my latest scripts (i can tell yours is old because you mention common3.js and i've been on common4.js for ages now).

edit common4.js in a text editor and comment out lines 401 & 402 like this...

Code: [Select]
//var vb = new ActiveXObject("ScriptControl");
//vb.Language = "VBScript";


doing this means input dialogs won't work from the context menu but if you copy the entire config from a working windows machine, it should just work. if you do need to set some variables then you might need to edit the script directly. give me a shout if you need any help.



Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-09-08 14:27:00
i've had my scripts working in WINE. i found an old post where i detailed what i had to do...

save this somewhere as winetricks

http://www.kegel.com/wine/winetricks (http://www.kegel.com/wine/winetricks)

run it from a terminal
Code: [Select]
sh winetricks
select
Code: [Select]
gdiplus
ie8
wsh57

I'm not sure whether this part will be applicable as Sixth Street is running foobar on OSX via wineskin - they may have a winetricks equivalent though...? (I don't know how much wineskin differs from pure WINE.)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-08 14:32:36
oops, i missed that.  i'd hazard a guess at WINE being installed though so it may work??
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-09-08 14:42:11
Wow epic formatting screw-up -.-

I was trying to say that it might work from the point of view that some WINE is probably in there.

I think the best thing to do would be for Sixth to update all your scripts first and then see what's happening after that.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-09-08 17:43:22
writing playlist viewer like esplaylist - with grouping. i create an object - album, which contents the songs.

Code: [Select]
pl_album=function(name,content,metadb) {
                ...
                this.display_image=utils.GetAlbumArtV2(this.metadb,0,true);
            }

content=massive of objects contents the tracks
metadb=this.Items.item(i) - one item of playlist.

as i understand while creating groups i call for a cover, but callback on_album_image_load_done isnt called. what i doing wrong? or how better load images for albums on screen?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-10 11:46:52
i don't think there is any such thing as on_album_image_load_done. there is on_get_album_art_done which is only called when using utils.GetAlbumArtAsync, not utils.GetAlbumArtV2.
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2012-09-10 15:41:51
I think the best thing to do would be for Sixth to update all your scripts first and then see what's happening after that.


Yup, you are correct.  I should try the newest scripts first.  It's just that I've heavily modified some of the scripts for my own usage and since they were working just fine never decided to update and have to try to re-create my modifications.  I'll try the latest stock scripts and report back.
Title: WSH Panel Mod script discussion/help
Post by: rawny on 2012-09-10 21:03:22
I think the best thing to do would be for Sixth to update all your scripts first and then see what's happening after that.

Yup, you are correct.  I should try the newest scripts first.  It's just that I've heavily modified some of the scripts for my own usage and since they were working just fine never decided to update and have to try to re-create my modifications.  I'll try the latest stock scripts and report back.

You could compare your modified versions and the new ones using some kind of text comparison program and then put your changes in, but yeah. Yell if you need any more help
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-09-13 02:21:55
I'm beating my head against a wall with something that seems simple, but I'm missing something - help appreciated!

I'm trying to invoke title formatting within a jscript to extract a portion of a path.  For example, let e_1 equal the variable that contains the path.  I echo e_1 to the console to ensure that e_1 really contains a path.  For example, the console echoes

c:\users\xyz\appdata\roaming\123456789_kjl.jpg

as I expect, which means the script recognizes e_1 and knows that it contains the string it echoed to the console.

But in the very next line of the script, when I try

y4 = fb.TitleFormat("$strrchr(e_1),_)").Eval();  (in this case I'm looking for the first occurrence of an underscore in the path stored in e_1),

y4 equals 2 instead of 10 per the console echo.  The title formatting is treating "e_1" as the string it's evaluating, instead of treating e_1 as a variable and evaluating the string "c:\users\xyz\appdata\roaming\123456789_kjl.jpg".  I played around with the name of my variable and moved around the underscore to ensure I was correct in my interpretation of what is happening.

I can't figure out how to get the command line to evaluate e_1's value.  I also tried fb.TitleFormat("$strrchr($get(e_1)),_)").Eval();  but that didn't work either.  I'm probably missing something simple as usual, but I can't figure it out.  Thanks for any advice!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-13 10:21:34
e_1 is your variable in the script but you're treating it as a plain text in your title formatting.

but you don't even need to use title formatting for this. javascript has indexOf.

y4 = e_1.indexOf("_");
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-09-13 10:34:11
I've got a suggestion for your "now playing" script marc2003.

Since it shows album art, I now use this panel instead of the album art viewer, the only downside is it takes a couple of clicks more to come to the directory of the currently playing track.

It's nice to be able to find the artist picture folder by double clicking, but if I double click on the albumart I would like to come to that directory instead. Just an idea, that I think makes sense?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-13 10:57:00
that's a reasonable request. samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

now playing: double clicking the album art image locates the image in explorer. double clicking anywhere else in the panel opens the artist image.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-09-13 11:11:41
wow, that's fast  thanks!
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-09-13 13:07:46
e_1 is your variable in the script but you're treating it as a plain text in your title formatting.

but you don't even need to use title formatting for this. javascript has indexOf.

y4 = e_1.indexOf("_");


Yes, marc2003 you are correct in describing the problem, and using javascript string object methods in this example does work.  But I've got other sting formatting actions I'm trying to do that either require me to figure out a way to have e_1 recognized correctly in a fb.titleformat expression, or at least seem easier with title formatting than with javascript string object methods.  I've successfully passed variables to fb.titleformat expressions previously and even in other places in the script I'm working on, but none of the other expressions involve string formatting  - is there something I need to do in this or similar cases to have the variable recognized as such?  Thanks for the help!
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-09-14 10:25:14
@Falstaff

is it possible to add this option to a WSH Playlist Viewer (item.cover_type=2) ?

(http://www.picshare.ru/uploads/120914/5q428S8F8A.jpg) (http://www.picshare.ru/view/268504/)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-14 12:32:41
@godrick

Code: [Select]
fb.TitleFormat("$strrchr(" + e_1 + "),_)").Eval();


Title: WSH Panel Mod script discussion/help
Post by: danielkza on 2012-09-14 23:22:18
A function I made to make my life a bit easier: it can register object methods to be called as if they were global callbacks. The following example will print 3 messages in the logs whenever the playback state is changed: one for each of the objects that registered their own callbacks in their constructors, and one for the global callback, that was properly stored before replacement. Get the actual code at github (https://gist.github.com/3725305).

Code: [Select]
// Actual code ommited, grab the latest version from the link above!
// function registerFooCallbacks(obj);

function MyPlayMonitor(id)
{
    this.id = id;
    registerFooCallbacks(this);
};
MyPlayMonitor.prototype.on_play_order_changed = function(new_order_index)
{
    fb.trace("Play order changed! (id = " + this.id + ")");
};
MyPlayMonitor.prototype.on_playback_pause = function(state)
{
    fb.trace("Playback state changed! (id = " + this.id + ")");
};

function on_playback_pause(state)
{
    fb.trace("Global callback, reporting for duty.");
};

var play_orders = [new MyPlayMonitor("foo"), new MyPlayMonitor("bar")];
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-09-15 00:25:36
@godrick

Code: [Select]
fb.TitleFormat("$strrchr(" + e_1 + "),_)").Eval();


Wow, I should have been able to figure that out....but I didn't.  Thanks very much marc2003, once again!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-09-15 10:23:27
@onv

possible yep, from me no, sorry, there are better things that are waiting to be done imho.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-18 12:57:12
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

musicbrainz releases has been renamed to musicbrainz. this is because it has a new mode and that is to show some clickable links to various pages online. unlike my weblinks script which attempts to guess URLs based on artist metadata, these are all official pages. you can switch between releases and URLs via the context menu.

(http://dl.dropbox.com/u/22801321/mb%20url.PNG)
Title: WSH Panel Mod script discussion/help
Post by: MrMonkey on 2012-09-18 15:05:48
Would it be possible to combine the artreader with the playback buttons so that the buttons are on top of the artwork and functional?
I previously did something similar with the normal artwork reader + rainmeter's NowPlaying plugin but it wasn't the cleanest solution.

I'm not asking for someone to do it - I'm just asking if it's possible.

Thx.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-09-20 18:22:28
I think I'm out of luck of this, but I'll ask just in case:  I'd like to deselect options in the main foobar2000 toolbar in a js script. I tried fb.RunMainMenuCommand and fb.RunContextMenuCommand but no joy.  I wasn't surprised by that, since I understand those commands are limited to what you can select from the main menu and context menu for what is playing, and the toolbar selections are not normally available either of those ways.  I also looked through all the commands exposed by foo_runcmd and also did not find anything on point.  I'd like this to work for DUI, so I can't hide the toolbar or status pane as CUI does as has been discussed many times.

For what it's worth, I'd like to not display all main toolbar selections other than buttons when my display goes below a certain size, and restore the display of certain toolbars when the display goes above that size.  I'd settle for turning all toolbars off instead of selective control if that were the only option.

Is there something I'm missing, or a workaround other than use CUI?  Thanks for any advice as usual!
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-09-20 18:40:09
marc2003 and anyone interested - this is what I came up with to revise Thumbs to automatically download images for all artists in a multivalue artist tag field and other fields as defined in the code below.  If one wanted this to also work for multivalue composer or conductor tag fields, this could be changed to accommodate that easily.  The first function is an existing function revised to add a new call, and the following two functions are new.  No other changes to Thumbs - the artist field remapping selection still works as it did before.  Thanks for the help!


Code: [Select]
function on_playback_new_track() {
on_item_focus_change();
update_all_images();
}

// new function to update all artist, composer, conductor images
function update_all_images() {
crcs = [];
folderart = [];
num = fb.TitleFormat("$meta_num(artist)").Eval();
debug && fb.trace("Thumbs script:  " + num + "  total artists");
for(i =0; i < num; i++) {
  crcs[i] = fb.TitleFormat("$meta(artist," + i + ")").Eval();
  folderart[i]= data_folder + fb.TitleFormat("$crc32(" + crcs[i] + ")").Eval();
  debug && fb.trace("Thumbs script:  artist  " + i + "  " + crcs[i]);
  download_my_images();
}
crcs[i] = fb.TitleFormat("[%conductor%]").Eval();
if (crcs[i] != "") {
folderart[i]= data_folder + fb.TitleFormat("$crc32(" + crcs[i] + ")").Eval();
debug &&  fb.trace("Thumbs script:  conductor  " + crcs[i]);
download_my_images();}

crcs[i] = fb.TitleFormat("[%composer%]").Eval();
if (crcs[i] != "") {
folderart[i]= data_folder + fb.TitleFormat("$crc32(" + crcs[i] + ")").Eval();
debug && fb.trace("Thumbs script:  composer " + crcs[i]);
download_my_images();}

  debug && fb.trace("Thumbs script: completed downloading");
  update_image(); 
}

//borrowed from common4 and tweaked - custom function to download art
function download_my_images() {
working = true;
window.Repaint();
debug && fb.trace("Thumbs script:  downloading art for " + crcs[i]);
WshShell.Run('"' + script_path + 'art.exe" "' + crcs[i] + '" "' + folderart[i] + '" ' + limit, 0, true);
working = false;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-21 15:10:54
I'm not asking for someone to do it - I'm just asking if it's possible.


i've done it anyway - just a quick bodge together of the 2 scripts. http://dl.dropbox.com/u/22801321/art%20rea...k%20buttons.txt (http://dl.dropbox.com/u/22801321/art%20reader%20with%20playback%20buttons.txt)

Quote
I'd like to deselect options in the main foobar2000 toolbar in a js script.


i'm not really sure what you mean by this as you can't customise the menu in DUI. but you can re-create your own. look at the MainMenuManager All-In-One script bundled in the samples folder that comes with the component. this allows you to use only partial submenus such as file, view, help etc so you could omit ones you don't use but this is only useful for columns where you can hide the original toolbar.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-09-21 17:05:34
Sorry for not being clear: within a js script, for a DUI layout, if any of the following toolbar items are displayed, I want to not display them when my foobar2000 display size goes below a certain size:
- layout editing mode toggle
- playback order
- playlist switcher
- any visualization
- volume control

... and then restore the ones from the list above that were previously displayed when the screen size increases.

Anyone have any experience with something like autohotkey to control these (i.e., commands not accessible from the main menu or context menu for what is playing)?
Title: WSH Panel Mod script discussion/help
Post by: MrMonkey on 2012-09-21 17:54:42
i've done it anyway - just a quick bodge together of the 2 scripts.

Amazing. Thank you so much.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-22 12:54:33
small update to my musicbrainz script - http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

it now has icons for the most popular websites...

(http://dl.dropbox.com/u/22801321/mb%20url.PNG)

(existing users need to extract the marc2003 folder again as it contains the new images)

@godrick, what you're asking is well beyond the scope of WSH panel mod.

panel stack splitter (for columns UI) can do this easily because you can hide the main toolbar and add each toolbar as a panel. you then have full control over what displays and what doesn't when panels are resized etc...
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-09-27 15:35:25
@godrick:

See references:
CalcTextHeight()
CalcTextWidth()

you'll probably want:
MeasureString()


I've struggled to find examples of any of these in an actual javascript to help me use them - if anyone has any js scripts that use these, or have written any js code to facilitate their use, it would be much appreciated if you could post or PM them to me.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-28 11:53:57
Code: [Select]
ww = 0;
wh = 0;
text = "some text and some more text bifsdfsdf sf s fsdfsdf sfsdfsf ";
font = gdi.Font("Segoe UI", 14);
colour = RGB(255,0,0);

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

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

function on_paint(gr) {
    gr.DrawString(text, font, colour, 0, 0, ww, wh, 0);
    line_length = gr.MeasureString(text, font, 0, 0, ww, wh, 0).Width;
    gr.DrawLine(0, 15, line_length, 15, 1, colour);
}
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-09-28 19:34:47
Well, there is AutoitX3 (http://www.autoitscript.com/site/autoit/) and DynamicWrapperX (http://www.script-coding.com/dynwrapx_eng.html) ActiveX components.

With these to components only the sky is the limit. You can send messages, get system handles, create 'AERO' glass and so on.


can i with this addons create a callback for cdrom tray insert and drives changed (for example, inserted usb device, disk to cdrom or hdd)?

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-09-29 11:35:42
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

simple text reader now has a toggle on the right click menu to enable/disable fixed width fonts.

(existing users must extract the marc2003 folder again as well as importing the new script)
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-09-29 21:29:41
i use window.repaintrect with constant size, but cpu loading depends on window size. is it normal?
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-10-03 23:52:51
marc2003, a belated thanks for the script showing MeasureString in actual js use.  I can't thank you enough for the help!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-10-09 09:34:18
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

no changes to scripts but the file foo_allmusic_mod.vbs inside the marc2003 folder has been updated to work with recent changes on the allmusic site. thanks to romor for his original script and providing this fix.
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2012-10-10 07:23:31
GdiDrawText-based text in panels doesn't automatically break words or phrases between e.g. () or "" nicely.
The parentheses and the quotation marks get widowed or orphaned:

Blah blah (
blah) blah.
Flip "flop
" flip flop.

The flag DT_WORDBREAK doesn't seem to handle (some?) glyphs and the like, or is the rub placed somewhere else?
Is it doable in JS or VBS to write a simple function that takes care of these situations?
As far as I can see, MSDN doesn't provide any solutions.
My limited mental capabilities prohibit me from composing a usable search string and google for a solution .

I'm very grateful to marc2003 for especially the Artreader and Allmusic scripts and of course to T.P Wang for making all this possible.
It's great fun reading the WSH fora.
(I'm not a programmer any more, it's 25 years since I made my last endless loop on a mainframe ... this GDI stuff is indeed terra incognita).
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-10-10 08:00:01
in new version (v1.5.5.1) this doesnt work:

Code: [Select]
//GetDeviceInfo by GiveMe9 http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&view=findpost&p=770121
var wbemFlagReturnImmediately = 0x10;
var wbemFlagForwardOnly = 0x20;
//SoundDevice
g_text = "SoundDeviceInfo";
var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2");
var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL",wbemFlagReturnImmediately|wbemFlagForwardOnly); //<<<<<---error there
var enumItems = new Enumerator(colItems);
for (; !enumItems.atEnd(); enumItems.moveNext()){
    var objItem = enumItems.item();
    g_text += "\nProductName:"+objItem.ProductName;
    g_text += "\nstatus:"+objItem.Status;
}
//END_GetDeviceInfo


any way to solve this problem?

also doesnt understand how custom tooltip works - cant put normally string on it
Title: WSH Panel Mod script discussion/help
Post by: Fractal_Mortality on 2012-10-10 13:14:38
With the seemingly apparent death of foo soft Playlists... I'm wondering if any of you WSH script wizards could conjure up an easy way to aggregate a last. Fm user's loved tracks onto a Playlist. I relied heavily on this to as a quick and easy way update my tracks that had not yet been tagged in foobar as loved.
Title: WSH Panel Mod script discussion/help
Post by: romor on 2012-10-10 15:15:00
Here is stylesheet (xspf.xslt) that transforms last.fm XML response to XSPF playlist: view (http://db.tt/oXw2iewA) or download (http://db.tt/Dro9uP9t)

CLI Usage: msxsl lastfm-response.xml xspf.xslt -o lastfm-response.xspf

where lastfm-response.xml is response from i.e.:

Code: [Select]
GET http://ws.audioscrobbler.com/2.0/?method=user.getlovedtracks&user=some_user_name&api_key=some_api_key

Of course it's not limited to just 'user.getlovedtracks' call

Some thoughts:

- obviously there is no other way, except XSPF, to reference tracks w/o providing track location
- foo_softplaylist is the only component able to handle XSPF paired to local library (I've done this in COM server component by iterating library, but it's not that great)
- user has to access menu (load xspf...) and browse to XSPF location, to be able to see result
- I have no idea if msxsl tool comes by default with Windows or I got it from office or by d/l msxml tools, anyway it's not necessary for end user to have this tool, as XSLT can be easily done with WSH, this is just one raw possibility with a small battery inside
- maybe foo_softplaylist developer will wake up in the meantime
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-10-15 09:58:29
GdiDrawText-based text in panels doesn't automatically break words or phrases between e.g. () or "" nicely.
The parentheses and the quotation marks get widowed or orphaned:

Blah blah (
blah) blah.
Flip "flop
" flip flop.

The flag DT_WORDBREAK doesn't seem to handle (some?) glyphs and the like, or is the rub placed somewhere else?


if you're talking about my scripts, then the problem is indeed elsewhere. i'm using the WSH panel mod EstimateLineWrap function which seems to be the cause of this problem. the reason i started using this is to get an accurate height for long bodies of text so i can control when to stop scrolling.
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-10-15 12:18:10
can i get somewhere windows8 metro desktop colors of current user?
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2012-10-15 12:51:05
@marc2003

I am probably doing something stupid, but I cannot get the allmusic script to work even for popular albums that are at the allmusic site. Can you confirm that the actual foo_allmusic_mod.vbs and allmusic.txt scripts in the recent download link of post #1845 are the correct ones and working? I always get [fetching info] followed by [nothing found]. Or do you have any other suggestions or special instructions? The other internet search scripts like musicbrainz.txt & news-reviews-blogs.txt work fine.
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2012-10-15 16:43:51
@marc2003

Thank you for the reply.
Yes, I was talking about your very useful allmusic script; as it by nature is dual mode I have implemented it in two WSH Panel Mod tabs: AMG bio/AMG review). A third tab is used for another of your charms, Musicbrainz Releases.
Offline reading in fb2k is really time-saving!
Getting back on topic: I will dig deeper into allmusic.txt, common4.js, and your modded version of romor's foo_allmusic.vbs to get a better understanding of what's happening. Plus of course the WSH Panel Mod documentation.
I'll be back, as someone once said in a movie.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-10-16 10:47:58
@romka18, maybe utils.GetSysColor(x). x is number, range 0 to 30 i *think*

@WilB, i doubt you're doing anything wrong - it does seem a bit temporamental. all i can suggest is try clearing the IE browser cache through its options and trying again.

@PeteG, in the allmusic script, inside the on_paint function, replace the default: section with this...

Code: [Select]
            gr.GdiDrawText(g_text, normal_font, g_textcolor, 6, 45 - (offset * row_height), ww - 16, text_rows * row_height, DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
            gr.FillSolidRect(0, 0, ww, 45, g_backcolor);
            gr.FillSolidRect(0, wh - 15, ww, 15, g_backcolor);
            gr.GdiDrawText(allmusic_type == 1 ? "Allmusic review" : "Allmusic bio", title_font, g_textcolor_hl, 6, 6, ww - 77, 24, DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
            gr.DrawLine(5, 29, ww - 10, 29, 1, g_textcolor_hl);
            up_btn.draw(gr);
            down_btn.draw(gr);


it seems ok on XP. i can't test on vista/7 at tmoment.
Title: WSH Panel Mod script discussion/help
Post by: deathrune666 on 2012-10-16 17:49:50
hi please could someone post a nice volume bar script?
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2012-10-17 03:52:07
@PeteG, in the allmusic script, inside the on_paint function, replace the default: section with this...

Yes! Colour me impressed! Thank you very much, marc2003.
Your new code snippet is doing the job flawlessly, except for a minor drawback: words compounded with a hyphen - record-making, fine-tuning
- are no longer wrapped after the hyphen, they are sent to the next line as a whole. It's just an observation. I've got precisely what I
asked for and I'm a happy man.
Dare I suggest that you put the new lines in the allmusic scipt, commented out and with a single line of explanation (I mean, why waste good
code)? Or am I the only person on Planet Earth with these nitpicking idiosynchrasies in regard of parentheses and quotation marks?

By the way: I haven't got the faintest idea of what's happing. I can see the difference between the new and the old default: section,
that's all. I have a long piece of homework to do, I guess. In the end DIYing is (well, can be) much more satisfying than begging others for
help. But for now GDI coding is close to Sanskrit in my view; my old arteries a hardening just fine, thank you.

it seems ok on XP. i can't test on vista/7 at tmoment.

On Vista 32-bit and 7 64-bit: Tested & Passed. foobar2000 1.1.15, WSH Panel Mod 1.5.6.
I created two Popup Panels (v0.1.4) each with an instance of WSH PM, one running the old allmusic script, the other the new script.
And did a lot of resizing the panels.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-10-17 10:22:19
i can improve the snippet i posted above. it's bit of an ugly hack but the main thing i wanted to test was appearance. now that's confirmed ok, i'll be updating all my scripts. infact i'm giving them all a major overhaul so it'll be a few weeks before i post the new version.

edit: samples updated with an updated allmusic script. just the marc2003 folder needs extracting. the script in the panel doesn't need updating. thanks to romor again - this is definitely working more consistently than before.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-10-17 13:30:21
Argh - struggling to capture in a js script the maximum pixel resolution of a display.  I thought window.MaxWidth was the correct command, but it returns a nonsensical answer of 2147483647.  I tried window.width and it returns the correct pixel width of my current display window and correctly changes as I resize that window, so I would expect MaxWidth to also return a pixel width.  For what it's worth, window.MaxHeight returns the same value of 2147483647 that I don't understand, while window.Height correctly returns the pixel height of my display window.  Any advice appreciated!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-10-17 13:38:49
use utils.GetSystemMetrics....

Code: [Select]
fb.trace(utils.GetSystemMetrics(16) + "x" + utils.GetSystemMetrics(17));


edit: this only gets the current resolution. i'm not sure if you can query what your monitor actually supports if you're running at a lower res.

window.Width and window.Height are the dimensions of the panel.

window.max/min width/height are for setting the max/min panel heights. this is useful if you want to lock the size.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-10-17 13:49:52
Works great, and thanks for the explanation as well.
Title: WSH Panel Mod script discussion/help
Post by: Gjorgjevski on 2012-10-17 14:18:10
I thought window.MaxWidth was the correct command, but it returns a nonsensical answer of 2147483647.

Heh, it is not really a nonsensical answer. 2 147 483 647 (231 ? 1) is the maximum value that 32-bit signed integer can have
Title: WSH Panel Mod script discussion/help
Post by: romka18 on 2012-10-18 10:21:24
2marc2003
no, GetSysColor() returns this colors:
(http://imageshack.us/a/img705/4479/explcolors.jpg) (http://imageshack.us/photo/my-images/705/explcolors.jpg/)
but i try to get this ones:
(http://imageshack.us/a/img89/332/metrocolorsl.jpg) (http://imageshack.us/photo/my-images/89/metrocolorsl.jpg/)
i searched it in registry but didnt find them.
Title: WSH Panel Mod script discussion/help
Post by: Elevory on 2012-10-19 07:49:41
Is there a script that replicates the information shown by CUI's Status Pane? I'd like to study such a thing for my own learning purposes.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-10-20 09:12:07
Is there a script that replicates the information shown by CUI's Status Pane? I'd like to study such a thing for my own learning purposes.


i've done a close thing for a config, but it's more the status bar than the status pane, get it and check the script here : http://fav.me/d4maqsc (http://fav.me/d4maqsc)
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-11-02 21:19:09
I'm trying to use utils.glob to return directories in a path, instead of files in the path. This appears to be possible based off of the FILE_ATTRIBUTE_DIRECTORY flag, but it doesn't seem to work. I've tried passing:
"C:\\temp\\"
"C:\\temp\\*"
"C:\\temp\\*."
"C:\\temp\\."

etc. and I only get the files in that path, but never the directories in that path which is all I want. I've tried some of the other flags, but still no joy.

Anybody have any ideas?
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-11-03 01:41:51
I don't know of an elegant approach, but a crude method that works is to use utils.glob to grab the full file paths, then whack everything from the right up to the first \ for each array element, and then use a duplicate elimination function borrowed from ojdo's HTPC scripts with which you're probably familiar:
Code: [Select]
function eliminateDuplicates(arr) {
  var i,
      len = arr.length,
      out = [],
      obj = {};

  for (i=0; i<len; i++) {
    obj[arr[i]] = 0;
  }
  for (i in obj) {
    out.push(i);
  }
  return out;
}



Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-03 10:31:27
http://msdn.microsoft.com/en-us/library/e1...v=vs.84%29.aspx (http://msdn.microsoft.com/en-us/library/e1dthkks%28v=vs.84%29.aspx)
Title: WSH Panel Mod script discussion/help
Post by: Gjorgjevski on 2012-11-05 00:19:48
Any idea why I get an “invalid pointer” error on line 19 (http://pastebin.com/waz8PuYV) ever now and then (it has happened 3 times in 2 and a half months)?
Title: WSH Panel Mod script discussion/help
Post by: Manchesterer on 2012-11-05 12:21:58
Help welcome - I recently updated obsolete timer functions in all my scripts, only below script refuses to work when I replace window.CreateTimerInterval with window.SetInterval.
I'm a non-coder, so you're welcome to point out my mistakes, important stuff missing, redundant stuff, runaway timers, endless loops etc.
Code: [Select]
// ==PREPROCESSOR==
// @name "Cover Panel" by Br3tt, mod by Zin-Uru, mod by TEA
// ==/PREPROCESSOR==

var g_tooltip = window.CreateTooltip();
var hover = null;
var g_img = null;

cover = function () {
    this.reset = function () {
        this.x = 0;
        this.y = 0;
    }
    this.update = function () {
        this.x = img_info.x;
        this.y = img_info.y;
    }
    this.swap = function (cover_source) {
        this.image = cover_source.image;
        this.x = cover_source.x;
        this.y = cover_source.y;
    }
}

var covers = Array(new cover, new cover);
var fader = 0;
var alphamax = 255;
var fading_step = 15.0;
var g_timer;
var g_refresh_timer = 40;
var g_metadb;
var is_stream = false;
var is_embedded;
var is_art;
var art_path = "";
var WshShell = new ActiveXObject("WScript.Shell");
var bg_dir = fb.FoobarPath + "\\skin\\";
var id = 0;
var img_info = {x: 0, y: 0, w: 0, h: 0};

function FormatImage(image, iw, ih) {
    if (!image || !iw || !ih) return image;

    var scale_w = ww / image.Width;
    var scale_h = wh / image.Height;
    var scale = Math.min(scale_w, scale_h);
    var pos_x = 0,
        pos_y = 0;
    img_info.w = iw;
    img_info.h = ih;

    if (scale_w < scale_h) pos_y = (wh - image.height * scale) / 2;
    else if (scale_w > scale_h) pos_x = (ww - image.Width * scale) / 2;

    var tmp_img = gdi.CreateImage(img_info.w, img_info.h);
    var gp = tmp_img.GetGraphics();
    gp.DrawImage(image, pos_x, pos_y, image.Width * scale, image.Height * scale, 0, 0, image.Width, image.Height);
    tmp_img.ReleaseGraphics(gp);
    CollectGarbage();
    return tmp_img;
}

function refresh_cover() {
    covers[0].swap(covers[1]);
    covers[1].reset();

    if (fb.PlaybackLength > 0 || !fb.IsPlaying) {
        is_stream = false;

        g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
        if (!g_metadb) {
            on_playback_stop(4);
            return;
        }
        utils.GetAlbumArtAsync(window.ID, g_metadb, 0);

        is_embedded = false;
        if (g_metadb) {
            covers[1].image = FormatImage(utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0), ww, wh, 7, 1, 0);
            g_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
            covers[1].update();
            if (covers[1].image) {
                is_embedded = true;
                is_art = false;
            } else {
                covers[1].image = FormatImage(utils.GetAlbumArtV2(g_metadb, 0), ww, wh, 7, 1, 0);
                g_img = utils.GetAlbumArtV2(g_metadb, 0);
                covers[1].update();
                if (!covers[1].image) {
                    is_art = false;
                    covers[1].image = FormatImage(gdi.Image(bg_dir + "no_cover.jpg"), ww, wh, 7, 1, 0);
                    covers[1].update();
                }
            }
        }

    } else if (fb.IsPlaying && fb.TitleFormat("$right($left(%path%,2),1)").Eval() != ":") {
        is_art = false;
        is_stream = true;
        covers[1].image = FormatImage(gdi.Image(bg_dir + "stream.jpg"), ww, wh, 7, 1, 0);
        covers[1].update();
    }
    window.Repaint();
}

function on_timer(id) {
    if (g_timer) {
        if (id == g_timer.ID) {
            fader = (fader > 0) ? fader - fading_step : 0;
            if (fader <= 0) g_timer && window.KillTimer(g_timer);
            window.Repaint();
        }
    }
}

function on_playback_stop(reason) {
    if (reason == 4 || (reason == 0 && !is_art)) {
        covers[0].swap(covers[1]);
        covers[1].image = FormatImage(gdi.Image(bg_dir + "no_cover.jpg"), ww, wh, 7, 1, 0);
        covers[1].update();
        fader = alphamax;
        g_img = null;
        g_timer = window.CreateTimerInterval(g_refresh_timer);
    }
    if (reason == 1 || reason == 0) {
        refresh_cover();
    }
}

function on_playback_new_track(info) {
    refresh_cover();
    fader = alphamax;
    g_timer = window.CreateTimerInterval(g_refresh_timer);
}

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, 0xFF000000);
    if (fader > 0) covers[0].image && gr.DrawImage(covers[0].image, covers[0].x, covers[0].y, covers[0].image.Width, covers[0].image.Height, 0, 0, covers[0].image.Width, covers[0].image.Height, 0, fader);
    covers[1].image && gr.DrawImage(covers[1].image, covers[1].x, covers[1].y, covers[1].image.Width, covers[1].image.Height, 0, 0, covers[1].image.Width, covers[1].image.Height, 0, 255 - fader);
}

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

function on_item_focus_change() {
    if (!fb.IsPlaying) {
        refresh_cover();
        fader = alphamax;
        g_timer = window.CreateTimerInterval(g_refresh_timer);
    }
}

function on_playlists_changed() {
    if (!fb.IsPlaying) on_item_focus_change();
}

function on_get_album_art_done(metadb, art_id, image, image_path) {
    art_path = image_path;
}

function on_mouse_lbtn_down(x, y) {
    var meta = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

    if (!meta || !is_art) return;
    switch (true) {
    case(art_path == ""):
        break;
    default:
//      WshShell.run('"JPEGView.exe"' + '"' + art_path + '"');
        break;
    }
}

function on_mouse_move(x, y) {
    if (!hover && g_img) {
        g_tooltip.Text = (is_embedded ? "Embedded - " : "External - ") + g_img.Width + " x " + g_img.Height;
        g_tooltip.Activate();
        hover = true;
    }
}

function on_mouse_leave() {
    g_tooltip.Deactivate();
    hover = null;
}
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2012-11-05 15:20:49
here is the modded version with new timer api

Code: [Select]
// ==PREPROCESSOR==
// @name "Cover Panel" by Br3tt, mod by Zin-Uru, mod by TEA
// ==/PREPROCESSOR==

var g_tooltip = window.CreateTooltip();
var hover = null;
var g_img = null;

cover = function () {
this.reset = function () {
this.x = 0;
this.y = 0;
}
this.update = function () {
this.x = img_info.x;
this.y = img_info.y;
}
this.swap = function (cover_source) {
this.image = cover_source.image;
this.x = cover_source.x;
this.y = cover_source.y;
}
}

var covers = Array(new cover, new cover);
var fader = 0;
var alphamax = 255;
var fading_step = 15.0;
var g_timer = false;
var g_refresh_timer = 40;
var g_metadb;
var is_stream = false;
var is_embedded;
var is_art;
var art_path = "";
var WshShell = new ActiveXObject("WScript.Shell");
var bg_dir = fb.FoobarPath + "\\skin\\";
var id = 0;
var img_info = {x: 0, y: 0, w: 0, h: 0};

function FormatImage(image, iw, ih) {
if (!image || !iw || !ih) return image;

var scale_w = ww / image.Width;
var scale_h = wh / image.Height;
var scale = Math.min(scale_w, scale_h);
var pos_x = 0,
pos_y = 0;
img_info.w = iw;
img_info.h = ih;

if (scale_w < scale_h) pos_y = (wh - image.height * scale) / 2;
else if (scale_w > scale_h) pos_x = (ww - image.Width * scale) / 2;

var tmp_img = gdi.CreateImage(img_info.w, img_info.h);
var gp = tmp_img.GetGraphics();
gp.DrawImage(image, pos_x, pos_y, image.Width * scale, image.Height * scale, 0, 0, image.Width, image.Height);
tmp_img.ReleaseGraphics(gp);
CollectGarbage();
return tmp_img;
}

function refresh_cover() {
covers[0].swap(covers[1]);
covers[1].reset();

if (fb.PlaybackLength > 0 || !fb.IsPlaying) {
is_stream = false;

g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (!g_metadb) {
on_playback_stop(4);
return;
}
utils.GetAlbumArtAsync(window.ID, g_metadb, 0);

is_embedded = false;
if (g_metadb) {
covers[1].image = FormatImage(utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0), ww, wh, 7, 1, 0);
g_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
covers[1].update();
if (covers[1].image) {
is_embedded = true;
is_art = false;
} else {
covers[1].image = FormatImage(utils.GetAlbumArtV2(g_metadb, 0), ww, wh, 7, 1, 0);
g_img = utils.GetAlbumArtV2(g_metadb, 0);
covers[1].update();
if (!covers[1].image) {
is_art = false;
covers[1].image = FormatImage(gdi.Image(bg_dir + "no_cover.jpg"), ww, wh, 7, 1, 0);
covers[1].update();
}
}
}

} else if (fb.IsPlaying && fb.TitleFormat("$right($left(%path%,2),1)").Eval() != ":") {
is_art = false;
is_stream = true;
covers[1].image = FormatImage(gdi.Image(bg_dir + "stream.jpg"), ww, wh, 7, 1, 0);
covers[1].update();
}
window.Repaint();
}

function on_playback_stop(reason) {
    if (reason == 4 || (reason == 0 && !is_art)) {
        covers[0].swap(covers[1]);
        covers[1].image = FormatImage(gdi.Image(bg_dir + "no_cover.jpg"), ww, wh, 7, 1, 0);
        covers[1].update();
        fader = alphamax;
        g_img = null;
        g_timer && window.ClearInterval(g_timer);
        g_timer = false;
        g_timer = window.SetInterval(function () {
            fader = (fader > 0) ? fader - fading_step : 0;
            if (fader <= 0) {
                g_timer && window.ClearInterval(g_timer);
                g_timer = false;
            }
            window.Repaint();
        }, g_refresh_timer);
    }
    if (reason == 1 || reason == 0) {
        refresh_cover();
    }
}

function on_playback_new_track(info) {
    refresh_cover();
    fader = alphamax;
    g_timer && window.ClearInterval(g_timer);
    g_timer = false;
    g_timer = window.SetInterval(function () {
        fader = (fader > 0) ? fader - fading_step : 0;
        if (fader <= 0) {
            g_timer && window.ClearInterval(g_timer);
            g_timer = false;
        }
        window.Repaint();
    }, g_refresh_timer);
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, 0xFF000000);
if (fader > 0) covers[0].image && gr.DrawImage(covers[0].image, covers[0].x, covers[0].y, covers[0].image.Width, covers[0].image.Height, 0, 0, covers[0].image.Width, covers[0].image.Height, 0, fader);
covers[1].image && gr.DrawImage(covers[1].image, covers[1].x, covers[1].y, covers[1].image.Width, covers[1].image.Height, 0, 0, covers[1].image.Width, covers[1].image.Height, 0, 255 - fader);
}

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

function on_item_focus_change() {
    if (!fb.IsPlaying) {
        refresh_cover();
        fader = alphamax;
        g_timer && window.ClearInterval(g_timer);
        g_timer = false;
        g_timer = window.SetInterval(function () {
            fader = (fader > 0) ? fader - fading_step : 0;
            if (fader <= 0) {
                g_timer && window.ClearInterval(g_timer);
                g_timer = false;
            }
            window.Repaint();
        }, g_refresh_timer);
    }
}

function on_playlists_changed() {
if (!fb.IsPlaying) on_item_focus_change();
}

function on_get_album_art_done(metadb, art_id, image, image_path) {
art_path = image_path;
}

function on_mouse_lbtn_down(x, y) {
var meta = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

if (!meta || !is_art) return;
switch (true) {
case(art_path == ""):
break;
default:
// WshShell.run('"JPEGView.exe"' + '"' + art_path + '"');
break;
}
}

function on_mouse_move(x, y) {
if (!hover && g_img) {
g_tooltip.Text = (is_embedded ? "Embedded - " : "External - ") + g_img.Width + " x " + g_img.Height;
g_tooltip.Activate();
hover = true;
}
}

function on_mouse_leave() {
g_tooltip.Deactivate();
hover = null;
}
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-11-05 15:43:51
I don't know of an elegant approach, but a crude method that works is to use utils.glob to grab the full file paths, then whack everything from the right up to the first \ for each array element, and then use a duplicate elimination function borrowed from ojdo's HTPC scripts with which you're probably familiar:

I'm very familiar with ojdo's script (the one I'm working on is a HEAVILY modified version of his) but the remove duplicates function wouldn't really work for me. The problem was that I wanted to use wildcards in the folder paths. My use case is that I wanted to be able to detect other versions of an album on my hard drive. My folder naming convention is always the same, but I'll use differentiator tags at the end to denote other things. i.e. %Artist% - 2012 - %Album% [FLAC], etc. I wanted to be able to search for /%artist% - $year(%date%) - %album%*/ but it doesn't appear to be possible with what we have available in WSHPanelMod. I ended up creating a glob list and creating entries for each file type like so: "%artist% - $year(%date%) - %album% [FLAC]/*.flac" and "%artist% - $year(%date%) - %album% [dts]/*.dts" etc. Then if I get files returned from in that folder I know the folder exists.

http://msdn.microsoft.com/en-us/library/e1...v=vs.84%29.aspx (http://msdn.microsoft.com/en-us/library/e1dthkks%28v=vs.84%29.aspx)

How do you use this in WSHPanelMod? Can I just drop that JScript code in? I've never used ActiveX objects before.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-06 09:37:38
sure it works. you just need to disable safe mode in the WSH panel mod preferences. i also modded the script a little as it's meant for web pages. see here:

http://dl.dropbox.com/u/22801321/folder%20list.png (http://dl.dropbox.com/u/22801321/folder%20list.png)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2012-11-06 14:13:54
Wow, that's slick.  I hereby dump the use of my crude method and will use this instead.  Thanks for the suggestion and showing an example, marc2003.
Title: WSH Panel Mod script discussion/help
Post by: Gjorgjevski on 2012-11-06 22:56:04
Does anybody have an answer about this:

Any idea why I get an “invalid pointer” error on line 19 (http://pastebin.com/waz8PuYV) ever now and then (it has happened 3 times in 2 and a half months)?


Is it possible that the window global object is invalid in on_paint(graphics)? If yes, what could cause such behavior?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-07 09:52:55
step 6 from the notes & hints:

Quote
It's better to retrieve window width and height in callback function on_size(), because their values during startup is not reliable.


so i just follow the example that came in the scripts from the component developer....

Code: [Select]
var ww = 0, wh = 0;

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


then use ww & wh as you like in on_paint. never had any problems.
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2012-11-07 23:30:37
@Marc2003

It seems there is no allmusic script at http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-08 09:10:36
indeed. i saw no point in trying to keep up with the original script by romor because that now has it's own caching function. that's the only advantage mine had but now that his does it, there's no point. you'll need the foo_uie_biography component if you want to use it. check the last few pages of that thread for his script/updates.

Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-11-08 10:30:35
indeed. i saw no point in trying to keep up with the original script by romor because that now has it's own caching function. that's the only advantage mine had but now that his does it, there's no point. you'll need the foo_uie_biography component if you want to use it. check the last few pages of that thread for his script/updates.


Thanks to you both for developing your solutions - the review panels are excellent (essential!) additions to foobar. =)
Title: WSH Panel Mod script discussion/help
Post by: ehrgeiz on 2012-11-11 22:20:41
hi, some real great examples here :)

@marc2003: the thumbs script works like a charm for fetching last.fm pics, but if i try to use custom folders there are some hickups: if the path contains some [] i have to envelope it inside single quotation marks and the title formatting does not seem to work at all (at least %path% and %path_sort% i tried).
i'm looking forward to all future updates of your scripts. i'm dreaming about musicbrainz script that shows url-rels for release and release group :3

however thx for all the great examples here and this great component, it's really appreciated

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-13 16:12:01
[] are indeed special characters that need to be wrapped in single quotes. the same applies anywhere else in foobar where title formatting is used. if you want to display them in your title bar or grouping pattern for your playlist, you need to use the single quotes. this script is no different. check the other section of the title formatting help found on the main help menu.

%path% won't work because it points to a file path. use $directory_path(%path%) to get all images in the same folder as the playing/selected file. and it should be fairly obvious why %path_sort% doesn't work. it needs to be a folder path and the script will automatically load all jpg, jpeg, png and gif files contained within.
Title: WSH Panel Mod script discussion/help
Post by: luckynax on 2012-11-14 08:06:23
Hi All,
not sure I'm in the connect forum page, but I have a question/request.

Using the all music script gets me no results, because I name most of my albums (titles) like this example:  "album [Deluxe Edition]"  or "album [Remastered]" or "album [cd release Number e.g. CPC2010]

Is there a way to tell the script to change the query string and ignore the part after "[" ... and search and return only the "album" ?

Thanks for your help
Title: WSH Panel Mod script discussion/help
Post by: Hodge on 2012-11-16 19:51:48
@marc2003

Thanks for all your hard work writing and maintaining these scripts.  Unfortunately, I'm running into errors running your lastfm scripts.  I actually noticed this about a month ago but I held off posting about this until I completed a hardware upgrade and did a clean re-install of Win7Pro x64.  Unfortunately, the problem followed me to the new install

I'm getting the following error whenever I try to initialize any of your lastfm charts:

Code: [Select]
"Scripting Engine Initialization Failed (Last.fm Charts by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error)."


This is what's coming up in the console:

Code: [Select]
Watching: N:\Music\Music
WSH Panel Mod (Now Playing by marc2003): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (Now Playing by marc2003): initialized in 29 ms
WSH Panel Mod (Simple Biography by marc2003): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (Simple Biography by marc2003): initialized in 6 ms
WSH Panel Mod (Last.fm by marc2003): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (Last.fm by marc2003): initialized in 5 ms
WSH Panel Mod (Thumbs by marc2003): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (Thumbs by marc2003): initialized in 3 ms
WSH Panel Mod (News / Reviews / Blogs by marc2003): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (News / Reviews / Blogs by marc2003): initialized in 4 ms
WSH Panel Mod (Last.fm Charts by marc2003): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\common4.js"
Error: WSH Panel Mod (Last.fm Charts by marc2003): Microsoft JScript compilation error:
Syntax error
File: <main>
Ln: 95, Col: 3
<source text only available at compile time>
WSH Panel Mod (Web Links by marc2003, Images by komodomedia.com and mjm716): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\common4.js"
WSH Panel Mod (Web Links by marc2003, Images by komodomedia.com and mjm716): Parsing file "C:\Users\Craig\AppData\Roaming\foobar2000\marc2003\tooltip_buttons.js"
WSH Panel Mod (Web Links by marc2003, Images by komodomedia.com and mjm716): initialized in 6 ms
w7shell: init started
w7shell: GDI+ initialized
w7shell: COM initialized
w7shell: running on Windows NT 6.1.7601 Service Pack 1
w7shell: DWM composition disabled
w7shell: all green
Autoplaylists initialized in: 0:00.294776
"ALL" : 0:00.032938
"CLASSICAL" : 0:00.028919
"FOLK / WORLD" : 0:00.022914
"HIP-HOP / R&B" : 0:00.021197
"JAZZ / BLUES" : 0:00.022458
"RECENTLY ADDED" : 0:00.142174
"ROCK / POP" : 0:00.024107
Startup time : 0:01.567823
w7shell: taskbar button create notification got


I'm up-to-date with wsh panel mode 1.5.6 and running Java 7.  The weird thing is that the scripts seem to work, at first, but then I start getting the errors after re-starting.

I'm totally at a loss as to how to debug this.

Hodge
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-11-17 03:38:51
Simple Biography just started crashing

Code: [Select]
WSH Panel Mod (Simple Biography by marc2003): Parsing file "D:\Apps\No Install\Audio\Players\foobar2000 DUI\marc2003\common4.js"
Error: WSH Panel Mod (Simple Biography by marc2003): Microsoft JScript compilation error:
Syntax error
File: <main>
Ln: 104, Col: 3
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-17 09:47:20
both scripts are working for me still so it might be a temporary glitch at last.fm's end spitting out some data that i'm not handling correctly.

can you both find this line in your scripts....

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


insert a new line before that:

Code: [Select]
fb.trace(filename);


now look in the foobar console and there should be a full path to a .json file. can you send/upload me the contents of the file so i can check it out.

to get things working straight away, you could try deleting all .json files from the wsh_lastfm folder inside your foobar profile. this simply removes all cached files and will force the scripts to fetch updated versions online.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-17 10:53:19
i've just updated all my scripts. http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

note for existing users: all major changes are behind the scenes so if the panels crash, you might need to reset the panel - this will cause per panel settings to be lost (right click>configure>tools>reset default. then close the dialog. right click>properties> clear. finally import the new script).

your last.fm username and autoplaylist configurations are stored separately so won't be affected by this.

a few noticeable changes-
in theory panels won't need updating when i push updates meaning the appearance can be customised by people and you won't have to think about making changes or not updating.
last.fm scripts no longer require an api key. i've supplied one in the script
now playing is a bit different. i'll explain later how to customise panels using multiple elements such as images, cd covers, ratings, buttons etc.
last.fm charts customise the bar colour using the context menu.
thumbs is missing. i'll update that soon.
Title: WSH Panel Mod script discussion/help
Post by: Hodge on 2012-11-17 14:04:58
@marc2003

I've updated your scripts.  Everything works fine except the lastfm scripts.  I just tried logging into my lastfm account through their web page and it looks I'm having problems connecting.  The problem may be on their end and not w/ your scripts...

Sorry if this was a false alarm.  I'll post an update if anything changes.

thanks again,
Hodge
Title: WSH Panel Mod script discussion/help
Post by: Hodge on 2012-11-17 15:16:09
@marc2003

I've confirmed that the problem was on my end...DNS server issues.  Once I changed my DNS server, all of the lastfm scripts started working again!

Anyway,  I really like how these scripts are evolving but I'd certainly love to see more config options for the "now playing" script.

thanks again,
Hodge
Title: WSH Panel Mod script discussion/help
Post by: Reflection on 2012-11-17 19:27:27
now playing is a bit different. i'll explain later how to customise panels using multiple elements such as images, cd covers, ratings, buttons etc.

Cool. I've hacked together my own now playing that adds a little bit of info, I've been using it for a while and it's probably out of date. Anyway, I was just experimenting yesterday trying to get some custom buttons to show up on the right hand side of the shadow part (sort of opposite side of the albume art). No luck yet, but if I'm reading your post right it should be a little easier now?
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-11-18 13:18:52
I like the changes made to the now playing panel. Not sure yet if I like that you moved most code for all samples to common6, seems to make it less convenient to customize it?

Here is how I use your similar artist script by the way (clicking the text sends to autoplaylist called "similar", so I can actually browse my library through it )

(http://i.imgur.com/x79C4.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-19 10:52:55
i was thinking of more simple appearance customisations. what you've done does require a bit more hacking.

i've updated now playing again and have documented how to place panels and buttons etc. adding buttons is a bit more faffing around than i probably implied.

(http://dl.dropbox.com/u/22801321/now%20playing%20with%20buttons.png)


http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt
samples\playback buttons.txt
samples\web links.txt
samples\artreader.txt


edit: bugfix for now playing just uploaded (just incase anyone downloaded in the 15 minutes since i posted- but that's unlikely)
Title: WSH Panel Mod script discussion/help
Post by: z-x on 2012-11-21 00:17:13
Is there a some super-simple playlist script that just shows the groups, album art and titles list? Something very rough. I want to build my own, but it would kickstart me if I've got something to learn on and most of the skins available are too complex to learn from code.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-21 10:28:21
the only person i know of on these boards who has a made a playlist is falstaff and i think his are probably a bit complex to get into. i did start awhile ago but gave up due to the lack of ability on my part. 

samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

added thumbs from my old scripts. it does look a little different but pretty much works the same way.

files changed/added:

Code: [Select]
marc2003\common6.js
samples\thumbs.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-22 10:29:44
samples updated: link/changed files as above post.

bugfix for thumbs: forgot to implement scrolling when in grid mode.

edit: also added some more images so the musicbrainz urls scripts look better on a dark background. existing users just extract the whole marc2003 folder again.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-22 15:28:04
thumbs & now playing updated again. 

because most images are bound to be artist/group pics, they now focus on the top instead of the centre when cropping the image meaning the heads won't get cut off.

i also bodged the musicbrainz images update from earlier on. if anyone downloaded in the few hours since the last update, they need to extract them again.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

files updated:

Code: [Select]
marc2003\common6.js
marc2003\images\myspace.png
marc2003\images\myspace small.png
samples\thumbs.txt
samples\now playing.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-23 10:03:44
added a new script: now playing with last.fm bio

because of the new way i've done my scripts, this only took around 10 new lines of code in the existing now playing panel. hopefully someone a bit more creative with design can make better looking stuff with what i've done. there are a few comments on how to position stuff in the panel.

screenshot: http://dl.dropbox.com/u/22801321/now%20pla...0with%20bio.png (http://dl.dropbox.com/u/22801321/now%20playing%20with%20bio.png)

link as above.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2012-11-23 13:32:36
Now playing with bio crashes at startup, with this code: File:
C:\Users\Cioran\AppData\Roaming\foobar2000\marc2003\common6.js
Ln: 1068, Col: 4
<source text only available at compile time>
ln 1068 is: "this.ratio = Math.min(this.w / this.case_img.Width, this.h / this.case_img.Height)"

Strangely, some of my old panels (the ones on my screenshot a few posts ago) crashes too now (but first when they try to show some info), they use common4.js so I don't know why they crash? Console points to this line in common4.js:
if (this.isVisible()) gr.DrawImage(this.img, this.x, this.y, this.w, this.h, 0, 0, this.img.Width, this.img.Height);

First I was on an old version of the plugin, but now I updated to 1.5.6 with the same error...
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-11-23 14:25:44
I have a WSH script which reads and displays a textfile, here is the header description inside the script:
// Draws "<dir_containing_current_audio_file>\folder.txt" in a "WSH Panel Mod" panel,
// or if "folder.txt" is not present, will draw the first text file in that directory,
// or if no text file exists, will draw some default ASCII Art text.


The WSH textfile viewer does not seem to work any more since the last WSH update - can anyone confirm or have a fix?

thanks much!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-26 09:58:04
@sylla, the lines from both common4 and 6 refer to images that i bundle with the zip. somehow you've lost those from your folder structure?? they are inside the marc2003\images folder.

edit: samples updated. unlikely to affect anyone but now playing with last.fm bio didn't properly update when changes were made to the last.fm username. unlikely to affect anyone as once they've set it, it's unlikely to change but still.... just the script itself needs re-importing.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-27 14:09:25
samples updated again: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

-musicbrainz releases / last.fm:added autoplaylist buttons to scripts to find music in your collection.
-thumbs: forgot to implement cycle mode. 

files changed:

Code: [Select]
marc2003\common6.js
samples\thumbs.txt
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2012-11-28 03:39:46
Just posting to thank you for sharing these scripts.  I've been using the last.fm bio and the now playing ones for a while.

I have a couple questions, though.

1) Some artists seem to make the bio script crash.  I don't know exactly which ones, but so far I've come across _65daysofstatic_ and _...And You Will Know Us by the Trail of Dead_.  It's not every now and then; it crashes reliably every time when I have one of those artists as my active selection.  It says syntax error and points to line 2486 in the common6.js file.  Any idea what might be causing it?

2) How does the rating feature in the now playing script work? I have the playback statistics component installed and I have some songs rated (in the DB, not tags) and the stars in the WSH panel don't do anything when I click them.  However, if I've rated the track previously by using the stars in the playlist column, it shows the rating I gave it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-28 09:36:49
1) can't reproduce.

screenshot (http://dl.dropbox.com/u/22801321/bio%20test.png)

the line you reference is completely unrelated so you must be using a slightly outdated version. next time, can you post what code is on the line you mention.

all i can suggest for now is to browse your foobar profile\wsh_lastfm folder in windows explorer and search for and delete all .json files. this will clear all cached files and force a fresh download.

2) i think perhaps you've customised your context menu to hide the playback statistics\rating entries?? you can leave those settings as they are as i can get around that.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

file changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2012-11-28 21:47:33
I deleted the .json files and it doesn't crash anymore.

And the rating feature works just fine now with that update.  Thank you!
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-11-30 02:50:09
marc2003: the "open image" menu item in your thumbs script has stopped working.

didn't double-click used to open the image too?



thanks for your efforts, i appreciate the work you do and the scripts you share for the foobar2000 community!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-11-30 09:31:05
with my old scripts, a single click used to open the main image. with these updated versions, it now requires a double click. the context menu is working fine for me so it should be working as you expect???

the only instance where double clicking does not work is in grid mode and you have an image overlaid on top of the background thumbnails. because that requires a single click to "close" the image, i've disabled the double click action there.

edit: thinking about it, something may have gone wrong with the file associations on your system. all my script does is launch the full path of the file and it's upto windows to decide what program to use based on the file extension. i'd look into that if i was you.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-12-01 19:12:26
Thanks for the comments. Nothing wrong with file associations. Images open as expected in explorer and elsewhere.

Open containing folder works in the context menu, and I can open images from there.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-03 09:19:45
you can browse the marc2003 folder and edit common6.js in a text editor.

on line 798, replace

Code: [Select]
    this.run = function(command) {
        try {
            this.WshShell.Run(command);
        } catch(err) {
        }
    }


with

Code: [Select]
    this.run = function(command) {
            this.WshShell.Run(command);
    }


see what error you get after saving it and reloading the panel. i'd restore the previous function when done testing as well.
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-12-03 12:45:49
you can browse the marc2003 folder and edit common6.js in a text editor.

on line 798, replace

Code: [Select]
    this.run = function(command) {
        try {
            this.WshShell.Run(command);
        } catch(err) {
        }
    }


with

Code: [Select]
    this.run = function(command) {
            this.WshShell.Run(command);
    }


see what error you get after saving it and reloading the panel. i'd restore the previous function when done testing as well.


Code: [Select]
Error: WSH Panel Mod (Thumbs by marc2003): The system cannot find the file specified.  File: D:\Apps\No Install\Audio\Players\foobar2000 DUI\marc2003\common6.js
Ln: 799, Col: 13

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-04 10:00:28
i think i forgot to handle paths with spaces in, try this.

Code: [Select]
    this.run = function(command) {
        try {
            this.WshShell.Run("\"" + command + "\"");
        } catch(err) {
        }
    }


edit:

samples updated with above fix and also a fix for buggy scrolling behaviour in thumbs script.

http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-12-04 12:34:36
Working, thanks for the fix 
Title: WSH Panel Mod script discussion/help
Post by: morphguy12 on 2012-12-04 21:03:46
Hey marc, definitely loving your samples! 
Just have a quick questions, where would I start if I wanted to attach similar artists' pictures next to the names on your panel?  I would ultimately like it to auto download them as well like your nowplaying panel too.

Definitely appreciate any input / help...  I'll do the dirty work, I just wanted to pick your brain.
Thanks!!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-05 10:17:07
i really don't want to encourage hitting last.fm for loads of artists at once. they've already removed documentation from their api for the artist.getimages method. it still works for now but it's not too encouraging for the future.

i'll explain how to access images you have cached already later. i don't have time right now.

samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

there is now an Online update feature on the context menu. as my scripts all now use an external file for the main code, it can update this when triggered. you will be prompted to restart foobar2000 when the download is complete.

files changed:
Code: [Select]
marc2003\common6.js
samples\*.txt (added version numbers to all panels)

Title: WSH Panel Mod script discussion/help
Post by: morphguy12 on 2012-12-05 13:55:58
gotcha, thanks Marc, I wasn't aware of that.
I only need the top three similar artists though, so if that's too much of a load I'll try and just have it look in the wsh_lastfm folder.

Thanks again!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-07 09:26:53
samples updated: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

thumbs: bug fix, quite a serious one.  all image related context menu items would not show if no images in folder.

files changed:
Code: [Select]
marc2003\common6.js


if you're using a new version of my scripts (since 5th dec), you can use the Online update feature on the context menu to avoid downloading the full zip.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2012-12-08 02:16:06
If this doesn't exist already somewhere let me know and I'll write my own, but does anyone have a ContextMenu setup to do playlist rating?

I'm looking for something like this, but the "Library" menu doesn't have it built in:
(http://img.photobucket.com/albums/v379/Mordred2003/rating.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-08 10:28:52
note for users of my playcount sync script: a "fix" i posted in this thread on the 5th december script broke the library import function. use the Online update option on the context menu to fix it.
Title: WSH Panel Mod script discussion/help
Post by: morphguy12 on 2012-12-09 19:31:29
Hey Marc anyway you've got an extra second to start me off for adding pictures to your similar artists code? 
Also to limit the fetch to just 3 artists with their pictures?

Definitely appreciate any help!
Thanks!
Title: WSH Panel Mod script discussion/help
Post by: neothe0ne on 2012-12-10 00:41:39
So does anyone know why the sample scripts MainMenuManager All-In-One.txt and MainMenuManager.txt do not always give you all the menu options?  The "View" file menu especially cuts off at an arbitrary point somewhere in the middle.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-10 10:18:07
@morphguy12, make sure you download the latest common6.js to your pc. use Online update on the context menu or extract from the full zip (http://dl.dropbox.com/u/22801321/samples.zip) if you don't have that option.

i haven't tested this and also there is quite a major flaw with how i designed my original code for my image scripts. because the artist name source was always your file tags, the case didn't seem important as i thought it was something that isn't going to change. but downloading artist names from last.fm probably isn't going to match your tags 100% of the time.

in your simliar artist panel:

Code: [Select]
images = [];

function on_metadb_changed() {
    if (li.metadb_changed()) {
        //li.metadb returns true or false depending on whether the artist has changed. we don't want to update if the artist hasn't changed.
        images = [];
        files = [];
        for (i = 0; i < Math.min(3, li.items); i++) {
            files[i] = [];
            var folder = p.data_folder + p.eval("$crc32(" + li.names[i] + ")");
            if (p.fso.FolderExists(folder)) files[i] = files[i].concat(utils.Glob(folder + "\\*.jpg").toArray(), utils.Glob(folder + "\\*.jpeg").toArray(), utils.Glob(folder + "\\*.png").toArray(), utils.Glob(folder + "\\*.gif").toArray());
            if (p.fso.FileExists(files[0])) images[i] = gdi.Image(files[0]);
        }
        window.Repaint();
    }
}


then inside the on_paint function, you should have an array called images to use. images[0] being the first, images[1] the second and images[2] the third...

@neothe0ne, never had a problem with the menu not displaying properly.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-10 10:46:12
samples updated: use Online update or download the full package. http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

musicbrainz: bugfix, it never checked for new releases. 

files changed
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: morphguy12 on 2012-12-11 03:32:34
@morphguy12, make sure you download the latest common6.js to your pc. use Online update on the context menu or extract from the full zip (http://dl.dropbox.com/u/22801321/samples.zip) if you don't have that option.

i haven't tested this and also there is quite a major flaw with how i designed my original code for my image scripts. because the artist name source was always your file tags, the case didn't seem important as i thought it was something that isn't going to change. but downloading artist names from last.fm probably isn't going to match your tags 100% of the time.

in your simliar artist panel:

Code: [Select]
images = [];

function on_metadb_changed() {
    if (li.metadb_changed()) {
        //li.metadb returns true or false depending on whether the artist has changed. we don't want to update if the artist hasn't changed.
        images = [];
        files = [];
        for (i = 0; i < Math.min(3, li.items); i++) {
            files[i] = [];
            var folder = p.data_folder + p.eval("$crc32(" + li.names[i] + ")");
            if (p.fso.FolderExists(folder)) files[i] = files[i].concat(utils.Glob(folder + "\\*.jpg").toArray(), utils.Glob(folder + "\\*.jpeg").toArray(), utils.Glob(folder + "\\*.png").toArray(), utils.Glob(folder + "\\*.gif").toArray());
            if (p.fso.FileExists(files[0])) images[i] = gdi.Image(files[0]);
        }
        window.Repaint();
    }
}


then inside the on_paint function, you should have an array called images to use. images[0] being the first, images[1] the second and images[2] the third...

@neothe0ne, never had a problem with the menu not displaying properly.


Thanks so much Marc,
Unfortunately I can't get any images to show under paint no matter what kind of code I put in there,

I'll keep trying, but have any suggestions?

Thanks!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-11 16:18:49
i'll try and test something over the next few days. the reason i didn't test before that is because i don't have any art to test with. i'm behind a proxy so i can't use the program i bundle with my script. i'll have to grab a few images manually.

samples updated: use the Online update feature on the context menu or download the full zip here. http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

last.fm biography: bugfix - last.fm logo button didn't work
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-12 09:32:18
samples updated: use the Online update feature on the context menu or download the full zip here. http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

simple seekbar /  nyan cat seekbar: bugfix - tooltip only worked on first hover then stopped working after mouse had left area.

files changed:
Code: [Select]
marc2003\common6.js


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-13 10:13:29
I'll keep trying, but have any suggestions?


there were loads of errors in that. i tested this one...

http://dl.dropbox.com/u/22801321/morphguy12.txt (http://dl.dropbox.com/u/22801321/morphguy12.txt)

(http://dl.dropbox.com/u/22801321/morphguy12.png)

the placeholder for artists that don't have images should already be on your system as it's bundled in the zip. obviously this was a quick bodge - you can mess around with placement yourself.
Title: WSH Panel Mod script discussion/help
Post by: kaloian79 on 2012-12-13 22:08:38
I have one silly problem - i can't add user picture for genre in the script - now playing with last.fm bio. place help me. tenx.
Title: WSH Panel Mod script discussion/help
Post by: neothe0ne on 2012-12-14 03:28:00
I want to create a button which runs a command from the Edit menu.
e.g., fb.RunMainMenuCommand("Edit/...");

I found plman.SetActivePlaylistContext(), however, I want to set the active focused playlist to a specific viewer.  (I want it to select my SimPlaylist instead of my ElPlaylist).  Is this possible?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-14 09:50:26
I have one silly problem - i can't add user picture for genre in the script - now playing with last.fm bio. place help me. tenx.


i'm not really sure what you're asking. can you clarify?

(I want it to select my SimPlaylist instead of my ElPlaylist).  Is this possible?


simplaylist is default UI only and ELPlaylist is columns UI only. perhaps you meant ESPlaylist?

but i don't even know why i'm asking - it's not possible either way.
Title: WSH Panel Mod script discussion/help
Post by: neothe0ne on 2012-12-14 10:36:19
I exploded my foobar2000 into pieces via Popup Panels but left the main window on Default UI for Facets (unfortunately the instance of Facets has to be recreated in a dozen seconds every time you reopen Facets...)

likewise I was hoping to use SimPlaylist's Search window, because I prefer it's custom search window over the default
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-14 10:42:55
perhaps you could place ELplaylist popup panel over simplaylist to hide it?? probably a bit ugly though.

Title: WSH Panel Mod script discussion/help
Post by: morphguy12 on 2012-12-15 16:30:47
Marc You are awesome!!!
Thanks so much!!

Definitely appreciate it!
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-12-15 17:38:57
marc2003, your thumbs config changed recently. it used to center the image, center the thumbs, add arrows for scrolling through thumbs...

now it's very plain.

any plans on bringing back the nicer version?
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-12-15 22:57:05
also, i'm still having trouble with your biography script crashing now and then. certain artists always make it crash, like Massive Attack and They Might Be Giants...

Code: [Select]
Error: WSH Panel Mod (Last.fm Biography by marc2003): Microsoft JScript compilation error:
Syntax error
File: D:\Apps\No Install\Audio\Players\foobar2000 DUI\marc2003\common6.js
Ln: 2509, Col: 6
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: neothe0ne on 2012-12-16 01:59:04
Is it possible to fb.RunMainMenuCommand while simulating the SHIFT key?

(I can get the behavior by holding SHIFT while clicking the button that does fb.RunMainMenuCommand, but would prefer to "bake" the shift key into the script...)
Title: WSH Panel Mod script discussion/help
Post by: kaloian79 on 2012-12-16 09:22:15
I have one silly problem - i can't add user picture for genre in the script - now playing with last.fm bio. place help me. tenx.


I would like to receive the following:
(http://img98.imageshack.us/img98/475/111vm.jpg) (http://img137.imageshack.us/img137/3295/333ioo.jpg)

this view I made after hard moding kabuki's script. I can not do it on wsh. place help me
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-17 10:24:17
any plans on bringing back the nicer version?


nicer in your opinion.  you can always continue to use the older version if you like. i just won't be updating it.

also, i'm still having trouble with your biography script crashing now and then. certain artists always make it crash, like Massive Attack and They Might Be Giants...


when i test those artists it works so i can only assume your downloaded cache files are corrupted. i need to check these files so find the on_metadb_changed function inside your panel. add this as the first line...

Code: [Select]
p.run("notepad " + p.data_folder + p.eval("$crc32(" + p.artist_tf + ")") + "\\artist.getInfo.json");


copy/paste the contents into [codebox ] tags here.

Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-12-17 12:39:41
i just won't be updating it.


Quick question about your 'text viewer' script - is there a way to use wildcard with it, e.g. path/*.txt ?

thanks in advance!
Title: WSH Panel Mod script discussion/help
Post by: garbanzo.bean on 2012-12-17 12:45:51
also, i'm still having trouble with your biography script crashing now and then. certain artists always make it crash, like Massive Attack and They Might Be Giants...


when i test those artists it works so i can only assume your downloaded cache files are corrupted. i need to check these files so find the on_metadb_changed function inside your panel. add this as the first line...

Code: [Select]
p.run("notepad " + p.data_folder + p.eval("$crc32(" + p.artist_tf + ")") + "\\artist.getInfo.json");


copy/paste the contents into [codebox ] tags here.


nothing happened but i found the file for Massive Attack. it was blank. so i deleted it and reloaded the panel, now it works.

thanks!

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-18 10:10:58
samples updated: use the Online update feature on the context menu or download the full zip here. http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

last.fm bio: better error handling. now prompts you to re-download if errors are encountered.
musicbrainz: now uses the json webservice instead of xml. you can delete all xml files from your profile\wsh_lastfm folder to tidy up.
simple text reader: added support for wildcards. it now supports the reading of txt and log files if you specify just the folder.

files changed:
Code: [Select]
marc2003\common6.js

Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2012-12-18 12:43:12
samples updated:
simple text reader: added support for wildcards. it now supports the reading of txt and log files if you specify just the folder.


with support like this, where's the 'donate' button?!
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2012-12-18 17:09:22
Quick question re. the "thumbs" script - it doesn't work and produces an error message in Foobar:

Scripting Engine Initialization Failed (Thumbs v6.2012-12-05.01 by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

The only thing that I can see is that in the script, it has a line:

// @import "%fb2k_profile_path%marc2003\common6.js"

Whereas in the marc2003 directory, there are only common2, common3 and common4.js files.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-12-18 22:32:45
Extracampine, you will find this file in the download Marc posted above. Just put it where the common4.js is and you're good.

Marc, once again I have to ask for your help in adjusting the row height in the new common6.js please. I produce nothing but errors :S
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-19 09:43:31
@extracampine, i'd extract the whole marc2003 folder again. a few images have been renamed/added since.

@Emerelle, i'd recommend not editing common6.js itself otherwise you wouldn't be able to update it without having to edit it everytime.

but assuming you mean for the last.fm bio/text reader, you can add this to your panel... this needs to go after the first line var p = new panel....

Code: [Select]
p.row_height = 26;


change 26 to whatever you like. the one downside to editing here is that if you change your font through the foobar preferences, this setting would revert to my default and you'd have to reload the panel.

if you meant row height for scripts with lists in like last.fm charts/similar artist/musicbrainz etc, you add these 2 lines to the on_size function in your panel. make sure they go after li.size();

Code: [Select]
li.row_height = 20;
li.rows = Math.floor((li.h - 30) / li.row_height);


only edit the value of 20 on the first line.

edit: i forgot to mention you need to get the latest update for the list edit to work. use Online update on the context menu.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2012-12-19 12:39:52
Thanks so much Marc, you are always so helpful. Chaning just the row height in bio panel will do.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-20 10:07:06
samples updated: use the Online update feature on the context menu or download the full zip here. http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

musicbrainz: bugfix. would crash if artist not found
last.fm - similar artists - top tags - top fans - top albums - top tracks: bugfix. would display info from previous artist if switching to an artist that doesn't have it's own info.
last.fm bio / simple text reader / now playing with last.fm bio: bugfix. text wouldn't update properly after changing font through the main preferences.

files changed:
Code: [Select]
marc2003\common6.js


@Emerelle. using this latest version, your custom line spacing should now stick even after changing fonts.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-21 10:12:08
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

new script: simple image viewer

these are the available options on the context menu.

(http://dl.dropbox.com/u/22801321/simple%20image%20menu.png)

it defaults to using the same folder as the playing/selected file for the source but you can change this using any title formatting you like. only specify the path to a folder. it will display all jpg/jpeg/png/gif files inside. you can scroll the images using your mouse wheel or by clicking the panel.

files added/changed:
Code: [Select]
marc2003\common6.js
samples\simple image viewer.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-21 14:17:15
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

artreader / simple image viewer: now has 2 crop options. one focuses on the centre of the image and the other focuses on the top.

files changed:
Code: [Select]
marc2003\common6.js
samples\artreader.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-22 11:50:32
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

for new users, an overview of the scripts contained in the package (skip to page 2):

http://dl.dropbox.com/u/22801321/wsh/samples%20readme.pdf (http://dl.dropbox.com/u/22801321/wsh/samples%20readme.pdf)

simple image viewer: display a message when no images are found. before you'd see a blank a panel.
samples readme: added how you can help yourself and me if you find errors.

files updated:
Code: [Select]
marc2003\common6.js
samples\simple image viewer.txt
samples readme.pdf


all scripts now display their version in the foobar2000 console. you can check the latest versions here-

http://dl.dropbox.com/u/22801321/wsh/versions.txt (http://dl.dropbox.com/u/22801321/wsh/versions.txt)

as most code is inside common6.js which can be updated via the right click Online update option, these will rarely if ever change assuming i don't find any more bugs.
Title: WSH Panel Mod script discussion/help
Post by: Koyber on 2012-12-22 14:59:56
Hi Marc, is it possible to make a script like the one for musicbrainz, but instead using discogs?
Title: WSH Panel Mod script discussion/help
Post by: ngonngon on 2012-12-24 10:01:05
I have a problem with foo_uie_wsh_panel_mod. Some of my pictures embed in the song files are shown but some are not. What is the reason for that?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-24 11:02:07
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

new script: discogs

this is a quick and dirty bodge so report any bugs. it only contains master releases and will only display the first 100. i won't be adding support for pagination.
i looked at using releases to get more results but that can return thousands of hits for popular artists so i ditched that idea...

(http://dl.dropbox.com/u/22801321/discogs.png)

files added/changed:
Code: [Select]
marc2003\common6.js
samples\discogs.txt


@ngonngon, use utils.GetAlbumArtEmbedded to always prefer embedded art. using the other methods, the core artreader may decide other images are better.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2012-12-26 00:23:33
Hi everyone. Quick question about WSH Coverflow :

How can I increase the size of the font that displays the %album artist% - %album% information, without going through foobar's prefs > colors and fonts ?
I don't mind hardcoding that size in the script. I just need to know what to type and where to type it. Thank you. 

Optionally, how can I set that same font to bold ? (within the script too).
Title: WSH Panel Mod script discussion/help
Post by: Koyber on 2012-12-26 20:55:28
Thanks marc2003! That's pretty much what I wanted.
There is just one thing I've changed (I can understand code but not write it ). I think because you are showing master releases, there is no need for showing the format of the release, because although it could say "vinil" it shows only the format of the oldest release (and the country of the publisher), not the other ones.
For me this is perfect to see if there are new releases from an artist, the format its not really so much important. Well, if I could see if it's an EP or a complete album it would be great, but I don't know how to do that hehe.

Thanks for your time again
Title: WSH Panel Mod script discussion/help
Post by: onv on 2012-12-26 23:12:36
Hi everyone. Quick question about WSH Coverflow :

How can I increase the size of the font that displays the %album artist% - %album% information, without going through foobar's prefs > colors and fonts ?
I don't mind hardcoding that size in the script. I just need to know what to type and where to type it. Thank you. 

Optionally, how can I set that same font to bold ? (within the script too).

F.e. :
Code: [Select]
function get_font() {
    if (g_instancetype == 0) {
//        g_font = window.GetFontCUI(FontTypeCUI.items);
        g_font = gdi.Font("Segoe UI", 24, 1); // or any other
        g_font_headers = window.GetFontCUI(FontTypeCUI.labels)
    } else if (g_instancetype == 1) {
        g_font = window.GetFontDUI(FontTypeDUI.playlists);
        g_font_headers = window.GetFontDUI(FontTypeDUI.tabs)
    }
};
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2012-12-27 01:19:14
Thanks onv ! Will try that !
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-27 09:26:41
I think because you are showing master releases, there is no need for showing the format of the release, because although it could say "vinil" it shows only the format of the oldest release (and the country of the publisher), not the other ones.


makes sense. i've removed it now. use Online update on the context menu to update the script.

edit: the Online update option has now been renamed to Script update. i changed it because some scripts have an Update (as in content) option and they might be confusing when seen together.
Title: WSH Panel Mod script discussion/help
Post by: kaloian79 on 2012-12-28 20:07:51
I have one silly problem - i can't add user picture for genre in the script - now playing with last.fm bio. place help me. tenx.


marc2003 I could deal with problem alone which I have described before, by modifying lines in your "Now Playing with Last.fm Bio" script:

var genre = encodeURIComponent(p.eval("%genre%"));      
b.buttons.but9 = new button(p.w - 540, 560, 544, 166, {normal: genre+".png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic);

but now I have another problem - when genre style of two words like - smooth jazz -> genre image not displayed. Please help me.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-29 10:02:01
replace %genre% with $meta(genre,0)

0 is the first value, 1 is the 2nd and so on

http://wiki.hydrogenaudio.org/index.php?ti...a.28name.2Cn.29 (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference#.24meta.28name.2Cn.29)

also, you probably don't need encodeURIComponent there. you only need that if putting in genre as part of a link to a website.
Title: WSH Panel Mod script discussion/help
Post by: kaloian79 on 2012-12-29 13:44:49
You're the top, thank you very much. Merry Christmas and Happy New Year from me
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2012-12-30 15:01:29
@extracampine, i'd extract the whole marc2003 folder again. a few images have been renamed/added since.


Thanks - you mean download the file from here:

http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)

And install again? I did this but it didn't change anything. I already had the latest version installed I think.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2012-12-31 09:34:23
no i meant from my samples.zip download (it contains a folder named marc2003 as per my instruction above). you've already downloaded it because the script in your panel comes with it....

but here's the link incase you need it again... http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-02 09:34:49
samples updated: use the Update script option on the right click menu or the full download is in the link above.

last.fm - similar artists - top tags - top fans - top albums - top tracks: spotify wouldn't launch due to typos in script. 

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: sym7 on 2013-01-03 08:27:13
I'm really new when it comes to this but I edited together some scripts I found here and made some buttons. They work great except I can't figure one button out. Ideally, this button would send Last.fm a 'loved track' signal using softplaylists and also rate it 5 stars using playback stats. Is that even possible to do two commands?

I found this over in the softplaylists thread but it isn't working for me, nothing shows up in console when I press it either.

Code: [Select]
fb.RunContextCommand("Last.fm/Last.fm Love '" + fb.TitleFormat("%title%").Eval() + "' By '" + fb.TitleFormat("%artist%").Eval() + "'");

Here's the full code I'm using.
http://pastebin.com/wwVwcCmA (http://pastebin.com/wwVwcCmA)

Here's what it looks like. (Buttons on the right)
http://i.imgur.com/2Thw3.jpg (http://i.imgur.com/2Thw3.jpg)

Also! Two of the buttons are for switching DSP modes, is it possible to combine them into one? Up state would be my Gapless DSP (like a default) and the Down state would be my Headphone DSP. Maybe I'll save that for another day and see if I can get the Love track to work first.

Thanks you guys! 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-03 10:43:37
you typically process mouse click events on up, not down. also, you need quite a few more callbacks in there....

Code: [Select]
metadb = fb.GetFocusItem();

function on_selection_changed() {
    on_item_focus_change();
}

function on_playlist_switch() {
    on_item_focus_change();
}

function on_playback_new_track() {
    on_item_focus_change();
}

function on_item_focus_change() {
    //prefer playing item if playing. use selected item if playback is stopped.
    metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
}


then inside your click function

Code: [Select]
if (!metadb) return;
var artist = fb.TitleFormat("%artist%").EvalWithMetadb(metadb);
var title = fb.TitleFormat("%title%").EvalWithMetadb(metadb);
fb.RunContextCommandWithMetadb("Last.fm Love Track '" + title + "' by '" + artist + "'", metadb);
//more code to run other functions here


you can't check the DSP so it's not really possible to make a proper toggable button. you could try and bodge something by storing the state manually (see window.GetProperty and window.SetProperty) but this wouldn't update if that setting was changed via the menu/preferences.
Title: WSH Panel Mod script discussion/help
Post by: sym7 on 2013-01-03 21:46:44
Thanks Marc, you're a lifesaver! Works great. I'll probably be back when I inevitably have more trouble.

Edit: Too bad about the toggle, not really a big deal though. I'll keep it as two buttons.
Title: WSH Panel Mod script discussion/help
Post by: extracampine on 2013-01-04 08:58:12
Thanks once again Marc, I've got it up and running again. The thumbs script seems to show the thumbs without any space between them, and sometimes they overlap. Any idea how to fix this? I tried the "simple image viewer" script - this looks good, but it won't seem to show all the art in the directory at the same time - only one image at a time.

Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-04 10:08:12
the images do not overlap. they're just cropped to be square.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-05 10:00:19
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

new script: now playing with track list



you can hack around around and change the title formatting on lines 137-140.

files added/changed:
Code: [Select]
marc2003\common6.js
samples\now playing with track list.txt

Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2013-01-05 12:27:26
things it can't do-
everything else


from playcount, appears to be your album of the year - admit it though, you're just hot for Natasha

here's to a foobar rich 2013
Title: WSH Panel Mod script discussion/help
Post by: Yeksfys on 2013-01-06 20:15:41
Marc2003 you thought of making lyrics in wsh panel?
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2013-01-07 03:03:48
Oh yes, a simple lyrics panel in the look of your other panels (bigger and underlined font at the top) would be really great, Marc.

Perhaps something like this:

(http://www.abload.de/img/wsh-lyrics-panel_examchl44.png) (http://www.abload.de/image.php?img=wsh-lyrics-panel_examchl44.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-07 09:30:27
Marc2003 you thought of making lyrics in wsh panel?


nope. i have no interest in lyrics at all.

also, falstaff has already created a lyrics panel. search the thread - it's in here somewhere.
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-01-09 02:38:03
Hey marc, is there any easy way to remove the cover art and playback buttons from the now playing script (the regular one, not the one with bio or track list) so I can display the artwork in a separate panel and give more room for the artist name and track titles?

I tried editing some of the code myself but couldn't quite figure it out.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-09 09:45:45
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

new script: ok, so i changed my mind and made a simple tag reader. displays mutli-line tags in panel. looks a bit like Bollerkopp's screenshot above.

(http://dl.dropbox.com/u/22801321/simple%20tag.png)

files changed/added:
Code: [Select]
marc2003\common6.js
samples\simple tag reader.txt


tip: you can edit my now playing with last.fm bio panel to replace the bio with the tag display simply by editing the code on line 12

change this...

Code: [Select]
var p = new panel("Now Playing with Last.fm Bio", ["lastfm_bio", "remap", "cd", "images"]);


to

Code: [Select]
var p = new panel("Now Playing", ["simple_tag", "remap", "cd", "images"]);


@Reith. http://dl.dropbox.com/u/22801321/now%20playing%20mod.txt (http://dl.dropbox.com/u/22801321/now%20playing%20mod.txt)
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2013-01-09 18:03:28
Hey marc2003,

wow... that is really great. Thank you very much for this tag reader script. And for your general work here of course.
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-01-09 23:57:02
Thanks, it works great.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-10 09:37:42
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

bugfix: addition of simple tag reader script yesterday caused my simple text reader script to break. 
new: simple text reader now has a customisable title like the tag reader.
misc: now playing with tracklist. code tidyup.

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing with tracklist.txt
samples\simple tag reader.txt
samples\simple text reader.txt


you can check the latest versions of all scripts here: http://dl.dropbox.com/u/22801321/wsh/versions.txt (http://dl.dropbox.com/u/22801321/wsh/versions.txt)
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2013-01-10 21:39:35
Awesome new samples Marc! Many thanks for the new sample and changing your mind

One more question about adjusting the tag script...if I want to have a transparent background, I tried disabling the line "p.draw_background(gr);" but that seems to break the script. In the simple text reader script this worked for me though.
Any quick way to make the background transparent?

Again, many thanks for your hard work, love all of your samples.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-11 09:13:47
Quote
I tried disabling the line "p.draw_background(gr);" but that seems to break the script.


are you sure?    add double backslashes to comment it out and the text should turn green in the editor. or just delete it....
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2013-01-11 10:20:42
I always use double slash for commenting things out - the panel turned white causing me thinking I broke it with the comment; anyways I only forgot to tick "transparent background" in the editor - sorry mate!!
Title: WSH Panel Mod script discussion/help
Post by: Yeksfys on 2013-01-14 14:38:45
marc2003 this can serve to "Custom folder" in your scripts. 

Code: [Select]
//Flags  http://msdn.microsoft.com/en-us/library/bb773205.aspx
var BROWSEINFO_FLAG = 0x00000010 // BIF_EDITBOX

function showFolderDialog() {
    var shell = new ActiveXObject("Shell.Application");
    var folder = shell.BrowseForFolder(0, "Select the folder", BROWSEINFO_FLAG);
    
    if (folder == null) {
        return;
    }
    
    return folder.items().item().path;
}

fb.trace(showFolderDialog());
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-15 09:26:49
nice, i didn't know you could do that sort of thing.

but it's not really any use for my scripts because it would be extremely rare for anyone to specify a hardcoded single folder. most people will be using foobar2000 title formatting so the folder names are dynamic based on track metadata.
Title: WSH Panel Mod script discussion/help
Post by: motorhorst on 2013-01-16 11:36:37
I have an idea for a script but I'm not sure if this is possible, maybe someone could comment on that.

I keep my playlists in a central container (e.g. a dropbox folder) and would like to use them on several computers (filepaths / libraries are the same on all machines).

I'd like a script that lists all playlists in that folder. By clicking on one of these files in foobar that list should be added as a playlist (and played, but that isn't the most important part).

As far as I see it, I need these functions:
- Read all files in a directory/folder
- File > Load Playlist after clicking the title of one file (something like fb.RunMainMenuCommand with the selected playlist as filename).

Is that possible?
Title: WSH Panel Mod script discussion/help
Post by: motorhorst on 2013-01-16 16:58:22
Version 2:

There is another way how I could tackle my problem.
I can get my playlists via a web service (they're saved to a mysql-Database).

Then I could create a new playlist and add all the items sent as json.

In this case the functions I need are:
- Create a new playlist
- Add items to a specific playlist.

Is this possible? Easier than my first request?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-17 09:32:34
i'm not sure why you don't get dropbox to monitor your normal playlists folder? then you can use the default playlist manager??? 

but if you really want to add a new playlist....

Code: [Select]
fb.RunMainMenuCommand("New playlist");


then look at utils.glob for getting all files from a folder into an array. then loop through the array for displaying and mouse click code. then run foobar2000.exe with the /add parameter to the full path of one of your playlists.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-17 09:36:38
samples updated: use Update script on the context menu or the full download is here: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

last.fm charts: fix crash when switching between populated and empty feeds.
artreader / simple image viewer: open containing folder did not work when path had spaces in. 

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: motorhorst on 2013-01-17 12:20:19
i'm not sure why you don't get dropbox to monitor your normal playlists folder? then you can use the default playlist manager??? 


Hi marc,
great idea, maybe too obvious for me...
Part 1 on computer 1 worked fine, I just have to check at home how it works out.

Edit/Resolved
Does anyone know where playlist organizer saves changes to folders, structures, order? Also in the playlists folder or somewhere else?
Answer: It's stored in theme.fth


Thanks for your help!
Title: WSH Panel Mod script discussion/help
Post by: MDMA on 2013-01-17 12:59:24
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

new script: discogs

this is a quick and dirty bodge so report any bugs. it only contains master releases and will only display the first 100. i won't be adding support for pagination.
i looked at using releases to get more results but that can return thousands of hits for popular artists so i ditched that idea...

(http://dl.dropbox.com/u/22801321/discogs.png)

files added/changed:
Code: [Select]
marc2003\common6.js
samples\discogs.txt


@ngonngon, use utils.GetAlbumArtEmbedded to always prefer embedded art. using the other methods, the core artreader may decide other images are better.



You are a hero, thanks so much for this!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-19 11:23:16
samples updated: use Update script on the context menu or the full download is here: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

news/reviews/blogs: fix ugly text drawing bug
last.fm similar artists: the top tags feed now has autoplaylist buttons to search your library for matching files against genre tags.

files changed:
Code: [Select]
marc2003\common6.js


although i try not to change panel scripts very much (as most code is in the common file), i've made a few minor changes over the last few days. you can check the versions here: http://dl.dropbox.com/u/22801321/wsh/versions.txt (http://dl.dropbox.com/u/22801321/wsh/versions.txt)

Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-20 17:55:45
Hey guys, would really appreciate some help. I've updated from 1.3.x to the current version and two panels stopped working for me (aw crashed), volume and seekbar.
Maybe somene can quickly glance over it and find the corrupt code?
Code: [Select]
// Knob button by Br3tt
// Modified by T.P Wang

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

var g_drag = false;
// foobar path, SHOULD be replaced
var g_btn_img1 = gdi.Image(fb.ComponentPath.replace("components","images") + "curacao/bt/volbutton50.png");
var g_btn_img2 = gdi.Image(fb.ComponentPath.replace("components","images") + "curacao/bt/voldot.png");

var g_angle = 270;
var g_R = 12;

function calc_theta(x,y){
x = x - 25.5;
y = y - 25.5;
theta = Math.atan2(y,x) / Math.PI * 180;
if (theta <= 90 && theta > 45)
return g_angle;
if (theta > 90 && theta < 135)
return 0;
if (theta >= 0) {
if (theta > 90)
return theta - 135;
else
return theta + 225;
} else {
return theta + 225;
}
}

function on_paint(gr){
ww = window.Width;
wh = window.Height;
theta = (Math.pow(10, fb.Volume / 50) - 0.01) / 0.99 * g_angle;
// Volume 'Round Button' by Br3tt (13-08-2008)
posA = (theta - 45) * Math.PI / 180;
cosinusA = Math.cos(posA);
sinusA = Math.sin(posA);
posX = 25 - (cosinusA * 12) - 4 ;
posY = 25 - (sinusA * 12) - 4 ;
gr.FillGradRect( 0, 0, ww, wh, 90, RGB(042,042,047), RGB(042,042,047));
gr.DrawImage(g_btn_img1,-4,-4,55,55,0,0,55,55);
gr.DrawImage(g_btn_img2,posX,posY,5,5,0,0,5,5);
}

function on_mouse_lbtn_down(x,y){
g_drag = true;
}

function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = false;
}

function on_mouse_move(x,y){
if (g_drag){
// Calc Volume
d = calc_theta(x,y) / g_angle;
v = 50 * Math.log(0.99 * d + 0.01) / Math.LN10;
if (fb.Volume != v)
fb.Volume = v;
}
}

function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}

function on_volume_change(val){
window.Repaint();
}

//EOF


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;

var g_btn_img1 = gdi.Image(fb.ComponentPath.replace("components","images") +

"curacao/bt/seeker10.png");

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_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;

ww = ww-20;

if(length > 0){
if(g_drag){
pos = ww * g_drag_seek;
txt = "Seek " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt

(length) + 00;
}
else{
pos = ww * (fb.PlaybackTime / length) + 00;
txt = g_titlefmt.Eval();
}
}

// background
gr.FillGradRect( 0, 0, window.Width+2, window.Height+2, 90, RGB(042,042,047), RGB

(042,042,047));

gr.FillGradRect( 11, 04, window.Width-22, 3, 90, RGB(0,0,0), RGB(0,0,0));

// orange progress bar
//gr.FillGradRect( 10, 04, pos+1, 3, 90, RGB(220,155,75), RGB(080,055,25));
//blue progress bar
gr.FillGradRect( 10, 04, pos+1, 3, 90, RGB(035,145,255), RGB(025,055,080));
//green progress bar
//gr.FillGradRect( 10, 04, pos+1, 3, 90, RGB(055,255,055), RGB(065,080,065));

gr.FillGradRect( 10, 03, window.Width-20, 1, 90, RGB(010,010,010), RGB(010,010,010));

gr.FillGradRect( 10, 08, window.Width-20, 1, 90, RGB(070,070,070), RGB(070,070,070));
gr.FillGradRect( 09, 04, 1, 4, 90, RGB(000,000,000), RGB(000,000,000));
gr.FillGradRect( window.Width-10, 4, 1, 4, 90, RGB(060,060,060), RGB(060,060,060));

gr.DrawImage(g_btn_img1,pos+2,1,17,17,0,0,17,17);

}

function on_size(){
}

function on_focus(gr){
//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){
x = x-10;
g_drag = 0;
g_drag_seek = x / (window.Width-20);
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){
x = x-10;
g_drag_seek = x / (window.Width-20);
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
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-21 10:07:24
i can't see anything in the code that wouldn't work in new versions. are you sure you have the external images in the right place?
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-21 16:46:31
i can't see anything in the code that wouldn't work in new versions. are you sure you have the external images in the right place?

Yes, nothing changed except the update of wsh plugin and I just rechecked with another path. I found the same knob script posted by Wang somewhere earlier in the thread and strangely it works (despite being the same). No luck with seekbar though
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-22 10:20:51
i just tested both and they work fine if i comment out the lines in on_paint which draw the images (because i obviously don't have them).
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-22 11:17:21
i just tested both and they work fine if i comment out the lines in on_paint which draw the images (because i obviously don't have them).

I'll try again, sorry if that was indeed the mistake, quite dumb from me then 

br3tt, while I was trying to fix the seekbar I've tried all your other configs and now spending quite some time tinkering with foorazor which uses most of the scripts you posted here before. Is it possible in your WSH Playlist Viewer v2.1.0 to collapse non active groups (like elplaylist does) and is it possible to add an A-Z quick jump browser with WSH?


and I guess it's impossible to chande DUI's color of splitters/tabs/etc? It's controlled by OS?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-22 11:23:39
and I guess it's impossible to chande DUI's color of splitters/tabs/etc? It's controlled by OS?


right. but you can get 3rd party themes. check somewhere like deviantart.com
Title: WSH Panel Mod script discussion/help
Post by: antheo on 2013-01-22 17:22:15
@ marc2003, Falstaff or someone, could you please help me a simple script using WSH panel mod which can make an image (like a vinyl disc) rotate/stop when playing/stopping a song? thank you in advance. 
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-22 19:31:37
antheo

Here's very simple script for rotating image on playback time.

Code: [Select]
var image = gdi.Image(fb.FoobarPath + "images\\vinyl.jpg");
var angle = 0;

function on_paint(gr) {
   
    gr.DrawImage(image, 0, 0, 500, 500, 0, 0, image.width, image.height, angle);

}
function on_playback_time(time){
   
    if(angle >= 360) angle = 0;
    angle += 60;
    window.Repaint();   
   
}

I tested it with this Vinyl image (http://www.senpaigamer.com/sites/default/files/news/sony/2012/03/21-black-panther-yakuza-2-ashura-original-vinyl-record-3.jpg)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-01-22 20:31:46
too slow
Title: WSH Panel Mod script discussion/help
Post by: antheo on 2013-01-23 06:02:38
antheo

Here's very simple script for rotating image on playback time.

Code: [Select]
var image = gdi.Image(fb.FoobarPath + "images\\vinyl.jpg");
var angle = 0;

function on_paint(gr) {
   
    gr.DrawImage(image, 0, 0, 500, 500, 0, 0, image.width, image.height, angle);

}
function on_playback_time(time){
   
    if(angle >= 360) angle = 0;
    angle += 60;
    window.Repaint();   
   
}

I tested it with this Vinyl image (http://www.senpaigamer.com/sites/default/files/news/sony/2012/03/21-black-panther-yakuza-2-ashura-original-vinyl-record-3.jpg)


Thank ExtremeHunter so much for this script, I already tested it but as Falstaff said it too slow, could you give me a little time to make it rotate faster? (at least 12 frames/per second).
Here is my skin and I like to update it with a vinyl disc rotate as a new visualization
(http://i341.photobucket.com/albums/o396/htlogo2008/main_zpsdc3d0ba6.png)

Anyways, thank you again and look for your help.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-23 09:00:08
Ok here's the faster one with timer .

Play with the values to make it faster/slower.

Code: [Select]
var vinylImage = gdi.Image(fb.FoobarPath + "images\\vinyl.jpg");
vinylImage = vinylImage.resize(300, 300);
var angle = 0;

var vinylX = 20;
var vinylY = 20;
var vinylW = vinylImage.width;
var vinylH = vinylImage.height;

function on_paint(gr) {

    gr.DrawImage(vinylImage, vinylX, vinylY, vinylW, vinylH, 0, 0, vinylW, vinylH, angle);

}

var rotationInterval = 50;
var rotationTimer;
var rotationTimerStarted = false;

function onRotationTimer() {

    if (!rotationTimerStarted) {

        rotationTimer = window.SetInterval(function () {

            if (angle >= 360) angle = 0;
            angle += 10;
            window.RepaintRect(vinylX, vinylY, vinylH, vinylH);

        }, rotationInterval);



        rotationTimerStarted = true;
    }

}

function stopRotationTimer() {

    window.ClearInterval(rotationTimer);
    rotationTimerStarted = false;

}

function on_playback_stop(reason) {

    if (reason != 2) {

        stopRotationTimer();

    }

}

function on_playback_pause(state) {

    if (state) stopRotationTimer();
    else onRotationTimer();

}

function on_playback_new_track() {

    onRotationTimer();

}
Title: WSH Panel Mod script discussion/help
Post by: antheo on 2013-01-23 09:57:01
Ok here's the faster one with timer .

Play with the values to make it faster/slower.

Code: [Select]
var vinylImage = gdi.Image(fb.FoobarPath + "images\\vinyl.jpg");
vinylImage = vinylImage.resize(300, 300);
var angle = 0;

var vinylX = 20;
var vinylY = 20;
var vinylW = vinylImage.width;
var vinylH = vinylImage.height;

function on_paint(gr) {

    gr.DrawImage(vinylImage, vinylX, vinylY, vinylW, vinylH, 0, 0, vinylW, vinylH, angle);

}

var rotationInterval = 50;
var rotationTimer;
var rotationTimerStarted = false;

function onRotationTimer() {

    if (!rotationTimerStarted) {

        rotationTimer = window.SetInterval(function () {

            if (angle >= 360) angle = 0;
            angle += 10;
            window.RepaintRect(vinylX, vinylY, vinylH, vinylH);

        }, rotationInterval);



        rotationTimerStarted = true;
    }

}

function stopRotationTimer() {

    window.ClearInterval(rotationTimer);
    rotationTimerStarted = false;

}

function on_playback_stop(reason) {

    if (reason != 2) {

        stopRotationTimer();

    }

}

function on_playback_pause(state) {

    if (state) stopRotationTimer();
    else onRotationTimer();

}

function on_playback_new_track() {

    onRotationTimer();

}


Haha, good job ExtremeHunter, it work well and I will try to fix it with seekbar so let them work look like a vinyl disc player with a (seekbar) needle.

Thank so much 
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-01-23 15:23:19
That's a really nice disc spinner visualization you made there ExtremHunter, congrats +++++

Unfortunately for me, it won't resize to fill the whole panel window. I drag the panel edges open and the disc wants to stay one size at top left.
Is there any chance you can add more code to (A) center the disc in the panel and (B) make the disc auto-resize to fit the whole panel.

Great job on this, it would be nice if you continued to develop the script with more features :-) . . . . . Just off the top of my head, a super-cool feature would be if you could right-click the panel and choose menu items "Zoom In" or "Zoom Out" in incremental steps . . . . for example, if we continue to zoom in, then the disc stays always centered in the panel but the image goes beyond the edges of the panel, so with high enough zoom-in level we are looking at the hole in the middle of the disc filling the whole panel !!

I added this preamble header to the current script:
Quote
//////////////////////////////////////////////////////////////////////////////////////
// "Spinning Disc Image Viewer"
// WSH Panel Mod script by ExtremeHunter (Jan 23, 2013)
// creates a visual effect of a spinning disc as track is playing.
//
// script source:
// www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=821699
///////////////////////////////////////////////////////////////////////////////////////
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-23 17:37:41
derty2

you can get zoomable/resizable version here (http://pastebin.com/EyKDiDQW) (zoom with Shift+mouse wheel or Shift+up/down arrow keys),
but keep in mind that larger your image goes, more CPU it takes.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-01-23 22:20:03
Fantastic work eXtremeHunter, the code works great +++++++

This looks really nice when using a PNG disc image with transparent background and a custom panel background color.

If anybody here wants to edit the script to have custom panel background colors then add these lines to the script:

add this:
Quote
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
var backgrcolor = RGB(34,28,28) //<<<<<<<<<< color is dark brown

and add this:
Quote
function on_paint(gr) {
    gr.FillGradRect(0, 0, window.Width, window.Height, 90, backgrcolor, RGB(50,0,0)); //<<<<<<<<<< color is gradient dark brown-maroon
    gr.DrawImage(resizedVinylImage, vinylX, vinylY, vinylW, vinylH, 0, 0, resizedVinylImage.Width, resizedVinylImage.Height, angle);
}


HOW TO CREATE A 'PNG' DISC IMAGE WITH TRANSPARENT BACKGROUND
Quote
For this example I am using Photoshop CS3,

Open image in Photoshop,

At the left-side toolbar select the "Elliptical Marquee Tool",

Place the mouse cursor somewhere in the middle of the image,

Hold down SHIFT+ALT keys, then click-drag the mouse cursor outwards from the middle of the image,

You will see a perfect selection circle radiating out from the middle of the image,

Keep dragging outwards until you reach the edge of the disc,

Let go of the mouse cursor and then let go of the keys,

You should now have a perfect circular selection,

Right click in the selection and choose "Layer Via Copy",

At the right-side layers panel you will now have two Layers named "Layer 1" and "Background",

Click on the "eyeball" of the "Background" layer to de-select it,

You will now see the main image showing in Photoshop will have a checkerboard background pattern,

This checkerboard pattern means the background is transparent,

Save this image as 'PNG' and you are done.

!!! IMPORTANT !!! do not save as 'JPG' because you will lose the transparent background.

Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-01-24 00:12:42
ExtremeHunter

great idea

http://www.youtube.com/watch?v=jzaoI8lru4s...eature=youtu.be (http://www.youtube.com/watch?v=jzaoI8lru4s&feature=youtu.be)
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-24 08:46:28
Mmm, good old times comes to mind 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-24 11:23:50
just a post to say if you use the right click>Update script option on my scripts from today, the last.fm charts and autoplaylists script panels will break. you just need to import those again from the full download here. http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

i've also tidied up a few things and bumped all the version numbers on my scripts but there are no functional changes.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-01-24 16:51:26
eXtremeHunter, I have one more feature request for your "Spinning Disc Image Viewer" script please. . .

I am getting bored looking at the same spinning disc for every track.
Can you modify the code so that the script searches for a disc named "disc.png" at same directory as playing track,
else if "disc.png" is not found then default disc image is displayed.

Thankyou.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-24 20:24:15
Updated Spinning disc script here (http://pastebin.com/Z8TCfmj7)

Added: Display now playing disc first, if not available  display default disc image.
(set source in Preferences/Display-Album art Disc)

Added: gradient background.
Added: disc mask. (now you can display non transparent disc images like  jpg. just use correctly cropped images (edge to edge)).

screen-shot with jpg disc image

(http://img33.imageshack.us/img33/360/24012013220819.png)
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-01-24 23:22:52
Thanks for the new code eXtremeHunter , it works great ++++

Here is a quick 'No Disc' image I made (1000x1000px, PNG):         (http://img210.imageshack.us/img210/8297/foobar2000nodisc.th.png) (http://img210.imageshack.us/img210/8297/foobar2000nodisc.png)
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-25 06:36:42
Hey guys, my some of my wsh panels flicker on pause/play if I set the panels to pseudo transparency, is it fixable?
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-25 08:59:13
Can't edit the post, sorry for the double post
Can anyone please change this function from opening external program to playing/pausing foobar playback?

function on_mouse_lbtn_clk(x, y, mask) {

   var path = Image.Items[Image.Index].path;
   if (!path || hbtn) return;
   if (path.indexOf("file://") >= 0 || path == Properties.Image.DefaultCoverPath) {
      return;
   }
   ShellObj.ShellExecute('"' + path + '"', "", "", "open", 1);
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-25 09:21:16
not sure what callback you're trying to use there??

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    fb.PlayOrPause();
}


that's single click. if you want double click then use on_mouse_lbtn_dblclk
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-25 16:28:03
not sure what callback you're trying to use there??

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    fb.PlayOrPause();
}


that's single click. if you want double click then use on_mouse_lbtn_dblclk

That's a script from another config which opens the cover in the external image viewer on double click.

Your script works well, thanks, I was trying this function but with on_mouse_lbtn_clk which doesn't work. But it counts my double clicks too so when I double click on the cover it quickly pauses and then keeps playing, is it possible to make wsh see the difference between a quick double click and a single click?
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-01-25 18:34:56
Hi everyone, i'm starting mod the PlaylistSwitcher in the skin Mizo (http://neonasahi.deviantart.com/art/Mizo-final-with-SP1-267685297).

Initially, I made it to show the number of songs in each playlist, but this number didn't change immediately every time I added or deleted some songs in playlist, can someone help me 

Sorry for my bad English.

This is my script :

https://dl.dropbox.com/u/22999146/FB/playlistsw.txt (https://dl.dropbox.com/u/22999146/FB/playlistsw.txt)
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-25 19:01:22
kjllmeplz

add these functions to your script


Code: [Select]
function on_playlist_items_removed(){
  RefreshPlaylists();
  window.Repaint();
}

function on_playlist_items_added(){
  RefreshPlaylists();
  window.Repaint();
}

Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-01-25 19:22:19
so fast
thanks u very much
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-26 09:17:16
is it possible to make wsh see the difference between a quick double click and a single click?


i don't think so. perhaps you should make a pause button rather than have the whole panel respond to a single click.
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-26 13:22:15
is it possible to make wsh see the difference between a quick double click and a single click?


i don't think so. perhaps you should make a pause button rather than have the whole panel respond to a single click.

I'm not a great wsh/foobar coder as you may have noticed  I've been using an old Br3tt's config curacao (http://br3tt.deviantart.com/art/Curacao-v1-2a-Released-105580817) for four years now and constantly modify it. It has a pause button but it's very small so pausing on clicking album art is an important feature for me (which I added with your help). Does WSH recognize middle mouse clicks then? Maybe I could remap the double click to that. Anyway it's not that big of a deal, it's not like I'll be using double clicks much so it won't bother me.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2013-01-26 15:34:46
Yes, there are several other mouse functions you could use, e.g.

function on_mouse_mbtn_down
function on_mouse_mbtn_up
function on_mouse_mbtn_dblclk
function on_mouse_rbtn_down
function on_mouse_rbtn_up
function on_mouse_rbtn_dblclk

See the callbacks doc that comes with wsh panel mod for more info.
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2013-01-26 18:55:26
Yes, there are several other mouse functions you could use, e.g.

function on_mouse_mbtn_down
function on_mouse_mbtn_up
function on_mouse_mbtn_dblclk
function on_mouse_rbtn_down
function on_mouse_rbtn_up
function on_mouse_rbtn_dblclk

See the callbacks doc that comes with wsh panel mod for more info.

Great, thanks a lot!
Title: WSH Panel Mod script discussion/help
Post by: antheo on 2013-01-27 09:30:35
Hello ExtremeHunter,

- Thanks for your great script and the reel-to-reel tape rotated very smooth in CC direction (the blue arrow) but when I made it rotate in CCW direction as in the real (the red arrow) by changing this line: " angle += 10;" to " angle += -10;", the reel-to-reel tape to be shaken sometimes.



Once again, thank you so much.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-27 12:49:15
antheo

Here's reel-to-reel (http://pastebin.com/2P1UsbT9) example.

now you only need some tape reels with transparent holes. 
Title: WSH Panel Mod script discussion/help
Post by: antheo on 2013-01-28 04:09:54
antheo

Here's reel-to-reel (http://pastebin.com/2P1UsbT9) example.

now you only need some tape reels with transparent holes. 


Wow, very quick!  I'm very excited with your script in my new CUI layout.

Thank you for your kindness and help, I'll try it right now.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-01-28 04:49:28
eXtremeHunter, your "Spinning Disc Image Viewer" only displays JPG files in path of playing track; it refuses to load other image file types.
Sometimes I want to save as GIF or PNG or BMP  or TIF images. Is there any way you can make your code accept all other image files as input?
Even nicer would be a config field in Properties where the user can add a list of file extensions to suit himself.
I tried editing your script, but I can not see any reference to a file extension (except for the default disc image).

That reel-to-reel image above is giving me further questions . . . .
Is it possible to have a picture of a turntable as the background of the "Spinning Disc Image Viewer" panel, and then overlay the spinning disc on top of it?

One more question . . . .
Is it possible to make an animated GIF image from a video clip and make it "play" in a WSH Panel ?
What is on my mind here is this idea: Shooting a video clip of vertical vinyl cover turning around the North-South axis so we get to see all facets of the cover . . . Front-Turning-Spine-Turning-Back-Turning-Spine-Turning-Front . . . we make an animated GIF from the video and it plays inside a WSH Panel Mod panel . . . . . . . . . . . . . . . . . . . . . is this possible?

Thanks +++++
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-01-28 09:37:38
eXtremeHunter
now still have to add a different rotational speed for modes (play, rew, ff), two straight lines tangent to the roll with tape... 
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-01-28 10:44:51
derty2

1. You can use wildcards to display different file types
example: foobar Preferences/Display-Album art Disc

*disc.*
*cd.*
*dvd.*

2. Yes, just add background image source and then use gr.DrawImage(background... before spinning disc and set spinning disc alpha to see through it.

3. AFAIC no. You can display only still gif images.


onv

just decrease rotationInterval value when rew/ff
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-01-28 11:00:29
just decrease rotationInterval value when rew/ff

it is clear, but the speed should vary smoothly, without jerks, just like in real life,
and during the change of mode, to play the short wav with a electromagnets click
Title: WSH Panel Mod script discussion/help
Post by: antheo on 2013-01-28 11:42:13
Hi ExtremeHunter,

My layout looks so fine with your script, I recorded it here:

Tape reels screen capture (http://www.youtube.com/watch?v=w7J9XDggqyE)

As you see, the left tape reel runs from full to empty while the right runs from empty to full but it will look more real if the left and the right are decreased/increased speed gradually.

Anyways, I am now very satisfied with this script and thanks so much for your support 

P/S: Thanks onv, derty2 and others for your useful suggestions.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-01-28 12:23:27
Is it possible to make an animated GIF image from a video clip and make it "play" in a WSH Panel ?


you could extract all "frames" from a .gif then have WSH panel mod loop through them all on a timer.
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2013-02-02 23:32:25
Can anyone shed some light on this on the flicking part?

Code: [Select]
Methods:
    // NOTE: Don't try to update tooltip text when tooltip is activated, because it will flick in Windows Vista/7.
    void Activate();
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-04 09:28:34
Code: [Select]
var g_tooltip = window.CreateTooltip();

function tt(t) {
    //t is a variable containing our tooltip text - usually called from on_mouse_move
    //if it hasn't changed, don't try and update it....
    if (g_tooltip.Text == t) return;
    g_tooltip.Text = t;
    g_tooltip.Activate();
}

function on_mouse_move(x, y) {
    tt("hello"); //obviously "hello" can be whatever text you like. it will probably change as you move over different things....
}


Title: WSH Panel Mod script discussion/help
Post by: emte on 2013-02-17 13:41:07
Is it possible to display whole biography from last.fm?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-18 09:15:08
nope: http://www.last.fm/group/Last.fm+Web+Servi...21604/_/2201974 (http://www.last.fm/group/Last.fm+Web+Services/forum/21604/_/2201974)

last.fm themselves are preventing the full display of artist info. 

and they've also broken the fetching of info on artists with an ampersand (&) in the name. 
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2013-02-18 11:54:58
nope: http://www.last.fm/group/Last.fm+Web+Servi...21604/_/2201974 (http://www.last.fm/group/Last.fm+Web+Services/forum/21604/_/2201974)

last.fm themselves are preventing the full display of artist info. 

and they've also broken the fetching of info on artists with an ampersand (&) in the name. 


Marc, in your bio panel, can we disable the download of bio info, if that info already exists in the XML?

I would rather keep my full local data rather than having it replaced.


Title: WSH Panel Mod script discussion/help
Post by: emte on 2013-02-18 16:42:09
Seeing that lastfm messed up it'd be good idea to change the provider of biographies.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-19 09:19:50
Marc, in your bio panel, can we disable the download of bio info, if that info already exists in the XML?

I would rather keep my full local data rather than having it replaced.


done. i really should have done this when i found out yesterday.... 

you can use Script update on the context menu. (load a blank playlist with nothing selected before loading the panel otherwise the cache for the current artist would be cleared). or you can download the modified file here: http://dl.dropbox.com/u/22801321/wsh/marc2003/common6.js (http://dl.dropbox.com/u/22801321/wsh/marc2003/common6.js)

full download zip is here: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

files changed:
Code: [Select]
marc2003\common6.js


and just incase people didn't realise, clicking the last.fm logo in the top right takes you to the full artist bio on the last.fm website.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2013-02-19 11:33:41
done. i really should have done this when i found out yesterday....


very kind Marc - your support time is more than acceptable!
Title: WSH Panel Mod script discussion/help
Post by: juso on 2013-02-20 09:59:30
Hello marc2003,

continuing on from the previous thread,

So as mentioned the error has disappeared but I can still not display anything correctly atm,

Checking the console I see errors like this,

Last.fm Similar Artists: Unexpected Last.fm server error.

Last.fm Charts: Unexpected Last.fm server error.

Audioscrobbler: Handshake failed.

--------------

I know this mod does not support the Audioscrobbler but I feel the errors may be related

The following is a screenshot of the far right section of my config showing the last fm errors.

https://dl.dropbox.com/u/12109423/foobar_lfm.png (https://dl.dropbox.com/u/12109423/foobar_lfm.png)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-20 10:27:10
working fine me.

). the fact your audioscrobbler is failing to connect might well be an indication of that.
Title: WSH Panel Mod script discussion/help
Post by: juso on 2013-02-20 13:33:53
Hey marc2003,

So it's all working

I noticed that foobar was version 1.2.2 - I downloaded the latest (1.2.3) installed it to my portable directory loaded everything up and after a few restarts Last.fm similar artists/charts/Bio/images all display - the console is also reporting that tracks from the cache are being submitted to last.fm. Thanks for all your help and excellent scripts!

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-21 10:24:24
samples updated: http://db.tt/BInQ3Abm (http://db.tt/BInQ3Abm)

new script: last.fm bio mod. due to changes made by last.fm which truncates the bio, this pulls the same info from another site. you lose all the stats, language and auto correct options but it'll do for most people.

this uses new filenames for caching so it won't affect any previously saved data from the old script and i've left the old one there for now incase last.fm revert this change.

old and new side by side: http://dl.dropbox.com/u/22801321/old%20new%20bio.PNG (http://dl.dropbox.com/u/22801321/old%20new%20bio.PNG)

changed / added files:
Code: [Select]
marc2003\common6.js
samples\last.fm biography mod.txt
Title: WSH Panel Mod script discussion/help
Post by: emte on 2013-02-21 11:54:59
Your mod script is nowhere to be found in the zip archive.
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2013-02-22 06:09:11
IMHO perhaps overkill but can last.fm bio mod and the orginial last.fm bio script be merged such that it pulls stats from the original and the full bio from the mod?

Quote
I would rather keep my full local data rather than having it replaced.

Also a bit unrelated perhaps but is there any way to convert add to tags all last.fm local data. My big issue with how data is stored right now is that is not that easily available for other applications/components/scripts. Still that doesn't seem to be a good solution. How would it be easier to call locally stored last.fm data for other components?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-22 09:47:56
Your mod script is nowhere to be found in the zip archive.


can't believe i forgot to put it in.    i'll sort that out a bit later.

EDIT: done.

IMHO perhaps overkill but can last.fm bio mod and the orginial last.fm bio script be merged such that it pulls stats from the original and the full bio from the mod?


it's certainly possible but i'm not doing it.

as for your second point, i'm assuming you want to save the data downloaded into your file tags? the only way i know of doing that would be to write a new WSH panel mod script. not really something i'd take on.

the data is saved as JSON which is a pretty universal format but i don't know of any other components that can handle it.
Title: WSH Panel Mod script discussion/help
Post by: emte on 2013-02-22 11:04:09
Possible that you haven't replaced old common6.js? I get this error:

Scripting Engine Initialization Failed (Last.fm Biography mod v6.2013-02-21.01 by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

Old script is working.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-22 11:17:17
i did that properly but i can't believe i bodged the last.fm biography mod.txt file itself. 

i've updated the zip but you don't need to download the full thing again. just open the panel and change line 10 from

Code: [Select]
var p = new panel("Last.fm Biography", ["metadb", "lastfm_bio", "remap"]);


to...

Code: [Select]
var p = new panel("Last.fm Biography", ["metadb", "lastfm_bio_mod", "remap"]);
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2013-02-23 10:35:21
it's certainly possible but i'm not doing it.

 

the data is saved as JSON which is a pretty universal format but i don't know of any other components that can handle it.

That's the problem
And converting json to a component-supported text format?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-23 11:04:25
even if the bio was stored as plain text, i still don't know any components that would read it. which makes the format kind of irrelevant.

however, i could add a copy text option to the context menu. this will put the text on the windows clipboard and you can paste it into the properties dialog yourself. although scripts can write tags themselves, it's not really useful doing one file at a time. you'd want to apply it to all tracks by a given artist.
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2013-02-23 18:35:59
even if the bio was stored as plain text, i still don't know any components that would read it. which makes the format kind of irrelevant.

Ahh 

Tags don't seem like the ideal way to go either. Adding a copy text option would help but is still a lot of work. A method similar to how lyrics are handed via foo uie lyrics? It's only that lyrics are per-track. For songs that haven't been tagged, I could at least get to display the info via a custom wsh script/text viewer. Integrating info as foo bio view does is awsome, but hum well after all dreaming is free
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-25 09:29:35
assuming you don't need the text outside of foobar, my cached files aren't going anywhere now because it no longer automatically updates. the reason i used auto-updates before is because the bio pages on the last.fm website are basically wiki's which are user editable. i even made changes to some pages myself so i always wanted the latest version displayed in foobar. but that idea is pretty much dead now unless last.fm revert the change.

all my data is saved in a folder called wsh_lastfm inside your foobar2000 profile folder so you can back that up if you like. it will always be readable by my scripts.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-26 09:37:34
samples updated. thumbs: improve appearance of edges by trimming them. i'd never noticed before how bad it can look with lots of images.

use Script update from the context menu or the full download is here.... http://dl.dropbox.com/u/22801321/wsh/samples.zip (http://dl.dropbox.com/u/22801321/wsh/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: Marc27 on 2013-02-26 19:08:16
That's what I had been doing, though yes I would like if possible to make it easier to access/read the data not only by your scripts.
Not all the time I use Foobar, for those cases I can't read it.

I do hope as well Last.fm reverts bio change.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-28 11:46:48
samples updated. now playing (all variants). bugfix. when foo_playcount is not installed, the whole panel responded to single clicks telling you this but it should only do it when clicking the rating stars.

use Script update from the context menu or the full download is here.... http://dl.dropbox.com/u/22801321/wsh/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-02-28 14:24:39
samples updated. now playing (all variants). bugfix. when foo_playcount is not installed, the whole panel responded to single clicks telling you this but it should only do it when clicking the rating stars.

use Script update from the context menu or the full download is here.... http://dl.dropbox.com/u/22801321/wsh/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js


Thanks for all your posts very much!
Here is a question again:
How do I keep focus on WSH Panel when context menu is opening?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-28 15:04:56
i don't know what you mean? explain what's happening and what you expect to happen.

also more samples updates: http://dl.dropbox.com/u/22801321/samples.zip (http://dl.dropbox.com/u/22801321/samples.zip)

i've removed the playback buttons on all now playing for aesthetic reasons. i figure most people will have them already as a permanent fixture somewhere else on their layout plus it can look messy depending on the CD cover.

i've also fixed the now playing with last.fm bio to use a 3rd party site to get the full bio again now that last.fm truncate theirs. that has been renamed to now playing with last.fm bio mod

files changed:
Code: [Select]
samples\now playing.txt
samples\now playing with last.fm bio mod.txt
samples\now playing with track list.txt
Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-02-28 17:21:58
How do I keep focus on WSH Panel when context menu is opening?

i don't know what you mean? explain what's happening and what you expect to happen.

When the context menu shows in WSH Panel, and then mouse hover any other elements, there will no reaction, because the focus is on the context menu. And I don't want to change focus to context menu, is it possible?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-28 17:51:38
i still don't understand. the right click behaviour is the same as any other component (try it). why the hell are you opening it if you you're not going to use it? 
Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-02-28 19:31:38
i still don't understand. the right click behaviour is the same as any other component (try it). why the hell are you opening it if you you're not going to use it? 

I want it open, but when it's open I also want to enable mouse hover function in WSH Panel, so that I can write a script which like toolbar (when menu is open, mouse hover other element, we can see the other element's menu).
Sorry, if you don't have answer, skip me.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-02-28 19:57:47
well it's just not possible. when you execute this bit of code....

Code: [Select]
idx = _menu.TrackPopupMenu(x, y);


nothing happens until you click something. it will wait indefinitely.

Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-03-01 17:56:09
well it's just not possible. when you execute this bit of code....

Code: [Select]
idx = _menu.TrackPopupMenu(x, y);


nothing happens until you click something. it will wait indefinitely.

Ok, I konw, thank you very much!
Title: WSH Panel Mod script discussion/help
Post by: Yeksfys on 2013-03-02 15:32:24
how to use? and where?
Code: [Select]
function on_tooltip_custom_paint(gr) {}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-02 19:24:59
^i have no idea.

samples updated: simple text reader / simple tag reader. no longer wrap text when using fixed width font.

use Update script on the context menu or full download is here: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-03 12:26:01
samples updated: changed appearance of themed toolbar buttons. also, the help button is now a popup of useful foobar2000 related web links. people might already have them bookmarked but meh.

screenshot (https://dl.dropbox.com/u/22801321/2013/march/new%20help%20button.png)

download: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
samples\themed toolbar buttons.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-04 12:58:04
i accidentally broke my artreader script a few days back. it may say no image when there clearly should be one.

use Update script on the context menu to fix it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-06 00:23:00
just a note for users of my last.fm biography mod script (which uses another site called echonest), you may find the bio not displaying. if you look in the foobar2000 console, you should see this message explaining why.

Quote
Now Playing with Last.fm Bio: {"response": {"status": {"version": "4.2", "code": 3, "message": "api_key - You are limited to 20 accesses every minute. You might be eligible for a rate limit increase, go to http://developer.echonest.com/account/upgrade"}}} (http://developer.echonest.com/account/upgrade&quot;}}})


at the moment i'm using my own api key for everybody and i have no idea how many people are using it. maybe this is just a one off freak occurrence but i guess i'll try and apply for the upgrade.

edit: i've got the upgrade to 120 calls per minute. i can't get any more than that.
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-03-06 20:09:54
marc2003 : good work.

btw, could u make a script which get artist info from both echonest and lastfm.api ?
i notice that there are some artist that echonest can't get info from last.fm

for example :

http://www.last.fm/music/Toyosaki+Aki/+wiki (http://www.last.fm/music/Toyosaki+Aki/+wiki)
http://developer.echonest.com/api/v4/artis...me=toyosaki+aki (http://developer.echonest.com/api/v4/artist/biographies?api_key=16GBFCD4RSRXNAFOX&format=json&name=toyosaki+aki)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-06 20:22:14
the whole point of me switching away from last.fm directly is because they truncate the text. my old version still works but it now displays this....

(https://dl.dropbox.com/u/22801321/2013/march/aki.png)

sorry, but there's no way i'm going to all the effort of mangling 2 scripts together just for that.
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-03-07 02:21:45
okay, i understand
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-10 00:22:32
i guess nobody uses my musicbrainz script (in URLs mode) because they made a breaking change on the 25th feb and i've only just discovered it. it's fixed nonetheless.

use Update script on the right click menu.

the full download zip here: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js


for those unaware, my musicbrainz script has 2 separate features rolled into one. the first mode displays up to 100 releases with clickable links taking you to the website where it will list all the details. you can toggle the mode on the right click menu to urls and it displays clickable links to various official websites related to the artist. i've put 2 panels side by side in this screenshot (https://dl.dropbox.com/u/22801321/2013/march/musicbrainz.png).

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-10 03:10:48
another quick fix. discogs are sending line breaks back in their response where they shouldn't be. 

now sorted. update instructions as above.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-12 08:37:49
added a few more favicon images to my musicbrainz script (when in links mode).

https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

changed / added files:
Code: [Select]
marc2003\common6.js
marc2003\images\flickr_small.png
marc2003\images\google_plus_small.png
marc2003\images\lyrics_wikia_small.png
marc2003\images\vimeo_small.png
Title: WSH Panel Mod script discussion/help
Post by: Koyber on 2013-03-12 19:39:06
Thanks for the fixes marc2003, I use both and I was aware of the problem with musicbrainz
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-12 21:23:57
i would have fixed it sooner had anyone said something. because i maintain quite a few scripts now, i don't have them all active in my layout at once.

i guess i should test them more often - especially with musicbrainz because i am using their beta JSON service which i know is subject to change. lesson learned.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-13 20:14:24
How to update a cover panel made in WSH panel mod immediately (and automatically) when a cover is added to the file?
For now i had to update the panel by myself.
Is there any way?

Btw. i haven't made anything in wsh panel mod since a long time, but now i think its time to update my scripts.
So i have an additional question:
What is the advantage of GetAlbumArtAsync over GetAlbumArtV2?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-13 20:39:30
i don't think it's possible. if you put this in a script and edit the tags of a playing song, it triggers...

Code: [Select]
function on_playback_edited() {
   fb.trace("boo!");
}


but using the tagging context menu to add/remove images does not affect it. i have context menu item for users to manually refresh.

GetAlbumArtAsync used in conjunction with the on_get_album_art_done callback gets you the image and the path of the image. this is useful if you want to add mouse click/context menu options for finding/opening it. utils.GetAlbumArtV2 simply gives you an image object.

....and on that note i've actually just changed my script to use utils.GetAlbumArtV2 again because the other method causes the occasional flicker (or maybe my implementation was wrong ).

users of my artreader / cd jewel case script can use the Update script option on the right click menu to update.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-13 20:43:23
How to update a cover panel made in WSH panel mod immediately (and automatically) when a cover is added to the file?
For now i had to update the panel by myself.
Is there any way?

sure ... if it's in file, metadb changed, so you can trap this tag update in this callback:
function on_metadb_changed(metadb_or_metadbs, fromhook) {}

NB: // @feature "watch-metadb" is to add in PREPROCESSOR section

What is the advantage of GetAlbumArtAsync over GetAlbumArtV2?

the first one is asynchronous, it's useful when you have to load a lot of covers in a row to not block the script while reading/loading the coverfile, each load is "queued" and you trap the load over in another callback:
function on_get_album_art_done(metadb, art_id, image, image_path) {}
the art_id is the one used in the GetAlbumArtAsync args...

HTH
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-13 20:43:47
@marc2003
Ah, thanks.

I tried on_metadb_changed and on_playback_edited.
The only thing is that then it will be updated when playcounts or any other info has changed.
But the cover doesn't seems to be recognised as an edit or a metadata change.
Too bad...

And thanks for clarification abour Async and V2
I thought the first may have performance advantages...
So i will stay on V2.

EDIT:
@Falstaff
on_metadb_changed?
I tried already but got no luck...
How did you did it?

And about Async/V2:
I guess its useful for playlists or like marc2003 said if one wants the filepath.
But i think i'll stick on V2 for my cover script
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-13 20:48:46
"But the cover doesn't seems to be recognised as an edit or a metadata change.
Too bad..."

it does for me, just tested on adding image with Context menu "Tagging" > "Attach pictures" or "Remove pictures"

EDIT: here is the FULL script!

Code: [Select]
// ==PREPROCESSOR==
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

function on_metadb_changed(metadb_or_metadbs, fromhook) {
    fb.trace("metadb_changed!");
};


open console, and check if it logs the trace on actions discribes above

HTH
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-13 20:58:00
are you sure? does nothing for me....
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-13 20:58:36
No, it doesn't...
It only gives the message on playback starting or i edit some tags, but not when i edit the attached pictures.
Tried it several times (with fb.trace and fb.ShowPopupmessage, no luck)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-13 22:11:26
yep i'm sure, weird you don't have it working .... tested with DUI
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-13 22:18:50
Nope...
In DUI the same. Tried it still - no luck.

Have you opened console before hit play?
Then you'll see the message comes when opening the first track, not from editing the attached pictures.

EDIT:
The only message that comes to console after attached/removed a picture is:
Reopening played file after update: "C:\Users\Gerhard\Music\Image\Bonus Tracks\001. xxx - xxx.wv"
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-03-13 22:38:56
Falstaff

When adding/removing cover art, on_metadb_changed gets called only if playlist is autoplaylist.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-13 22:47:17
Oh, yes.
Works with autoplaylists but not with normal ones.
As i said: too bad...

Another strage thing i realized: this fb.trace will be called three times on every start of a new track in my config, although no metadata is changed...
Guess its really time to rewrite my scripts...

EDIT:
Ah, found the bad one: not my scripts at all but Biography view panel!
If i delete it from my config, on_metadb_changed() won't called anymore when playback of a track starts.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-13 23:01:12
that's normal. you usually have on_item_focus_change (which in turn calls on_metadb_changed) in these 2 callbacks.

on_playback_stop
on_playback_new_track

it gets called a 3rd time if you have cursor follows playback enabled as well.

depending on what your on_metadb_changed function does, you can have it return if the metadata is the same as before. just store and compare it. i use this for my artist related scripts. if a user is half way down scrolling through a long bit of text, a selection or track change isn't going to reset the position so long as the artist is the same.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-13 23:12:14
No, it shouldn't.
It should only "work" when metadata is changed not when focus has changed

And without biograhy view panel this console message does only appear when metadata is changed not when playback starts/stops or focus changes.
So its not my scripts fault (yippieh . No need to rewrite my whole scripts)

EDEIT:
No forget it...
Of course metadata changes when a new track is in focus/playback, but a script that only contains the code snippet posted by falstaff shouldn't give a message to console then.
Because the file and its metadata itself aren't touched by the snippet and as long no other script changes tags or infos this message shouldn't appear.
In other scripts containing on_metadb_changed, on_playback_new_track and on_playback_stop where metadata changes are asked of course this message should appear.
So i was mistakable, sorry
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-13 23:25:55
we must do things differently then. of course on_metadb_changed only works as a callback when tags change. but as i explained above, i have other events/callbacks trigger it as well.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-13 23:27:45
See my edit (i'm always too fast in writing my thoughts down and that for easy mistakable  )
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-14 07:35:39
Falstaff

When adding/removing cover art, on_metadb_changed gets called only if playlist is autoplaylist.


i still don't know why, but still works for me even on "normal" playlist ...
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-14 08:37:17
Not for me...
Only when the playing file reaches one minute and playcount updates on_metadb_changed is called and the message appears.
And i tried several skins (my own, my new design i'm working at, HiFoo, foo_tunes, fooRazor) and blank CUI and DUI with your code snippet.
Still no luck...
Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-03-14 09:27:50
Hello, everyone! I want to use two colors in one DrawString line, but I can't find the way to do this, can anyone help me?
In other computer language it can be use in "|cffFF0000XXX|r OOO" but I don't know the way in WSH.
PS. I use one line because I want the string align in center.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-14 09:36:56
the only way i know of to do that requires that you use 2 lines of DrawString code.

Quote
PS. I use one line because I want the string align in center.


there's no reason why it can't be done with 2 lines. calculate the width of the entire text. subtract that from the overall width of your "text area". divide that by 2. that gives x for the first bit of text. after calculating the width of the first colour text (plus a space), add that on to give the value of x for the second colour.

obviously this method would be useless for text spread over multiple lines but it should work fine for anything on a single line.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-14 11:19:25
Maybe someone knows an answer for:
How to draw something like this in wsh panel mod:

(http://www.abload.de/img/spacetsuvt.png)

But amount of squares depending on the width of a panel.
(the colour depends on ui settings, otherwise i would use png image).
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-03-14 11:42:37
Code: [Select]
function on_paint(gr) {

    var w = 20;
    var l = (ww - w) / w;

    for (var i = 0; i < l; i++) {

        for (var j = 0; j < 10; j++) {
            if (i % 2 == 1 && j % 2 == 1) gr.FillSolidRect(w * i, w * j, w, w, 0xff000000);

        }

    }
}

function on_size() {

    ww = window.Width;
    wh = window.Height;

}
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-14 11:45:05
Wow, this was fast
I'll try it asoon.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-14 11:48:25
too slow ... but i give it to you too

Code: [Select]
function on_size() {
    ww = window.Width;
    wh = window.Height;
}

function on_paint(gr) {
    drawSquares(gr, 30, 5, ww, wh);
};

function drawSquares(gr, squareSize, paddingSize, panelW, panelH) {
    // square colour
    var colour = 0xffff0000;
    // step size
    var stepSize = squareSize + paddingSize;
    // # of square in a line
    var totalsq = Math.ceil(panelW / stepSize);
    // # of lines to draw
    var totalrow = Math.ceil(panelH / stepSize);
    
    // let's draw the matrix
    for(var j=0; j < totalrow; j++) {
        for(var i=0; i < totalsq; i++) {
            gr.FillSolidRect(i*stepSize, j*stepSize, squareSize, squareSize, colour);
        }
    }
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-14 11:48:34
edit: ah too slow as well.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-14 11:50:23
kudos to ExtremeHunter !!!
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-14 11:52:26
Wow, thanks Falstaff
This is nearly exactly what i want.
One day if i understand this code i maybe found out how i get the a square at half width at the end

EDIT: Damn i'm that silly.
Understood this code now and its no problem to get what i want 
Many thanks again
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-14 12:05:59
ok, replace drawSquares function by this one to get the center thing:

Code: [Select]
function drawSquares(gr, squareSize, paddingSize, panelW, panelH) {
    // square colour
    var colour = 0xffff0000;
    // step size
    var stepSize = squareSize + paddingSize;
    // # of square in a line
    var totalsq = Math.ceil(panelW / stepSize);
    // # of lines to draw
    var totalrow = Math.ceil(panelH / stepSize);
    // padding to center
    var hpad = Math.round( ((stepSize * totalsq) - panelW - paddingSize) / 2);
    var vpad = Math.round( ((stepSize * totalrow) - panelH - paddingSize) / 2);
    
    // let's draw the matrix
    for(var j=0; j < totalrow; j++) {
        for(var i=0; i < totalsq; i++) {
            gr.FillSolidRect(i*stepSize - hpad, j*stepSize - vpad, squareSize, squareSize, colour);
        }
    }
}
Title: WSH Panel Mod script discussion/help
Post by: MaCs on 2013-03-14 12:09:41
Hi, I would like to modify marc2003's Art Reader script so that when I drag and drop songs from the library to the Art Reader panel, it adds the songs at the end of the active playlist. Is this possible?
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-14 12:16:13
@Falstaff
Many many many thanks again. You're my hero

Btw. this one is needed for replacing my font style in my display panel with png.
But the background has to be drawn then. And that for is this matrix.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-14 12:38:06
Hi, I would like to modify marc2003's Art Reader script so that when I drag and drop songs from the library to the Art Reader panel, it adds the songs at the end of the active playlist. Is this possible?


add this to the preprocessors (green text) at the top

Code: [Select]
// @feature "dragdrop"


then put this function anywhere in the script

Code: [Select]
function on_drag_drop(action) {
    if (plman.PlaylistCount == 0) {
        plman.CreatePlaylist(0, "New playlist");
        plman.ActivePlaylist = 0;
    }
    action.ToPlaylist();
    action.Playlist = plman.ActivePlaylist;
    action.ToSelect = false;
}
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-14 15:01:09
ExtremeHunter

Can you modify your code at Post #2093 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=827343) so instead of background squares we get cross-hatch lines like you see in graph paper?

Here are some examples of what I'm talking about: (1) plain grid (http://www.printfree.com/Office_forms/FormImages/Graph_paper2.gif) (2) enhanced grid (http://people.rit.edu/andpph/misc/graph-paper-v-7x9.jpg)

Also, I would like the lines to be light-gray and the back to be dark-gray ....I want the pattern to look very subtle in the WSH panel.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-14 15:28:18
this is just a plain grid. you can customise the first 4 lines as you like.

Code: [Select]
spacing = 20;
line_thickness = 1;
bg = RGB(65, 65, 65);
colour = RGB(192, 192, 192);
//////////////////////////////////////////

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

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, bg);
    for(i = 0; i < Math.ceil(ww / spacing); i++) {
        gr.DrawLine(i * spacing, 0, i * spacing, wh, line_thickness, colour);
    }
    for(i = 0; i < Math.ceil(wh / spacing); i++) {
        gr.DrawLine(0, i * spacing, ww,  i * spacing, line_thickness, colour);
    }
}


enhanced grid version.

Code: [Select]
spacing = 8;
bg = RGB(65, 65, 65);
colour = RGB(192, 192, 192);
//////////////////////////////////////////

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

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, bg);
    for(i = 0; i < Math.ceil(ww / spacing); i++) {
        gr.DrawLine(i * spacing, 0, i * spacing, wh, i % 20 == 0 ? 4 : i % 10 == 0 ? 2 : 1, colour);
    }
    for(i = 0; i < Math.ceil(wh / spacing); i++) {
        gr.DrawLine(0, i * spacing, ww,  i * spacing, i % 20 == 0 ? 4 : i % 10 == 0 ? 2 : 1, colour);
    }
}
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-14 17:01:50
Very nice marc, thanks a lot +++++++++

ExtremeHunter,
I am too stupid and cannot put a turntable as background image in your "WSH Spinning Disc Image Viewer" code!
Can you please modify this code so it works please, thanks:
Code: [Select]
// ============================================================================= //
// @name "Spinning Disc Image Viewer"    (2013-01-25-075628)
// @author "eXtremeHunter"
// ============================================================================= //

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


window.DlgCode = 0x0001; // arrow keys for DUI

var defaultDisc = gdi.Image(fb.FoobarPath + "addons\\wsh-spinning-disc\\disc.png");                      //<<<<<<<<<<<< is used as animated foreground
var backgroundimage = gdi.Image(fb.FoobarPath + "addons\\wsh-spinning-disc\\turntable.png");    //<<<<<<<<<<<< is used as still background
var margin = window.GetProperty("Margin", 50);
var zoomStep = window.GetProperty("Zoom Step", 30);
var useDiscMask = window.GetProperty("Use Disc Mask", true);

var angle = 0;
var minSize = 20;
var disc = defaultDisc;
var discAlpha = 100;  // disc transparency 0-255.
var rotationInterval = 50;
var rotationTimer;
var rotationTimerStarted = false;
// ============================== //
function on_paint(gr) {

    backgroundimage && gr.DrawImage(backgroundimage, ww, ww, ww, wh, 0, 0, window.Width, window.Height);

    disc && gr.DrawImage(resizedDisc, discX, discY, discW, discH, 0, 0, resizedDisc.Width, resizedDisc.Height, angle, discAlpha);

}
// ============================== //
function on_mouse_wheel(step) {

    if (utils.IsKeyPressed(16)) {

        if (step == -1 && discW <= minSize) return;

        var s = step * zoomStep;
        margin = margin -= s;
        window.SetProperty("Margin", margin);
        on_size();

        window.Repaint();

    }

}
// ============================== //
function on_key_down(vkey) {

    if (vkey == 38) on_mouse_wheel(1) //UP ARROW
    if (vkey == 40) on_mouse_wheel(-1); //DOWN ARROW

}
// ============================== //
function on_size() {

    ww = window.Width;
    wh = window.Height;

    discW = Math.max(minSize, ww - margin);
    discH = Math.max(minSize, wh - margin);

    if (discH < discW) discW = discH;
    else if (discW < discH) discH = discW;

    discX = ww / 2 - discW / 2;
    discY = wh / 2 - discH / 2;

    resizedDisc = disc.resize(discW, discH);

    if (useDiscMask) {

        var discMask = gdi.CreateImage(discW, discH);
        var g = discMask.GetGraphics();
        g.FillSolidRect(0, 0, discW, discH, 0xffffffff);
        g.SetSmoothingMode(2);
        g.FillEllipse(1, 1, discW - 2, discH - 2, 0xff000000);
        discMask.ReleaseGraphics(g);
        resizedDisc.ApplyMask(discMask);
        discMask.Dispose();

    }

}
// ============================== //
(function onRotationTimer() {

    getDiscImage();

    if (!fb.IsPlaying || fb.IsPaused) {
        return;
    }

    if (!rotationTimerStarted) {

        rotationTimer = window.SetInterval(function () {

            if (angle >= 360) angle = 0;
            angle += 10;
            (discW >= ww || discH >= wh) ? window.Repaint() : window.RepaintRect(discX, discY, discW, discH);

        }, rotationInterval);

        rotationTimerStarted = true;
    }

})();
// ============================== //
function stopRotationTimer() {

    window.ClearInterval(rotationTimer);
    rotationTimerStarted = false;

}
// ============================== //
function on_playback_stop(reason) {

    if (reason != 2) {
        stopRotationTimer();
        getDiscImage();
    }
}
// ============================== //
function on_playback_pause(state) {

    state ? stopRotationTimer() : onRotationTimer();

}
// ============================== //
function on_playback_new_track() {

    onRotationTimer();

}
// ============================== //
var tempAlbum;

function getDiscImage() {

    if (!plman.PlaylistItemCount(plman.ActivePlaylist)) return;

    var nowPlayingDisc;

    var metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
   
    if(!metadb) return;

    var currentAlbum = fb.TitleFormat("%album%").EvalWithMetadb(metadb);

    if (currentAlbum == tempAlbum) return;

        nowPlayingDisc = utils.GetAlbumArtV2(metadb, 2);

        nowPlayingDisc ? disc = nowPlayingDisc : disc = defaultDisc;

        tempAlbum = currentAlbum;

    on_size();
    window.Repaint();

}
// ============================== //
function on_selection_changed(metadb) {
    if (!fb.IsPlaying) getDiscImage();
}
// ============================== //
function on_playlist_items_removed() {

    if (!plman.PlaylistItemCount(plman.ActivePlaylist)) disc = defaultDisc;
    on_size();
    window.Repaint();

}
Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-03-14 18:48:54
the only way i know of to do that requires that you use 2 lines of DrawString code.

Quote
PS. I use one line because I want the string align in center.


there's no reason why it can't be done with 2 lines. calculate the width of the entire text. subtract that from the overall width of your "text area". divide that by 2. that gives x for the first bit of text. after calculating the width of the first colour text (plus a space), add that on to give the value of x for the second colour.

obviously this method would be useless for text spread over multiple lines but it should work fine for anything on a single line.

Hi, thank you for quickly answer.  But I have tried to use 2 draw text codes in long time ago, and I found the API about CalcTextWidth, CalcTextHeight, and EstimateLineWrap isn't very accurate, and my string shows in panel is 1~5 lines, so use 2 draw text is not useful for me.  But anyway, thank you very much again!
Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-03-14 20:16:34
added a few more favicon images to my musicbrainz script (when in links mode).

https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

changed / added files:
Code: [Select]
marc2003\common6.js
marc2003\images\flickr_small.png
marc2003\images\google_plus_small.png
marc2003\images\lyrics_wikia_small.png
marc2003\images\vimeo_small.png


I just played your sample, it's awesome!
Would you like to add search album function in art.exe? (I can't understand the source...)
If you are not interesting in it, skip my comment.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-14 20:30:36
that program is made for last.fm and it's not very good for album images. you could look at this instead.

http://www.hydrogenaudio.org/forums/index....showtopic=57392 (http://www.hydrogenaudio.org/forums/index.php?showtopic=57392)

BTW, i didn't make that art.exe program. the original is here:

http://www.hydrogenaudio.org/forums/index....showtopic=77425 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425)

i had to modify it to work with WSH panel mod so i had to include my modified source. (i just commented out a line or 2)



Title: WSH Panel Mod script discussion/help
Post by: MaCs on 2013-03-15 00:52:03
Hi, I would like to modify marc2003's Art Reader script so that when I drag and drop songs from the library to the Art Reader panel, it adds the songs at the end of the active playlist. Is this possible?


add this to the preprocessors (green text) at the top



Perfect, thank you very much!! And where could I find some documentation for those functions?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-15 00:56:13
i just copy/pasted from the sample provided with the component. Drag Drop Basic.txt.

documentation will be in interfaces.txt and callbacks.txt (almost forgot preprocessors.txt)
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-03-15 10:10:06
derty2

backgroundimage && gr.DrawImage(backgroundimage, 0, 0, ww, wh, 0, 0, backgroundimage.Width, backgroundimage.Height);
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-15 12:27:59
Thankyou eXtremeHunter +++++++

Here is a screenshot of my panel in action:
(http://i.imgur.com/nw0Kt0e.jpg)

How can I adjust the X-Y coordinates of the disc in the panel so its hole sits exactly at same location as the turntable spindle? (i.e. I want to center the disc on the turntable platter).

By the way, I have been observing the behaviour and performance of your script (with the panel as you see above) and it is not perfect news :-( . . . . . . . when the panel is active it impacts the performance of all other foobar2000 functions. The panel itself no longer spins the disc smoothly; it spins with a  stuttering, jerky action. If I try scrolling the playlist viewer, I get stuttering and lagging movement. If I try opening menus I get stuttering and freezing graphics, and CPU usage escalates to around 25%.

If you have time one day, maybe you can review your code; I think it needs some tweaking and optimizing. I wish I could do it myself by I am not a JS scripter (yet).

Thanks again for all your help eXtremeHunter +++++++
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-15 12:50:40
i do not believe there is anything that can be done in script to solve that. this component is not optimised for working with images like that.

i'd happily like to be corrected though.

if you want to tinker with x co-ordinate. on line 16

Code: [Select]
gr.DrawImage(resizedVinylImage, vinylX, vinylY, vinylW, vinylH, 0, 0, resizedVinylImage.Width, resizedVinylImage.Height, angle);


change to

Code: [Select]
gr.DrawImage(resizedVinylImage, vinylX - 100, vinylY, vinylW, vinylH, 0, 0, resizedVinylImage.Width, resizedVinylImage.Height, angle);


change the -100 if you like

edited to make simpler
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-15 13:27:35
Thanks for that marc, unfortunately if I resize the panel in the X-axis then we no longer have the same relative co-ordinate :-(
I'm guessing it is solvable with more math in the script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-15 14:04:35
you can either wait for ExtremeHunter to reply or i could attempt to have a go but i'd need the full script and images to test with.
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-03-15 14:07:35
derty2
use proportionality virtual center X/background width and virtual center Y/background hight as the center of origin of your rotating disc
your background (https://www.dropbox.com/s/n342cmbyldad460/nw0Kt0e.jpg)
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-15 14:36:16
Me again...
Hoping that someone can help me here again:

I'm on replacing the font used in my display with PNG's and it worked good so far, except one thing: the volume.
I have no clue how i can do it with the volume...
I used the format fb.Volume.toFixed(2).

Here is the working example code for playback time:
Code: [Select]
function TimeImage() {
this.image = gdi.CreateImage(120, 20);
this.currentTime  = "";

this.init = function(time) {
gr = this.image.GetGraphics();

this.drawDigit(time, 0, 0);
this.drawDigit(time, 1, 0);

g_rowImage && gr.DrawImage(g_rowImage, 36, 0, 6, 20, 234, 0, 6, 20);

this.drawDigit(time, 3, -12);
this.drawDigit(time, 4, -12);

g_rowImage && gr.DrawImage(g_rowImage, 78, 0, 6, 20, 234, 0, 6, 20);

this.drawDigit(time, 6, -24);
this.drawDigit(time, 7, -24);

this.currentTime = time;

this.image.ReleaseGraphics(gr);
}

this.draw = function(time) {
if (this.currentTime == "") this.init(time);
else {
gr = this.image.GetGraphics();

this.drawDigit(time, 0, 0);
this.drawDigit(time, 1, 0);

this.drawDigit(time, 3, -12);
this.drawDigit(time, 4, -12);

this.drawDigit(time, 6, -24);
this.drawDigit(time, 7, -24);

this.currentTime = time;

this.image.ReleaseGraphics(gr);
}
}

this.drawDigit = function(time, index, offset) {
var digitValue = time.charAt(index);

if (this.currentTime == null || this.currentTime == "" || digitValue != this.currentTime.charAt(index)) {
var xoffset = index * 18 + offset;
gr.FillSolidRect(xoffset, 0, 18, 20, ui_backcol);
                        drawSquares(gr, 2, 1, xoffset, 0, 18, 20);
g_rowImage && gr.DrawImage(g_rowImage, xoffset, 0, 18, 20, digitValue * 18, 0, 18, 20);
}

}
}

var g_timeImage = new TimeImage();
Later i call in on_paint:
Code: [Select]
var t_fmt = t_rem ? info.Remain : info.Elapse;
g_timeImage.draw(t_fmt);
gr.DrawImage(g_timeImage.image, Math.floor(ww / 2.55), 30, 120, 20, 0, 0, 120, 20);
g_noTimeImage && gr.DrawImage(g_noTimeImage, Math.floor(ww / 2.55), 30, 120, 20, 0, 0, 120, 20);

And as long the g_rowImage (where all needed numbers and signs are in) is there it works really well.
So i thought i could do something similar with the volume and rewrote it to this:
Code: [Select]
function VolumeImage() {
this.image = gdi.CreateImage(168, 20);
this.curVolume  = "";

this.init = function(volume) {
gr = this.image.GetGraphics();

this.drawDigit(volume, 0, 0);
this.drawDigit(volume, 1, 0);
this.drawDigit(volume, 2, 0);
this.drawDigit(volume, 3, 0);
       
g_rowImage && gr.DrawImage(g_rowImage, 72, 0, 6, 20, 240, 0, 6, 20);
       
this.drawDigit(volume, 5, -12);
this.drawDigit(volume, 6, -12);

g_rowImage && gr.DrawImage(g_rowImage, 114, 0, 18, 20, 216, 0, 18, 20);
g_rowImage && gr.DrawImage(g_rowImage, 132, 0, 36, 20, 264, 0, 36, 20);

this.curVolume = volume;

this.image.ReleaseGraphics(gr);
}

this.draw = function(volume) {
if (this.curVolume == "") this.init(volume);
else {
gr = this.image.GetGraphics();

this.drawDigit(volume, 0, 0);
this.drawDigit(volume, 1, 0);
this.drawDigit(volume, 2, 0);
this.drawDigit(volume, 3, 0);

this.drawDigit(volume, 5, -12);
this.drawDigit(volume, 6, -12);

this.curVolume = volume;

this.image.ReleaseGraphics(gr);
}
}

this.drawDigit = function(volume, index, offset) {
var digitValue = volume.charAt(index);

if (this.curVolume == null || this.curVolume == "" || digitValue != this.curVolume.charAt(index)) {
var xoffset = index * 18 + offset;
gr.FillSolidRect(xoffset, 0, 18, 20, ui_backcol);
                        drawSquares(gr, 2, 1, xoffset, 0, 18, 20);
g_rowImage && gr.DrawImage(g_rowImage, xoffset, 0, 18, 20, digitValue == " " ? 216 : digitValue * 18, 0, 18, 20);
}

}
}

var g_volumeImage = new VolumeImage();
furthermore:
Code: [Select]
function pad_right(x, y, z) {
    z || (z = ' ');
    return x.length < y ? z.repeat(y - x.length) + x : x
}
And in on_paint:
Code: [Select]
var vol = fb.Volume.toFixed(2) + " db";
g_volumeImage.draw(pad_right(vol, 10));
gr.DrawImage(g_volumeImage.image, ww - 194, 30, 168, 20, 0, 0, 168, 20);
But always get script errors (overflow in the g_rowImage line in this.drawDigit part)...
Does anybody have a clue why ones working ones not?
I guess it may be the "-" before the volume?
How could i get rid of?

Btw. all other codes (for tracknumber, totaltracks and bitrate) i rewrote from the time code works well too.
Only the volume will not work...

Edit:
Oh, i forgot...
This is one of the rowImages i use (this one in red):
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-15 17:53:08
onv

Thanks for the "proportionality virtual center" tip and taking the time to post a diagram ++++
I think you are on the money here. . . .please show me some demo code to paste into the script I posted at Post #2105 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=827390). Thanks
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-03-15 19:01:19
derty2
at least for this I need a clean background picture, without disc
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-15 19:19:40
onv
here is an uploaded copy of the turntable image used as background in the panel:

turntable.png.rar - 2.3 MB, No Password
Code: [Select]
http://filebeam.com/9a42860bc83d58bc0f78dd4b4c10b909
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-03-15 21:40:44
derty2
Code: [Select]
// ================================================== //
// @name "Spinning Disc Image Viewer  (Jan 24, 2013)"
// @author "eXtremeHunter"
// ================================================== //
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
window.DlgCode = 0x0001; // arrow keys for DUI

var defaultDisc = gdi.Image(fb.FoobarPath + "images\\disc.png");
var backgroundImage = gdi.Image(fb.FoobarPath + "images\\turntable.png");
var margin = window.GetProperty("Margin", 50);
var zoomStep = window.GetProperty("Zoom Step", 30);
var useDiscMask = window.GetProperty("Use Disc Mask", true);

var angle = 0;
var minSize = 20;
var disc = defaultDisc;
var rotationInterval = 50;
var rotationTimer;
var rotationTimerStarted = false;
// ============================== //
function on_paint(gr) {

  backgroundImage && gr.DrawImage(backgroundImage, 0, 0, backW, backH, 0, 0, 1196, 944);

disc && gr.DrawImage(resizedDisc, discX, discY, discW, discH, 0, 0, resizedDisc.Width, resizedDisc.Height, angle);

}
// ============================== //
function on_mouse_wheel(step) {

if (utils.IsKeyPressed(16)) {

if (step == -1 && discW <= minSize) return;

var s = step * zoomStep;
margin = margin -= s;
window.SetProperty("Margin", margin);
on_size();

window.Repaint();

}

}
// ============================== //
function on_key_down(vkey) {

if (vkey == 38) on_mouse_wheel(1) //UP ARROW
if (vkey == 40) on_mouse_wheel(-1); //DOWN ARROW

}
// ============================== //
function on_size() {

ww = window.Width;
wh = window.Height;

discW = Math.max(minSize, ww - margin);
discH = Math.max(minSize, wh - margin);
backW = ww;
backH = wh;
if (discH < discW) discW = discH;
else if (discW < discH) discH = discW;

if (backH < backW) backW = backH*1.267;
else if (backW < backH) backH = backW/1.267;

discX = backW * 0.392 - discW / 2;
discY = backH * 0.493 - discH / 2;

resizedDisc = disc.resize(discW, discH);
 

if (useDiscMask) {

var discMask = gdi.CreateImage(discW, discH);
var g = discMask.GetGraphics();
g.FillSolidRect(0, 0, discW, discH, 0xffffffff);
g.SetSmoothingMode(2);
g.FillEllipse(1, 1, discW - 2, discH - 2, 0xff000000);
discMask.ReleaseGraphics(g);
resizedDisc.ApplyMask(discMask);
discMask.Dispose();

}

}
// ============================== //
(function onRotationTimer() {

getDiscImage();

if (!fb.IsPlaying || fb.IsPaused) {
return;
}

if (!rotationTimerStarted) {

rotationTimer = window.SetInterval(function () {

if (angle >= 360) angle = 0;
angle += 10;
(discW >= ww || discH >= wh) ? window.Repaint() : window.RepaintRect(discX, discY, discW, discH);

}, rotationInterval);

rotationTimerStarted = true;
}

})();
// ============================== //
function stopRotationTimer() {

window.ClearInterval(rotationTimer);
rotationTimerStarted = false;

}
// ============================== //
function on_playback_stop(reason) {

if (reason != 2) {
stopRotationTimer();
getDiscImage();
}
}
// ============================== //
function on_playback_pause(state) {

state ? stopRotationTimer() : onRotationTimer();

}
// ============================== //
function on_playback_new_track() {

onRotationTimer();

}
// ============================== //
var tempAlbum;

function getDiscImage() {

if (!plman.PlaylistItemCount(plman.ActivePlaylist)) return;

var nowPlayingDisc;

var metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

if(!metadb) return;

var currentAlbum = fb.TitleFormat("%album%").EvalWithMetadb(metadb);

if (currentAlbum == tempAlbum) return;

nowPlayingDisc = utils.GetAlbumArtV2(metadb, 2);

nowPlayingDisc ? disc = nowPlayingDisc : disc = defaultDisc;

tempAlbum = currentAlbum;

on_size();
window.Repaint();

}
// ============================== //
function on_selection_changed(metadb) {
if (!fb.IsPlaying) getDiscImage();
}
// ============================== //
function on_playlist_items_removed() {

if (!plman.PlaylistItemCount(plman.ActivePlaylist)) disc = defaultDisc;
on_size();
window.Repaint();

}

very quickly, perhaps not very accurately
so (http://www.youtube.com/watch?v=X4FyzIM14NI&feature=youtu.be)

eXtremeHunter
sorry 
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-15 23:12:50
Excellent work onv +++++++

you locked the aspect ratio of the turntable and added math calculations for resizing the disc to suit changing co-ordinates at function on_size() ....impressive ++++++

I've played with it a little bit as I type this ....it has a problem! ....panel will crash if I try resizing the panel in the Y-axis ....X-axis is OK

Man this is such a lovely visualization, I love it! ...I am a vinyl freak (if you didn't know :-) .....unfortunately, foobar2000 performance and usability are TOTALLY CRUSHED when this panel is working!!!!
It looks to me like this panel cannot be anything more than a proof-of-concept project .....a sad conclusion.

I think that Russian developer who made the "Analog VU Meter" ("foo_vis_vumeter") component —I think his name is DRON or something— could make something like this.
Maybe he should name it "Analog Turntable" ("foo_vis_turntable")
 
 
P.S. -- I tell you what would look really cool as the "Default Disc" in this panel .....watching the empty turntable platter spinning around !!!!!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-16 02:26:05
Quote
....unfortunately, foobar2000 performance and usability are TOTALLY CRUSHED when this panel is working!!!!


i had a go at fixing this and i've basically done it. the only problem is on album change where the UI freezes for 2-3 seconds. it uses next to no cpu once the album change is out of the way. i just need to tidy it up a bit and i'll post it later on.
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-03-16 06:07:56
foobar2000 performance and usability are TOTALLY CRUSHED when this panel is working!!!!

Maybe using RegisterRect(window.ID,x,y,discW,discH) can reduce CPU loading
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2013-03-16 08:40:56
Hi all.

I'm currently using foo_uie_albumart and I'm looking for a replacement because I fear sooner or later it (or CUI itself) won't be compatible with fb2k.

So I had a look at marc's Art Reader and, while it works, it lacks some features I've grown accustomed to. I know the script is based on fb2k art reader and therefore my request should probably be addressed to Peter, but I don't think he's interested so I'll ask here just in case:

1) define multiple sources of images (with title formatting) and automatically cycle through them; for example, my current uie_albumart shows cover and artist images (if any) through the following setup:
Code: [Select]
E:\My Music\covers\%artist%_%album%.*
E:\My Music\artists\$substr(%artist%,1,1)\%artist%_*.*
2) define multiple sources of no-cover images (with title formatting) and automatically cycle through them; again, my current setup is
Code: [Select]
--$if($strcmp($left(%path%,4),http),E:\My Music\covers\onlineradio*.*,E:\My Music\covers\nocover*.*)
3) switch between currently playing and selected track (now, if I'm not mistaken, it always shows the art for the selected track)

Cheers.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-16 08:42:15
i cut most of the old code out but here is my modified turntable script. https://dl.dropbox.com/u/22801321/2013/march/turntable.txt (https://dl.dropbox.com/u/22801321/2013/march/turntable.txt)

turntable image saved as .jpg here: https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg (https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg)

i'm not sure how memory usage goes after extended use as i haven't really had time to test it properly.

@mobyduck, my simple image viewer script can display images from multiple folders and cycle through them. there is no support for no cover images though.

edit: just realised that script won't work for you. it does not support wildcards for filenames. it only supports title formatting for folders and it automatically displays all the images inside.

and lastly, check the Selection mode submenu. by default it uses the settings found under file>preferences>display to choose whether to follow the playing/selected track but you can over-ride this on a per panel basis. that is far more functionality then you get from anything else.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-16 08:58:06
foobar2000 performance and usability are TOTALLY CRUSHED when this panel is working!!!!

Maybe using RegisterRect(window.ID,x,y,discW,discH) can reduce CPU loading


RegisterRect()

what's that ? how does it work? nothing in WSH Panel Mod docs about it ...
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2013-03-16 08:58:49
check the Selection mode submenu. by default it uses the settings found under file>preferences>display to choose whether to follow the playing/selected track but you can over-ride this on a per panel basis. that is far more functionality then you get from anything else.
I had missed that, thanks (but, as far as usability goes, in foo_uie_albumart you can toggle that preference with a single click... ).

Well, I can always hope for some programmer to resurrect the plugin some day (source is available). Or I might just learn some C and do it myself.

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-16 10:24:05
(but, as far as usability goes, in foo_uie_albumart you can toggle that preference with a single click... ).


it's really a single click? how do you know which mode it is in? i guess i need to streamline my 2 click approach.

and whilst on the subject of usability, doesn't that component crash foobar everytime you close it?   
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-03-16 10:54:30
foobar2000 performance and usability are TOTALLY CRUSHED when this panel is working!!!!

Maybe using RegisterRect(window.ID,x,y,discW,discH) can reduce CPU loading


RegisterRect()

what's that ? how does it work? nothing in WSH Panel Mod docs about it ...

about RegisterRect (http://foobar2000.ru/forum/viewtopic.php?t=4061&start=140)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-16 11:24:57
@onv:

ok, it's only concern foo_vis_vumeter.dll
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-03-16 11:39:40
@onv:

ok, it's only concern foo_vis_vumeter.dll

unfortunately, but it's true
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-16 12:04:36
little update for my version of the turntable script: https://dl.dropbox.com/u/22801321/2013/march/turntable.txt (https://dl.dropbox.com/u/22801321/2013/march/turntable.txt)
image: https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg (https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg)

the button now responds to clicks for play/pause.

i should say preliminary testing shows this uses around 60-70mb of ram. there is no load on cpu except very heavy usage at album change/panel resize causing the UI for freeze for a couple of seconds.
Title: WSH Panel Mod script discussion/help
Post by: mobyduck on 2013-03-16 12:47:27
it's really a single click?
[a href="http://imageshack.us/photo/my-images/163/imgnd.jpg/" target="_blank"]
i guess i need to streamline my 2 click approach.
I was merely responding to your more functionality then you get from anything else claim: didn't mean to criticize your brilliant work.
and whilst on the subject of usability, doesn't that component crash foobar everytime you close it?
Not here. It has some glitches, granted, but I don't experience frequent crashes as its reputation seems to suggest (perhaps because I'm on XP, don't know).

Alessandro
Title: WSH Panel Mod script discussion/help
Post by: onv on 2013-03-16 12:53:00
marc2003
ideally it would be great to rotate synchronously with the disc and the ring with setting marks 
But, if we want realism, will impose two areas highlight the blue and red rays, CPU even more sad... 
and if add the angle of rotation of the tonearm as a stylized seekbar...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-16 12:57:24
@mobdyduck, single click code for simple image viewer. just stick it right at the end.

Code: [Select]
function on_mouse_mbtn_up(x, y) {
    p.selection_mode = p.selection_mode == 2 ? 1 : 2;
    im.folder = "";
    on_item_focus_change();
}

Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-16 14:26:12
    >> onv:    "and if add the angle of rotation of the tonearm as a stylized seekbar..."

don't forget to remove the tonearm locking clamp (look at the image again)

marc2003 - brilliant work mate, thanks a lot for putting all that effort and skill into this ++++++++++++++++++++++++++++++
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-16 16:14:13
marc2003

ermm, please excuse my stupidity ....I imported your script; yes it shows an image of a static turntable and the panel does not crash when resizing ...but where is the spinning disc?

Does your code do this? :    Draws a spinning disc (disc.jpg) found in same location as selected track, ELSE draws a default spinning disc from a specified location.

*EDIT*    sorry, upon further testing. . .

   - I see it renders the disc.jpg at playing track location.
   - I see your point about UI freezing! ....this only begins to happen if you have played a track ....if you restart fb2k and then resize the panel, there is no freezing
     ....if you play a track and then try resizing you get freezing ....if you play a track and then STOP playing and then try resizing, the panel freezing continues.
   - Where is the default spinning disc when disc.jpg at playing track is not found? ...I was thinking of using an image of the empty turntable mat itself so the panel looks animated
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-16 16:58:36
it uses the core display preferences. make sure you set the id variable in the script to match which type you want (i've given all the examples). i was using front for testing because i don't have any disc art.

you can specify a default image under file>preferences>display>album art>TYPE>stub image path - no need for me to code this into the script.

Quote
if you restart fb2k and then resize the panel, there is no freezing


right. resize before starting playback. why are people always resizing?

because of the overhead involved creating the images, there are no updates when playback is stopped. when you stop and select something else, you will still see the image from the previous album. it's only when playback starts again that the display will refresh.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-16 18:50:17
_______________________________________________________

disc.jpg     (used for "default disc" animation if disc.jpg at playing track is not found ....i.e. turntable platter contains no disc but looks like it is spinning)
(http://i.imgur.com/YgMb13Zl.jpg)

The above is a large thumbnail. The full size image can be found here:  http://i.imgur.com/YgMb13Z.jpg
________________________________________________________

@marc2003
- I placed the above (default disc) image  at <foobar_profile>\images\disc.jpg and I played some music having no disc.jpg at playing track ....your panel is not rendering the default disc.
- @fb2k . . . . . . File > Preferences > Display >  Album art (section) > Disc (tab) . . . . . . I have disc.jpg as first item
- @script_config . . . . . . I have edited this line:   var id = 2;

Ideally I want to keep this script and its resources in one subfolder. All user-made functions in my (portable) foobar2000 go to this location: <foobar_profile>\addons\<subfolder>

therefore I eventually want this WSH scripted panel to reference itself ONLY HERE:
<foobar_profile>\addons\wsh_vis_turntable\disc.jpg                <<<<<<<<< the default disc . . . aka the turntable platter contains no disc but looks like it is spinning
<foobar_profile>\addons\wsh_vis_turntable\script.js                <<<<<<<<< the working script
<foobar_profile>\addons\wsh_vis_turntable\turntable.jpg         <<<<<<<<< the default background image
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-16 19:08:31
- I placed the above (default disc) image  at <foobar_profile>\images\disc.jpg and I played some music having no disc.jpg at playing track ....your panel is not rendering the default disc.


the artwork preferences don't know about your foobar profile\images folder. paths are relative to the playing track. how would it know to look in there? you'd have to specify the full path for that to work  - with a drive letter. no good if you really need portable i suppose. it can be done in script by changing line 57.

replace

Code: [Select]
if (!img) return(window.Repaint());


with

Code: [Select]
if (!img) img = gdi.Image(fb.ProfilePath + "images\\disc.jpg");

Title: WSH Panel Mod script discussion/help
Post by: matif on 2013-03-16 19:33:29
that program is made for last.fm and it's not very good for album images. you could look at this instead.

http://www.hydrogenaudio.org/forums/index....showtopic=57392 (http://www.hydrogenaudio.org/forums/index.php?showtopic=57392)

BTW, i didn't make that art.exe program. the original is here:

http://www.hydrogenaudio.org/forums/index....showtopic=77425 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77425)

i had to modify it to work with WSH panel mod so i had to include my modified source. (i just commented out a line or 2)

Thanks for the information!
artistArt downloader is useful.
And I think I found the way to download image use jscript.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-16 20:20:21
marc2003 - thanks again +++++++
 
 
The 'disc.jpg' (empty turntable platter mat) I posted at Post #2140 was not perfectly round, so I deleted it from the image hosting site.
This one here is perfectly round and will fill the the exact dimensions of the turntable platter without visual errors.

Click on the thumbnail to see/copy the full size image to your computer:       (http://i.imgur.com/9MLgKxqs.jpg) (http://i.imgur.com/9MLgKxq.jpg)
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-17 11:15:54
And my next questions (hopefully the last  ):

I have these two arrays in my script:
Code: [Select]
var c_arr = new Array(RGBA(191, 228, 255, 255), RGBA(128, 192, 255, 255), RGBA(0, 255, 0, 255), RGBA(255, 0, 0, 255), RGBA(255, 255, 255, 255), RGBA(255, 255, 0, 255));
var a_arr = new Array(RGBA(191, 228, 255, 8), RGBA(128, 192, 255, 8), RGBA(0, 255, 0, 8), RGBA(255, 0, 0, 8), RGBA(255, 255, 255, 8), RGBA(255, 255, 0, 8));

As you can see only alpha value changes.
This is for drawing rectangles according to a condition in full colour (in "on" mode) or semi-transparent (in "off" mode).

So is there a way to make it easier?
Is there anything like "blending" normal RGB() with alpha?

And is there anything like "blending" two colours (RGB() and RGB()) or substract one from another?
Then i could also use this on/off mode for text (since GdiDrawText doesn't seems to support an alpha value, i could then use a "off" colour depending on the c_arr colour and the background colour)
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-17 13:11:23
Okay, found the answer for question one.
Have again read the helpers.txt and found the setAlpha function (must have overread it before... shame on me).

But there is still my second question:
Is there a way to blend two colours like:
RGBA(19, 30, 38, 255) and RGBA(191, 228, 255, 10) will give RGBA(25, 38, 47, 255) (at least according to Paint.NET that i used for get the blend colour).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-17 15:31:21
^haven't a clue, sorry.

just a note to say after a few problems with my scripts going by un-noticed recently, i've tested all of them to make sure they all work as i expect and i think they do. no doubt i've missed something...

i've tidied up a few bits, bumped the version numbers and updated the readme with a few more troubleshooting hints.

https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

i've also created a new readme:

configuring the foobar2000 core to use Last.fm art fetched by my scripts (https://dl.dropbox.com/u/22801321/wsh/configuring%20the%20foobar2000%20core%20to%20display%20Last.fm%20artist%20art.pdf)

catchy title eh? 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-03-17 15:54:32
Okay, found the answer for question one.
Have again read the helpers.txt and found the setAlpha function (must have overread it before... shame on me).

But there is still my second question:
Is there a way to blend two colours like:
RGBA(19, 30, 38, 255) and RGBA(191, 228, 255, 10) will give RGBA(25, 38, 47, 255) (at least according to Paint.NET that i used for get the blend colour).


not sure what you want really as result for "blending" but i "blend" colour sometimes to get differents shades of a coulour with "&" and "|" :

    i.e : RGBA(0, 255, 0, 255) | RGBA(0, 0, 255, 255) gives RGBA(0, 255, 255, 255)

but i generally play with the alpha channel ony to get the differents shades of a same colours by increasing or decresing the apha.

HTH

Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-03-17 17:20:05
tedgo

maybe this helps

Code: [Select]
// Combine two colors
// this [url=http://www.colortools.net/color_combination.html]http://www.colortools.net/color_combination.html[/url] web site uses similar formula

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

color1 = {
    r : 0,
    g : 255,
    b : 0

}
color2 = {
    r : 0,
    g : 0,
    b : 255


function combineColors(c1, c2, f){
 
// When fraction is 0, result is 100% color1, when f is 1, result is 100% color2.

var r = Math.round(c1.r + f * (c2.r - c1.r));
var g = Math.round(c1.g + f * (c2.g - c1.g));
var b = Math.round(c1.b + f * (c2.b - c1.b));

fb.trace("R = " + r + " G = " + g + " B = " + b);

return (0xff000000 | (r << 16) | (g << 8) | (b));

}
   
var combinedColor = combineColors(color1, color2, 0.5);
 
function on_paint(gr){
   
gr.FillSolidRect(20,20, 100, 100, RGB(color1.r, color1.g, color1.b));
gr.FillSolidRect(140,20, 100, 100, RGB(color2.r, color2.g, color2.b));
gr.FillSolidRect(260,20, 100, 100, combinedColor);

}
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-17 17:21:30
Thanks Falstaff. New idea to play with

But i want more something like this formula:
Code: [Select]
first colour: RBA(r1, g1, b1, a1)
second colour: RGBA(r2, g2, b2, a2)

r = Math.min(255, r1/255*a1 + r2/255*a2)
g = Math.min(255, g1/255*a1 + g2/255*a2)
b = Math.min(255, b1/255*a1 + b2/255*a2)
a = 255

new colour: RGBA(r, g, b, a)

This would exactly do what i need.
But how could i do this in jscript?

Edit:
@ExtremeHunter
Thanks, i'll give it a try.

EDIT:
@ExtremeHunter

Thank you
This does what i need with an easier formula

But how could i rewrite this function to use the colours from my array and the background colour i set in my global script (both given as RGBA(r,g,b,a))?
I'd need it working like this:
var combinedColor = combineColors(RGBA(19, 30, 38), RGBA(191, 228, 255), 0.5);

Edit: typo...
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-03-17 22:28:45
tedgo

I think this is what you need, but this script has lot of rgb conversions, maybe someone knows better way, like how to directly combine decimal colors without that RGB mambo jumbo. 


Code: [Select]
// Combine two colors
// this [url=http://www.colortools.net/color_combination.html]http://www.colortools.net/color_combination.html[/url] web site uses similar formula

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

var color1 = RGB(0,255,0);
var color2 = RGB(0,0,255);

function toRGB(d){ // convert back to RGB values
 
var d = d-0xff000000;
var r = d >> 16;
var g = d >> 8 & 0xFF;
var b = d & 0xFF;

return [r,g,b];
}

function combineColors(c1, c2, f){

// When fraction is 0, result is 100% color1, when f is 1, result is 100% color2.
var c1 = toRGB(c1);
var c2 = toRGB(c2);

var r = Math.round(c1[0] + f * (c2[0] - c1[0]));
var g = Math.round(c1[1] + f * (c2[1] - c1[1]));
var b = Math.round(c1[2] + f * (c2[2] - c1[2]));

fb.trace("R = " + r + " G = " + g + " B = " + b);

return (0xff000000 | (r << 16) | (g << 8) | (b));

}

var combinedColor = combineColors(color1, color2, 0.5);

function on_paint(gr){

gr.FillSolidRect(20,20, 100, 100, color1);
gr.FillSolidRect(140,20, 100, 100, color2);
gr.FillSolidRect(260,20, 100, 100, combinedColor);

}
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-18 09:10:38
Wow, thank you man
Now it is exactly what i need.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-18 16:52:23
i've updated my sample scripts. this applies to my artreader, cd jewel case and now playing (all variants). until now i've always chosen to prefer embedded art first and fall back on the display preferences if nothing is found. i've never given people the choice before. but i've just been fumbling around in the foobar preferences and see it's now an option which the user can set.

file>preferences>advanced>display>album art

i don't know when that setting was implemented but my scripts now respect the choice made there.

use Update script on the right click menu or the full download is here: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2013-03-19 08:58:48
@marc2003

Inspired by something you wrote in another thread I've just begun using your Simple Text Reader, loading title reviews manually scraped from Rovi.
It's indeed a boring pursuit copying and pasting all day long from now and probably until kingdom come, but I've given up the hope that you or romor or someone else will ever write a script performing the task...
Problem is, that in my opinion the text is too small; the normal_font is o.k. in lists and so on, but used in body text on a 1920x1080 monitor it's not an easy reading font size.
It's pure flagellation if I try to make changes in the huge Common6.js – not to mention that it's frequently updated, and it's probably only necessary to have the choice of selecting larger font sizes in text heavy panels such as the Simple Text Reader and e.g. your Last.fm Biography mod script.
I found an old Simple Text Reader and common4.js in my archives and edited the latter to use

Code: [Select]
normal_font = 14

(instead of 12) and

Code: [Select]
row_height = 1.2 * normal_font.Height

(row_height being leading/line spacing), that helped my old eyes a lot.
It would however be much more elegant if you implemented some sort of font (size) handling in the context menus, if it's doable with the WSH Panel mod without to much hassle?
Your collection of scripts is highly valued and appreciated, I use 6-7 of them in my DUI layout!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-19 15:03:49
a perfectly reasonable request. i'll probably get that done tonight sometime.

edit: just had a quick bash at it now. click (http://dl.dropbox.com/u/22801321/2013/march/text%20size.png)

i just need to test it doesn't break anything else before i put it online.
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2013-03-19 15:59:40
edit: just had a quick bash at it now. click (http://dl.dropbox.com/u/22801321/2013/march/text%20size.png)

You're fantastic, marc2003, the preview looks promising!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-19 19:09:23
^ok, done. just use Update script from the right click menu.

it will apply to last.fm bio mod, now playing with last.fm bio mod, simple text reader, and simple tag reader.

the scripts in the panels haven't changed - just using the update feature above updates the common file they all share.
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2013-03-20 07:32:33
... the update is exactly what I had in mind. Simple Text Reader and the last.fm bio mod look perfect.
I'll stick to '14' for now and maybe begin using '16' in a couple of years . The leading is fine too. (normally a factor 1.1 to 1.2 is used in type setting.)
marc2003, you earn 5 stars for service and support. And speed!

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-20 08:31:27
if you need it any of my "list" scripts like last.fm similar artists, charts, musicbrainz, discogs, etc then give me a shout and i can probably work it in.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-21 14:06:22
marc2003

your vinyl turntable script has decided to crash unexpectedly.
I started foobar2000 and selected a playlist, then played a track (whose folder contains a "disc.jpg") which has previously worked fine with your script . . . . not this time!

Here is the console output:
Quote
. . .
Opening track for playback: "F:\music\lib\rhythm\curtis mayfield\(1972) superfly\vinyl - buddah records, usa, original pressing\02. pusherman.flac"
Error: WSH Panel Mod ({40845811-E334-4CB0-B4C5-DE5B1B33E36F}): Microsoft JScript runtime error:
'images[...]' is null or not an object
File: <main>
Ln: 94, Col: 3
<source text only available at compile time>
. . .


Here is line 94 (red) in my script:
Quote
function calc() {
    if (!img) return;
    for (i = 0; i < images.length; i++) {
        try { images.Dispose(); } catch(e) {}
    }
    images = [];
    for (i = 0; i < 36; i ++) {
        images = gdi.CreateImage(nw,  nh);
        var temp_gr = images.GetGraphics();
        temp_gr.SetInterpolationMode(6);
        temp_gr.DrawImage(bg, 0, 0, nw, nh, 0, 0, bg.width, bg.height);
        temp_gr.DrawImage(img, disc_x, disc_y, disc_size, disc_size, 0, 0, img.Width, img.Height, i * 10);
        images.ReleaseGraphics(temp_gr);
        temp_gr = null;
    }
}


I right-clicked the crashed panel, went to the "WSH Panel Mod Configuration" window, clicked the "Apply" button . . . . . and the panel started working again!
Can you make sense of the reasons for the crash?


*EDIT*

In the past, I remember having another WSH image viewing panel which decided to crash one day with the "null image" report at the console.

Here is the original lines in that script . . . which would occasionally crash:

        if (Properties.Image.Sort == ImageSort.Shuffle)
            NewItems = NewItems.sort(function(){return (Math.random() > 0.5) ? -1 : 1;});   
        return NewItems;


I fixed the problem by adding the line in red . . . the panel never crashed again after this edit:

        if (Properties.Image.Sort == ImageSort.Shuffle)
            NewItems = NewItems.sort(function(){return (Math.random() > 0.5) ? -1 : 1;});
        CollectGarbage();   
        return NewItems;
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-21 14:48:10
not got a clue. if you can make it fail in a way that i can reproduce reliably then it's worth looking at but otherwise....

edit: you can try replacing the for loop with this. it might give me something useful in the console if it happens again..

Code: [Select]
    try {
        for (i = 0; i < 36; i ++) {
            images[i] = gdi.CreateImage(nw,  nh);
            var temp_gr = images[i].GetGraphics();
            temp_gr.SetInterpolationMode(6);
            temp_gr.DrawImage(bg, 0, 0, nw, nh, 0, 0, bg.width, bg.height);
            temp_gr.DrawImage(img, disc_x, disc_y, disc_size, disc_size, 0, 0, img.Width, img.Height, i * 10);
            images[i].ReleaseGraphics(temp_gr);
            temp_gr = null;
        }
    } catch(e) {
        fb.trace("image:" + i);
        fb.trace("nw: " + nw);
        fb.trace("nh: " + nh);
        fb.trace(typeof images[i]);
        fb.trace("width: " + images[i].Width);
        fb.trace("height: " + images[i].Height);
    }


incidentally, this is the bit of code that causes the UI lag on album change. the original script overlaid one image on top of another every 50ms and this caused the silly CPU usage. my idea was to create a slide show but to do that i need to create 36 "flattened" images of these 2 layers first. so i draw the background and then the disc art on top rotated a bit each time. once i've done that, and i have an array of 36 images to loop through, there is no CPU usage at all.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-21 14:54:45
If I was to insert CollectGarbage(); inside the function calc() field, can you tell me after which line it would be added, thanks.

*EDIT*

Thanks for your edit
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-21 15:09:06
it has nothing to do with that at all.
Title: WSH Panel Mod script discussion/help
Post by: Rush21 on 2013-03-23 01:55:36
Hey guys I am new to writing code in the wsh panel for foobar but am trying to learn, in the meantime I am using eXtremeHunter's code to display a rotating image of a vinyl:

Code: [Select]
// ================================================== //
// @name "Spinning Disc Image Viewer  (Jan 24, 2013)"
// @author "eXtremeHunter"
// ================================================== //
function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}
window.DlgCode = 0x0001; // arrow keys for DUI

var defaultDisc = gdi.Image(fb.FoobarPath + "images\\record2.png");
var margin = window.GetProperty("Margin", 50);
var zoomStep = window.GetProperty("Zoom Step", 30);
var useDiscMask = window.GetProperty("Use Disc Mask", true);

var angle = 0;
var minSize = 20;
var disc = defaultDisc;
var rotationInterval = 50;
var rotationTimer;
var rotationTimerStarted = false;
// ============================== //
function on_paint(gr) {

    gr.FillGradRect(0, 0, ww, wh, 65, RGB(0, 0, 0), RGB(0, 0, 0), 0.5);

    disc && gr.DrawImage(resizedDisc, discX, discY, discW, discH, 0, 0, resizedDisc.Width, resizedDisc.Height, angle);

}
// ============================== //
function on_mouse_wheel(step) {

    if (utils.IsKeyPressed(16)) {

        if (step == -1 && discW <= minSize) return;

        var s = step * zoomStep;
        margin = margin -= s;
        window.SetProperty("Margin", margin);
        on_size();

        window.Repaint();

    }

}
// ============================== //
function on_key_down(vkey) {

    if (vkey == 38) on_mouse_wheel(1) //UP ARROW
    if (vkey == 40) on_mouse_wheel(-1); //DOWN ARROW

}
// ============================== //
function on_size() {

    ww = window.Width;
    wh = window.Height;

    discW = Math.max(minSize, ww - margin);
    discH = Math.max(minSize, wh - margin);

//    if (discH < discW) discW = discH;
  //  else if (discW < discH) discH = discW;

    discX = ww / 2 - discW / 2;
    discY = wh / 2 - discH / 2;

    resizedDisc = disc.resize(discW, discH);

    if (useDiscMask) {

        var discMask = gdi.CreateImage(discW, discH);
        var g = discMask.GetGraphics();
        g.FillSolidRect(0, 0, discW, discH, 0xffffffff);
        g.SetSmoothingMode(2);
        g.FillEllipse(1, 1, discW - 2, discH - 2, 0xff000000);
        discMask.ReleaseGraphics(g);
        resizedDisc.ApplyMask(discMask);
        discMask.Dispose();

    }

}
// ============================== //
(function onRotationTimer() {

    getDiscImage();

    if (!fb.IsPlaying || fb.IsPaused) {
        return;
    }

    if (!rotationTimerStarted) {

        rotationTimer = window.SetInterval(function () {

            if (angle >= 360) angle = 0;
            angle += 10;
            (discW >= ww || discH >= wh) ? window.Repaint() : window.RepaintRect(discX, discY, discW, discH);

        }, rotationInterval);

        rotationTimerStarted = true;
    }

})();
// ============================== //
function stopRotationTimer() {

    window.ClearInterval(rotationTimer);
    rotationTimerStarted = false;

}
// ============================== //
function on_playback_stop(reason) {

    if (reason != 2) {
        stopRotationTimer();
        getDiscImage();
    }
}
// ============================== //
function on_playback_pause(state) {

    state ? stopRotationTimer() : onRotationTimer();

}
// ============================== //
function on_playback_new_track() {

    onRotationTimer();

}
// ============================== //
var tempAlbum;

function getDiscImage() {

    if (!plman.PlaylistItemCount(plman.ActivePlaylist)) return;

    var nowPlayingDisc;

    var metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
   
    if(!metadb) return;

    var currentAlbum = fb.TitleFormat("%album%").EvalWithMetadb(metadb);

    if (currentAlbum == tempAlbum) return;

        nowPlayingDisc = utils.GetAlbumArtV2(metadb, 2);

        nowPlayingDisc ? disc = nowPlayingDisc : disc = defaultDisc;

        tempAlbum = currentAlbum;

    on_size();
    window.Repaint();

}
// ============================== //
function on_selection_changed(metadb) {
    if (!fb.IsPlaying) getDiscImage();
}
// ============================== //
function on_playlist_items_removed() {

    if (!plman.PlaylistItemCount(plman.ActivePlaylist)) disc = defaultDisc;
    on_size();
    window.Repaint();

}

The code works fine except I want to make one small tweak and I am unsure of how to implement it into the code. Essentially I want the image to to be resized AFTER it is rotated. I want the circular vinyl to be resized to an ellipse before every iteration of the rotation so that the vinyl appears as if it was being viewed from the side and above, with its axis of rotation being neither parallel nor perpendicular (as it is displayed currently) to the monitor. I realize it may be difficult to understand what I want and so I can better clarify if needed. Any help will be greatly appreciated.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-23 08:17:06
^i have no idea how to implment that.

samples updated. right click>Update script or the full download is here: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

musicbrainz.
when in links mode, unescape characters before displaying them to make it look nicer.

also added checking for musicbrainz artist id. this is what picard writes to mp3s but i only checked for musicbrainz_artistid previously because that is what foo_musicbrainz writes (and it's the standard for vorbis/apev2). it's not compulsory to tag files with this info because the script will search based on artist name - but it will use the first entry it matches which may be wrong if there is more than artist with the same name.

artreader / cd jewel case
add Google image search to the context menu. having a large panel has made me realise not all my art is up to scratch. i prefer to find stuff manually rather than use programs to do it so i've added this item which opens your browser looking for artist/album. also added Refresh option for cd jewel case. artreader already had it. this just updates the panel if you've edited/replaced the image while a track is playing.

files changed:
Code: [Select]
marc2003\common6.js
Title: WSH Panel Mod script discussion/help
Post by: HeroKid on 2013-03-24 02:38:31
I am hoping you can help me Marc. I am completely new to foobar2000 and am using a pretty advanced theme not compiled by myself so I am certainly in over my head.

For some reason unbeknown to me the 'last.fm Charts' does not initialise/crashes. It used to work a few days ago but I have no real idea what I have done to change things.
The error from console is as follows:
Code: [Select]
Error: WSH Panel Mod (Last.fm Charts v6.2012-12-05.01 by marc2003): Microsoft JScript runtime error:
Object doesn't support this property or method
File: <main>
Ln: 15, Col: 1
<source text only available at compile time>
I downloaded your newest 'samples' folder linked above and tried replacing the common6 file but it made no difference.
I am not sure if this is even releant but this is the code I get when I select 'configure'.
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common6.js"
// @name "Last.fm Charts"
// @author "marc2003"
// @version "6.2012-12-05.01"
// ==/PREPROCESSOR==

var p = new panel("Last.fm Charts", ["lastfm_charts"]);
var l = new lastfm();
var li = new list(6, 30, p.w - 12, p.h - 30);
var b = new buttons();

b.buttons.but1 = new button(p.w - 56, 8, 50, 18, {normal: "lastfm_red_small.gif"}, function() { p.browser(l.url); }, l.url);

li.lastfm_charts_load();

function on_notify_data(name, data) {
l.notify_data(name, data);
}

function on_size() {
p.size();
b.buttons.but1.x = p.w - 56;
li.w = p.w - 12;
li.h = p.h - 30;
li.size();
}

function on_paint(gr) {
p.draw_background(gr);
p.header(gr, l.username + ": " + li.lastfm_charts_periods_display[li.lastfm_charts_period] + " " + li.lastfm_charts_types[li.lastfm_charts_type] + " charts");
b.draw(gr);
switch(true) {
case l.username.length == 0:
p.centre_text(gr, l.username_error, p.normal_font, p.textcolour, 0, 0, p.w, p.h);
break;
case li.items > 0:
li.draw(gr);
break;
default:
p.centre_text(gr, "[nothing found]", p.normal_font, p.textcolour, 0, 0, p.w, p.h);
break;
}
}

function on_mouse_wheel(step) {
li.wheel(step);
}

function on_mouse_move(x, y) {
p.move(x, y);
if (b.move(x, y)) return;
if (li.move(x, y)) return;
}

function on_mouse_lbtn_up(x, y) {
if (b.lbtn_up(x, y)) return;
if (li.lbtn_up(x, y)) return;
}

function on_mouse_rbtn_up(x, y) {
p.rbtn_up(x, y);
return true;
}
Any guidance would be truly appreciated. Please remember that I have no idea what I am doing. Cheers.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-24 09:21:21
just update the charts script in the panel. an updated common6.js broke it back in january. obviously it kept working until now because you didn't update yours.

http://www.hydrogenaudio.org/forums/index....mp;#entry821841 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&st=2000&p=821841&hl=charts&#entry821841)

you can always check the latest panel versions here: https://dl.dropbox.com/u/22801321/wsh/versions.txt (https://dl.dropbox.com/u/22801321/wsh/versions.txt)

i try not to change panel scripts often but sometimes it is unavoidable. most of the constant work/updating goes on in the main common6.js file.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-24 15:54:44
i've updated my last.fm bio mod script. it has now been renamed to last.fm & wikipedia biography. i think from the rename alone, you can tell what it does. i've just added a context menu item allowing you to switch between the two.

(https://dl.dropbox.com/u/22801321/2013/march/wikipedia.png)

https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

some other minor changes too.

new / changed files:
Code: [Select]
marc2003\common6.js
samples\last.fm & wikipedia biography.txt
samples\now playing with track list.txt
samples\now playing with last.fm & wikipedia biography.txt
samples\now playing.txt
Title: WSH Panel Mod script discussion/help
Post by: HeroKid on 2013-03-24 22:53:20
Thanks Marc updating the script fixed it for me. Now that I have the functionality to update the script from within foobar2000 I suspect I will have fairly smooth sailing from here!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-24 23:08:48
^just incase it wasn't clear, using Update script can only update the common file and not what is in the panel. there is still potential for problems if i change things in the future but i hope not.  the general rule of thumb is that if you have files from the same zip, you won't go far wrong.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-26 12:22:13
i've updated my thumbs script. it now has options to align thumbs along the top and to the right of the panel - in addition to left and bottom that it had previously.

also, you can now turn thumbs off completely which makes my simple image viewer script redundant. support for that has been dropped.

(http://dl.dropbox.com/u/22801321/2013/march/new%20thumbs.png)

use right click>Update script or the full download is here: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
samples\simple image viewer.txt <<removed
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-26 13:02:51
I have a problem with this script in my config:
Code: [Select]
// ==PREPROCESSOR==
// @name "DarkOne Display Panel"
// @version "4.0"
// @author "super-gau and tedGo, includes partial codes by fbuser, Br3tt and T.P Wang"
// @import "%fb2k_path%themes\DarkOne_v4.0\Others\WSH Scripts\DO 4.0 Global Script.js"
// ==/PREPROCESSOR==

// ----- VARIABLES -----
var g_timer = v_timer = g_alpha = s_alpha = p_alpha = null;
var g_interval, fileinfo, g_trackinfo;
var v_change = false;

var t_rem = window.GetProperty("Remain Time on", false);

// ----- COLOURS -----
var d_arr = new Array("Default", "Blue", "Green", "Red", "White", "Yellow");
var c_arr = new Array(RGB(191, 228, 255), RGB(128, 192, 255), RGB(0, 255, 0), RGB(255, 0, 0), RGB(255, 255, 255), RGB(255, 255, 0));

function InitColours() {
d_col = window.GetProperty("Display Colour", 0);
g_dcol = d_arr[d_col];
g_acol = c_arr[d_col];
g_fact = g_acol == -65536 ? 0.09 : 0.03;
g_bcol = combColours(ui_backcol, g_acol, g_fact);
}

InitColours();

// ----- CREATE HELPERS -----
String.prototype.repeat = function(n) {
return (new Array(n + 1)).join(this);
}

function pad(x, y, z) {
z || (z = ' ');
return x.length < y ? x + z.repeat(y - x.length) : x;
}

function pad_right(x, y, z) {
z || (z = ' ');
return x.length < y ? z.repeat(y - x.length) + x : x
}

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);

return zpad(h) + ":" + zpad(m) + ":" + zpad(s);
}

function drawSquares(gr, squareSize, paddingSize, x, y, w, h) {
var stepSize = squareSize + paddingSize;
var totalsq = Math.ceil(w / stepSize);
var totalrow = Math.ceil(h / stepSize);

for(var j = 0; j < totalrow; j++) {
for(var i = 0; i < totalsq; i++) {
gr.FillSolidRect(i * stepSize + x, j * stepSize + y, squareSize, squareSize, g_bcol);
}
}
}

// ----- CREATE INFO -----
Info.prototype.setColours = function() {
var metadb = fb.GetNowPlaying();

if (metadb) {
fileinfo = metadb.GetFileInfo();
this.Colours[0] = fileinfo.InfoValue(fileinfo.InfoFind("encoding")) == "lossless" ? g_acol : g_bcol;
this.Colours[1] = fileinfo.InfoValue(fileinfo.InfoFind("encoding")) == "lossless" ? g_bcol : g_acol;
this.Colours[2] = fileinfo.InfoValue(fileinfo.InfoFind("md5")) ? g_acol : g_bcol;
this.Colours[3] = fb.TitleFormat("[%replaygain_track_gain%]").Eval() ? g_acol : g_bcol;
this.Colours[4] = fileinfo.MetaValue(fileinfo.MetaFind("tracknumber"), 0) ? ui_btntxtcol : g_bcol;
this.Colours[5] = fileinfo.MetaValue(fileinfo.MetaFind("totaltracks"), 0) ? ui_btntxtcol : g_bcol;
this.Colours[6] = ui_btntxtcol;
} else for (var i = 0; i < this.Colours.length; i++) this.Colours[i] = g_bcol;
}

Info.prototype.setTrackNo = function() {
var metadb = fb.GetNowPlaying();
var a, b;

if (metadb) {
fileinfo = metadb.GetFileInfo();
var c = fileinfo.MetaValue(fileinfo.MetaFind("tracknumber"), 0);
var d = fileinfo.MetaValue(fileinfo.MetaFind("totaltracks"), 0);
var e = c ? pad_right(c, 2, "0") : "  ";
var f = d ? pad_right(d, 2, "0") : "  ";
a = pad(e, 3);
b = pad(f, 3);
this.TrackNo = a;
this.TotalNo = b;
g_trackinfo = fb.PlaybackLength <= 0 ? 2 : metadb.RawPath.indexOf("FOO_LASTFM") == 0 ? 1 : 0;
} else {
this.TrackNo = "";
this.TotalNo = "";
}
}

Info.prototype.setPBTime = function() {
this.Elapse = TimeFmt(fb.PlaybackTime);
this.Remain = fb.PlaybackLength <= 0 ? "" : TimeFmt(fb.PlaybackLength - fb.PlaybackTime);
}

Info.prototype.setBitrate = function() {
this.Bitrate = pad_right(fb.TitleFormat("%bitrate%").Eval(), 4);
}

Info.prototype.setInfo = function() {
this.setColours();
this.setTrackNo();
this.setPBTime();
this.setBitrate();
}

function Info() {
this.Colours = new Array(7);
this.setInfo();
}

info = new Info();

// ----- BASE IMAGE OBJECT -----
function BaseImage() {
this.image = null;
this.curVal  = "";

this.reset = function() {
this.curVal  = "";
}

this.dispose = function() {
this.image && this.image.Dispose();
}

this.isDrawDigit = function(digitValue, index) {
return (this.curVal == null || this.curVal == "" || digitValue != this.curVal.charAt(index));
}
}

// ----- CREATE TRACKNUMBER IMAGE -----
function NumImage() {
this.image = gdi.CreateImage(54, 20);

this.init = function(curNo) {
gr = this.image.GetGraphics();

this.drawDigit(curNo, 0);
this.drawDigit(curNo, 1);
this.drawDigit(curNo, 2);

this.curVal = curNo;

this.image.ReleaseGraphics(gr);
}

this.draw = function(curNo) {
this.init(curNo);
}

this.drawDigit = function(curNo, index) {
var digitValue = curNo.charAt(index);

if (this.isDrawDigit(digitValue, index)) {
var xoffset = index * 18;
gr.FillSolidRect(xoffset, 0, 18, 20, ui_backcol);
drawSquares(gr, 2, 1, xoffset, 0, 18, 20);
g_signs && gr.DrawImage(g_signs, xoffset, 0, 18, 20, digitValue == " " ? 216 : digitValue * 18, d_col * 22, 18, 20);
}
}
}

NumImage.prototype = new BaseImage();
var g_trackNoImage = new NumImage();
var g_totalNoImage = new NumImage();

// ----- CREATE TIME IMAGE -----
function TimeImage() {
this.image = gdi.CreateImage(120, 20);

this.init = function(time) {
gr = this.image.GetGraphics();

this.drawDigit(time, 0, 0);
this.drawDigit(time, 1, 0);

g_signs && gr.DrawImage(g_signs, 36, 0, 6, 20, 234, d_col * 22, 6, 20);

this.drawDigit(time, 3, -12);
this.drawDigit(time, 4, -12);

g_signs && gr.DrawImage(g_signs, 78, 0, 6, 20, 234, d_col * 22, 6, 20);

this.drawDigit(time, 6, -24);
this.drawDigit(time, 7, -24);

this.curVal = time;

this.image.ReleaseGraphics(gr);
}

this.draw = function(time) {
if (this.curVal == "") this.init(time);
else {
gr = this.image.GetGraphics();

this.drawDigit(time, 0, 0);
this.drawDigit(time, 1, 0);

this.drawDigit(time, 3, -12);
this.drawDigit(time, 4, -12);

this.drawDigit(time, 6, -24);
this.drawDigit(time, 7, -24);

this.curVal = time;

this.image.ReleaseGraphics(gr);
}
}

this.drawDigit = function(time, index, offset) {
var digitValue = time.charAt(index);

if (this.isDrawDigit(digitValue, index)) {
var xoffset = index * 18 + offset;
gr.FillSolidRect(xoffset, 0, 18, 20, ui_backcol);
drawSquares(gr, 2, 1, xoffset, 0, 18, 20);
g_signs && gr.DrawImage(g_signs, xoffset, 0, 18, 20, digitValue * 18, d_col * 22, 18, 20);
}
}
}

TimeImage.prototype = new BaseImage();
var g_timeImage = new TimeImage();

// ----- CREATE BITRATE IMAGE -----
function BitrateImage() {
this.image = gdi.CreateImage(72, 20);

this.init = function(bitrate) {
gr = this.image.GetGraphics();

this.drawDigit(bitrate, 0);
this.drawDigit(bitrate, 1);
this.drawDigit(bitrate, 2);
this.drawDigit(bitrate, 3);

this.curVal = bitrate;

this.image.ReleaseGraphics(gr);
}

this.draw = function(bitrate) {
this.init(bitrate);
}

this.drawDigit = function(bitrate, index) {
var digitValue = bitrate.charAt(index);

if (this.isDrawDigit(digitValue, index)) {
var xoffset = index * 18;
gr.FillSolidRect(xoffset, 0, 18, 20, ui_backcol);
drawSquares(gr, 2, 1, xoffset, 0, 18, 20);
g_signs && gr.DrawImage(g_signs, xoffset, 0, 18, 20, digitValue == " " ? 216 : digitValue * 18, d_col * 22, 18, 20);
}
}
}

BitrateImage.prototype = new BaseImage();
var g_bitrateImage = new BitrateImage();

// ----- CREATE VOLUME IMAGE -----
function VolumeImage() {
this.image = gdi.CreateImage(168, 20);

this.init = function(volume) {
gr = this.image.GetGraphics();

this.drawDigit(volume, 0, 0);
this.drawDigit(volume, 1, 0);
this.drawDigit(volume, 2, 0);
this.drawDigit(volume, 3, 0);

g_signs && gr.DrawImage(g_signs, 72, 0, 6, 20, 240, d_col * 22, 6, 20);

this.drawDigit(volume, 5, -12);
this.drawDigit(volume, 6, -12);

g_signs && gr.DrawImage(g_signs, 114, 0, 18, 20, 216, d_col * 22, 18, 20);
g_signs && gr.DrawImage(g_signs, 132, 0, 36, 20, 264, d_col * 22, 36, 20);

this.curVal = volume;

this.image.ReleaseGraphics(gr);
}

this.draw = function(volume) {
if (this.curVal == "") this.init(volume);
else {
gr = this.image.GetGraphics();

this.drawDigit(volume, 0, 0);
this.drawDigit(volume, 1, 0);
this.drawDigit(volume, 2, 0);
this.drawDigit(volume, 3, 0);

this.drawDigit(volume, 5, -12);
this.drawDigit(volume, 6, -12);

this.curVal = volume;

this.image.ReleaseGraphics(gr);
}
}

this.drawDigit = function(volume, index, offset) {
var digitValue = volume.charAt(index);

if (this.isDrawDigit(digitValue, index)) {
var xoffset = index * 18 + offset;
gr.FillSolidRect(xoffset, 0, 18, 20, ui_backcol);
drawSquares(gr, 2, 1, xoffset, 0, 18, 20);
g_signs && gr.DrawImage(g_signs, xoffset, 0, 18, 20, digitValue == " " ? 216 : digitValue == "-" ? 246 : digitValue * 18, d_col * 22, 18, 20);
}
}
}

VolumeImage.prototype = new BaseImage();
var g_volumeImage = new VolumeImage();

// ----- CREATE MENU -----
function CustomMenu(x, y) {
var a = window.CreatePopupMenu();
var idx;

for (var i = 0; i < d_arr.length; i++) {
a.AppendMenuItem(0, 1 + i, d_arr[i]);
}
a.CheckMenuRadioItem(1, 6, d_col + 1);

a.AppendMenuSeparator();
a.AppendMenuItem(0, 7, "Properties");
a.AppendMenuItem(0, 8, "Configure...");

idx = a.TrackPopupMenu(x, y);

switch (true) {
case (idx >= 1 && idx <= 6):
window.SetProperty("Display Colour", idx - 1);
InitColours();
info.setColours();
g_trackNoImage.reset();
g_totalNoImage.reset();
g_timeImage.reset();
g_bitrateImage.reset();
g_volumeImage.reset();
window.Repaint();
break;

case (idx == 7):
window.ShowProperties();
break;

case (idx == 8):
window.ShowConfigure();
break;
}

a.Dispose();
}

// ----- DRAW -----
function on_paint(gr) {
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, ui_backcol);
drawSquares(gr, 2, 1, 0, 30, ww - 26, 20);

gr.DrawRect(1, 0, ww * 17 / 70, 10, 1, info.Colours[0]);
gr.DrawRect(ww * 71 / 280, 0, ww * 17 / 70, 10, 1, info.Colours[1]);
gr.DrawRect(ww * 141 / 280, 0, ww * 17 / 70, 10, 1, info.Colours[2]);
gr.DrawRect(ww * 211 / 280, 0, ww * 17 / 70, 10, 1, info.Colours[3]);

gr.GdiDrawText("LOSSLESS", btn_font, info.Colours[0], ww / 8 - 33, 0, 70, 10, 37);
gr.GdiDrawText("LOSSY", btn_font, info.Colours[1], ww / 8 * 3 - 34, 0, 70, 10, 37);
gr.GdiDrawText("AUDIO MD5", btn_font, info.Colours[2], ww / 8 * 5 - 34, 0, 70, 10, 37);
gr.GdiDrawText("REPLAYGAIN", btn_font, info.Colours[3], ww - ww / 8 - 33, 0, 70, 10, 37);

gr.GdiDrawText("TRACK", btn_font, info.Colours[4], 0, 18, 27, 10, 37);
gr.GdiDrawText("TOTAL", btn_font, info.Colours[5], 60, 18, 27, 10, 37);
gr.GdiDrawText("ELAPSED", btn_font, v_change || t_rem ? g_bcol : info.Colours[6], ww / 2 - 38, 18, 35, 10, 38);
gr.GdiDrawText("TIME", btn_font, v_change ? g_bcol : info.Colours[6], ww / 2 + 5, 18, 20, 10, 38);
gr.GdiDrawText("REMAINING", btn_font, v_change || !t_rem ? g_bcol : info.Colours[6], ww / 2 + 33, 18, 46, 10, 38);
gr.GdiDrawText("VOLUME", btn_font, v_change ? ui_btntxtcol : g_bcol, ww - 88, 18, 34, 10, 37);
gr.GdiDrawText("KBPS", btn_font, v_change ? g_bcol : info.Colours[6], ww - 46, 18, 20, 10, 37);

if (fb.IsPlaying) {
if (g_trackinfo == 0) {
g_trackNoImage.draw(info.TrackNo);
gr.DrawImage(g_trackNoImage.image, 0, 30, 54, 20, 0, 0, 54, 20);

g_totalNoImage.draw(info.TotalNo);
gr.DrawImage(g_totalNoImage.image, 60, 30, 54, 20, 0, 0, 54, 20);
} else {
var noTrack = g_trackinfo == 1 ? 534 : 420;
g_signs && gr.DrawImage(g_signs, 0, 30, 114, 20, noTrack, d_col * 22, 114, 20);
}

g_signs && gr.DrawImage(g_signs, ww / 2 - 63, 30, 18, 20, fb.IsPaused ? 197 : 179, d_col * 22, 18, 20);
}

if (v_change) {
var vol = fb.Volume.toFixed(2) + " db";
g_volumeImage.draw(pad_right(vol, 10));
gr.DrawImage(g_volumeImage.image, ww - 191, 30, 165, 20, 0, 0, 165, 20);
} else {
if (fb.IsPlaying) {
var t_play = t_rem && fb.PlaybackLength <= 0 ? false : true;
var t_fmt = t_rem ? info.Remain : info.Elapse;
t_play && g_timeImage.draw(t_fmt);
t_play && gr.DrawImage(g_timeImage.image, ww / 2 - 38, 30, 120, 20, 0, 0, 120, 20);
!t_play && g_signs && gr.DrawImage(g_signs, ww / 2 - 38, 30, 120, 20, 300, d_col * 22, 120, 20);

g_bitrateImage.draw(info.Bitrate);
gr.DrawImage(g_bitrateImage.image, ww - 94, 30, 69, 20, 0, 0, 69, 20);
}
}

g_alpha = g_fact == 0.09 ? 20 : 7;
s_alpha = fb.StopAfterCurrent ? 255 : g_alpha;
g_signs && gr.DrawImage(g_signs, ww - 18, 21, 18, 12, 648, d_col * 22, 18, 12, 0, s_alpha);

p_alpha = fb.IsPlaying ? 255 : g_alpha;
g_signs && gr.DrawImage(g_signs, ww - 18, 38, 18, 12, 668 + fb.PlaybackOrder * 20, d_col * 22, 18, 12, 0, p_alpha);

!window.IsTransparent && gr.FillGradRect(0, -25, ww, 75, 90, RGBA(63, 100, 127, 128), 0);
}

// ----- MOUSE ACTIONS -----
function on_mouse_rbtn_up(x, y) {
CustomMenu(x, y);
return true;
}

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

function on_volume_change(val) {
if (v_timer) {
window.ClearTimeout(v_timer);
v_timer = null;
}

v_timer = window.SetTimeout(
function () {
window.RepaintRect(ww / 2 - 38, 18, ww - (ww / 2 - 12), 32);
window.ClearTimeout(v_timer);
v_timer = null;
v_change = false;
}, 3000);

v_change = true;
window.RepaintRect(ww / 2 - 38, 18, ww - (ww / 2 - 12), 32);
}

function on_playback_order_changed(new_order) {
window.RepaintRect(ww - 18, 38, 18, 12);
}

function on_playback_time(time) {
info.setPBTime();
window.RepaintRect(ww / 2 - 38, 30, 120, 20);
}

function on_playback_dynamic_info() {
info.setBitrate()
window.RepaintRect(ww - 94, 30, 69, 20);
}

function on_playback_edited() {
info.setInfo();
window.Repaint();
}

function on_playback_new_track(metadb) {
info.setInfo();
window.Repaint();
}

function on_playback_pause(state) {
window.RepaintRect(ww / 2 - 62, 30, 18, 20);
}

function on_playback_stop(reason) {
if (fileinfo) fileinfo.Dispose();

if (reason != 2) {
info.setInfo();
fb.RunMainMenuCommand("ELPlaylist/Redraw");
}

window.Repaint();
}

function on_playlist_stop_after_current_changed(state) {
window.RepaintRect(ww - 18, 21, 18, 12);
}

function on_notify_data(name, info) {
if (name == "remTime") {
window.SetProperty("Remain Time on", info == true ? true : false);
t_rem = window.GetProperty("Remain Time on");
window.RepaintRect(ww / 2 - 38, 18, 120, 38);
}
}

function on_script_unload() {
g_trackNoImage && g_trackNoImage.dispose();
g_totalNoImage && g_totalNoImage.dispose();
g_timeImage && g_timeImage.dispose();
g_bitrateImage && g_bitrateImage.dispose();
g_volumeImage && g_volumeImage.dispose();
g_signs && g_signs.Dispose();
}
The global script that is loaded looks like this:
Code: [Select]
// DarkOne v4.0 Global Script
// Code by tedGo, using partial code by eXtremeHunter1972

var configPath = fb.FoobarPath + "themes\\DarkOne_v4.0\\";
var imgPath = configPath + "Images\\";
var g_signs = gdi.Image(imgPath + "Signs.png");

var btn_font = gdi.Font("Arial Black", 7, 0);
var ui_type = window.InstanceType;
var ww = 0; wh = 0;

// ----- CREATE RGB(A) -----
function RGBA(r, g, b, a) {
return ((a << 24) | (r << 16) | (g << 8) | (b));
}

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

// ----- CREATE CUSTOM COLOURS -----
function CustomColour(colour){
tempc = colour.split("-");
return ((tempc[3] << 24) | (tempc[0]<<16) | (tempc[1]<<8) | (tempc[2]));
}

function setAlpha(color, a) {
return ((color & 0x00ffffff) | (a << 24));
}

function toRGB(d){
var d, r, g, b;
d = d - 0xff000000; r = d >> 16; g = d >> 8 & 0xFF; b = d & 0xFF;
return [r,g,b];
}

function combColours(c1, c2, f){
var c1, c2;
c1 = toRGB(c1); c2 = toRGB(c2);

var r, g, b;
r = Math.round(c1[0] + f * (c2[0] - c1[0])); g = Math.round(c1[1] + f * (c2[1] - c1[1])); b = Math.round(c1[2] + f * (c2[2] - c1[2]));
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

// ----- GET UI COLOURS -----
function get_colors() {
ui_backcol = ui_type == 0 ? window.GetColorCUI(3) : window.GetColorDUI(1);
ui_textcol = ui_type == 0 ? window.GetColorCUI(0) : window.GetColorDUI(0);
ui_btntxtcol = ui_type == 0 ? window.GetColorCUI(2) : window.GetColorDUI(0);
}

get_colors();

function on_colors_changed() {
get_colors();
window.Repaint();
}
Some users of my config have random crashes of the panel - but with FLAC files only! - with this error message:
Code: [Select]
Error: WSH Panel Mod (DarkOne Display Panel v4.0 by super-gau and tedGo, includes partial codes by fbuser, Br3tt and T.P Wang): Microsoft JScript runtime error:
Overflow
File: <main>
Ln: 176, Col: 4
<source text only available at compile time>
And i don't know why...

The line that causes the crash is:
g_signs && gr.DrawImage(g_signs, xoffset, 0, 18, 20, digitValue == " " ? 216 : digitValue * 18, d_col * 22, 18, 20);
(All variables are defined before)
Could anybody take a look at and point me to the right direction?

If someone wants to try the script, this is the Signs.png file: http://www.abload.de/image.php?img=signs1gujt.png (http://www.abload.de/image.php?img=signs1gujt.png)
Title: WSH Panel Mod script discussion/help
Post by: Propheticus on 2013-03-26 13:59:25
As I said on deviantArt: The problem occurs when a track number contains a period (i.e. "21.").
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-26 14:05:07
Yes, and not only on flac files (was an accident that it only happens with flac files until now).
I now know whats the reason - i haven't respected that users may tag tracknumber with letters/signs besides numbers.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-03-26 14:25:17
I have a workaround that should work (will update the download, too):
Go to the Script and change line 93 from:
var c = fileinfo.MetaValue(fileinfo.MetaFind("tracknumber"), 0);
to:
var c = fb.TitleFormat("$if2($num(%tracknumber%,0),)").Eval();

Then it should work without crashes
Title: WSH Panel Mod script discussion/help
Post by: Propheticus on 2013-03-26 14:25:58
Confirmed. Fix works.
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-03-26 16:30:49
marc2003

Thanks for the hard work.

btw, could you make more options in displaying artist picture in your thumbs script, like keep aspect raito(centre), stretch, not only crop ?
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-03-26 22:45:22
@Marc
I tried your scripts (thumbs, np last fm+wikipedia) on a machine that I stream to using foo_upnp as a renderer.
While the scripts are working well on the machine that i stream from (upnp server + controler), on the renderer i do not see any artist images (only the text and the album art appear in n.p. script and nothing appears in thumbs).

Note:


Do you have any idea? Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-27 09:21:50
@kjllmeplz, i'll have a look into it.

@NEMO7538, as the script is obviously getting artist metadata ok for the other parts of the script to work, perhaps it's the art.exe program that i bundle that's not working? can you browse the marc2003 folder and run it from a command prompt? it will tell you the parameters it needs and you can try something manually.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-27 11:25:55
@NEMO7538, i completely forgot to mention checking the automatic download options on the context menu first.  by default, it only automatically downloads images for tracks that are monitored as part of your library (and have no images existing already). you can change this to all tracks.

the manual trigger should always work regardless of this setting.

@kjllmeplz, done. https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

thumbs and all now playing scripts have these options. the scripts in the panels need updating though.

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing with track list.txt
samples\now playing with last.fm & wikipedia biography.txt
samples\now playing.txt
samples\thumbs.txt

Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-03-27 11:41:11
Thanks .... I'll have a look but unfortunately the context menu doe not work (on both machines). When I right click I only get "Properties" and "Configure" ....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-27 11:56:48
the context menu not working is a new one for me. i cannot fathom how that could even be possible. it's not even part of the script that goes in the panel. it's all handled by my common file (the imported script in the preprocessor section).

accessing the properties dialog bypasses most of the context menu options - if you know what to set. setting image_auto_download to all would at least get automatic downloads going.
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-03-27 13:50:45
marc2003

thank you so much! you are the best
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-28 09:13:23
samples updated: use right click>Update script or the full download is here. https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

thumbs: bugfix. right aligned thumbs would not always scroll properly.

and a reminder to anyone using thumbs or any now playing scripts and are finding the new crop/centre/stretch options have no effect. this means you need to download the latest zip and re-import the script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-28 11:47:46
ooh another update. this time i've added more options to allow you to filter and display release type on my musicbrainz script.



files changed:
Code: [Select]
marc2003\common6.js


right click>Update script should work for most people but the full download link is in the post above.
Title: WSH Panel Mod script discussion/help
Post by: ruebe on 2013-03-28 12:01:46
awesome, two thumbs up!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-28 20:21:09
oh yay, another update.   

this applies to all scripts that use artist metadata to perform lookups online. bugfix: do not try to search with blank/missing tags. 

just right click any one>Update script.
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-03-28 22:00:19
the context menu not working is a new one for me. i cannot fathom how that could even be possible. it's not even part of the script that goes in the panel. it's all handled by my common file (the imported script in the preprocessor section).

Nevermind ... I got the latest version of foo_uie_wsh_panel_mod and it works.
Now what about if I want to directly access the properties and manually change some parameters (e.g. set the download limit to 6 images) ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-28 22:13:10
have you not seen the Limit option on the context menu? from there you can set 1,3,5,10 or 20.

you can of course edit the properties if you really must have 6. image_limit is the one you want.
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-03-28 22:24:58
have you not seen the Limit option on the context menu? from there you can set 1,3,5,10 or 20.

you can of course edit the properties if you really must have 6. image_limit is the one you want.

Yes I have seen it but how do I access the properties?
Edit: Using the Layout Editing mode ...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-28 22:30:06
hold shift when you right click.

i hide it for most people because all settings are usually set via the context menu. the one exception being the tweaking of numerical values such as the limit.
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-03-29 07:06:37
Thanks Marc for your hard work .... Some comments below:

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-29 08:51:19
you shouldn't have to re-scan the folder. it does refresh automatically when downloading is complete. it can take awhile depending on how last.fm is behaving. sometimes it's pretty much instant, other times it can take 5 seconds+.

and there was no optimisation. in your case, it would lookup twice as those panels are independent of each other. however, i've just added in panel notifications. if you Update script, restart when prompted and then turn off automatic download in all panels but one, the "downloading" one should now notify others when downloading is complete.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-29 13:20:09
a few more bugfixes:

simple text reader / simple tag reader: fix crash if tag/filename input dialog is left blank.
simple text reader: fix font size not working on fixed width font.
last.fm similar artists: spotify buttons did not work properly if it was set to pause foobar before launching. i think this was reported before and i thought i'd fixed it but i just stumbled across it again realising i hadn't fixed it at all. 

for those, a simple right click>Update script will do.

full download is here: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-03-29 14:43:20
Oh sweet I found the properties dialog using shift, now I can set the thumb size to fit my layout perfectly, awesome stuff.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-29 23:17:35
marc2003

your vinyl turntable script has eventually decided to crash again (using your tracing code modification at Post #2160 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=828073)).

Here is the console output:
Quote
. . .
Opening track for playback: "F:\music\lib\rock\iggy pop and the stooges\(1973) raw power\vinyl - columbia kc 32111, usa\02. gimme danger.flac"
image:0
nw: 0
nh: 0
object
Error: WSH Panel Mod ({40845811-E334-4CB0-B4C5-DE5B1B33E36F}): Microsoft JScript runtime error:
Object required
File: <main>
Ln: 170, Col: 9
<source text only available at compile time>
. . .

Here is line 170 (red) in my script:
Quote
function calc() {
    if (!img) return;
    for (i = 0; i < images.length; i++) {
        try { images.Dispose(); } catch(e) {}
    }
    images = [];
    try {
        for (i = 0; i < 36; i ++) {
            images = gdi.CreateImage(nw,  nh);
            var temp_gr = images.GetGraphics();
            temp_gr.SetInterpolationMode(6);
            temp_gr.DrawImage(bg, 0, 0, nw, nh, 0, 0, bg.width, bg.height);
            temp_gr.DrawImage(img, disc_x, disc_y, disc_size, disc_size, 0, 0, img.Width, img.Height, i * 10);
            images.ReleaseGraphics(temp_gr);
            temp_gr = null;
        }
    } catch(e) {
        fb.trace("image:" + i);
        fb.trace("nw: " + nw);
        fb.trace("nh: " + nh);
        fb.trace(typeof images);
        fb.trace("width: " + images.Width);
        fb.trace("height: " + images.Height);
    }
}

I went to the containing folder of the track and there is no "disc.jpg", therefore (if no error) default disc should have been used.
I right-clicked the crashed panel, went to the "WSH Panel Mod Configuration" window, clicked the "Apply" button . . . . . and the panel started working again.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-29 23:54:35
hasn't the novelty worn off yet? 

try this updated version... https://dl.dropbox.com/u/22801321/2013/march/turntable.txt (https://dl.dropbox.com/u/22801321/2013/march/turntable.txt)

Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-03-30 02:27:18
marc2003

That is an EXCELLENT update of your turntable script!

-It works slightly faster than the previous script!
-Freezing is no longer perceptible if choosing another track from the same containing folder!
-Console reports nothing irregular!

Brilliant work mate ++++++++++++
 
 
 
        > hasn't the novelty worn off yet? ...

I think these guys need your advice more than I do: "The Prisoner Appreciation Society" (http://www.netreach.net/~sixofone/)

Who/What is TPAS?
They are fanatical fans of the 1967 British TV series "The Prisoner" (http://en.wikipedia.org/wiki/The_Prisoner) . . . . Only one season and 17 episodes were ever made,
yet these fans meet up once a year at the same location where the series was made and re-enact scenes from the show,
and they have not stopped doing this since 1967 !!!! 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-30 07:35:35
i think you're experiencing good old placebo. the changes were very minor.

Quote
-It works slightly faster than the previous script!


if playback is running when the panel is loaded, i've actually increased the delay from 200ms to 300ms so it's slower to load the first image. the difference is negligible but it ain't faster. and there is no change in the code when switching albums. the freeze is still very noticeable.

Quote
-Freezing is no longer perceptible if choosing another track from the same containing folder!


i'm not sure what you mean. it still uses %album% as the title formatting to trigger a change.  there was never any freezing when switching tracks with the same %album% tag. but as mentioned above, the freeze is most definitely still there when albums change.

Quote
-Console reports nothing irregular!


well to be fair the old one only crashed for you twice (well that's what you've reported anyway). it could happen to this one still.

the thing that proved useful from the debugging message you posted was the values of nw and nh which were 0. these should get set on startup and will change if you resize the panel. i've put in some checking to make sure it does not attempt to create any images if those values are 0. i'm hoping it won't crash but as it's not been possible to reliably reproduce it, there's no way i can test for sure.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-30 10:49:03
i've updated my now playing script. you can now toggle various elements on or off via the context menu. because displaying an artist bio is now optional, i've ditched the separate script i had for that.

here are 2 instances running side by side: screenshot (https://dl.dropbox.com/u/22801321/2013/march/now%20playing%20new.jpg)

https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt
samples\now playing with last.fm & wikipedia biography <<deleted
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-30 13:04:21
i stupidly bodged the now playing.txt file in my previous update. the fixed version is in the zip from the post above.

(one of the settings wasn't loaded properly on startup. not serious but could be puzzling/annoying )
Title: WSH Panel Mod script discussion/help
Post by: pupil on 2013-03-30 13:56:43
i've updated my now playing script. you can now toggle various elements on or off via the context menu. because displaying an artist bio is now optional, i've ditched the separate script i had for that.

here are 2 instances running side by side: screenshot (https://dl.dropbox.com/u/22801321/2013/march/now%20playing%20new.jpg)

https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt
samples\now playing with last.fm & wikipedia biography <<deleted


Great scripts, really appreciate your work on these. Could you make the track info and rating elements separate? I'd like to display the track info but I don't use the rating stars and would like to remove these. I do it manually by editing the script already, but it would be easier if it was selectable in the menu. Many thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-30 15:40:36
the trouble with making the rating separate, is where to put it if people turn the track info off. i'll try and think of something.
Title: WSH Panel Mod script discussion/help
Post by: pupil on 2013-03-30 15:56:10
the trouble with making the rating separate, is where to put it if people turn the track info off. i'll try and think of something.


Thanks Marc, I think the ratings location won't be a problem, it would look fine where it is without the track info. If someone has got to the point where they are using your scripts, they would know what all of the separate elements do, I'm sure.

Thanks again.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-30 19:24:17
it would look fine where it is without the track info.


it looks ok with CD cover off but not when it's on. it looks stupid sat next to it on it's own.

anyway, rather than make it independent, the script now checks for foo_playcount. if it's missing, the rating will not display.

https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt


to make it easier for people to edit the track info display, i've put this at the top of the script.

Code: [Select]
var line1 = {text: "", tf: "%artist%", font: gdi.Font("Segoe UI", 30, 1), colour: RGB(240, 240, 240), y: 0}
var line2 = {text: "", tf: "%title%", font: gdi.Font("Segoe UI", 22, 1), colour: RGB(210, 210, 210), y: 0}
var line3 = {text: "", tf: "[[%album%] '('%date%')']", font: gdi.Font("Segoe UI", 18, 1), colour: RGB(180, 180, 180), y: 0}


leave the text empty. customise title formatting how you like. changing the font is easy too. it's simply font/size/style. the style set to 1 indicates bold text. other values:

Code: [Select]
    Regular: 0,
    Bold: 1,
    Italic: 2,
    BoldItalic: 3,
    Underline: 4,
    Strikeout: 8


colour is straight forward again and you can tweak the value of y. this is used to shift the vertical position from it's default. you might need to do this if changing font sizes.


Title: WSH Panel Mod script discussion/help
Post by: pupil on 2013-03-30 21:46:27
it would look fine where it is without the track info.


it looks ok with CD cover off but not when it's on. it looks stupid sat next to it on it's own.

anyway, rather than make it independent, the script now checks for foo_playcount. if it's missing, the rating will not display.


Hi thanks again. This work around wouldn't actually work for me as I do have foo_playcount installed so that I can record a files %added% data, but not for rating the tracks. So, for me, the rating stars will still appear even though I won't be using foo_playcount for that function. Any other way you can think to remove the stars where you'll be happy with the layout?

Really appreciate this, thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-30 21:56:32
edit line 36:

Code: [Select]
var np_rating_check = utils.CheckComponent("foo_playcount", true);


to become

Code: [Select]
var np_rating_check = false;
Title: WSH Panel Mod script discussion/help
Post by: pupil on 2013-03-30 23:05:41
edit line 36:

Code: [Select]
var np_rating_check = utils.CheckComponent("foo_playcount", true);


to become

Code: [Select]
var np_rating_check = false;


Brilliant, that's perfect, many thanks!
Title: WSH Panel Mod script discussion/help
Post by: FooChick on 2013-03-31 18:30:46
Hello Marc - I really love your scripts.
I would love to edit the width of the biography txt column. Something like this:

(http://i47.tinypic.com/2co4kfo.jpg)

Thanx in advance
Natasha



Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-03-31 18:43:22
line 74 is

Code: [Select]
t.x = p.w - Math.round(p.w / 3);


that represents 1/3 of the panel width. you could try changing it to 4 for a quarter. or you can fix the size in pixels....

Code: [Select]
t.x = p.w - 200;
Title: WSH Panel Mod script discussion/help
Post by: FooChick on 2013-03-31 20:07:39
Marc, - line 74

Beautiful!
4 is fine, and 5 is nice for fullscreen (1920x1080)

Thank you Marc2003!
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-04-01 09:56:27
Thanks Marc for your nice work
I have tweaked () the NP script, see below (quick and dirty: larger albumart size + placed on top with track info + merged thumbs + large track info fonts)
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common6.js"
// @name "Now Playing"
// @author "marc2003"
// @version "6.2013-03-27.01"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
var th = new thumbs();
//first argument is any arbitrary text to name the panel. it will use in the console and popup boxes.
//seconds argument is an array of features. i'll post a full list of acceptable/required values at some point. it's mostly for handling right click menus.
var p = new panel("Now Playing", ["remap", "cd", "images", "metadb", "thumbs"]);
//force the panel to always prefer the playing track regardless of selection
p.selection_mode = 1;
//setup a new cd cover: x, y co-ords and width & height
//var c = new cd(10, p.h - 190, 200, 200);
var c = new cd(0, -20, 360, 360);
//setup rating, x, y co-ords and button size
//var r = new rating(220, p.h - 35, 24);
//note that because some co-ords are relative to panel size (p.w is width, p.h is height), we need to update these values in the on_size function later

//setup images, x, y, width, height,
var im = new images(0, 0, p.w, p.h);
//setup buttons
/*
var b = new buttons();
b.buttons = {}
b.update = function() {
//only add web link buttons if we have a valid selection
if (p.metadb) {
var artist = encodeURIComponent(p.eval("%artist%"));
var title = encodeURIComponent(p.eval("%title%"));
var myspace = "http://www.myspace.com/search/music?q=" + artist;
var lastfm = "http://www.last.fm/music/" + artist + "/_/" + title;
var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
var discogs = "http://www.discogs.com/search?q=" + artist;
var allmusic = "http://www.allmusic.com/search/artists/" + artist;
b.buttons = {
           
            but5: new button(p.w - 163, 0, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
but6: new button(p.w - 131, 0, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
but7: new button(p.w - 99, 0, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
but8: new button(p.w - 67, 0, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
but9: new button(p.w - 35, 0, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
   
       
        }
}
window.RepaintRect(0, 0, 160, 32);
}
*/
//setup 3 lines of text for the display. editing this should be self explanaotory. if you change the font sizes, adjustments may need
//to be made to the positions in the on_paint function
var line1 = {text: "", tf: "$if($strcmp($strstr(%artist%,','),0),%artist%,$cut(%artist%,$sub($strstr(%artist%,','),1)))", font: gdi.Font("Segoe UI", 48, 1), colour: RGB(250, 250, 250)}
var line2 = {text: "", tf: "%title%", font: gdi.Font("Segoe UI", 36, 1), colour: RGB(230, 230, 230)}
var line3 = {text: "", tf: "[[%album%] '('%date%')'] ['['# %tracknumber%']']", font: gdi.Font("Segoe UI", 28, 1), colour: RGB(190, 190, 190)}

//startup
on_item_focus_change();
//b.update();

function on_playback_time(time) {
//this function handles the cycling of images if enabled.
im.playback_time(time);
}

function on_size() {
   
//always call p.size to update the values of p.w and p.h
p.size();
//cd case y co-ord updated relative to bottom of panel
//c.y = p.h - 190;
//further updates to co-ords/sizes
//r.y = p.h - 35;
//im.w = p.w;
//im.h = p.h;
    //b.update();
    th.calc();
}

function on_paint(gr) {
//my own helper functions. note some things need to layered on top of each other.
//first draw the background. you'll only see this if there are no images to display
p.draw_background(gr);
//now we draw the background image as everything else goes on top
//im.images is an array of images. im.index is the current image. this value changes when scrolling the mouse or when cycling is enabled
//p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
if (im.images.length > 0) {
th.draw(gr);
if (th.mode == "grid") {
if (th.overlay) p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "centre");
} else {
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
}
} else {
p.centre_text(gr, p.metadb ? "[no image]" : "[no selection]", p.normal_font, p.textcolour, 0, 0, p.w, p.h);
}
    //"crop" can also be "centre" or "stretch"
//this function also takes 2 additional arguments: border colour and alpha eg.
//a red border
//p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "crop", RGB(255, 0, 0));
//no border but alpha level of 128. values can be between 0 and 255
//p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "crop", null, 128);

    //draw the slightly transparent rectangle at bottom
gr.FillSolidRect(0, 35, p.w, 145, RGBA(0, 0, 0, 156));
//draw the cd cover
c.draw(gr);
//web link buttons
//b.draw(gr);
//draw the rating panel
//r.draw(gr);
//draw the text. the last 4 values are x,y,w,h
p.left_text(gr, line1.text, line1.font, line1.colour, 365, 45, p.w - 365, 40);
p.left_text(gr, line2.text, line2.font, line2.colour, 365, 95, p.w - 365, 32);
p.left_text(gr, line3.text, line3.font, line3.colour, 365, 145, p.w - 365, 20);
}

function on_metadb_changed() {
//call these functions when selection changes/tag updates are made
//buttons. links are based off artist/track metadata
//b.update();
//cd
c.metadb_changed();
//rating
//r.metadb_changed();
//images
im.metadb_changed();
//only update text if we have a valid selection
if (p.metadb) {
line1.text = p.eval(line1.tf);
line2.text = p.eval(line2.tf);
line3.text = p.eval(line3.tf);
}
window.Repaint();
}

//we need to update buttons whenever their state could be changed. as these are playback buttons, we need to call
//updates when this happens.

function on_playback_stop() {
on_item_focus_change();
//b.update();
}

function on_playback_pause() {
//b.update();
}

function on_playback_starting() {
//b.update();
}

function on_get_album_art_done(metadb, art_id, im, ip) {
//used by cd cover for updates
c.get_album_art_done(im, ip);
}

function on_mouse_wheel(step) {
    th.wheel(step);
//this scrolls through multiple images
im.wheel(step);
}

function on_mouse_move(x, y) {
//we only need to call p.move if there elements in our panel which require scrollling as i need to track where the mouse is. do not return after it.
p.move(x, y);
    th.move(x, y);
//if mouse detected over rating, no point in checking the rest
//if (r.move(x, y)) return;
//buttons -update tooltips
//if (b.move(x,y)) return;
//cd - tooltip
if (c.move(x, y)) return;
//note the order. because the buttons are on top of the cd, we need to check that first
}

function on_mouse_lbtn_up(x, y) {
//check for button clicks
//if (b.lbtn_up(x, y)) return;
//check for rating clicks
//if (r.lbtn_up(x, y)) return;
    th.lbtn_up(x, y);
}

function on_mouse_lbtn_dblclk(x, y) {
//double click to open images
//cd
if (c.lbtn_dblclk(x, y)) return;
//image
if (im.lbtn_dblclk(x, y)) return;
//again we need to check order because the image covers the whole panel so we need to return if the cd was double clicked first
}

So here are a few suggestions :
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-01 12:17:32
i like what you've done. i'll have a go at implementing those things.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-01 18:03:16
now playing updated: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt


changes:

new common file has broken compatibility with now playing dated the 30th march  people will have to update but older versions should still work because they don't have a context menus like these new ones.
implemented thumbs (off by default)
variable CD art size. just scroll your mouse wheel over it
top/bottom alignment for CD art/track info.
everything can be enabled/disabled from the context menu

a few example layouts here: screenshot (http://dl.dropbox.com/u/22801321/2013/april/now%20playing%2001.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-01 20:40:34
obviously i didn't test all combinations like i should have. there is a bug with top aligned thumbs and bottom aligned cd/track info.

updated: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

files changed:
Code: [Select]
samples\now playing.txt
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-04-01 21:40:22
Marc noticed a few bugs in your thumbs script. The cycle of 5 seconds works fine but 10 and 20 are not changing the picture. The crop code isn't working, it does nothing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-01 22:01:17
because the context menu is controlled by my common file, you must have updated that but not the script in the panel. i did mention it when i pushed that update a few days back....

and a reminder to anyone using thumbs or any now playing scripts and are finding the new crop/centre/stretch options have no effect. this means you need to download the latest zip and re-import the script.


i know i don't make it easy for people to keep a track of things. 

and cycle works fine for me. due to the way it's coded, if it works for one value, it has to work for others.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-04-01 22:58:18
Sorry I'm always in a rush when I get time to go on here so overlooked/forgot it.

Actually I updated the script using update script in the context menu, I just pasted the new sample in from the samples zip and it's working now but I thought that's what the update script option does? So it's not actually updating I still need to paste in the updated sample zip?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-01 23:28:47
Sorry I'm always in a rush when I get time to go on here so overlooked/forgot it.


like i said, it's really not your fault -rather it's mine. you can't really be expected to trawl the thread looking for every update. i'll have to try and manage updates better - i have a few ideas.

the vast majority of code is in the common file and updates work well for the most part. this problem occurred because your updated common file had all the code for handling the context menu in it. but the basic layout and positioning of the image happens in the panel. that's why it needed updating - it was hardcoded to crop images and it did not recognise the fact that there were new user settings it could use.

my goal when doing my last major update was not to update panel scripts but i have had to do it far more often than i'd like. i guess that's the price i pay for being an amateur bodger. i never plan anything in advance.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-04-02 01:09:29
Lol well I don't mind keeping an eye on your samples, I guess I better bookmark the download link. Could you not put all the code into the common file that way updating the script will cover all of your new code changes? My apologies if that is a naive suggestion

Also it's a shame the code doesn't retain when importing .flc skins as I share my layout with friends and family who want to use your scripts too.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-02 01:32:21
panel script settings do get properly saved as part of .fcl files. remember you'd have to share the entire marc2003 folder as well for it to work. (and the WSH panel mod component) back when i used to use columns UI, i shared a few themes with no problems at all.

you'll find most themes on deviant art have WSH panels as well.

putting all the code in external files is a nice idea but it doesn't really suit me at the moment. it's something i might think about looking at again. i dunno.
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-04-02 16:13:11
Marc .... I am tweaking the NP script and have this error sometimes ... when changing the rating
Code: [Select]
Error: WSH Panel Mod (Now Playing v6.2013-04-01.03 by marc2003): Erreur d'exécution Microsoft JScript:
Dépassement de capacité (Capacity overflow)
File: C:\Program Files (x86)\foobar 1.2\marc2003\common6.js
Ln: 1328, Col: 3
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-02 16:58:20
reproduced here when using the top style - using bottom, it's fine. i have to say i'm completely stumped. that line is refers to this inside my CD drawing function.

Code: [Select]
window.RepaintRect(this.x, this.y, this.w, this.h);


you could replace it with a simple

Code: [Select]
window.Repaint();


to make it work for now. i'll try and find the cause and a proper solution.

EDIT: i'm finding even more unrelated bugs inside the now playing script now. it's been removed from my samples.zip to stop anyone else stumbling across it. 
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2013-04-02 17:18:18
Thanks .... it works now, and here is my tweaked script below. I only changed the placement of the rating and the web links.
(Please note the common6b.js at the beginning).
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common6b.js"
// @name "Now Playing"
// @author "marc2003"
// @version "6.2013-04-01.03"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var line1 = {text: "", tf: "$if($strcmp($strstr(%artist%,','),0),%artist%,$cut(%artist%,$sub($strstr(%artist%,','),1)))", font: gdi.Font("Segoe UI", 48, 1), colour: RGB(250, 250, 250), y: 0}
var line2 = {text: "", tf: "%title%", font: gdi.Font("Segoe UI", 36, 1), colour: RGB(230, 230, 230), y: 55}
var line3 = {text: "", tf: "[[%album%] '('%date%')']", font: gdi.Font("Segoe UI", 28, 1), colour: RGB(190, 190, 190), y: 100}

/*
leave the text empty. customise tf (title formatting) how you like. changing the font is easy too. it's simply font/size/style.
the style set to 1 indicates bold text. other values:

0: Regular
1: Bold
2: Italic
3: BoldItalic
4: Underline
8: Strikeout

colour is straight forward again and you can tweak the value of y. this is used to shift the vertical position from it's default.
you might need to do this if changing font sizes. negative numbers shift up and postive goes down.
*/

var p = new panel("Now Playing", ["custom_background", "now_playing", "lastfm_bio_mod", "remap"]);
p.selection_mode = 1;

var np_cd = window.GetProperty("np_cd", true);
var np_cd_size = window.GetProperty("np_cd_size", 200);
var np_track = window.GetProperty("np_track", true);
var np_track_top = window.GetProperty("np_track_top", false);
var np_buttons = window.GetProperty("np_buttons", true);
var np_bio = window.GetProperty("np_bio", true);
var np_cd_size = window.GetProperty("np_cd_size", 200);
var np_rating = window.GetProperty("np_rating", true);
window.GetProperty("thumbs_mode", "off");

var c = new cd(0, 0, np_cd_size, np_cd_size);
var r = new rating(0, 0, 24);
var t = new text(0, 0, 0, 0);
var im = new images(0, 0, 0, 0);
var th = new thumbs(0, 0 , 0, 0)
var b = new buttons();
var bar1y = 0;
var bar1h = 0;
var bar2y = 0;
var bar2h = 0;

b.buttons = {}
b.update = function() {
if (p.metadb) {
var artist = encodeURIComponent(p.eval("%artist%"));
var title = encodeURIComponent(p.eval("%title%"));
var myspace = "http://www.myspace.com/search/music?q=" + artist;
var lastfm = "http://www.last.fm/music/" + artist + "/_/" + title;
var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
var discogs = "http://www.discogs.com/search?q=" + artist;
var allmusic = "http://www.allmusic.com/search/artists/" + artist;
b.buttons = {
            /*
but5: new button(im.x + im.w - 160, bar2y - 1, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
but6: new button(im.x + im.w - 128, bar2y - 1, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
but7: new button(im.x + im.w - 96, bar2y - 1, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
but8: new button(im.x + im.w - 64, bar2y - 1, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
but9: new button(im.x + im.w - 32, bar2y - 1, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
            */
           
            but5: new button(im.x + p.w - 160, np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
but6: new button(im.x + p.w - 128, np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
but7: new button(im.x + p.w - 96,  np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
but8: new button(im.x + p.w - 64,  np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
but9: new button(im.x + p.w - 32,  np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
           
            /*
            but5: new button(p.w - 163, 0, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
            but6: new button(p.w - 131, 0, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
            but7: new button(p.w - 99, 0, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
            but8: new button(p.w - 67, 0, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
            but9: new button(p.w - 35, 0, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
            */
}
}
window.RepaintRect(0, 0, 160, 32);
}

on_item_focus_change();

function on_playback_time(time) {
im.playback_time(time);
}

function on_size() {
p.size();
th.calc();
c.x = im.x;
switch(true) {
case np_track_top:
c.y = im.y - (np_cd_size * 0.05);
            //bar1y = 0;
//bar1h = np_track ? 100 : 0;
            //bar2y = bar1h;
            bar1y = 35;
            bar1h = np_track ? 145 : 0;
bar2y = bar1h + bar1y;
//bar2h = np_buttons || np_rating ? 30 : 0;
            bar2h = 0;
//t.y = bar1h + bar2h;
            t.y = bar1y + bar1h + bar2h;
break;
default:
c.y = im.y + im.h - np_cd_size + (np_cd_size * 0.05);
            //bar1y = im.y + (np_rating || np_buttons ? im.h - 130 : im.h - 100);
bar1y = im.y +  im.h - 180;
bar1h = np_track ? 145 : 0;
bar2y = im.y + im.h - 30;
//bar2h = np_buttons || np_rating ? 30 : 0;
            bar2h = 0;
t.y = im.y;
break;
}
//r.y = bar2y + 3;
    r.y = bar1y + 10;
line1.ny = bar1y + line1.y;
line2.ny = bar1y + line2.y;
line3.ny = bar1y + line3.y;
t.x = im.x + im.w - Math.round(im.w / 3);
t.w = im.x + im.w - t.x - 15;
//t.h = im.h - bar1h - bar2h;
    t.h = im.h - bar1h - 35 - bar2h;
   
t.size();
b.update();
}

function on_paint(gr) {
p.draw_background(gr);
if (im.images.length > 0) {
th.draw(gr);
if (th.mode == "grid") {
if (th.overlay) p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "centre");
} else {
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
}
}
tix = im.x + (np_cd ? np_cd_size : 10);
//r.x = tix;
    r.x = p.w - 130;
if (np_track) {
//gr.FillSolidRect(im.x, bar1y, im.w, bar1h, RGBA(0, 0, 0, 196));
        gr.FillSolidRect(im.x, bar1y, p.w, bar1h, RGBA(0, 0, 0, 156))
//p.left_text(gr, line1.text, line1.font, line1.colour, tix, line1.ny, im.w - tix - 10, line1.font.Height);
//p.left_text(gr, line2.text, line2.font, line2.colour, tix, line2.ny, im.w - tix - 10, line2.font.Height);
//p.left_text(gr, line3.text, line3.font, line3.colour, tix, line3.ny, im.w - tix - 10, line3.font.Height);
        p.left_text(gr, line1.text, line1.font, line1.colour, tix, line1.ny, np_rating ? p.w - tix - 140 : p.w - tix - 10, line1.font.Height);
p.left_text(gr, line2.text, line2.font, line2.colour, tix, line2.ny, p.w - tix - 10, line2.font.Height);
        p.left_text(gr, line3.text, line3.font, line3.colour, tix, line3.ny, p.w - tix - 10, line3.font.Height);
}
if (np_rating || np_buttons) gr.FillSolidRect(im.x, bar2y, im.w, bar2h, RGBA(0, 0, 0, 136));
if (np_cd) c.draw(gr);
if (np_rating) r.draw(gr);
if (np_buttons) b.draw(gr);
if (np_bio) {
        gr.FillSolidRect(t.x - 15, t.y, t.w + 30, t.h, RGBA(0, 0, 0, 156));
t.draw(gr, RGB(240, 240, 240));
}
}

function on_metadb_changed() {
b.update();
c.metadb_changed();
r.metadb_changed();
im.metadb_changed();
t.metadb_changed();
if (p.metadb) {
line1.text = p.eval(line1.tf);
line2.text = p.eval(line2.tf);
line3.text = p.eval(line3.tf);
}
window.Repaint();
}

function on_playback_stop() {
on_item_focus_change();
b.update();
}

function on_playback_pause() {
b.update();
}

function on_playback_starting() {
b.update();
}

function on_get_album_art_done(metadb, art_id, im, ip) {
c.get_album_art_done(im, ip);
}

function on_mouse_wheel(step) {
if (np_cd && c.trace(p.mx, p.my)) {
np_cd_size += step * 25;
if (np_cd_size < 200) np_cd_size = 200;
if (np_cd_size > 400) np_cd_size = 400;
window.SetProperty("np_cd_size", np_cd_size);
c.y = Math.round(np_track_top ? im.y - (np_cd_size * 0.05) : im.y + im.h - np_cd_size + (np_cd_size * 0.05));
c.w = np_cd_size;
c.h = np_cd_size;
window.Repaint();
return;
}
if (th.wheel(step)) return;
if (np_bio && t.wheel(step)) return;
im.wheel(step);
}

function on_mouse_move(x, y) {
p.move(x, y);
    if (np_rating && r.move(x, y)) return;
    if (np_buttons && b.move(x,y)) return;
if (th.move(x, y)) return;
if (np_bio && t.move(x, y)) return;
if (np_cd && c.move(x, y)) return;
}

function on_mouse_lbtn_up(x, y) {
    if (np_rating && r.lbtn_up(x, y)) return;
    if (np_buttons && b.lbtn_up(x, y)) return;
if (th.lbtn_up(x, y)) return;
if (np_bio && t.lbtn_up(x, y)) return;
}

function on_mouse_lbtn_dblclk(x, y) {
if (np_cd && c.lbtn_dblclk(x, y)) return;
if (im.lbtn_dblclk(x, y)) return;
}

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-02 20:32:30
samples updated: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

-major version bumpage meaning full marc2003 folder has be extracted again and all scripts imported again to take advantage of it. all old scripts will continue to work as normal as this does not affect them.
-a changelog (https://dl.dropbox.com/u/22801321/wsh/changelog.txt) which i promise to update 

Code: [Select]
02-04-2013

NEW: Can now check if scripts in panels are current after using "Update script". You will be prompted if they need updating.
NEW: Add "pattern" option to "Background" menu in some scripts such as "Now playing", "Thumbs" and "CD Jewel Case".
FIX: Lots of bugs squished in "Now playing".
CHG: Renamed lots of settings internally for consistency so you might find a few of them have been "forgotten". Just use the right click menu to set them again.
     All important data such as cached images, online feed data, saved autoplaylist queries and last.fm username are untouched.


-using Update script on previous versions now results in nothing happening. because i deleted the online copy, you will see a 404 error from dropbox in the console. i removed the file so you don't get the false impression it's up to date. that's what would happen if i left it there.

edit: and i'm off to a bad start already. found and fixed a few more bugs in now playing since i posted. starting to hate this script now
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2013-04-02 22:40:53
Guys, can you please comment on the efficiency of using a shared *.js script and importing it everywhere instead of copy-pasting things (the ones which are needed, obviously).

I currently use these two panels:

http://pastebin.com/Nd81uR23 (http://pastebin.com/Nd81uR23) (used to display CUETools logs named either rip.txt, or rip (%discnumber%).txt for multi-disc albums)
http://pastebin.com/b9M83BxQ (http://pastebin.com/b9M83BxQ) (used to display album art)

And I'm wondering if there are ways I could improve them. Huge thanks to marc2003 for the basics + inspiration.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-02 23:06:46
you could argue my scripts loading a shared file into memory for every panel is wasteful when most of the code won't be used. but in the grand scheme of things, it doesn't really matter. for me, it's made my life easier to manage them all as i have over 20 now.

only you can answer the question about improving yours. if they do what you need already then leave them be. i wouldn't lock panel sizes on scripts you share though. some people might find that undesirable.
Title: WSH Panel Mod script discussion/help
Post by: ruebe on 2013-04-03 11:42:56
@marc: i was toying around with your now playing script and stumbled upon background > splitter
i don't get the usage point of it...in DUI that is...is this something that's only supposed to be useful for panel stack splitter? if not, what's the point i'm missing?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-03 11:54:52
the Background menu is shared between many scripts and the splitter option is mainly useful for button scripts like this....

(https://dl.dropbox.com/u/22801321/2013/april/splitter.png)

it's a system colour and it's meant to blend in with the standard look. it will change if you use a 3rd party windows theme.
Title: WSH Panel Mod script discussion/help
Post by: ruebe on 2013-04-03 16:12:04
ah, okay, i get it now

once more, thx for all your scripts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-03 19:09:48
samples updated: right click>Update script will only work for those people using the new full update from yesterday (2nd april)

full download: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)
changelog: https://dl.dropbox.com/u/22801321/wsh/changelog.txt (https://dl.dropbox.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: carlito95 on 2013-04-04 21:28:16
I've been using my own modded MNLT2 theme (all I did was change the colors, font and added a filter panel) for several months now, and now the WSH panel with the progress bar starts crashing everytime I start playing a song. I've tried starting from a fresh download of the skin and re-changed the colors/fonts and added the filter bar and it works fine for the duration my computer is on, but when I turn it on the next day and open up foobar, the progress bar just crashes again. I haven't actually started messing with WSH for myself, but does anyone have an idea of what could be causing this? Thanks in advance.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-04 21:49:00
do you have any idea how useless your report is? 

checking the foobar console and posting the offending errors/code would be a start.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-07 14:40:16
marc2003

I am still enjoying your WSH Vinyl Turntable script; the novelty hasn't worn off . . . mainly because I am a die-hard vinyl freak. It's purring along nicely; It looks like you permanently solved the crashing issue.

If I was a CD freak, I wouldn't be asking you this question . . . however vinyl records are different; they contain more than one label.

If you have ripped a vinyl record, you have ripped two sides and each label is different. Therefore for every track using disc.jpg, there should actually be a choice between disc1.jpg or disc2.jpg representing side1 and side2 of the record.

For all my vinyl rips, I was thinking of modifying the %tracknumber% tag to have multiple values like these examples:

This is 1 vinyl record — it has 4 tracks , 2 are on side1 , 2 are on side2 — here is the %tracknumber% tags:
Quote
01;1
02;1
03;2
04;2
[/size][/font]
This is 2 vinyl records (a 2-LP album) — it has 8 tracks , 2 are on side1 , 2 are on side2 , 2 are on side3 , 2 are on side4 — here is the %tracknumber% tags:
Quote
01;1
02;1
03;2
04;2
05;3
06;3
07;4
08;4
[/size][/font]

As you can see, the second value in the tracknumber tag is a number representing a side of a record.
How can your script be modified to flag this tag value and choose the appropriate image from   disc1.jpg | disc2.jpg | disc3.jpg| ... | disc(n).jpg

Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-07 15:08:00
you shouldn't need to modify the script. this should be set in the main foobar2000 artwork preferences dialog.

Code: [Select]
disc[%discnumber%].jpg
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-07 16:15:00
marc

I changed foobar200 artwork preferences for disc exactly as you specified.
I set up a test album . . . some tracks were tagged with %discnumber% value 1, some tracks were tagged with %discnumber% value 2.
Your WSH Turntable panel did not refresh to disc2 at any time . . . "play this, stop, play that" actions had no effect; it continued to play disc1 at all times.
Actually previous line is not totally true . . . If I play a track from another album and then go back to the test album and play a track, the panel will refresh.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-07 16:19:27
oops, i forgot to mention you'll need to edit what triggers a change. change %album% on line56 to whatever you like. just adding %discnumber% should be sufficient.

Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-07 16:31:44
you are referring to the item here in red I presume?:
Quote
function on_playback_new_track() {
        metadb = fb.GetNowPlaying();
        if (!metadb) return;
        var temp_album = fb.TitleFormat("%album%").EvalWithMetadb(metadb);
        if (temp_album == album) return;
        album = temp_album;
        img = utils.GetAlbumArtV2(metadb, id);
        if (img) {
                mask();
                calc();
        }
        window.Repaint();
}



Yeah, it worked . . . . thanks +++++++
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-07 16:37:10
you presume right. i'm not sure why you had to ask.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-07 17:03:36
it's more educational for everyone viewing
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-07 17:19:03
marc
it still has a small problem . . .
if i change to an album containing one disc.jpg and no %discnumber% tag filled, then the default disc image will show (rather than disc.jpg at track location).

*EDIT*

I think I fixed it by changing this item (in red) in the script from this:
Quote
var temp_album = fb.TitleFormat("%discnumber%").EvalWithMetadb(metadb);

to this:
Quote
var temp_album = fb.TitleFormat("$if2(%discnumber%,%album%)").EvalWithMetadb(metadb);
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-07 17:32:34
you're getting it all mixed up. first of all, i said you should add %discnumber% to the %album% string. with your code, it won't update when switching albums if the %discnumber% remains the same.

Quote
then the default disc image will show (rather than disc.jpg at track location)


this is dictated by what is set in the artwork preferences and what i already gave you should account for that.

Code: [Select]
disc[%discnumber%].jpg
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-07 17:37:08
now you've got me confused. . .

> i said you should add %discnumber% to the %album% string . . .

please show me the exact code line which is correct in your eyes, thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-07 17:43:26
this is what i said.

change %album% on line56 to whatever you like. just adding %discnumber% should be sufficient.


original code on line56:

Code: [Select]
var temp_album = fb.TitleFormat("%album%").EvalWithMetadb(metadb);


add %discnumber%

Code: [Select]
var temp_album = fb.TitleFormat("%album%%discnumber%").EvalWithMetadb(metadb);


stop me if i'm going too fast...
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-07 17:47:02
penny has dropped . . . . thanks ++++++
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-07 17:52:49
i suppose i should have put discnumber in the original script but because all my multi-disc CD rips have the same art, i didn't think to do that. i've updated it now:

script: https://dl.dropbox.com/u/22801321/2013/march/turntable.txt (https://dl.dropbox.com/u/22801321/2013/march/turntable.txt)
turntable image: https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg (https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-04-07 20:49:37
you are referring to the item here in red I presume?:
Quote
[!--sizeo:2--][span style=\"font-size:10pt;line-height:100%\"][!--/sizeo--]function on_playback_new_track() {
        metadb = fb.GetNowPlaying();
        if (!metadb) return;
        var temp_album = fb.TitleFormat("%album%").EvalWithMetadb(metadb);
        if (temp_album == album) return;
        album = temp_album;
        img = utils.GetAlbumArtV2(metadb, id);
        if (img) {
                mask();
                calc();
        }
        window.Repaint();
}[/size]
[/color]


Yeah, it worked . . . . thanks +++++++

just FYI, no need to grab the metadb of the playing item in this function, because you have it in input argument, so simply add it in args and remove the first line :

Quote
[!--sizeo:2--][span style=\"font-size:10pt;line-height:100%\"][!--/sizeo--]function on_playback_new_track(metadb) {
        metadb = fb.GetNowPlaying();
        if (!metadb) return;
        var temp_album = fb.TitleFormat("%album%").EvalWithMetadb(metadb);
        if (temp_album == album) return;
        album = temp_album;
        img = utils.GetAlbumArtV2(metadb, id);
        if (img) {
                mask();
                calc();
        }
        window.Repaint();
}[/size]
[/color]



[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]EDIT: typo[/size]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-07 21:21:32
given the absolutely horrible performance of this script on album change, i don't think this change will make much difference. but thanks anyway.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-04-07 22:44:03
i suppose i should have put discnumber in the original script but because all my multi-disc CD rips have the same art, i didn't think to do that. i've updated it now:

script: https://dl.dropbox.com/u/22801321/2013/march/turntable.txt (https://dl.dropbox.com/u/22801321/2013/march/turntable.txt)
turntable image: https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg (https://dl.dropbox.com/u/22801321/2013/march/turntable.jpg)

does this do something? i haven't followed previous discussion about it but just pasted in a WSH panel Mod with image set in the right folder, nothing happens on new track playing ... ?

asking to quickly, id set to 2 = cd image, i've none  better with id = 0 for me...
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-08 03:49:51
Falstaff
marc2003 forgot to share one more image . . . default disc when no 'disc.jpg' exists for the album, giving the effect of an empty spinning turntable platter:

empty platter image (click to see/copy full size):        (http://i.imgur.com/9MLgKxqs.jpg) (http://i.imgur.com/9MLgKxq.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-08 23:35:14
samples updated: https://dl.dropbox.com/u/22801321/samples.zip (https://dl.dropbox.com/u/22801321/samples.zip)

new script: small web links

description from the full changelog: https://dl.dropbox.com/u/22801321/wsh/changelog.txt (https://dl.dropbox.com/u/22801321/wsh/changelog.txt)

Code: [Select]
08.04.2013.01

NEW: "Small Web Links"

     Unlike my old "Web Links" which generates 5 buttons
     based on track metadata, this new script uses the same
     backend as my "Musicbrainz" script to fetch real links.
     Unlike my "Musicbrainz" script which displayed a list
     of wesbites, this displays a more compact row of
     buttons. The most common wesbites have familiar logos.
     For ones that don't, you'll see a tooltip
     when hovering your mouse. If already using the "Musicbrainz"
     script in "links" mode, it should be removed (or kept in
     "releases" mode). Lastly, it can take a second or two
     for buttons to appear on artists that haven't been played
     before due to background web requests that have to be made.



edit2: rewrote changelog.
Title: WSH Panel Mod script discussion/help
Post by: colagen on 2013-04-10 10:41:45
Hi,

Does someone know a way to display a simple dialog box, with two button yes/No, and use the result in a WSH script ?
(I'm adding a menu for quick tagging things like genre, date, but i want to avoid bad clics and get all my library re-tagged..)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-10 11:02:09
you need to disable safe mode in the preferences for this to work.

put this code somewhere and don't edit it
Code: [Select]
var vb = new ActiveXObject("ScriptControl");
vb.Language = "VBScript";

function MsgBox(prompt, buttons, title) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "');
    prompt = prompt.replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    return vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
}


now you can use some custom code like this.

Code: [Select]
var result = MsgBox("Open preferences?", 4, "Question");
if (result == 6) fb.ShowPreferences();


note i passed 4 as the buttons argument. that's a simple Yes/no. i check to see if the result was 6 because that means Yes was clicked.

see all codes here- http://msdn.microsoft.com/en-us/library/sf...v=vs.84%29.aspx (http://msdn.microsoft.com/en-us/library/sfw6660x%28v=vs.84%29.aspx)
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-04-10 11:25:39
Is there any way to apply actions with a button for a bunch of files instead of only one selected or nowplaying?
Like File Operations/Delete files or tagging actions

For now i tried with fb.RunContextCommandWithMetadb(..., fb.GetFocusItem()) but it only applies to the first file of a selection...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-10 11:29:24
fb.GetSelections()
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-04-10 11:30:55
Instead of fb.GetFocusItem()
Is it new? (i haven't engaged with wsh panel mod's new interfaces for a long time...)

EDIT: Thanks btw. ...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-10 11:34:25
it's been around since 1.4.0 so quite awhile.

one other thing you might find useful is the flags..

Code: [Select]
    // [1.4.0] Changed: Accept IFbMetadbHandleList interface for metadb handle list.
    // [1.5.0 Preview 2] Changed: Add new "flags" parameter
    // flags:   0 - default (depends on whether SHIFT key is pressed, flag_view_reduced or flag_view_full is selected)
    //          4 - flag_view_reduced
    //          8 - flag_view_full
    boolean RunContextCommandWithMetadb(command, handle_or_handles, flags = 0);


if you set it to 8, it will even work on context commands that have been hidden by the user. i've found it very handy as people generally like to hide the foo_customdb/last.fm options used by my last.fm playcount script.
Title: WSH Panel Mod script discussion/help
Post by: tedgo on 2013-04-10 11:38:06
Oh, then i must have overread it all the time (or confused with GetSelection...)

EDIT (according to yours):
Wow, i should really read the interfaces.html carefully and play with all the new unknown stuff
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-10 12:18:54
dropbox are now using a new domain/URL re-direction which has broken my update script feature. i've had to make changes which need to be downloaded manually.

snippet from changelog (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt):

Quote
10.04.2013.01

Due to recent changes made by dropbox, you may see
"HTTP error: 0" in your foobar2000 console when trying to run
"Update script". The only way around this is to download this
file manually and save it in the "marc2003" folder.

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common7.js)


this only affects people using the full zip posted on or after the 2nd april. previous versions don't update any more.

the full download is available here: https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: colagen on 2013-04-10 12:30:44
you need to disable safe mode in the preferences for this to work.

put this code somewhere and don't edit it
Code: [Select]
var vb = new ActiveXObject("ScriptControl");
vb.Language = "VBScript";

function MsgBox(prompt, buttons, title) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "');
    prompt = prompt.replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    return vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
}


now you can use some custom code like this.

Code: [Select]
var result = MsgBox("Open preferences?", 4, "Question");
if (result == 6) fb.ShowPreferences();


note i passed 4 as the buttons argument. that's a simple Yes/no. i check to see if the result was 6 because that means Yes was clicked.

see all codes here- http://msdn.microsoft.com/en-us/library/sf...v=vs.84%29.aspx (http://msdn.microsoft.com/en-us/library/sfw6660x%28v=vs.84%29.aspx)


Thanks a lot, this code snippet which allow to use vbscript functions will be useful fore sure
Title: WSH Panel Mod script discussion/help
Post by: colagen on 2013-04-10 14:15:36
And do you know a way to open the properties dialog ? (The one you see when you right-click selected items in a playlist)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-10 15:00:32
my post just up the page shows the documentation for that.

http://www.hydrogenaudio.org/forums/index....st&p=830729 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77883&view=findpost&p=830729)

in your case, the command would simply be "Properties".
Title: WSH Panel Mod script discussion/help
Post by: colagen on 2013-04-10 22:50:28
Okey, thanks. Now, it seems pretty obvious, shame on me for missing it (maybe the documentation should include some basic descriptions of each functions utility)
Title: WSH Panel Mod script discussion/help
Post by: VlaKor on 2013-04-13 19:57:23
(http://savepic.org/3294368m.jpg) (http://savepic.org/3294368.htm)

Help please.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-13 22:21:00
i just tested my musicbrainz script with Iron Maiden set as the artist and it works for me so something must have have corrupted the download of the file??

you can force a fresh download by doing this.

-first of all close foobar
-browse your foobar2000 profile folder in explorer and into the wsh_lastfm folder.
-search for and delete all files named musicbrainz_URLs.json
-lastly open internet explorer and clear the temporary files. (even if you don't use the browser, it still caches data used by my scripts so it needs to be cleared.)

now start foobar and a fresh copy should be downloaded.

edit: completely unrelated to this but discogs seems to be having major server problems at the moment. if anybody finds my script not updating/working, you now know why.
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-04-16 01:31:36
I just did an update of the scripts and now they all crash.

Error: WSH Panel Mod (Art Reader by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>

Did I mess something up?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-16 01:57:06
when i do major updates, files inside the marc2003 folder change so you just need to extract it again.

if you think you have extracted it, then you've put it in the wrong place. the readme will tell you.
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-04-16 02:03:55
Did you do another major update after the one on April 10? I manually extracted and replaced everything then and it was working fine until today.

EDIT: Never mind, I fixed it. Looks like the common7.js file somehow got screwed up when I ran the update scripts command. It was only 1 kb so obviously something was wrong. I just replaced it manually and it's ok now.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-16 02:21:06
sorry about that. it looks like i need to do some more robust checking on file contents before over-writing existing files. i rely on the http server response code of  200 (which means "OK") from dropbox and assume it's safe to update if version numbers don't match. obviously it went a bit wrong when you did your update.

edit: i've now put some checking in. here's a direct link in case you don't trust Update script in the current version.

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common7.js)
Title: WSH Panel Mod script discussion/help
Post by: millzeyweb on 2013-04-17 00:59:08
Hi Marc,

I'd like to say that your work with wsh/fb2k sure is appreciated by many and myself, and you are quite generous in helping others with questions.

I was wondering if you would you be so kind as to help me with a minor change to "nowplaying". I need the ratings stars to read/edit a custom metatag instead of the playback statistics db or standard "rating" metatag as it currently does. I found a post where someone asked the same, but it was many versions ago and didnt apply to your much updated lib and script.

Many thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-17 03:08:56
i couldn't be bothered to implement it properly (such as giving people a choice between foo_playcount or file tags) so i just did a quick bodge job.

https://dl.dropboxusercontent.com/u/2280132...ating%20tag.txt (https://dl.dropboxusercontent.com/u/22801321/2013/april/now%20playing%20%2B%20rating%20tag.txt)

Title: WSH Panel Mod script discussion/help
Post by: millzeyweb on 2013-04-17 05:07:10
i couldn't be bothered to implement it properly (such as giving people a choice between foo_playcount or file tags) so i just did a quick bodge job.

https://dl.dropboxusercontent.com/u/2280132...ating%20tag.txt (https://dl.dropboxusercontent.com/u/22801321/2013/april/now%20playing%20%2B%20rating%20tag.txt)


1000 thank you very muches
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-17 13:23:41
i don't really use my discogs script much but added it today and noticed it's returns anything containing the search term. i've changed it to filter out all the results that don't exactly match.

this is a before/after screenshot. https://dl.dropboxusercontent.com/u/2280132...ril/discogs.png (https://dl.dropboxusercontent.com/u/22801321/2013/april/discogs.png)

if this causes issues, i might make an option to toggle the behaviour on/off.

just right click>Update script.

if nothing happens check the foobar console. if it's http error code 0, you should see the changelog entry dated 10.04.2013

https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

if it's a 404 error, your package is out of date and you need extract the full zip and update the scripts in the panels.

https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)

new users should also download this zip and there are full instructions inside.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-17 14:32:32
is it possible to have individual right-click context menus for different buttons in the same WSH panel?

i plan to make a simple playback panel with the usual play, pause, stop, prev, next.
> the Play button will have "Play random track" in it's right-context menu
> the Stop button will have "Stop after current"
> the Next button will have the 3 Shuffle playback orders

also i have been wondering if this can be achieved with a <keyboardKey + mouseClick> event so i can do a shift+mouseLeftClick
--
i am not much of a WSH coder so i'd like to know upfront if this is possible before i set out on a wild goose chase
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-17 14:40:25
yes that's definitely possible.

this is the callback for a left mouse click and you can check whether shift was held.

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    if (utils.IsKeyPressed(0x10)) {
        //shift key was pressed. do something
    } else {
        //do something else
    }
}
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-17 15:41:24
yes that's definitely possible.

great!
--
thanks for the help marc, much appreciated.
Title: WSH Panel Mod script discussion/help
Post by: tarkus721 on 2013-04-17 18:00:49
Hi marc!

Your News / Reviews / Blogs wsh panel crashes when scrolling down (mouse wheel) on 'Reviews' view if the artist name contains an ampersand.
ex: Emerson, Lake & Palmer; Bog Seger & The Silver Bullet Band.

Error: WSH Panel Mod (News / Reviews / Blogs by marc2003): Microsoft JScript runtime error:
Invalid procedure call or argument
File: C:\My Applications\Placebo Monolithic\foobar2000\marc2003\common7.js
Ln: 1615, Col: 6
<source text only available at compile time>

Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-17 18:29:41
it's not the ampersands. i can't explain why but some of the article's text consists of a single space and that is causing the problem. anyway, fixed version uploaded. right click>Update script.

changelog - https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
full download  - https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: tarkus721 on 2013-04-17 19:01:23
That did the trick...thanks! 
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-18 14:26:58
hey marc,
say my code for a button for the time being is:
Code: [Select]
//...
//tipText = {normal: "Next", alternate: "Random"}
//func = function(){fb.next();}
//altFunc = function(){fb.random();}

function Button(x, y, w, h, defaultImage, hotImage, func, tipText, altFunc)
{
    //...

    if(altFunc === null){
        this.altFuncFlag = false;
    }
    else{
        this.altFuncFlag = true;
        this.altFunc = altFunc;
    }
}

what i want to do is check if the altFunc parameter was passed within the button function.
so i start the if condition to do my business as:
if(is there an altFunc?){...}

but how should i go about it?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-18 16:31:11
that looks rather complicated. for buttons without an alternate function, just assign the normal function to the variable.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-18 19:38:37
that looks rather complicated...
true that but i am basically modding T.P. Wang & Tedgo's script for the moment.
So, i am kinda messing it up (progressively but i am happy with the results)

i did, however, achieve this (thanks to this link at stackoverflow (http://stackoverflow.com/questions/411352/how-best-to-determine-if-an-argument-is-not-sent-to-the-javascript-function))

now, i have it done this way:
Code: [Select]
//func = function(){fb.next();}
//func_alt = function(){fb.random();}

function Button(x, y, w, h, img_src, func, tiptext, func_alt) {
    //...

    this.func = func;

    if(typeof func_alt === 'undefined'){
        this.func_alt_flag = false;
    }
    else{
        this.func_alt_flag = true;
        this.func_alt = func_alt;
    }
}

and for buttons without any alternate function, it doesn't matter cuz that's where the the flag comes handy (the only place it comes handy)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-18 19:57:59
this is how i'd do it.

Code: [Select]
this.func = func;
this.func_alt = func_alt || func;


if func_alt is undefined, it will use the default function.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-18 20:01:21
lol
that's even better
*sigh*

thanks


--
Title: WSH Panel Mod script discussion/help
Post by: Curly on 2013-04-22 19:38:01
Hi!

I am using this script as a volume bar;


Quote
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "Volbar"
// @author "T.P Wang"
// ==/PREPROCESSOR==

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

// gdi.Font is changed, the last paramter is style flags
// FontStyleRegular = 0,
// FontStyleBold = 1,
// FontStyleItalic = 2,
// FontStyleBoldItalic = 3,
// FontStyleUnderline = 4,
// FontStyleStrikeout = 8
// Here is 0, means FontStyleRegular
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;

function on_paint(gr) {
    gr.SetTextRenderingHint(5);
    var ww = window.Width;
    var wh = window.Height;
    var volume = fb.Volume;
    var pos = window.Width * ((100 + volume) / 100);
    var txt = (Math.ceil(volume)) + "dB";
    gr.FillGradRect(0, 0, pos, wh, 90, RGB(240, 240, 240), RGB(100, 230, 100));
    gr.FillGradRect(pos, 0, ww - pos, wh, 90, RGB(240, 240, 240), RGB(190, 190, 190));
    gr.DrawString(txt, g_font, RGB(64, 64, 128), 0, 0, ww, wh, 0x11005000);
    gr.DrawRect(0, 0, ww - 1, wh - 1, 1.0, RGB(150, 150, 150));
}

function on_mouse_lbtn_down(x, y) {
    g_drag = 1;
}

function on_mouse_lbtn_up(x, y) {
    on_mouse_move(x, y);
    g_drag = 0;
}

function on_mouse_move(x, y) {
    if (g_drag) {
        var v = x / window.Width;
        v = (v < 0) ? 0 : (v < 1) ? v : 1;
        v = -100 * (1 - v);
        if (fb.Volume != v) fb.Volume = v;
    }
}

function on_mouse_wheel(delta) {
    if (delta > 0) fb.VolumeUp();
    else fb.VolumeDown();
}

function on_volume_change(val) {
    window.Repaint();
}


Is there any way of modifying this script to act as a seekbar?
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-22 21:29:59
curly... you want to modify this sample or simply want a seekbar?
cuz imho, to make this a seekbar is as good as modifying the entire script.

if you want a similar type seekbar then check this post:
http://www.hydrogenaudio.org/forums/index....st&p=628170 (http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&view=findpost&p=628170)
...the one starting with "var DT_TOP = 0x00000000;"
Title: WSH Panel Mod script discussion/help
Post by: Curly on 2013-04-22 21:54:58
curly... you want to modify this sample or simply want a seekbar?
cuz imho, to make this a seekbar is as good as modifying the entire script.

if you want a similar type seekbar then check this post:
http://www.hydrogenaudio.org/forums/index....st&p=628170 (http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&view=findpost&p=628170)
...the one starting with "var DT_TOP = 0x00000000;"


Thanks for the help! Got it working.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-23 08:33:30
yes that's definitely possible.

this is the callback for a left mouse click and you can check whether shift was held.

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    if (utils.IsKeyPressed(0x10)) {
        //shift key was pressed. do something
    } else {
        //do something else
    }
}

hey marc, i was reading Flags.html and was wondering whether i can skip "utils.IsKeyPressed(...)" and use the flag mask "MK_SHIFT" in, say, "on_mouse_lbtn_up(x, y, mask) {}".
but since i don't have much experience in WSH/jscript per say, i am unable to get this to work.

i am doing it so:
Code: [Select]
var MK_SHIFT = 0x0004;
function on_mouse_lbtn_up(x,y,MK_SHIFT){
    fb.trace("something");
}
but it ignores the mask and works like a normal mouse callback function.

i can't figure out what i may be doing wrong.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-04-23 08:56:16
function on_mouse_lbtn_up(x, y, mask){
   
    if (mask == 4) {
        //shift key was pressed. do something
    } else {
        //do something else
    }
   
}
Title: WSH Panel Mod script discussion/help
Post by: matav on 2013-04-23 09:03:02
aah...
thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-24 15:37:28
samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

Quote
added new "last.fm album info" script. just be aware
many albums have no content. however, clicking the
logo should open the last.fm website on
most album pages.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-25 05:18:19
samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

new script: spectrogram seekbar

(https://dl.dropboxusercontent.com/u/22801321/2013/april/spectrogram%20seekbar.png)

notes-
-it requires ffmpeg and SOX. download links are in the script.
-because it uses ffmpeg for decoding files, you're limited to the codecs it supports. what foobar input components you might have are irrelevant.
-images are generated automatically as songs are played. there can be a delay of a few seconds when playing something for the first time. foo_wave_seekbar users should be used to this.
-current settings create images around 80KB in size per track. these are stored in a folder inside your foobar2000 profile.
-tooltips indicate track position without having to drag
-does not support cuesheets

files changed / added:
Code: [Select]
marc2003\common7.js
marc2003\images\hourglass.png
samples\spectrogram seekbar.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-25 10:31:09
samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt)

Quote
7.2013.04.25.02

"Spectrogram seekbar". Bugfix. Panel would show previous
spectrogram when switching to an unsupported format like
a stream.


files changed:
Code: [Select]
marc2003\common7.js
samples\spectrogram seekbar.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-25 15:08:54
samples updated. same links as above. added a few options to my spectrogram seekbar script.

(https://dl.dropboxusercontent.com/u/22801321/2013/april/clear%20seekbar.png)

other seekbars have been cleaned up slightly.

files changed:
Code: [Select]
marc2003\common7.js
samples\nyan cat seekbar.txt
samples\simple seekbar.txt
samples\spectrogram seekbar.txt
samples\themed seekbar.txt
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2013-04-25 18:14:39
Hi marc. Nice addition to your panels. Couple suggestions, feel free to ignore them 


BTW, as i was posting this, i just had your "Now Playing" panel crash on me out of the blue
Code: [Select]
WSH Panel Mod (Now Playing by marc2003): initialized in 17 ms
Error: WSH Panel Mod (Now Playing by marc2003): Erreur d'exécution Microsoft JScript:
Objet requis
File: C:\Users\Roland\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 1393, Col: 4
<source text only available at compile time>

Looks like it's pointing to this part of common7.js
Code: [Select]
function cd(x, y, w, h) {
    this.draw = function(gr) {
        if (this.shadow) p.draw_image(gr, this.shadow_img, this.x, this.y, this.w, this.h, "centre");
        p.draw_image(gr, this.case_img, this.x, this.y, this.w, this.h, "centre");
        if (this.img) {
→           this.ratio = Math.min(this.w / this.case_img.Width, this.h / this.case_img.Height);
            this.nw = 488 * this.ratio;
            this.nh = 476 * this.ratio;
            this.nx = Math.round((this.w - (452 * this.ratio)) / 2);
            this.ny = Math.round((this.h - this.nh) / 2);
            p.draw_image(gr, this.img, this.nx + this.x, this.ny + this.y, this.nw, this.nh, "crop");
        }
        p.draw_image(gr, this.semi_img, this.x, this.y, this.w, this.h, "centre");
        if (this.gloss) p.draw_image(gr, this.gloss_img, this.x, this.y, this.w, this.h, "centre");
    }
    ...

This all occured at the same time i had my Router crash, as i've noticed when trying to post this i no longer had internet connection. Probably related to the LastFM biography.

EDIT : On the other hand, it might be totally unrelated. I have the panel crashed again right now, and still have Internet access.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-25 19:51:12
i've just removed the spectrogram seekbar from the zip temporarily because it randomly crashes on track changes and i can't figure out why. it's been fine all afternoon but it's just started playing up now. 

spectrogram seekbar has been restored. it should be ok now. just right click>update script to fix.

@r0k, that error would suggest it can't find the case images. but if you've been using it for sometime without issue then i have no idea what would cause it to go wrong all of a sudden.
Title: WSH Panel Mod script discussion/help
Post by: r0k on 2013-04-25 22:00:39
OK. I re-extracted the zip and it's working again. For whatever reason this picture had gone missing. Don't know how it got removed ...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-25 22:12:09
about your other points, i'll consider adding an option where you can specify SOX parameters yourself for image creation.
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2013-04-26 09:10:51
@marc2003 | Spectrogram Seekbar

Thank you very much for your latest brainchild  . The time tooltip is one of those details that comes in very handy.
A minor problem (for me, that is) has however popped up: Either ffmpeg or Sound eXchange are having problems with at least some 'foreign' characters resulting in nil output to screen and disk.
No blurps from the Console with fb.trace activated in the front end script:

Code: [Select]
Opening track for playback: "H:\Rhythmic\K\Aiko Kitahara\Piece Of Love\05 - サヨナラを告げた日が近すぎて.mp3"
cmd /c ""C:\Users\PG\AppData\Roaming\foobar2000\sox\ffmpeg.exe" -i "H:\Rhythmic\K\Aiko Kitahara\Piece Of Love\05 - サヨナラを告げた日が近すぎて.mp3" -f
sox - | "C:\Users\PG\AppData\Roaming\foobar2000\sox\sox.exe" -p -n channels 2 spectrogram -d 3:27 -Y 2000 -r -o
        "C:\Users\PG\AppData\Roaming\foobar2000\spectrogram_cache\HRhythmicKAiko KitaharaPiece Of Love05 - サヨナラを告げた日が近すぎて.mp3.png""

Opening track for playback: "H:\Rhythmic\M\Magma\Üdü Wüdü\01 - Üdü Ẁüdü.flac"
cmd /c ""C:\Users\PG\AppData\Roaming\foobar2000\sox\ffmpeg.exe" -i "H:\Rhythmic\M\Magma\Üdü Wüdü\01 - Üdü Ẁüdü.flac" -f
sox - | "C:\Users\PG\AppData\Roaming\foobar2000\sox\sox.exe" -p -n channels 2 spectrogram -d 4:17 -Y 2000 -r -o
        "C:\Users\PG\AppData\Roaming\foobar2000\spectrogram_cache\HRhythmicMMagmaÜdü Wüdü01 - Üdü Ẁüdü.flac.png""

Notice the 'Ẁ'.
I've changed channels to 2 and the Y parameter to 2000, but the innate values make of course no difference.
A shot in the dark: creating png file and writing to disk fails. Maybe another file naming schema would eliminate the problem? md5 or what do I know?

Btw, I'm trying to figure out how to change SoX' standard colours to something that's matching my layout. Not an easy task it seems.







Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-26 11:04:06
^i now use the $crc32 title formatting function on the path. hopefully that will resolve it.

right click>Update script should work for current users.

samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt)

Quote
7.2013.04.26.01

"Spectrogram seekbar". The naming scheme for images has
been changed so you should clear all old files using the
right click menu. You can now set SOX parameters via a
dialog. See sox.pdf for all options. These
parameters also form part of the cached image filename
so changing them will update the display immediately.

(https://dl.dropboxusercontent.com/u/22801321/2013/april/sox%20dialog.png)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-26 11:32:45
i meant to edit my previous post and not post a new reply. delete me please.
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2013-04-26 21:22:33
^i now use the $crc32 title formatting function on the path. hopefully that will resolve it.

Yes, problem solved!
Very nice with the enhanced right click possibilities and that parametric changes are reflected immediately. Thanks a lot.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-27 14:20:25
marc2003

I'm trying to tweak your "WSH Vinyl Turntable" script a little more . . .

I want to add a right-click context menu item named "View with external viewer" (i.e. opens with system default image viewer).
Could you give me a few quick code lines I can add to the script please.

_____________________________________________________________________________________________


QUICK TIP to anybody else using this panel . . .
I added a really cool enhancement to the interface:

          Mouse Left Click  Down on spinning disc pauses playback / Mouse Left Click Up continues playback
          . . . giving the effect of putting your finger on the turntable platter, stopping it from spinning.

Add these lines to the script configuration:
Code: [Select]
function on_mouse_lbtn_down(x, y) {
    fb.Pause();
}
function on_mouse_lbtn_up(x, y) {
    fb.Play();
}

The code above replaces the original lines added by marc2003 (these original lines by marc2003 didn't do anything useful!! ...as far as I can tell):
Code: [Select]
function on_mouse_lbtn_up(x, y) {
    if (trace(x, y)) fb.PlayOrPause();
}


_____________________________________________________________________________________________

ANOTHER INTERESTING EFFECT POSSIBILITY . . .

          Mouse-left-click-down-and-moving in the disc area changes playback tempo/speed, giving the effect of interactivity
          . . . analogous to playing the record by spinning it with your finger
          . . . no mouse movement = no sound | movement = sound | faster movement = sound+faster tempo | slower movement = sound+slower tempo
          . . . if you could move (spin) the disc at default display speed then you would get exact playback speed !!!

What do you think marc ?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-04-27 15:02:58
I just dropped by to say that my WSH playlist is released here (http://browse.deviantart.com/art/CaTRoX-beta1-368146015) with my new theme.

If you find some bugs please let me know!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-27 15:05:32
(these original lines by marc2003 didn't do anything useful!! ...as far as I can tell):


it was only code to make the start/stop button work on the image. 

i should have documented that..... oh wait, i did. it's the first line of the notes at the top of the script.

i think it's more practical than sitting there holding down your mouse button to pause playback. but whatever works best for you....

@ExtremeHunter, nice. i'll definitely be checking that out later.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-04-27 15:16:01
marc2003

throw it, kick it, shake it, smash it,  I'm sure there are some bugs lurking in the dark corners.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-27 15:17:15
> marc2003: "it was only code to make the start/stop button work on the image."

So, leaving your lines enabled AND including my lines is the right approach for my case, yes?

    *EDIT*
    disregard that question . . . the answer is obviously a choice: "mine or yours" .
    But I must say, enabling/disabling your lines had no effect on whether the start/stop buttons work on the image ...unless I am misunderstanding your description of this.

Could you pass me a few lines to add for the context menu item please.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-27 17:11:41
@ExtremeHunter, really liking the playlist. i could never, ever make something like that. i'm far too stupid.

only one bug found so far. when you click an item that isn't selected, moving your mouse up/down should select tracks above/below. but your script starts moving it straight away. other playlists only do that when the item you've clicked on is already selected.

Quote
But I must say, enabling/disabling your lines had no effect on whether the start/stop buttons work on the image ...unless I am misunderstanding your description of this.


my original script works. perhaps you didn't undo your modifications properly? fb.PlayOrPause() is self explanatory really.

if playback is stopped, it plays.
if playback is um... playing, it pauses.
if playback is paused, it plays.

the image stops/starts spinning accordingly.

and of course you can have the panel do different things on mouse clicks. it not a case of either/or. that would be stupid. you just have to track where the mouse is clicked which is what i do to detect it's over the button.

open image feature added here: https://dl.dropboxusercontent.com/u/2280132...h/turntable.txt (https://dl.dropboxusercontent.com/u/22801321/2013/march/turntable.txt)
turntable image: https://dl.dropboxusercontent.com/u/2280132...h/turntable.jpg (https://dl.dropboxusercontent.com/u/22801321/2013/march/turntable.jpg)
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-27 18:11:48
       > marc2003: "..i could never, ever make something like that. i'm far too stupid.."

No fucking way in the world i can believe that marc. To me you are a JS guru (with different motivations to the other gurus).

Honest question: if your life depended on making something like that, what chance do you give yourself of making it?

________________________

       > if playback is stopped, it plays.
       > if playback is playing, it pauses.
       > if playback is paused, it plays.

Got it . . . I see what your code does. I think I'll stick to my edit, but I might add a descriptive note next to your (disabled) code in the script.

Thanks again for your help marc ++++++++
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-04-27 18:29:36
marc2003

Glad you like it

I don't consider that as a bug, it just that this feature is not available in my Playlist, maybe I should add it in the future.

He he and who is stupid here?

One day I looked your biography script and thought how hard can it be to make my self a nice bio panel,
but huh ... that web stuff is not for my poor brain.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-27 18:54:50
it just that this feature is not available in my Playlist


ha, ok then.

i find the web stuff easy because you can always google for help.

i must admit my major flaw is that i give up too easily when i get stuck. i did start a playlist sometime ago but gave up after awhile. i just didn't have the patience.
Title: WSH Panel Mod script discussion/help
Post by: Lucky Luciano on 2013-04-28 13:35:53
EDIT: Wow, I figured it out by accident: 

Renaming on_timer to on_timer1 fixed it!


ORIGINAL post:

I made a seekbar/progressbar based on Marc2003's but it seems to update in real-time, instead of every 1 second, which looks ugly. Other WSH scripts around seem to have the same issue.

Does anyone have a solution to this?
Code: [Select]
// ==PREPROCESSOR==
// @name "Simple Seekbar"
// @author "marc2003"
// ==/PREPROCESSOR==

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));
}

var g_drag = 0;
var g_drag_seek = 0;
var g_timer = window.CreateTimerInterval(1000);
var g_font = gdi.Font("Tahoma", 12, 0);


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

function on_paint(gr) {
   
    var x;   
    gr.DrawRect(4, 3, ww-7, wh-7, 1,RGB(72,66,58)); //BACKGROUND RECTANGLE
    if (fb.IsPlaying && fb.PlaybackLength > 0) {

if (g_drag) //WHEN DRAGGING SEEKBAR
            {
t = fb.PlaybackLength * g_drag_seek;
h = Math.floor(t / 3600);
m = Math.floor((t -= h * 3600) / 60);
s = Math.floor(t -= m * 60);
pos = ww * g_drag_seek;
//text = (h > 0 ? h + ":" + (m < 10 ? "0" + m : m) : m) + ":" + (s < 10 ? "0" + s : s);

            // prevent slider from being obscured by borders
                if (pos<5) {x=5;}
                else if (ww-pos<5) {x=ww-5;}
                else {x=pos;}       
                         
                   
            gr.FillGradRect(1, 1, pos-2, wh-2, 90, RGBA(112,106,98,255), RGBA(82,76,68,255)); //PROGRESS RECTANGLE
            gr.FillGradRect(x-(wh/2), 1, wh-2,  wh-2, 90, RGB(161,115,74), RGB(121,75,34)); //SLIDER
           
           
           
}
        else { //NORMAL PASSIVE DISPLAY
     
pos = ww * (fb.PlaybackTime / fb.PlaybackLength);
           
            // prevent slider from being obscured by borders
                if (pos<5) {x=5;}
                else if (ww-pos<5) {x=ww-5;}
                else {x=pos;}       
                         
         
                       
            //GRAY SEEKBAR RGB(185,145,40), RGB(125,85,0)
         
            gr.FillGradRect(1, 1, pos-2, wh-2, 90, RGBA(112,106,98,255), RGBA(82,76,68,255)); //PROGRESS RECTANGLE
            gr.FillGradRect(x-(wh/2), 1, wh-2,  wh-2, 90, RGB(161,115,74), RGB(121,75,34)); //SLIDER
           
           
            }
 
      }


}

function on_timer(g_timer) {
if (!fb.IsPlaying || fb.IsPaused) return;
window.Repaint();
}

function on_playback_seek(time) {
window.Repaint();
}

function on_playback_stop() {
window.Repaint();
}

function on_mouse_wheel(delta) {
fb.PlaybackTime = fb.PlaybackTime + delta;
}

function on_mouse_move(x, y) {
g_drag_seek = x < 0 ? 0 : x > ww ? 1 : x / ww;
if (y > wh) g_drag = 0;
if (g_drag) window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
if (fb.IsPlaying && fb.PlaybackLength > 0) g_drag = 1;
}

function on_mouse_lbtn_up(x, y) {
if (!g_drag) return;
g_drag = 0;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-28 14:09:06
^that post is complete and utter gibberish. 

my script updates every 150ms which makes the seekbar movement look smooth(-ish). you actually want it to update just once a second? that looks like crap to me.
secondly, you've already edited the timer to 1000ms (1 second) which is what you want so i have no idea why you posted in the first place
lastly, by renaming that function so it doesn't run, the seekbar won't ever update during playback. :/

also, that is based on a very old script using obsolete functions. you'll see this message in your foobar2000 console...

Code: [Select]
WSH Panel Mod: Warning: Obsolete: window.CreateTimerInterval() is now obsolete, please use window.SetInterval() in new script.

Title: WSH Panel Mod script discussion/help
Post by: Lucky Luciano on 2013-04-28 14:26:57
^that post is complete and utter gibberish. 

my script updates every 150ms which makes the seekbar movement look smooth(-ish). you actually want it to update just once a second? that looks like crap to me.
secondly, you've already edited the timer to 1000ms (1 second) which is what you want so i have no idea why you posted in the first place
lastly, by renaming that function so it doesn't run, the seekbar won't ever update during playback. :/

also, that is based on a very old script using obsolete functions. you'll see this message in your foobar2000 console...

Code: [Select]
WSH Panel Mod: Warning: Obsolete: window.CreateTimerInterval() is now obsolete, please use window.SetInterval() in new script.

-I did use SetInterval() subsequently which didn't change anything.
-The function needs to be renamed everywhere it appears, of course.
-Real-time updating maybe appears ugly only on old PCs(mine has an AthlonXP)


Code: [Select]
// ==PREPROCESSOR==
// @name "Simple Seekbar"
// @author "marc2003"
// ==/PREPROCESSOR==

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));
}

var g_drag = 0;
var g_drag_seek = 0;



var g_timer = window.SetInterval(on_timer1,1000);
var g_font = gdi.Font("Tahoma", 12, 0);


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

function on_paint(gr) {
   
    var x;   
    gr.DrawRect(4, 5, ww-8, wh-10, 1,RGB(140,130,105)); //BACKGROUND RECTANGLE
    if (fb.IsPlaying && fb.PlaybackLength > 0) {

if (g_drag) //WHEN DRAGGING SEEKBAR
            {
t = fb.PlaybackLength * g_drag_seek;
h = Math.floor(t / 3600);
m = Math.floor((t -= h * 3600) / 60);
s = Math.floor(t -= m * 60);
pos = ww * g_drag_seek;
//text = (h > 0 ? h + ":" + (m < 10 ? "0" + m : m) : m) + ":" + (s < 10 ? "0" + s : s);

            // prevent slider from being obscured by borders
                if (pos<5) {x=5;}
                else if (ww-pos<5) {x=ww-5;}
                else {x=pos;}       
                         
                   
            gr.FillGradRect(1, 8, pos-2, wh-8, 90, RGBA(95,94,94,255), RGBA(55,55,55,255)); //PROGRESS RECTANGLE
            gr.FillGradRect(x-(wh/2), 1, wh-2,  wh-2, 90, RGB(181,135,94), RGB(121,75,34)); //SLIDER
           
           
           
}
        else { //NORMAL PASSIVE DISPLAY
     
pos = ww * (fb.PlaybackTime / fb.PlaybackLength);
           
            // prevent slider from being obscured by borders
                if (pos<5) {x=5;}
                else if (ww-pos<5) {x=ww-5;}
                else {x=pos;}       
                     
            //GRAY SEEKBAR
         
            gr.FillGradRect(3, 3, pos-2, wh-6, 90, RGBA(95,94,94,255), RGBA(55,55,55,255)); //PROGRESS RECTANGLE
            gr.FillGradRect(x-(wh/2), 1, wh-2,  wh-2, 90, RGB(181,135,94), RGB(121,75,34)); //SLIDER
            }
 
      }


}


function on_playback_seek(time) {
window.Repaint();
}

function on_playback_stop() {
window.Repaint();
}

function on_mouse_wheel(delta) {
fb.PlaybackTime = fb.PlaybackTime + delta;
}

function on_mouse_move(x, y) {
g_drag_seek = x < 0 ? 0 : x > ww ? 1 : x / ww;
if (y > wh) g_drag = 0;
if (g_drag) window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
if (fb.IsPlaying && fb.PlaybackLength > 0) g_drag = 1;
}

function on_timer1(g_timer) {
if (!fb.IsPlaying || fb.IsPaused) return;
window.Repaint();
}

function on_mouse_lbtn_up(x, y) {
if (!g_drag) return;
g_drag = 0;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-04-28 14:38:19
now that you're using window.SetInterval, i see why you had to rename your function. it conflicts with the built in on_timer callback.

i still don't get why you posted originally. using the old timer functions with the interval of 1000ms would have done what you wanted.

anyway, so long as what you have is working now.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-04-28 15:27:54
Lucky Luciano

Try out this Seekbar config in a WSH panel and see what it does for you (edit it if you like) . . .
Code: [Select]
// ================================================================
// Script for foobar2000 component "WSH Panel Mod"
// Description........: Horizontal seekbar with 1-second refresh intervals, time display, and mouse hover effects: tooltips and glowing panel edges
// Author.............: Maxim Terpilovsky  (http://terpilovsky.ru)
//
// this edition modified by derty2
// ================================================================

var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_SINGLELINE = 0x00000020;
var DT_CALCRECT = 0x00000400;

function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }    //---orig--->  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);
}
//----------------------------------------------------------------------------




// gdi.Font is changed, the last paramter is style flags
// FontStyleRegular = 0,
// FontStyleBold = 1,
// FontStyleItalic = 2,
// FontStyleBoldItalic = 3,
// FontStyleUnderline = 4,
// FontStyleStrikeout = 8
// Here we are using 0, meaning FontStyleRegular
if ( utils.CheckFont( "Verdana" ) ) {          //---orig--->    if ( utils.CheckFont( "Segoe UI" ) ) {
var g_font = gdi.Font("Verdana", 11, 2);        //---orig--->    var g_font = gdi.Font("Segoe UI", 11);
} else {
var g_font = gdi.Font("Tahoma", 12);
}




var g_titlefmt = fb.TitleFormat("%playback_time% / %length%");        //--orig-->  //var g_titlefmt = fb.TitleFormat("$if(%ispaused%,Paused  '//'  ,)[%artist% - %title%  ]%playback_time% / %length%");
var g_fileinfo = null;

//---------------------------- COLOR SCHEMES FOR TIME ELAPSED BAR
//var g_colors = new Array(RGB(0,120,0), RGB(0,110,0), RGB(0,75,0), RGB(0,65,0));
//var g_colors = new Array(RGB(105,125,160), RGB(85,105,160), RGB(46,48,63), RGB(46,48,63));
//var g_colors = new Array(RGB(64,54,39), RGB(162,98,10), RGB(88,70,44), RGB(88,70,44));
//var g_colors = new Array(RGB(6,53,46), RGB(34,28,0), RGB(0,120,30), RGB(100,162,95));
//var g_colors = new Array(RGB(0,50,0), RGB(120,10,90), RGB(40,0,40), RGB(46,48,63));
var g_colors = new Array(RGB(0,0,0), RGB(0,0,0), RGB(0,0,0), RGB(46,48,63));

var g_drag = 0;
var g_drag_seek = 0;
var g_hover_seek;
var g_hover;
var g_clicked = 0;







//------------------------------------------------------------------ function on_paint(gr)  START

function on_paint(gr){

var ww = window.Width;
var wh = window.Height;
var spos = 0;
var length = fb.PlaybackLength;
var stxt;

  gr.SetSmoothingMode(2);

    if(length <= 0) { stxt = "0:00 / 0:00"; }

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

else if ( fb.PlaybackTime ) { stxt = "Streaming..."; }



gr.FillSolidRect(0, 80, ww-20, wh+20, RGB(0,0,0));      //---orig--->    gr.FillSolidRect(0, 0, ww, wh, RGB(120,120,120));
   
gr.FillGradRect( 0, 0, spos, wh, 10, g_colors[2], g_colors[1], g_colors[1]);      //---orig--->    gr.FillGradRect( 0, 0, spos, wh, 90, g_colors[0], g_colors[2]);

    //--- fills unused space with color:
    // gr.FillGradRect( spos, 0, ww-spos, wh, 90, RGB(100,100,100), RGB(140,140,140));  <<<<<<<<<<<< original
    // gr.FillGradRect( spos, 0, ww-spos, wh, 0, RGB(64,70,85), RGB(80,70,85));        <<<<<<<<<<<< previous = mid-grey
    gr.FillGradRect( spos, 0, ww-spos, wh, -90, RGB(20,20,20), RGB(40,40,40));

gr.GdiDrawText(stxt, g_font, RGB(214,147,95), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_SINGLELINE);      //--orig:  gr.GdiDrawText(stxt, g_font, RGB(255,255,255), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

gr.DrawRect( ww-1, 0, 0, wh, 1.0, RGB(0,0,0));
   
    //--- draws thin border
    // gr.DrawRect(-1,0, ww+1, wh-1, 1.0, RGB(150,150,150));  <<<<<<<<<<<< original
// gr.DrawRect(0, 0, ww-1, wh-1, 1.0, RGB(116,90,90));    <<<<<<<<<<<< my previous = orange-grey
    // gr.DrawRect(0, 0, ww-1, wh-1, 1.0, RGB(64,77,85));      <<<<<<<<<<<< previous
    gr.DrawRect(0, 0, ww-1, wh-1, 1.0, RGB(64,120,85));      //<<<<<<<<<<<< Green
   
   
   
    if ( g_clicked ) {
        gr.DrawRoundRect(0, 0, ww-1, wh-1, 1, 1, 1, RGBA(70,240,60,200));      //---orig--->  gr.DrawRoundRect(0, 0, ww-1, wh-1, 4, 4, 1, RGBA(255,255,255,200));
    }
    else if ( g_hover ) {
        //--- displays a thin border frame when mouse hovers over the panel:
        //    gr.DrawRoundRect(0, 0, ww-1, wh-1, 4, 4, 1, RGBA(255,255,255,100));  <<<<<<<<<<<<<<< Original
        //    gr.DrawRoundRect(0, 0, ww-1, wh-1, 1, 1, 1, RGBA(207,121,5,200));    <<<<<<<<<<<<<<< My previous choice = orange, thin
        //    gr.DrawRoundRect(0, 0, ww-1, wh-1, 1, 1, 1, RGBA(20,20,20,20));      <<<<<<<<<<<<<<< My previous choice = black-grey
        gr.DrawRoundRect(0, 0, ww-1, wh-1, 1, 1, 1, RGBA(117,231,172,120)); 
    }



if ( g_hover_seek ) {
var text_w = gr.CalcTextWidth(g_hover_seek, g_font) + 5;
if ( (g_hover + text_w) > ww) g_hover -= text_w + 4;
gr.FillSolidRect(g_hover - 2, 3, text_w + 2, wh-6, RGB(0,0,150));
gr.GdiDrawText(g_hover_seek, g_font, RGB(255,255,255), g_hover, 4, text_w, wh-8, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_CALCRECT);
}
   
}
//------------------------------------------------------------------ function on_paint(gr)  END





function on_mouse_lbtn_down(x,y){

g_drag = 1;
    g_clicked = 1;
    g_hover = 0;

on_mouse_move(x,y);
}





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;
}
    g_clicked = 0;
}







function on_mouse_move(x,y) {
window.SetCursor(32649);

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;
}

    g_hover_seek = null;
   
  if ( x <= window.Width && fb.PlaybackLength > 0) {
g_hover_seek = x / (window.Width);
g_hover_seek = (g_hover_seek<0) ? 0 : (g_hover_seek<1) ? g_hover_seek : 1;
g_hover_seek = TimeFmt(g_hover_seek * fb.PlaybackLength);
  }
 
    else { g_hover_seek = null; }
   
g_hover = x + 4;
window.Repaint();
}







function on_mouse_leave() {
g_hover_seek = null;
    g_hover = null;
    g_clicked = 0;
window.SetCursor(32512);
window.Repaint();
}




function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}




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){
window.Repaint();
}




function on_playback_time(time){
window.Repaint();
}




function on_volume_change(val){
window.Repaint();
}

//EOF
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-01 12:08:02
Hi,

Here my new Playlist Viewer script, i hope you'll give it a try and report me any bugs you may found. Thanks

http://fav.me/d63owft (http://fav.me/d63owft)

preview of the rendering into a WSH Panel Mod panel:
(http://img834.imageshack.us/img834/856/playlistd.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 12:11:17
^nice. i'll be giving that a test later. 

just a little bugfix for my spectrogram seekbar

https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

Code: [Select]
7.2013.05.01.02

"Spectrogram seekbar". Fix marker not showing on
very short tracks.


right click>Update script to fix.

full download here: https://dl.dropboxusercontent.com/u/22801321/samples.zip (https://dl.dropboxusercontent.com/u/22801321/samples.zip)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 12:42:57
@falstaff, first of all, that is some seriously impressive stuff making customisable/drag-able columns. i'll definitely be using this as it's so easy to customise.

a few things:

drag/drop doesn't appear to work. tried from album list/esplaylist.
some useless (to me) stuff is written to the console eg init groups delay = 1 /handleList count=37
using ctrl+click doesn't de-select group headers. i think it should.
could the title headers align to match the contents? (such as time being right aligned)
could you move the edit column option so it's not under the columns submenu. <<i understand if you don't want to do this one as it's your choice.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-01 13:05:26
thanx for this reporting marc

drag/drop doesn't appear to work. tried from album list/esplaylist.

you are trying to drag external items to the playlist viewer ? ok i'll check
(opposit isn't possible due to WSH panel mod limitation or it can be mimics to another WSH panel mod)

some useless (to me) stuff is written to the console eg init groups delay = 1 /handleList count=37

well see, i'll remove that trace

using ctrl+click doesn't de-select group headers. i think it should.

my behaviour choice, but i may reconsider it... will see

could the title headers align to match the contents? (such as time being right aligned)

i saw it just before posting, it will be done in next release

could you move the edit column option so it's not under the columns submenu. <<i understand if you don't want to do this one as it's your choice.

it makes sense, i will.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-01 13:46:31
WSH Playlist Viewers everywhere!
Excellent work Falstaff, congratulations ++++++

Having said that . . .

I wish somebody would script the WSH equivalent of the CUI Library Filters columns.

That would be super useful, especially for DUI users,
foobar2000 out-of-the-box does not have this library viewing functionality; the only way to have this is to use the "foo_facets (Facets)" component. However, there are numerous "features" built into Facets which can not be disabled to allow a simple layout of Filter columns ONLY. i.e., if you choose to use Facets, then you must have the kitchen sink!, you cannot completely detach the Filters functionality from the rest of the components other features.

An interesting advantage to making a Library Filter Columns panel using WSH Panel Mod,
is the fact that this is one of the few ways you can bypass the limitations of color usage when using the Default User Interface. i.e., you can program panels for DUI using color functions ("$RGB(x,y,z)") and emulate panels from CUI.

Summing up,
I believe a WSH panel containing customizable columns of Library Filters would be a superb JS scripting project for the benefit of ALL foobar2000 users. It would help build a bridge for current CUI users who want to eventually migrate to DUI . . . especially given the fact that CUI is now classed as "Seemingly Abandonware" and the developer ("musicmusic") has not set foot at HydrogenAudio since 2011 !!!!!!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 13:47:37
not possible because there are no library functions in WSH panel mod.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-01 13:55:58
That's great! So one can program Playlist Viewers even NASA programmers would be proud of . . . but trying to create a bunch of simple Library Filter columns is not possible!!!!!!

So what is the solution, how can this limitation be overcome?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 14:01:45
if it's so simple, you can always write a native foobar component using the SDK here: http://www.foobar2000.org/SDK (http://www.foobar2000.org/SDK)

or if you want to extend WSH panel mod to include this functionality, the source code is here: http://code.google.com/p/foo-wsh-panel-mod/source/checkout (http://code.google.com/p/foo-wsh-panel-mod/source/checkout)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-01 14:10:48
WSH playlist Viewer updated!

http://fav.me/d63owft (http://fav.me/d63owft)

[Change Log]
* v0.0.2 (2013-05-01 15:05 GMT+1):
- toolbar headers now are following column text alignment
- column name "N°" changed to "#" because of some problem with asian code pages ...
- Right click context menu on toolbar Header => Edit Column moved to top of the menu, no more in "Columns" submenu
- drag'n drop in this panel => support added
- some useless traces still wrote to the console removed!
[Change Log]
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-01 14:13:02
Putting my "faux-developer" cap on for a moment . . .

So I have a choice between
(1) programming a C++ component from scratch
(2) updating a current C++ component whose source code is freely available.

If I was to do this, then
if I choose (1), then I can not bypass the limited DUI color usage options, therefore the advantages are minimal when compared to Facets (foo_facets_.
if I choose (2), then we open up a new world of exploration for DUI users and programmers, and can bypass foobar2000 built-in limitations, and help bridge the gap between "DUI" and "[Seemingly Abandonware] CUI"

I would choose (2).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 14:42:46
i bodged my spectrogram seekbar fix earlier. it was worse than the marker not showing on shorter tracks.  right click>Update script to try again. depending on size of panel, you may see a few percent CPU usage. 

@falstaff, thanks for fixes. i note the playlist header doesn't update when drag/drop adds tracks.

also a feature request rather than a bug. can you track the position of dropped tracks so they can be inserted between existing items in the playlist? i'm not sure if this is possible but no harm in asking.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-01 14:59:01
@falstaff, thanks for fixes. i note the playlist header doesn't update when drag/drop adds tracks.
also a feature request rather than a bug. can you track the position of dropped tracks so they can be inserted between existing items in the playlist? i'm not sure if this is possible but no harm in asking.


thanx, refresh of the top playlist header will be fixed next (no refresh too on items add or remove)
for the insert point, i'll check that asap
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 15:06:56
another couple of requests   

when you have a short playlist with no scrollbar, could the group header text align to the last "proper" column - in this example, Time.

can you make your mood column heart stay red when the item is playing/selected?
Title: WSH Panel Mod script discussion/help
Post by: ehrgeiz on 2013-05-01 15:39:49
@marc2003's now playing script:
neither crop center nor crop top are imho good solutions

changing line 1103 of common7.js
Code: [Select]
var sy = type == "crop top" ? 0 : Math.round((img.Height - ch) / 2);

to
Code: [Select]
var sy = type == "crop top" ? 0 : Math.round((img.Height - ch) / 4);


gives a much more better crop focusing on the upper part of the picture (if you select the crop on center, thats what i changed here; actually i wanted to change the crop top but alas i'm too stupid to make it work)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-05-01 16:00:47
marc2003, I think something recently (perhaps in an update in the last day or so) changed in common7 that results in no information found for artists in your musicbrainz script, and strange behavior of the "update script" action. .  I tried the "update script" action in one of your scripts, and it always returns that an update was available, downloaded, and asks to restart foobar2000.  It will continue to report that a new script was available and downloaded when I try "update script" even if I had just done so and restarted foobar2000, and it will continue to do so every time I now hit "update script".

None of the updated common7 files fixed the musicbrainz script.  I then tried deleting all json files in my stored image folders - no change in behavior.  I then reverted back to a April 3 version of common7 and the musicbrainz script now works.

Thanks very much for such great scripts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 16:03:09
Quote
neither crop center nor crop top are imho good solutions


can you explain why, preferably with a screen shot? i really don't understand what the problem is. 

@godrick, thanks for pointing out i broke the Update script feature. i did this earlier today.  i think i've fixed it. of course another update/restart is required.

as for musicbrainz, not working, i have it active in my layout and it's been fine through all my recent changes?? the panel script hasn't changed so all i can suggest is holding shift when right clicking the panel>properties>clear. that will reset any settings.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-05-01 16:25:19
Updates now works, and musicbrainz script works with the common7 that was automatically downloaded.  All is good - thanks again!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 18:58:12
@falstaff, a couple more things:

(https://dl.dropboxusercontent.com/u/22801321/2013/may/playlist%20issues.png)

overlapping text and inaccurate calcuation of group length.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-05-01 19:22:13
marc2003, it looks like I was incorrect in thinking that my musicbrainz issue was fixed with the update script fix.  The old common7 created new json files for the artist I was viewing and I didn't check to see if the latest common7 would create new json files for another artist.  When I checked with a different artist that did not have existing json files, the new common7 did not create them.

In looking over the latest and old (from April 3) common7 scripts, I noticed the following:

for the April 3 version of common7,
    - the echoed url for links was
Code: [Select]
http://www.musicbrainz.org/ws/2/artist/8347dd6d-b9a2-4e96-a610-d1ed67b189f1
?inc=url-rels&fmt=json

    - the echoed url for releases was
Code: [Select]
http://www.musicbrainz.org/ws/2/release-group?artist=8347dd6d-b9a2-4e96-a610-d1ed67b189f1
&limit=100&offset=0&fmt=json


for the latest common7,
    - the echoed url for links was
Code: [Select]
 http://search.musicbrainz.org/ws/2/artist/?query=artist:steve%20roach&fmt=json

    - the echoed url for releases was
Code: [Select]
 http://search.musicbrainz.org/ws/2/artist/?query=artist:steve%20roach&fmt=json


...and the results of the latest common7 musicbrainz urls echoes the following in the console:
Code: [Select]
Musicbrainz: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
  <head>
    <title>502 Bad Gateway</title>
    <link rel="stylesheet" href="/.proxy/httperror.css" type="text/css" />
  </head>
  <body>
    <div id="bg">
      <img src="/.proxy/MusicBrainzLogo-Q.png" />
    </div>
    <h1>Server being naughty</h1>
    <p>One of our servers appears to be misbehaving.&nbsp; Please try again later.</p>
    <p id="http">502 Bad Gateway</p>
  </body>
</html>


I cleared the panel and restarted each time I changed which common7 script I was using.  I echoed the urls from the end of the "musicbrainz" case in this.get = function().  It looks like something isn't right with this.musicbrainz_id in the lastest common7 script in my setup.

If this doesn't make sense, isn't what you are seeing or more info is needed, please let me know.

edit: tried to fix the url references
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-01 19:39:40
@falstaff, a couple more things:

thanx
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 19:54:01
@godrick, fixed. right click>yada yada.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-05-01 19:54:08
marc2003, you probably figured this out or have something better, but if I replace the following in the latest common7:
Code: [Select]
                this.musicbrainz_id = p.eval("$if3(%musicbrainz_artistid%,%musicbrainz artist id%," + p.read(fn1) + ",)");
                if (this.musicbrainz_id.length == 0) {


with the equivalent in the April 3 version of common7:
Code: [Select]
                this.musicbrainz_id = p.eval("$if3(%musicbrainz_artistid%,%musicbrainz artist id%,)");
                if (this.musicbrainz_id.length == 0) this.musicbrainz_id = p.read(fn1);
                if (this.musicbrainz_id.length == 0) {


...I can get the latest common7 to work
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-01 20:06:40
i thought i tested abusing $if3 like that but evidently not well enough. anyway, i did spot it before you posted.

and i think that server error could appear when doing any MBID lookup so i'm pretty sure that part wasn't my fault.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-01 21:57:32
another couple of requests   

when you have a short playlist with no scrollbar, could the group header text align to the last "proper" column - in this example, Time.

can you make your mood column heart stay red when the item is playing/selected?


1. right text now aligned to the last column as pointed, will be available in v0.0.5 (release this evening or tomorrow...)
2. making group header more editable is one of the things i've planed with the use of my WSH inputbox script object , you'll have to wait a little to let me finish this part
3. edit: maybe but only if i can draw an outline around the heart to give contrast when bg colour on selected track is near to the red/pink colour used

EDIT:
v0.0.5 released (http://fav.me/d63owft (http://fav.me/d63owft))
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-01 23:02:07
edit: one more thing...  can you make your mood column heart stay red when the item is playing/selected?


done for v0.0.6 that will be released tomorrow, here is the look of the new "heart" of the mood columns

(http://img811.imageshack.us/img811/9513/captureheart2.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-02 00:23:49
^nice.

still a problem with length calculation though in 0.0.5 (changelog says it's fixed?)

(https://dl.dropboxusercontent.com/u/22801321/2013/may/group%20header.png)

the time in the playlist header is right but not the group.

also, thanks for all your updates so far.
Title: WSH Panel Mod script discussion/help
Post by: ehrgeiz on 2013-05-02 03:13:08
Quote
neither crop center nor crop top are imho good solutions


can you explain why, preferably with a screen shot? i really don't understand what the problem is. 


there is no real problem, just my preference and i wanted to share.
if you do classic photography the "rule of thirds" is very common and a lot of pics are following these principles. the head/eyes is usually on the level of the upper line
(http://youmakemedia.com/wp-content/uploads/2007/09/karengirl.jpg)

if you do a top crop of a classic portrait half the face is cut of or overlayed by the trackinfo/albumcover (green-box)
if you do a center crop the eyes are nearly cut off (blue-box)
based on my experience a crop focusing on the upper third-line works very good for a lot of photos. (i used 16:9 ratio for the crop-boxes as my "now playing" panel is)

(http://i.imgur.com/KGqy1fs.png)

but of course it's not perfect either, maybe you do some face recognition and crop on those ;P
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-02 03:59:41
thanks for the clear explanation. i had no idea about of any of that.

Quote
actually i wanted to change the crop top but alas i'm too stupid to make it work)


just change the value of the 0 in this line you posted.

Code: [Select]
var sy = type == "crop top" ? 0 : Math.round((img.Height - ch) / 2);


that code is just a shorthand way of writing this.

Code: [Select]
if (type == "crop top") {
    var sy = 0;
} else {
    var sy = Math.round((img.Height - ch) / 2);
}


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-02 13:13:50
new permanent link for my scripts: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog link is still the same: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

(i just moved it into a folder making it easier for me to update)
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2013-05-03 13:44:42
Can anybody direct me to information required to make the Volbar sample (included in WSH Panel Mod) use a logarithmic scale instead of a linear?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-03 13:53:48
if you search this thread or the main WSH panel mod thread, i'm pretty sure you'll find what you're looking for.

(use the box on the bottom left to search within a thread)
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2013-05-03 14:44:45
The things that were previously posted here didn't make much sense, sorry. However, reading this thread (http://www.hydrogenaudio.org/forums/index.php?showtopic=33197) helped me a lot, so now I have everything figured out.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-03 21:07:30
About the rule of thirds, this is the exact problem I had with the thumbs script, top was cutting off the bottom of thier heads and center was cutting off the top, thanks ehrgeiz. You should make this part of the script marc. Also is thumbs discontinued now? Now playing does everything thumbs can do and more??
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-03 22:32:18
Putting my "faux-developer" cap on for a moment . . .

So I have a choice between
(1) programming a C++ component from scratch
(2) updating a current C++ component whose source code is freely available.

If I was to do this, then
if I choose (1), then I can not bypass the limited DUI color usage options, therefore the advantages are minimal when compared to Facets (foo_facets_.
if I choose (2), then we open up a new world of exploration for DUI users and programmers, and can bypass foobar2000 built-in limitations, and help bridge the gap between "DUI" and "[Seemingly Abandonware] CUI"

I would choose (2).


(3)

Track down musicmusic and give him lots of money
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-03 23:16:55
Bratman, I think we are going off topic and too deep into this man. . .

My initial comments on this were left at Post #2320 (if anybody wants to go and have a read).

Firstly, I would like to say:
I WAS WRONG . . . IT IS POSSIBLE to have a DUI panel with ONLY Filter columns by using foo_facets (Facets) component.

Secondly, my discussion was related to this concept:
Using WSH Panel Mod to create Library viewing panels with RGB color options, bypassing the DUI limitations. Also, it would have the added benefit of bridging the gap between DUI and CUI, considering that CUI is seemingly abandonware.

Continued development of CUI was not really part of my discussion.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-04 06:38:01
@ehrgeiz & bratman, i've done some testing with a wider panel and the suggested method does look better. because i generally have my panels in portrait, i didn't see any issue with what i was doing before. you still get the issue of the odd top of head cut off but i believe it solves more problems than it causes. script updated. right click>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js


@falstaff, thanks for the 0.0.6 playlist update. no complaints at all now. i hope you implement the group header title formatting options. then it will be perfect.

RGB color options


that seemingly simple thing would be extremely hard to do in WSH panel mod. it might not be impossible but i'd never take it on. it would take a supreme amount of effort.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-04 11:31:12
@falstaff, just one more niggle with your playlist. it should repaint when the last track in playlist has finished because it shows the playing icon when it shouldn't

i see it only repaints when the reason is 0 (stopped by user) but you should include 1 (EOF) as well.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-04 13:37:48
@falstaff, just one more niggle with your playlist. it should repaint when the last track in playlist has finished because it shows the playing icon when it shouldn't

i see it only repaints when the reason is 0 (stopped by user) but you should include 1 (EOF) as well.


thanx, will be fixed in v0.0.7 which will bring a new option :  artist image as wallpaper bg image
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-04 16:16:10
@ehrgeiz & bratman, i've done some testing with a wider panel and the suggested method does look better. because i generally have my panels in portrait, i didn't see any issue with what i was doing before. you still get the issue of the odd top of head cut off but i believe it solves more problems than it causes. script updated. right click>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js


@falstaff, thanks for the 0.0.6 playlist update. no complaints at all now. i hope you implement the group header title formatting options. then it will be perfect.

RGB color options


that seemingly simple thing would be extremely hard to do in WSH panel mod. it might not be impossible but i'd never take it on. it would take a supreme amount of effort.


Thanks marc2003, I see you updated the crop top values that's done it, the majority of thumbnails are cropped better too. It definitely solves more problems than it causes, it was a bit of a problem before but now most of the images are cropped pretty well. I have the panel pretty wide:

(http://imageshack.us/a/img571/3083/78768437.png)
(http://imageshack.us/a/img547/4457/68116738.jpg)

Honestly before the new crop value their legs or heads was cropped, but now look at the thumbnails, mostly good.

Just a suggestions whilst I'm here if you're interested...

Similar Artists - Have the spotify icons only coloured green if the artist is in the library, then any artist with a green icon can be clicked which would play the clicked artist from the library? Would be cool if the spotify icons was a quicksearch icon which could search for the same artist and send to playlist and play?

I'm just getting to spend more time using your other scripts, I am using six so far. Thumbs, Similar Artists, Lastm/Wiki Bio, News and Musicbrainz. I'll post back soon if I can think of any ideas or improvements, great work marc I was looking at the script and it's very clever stuff, I hope I can learn to do it some day.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-04 16:34:28
Quote
Similar Artists - Have the spotify icons only coloured green if the artist is in the library, then any artist with a green icon can be clicked which would play the clicked artist from the library?


eh? why would you want a spotify button to find music in your own library?   

the main purpose is to find new music from artists you don't have but are similar to what you are listening to. i had 6 months of spotify premium for free with my last ISP so that's why i created it. i don't use it much now.

also, i can't check the library for an existence of any artist even if i wanted to.

but you can right click>buttons>autoplaylist. that will replace spotify with autoplaylist buttons to search your library for each artist instead.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-04 19:21:26
I meant click the link not the button, I was going to say I don't use spotify (never will) but I figured you'd be keeping the icons. Shame about the artist checking and the autoplaylist button is cool but it would be better if it played and wasn't an autoplaylist which has to be deleted afterwards.

Got another suggestion being how about the option to list the similar artists as a wall of text, you can fit more in this way.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-04 20:44:47
you can scroll to see the maximum amount of artists that are fetched.

it's just isn't feasible to list all artists in a paragraph - well not if you want things to be clickable. (even if you don't, i won't be making the changes. )
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-05 01:00:47
I know that but isn't it best to display information without wasting space and have a script that is more customizable to different layouts? You say it isn't feasible, so it's not worth putting the code in?

(even with my wonky botch job).

I've had this crash on the musicbrainz script twice, do you know what it is?

Quote
Error: WSH Panel Mod (Musicbrainz by marc2003): JavaScript runtime error:
Out of stack space
File: C:\Users\Nate\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 2310, Col: 4
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-05 02:21:26
making an image isn't going to change my mind. it's not like i didn't know what you meant first time around so you've wasted your own time there.   

if that was just normal HTML, it would be very easy indeed. you just list all the names/urls in anchor tags and the browser takes care of the rest. with WSH panel mod, it's not so easy. i have to calculate the size and position of every piece of text on screen and track the mouse on every move to make it respond to clicks. there is no way you'll ever see anything like that from me.

that error certainly is a new one for me. i'll have to get my googling hat on to see what i can find.

edit: based on what i've googled, i've put in some checks to hopefully stop that happening. i have no idea whether it will work or not because it's not something i've been able to re-produce.

right click>Update script.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-05 03:07:34
making an image isn't going to change my mind. it's not like i didn't know what you meant first time around so you've wasted your own time there.   

if that was just normal HTML, it would be very easy indeed. you just list all the names/urls in anchor tags and the browser takes care of the rest. with WSH panel mod, it's not so easy. i have to calculate the size and position of every piece of text on screen and track the mouse on every move to make it respond to clicks. there is no way you'll ever see anything like that from me.

that error certainly is a new one for me. i'll have to get my googling hat on to see what i can find.

edit: based on what i've googled, i've put in some checks to hopefully stop that happening. i have no idea whether it will work or not because it's not something i've been able to re-produce.

right click>Update script.


Lol well I was hoping it might, that does sound like too much work for what it's worth, damn WSH Panel Mod sounds like a pain, can you not put html in javascript? (http://www.webmaster-talk.com/javascript-forum/88031-adding-html-into-javascript.html)

Thanks I'll let you know if it happens again.

Two more suggestions.

1) In thumbs grid view how about combining two squares and having an option of portrait thumbs? I'm using 150pixel thumbs giving 4 columns and 2 rows of images, but having just 4 columns would look very cool. This could be an option instead of having a wide image, divide it into portrait images.

2) In grid mode, it displays all different album artists by image and upon clicking the image of the artist it will play that artist, image link (http://imageshack.us/a/img507/7780/23419568.png) Like all the images are different artists with their albums below, double clicking an artist will display the albums of that artist. Just an idea mind.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-05 03:43:01
can you not put html in javascript? (http://www.webmaster-talk.com/javascript-forum/88031-adding-html-into-javascript.html)


no. you still need a browser to render it.

custom sized thumbs is a more interesting idea. i might think about it.

and it's a big fat no for your last point. i can't list artists/albums because i have no way to query the library. also drawing multiple images is quite CPU intensive. doing a panel that size with so many thumbnails will lag. my script is fine with the default of 5 it downloads from last.fm but if you have lots of images, you will notice a delay.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-05 21:00:30
Damn that's a shame you could of done a WSH Panel that displays the youtube video of the song. Is it possible to display a video instead of an image? To play music videos in the library, I guess not as it's not a video player.

Well I have the 20 images selected and it's not lagging, seems fine to me!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-06 03:39:08
no video and no library support. how many more times does it have to be said before it sinks in?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-06 12:57:51
@falstaff, is it ok if i post a little modification of your playlist? i've edited the "mood" column so people can love/unlove tracks on last.fm by clicking the heart of any playlist item. all i've done is replace your mouse button up code with a single line of code (window.NotifyOthers) to tell my script which track to process.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-06 15:51:55
no video and no library support. how many more times does it have to be said before it sinks in?


I forgot even video would need library support, sorry for being dumb!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-07 08:23:40
@falstaff, is it ok if i post a little modification of your playlist? i've edited the "mood" column so people can love/unlove tracks on last.fm by clicking the heart of any playlist item. all i've done is replace your mouse button up code with a single line of code (window.NotifyOthers) to tell my script which track to process.


it's ok
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-07 11:46:52
^thanks. i posted a little "how to" in my main last.fm playcount thread:

http://www.hydrogenaudio.org/forums/index....st&p=833547 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=76772&view=findpost&p=833547)

quick overview: currently my "last.fm love/unlove" button only works on the playing track (or selected track when playback is stopped). with falstaff's WSH playlist, this modification allows you to love/unlove any track in any playlist regardless of what is currently playing, simply by clicking the inline "heart" icons.
Title: WSH Panel Mod script discussion/help
Post by: MDMA on 2013-05-07 11:49:29
what's this vinyl script I've seen mention of? does someone have a link? It's not in marc's samples folder
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-07 11:52:45
https://dl.dropboxusercontent.com/u/2280132...h/turntable.txt (https://dl.dropboxusercontent.com/u/22801321/2013/march/turntable.txt)
turntable image: https://dl.dropboxusercontent.com/u/2280132...h/turntable.jpg (https://dl.dropboxusercontent.com/u/22801321/2013/march/turntable.jpg)

check the artwork type (id) and path settings in the script for where to save the image. i've not bundled it because the image is large and the lag on startup/album change is pretty crappy.
Title: WSH Panel Mod script discussion/help
Post by: MDMA on 2013-05-07 18:56:32
nice one marc, thanks
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-07 22:29:37
I need some help please . . .

I want to display a single image by itself in a WSH panel and I want the image to always resize to fit the panel dimensions. What is the JS code to do this?

More specifically, I am trying to do this:
If playing track has one channel, display image "A"
else if playing track has two channels, display image "B"
and resize images to fit panel dimensions at all times.


Once I figure this out, I will show you guys an interesting visual enhancement of the default foobar2000 built-in spectrogram (used as a custom-colored panel).
It actually looks quite nice when used side-by-side together with marc2003's sox spectrogram script.
Title: WSH Panel Mod script discussion/help
Post by: aNewDay_ on 2013-05-08 10:23:40
Hi, I can't install WSH pannel on my foobar. I'm on Windows xp Service Pack 3. I upload a video of foobar. Plz check this out http://youtu.be/pebwM_4D3r4 (http://youtu.be/pebwM_4D3r4)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-08 10:53:47
WSH Playlist 2013 updated to v0.0.8

LINK (http://fav.me/d63owft)

last changelog:
* v0.0.7 (2013-05-05 10:20 GMT+1):
- some bugs fixed
- wallpaper feature enhanced, now, you can set the wallpaper to the now playing artist image (check panel properties)
* v0.0.8 (2013-05-08 11:50 GMT+1):
- bug fixed to avoid crash on dragging group when auto-collapse is active
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-08 12:31:15
@derty2, try this.... https://dl.dropboxusercontent.com/u/2280132.../may/derty2.txt (https://dl.dropboxusercontent.com/u/22801321/2013/may/derty2.txt)

@aNewDay_, have you done anything stupid like use nlite to reduce the size of your install disk which chops out important system files?
Title: WSH Panel Mod script discussion/help
Post by: aNewDay_ on 2013-05-08 17:04:06
No, i never use nlite for any reason. My copy of xp is genuine. 4 or 5 months ago i tried br3tt's WSH Playlist viewer v2.0 and it did work at that time. But now WSH pannel don't work on my pc. To end my doubt yesterday i tried to install foobar and WSH pannel on my friend's pc and yes it's working, but today when i tried to install a new skin fooEKo_v6 'Elato' from Foo-Nation which use WSH pannel it give me script error. I don't know why. Whatever i do with foobar, i do it with portable version.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-08 18:04:22
you using the latest version from here?

http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-08 20:01:13
Hi, I can't install WSH pannel on my foobar. I'm on Windows xp Service Pack 3. I upload a video of foobar. Plz check this out http://youtu.be/pebwM_4D3r4 (http://youtu.be/pebwM_4D3r4)


may help: http://leftosa.wordpress.com/2013/05/08/fi...-create-object/ (http://leftosa.wordpress.com/2013/05/08/fix-for-automation-server-cant-create-object/)
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-10 01:56:52
marc2003

thanks for code at Post #2374 for drawing images in a panel . . . but the code doesn't work; panel crashes . . .
The console reports "Type Mismatch" at subroutine "function on_paint(gr) {"

I cannot believe such a simple task, drawing an image in a panel and making it always resize to fit the panel dimensions, is beyond me ... I am totally fucking useless with JS coding !!!!

Title: WSH Panel Mod script discussion/help
Post by: aNewDay_ on 2013-05-10 02:03:55
@marc2003 Yes, i am using the latest version of WSH pannel from your given link.

@Falstaff You're Mr. Br3tt? Your work is commendable. Thanks for the link. I do changes values to the reg keys but this time i'm unable to understand.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-10 02:29:19
@derty, i made quite a large mistake. lines 2&3....

Code: [Select]
var img_a = fb.ProfilePath + "images\\a.png"; //1 channel
var img_b = fb.ProfilePath + "images\\b.png"; //2 channels


should really be

Code: [Select]
var img_a = gdi.Image(fb.ProfilePath + "images\\a.png"); //1 channel
var img_b = gdi.Image(fb.ProfilePath + "images\\b.png"); //2 channels
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-10 11:48:03
Excellent marc, it works now +++++

Is it possible to make the image adjust its sharpness, especially if the panel is resized larger resulting in blurring?
Is there JS code which can be added to the script to control the graphical qualities?

About your SoX spectrogram script (in a WSHPM panel)...

Observations of the panel working with .CUE sheets(+ single audio image):

I have quite a few albums which are CUE+IMAGE. I have just noticed that your script does not work on the CUE at all; it only works by clicking on the single audio image.
In the CUE case, all we see is a blank background but the marker and mouse hover and seek will work correctly.
Is it not possible to extrapolate track duration indexes from the CUE sheet and parse the info to the programs (Sox/FFMPEG)?

Observations of the panel working with .MKA (standalone audio container):

I have quite a few albums converted to a single .MKA file. In this case we have a different type of 'wrong' behaviour.
I click track 1 and your spectrogram renders the track 1 spectrogram image . . . I click on any other track in the album and the spectrogram image never changes, but the marker and mouse hover and seek will work correctly. . . If I change focus to tracks from another album and then go back to the .MKA album, the problem continues as before; i.e. marker, mouse hover and seek will update and work, but always with track 1 spectrogram image as background.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-10 12:28:26
you can put this as the first line inside on_paint()

Code: [Select]
gr.SetInterpolationMode(7);


it's useful for maintaining quality when resizing large images into a smaller panel. trying to stretch smaller images to fit isn't going to work so well. as the old saying goes, you can't polish a turd.

as for cuesheets, the reason why the marker works is because the length of the track is provided by foobar title formatting. i can't get a start point within the file though. i don't know how to write a cuesheet parser from scratch.

and it looks like i should be excluding .mka files as well. i've not encountered those before.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-10 14:04:25
i've updated my spectrogram seekbar to exclude scanning of tracks with a subsong index of more than 0. i have no other way to determine if tracks contain multiple chapters. i don't want to assume anything based on just the codec/container.

existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-10 20:35:07
Good stuff marc you are the king of kings. Please add some support to thumbs/now playing for three horizontal images. Using grid view to display three artist images at the same time is laggy and no cycle because it's the thumbnails. 

Got a crash on now playing

Error: WSH Panel Mod (Now Playing by marc2003): JavaScript runtime error:
Overflow
File: <main>
Ln: 77, Col: 2
<source text only available at compile time>

Happens when I move a panel stack splitter.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-10 23:25:37
i don't know what causes that crash because i'm not installing columns/PSS to test. in default UI, i did manage to make it hang foobar completely when resizing the panel to a ridiculously small size so i've fixed that. it might help?   

right click>Update script.

can you illustrate what you mean with the thumbnails because i don't really understand.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-11 00:18:31
Awesome that has fixed it!

I mean like this, at the moment that is using big 220 pixel thumbnails to give 3 images but that way is slow as there is lots of thumbs under the graphical browser panel so when you slide it up and down it lags bad.  Also no cycle as thumbs don't cycle, maybe have an option to limit how many thumbs can be shown? I understand if I'm being stupid

(http://img18.imageshack.us/img18/810/threeartists.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-11 00:45:25
well i did say the other day it's slow with multiple images but you said it was fine? 

if you lock the panel size, that should pretty much sort it. you'd only get a little delay on artist change.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-11 00:58:50
It is fine with multiple smaller images
Locking the WSH panel has no effect, dragging with one image is super fast, dragging with three is slow because the other big thumbs begin to display as the splitter becomes larger, now if I could drag with only three thumbs or images enabled it would just zoom/crop into them just like having thumbs off. I guess I'll just display one image instead as I think it's getting a bit too much of a niche problem.

On the plus side foobar is loading in 2 seconds, whatever you did to your scripts since a few weeks ago is much faster.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-11 02:21:42
large improvements ahoy for thumbs & now playing. there is no lag on panel resize with thumbs enabled - apart from resizing the width in grid mode.

existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

edit: just realised i bodged the thumbs grid mode update. in the unlikely event anyone downloaded it in the last 20 minutes since i posted, just Update script again.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-11 02:56:57
in the unlikely event anyone downloaded it in the last 20 minutes since i posted, just Update script again.


That would be me

Nicely done! It's really zero lag when re sizing now  Small problem though,
(http://img716.imageshack.us/img716/656/uuung.jpg)


Dragging graphical browser down is fine but once I drag it up PAST the top thumbs, they disappear, skipping song brings them back?
Is thumbs faster than now playing? The only thing thumbs has that now playing doesn't is a selection mode option in the right-click menu.
Marc you really need your own thread for your scripts, they are just dominating this one lol.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-11 03:17:17
the thumbs not showing when you resize smaller than the thumbnail dimension is intentional. it not coming back when the panel is resized larger again is a bug which i've just fixed.

thumbs also has grid mode. now playing does not because it would interfere with the mouse clicks and it would probably look like crap behind the bio text as well.
Title: WSH Panel Mod script discussion/help
Post by: rx32555 on 2013-05-11 04:06:12
Hi Marc.

about last.fm playback script:

Can i love tracks using a globlal hotkey?  I tried it, it shows loved track in WSH panel, but doesnt update last.fm.

If already asked, sorry . 

And thanks for your awesome work with WSH!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-11 04:10:25
you'll have to use foo_softplaylists (http://www.hydrogenaudio.org/forums/index.php?showtopic=76133) if you want global hotkeys to love/unlove tracks. obviously my script won't detect this but if you do it before the scheduled playcount update half way through the track, it should update then.
Title: WSH Panel Mod script discussion/help
Post by: rx32555 on 2013-05-11 04:37:41
Thanks, it works nicely using two global hotkeys (CustomdbLove 1 + Last.fm Love Track).
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-11 15:03:58
Yep that's fixed it marc, about the thumbs/nowplaying I know what you mean but then again bio can be turned off? Although fair enough with mouse clicks.
I got a request to have folder.jpg as an image source in thumbs, sometimes I have thumbs fully spread out in foobar with a playlist on the right, would be nice to have a choice to display the album cover. Shouldn't cause much extra cpu as it's just one more path and it turns thumbs into an album viewer too, bonus?

P.S I know you have created art reader for that purpose but having the option in thumbs would still be nice even without having the other features like front/disc/back.
I love this layout with album cover, but then I have to load up the thumbs script to enable lastfm artist images, why not merge art reader and thumbs?
(http://img18.imageshack.us/img18/5493/hjkhjkn.jpg)
Now I don't regret choosing 1200x1200 album covers.
That original size tooltip is very nice, good attention to detail and the google image search is great too.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-11 16:16:04
it's a lot more effort than you might think for me to add the front cover into all the images used in my thumbs script. how they update is fundamentally different.

either have 2 panels, or use now playing with everything turned off but the CD cover.


edit: i forgot there is already the functionality to have more than 1 folder in custom folder mode. obviously it won't download art from last.fm but if you have stuff already acquired, you can use it like this.

Code: [Select]
d:\applications\foobar2000\wsh_lastfm\$crc32(%artist%)|$directory_path(%path%)

note each folder is separated by a | with no spaces. the first uses my art downloaded from last.fm. you'd have to modify the path to your foobar profile folder. the 2nd path is the folder containing the playing/selected track.

example of front cover added to artist images: https://dl.dropboxusercontent.com/u/2280132...%2B%20cover.png (https://dl.dropboxusercontent.com/u/22801321/2013/may/thumbs%20%2B%20cover.png)
Title: WSH Panel Mod script discussion/help
Post by: chadamir on 2013-05-11 16:55:04
Falstaff, you might be aware of this, but when you choose a single song (at least with flac), it does not accurately report the length.  Also would it be possible to set it up so that instead of counting backwards it lists it as (Time in song/Length) For example 2 minutes and 30 seconds into a 4 minute song would look like (2:30/4:00)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-11 18:37:52
i have a request for falstaff as well. can you get rid of the thin top line when the top toolbar is hidden?

edit: never mind. although i couldn't find and remove it myself, i've just drawn a white line over the top of it. that works well enough for me.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-05-11 21:20:38
Falstaff, you might be aware of this, but when you choose a single song (at least with flac), it does not accurately report the length.  Also would it be possible to set it up so that instead of counting backwards it lists it as (Time in song/Length) For example 2 minutes and 30 seconds into a 4 minute song would look like (2:30/4:00)


please shot me screenshot of the not accurate length. thank you
Title: WSH Panel Mod script discussion/help
Post by: chadamir on 2013-05-11 22:58:05
Falstaff, you might be aware of this, but when you choose a single song (at least with flac), it does not accurately report the length.  Also would it be possible to set it up so that instead of counting backwards it lists it as (Time in song/Length) For example 2 minutes and 30 seconds into a 4 minute song would look like (2:30/4:00)


please shot me screenshot of the not accurate length. thank you


http://imgbox.com/aceRdVY9 (http://imgbox.com/aceRdVY9)  See it says 1 song, 10 minutes, but the song is half that length.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-11 23:47:53
just updated my discogs script. a few weeks back i didn't like all the partial matches you get so i made it show exact matches only. i've now decided to make this a toggable option that can be turned on or off.

existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-12 01:09:25
it's a lot more effort than you might think for me to add the front cover into all the images used in my thumbs script. how they update is fundamentally different.

either have 2 panels, or use now playing with everything turned off but the CD cover.


edit: i forgot there is already the functionality to have more than 1 folder in custom folder mode. obviously it won't download art from last.fm but if you have stuff already acquired, you can use it like this.

Code: [Select]
d:\applications\foobar2000\wsh_lastfm\$crc32(%artist%)|$directory_path(%path%)

note each folder is separated by a | with no spaces. the first uses my art downloaded from last.fm. you'd have to modify the path to your foobar profile folder. the 2nd path is the folder containing the playing/selected track.

example of front cover added to artist images: https://dl.dropboxusercontent.com/u/2280132...%2B%20cover.png (https://dl.dropboxusercontent.com/u/22801321/2013/may/thumbs%20%2B%20cover.png)

You're right I checked the scripts, that's a shame. I wish the now playing cover didn't have a limit so it could be made big enough to fit the panel. I guess I'll use two panels, gives me a reason to use the buttons I spent ages creating but ended up not needing. I'll try the custom folder mode not a bad solution for me.


Which do you prefer discogs or musicbrainz? I prefer having exact artist match or this happens http://img16.imageshack.us/img16/4996/discogsv.jpg (http://img16.imageshack.us/img16/4996/discogsv.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-12 01:53:09
i much prefer musicbrainz for the cleaner output. but i have both active because there can be differences. i have all mine in tabs so it's no effort to hide them out of the way most of the time.


Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-12 19:43:25
Yeah me too and musicbrainz gets more of the obscure artists nearly everytime, I use panel stack splitters to slide panels in and out. I still get this crash in musicbrainz though:

Error: WSH Panel Mod (Musicbrainz by marc2003): JavaScript runtime error:
Out of stack space
File: C:\Users\Nate\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 2332, Col: 4
<source text only available at compile time>

I'm trying to workout what is causing it, it was happening randomly not very often. Some songs it crashed on I couldn't reproduce with the same song. Then I noticed it crashes with ELPlaylist when selecting multiple songs, if I try and make it crash by drag selecting say five songs fast up and down it crashes every time. I've put it to prefer now playing which seems to have fixed the problem.

I also get this crash in now playing:

Error: WSH Panel Mod (Now Playing by marc2003): JavaScript runtime error:
Overflow
File: <main>
Ln: 77, Col: 2
<source text only available at compile time>

This happens when I reduce the panel to size 0, sometimes I don't want to show the panel so I slide it up and close it, this crashes it, I know you said you fixed this but it still crashes on Windows 8 using Jscript9, (it doesn't crash using Jscript though). I think it was you or Brett who said use Jscript9, on Windows 8 due to high cpu bug?

Edit* Just tested it on jscript and it's much faster than jscript9, that was giving 10-15% cpu usage just moving the mouse over it, now with jscript it's hitting 1% max. So which should be used jscript or j9 for win8?

Edit* It's the same on all your scripts, much much faster in jscript, I had them running jscript9 all this time because bretts wsh playlist needs j9 for windows 8. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-12 19:58:53
Quote
This happens when I reduce the panel to size 0


well don't do it then. you can achieve the same effect by hiding panels instead.

the windows 8/jscript9 thing has been reported before in the main component thread. i guess i should update my readme telling windows 8 users not to use it.

http://www.hydrogenaudio.org/forums/index....st&p=816938 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=70363&view=findpost&p=816938)

it's nothing to do with any script - it's the function that detects mouse movement that is problematic.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-12 20:18:35
I don't like hiding panels, I like having freedom to resize them with the mouse, to be able to move the layout around.
Are you using Windows 8 Marc because I've just tested this on your panels. Using jscript and moving the mouse around is doing nothing to the cpu in task manager, it's at 0-1% never goes higher. Using Jscript9 eats upto 15% CPU. This was the opposite using bretts wsh playlist.

I know it's not your scripts as it does it even with an empty WSH panel.

Also jscript has fixed that panel size 0 crash, it's all good .
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-12 20:25:33
no, i don't use windows 8 which is why i posted a link to someone else reporting that problem.

i've never told anyone to use jscript9. new panels always default to using jscript.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-12 20:33:12
So you're right. Is this reported often because I don't think it's a problem with Windows 8, at least not mine. To me it is the opposite, I think it would be a bad move to tell W8 users not to use it.

Now I remember it was hunter who told me about J9.

Quote
~eXtremeHunter1972 Apr 27, 2013
"on mouse move high CPU"

I assume you are on windows 8? if so then right click while holding shift key on playlist and select WSH configure and
on left top Script Engine select jscript (other people who have installed Internet explorer 9 should select jscript9).
This is known bug on WSH panel but so far not fixed.


Weird as it's the opposite of what he said for me, I'll have to test on some other Windows 8 machines.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-12 20:49:56
your post might as well be written in japanese for all the sense it makes to me.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-12 21:07:24
lmao, basically Jscript9 sucks on Windows 8, people told me to use it though, which I'm not now.

Marc musicbrainz is still crashing 

Quote
Error: WSH Panel Mod (Musicbrainz by marc2003): Microsoft JScript compilation error:
Unterminated string constant
File: C:\Users\Nate\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 2297, Col: 7
<source text only available at compile time>
Musicbrainz: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
  <head>
    <title>502 Bad Gateway</title>
    <link rel="stylesheet" href="/.proxy/httperror.css" type="text/css" />
  </head>
  <body>
    <div id="bg">
      <img src="/.proxy/MusicBrainzLogo-Q.png" />
    </div>
    <h1>Server being naughty</h1>
    <p>One of our servers appears to be misbehaving.&nbsp; Please try again later.</p>
    <p id="http">502 Bad Gateway</p>
  </body>
</html>


*Edit I guess that's not your script, it's their server. Ignore this.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-12 21:22:11
the script shouldn't crash because of the dodgy server response. i've just updated it to fix that.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-12 23:07:19
Damn you're quick on fixes, it's not crashed at all since the fix, cheers dude
What are you working on at the moment? A VU meter by any chance?
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-13 00:31:03
Got a link request, it's a must have for guitar players.

Code: [Select]
http://www.ultimate-guitar.com/search.php?value=$replace(%artist%, ,+)&search_type=band
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-05-13 07:49:51
Bratman


Maybe you didn't understand me or i explained poorly, if you are on windows 8 DON'T use jscript9, if you are on xp or vista or seven and you have installed internet explorer 9 then use jscript9.
Windows 8 uses jscript10 engine and thats why there is some complications when jscript9 is enabled on your machine.

T.P. Wang has written:

v1.5.0 Beta 1
- ADD: Add support for new JScript engine (aka "Chakra") from IE9.
      In order to get it work, select "JScript9" from the script editior, and ensure the IE9 is installled, or it will fallback to the default JScript engine.
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2013-05-13 10:43:11
Are there any advantages to using JScript9 over the default JScript?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-05-13 11:51:09
Wikipedia Jscript9 (http://en.wikipedia.org/wiki/Chakra_%28JScript_engine%29)

Test it on your machine with this script, in my old core2duo with jscript9 calculation takes 25 ms with jscript it takes 349 ms.

Code: [Select]
function on_paint(gr) {

    var from = new Date();

    for (var i = 0; i < 1000000; i++) {

        var result = Math.sqrt(i);

    }

    var to = new Date();

    gr.SetTextRenderingHint(5);
    gr.DrawString("Calculation took: " + (to - from) + "ms", gdi.font("Segoe Ui", 20, 0), 0xFF000000, 30, 30, 1000, 30);

}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-13 14:03:02
jscript9 certainly looks far faster performing 1 million calculations like that but have you tested your own scripts? i just tested a few of my own and it's far less conclusive. i even have jscript consistently beating jscript9 in a few of them (to be fair, the difference is less than 10ms). 

of course the most expensive operation in WSH panel mod is the display and it's not going to help with that at all.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-05-13 14:17:37
It's faster in WSH playlist initialization when there is some 50000 tracks to init,

but most of the time the difference is negligible and I personally don't bother to switch  jscript9.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-05-13 14:19:46
Wanted to edit my last post.
Ehh we really need option to delete post!
Delete me please.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-13 14:34:41
i just added 13 of my own panels plus falstaff's WSH playlist to a default UI layout and restarted foobar 5 times for each test. these are the startup times reported in the console.

jscript
Code: [Select]
0:00.485566
0:00.476765
0:00.485435
0:00.497912
0:00.485515


jscript9
Code: [Select]
0:00.591191
0:00.588813
0:00.605242
0:00.596497
0:00.591015


although the difference is small, it's certainly consistent. this was on windows 7 x64 with IE9 installed.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-13 14:51:33
Hunter, reading your comment again makes sense now, my bad.
I tested the calculation script and I get 25ms in jscript9 compared to 145ms in jscript.
When I am using Marcs scripts, I get high cpu usage moving the mouse cursor over them with jscript9.
So jscript9 IS faster but the downside is it lags with mouse activity?
But then Marcs last reply proves jscript9 is slower (at least with his scripts) , I'm a BIT confused. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-13 15:02:21
Quote
When I am using Marcs scripts, I get high cpu usage moving the mouse cursor over them with jscript9.


like i said before, it has nothing to do with my, or anyone else's scripts. it's a problem with the component. you can verify this yourself by adding a blank panel and adding only this code to it. close the dialog and move your mouse over it.

Code: [Select]
function on_mouse_move(x,y) {}


Quote
So jscript9 IS faster but the downside is it lags with mouse activity?


jscript9 is faster at pure number crunching. that snippet extremehunter posted has it performing a million calculations and it certainly looks far superior doing that one task.

but i've found that in real world usage - at least using my scripts - it's slower.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-13 15:54:40
a little update:

Code: [Select]
7.2013-05-13.01

"Discogs". As discogs uses something like $swapprefix, this
script needs to use it if the "exact artist match" option is
enabled. Also, the output has been tidied up by removing
all extraneous spaces.


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-14 00:24:57
Your scripts are faster in Jscript though, it might depend on the script because sometimes jscript9 is faster on certain scripts. Maybe that is wrong, it's just what I've seen.
I'll just use Jscript I agree it's faster in real world usage.

Musicbrainz has been crashing again on me, a new error.

Quote
Error: WSH Panel Mod (Musicbrainz by marc2003): Microsoft JScript runtime error:
'this.data.length' is null or not an object
File: C:\Users\Nate\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 2107, Col: 21
<source text only available at compile time>


Somethings up with the code, it's not working at all even after pasting in from samples.

*nvm, your latest dropbox sample rar has fixed it.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-14 15:33:59
I have created a context menu item to open the now playing track in an external spectrum analyzer program (SPEK.EXE)
But it does not work . . . SPEK opens with a blank interface but does not load the track (i.e. the file path)

Why ???? . . . this program accepts basic commands like spek.exe [file] , therefore it should work.



Here is the context menu function in the script:
Code: [Select]
function on_mouse_rbtn_up(x, y) {
    metadb = fb.GetNowPlaying();
    _menu = window.CreatePopupMenu();
    _menu.AppendMenuItem(MF_STRING, 1,  "Open active track with SPEK");
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(MF_STRING, 2,  "Configure");
    idx = _menu.TrackPopupMenu(x, y);
    if (idx == 1) try {
        var path_to_target_file = metadb.Path;
        WshShell.Run(fb.ProfilePath + "addons\\wsh-enhanced-fb2k-spectrogram\\spek.exe" + "path_to_target_file");
        }
        catch(e) { }
    if (idx == 2) window.ShowConfigure();
    _menu.Dispose();
    return true;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-14 15:55:13
Quote
"path_to_target_file"


you've put the variable name in quotes so it's getting sent as plain text.

also, you need to consider spaces in your paths/filenames. try this.

Code: [Select]
WshShell.Run("\"" + fb.ProfilePath + "addons\\wsh-enhanced-fb2k-spectrogram\\spek.exe\" \"" + path_to_target_file + "\"");
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-14 16:45:43
You nailed it marc, thanks  +++++++++++++++++++++++++++++++
Title: WSH Panel Mod script discussion/help
Post by: ehrgeiz on 2013-05-15 00:14:21
another 'nice to have' feature would be a script that calculates a fingerprint with chromaprint/fpcalc.exe [1] for the current track, queries the acoustID database to extract the musicbrainz recording-id [2] and then pulls artist-credits via the musicbrainz webservice [3] for display.
eg.:
S'posin'by Frank Sinatra
writer:    Paul Denniker, Andy Razaf
arranger:    John Guarnieri
bass:    Herman Albert
guitar:    Tony Mottola
lead vocals:    Frank Sinatra
piano:    John Guarnieri


sadly i don't know how to do that but maybe someone else who thinks that'd be nice3 

[1] http://acoustid.org/chromaprint (http://acoustid.org/chromaprint)
[2] http://acoustid.org/webservice (http://acoustid.org/webservice) ; e.g.: http://api.acoustid.org/v2/lookup?format=x...oDx1AAhAEFEMEAA (http://api.acoustid.org/v2/lookup?format=xml&client=8XaBELgH&meta=recordingids&duration=167&fingerprint=AQADtEmUaEkSRZEGHJCBI8cj8DiSnDjizyiVBk9wonk--Dua47qQxyNkLUcfhPmN68bx5Wi4A7aO45_xI71CFe2H5Iku4PB1nBu-3HhRRw9xHT9ONMeL40mOH8nEnEKYKNnx40fzE1X44scn9AmaHyeNME-UI9lxHp1yhLEb6BIC92HwpTeeZMbDJ6h0NOpXJH-OXITTZMFFwgtVHVeaBK6Mh7nwFX2E5mJx6viO6JAq6jDVQM8RSlKegklyfOCjrGDy5Dj2IMyY63ik4x98i8LlQm_wIN-O4xd8Dg_2YdnzIc8XJHfwTscUOUIPjsdz_Cmiq4SmH4-i4IfIHM9Q_vhw5EmES0w045SuoKbRvBl-qriOqeqRSy10ZDkp4QlG_oEX_bhOXLrwKHmQREZ6MWByH8-CPJI-nHlwSQn0SwgXPkLChZeE0MfDrJhswz1M6RdCPyN05BLxAE8SHZcO5_ilIVfWBN8M5csRPfiKK_rRH9Z2nEf_4k4yXFmKKyHxccef4R98HTmP5MND4ZKiEXceOI_wA-_RPES7PDEu6TjSN4mg8EV-eK_wiPiSKMUeND5KnbiPKmGuoHkW7GHwJNiFG8kVfcgTYTqa40kSXMajhwgFORkfnMoSb2BQ9mguCW8i4sYPbsuMZ8mToWQfNBaPk9AP5U1xQ_2hHefRsWhCZYFG4umDlwhTo7eK78WfwJJ09Ay-jAh56EKeYfpyMNlDKZiy9KiMr0fyTETonEEzHQ-Pn1j74I8Gl0eiIzqe4EosPMdlHs8i3WguHuPlIPGP7EHy1IisF9WO8ziz2MJzNFXiJUgdpqKQjMKzaMePporEoj9GxxGRLckFxdeIvEFTheiH-0fPBeeP6j2eHT9OXFOORxeO76gS-UTq61BWJTr6iqheZDxOffCUHE_VoDkuTseVJVFUdLPQ7DzoJWqCc5WhwA_6o_kX4uFTmGFyXNGRx9A-NHeRLCsmS3hCHS-V42mbgf_wCzuaUDnapOpxicTq5bilLsj-BEkuGm8VPM7Q5xf6B89FXEKeH3qO9A-eC1eI_Ifn9Lim48qD58V_aD2a_YV-4kl6_CmexkWkzJTB_Djix0iaPIcZnbgypsEnlEyOhgd743mwJWF-qMoOH39wlRh5HWXyGZsyxUfFok-GZLmQPFGuoHxg1DJ-hmiWpcEH54wRPjuS4w_xiEc5H01UNiMuOGuQT9C9EWeEHsKPtGPx40X6D4eVJEcy6jhhdk2F60cd5UHTJzj-HM-yTELOpUhOoo_QhBme7RbwxMG-4ymSJ0WuPPB04skLTr2J_Wj0o9KaHT_u5EguBTlzmPljXMnR_EIf4A9cMTP-I4oV5kESL6SEJtdQxU5CTEwewuPRJ8eVI3uRNMfFB3OiXEWPJmfwHzG3HPqRE82PUsWHHmHOTNCtESG1w02YtOipY3bB5CJCZllO6AipoMlyPMSdwx_O7MOZR1AuND8mRSyPf9gZLVHxJIefI3-QHP8CK3mIK3WOj33Q5Aneo4mz4yeu5EnQTMmhnS_2DD_4rMP3GE2So9rxQ__h8imOa8ooPOSDHlT1HPkK5VIQXhd-fGrxlcPzoVkvFReaP3jGI4d2HXGWEBXHMPgV9Deapjt-4dbxfEdPD_mCpsKP5kNy-E2GP8J5WPnxHz6Dp4ReXFrChWir4y9KHk0colG0o06OX7jgOnim4zq8IGnyBPH14T6Mo69RK8GTHTmRLOfQi7i6HHOiPGjqFP3xYB-eow-SxclD5EcPo2-Q08aFH79TNI8QdtFxH1dH2PiJ7ZjzByEPLc-RJ9kzXDmF8EtjJMsxis_xTAmFf43xE9MfbEilB8mekTjx08MlHc-iC8ezHA5zCrsdHH9U_Hh2XNlzvB3K5oHPiEGYJsQP6E9RSR9SJhr6i8P1oJnUERWjo7_QT9EQXjmSJS-eC1ee42mH64RfPPgyIoeWKLqMUjoT4UT4Hameo16Cb9CyIPxxN8iPZMlRpmlwW_CPPz2eTRSuPGg-JOePdGwcnD4qXcGTLAtODXijI1LyB8mePWByHdP34smKK8FzYzpTNOeDn8TaGxWP5rnwJDlyPIf2MESY8MkS_KJQfXDVw0atXpgP8wcr5cIT7cGUv-iDXkIzORfCJkl5JMtP_DkudEzwad6wVcwxTcO7oy_C5Ej2LEczicbVODE8ZhYu4k8unMUtavhxD4H24Q-eJcfRjMfzBPKFB88QHk-WB9e-4eyMZjmORzfOJcRz9EuIiwyDcw-a8fiNOyT2SUaDxlmIq8f_YIyvCc0sKUOfG0f6rEguRXiSyEbzB1Ve4VeT4ikuEU_CRAj_mPCjDNWadHjCB8ffYD_-ohEmfdD14MlSQfOhkT1iMT-e7PiLJ8eV-OiTDE1yHd8S7Ug-MUGO5khmr4j4o0l2LTGYX9ijEEeDSH5yJFcuNFXQ5MN_JFczhNGboRRzgtSDJrbQ08gjpkHyJDjMD2cw-knwK8h3yFESbZUQFlZe5DHKZyyeRDuuGffRvOidBnKPXxWexCn0HQijHb3y4oye4EezPAn-DPUq4jtyWA9kKYmOXMyEdopLNBep4PNT7GGMXj-aRTiSH-lDvDbuBz9yZYWeSCnCN0ifLUZy7Qum6sSjo3zQxJyEOsmLpidxZkdy5EpyHF-yHA959EIzJqKKu4sQvYFU5cgVDs3RH1dQitbxJc_Qtcf348eRQ3ryCGEiH08yJcct7BeaRxmS_EZ-oszngEnkHY8ioknGozeO5hIS3QkR5mKHJ0k0wXUxJtlxMT6eSGkOd-KQSzmSo1nR5gseLaUAaFIRYZxCGDDCYcSMkIIwQphyBgzDiHBGcACcIQIhRTRTCjUDGTLEWQIYAkAMIwgQwkAFHAHMGAwUAYYAqAAihgImtDKGMG-IUBsAwhwElkLBRBGCeiCAEkw4jiQ0CBGgqGSCMYyJAIAIwoBQQiwADAFEEIIQIcAogpAQACkBhFALCkScYcJAQgwBhBADmGOAIgKgEUwQJwBRQAiDjFJIAEcWcJIZoo0BBkAEHQNGgMAgIgIAQBg1gABACAIEOIwUEQ44QhwRhmFDAADOQOCIckgAIYEHSREiCAACUeAIQ4QQoghhAhBlkCRCMKKAAYByQ4xiCgEGgFACEiAMowwQQQgWSgAhGKFUAYMMAYYABoAgCAgkGDUAEIIIEEIgCgwiSBkghEMIMWCUEIAoRBggBFBDlCCMeKcMAEQhpQASRkAgJCHeCQWJNAJxhLgnAiOrBEWMAEAMwMQBQpEBhgqEkCLOAIAEQcYwApBAABCDjKKMMAAUQEIwQzAwQDtBlOEAFGE0IEAABBAQwCgAEJEACCaEQgAaZwIQRAghGEKCAWWEcdABRIzgRBEhpBHCGYANQZAKYgSgQDHBHSKOIIAEAMAAwaQiigHKBBEAIOAcEc4IQAQDiDjoAFAAMoSclQAgYjyEjiAhFVOKCQEwIYJaQoXRiABEAEGCECCoEAoJBwBCCBBCgWCCAE8EAQAZgBgQQAjBiCBGECAUAAAhpCCyBIBCCCCEKOMwQYAIYQgSSAAmFEICCCKEAgQQwowAAjgCAFDAKSeEgEARBSBBwAAhAAEAIEAIIEwYgQwEgDEmLCYWIAEFUYwyMghABEEGEAISGGKARIQAQAQQBA1ABDDAUGKEEECBQrAAQCFhnEBAUICQQQABBQTyEECBFKJICIGZQAQgJAhBgxAoAABiEIcgAYQQRQgBwCDggCKMIBCAAQI4ABBChjqgNBBAIUCIMcIIRthCkABBNADAOAOkAAwAAImwIigpFBCKEqAEAIwoDx1AAhAEFEMEAA)
[3] http://musicbrainz.org/doc/Development/XML...rvice/Version_2 (http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2) ; e.g.: http://musicbrainz.org/ws/2/recording/9c7a...k-rels+url-rels (http://musicbrainz.org/ws/2/recording/9c7ae097-408a-43a3-be2a-5094b45fe441?inc=recording-rels+artist-rels+work-rels+url-rels)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-15 15:30:48
i'd consider making more musicbrainz scripts provided files are tagged with proper MBIDs before hand. i'm not really keen on doing the lookups first when people can easily use picard (http://musicbrainz.org/doc/MusicBrainz_Picard) to tag their files.
Title: WSH Panel Mod script discussion/help
Post by: ehrgeiz on 2013-05-15 16:51:05
i'd consider making more musicbrainz scripts provided files are tagged with proper MBIDs before hand. i'm not really keen on doing the lookups first when people can easily use picard (http://musicbrainz.org/doc/MusicBrainz_Picard) to tag their files.


good thing i tag my files with picard
bad thing is that foobar can't read the MUSICBRAINZ_TRACKID field picard is writing to store the MBID[1] for that specific recording as it is using the UFID[2] field for that.
so for specific track-credits you'd have to make two queries, one to get all recordingIDs from the current release and then with help of the tracknumber get the recording/track ID to query the specific credits i guess. dunno if thats easier than using the fingerprinter. maybe i'm just a fan of these open-source/open-data projects that i want to see them used in my favourite mediaplayer^^

[1] http://musicbrainz.org/doc/MusicBrainz_Picard/Tags/Mapping (http://musicbrainz.org/doc/MusicBrainz_Picard/Tags/Mapping)
[2] http://id3.org/id3v2.3.0#sec4.1 (http://id3.org/id3v2.3.0#sec4.1)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-15 17:27:08
i had a quick search (http://forums.musicbrainz.org/viewtopic.php?id=3244) and you can configure picard to write a TXXX frame in the scripting section of the options.

Code: [Select]
$copy(_id3:TXXX:MUSICBRAINZ TRACK ID,musicbrainz_recordingid)

what's really bugging me at the moment is the inconsistency between the id3 & flac/vorbis tag mapping. why use MUSICBRAINZ ARTIST ID and MUSICBRAINZ_ARTISTID when they could use one OR the other?
Title: WSH Panel Mod script discussion/help
Post by: Black Bear on 2013-05-16 04:20:39
I don't really know what to do with this component. Every time I try to load it, it crashes. This last time the console gave me this, but I have no idea what it means. Any help?
Code: [Select]
WSH Panel Mod ({ED89F4DA-FDCC-4CBC-8DDB-58D202FD6BF3}): initialized in 28 ms
Error: WSH Panel Mod ({1F73EB63-C052-4E32-8A7A-BF4FBF6C1430}): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Ln: 88, Col: 5
<source text only available at compile time>
Error: WSH Panel Mod ({82E26BE2-93C2-497A-BFE4-C40892B2AFDD}): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Ln: 25, Col: 5
<source text only available at compile time>
Error: WSH Panel Mod ({ED89F4DA-FDCC-4CBC-8DDB-58D202FD6BF3}): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Ln: 46, Col: 5
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-16 05:56:56
the console is telling you that 3 scripts have crashed and it tells you where to look for the errant code in each one.

i'm guessing you didn't create these scripts but are using someone else's configuration (or theme)?? if it's from deviantart, your best bet would be to ask the author there.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-05-17 23:21:35
Hi marc2003, thank you so much for your scripts, i'm having some fun lately with the spectrogram seekbar, really clever
I know it's probably too hard, but i was wondering if it's possible to add the possibility to change the spectrogram colours like in the native fb2k spectrogram.
It would be perfect to integrate it in some skins!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-17 23:39:27
samples updated: artreader and cd jewel case now have options to launch Album Art Downloader (http://www.hydrogenaudio.org/forums/index.php?showtopic=57392) from the right click menu, sending the current artist/album as search terms.

(https://dl.dropboxusercontent.com/u/22801321/2013/may/cd%20aad.jpg)

existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js


@foomark, right click>SoX options. then look at page 33 of the sox.pdf file. play with the -h, -m and -p options. you can't easily choose colours but you might find something better suited than the default.

remember that playing with these options will render all previous images obsolete so you might want to clear them using the right click menu.
Title: WSH Panel Mod script discussion/help
Post by: kareha on 2013-05-18 00:38:54
Fantastic cover art update, works like a charm.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-18 05:39:28
it's possible that recent updates over the last day or so have broken the Update script feature causing all my scripts to crash on a restart.

if this has happened to you, save this file in your foobar profile\marc2003 folder and restart foobar.

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common7.js)

apologies for the inconvenience. 
Title: WSH Panel Mod script discussion/help
Post by: jaredpaik on 2013-05-18 05:43:10
Hey Guys. I'm using one of marc2003's configs he posted a few years ago.

I reinstalled Windows 7 on my PC and reinstalled foo 1.1, and set everything back up. Now I'm getting these errors on Startup.

A couple of errors;

Scripting Engine Initialization Failed (GUID: E71AC80A-2F79-4BCB-8A51-3508849A40A2, CODE: 0x80020101)
Check the console for more detailed information (Always caused by unexcepted script error).

Scripting Engine Initialization Failed (GUID: FFE1F23C-1D2D-40CF-B721-B83160A9DCC4, CODE: 0x80020101)
Check the console for more detailed information (Always caused by unexcepted script error).

and here's a dump from the console;
http://pastebin.com/q0CShRDm (http://pastebin.com/q0CShRDm)

Any help would be awesome.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-18 05:54:10
the very first line should be easy enough to interpret:

Quote
WSH Panel Mod (GUID: E71AC80A-2F79-4BCB-8A51-3508849A40A2): Parsing file "C:\Program Files (x86)\foobar2000\scripts\marc2003\v2\common.js": Failed to load


quite simply you haven't extracted the files in the zip to the right place.

that looks to be a very old script though. it's been a very long time since i've placed files in main foobar progam folder. these days the folder should be placed in the foobar profile folder. my latest scripts are available here:

https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

or if you're using my last.fm playcount sync script: https://dl.dropboxusercontent.com/u/2280132...ount%20sync.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/playcount%20sync.zip)

further questions should go in this thread: http://www.hydrogenaudio.org/forums/index....showtopic=77883 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883)
Title: WSH Panel Mod script discussion/help
Post by: jaredpaik on 2013-05-18 07:48:24
Thanks Marc.

Quick question, how do I embed Esplaylist with Playlist View?
Title: WSH Panel Mod script discussion/help
Post by: jaredpaik on 2013-05-18 09:18:44
Thanks Marc.

Quick question, how do I embed Esplaylist with Playlist View?


Nevermind, figured it out.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-05-18 09:59:01
@foomark, right click>SoX options. then look at page 33 of the sox.pdf file. play with the -h, -m and -p options. you can't easily choose colours but you might find something better suited than the default.

remember that playing with these options will render all previous images obsolete so you might want to clear them using the right click menu.


Thank you , i didn't know about these parameters, really nice to have them.
The customization's not "total" but it can fit a lot of configurations, great work, thank you again marc2003.
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2013-05-19 09:14:58
marc would it be possible to create a script that shows the top tracks for the currently playing artist?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-19 09:58:00
it might not be obvious from the name, but my last.fm similar artists script already does this. it is mentioned in the readme though.

you can switch to it on the right click menu.

you can use foo_facets for that. you can create an artist pane to select an artist. then add a track pane with 2 columns - the title and playcount. reverse sort the playcount by clicking on the header.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-19 12:55:40
And you can use the sort function too in preferences / advanced / display / standard sort patterns
Then use the sort menu command from Edit / Sort

Quote
play count=$sub(999,%play_count%)
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2013-05-19 13:26:32
it might not be obvious from the name, but my last.fm similar artists script already does this. it is mentioned in the readme though.

you can switch to it on the right click menu.

you can use foo_facets for that. you can create an artist pane to select an artist. then add a track pane with 2 columns - the title and playcount. reverse sort the playcount by clicking on the header.


awesome, thanks!
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-19 16:49:29
Marc I want to share a layout on Deviant Art using your scripts, wanted to check if it's okay with you? They are all updated to the latest version and I'll include the readme and what not.

These are the scripts:

now playing
last fm and wiki bio
musicbrainz

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-19 19:24:30
yeah, that's fine. it makes a change for someone to ask. plenty of people have used them before without checking.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-19 19:59:38
Awesome thanks I'll be sure to credit you of course, you've done amazing work.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-20 05:49:01
bugfix for my musicbrainz script.

Code: [Select]
7.2013-05-20.01

"musicbrainz". In "releases" mode, a recent change prevented
all links being clickable. This should now be fixed.


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-05-20 08:41:18
Maybe it's been already asked but...why not to add by default Wiki and Google to the Web Links?
I have the right images that match the style of other web link's buttons if needed
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-20 11:58:10
i already have the google image from the same icon pack i got most of the others from. let's see your wikipedia image.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-05-20 12:14:15
i already have the google image from the same icon pack i got most of the others from. let's see your wikipedia image.


I saw you do have wiki in the small web links script so i thought it would be nice to have it also in the standard web links script.
I have these two png that i think could match the style of other buttons:
(http://i.imgur.com/f6t4w7E.png)
and
(http://i.imgur.com/hroBCql.png)
You can download them from this zip
https://mega.co.nz/#!xxAxXYza!Ixfqq...eaX_q-Hz7XPs4aQ (https://mega.co.nz/#!xxAxXYza!IxfqqWi1MMv0dddpJAWdyzqvL3F0eaX_q-Hz7XPs4aQ)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-20 13:26:27
I saw you do have wiki in the small web links script


it's much easier to get those. i simply use favicons from the websites.

with the larger web links they really need to be the same style for it not to look horrible. i'll see if the image you provided fits.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-05-20 13:38:34
I saw you do have wiki in the small web links script


it's much easier to get those. i simply use favicons from the websites.

with the larger web links they really need to be the same style for it not to look horrible. i'll see if the image you provided fits.


Ok, it was just an idea of course.
I did a quick test and my images do look like this between the other buttons, maybe they need a small roundings on the corners?
(http://i.imgur.com/ej7NTsb.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-20 13:57:17
i'm useless at editing images so i've just added the google one for now because the image is from the same pack.

a full download is required because of changes to files and new images: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

files changed / added:
Code: [Select]
marc2003\common7.js
marc2003\images\google.png
marc2003\images\google_h.png
samples\web links.txt



Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-05-20 14:04:29
I'm not a graphic but i tried to edit them better, i think the result is quite good but maybe we do have different standards
Normal:
Title: WSH Panel Mod script discussion/help
Post by: icedtea on 2013-05-20 16:22:16
marc, another question. Is there a way I can enable click and drag for the text panels?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-20 19:49:31
not easily. i couldn't even think how to implement it so i searched the thread and found T.P Wang has a draggable text example bundled with the component. i also found you were asking about it 3 years ago.

but the way mine handles scrolling/layout/calculation of text height is completely different and it would require some major changes to the way mine works. i admit it would be nice to have and i may consider it sometime.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-21 01:56:04
samples updated: i just noticed my last.fm charts wasn't updating automatically. my own stupid fault again.

existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js


@icedtea, i tried implementing drag in text scripts but i failed miserably. it's beyond me at the moment.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-26 00:37:20
marc2003

The context menu for my "enhanced spectrogram visualization" panel has a bug; it will crash if I right click on it when there is no active track (i.e. playback is stopped).
Console error reports "Object required" at Line 102

Here is the code (Line 102 error is in red):
Quote
function on_mouse_rbtn_up(x, y) {
    metadb = fb.GetNowPlaying();
    var path_to_spek = fb.ProfilePath + "addons\\wsh-enhanced-fb2k-spectrogram\\spek.exe";
    var path_to_active_track = metadb.Path;
    _menu = window.CreatePopupMenu();
    _menu.AppendMenuItem(fso.FileExists(path_to_spek) ? MF_STRING : MF_GRAYED, 1,  "Analyze active track with SPEK");
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(MF_STRING, 2,  "Configure");
    idx = _menu.TrackPopupMenu(x, y);
    if (idx == 1) try {
        WshShell.Run("\"" + path_to_spek + "\" \"" + path_to_active_track + "\"");       
        }           
        catch(e) { }
    if (idx == 2) window.ShowConfigure();
    _menu.Dispose();
    return true;
}

How do I change that line in red to stop the crash from happening?
Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-26 13:10:49
Code: [Select]
var path_to_active_track = metadb ? metadb.Path : "";
Title: WSH Panel Mod script discussion/help
Post by: d125q on 2013-05-26 13:12:45
Try this:

Code: [Select]
function on_mouse_rbtn_up(x, y)
{
    metadb = fb.GetNowPlaying();
    if (!metadb) return;
    var path_to_spek = fb.ProfilePath + "addons\\wsh-enhanced-fb2k-spectrogram\\spek.exe";
    var path_to_active_track = metadb.Path;
    _menu = window.CreatePopupMenu();
    _menu.AppendMenuItem(fso.FileExists(path_to_spek) ? MF_STRING : MF_GRAYED, 1, "Analyze active track with SPEK");
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(MF_STRING, 2, "Configure");
    idx = _menu.TrackPopupMenu(x, y);
    if (idx == 1) try {
        WshShell.Run("\"" + path_to_spek + "\" \"" + path_to_active_track + "\"");
        }
        catch(e) { }
    if (idx == 2) window.ShowConfigure();
    _menu.Dispose();
}
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-05-26 13:47:00
Righto . . . Solved! . . . Thanks for the answers guys +++++

The code also needed one more little tweak (all new edits are in red):
Quote
function on_mouse_rbtn_up(x, y) {
    metadb = fb.GetNowPlaying();
    var path_to_spek = fb.ProfilePath + "addons\\wsh-enhanced-fb2k-spectrogram\\spek.exe";
    var path_to_active_track = metadb ? metadb.Path : "";
    _menu = window.CreatePopupMenu();
    _menu.AppendMenuItem(fso.FileExists(path_to_spek) && metadb ? MF_STRING : MF_GRAYED, 1,  "Analyze active track with SPEK");
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(MF_STRING, 2,  "Configure");
    idx = _menu.TrackPopupMenu(x, y);
    if (idx == 1) try {
        WshShell.Run("\"" + path_to_spek + "\" \"" + path_to_active_track + "\"");       
        }           
        catch(e) { }
    if (idx == 2) window.ShowConfigure();
    _menu.Dispose();
    return true;
}
Title: WSH Panel Mod script discussion/help
Post by: Aldem on 2013-05-26 13:59:18
Hi

This is the error that I get when I try the themed seekbar

Code: [Select]
WSH Panel Mod (Themed Seekbar by marc2003): Parsing file "C:\Users\Aldem\AppData\Roaming\foobar2000\marc2003\common7.js"
Error: WSH Panel Mod (Themed Seekbar by marc2003): Erreur d'exécution Microsoft JScript:
'this.themed_header' a la valeur Null ou n'est pas un objet
File: C:\Users\Aldem\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 986, Col: 6
<source text only available at compile time>


I'm using Foobar2000 on Windows 7 - 32 Bits

Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-26 14:05:25
it works on any theme apart from windows classic. i guess that is your issue.
Title: WSH Panel Mod script discussion/help
Post by: Aldem on 2013-05-26 17:22:47
You were right, thanks for the tip and for the good work !
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-27 22:45:47
marc why did you take out the option to select a different language in the biography context menu?
I've got a couple of people asking how to do it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-28 03:41:30
that change was made sometime ago and i put this note in the panel to explain why:

Quote
//due to recent changes at Last.fm which truncate the artist bio to just
//300 characters, this script now uses an alternate source for the bio.
//it's English only and there is no support for other languages.


last.fm announcement: http://www.last.fm/group/Last.fm+Web+Servi...21604/_/2201974 (http://www.last.fm/group/Last.fm+Web+Services/forum/21604/_/2201974)
old screenshot showing the difference: https://dl.dropboxusercontent.com/u/2280132...20new%20bio.png (https://dl.dropboxusercontent.com/u/22801321/old%20new%20bio.png)
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-05-29 00:30:08
Stupid last.fm, oh well I have to agree with the decision.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-05-30 09:44:20
samples updated. i made a quite a serious **** up about a week ago but no one has reported any problems. i won't mention what i did but this fixes it.

i also updated my last.fm & wikipedia biography script. when in wikipedia mode, i've tidied up the text by removing where it says edit: on some section headers.

existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: Dario on 2013-05-31 22:51:01
Is it possible to do multiline tooltips? If yes, how exactly?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-06-01 05:36:56
i don't think so.
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2013-06-01 10:36:06
I have a simple question.
I don't want to see the id 3 (Artwork id 3 Icon)
how must I modify the mouse wheel function?
I don't get it...

Code: [Select]

function on_mouse_wheel(delta) {
    id -= delta;
    if (id < 0) id = 4;
    if (id > 4) id = 0;
    window.SetProperty("id", id);
    update_image();
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-06-01 10:53:03
Code: [Select]
function on_mouse_wheel(delta) {
    id -= delta;
    if (id == 3) id -= delta;
    if (id < 0) id = 4;
    if (id > 4) id = 0;
    window.SetProperty("id", id);
    update_image();
}
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2013-06-01 11:18:24
Thank You!!! It's working
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2013-06-05 17:44:42
I played a litle bit with the SetInterval function.
I want on playback new track that the text pop up in my pannel.
But only once and not untill eternity...
here Is my modified code from page 80

Code: [Select]
// -------------------------------------------------------------------------- //
// @name "TXT FX Alpha"
// -------------------------------------------------------------------------- //

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

DT_LEFT=0x00000000;
DT_CALCRECT = 0x00000400;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_NOPREFIX = 0x00000800;

var special_font = "Calibri";
var font_h = 1;
var font_h1 = 12;

function on_paint(gr) {
gr.GdiDrawText("XXXXXXXXXXXXXXX", gdi.Font(special_font, font_h, 1), RGB(0, 255, 0), 1,10, 404, 16, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
}

var TXT_Interval = 150;
var TXT_Timer;
var TXT_TimerStarted = false;

function onTXT_Timer() {
   
if (!TXT_TimerStarted) {

TXT_Timer = window.SetInterval(function () {
if (font_h >= font_h1) font_h = 0;
font_h += 1;
window.Repaint();
}, TXT_Interval);

TXT_TimerStarted = true;

}}

function stopTXT_Timer() {
window.ClearInterval(TXT_Timer);
TXT_TimerStarted = false;
}

function on_playback_stop(reason) {
if (reason != 2) {
stopTXT_Timer();
}}

function on_playback_pause(state) {
if (state) stopTXT_Timer();
else onTXT_Timer();
}

function on_playback_new_track() {
onTXT_Timer();
}

I hope somebody can help me.
Thank You
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-06-05 19:56:46
Try this.

Code: [Select]
function onTXT_Timer() {

if (!TXT_TimerStarted) {
font_h = 0;
TXT_Timer = window.SetInterval(function () {

font_h += 1;   
if (font_h >= font_h1) {
stopTXT_Timer();
}
window.Repaint();
}, TXT_Interval);

TXT_TimerStarted = true;

}}
Title: WSH Panel Mod script discussion/help
Post by: Jango on 2013-06-06 16:59:20
Thank You Hunter!
Now it works.
Here is the Code...

Code: [Select]
// -------------------------------------------------------------------------- //
// @name "TXT FX Working"
// -------------------------------------------------------------------------- //

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

DT_CENTER = 0x00000001;
DT_CALCRECT = 0x00000400;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_NOPREFIX = 0x00000800;

var special_font = "Calibri";

var size_a0 = 12;
var size_a1 = 12;
var size_b0 = 11;
var size_b1 = 11;

function on_paint(gr) {

gr.GdiDrawText("FOOBAR", gdi.Font(special_font, size_a0, 1), RGB(0, 255, 0), 0,10, window.Width, 16, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
gr.GdiDrawText("2000", gdi.Font(special_font, size_b0, 0), RGB(0, 255, 0), 0,30, window.Width, 16, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);

}

var TXT_Interval = 75;
var TXT_Timer;
var TXT_TimerStarted = false;

function onTXT_Timer() {

if (!TXT_TimerStarted) {
size_a0 = 1;
size_b0 = 1;
TXT_Timer = window.SetInterval(function () {

size_a0 += 1;
size_b0 += 1;

if (size_b0 >= size_b1) size_b0 = size_b1;
if (size_a0 >= size_a1) {
stopTXT_Timer();
}
window.Repaint();
}, TXT_Interval);

TXT_TimerStarted = true;

}}



function stopTXT_Timer() {
window.ClearInterval(TXT_Timer);
TXT_TimerStarted = false;
}



function on_playback_new_track() {
onTXT_Timer();
}
Title: WSH Panel Mod script discussion/help
Post by: patanpatan on 2013-06-06 19:22:15
Hi @marc2033, thanks for all your work.
I'm using Now Playing v1.4, and it's great. I've been trying to make a change, I want the thumbs to move forward one step on every image cycle.
I thought im.images was an array, so I've tried to do a .shift, and I've tried to change this.offset on every step, but I can't get it to work.
Is there some variable with the current image index? maybe I could use it to call this.wheel(index).
Let me know if it's feasible (and please consider a script update if you think it's worthy).

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: vothanhdat on 2013-06-07 02:45:39
How do I get library RelativePath in wshpanel mod.
I`m coding "WSH libray search and viewer" but I don`t know how to get library RelativePath;
WSH panel mod (http://thanhdat1710.deviantart.com/art/WSH-library-search-V1-0-376360761)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-06-07 07:00:27
@patanpatan, i might think about making that change but it won't be for a good few days.

@vothanhdat, there are no library features at all in WSH panel mod.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-06-09 11:58:14
samples updated.

Code: [Select]
7.2013-06-09.01

"Thumbs" / "Now playing". Fix stupid bug where image cycle
mode would only work when the mouse pointer is over the
panel.


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: phool on 2013-06-10 18:56:10
antheo

Here's very simple script for rotating image on playback time.

Code: [Select]
var image = gdi.Image(fb.FoobarPath + "images\\vinyl.jpg");
var angle = 0;

function on_paint(gr) {
   
    gr.DrawImage(image, 0, 0, 500, 500, 0, 0, image.width, image.height, angle);

}
function on_playback_time(time){
   
    if(angle >= 360) angle = 0;
    angle += 60;
    window.Repaint();   
   
}

I tested it with this Vinyl image (http://www.senpaigamer.com/sites/default/files/news/sony/2012/03/21-black-panther-yakuza-2-ashura-original-vinyl-record-3.jpg)

Being a complete coding noob, how would I be able to get this to work with a folder not in the foobar media library stored with png files that have been saved as "%album artist% - %album%.png".

The other catch is that the filenames of the images are all lower case, while in the foobar media library they are effectively title case (I'm not sure if that makes a difference for wsh panel).
Title: WSH Panel Mod script discussion/help
Post by: PureHydrogen on 2013-06-19 22:02:16
Hi,

First off I'm a totally new to Jscript or WSH Panel Mod but I'm trying to create a skin for foobar so I need it.
What I'm looking for is a script for a seek bar which is a half circle which slowly progresses as the song progresses.
And a similar one for the volume control. Where full volume would be and complete half circle and muted no circle.
I was wondering if this is at all possible. And if so, if somebody can help me with it.

Greetings,
Pure
Title: WSH Panel Mod script discussion/help
Post by: Yeksfys on 2013-06-19 22:34:50
Example (PopupMenu): change and restore playlists.
foo_playcount is required to view the history and new.

Code: [Select]
// Use with MenuManager()
// {{
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;
// }}

function on_mouse_lbtn_up(x, y, mask) {
switch_playlist_menu(x, y);
return true;
}

function isQueuePlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "Queue Content") {
return i;
}
}
return -1;
}

function isLibraryPlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "Library") {
return i;
}
}
return -1;
}

function isHistoryPlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "History") {
return i;
}
}
return -1;
}

function isNewPlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "New") {
return i;
}
}
return -1;
}

function ShowPlaylistQueue(focus_id) {
var total_pl = plman.PlaylistCount;
var queue_pl_idx = isQueuePlaylistPresent();
if (queue_pl_idx < 0) {
plman.CreatePlaylist(total_pl, "Queue Content");
queue_pl_idx = total_pl;
plman.ActivePlaylist = queue_pl_idx;
} else {
plman.ActivePlaylist = queue_pl_idx;
fb.ClearPlaylist();
};
var queue_total = plman.GetPlaybackQueueCount();
var vbarr = plman.GetPlaybackQueueContents();
var arr = vbarr.toArray();
var q_handlelist = plman.GetPlaylistSelectedItems(queue_pl_idx);
q_handlelist.RemoveAll();
for (var i = 0; i < queue_total; i++) {
q_handlelist.Add(arr[i].Handle);
};
plman.InsertPlaylistItems(queue_pl_idx, i, q_handlelist, false);
plman.SetPlaylistFocusItem(queue_pl_idx, focus_id);
}

function RenamePL(idx) {
fb.ActivePlaylist = idx;
fb.RunMainMenuCommand("File/Rename Playlist");
}

function switch_playlist_menu(x, y) {

var p = window.CreatePopupMenu();
var pr = window.CreatePopupMenu();

var act = plman.ActivePlaylist;
var ply_act = plman.PlayingPlaylist;
var prm = plman.PlaylistRecyclerManager;
var pl_count = plman.PlaylistCount;

p.AppendMenuItem(MF_STRING, 2000, "New playlist");
p.AppendMenuItem(MF_STRING, 895, "Autoplaylist...");
p.AppendMenuItem(MF_STRING, 2001, "Load playlist...");

if (pl_count >= 2) {
p.AppendMenuItem(MF_SEPARATOR, 0, 0);
for (var i = 0; i < pl_count; i++) {
if (plman.GetPlaylistName(i) != "New" && plman.GetPlaylistName(i) != "History" && plman.GetPlaylistName(i) != "Queue Content" && plman.GetPlaylistName(i) != "Library") {
var np = i == plman.PlayingPlaylist ? " (playing)" : "";
//var ap = fb.IsAutoPlaylist(i) ? "*" : "";
p.AppendMenuItem(MF_STRING, 2003 + i, plman.GetPlaylistName(i) + np);
try {
p.CheckMenuRadioItem(2003, 2003 + i, act + 2003);
} catch (e) {}
}
}
}

p.AppendMenuItem(MF_SEPARATOR, 0, 0);
p.AppendMenuItem(MF_STRING, 983, "Show Library" + (plman.GetPlaylistName(ply_act) == "Library" ? " (playing)" : ""));
p.AppendMenuItem(MF_STRING, 981, "Show New" + (plman.GetPlaylistName(ply_act) == "New" ? " (playing)" : ""));
p.AppendMenuItem(MF_STRING, 980, "Show History" + (plman.GetPlaylistName(ply_act) == "History" ? " (playing)" : ""));
var q_count = plman.PlaylistItemCount(isQueuePlaylistPresent());
var count_plq = (q_count > 0 ? " - " + q_count + (q_count > 1 ? " songs" : " song") : "");
p.AppendMenuItem(plman.IsPlaybackQueueActive() ? MF_STRING : MF_GRAYED | MF_DISABLED, 982, "Show Queue" + count_plq);
var pl_prd = plman.GetPlaylistName(act) == "New" ? 981 : plman.GetPlaylistName(act) == "History" ? 980 : plman.GetPlaylistName(act) == "Queue Content" ? 982 : plman.GetPlaylistName(act) == "Library" ? 983 : false;
p.CheckMenuRadioItem(980, 983, pl_prd);

p.AppendMenuItem(MF_SEPARATOR, 0, 0);
pr.AppendTo(p, prm.Count >= 1 ? MF_STRING : MF_GRAYED | MF_DISABLED, "Restore");
if (prm.Count >= 1) {
for (var irm = 0; irm < prm.Count; irm++) {
pr.AppendMenuItem(MF_STRING, 3001 + irm, prm.Name(irm));
}
}

var ret = p.TrackPopupMenu(x, y);
if (ret < 1000) {
switch (ret) {
case 980:
var total_pl = plman.PlaylistCount;
var history_pl_idx = isHistoryPlaylistPresent();
if (history_pl_idx < 0) {
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "History", "%last_played% DURING LAST 1 DAY SORT DESCENDING BY %last_played%", "", true);
history_pl_idx = total_pl;
plman.ActivePlaylist = history_pl_idx;
} else {
plman.ActivePlaylist = history_pl_idx;
fb.ClearPlaylist();
}
break;
case 981:
var total_pl = plman.PlaylistCount;
var new_pl_idx = isNewPlaylistPresent();
if (new_pl_idx < 0) {
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "New", "%added% DURING LAST 1 WEEK SORT DESCENDING BY %added%", "", true);
new_pl_idx = total_pl;
plman.ActivePlaylist = new_pl_idx;
} else {
plman.ActivePlaylist = new_pl_idx;
fb.ClearPlaylist();
}
break;
case 982:
ShowPlaylistQueue(0);
break;
case 983:
var total_pl = plman.PlaylistCount;
var library_pl_idx = isLibraryPlaylistPresent();
if (library_pl_idx < 0) {
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "Library", "%path% PRESENT");
library_pl_idx = total_pl;
plman.ActivePlaylist = library_pl_idx;
} else {
plman.ActivePlaylist = library_pl_idx;
fb.ClearPlaylist();
}
break;
case 895:
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "", "");
RenamePL(fb.ActivePlaylist);
fb.ShowAutoPlaylistUI(fb.ActivePlaylist);
break;
}
} else {
switch (ret) {
case 2000:
fb.RunMainMenuCommand("File/New playlist");
break;
case 2001:
fb.RunMainMenuCommand("File/Load playlist...");
break;
default:
plman.ActivePlaylist = (ret - 2003);
}
}

if (ret > 3000) {
switch (ret) {
default:
(prm.Count >= 1) && prm.Restore(ret - 3001);
}
}

p.Dispose();
pr.Dispose();
return true;
}
Title: WSH Panel Mod script discussion/help
Post by: millzeyweb on 2013-06-29 16:34:04
I'm finding Marc's weblinks (preferrably small weblinks version) quite useful, but I dont like the idea of it needing to generate web traffic to gather the artist links from the json data everytime a song is played. Would it be feasable and efficient enough to store successful retrieval of such data in a textfile or some other database type using WSH, and having an update button to manually update? If so, is there a script around already which works with a text/db file that does the same thing so I might could try to build something like this on my own, rather than begging Marc to do it?

Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-06-29 18:39:39
it already caches data for each artist. it is stored for one week before it checks again for updates.
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-07-10 14:10:47
Hey marc, thanks again for the scripts, I've been using them for a while now.

Just out of curiosity, is it possible to hide the buttons (Myspace/Discogs/Allmusic/etc) in the Now Playing script by commenting some of it out? Could you maybe point me to the lines I would need for that? Lines 69-73 seem to work, but I just want to double check.

Edit: I want to keep the Youtube button, so I tried swapping that one with the one that appears in the last line and commenting the rest out. It works okay at first, but then whenever I re-launch foobar all the buttons are back until I open the panel config and hit apply again. It doesn't help that I actually have no idea what I'm doing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-07-11 09:27:21
on line 60, replace the whole b.update function with this..

Code: [Select]
b.update = function() {
    if (p.metadb) {
        var artist = encodeURIComponent(p.eval("%artist%"));
        var title = encodeURIComponent(p.eval("%title%"));
        var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
        b.buttons.youtube = new button(im.x + im.w - 32, bar2y - 1, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube);
    }
    window.RepaintRect(0, bar2y, im.w, bar2h);
}


Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-07-11 11:58:44
Works perfect, thank you!
Title: WSH Panel Mod script discussion/help
Post by: cliffflip on 2013-07-15 12:16:01
Hi marc,
Is it possible to add blur effect for cover artwork?
pretty much like the background on Poweramp Music Player for Android : https://play.google.com/store/apps/details?...layer&hl=en (https://play.google.com/store/apps/details?id=com.maxmpz.audioplayer&hl=en)

one more thing, the last.fm charts codes from your sample, Is there any way to make the background transparent,
or at least change its color?

thank you very much!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-07-15 12:45:56
you can draw any image you like behind the artwork display. are you looking to edit the CD jewel case or artreader panel?

as for the transparent background, edit line 9...

Code: [Select]
var p = new panel("Last.fm Charts", ["lastfm_charts"]);


so it becomes

Code: [Select]
var p = new panel("Last.fm Charts", ["lastfm_charts", "custom_background"]);


now you can right click the panel>Background>None (None only appears when using columns UI - it's obviously not available when using default UI)


Title: WSH Panel Mod script discussion/help
Post by: cliffflip on 2013-07-15 13:14:02
thanks marc,

the artreader panel, so the bigger & blurred artwork for the background, and draw the smaller one on top of it (with shadow effect if it's possible).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-07-15 13:24:55
i'll be honest and say i don't really know what you mean. i can't make anything out from the screenshots in that link as they're all very small on a 1080p screen - i guess the page is more optimised for mobile devices.

also, i should say i'm useless at making things look pretty so i doubt i'd be able to implement it anyway.
Title: WSH Panel Mod script discussion/help
Post by: cliffflip on 2013-07-15 13:58:38
sorry my bad 

here's what I meant anyway : http://tinypic.com/r/2iup7oj/5 (http://tinypic.com/r/2iup7oj/5)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-07-15 15:02:30
if that background image is dynamically generated from the colours in the artwork, i can't do that. it would be possible to use your own "wallpaper" image as a background. the shadow effect should be possible but i don't know how. i'll have to dig around and see if i can find someone else's code that does it.

hopefully someone with more artistic flair will read this and have a suggestion.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-07-15 17:08:35
sorry my bad 

here's what I meant anyway : http://tinypic.com/r/2iup7oj/5 (http://tinypic.com/r/2iup7oj/5)


i like the idea, i may consider it for a art cover panel
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-07-15 20:20:51
here's a couple of quick bodge jobs i've made. it requires the marc2003 folder from my samples package and also  this image saved inside your foobar profile marc2003\images folder.

https://dl.dropboxusercontent.com/u/2280132.../july/splat.jpg (https://dl.dropboxusercontent.com/u/22801321/2013/july/splat.jpg)

if you want to use your own background, you can edit the filename on line 14.

first one is just a plain front cover on the background...

screenshot - https://dl.dropboxusercontent.com/u/2280132...3/july/art1.png (https://dl.dropboxusercontent.com/u/22801321/2013/july/art1.png)
download - https://dl.dropboxusercontent.com/u/2280132...3/july/art1.txt (https://dl.dropboxusercontent.com/u/22801321/2013/july/art1.txt)

the second one has a seekbar and track details.

screenshot -  https://dl.dropboxusercontent.com/u/2280132...3/july/art2.png (https://dl.dropboxusercontent.com/u/22801321/2013/july/art2.png)
download -  https://dl.dropboxusercontent.com/u/2280132...3/july/art2.txt (https://dl.dropboxusercontent.com/u/22801321/2013/july/art2.txt)

(note the right click options to change centre/crop/stretch do not work. i'm not going to edit my common file just for this)
Title: WSH Panel Mod script discussion/help
Post by: Rarn on 2013-07-24 18:25:52
Is there a way to send a command that jumps to the currently playing playlist, and highlights the playing track?

Basically I'd want a button that does the exact same thing as double clicking the status bar.

I know how to make the button I just don't know what the command would be, or if it is possible!

thanks!

edit: this is in DUI if that is relevant.
Title: WSH Panel Mod script discussion/help
Post by: Rarn on 2013-07-26 09:13:45
Well, I've found a solution if anybody else turns out to be curious, no thanks to me, but to finding the necessary code in a coverflow panel by "Br3tt aka Falstaff." 

It used this function (very slightly modified to remove dependencies):
Code: [Select]
function ShowNowPlaying() {
    if(fb.IsPlaying) {
        if(plman.PlaylistItemCount(plman.PlayingPlaylist)==0) {
            return true;
        };
        plman.ClearPlaylistSelection(plman.PlayingPlaylist);
        var nowplaying = plman.GetPlayingItemLocation();
        var pid = nowplaying.PlaylistItemIndex;
        if(pid>=0 && pid<plman.PlaylistItemCount(plman.PlayingPlaylist)) {
            plman.SetPlaylistFocusItem(plman.PlayingPlaylist, pid);
            plman.SetPlaylistSelectionSingle(plman.PlayingPlaylist, pid, true);
            plman.ActivePlaylist = plman.PlayingPlaylist;
        };
    } else {
        if(plman.PlaylistItemCount(plman.ActivePlaylist)==0 || !fb.GetFocusItem(false)) return true;
        plman.ClearPlaylistSelection(plman.ActivePlaylist);
        var pid = plman.GetPlaylistFocusItemIndex(plman.ActivePlaylist);
        plman.SetPlaylistFocusItem(plman.ActivePlaylist, pid);
        plman.SetPlaylistSelectionSingle(plman.ActivePlaylist, pid, true);
    };
};


I'm not sure what the purpose of the code in the else statement is though, it appears to behave the same without it.
Title: WSH Panel Mod script discussion/help
Post by: SardonicWrath on 2013-07-26 18:11:19
when I last worked on my foobar config, WSH panel was just released... and turns out I completely underestimated the potential of this component. What you guys accomplished is beyond amazing

@Marc2003:
I am just trying to adapt some of your great panels for my config, and I stumbled upon a small issue concering the last.fm panel (and similar) when using "Selection Mode / Use Display Preferences" (set to "prefer current selection" in Preferences):
When I select a group in el_playlist by clicking on the group header, the panels switch back to the now playing artist for a very brief moment. Only happens during playback/pause, its fine while stopped.
Some function (item_focus_change() I think) is triggered twice, probably because el_playlist clears the selection before making a new one, or something like that.

I tried fixing it myself by adding a tiny delay time in various parts of the script, without success (obviously...). I'm afraid this is to difficult for me, just having started with WSH panel and having next to no JScript experience 

Anyways, thanks for those awesome scripts
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-07-26 22:22:59
i can't seem to reproduce that issue but i know the selection can change back to now playing when the playlist loses focus. i guess you're seeing this.

instead you can right click panel>selection mode>follow selected track. that should always stay with selection even when the playlist loses focus.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2013-07-27 00:05:50
That album background camouflage effect is cool I always wished this was possible with channel spectrum so the spectrum bars changed colour with the album art above.
Title: WSH Panel Mod script discussion/help
Post by: SardonicWrath on 2013-07-27 14:27:51
i can't seem to reproduce that issue but i know the selection can change back to now playing when the playlist loses focus. i guess you're seeing this.

instead you can right click panel>selection mode>follow selected track. that should always stay with selection even when the playlist loses focus.

well, thats probably because I have a kind of unusual setup... I use two playlists that are visible all the time, one for playback and one for viewing the library. The playback one is always kept active (I use a script for that).
"Follow selected track" doesn't work well for that, it sticks to one playlist
Still a bit confused how all of this works, with focused/selected items/playlists....

Anyway, I found a solution:
Code: [Select]
function on_selection_changed() {
    nowplaying = fb.GetNowPlaying()
    focused = fb.GetSelection()
    if (fb.IsPlaying && fb.TitleFormat("%artist%").EvalWithMetadb(nowplaying) == fb.TitleFormat("%artist%").EvalWithMetadb(focused)){
        var timer
        timer = window.SetTimeout(function (){
            p.item_focus_change();
        }, 200);
    } else {
        p.item_focus_change();
    }
}

Same for on_item_focus_change
I know, hideous code, there gotta be a more elegant method of comparing the playing and the selected item, but I couldn't figure it out and used something i found somewhere.
But it solved my problem and only adds this tiny delay when its necessary.

What could improve this solution is if I could determine the reason for the selection change- wether it was because I made a new selection or whatever el_playlist does on group selection that causes the selection to jump to now playing.
But I guess thats not possible, or is it?
Doesn't really matter, what I got now is good enough
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2013-08-01 07:41:13
I wonder if you guys could help me. I'm using Br3tt/Falstaff's WSH Playlist this one here (http://br3tt.deviantart.com/art/WSH-Playlist-2013-v0-0-8-368997689), and I'm trying to get the artist image to display as a wallpaper.
I CAN get it to work when I place the artist.jpg in the album folder. BUT, some artists I have have over 20 albums or so, and rather than having the same artist image in every folder, I would like to just have the artist.jpg saved in the I:\Music\Artist folder. My Library is set up "Music\Artist\Albums".
I am using Biography Server which automatically downloads the artist.jpg from last.fm, the script I am using to save the image to the artist folder is

Code: [Select]
$replace($directory_path(%path%),\%directory%,)\artist


Which is working fine. What I am struggling with however, is getting the WSH Playlist to look here for the artist image.

(http://i.imgur.com/mPa6QhA.png)

I've also tried using the same code in Preferences>Display>Artist, but it's not working.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-08-01 08:44:43
CUSTOM Default Wallpaper Path is ... for the default Wallpaper when no "artist" pic is found, so just point the path to a single picture you want to use for this usage.

so, now, to get artist picture from a centralized folder like you want (and like i do), it's quite easy:

1) be sure that all your artists images are saved in this folder and named with the artist name plus the file extension (.jpg i asume)
2) in fb2k Preferences > Display > "artitst" tab, enter the path of this centralized folder with the pattern thaht match the filename of the image of course, in our case, the TAG %artist% give the name of the filname right ?
so enter this: I:\Music\Artist\%artist%.jpg
3) nothing else, the WSH panel properties are already set : CUSTOM Show Wallpaper AND CUSTOM Use Artist Image As Wallpaper are already set to TRUE

HTH
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2013-08-01 09:07:37
CUSTOM Default Wallpaper Path is ... for the default Wallpaper when no "artist" pic is found, so just point the path to a single picture you want to use for this usage.

so, now, to get artist picture from a centralized folder like you want (and like i do), it's quite easy:

1) be sure that all your artists images are saved in this folder and named with the artist name plus the file extension (.jpg i asume)
2) in fb2k Preferences > Display > "artitst" tab, enter the path of this centralized folder with the pattern thaht match the filename of the image of course, in our case, the TAG %artist% give the name of the filname right ?
so enter this: I:\Music\Artist\%artist%.jpg
3) nothing else, the WSH panel properties are already set : CUSTOM Show Wallpaper AND CUSTOM Use Artist Image As Wallpaper are already set to TRUE

HTH



YES, thank you it's working.

In the Biography Server Last.fm section, I have the cache file path set to:

Code: [Select]
I:\Documents\Foobar\Artist\%artist%


And under Preferences>Display>Artist I have:

Code: [Select]
I:\Documents\Foobar\Artist\%artist%.jpg
I:\Documents\Foobar\Artist\%artist%.png
I:\Documents\Foobar\Artist\%artist%.jpeg


Thanks again, man. Such a good WSH Playlist.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-08-01 09:23:02
one line is enough
Code: [Select]
I:\Documents\Foobar\Artist\%artist%.*
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2013-08-01 09:25:23
one line is enough
Code: [Select]
I:\Documents\Foobar\Artist\%artist%.*


Ah, learn something new every day. Cheers.
Title: WSH Panel Mod script discussion/help
Post by: cliffflip on 2013-08-02 19:51:11
Hi marc,
can you show me how to turn the rating panel from horizontal mode to vertical? pretty much like this :

(http://i42.tinypic.com/2u88mx0.jpg)

by the way thanks for your help on previous posts, I'm sure I posted thanks but it's deleted somehow.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-08-02 20:17:58
it would take very large changes to make that work. i might have a go if i get bored over the weekend.
Title: WSH Panel Mod script discussion/help
Post by: cliffflip on 2013-08-03 04:59:36
it would take very large changes to make that work. i might have a go if i get bored over the weekend.


I have found a way for that, thanks
Title: WSH Panel Mod script discussion/help
Post by: PeteG on 2013-08-03 05:10:46
I have found a way for that, thanks

Eh?
Meaning you found a solution and then signed a NDA with yourself?


Edit: Typo
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-08-03 05:25:50
doing it top/down is easy enough. but i was thinking it would look better with 1 star at the bottom and working upwards towards 5. that would have required a bit more effort. which way did you do it?
Title: WSH Panel Mod script discussion/help
Post by: cliffflip on 2013-08-03 08:43:16
I have found a way for that, thanks

Eh?
Meaning you found a solution and then signed a NDA with yourself?


Edit: Typo


sorry I don't understand what you mean   

doing it top/down is easy enough. but i was thinking it would look better with 1 star at the bottom and working upwards towards 5. that would have required a bit more effort. which way did you do it?


from top to bottom, it's more suitable on my skin.
Since I also use the default horizontal layout, I copy the code from common7.js file, paste it to WSH Panel then edit it.

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%skins\tests\Scripts\common7.js"
// @name "Rating"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

function rating(x, y, bs) {
    this.draw = function(gr) {
        if (!p.metadb) return;
        for (i = 1; i < 6; i++) {
            this.img = i > (this.hover ? this.lrating : this.rating) ? this.off_img : this.on_img;
            p.draw_image(gr, this.img, this.x, this.y + this.bs * (i - 1), this.bs, this.bs, "centre");
        }

    }
    
    this.metadb_changed = function() {
        if (!p.metadb) return false;
        this.hover = false;
        this.rating = p.eval("$if2(%rating%,0)");
        this.tiptext = p.eval(this.tiptext_tf);
        this.lrating = this.rating;
        window.RepaintRect(this.x, this.y, this.bs, this.w);
        return true;
    }
        
        this.trace = function(x, y) {
        return x > this.x && x < this.x + this.bs && y < this.y + (this.bs * 5) && y > this.y;
    }
    
    this.move = function(x, y) {
        if (!this.trace(x, y)) {
            if (this.hover) this.leave();
            return false;
        }
        if (p.metadb) {
            if (y > this.y) p.tt(this.tiptext);
            this.hover = true;
            this.lrating = Math.ceil((y - this.y) / this.bs);
            window.RepaintRect(this.x, this.y, this.bs, this.w);
        }
        return true;
    }
    
    this.lbtn_up = function(x, y) {
        if (!this.trace(x, y)) return false;
        if (this.check) {
            if (this.lrating != this.rating && this.hover == 1) fb.RunContextCommandWithMetadb("Rating/" + (this.lrating == 0 ? "<not set>" : this.lrating), p.metadb, 8);
        } else {
            p.MsgBox(this.error_text, 0, p.name);
            p.browser("http://www.foobar2000.org/components/view/foo_playcount");
        }
        return true;
    }
    
    this.leave = function() {
        p.ttd();
        this.hover = false;
        window.RepaintRect(this.x, this.y, this.bs, this.w);
    }
    
    this.x = x;
    this.y = y;
    this.bs = bs;
    this.w = this.bs * 5;
    this.hover = false;
    this.rating = null;
    this.lrating = null;
    this.img = null;
    this.off_img = gdi.Image(p.images_path + "off.png");
    this.on_img = gdi.Image(p.images_path + "on.png");
    this.check = utils.CheckComponent("foo_playcount", true);
    this.error_text = "This script requires foo_playcount.";
    this.tiptext_tf = this.check ? 'Rate "%title%" by "%artist%"' : this.error_text;
}


var p = new panel("Rating", ["custom_background", "metadb"]);
p.version = "7.2013-04-02.01";
p.filename = "rating.txt";
var r = new rating(0, 0, 18);
p.check_version();

on_item_focus_change();

function on_size() {
    p.size();
    r.x = Math.round((p.w - r.w) / 52);
    r.y = Math.round((p.h - r.bs) / 5);
}

function on_paint(gr) {
    p.draw_background(gr);
    r.draw(gr);
}

function on_metadb_changed() {
    r.metadb_changed();
}

function on_mouse_move(x, y) {
    r.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
    r.lbtn_up(x, y);
}


I need a smaller panel, so I resized it too.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-08-04 20:32:53
sorry my bad 

here's what I meant anyway : http://tinypic.com/r/2iup7oj/5 (http://tinypic.com/r/2iup7oj/5)

I noticed no one responded to your question about this. I can't give you exact code for your theme, but this should give you a place to start.

You'll need to have two copies of the album art. This code assumes you're loading the album art into an image called albumart. I'd suggest, loading it once and then drawing it into the background image like so:
Code: [Select]
    bgImage = gdi.CreateImage(1920,1080);
    background = bgImage.GetGraphics();
    background.DrawImage(albumart, 0, 0, 1920, 1080, 0, 0, albumart.Width, albumart.Height);
    bgImage.ReleaseGraphics(background);
    bgImage.BoxBlur(40, 5);


I went with a medium amount of BoxBlur and then 5 iterations which should give you a nice diffuse background image.

Then just draw bgImage to cover the panel and draw albumart on top of it. I didn't test this code, so apologies if there are any bugs.
Title: WSH Panel Mod script discussion/help
Post by: cliffflip on 2013-08-05 08:59:25
Hi, thanks for your response. I'll test it as soon as I can
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-08-05 09:16:07
I noticed no one responded to your question about this.


um.... http://www.hydrogenaudio.org/forums/index....st&p=839573 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77883&view=findpost&p=839573)

admittedly mine uses a static background wallpaper so if yours generates nice colours on the fly then it is better.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-08-08 15:26:29
Here's very simple script for rotating image on playback time.

Code: [Select]
var image = gdi.Image(fb.FoobarPath + "images\\vinyl.jpg");
var angle = 0;

function on_paint(gr) {
   
    gr.DrawImage(image, 0, 0, 500, 500, 0, 0, image.width, image.height, angle);

}
function on_playback_time(time){
   
    if(angle >= 360) angle = 0;
    angle += 60;
    window.Repaint();   
   
}

I tested it with this Vinyl image (http://www.senpaigamer.com/sites/default/files/news/sony/2012/03/21-black-panther-yakuza-2-ashura-original-vinyl-record-3.jpg)

ExtremeHunter please can you help me?
I use WSH panel mod 1.4.2. I can't use new version, because it brakes my skin.
This skript work's good, but it is slow. How to set speed in WSH panel mod 1.4.2?

Seems to older version don't recognize ''window.ClearInterval'' , ''window.SetInterval'' and simmilar action's..
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-08-08 17:23:40
I slightly modified the old spinning disc script so that you can use it with 1.4.2 wsh panel mod. pastepin link (http://pastebin.com/nfnwQWK8)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-08-08 17:37:36
I slightly modified the old spinning disc script so that you can use it with 1.4.2 wsh panel mod. pastepin link (http://pastebin.com/nfnwQWK8)


Oh, Thank's Extreme Hunter, you're the best
Title: WSH Panel Mod script discussion/help
Post by: phool on 2013-08-08 18:57:44
Hi ExtremeHunter, last time I tried your spinning disk script (for the current version of wsh panel mod, the rotation wan't as smooth as I expected. Is it possible to simulate the effect on this website: http://fanart.tv/artist/477b8c0c-c5fc-4ad2...uuren-van-armin (http://fanart.tv/artist/477b8c0c-c5fc-4ad2-b5b2-191f0bf2a9df/buuren-van-armin) (scroll down to the CDART section)? I'd also like to be able to have the image be linked to actual CDart saved in same folder as the album with the naming scheme: [CD Art] %album artist% - %album%
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-08-08 20:56:13
My spinning disc script already does that, you need to set disc image location in foobar Preferences->Display->Disc

"the rotation wasn't as smooth" This component is not meant for such a heavy animation.
Title: WSH Panel Mod script discussion/help
Post by: drm200 on 2013-08-08 22:13:01
I have a novice question as I am a novice .. but I've not been able to understand what is causing a panel to react as it does  ..

I have some simple code that I downloaded that displays "now playing" info in a wsh panel.  The panel works fine.  But, when I right click on the mouse .. it shows a menu for properties and configuration and I can click on "configuration" and go into edit regardless of whether I have layout editing mode enabled or not.  All of my other panels do not react to a right mouse click this way.

I want to disable the "configuration" menu unless I have "layout editing" enabled.

The code in this panel has no "right mouse" button functions defined  ..
The code in this panel has no functions working with the popup context menu ...
There are no pre-processors loading other code. ...

Can someone explain why I get this context popup menu on right click with layout edit mode disabled (and not for other panels).... and how I may disable it so one can not go into configuration edit unless layout edit mode is enabled?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-08-08 23:06:40
add this function to your wsh panel script

function on_mouse_rbtn_up(x, y) {
    return true;
}
Title: WSH Panel Mod script discussion/help
Post by: drm200 on 2013-08-09 05:45:39
thanks.  adding that fixed the problem ... I'm not sure how I could have figured that out on my own ...
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-08-09 16:49:18
Hi ExtremeHunter, last time I tried your spinning disk script (for the current version of wsh panel mod, the rotation wan't as smooth as I expected. Is it possible to simulate the effect on this website: http://fanart.tv/artist/477b8c0c-c5fc-4ad2...uuren-van-armin (http://fanart.tv/artist/477b8c0c-c5fc-4ad2-b5b2-191f0bf2a9df/buuren-van-armin) (scroll down to the CDART section)?



I don't see problem in animation. You can simulate that smooth efect from website..
I got the same speed and smooth like in website..

Go to script and set ''angle += 1''
, and  ''var rotationInterval = 15;'' .

Set rotationInterval speed how you like..
Hope that helps..
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-08-10 10:53:27
I made a modified xch4nge menu, which allows you to easily add as much panel and WSH scripts in CUI, as you want: http://mire777.deviantart.com/art/xch4nge-...oobar-359868460 (http://mire777.deviantart.com/art/xch4nge-can-acts-as-the-DUI-foobar-359868460)
But I noticed that when you starting foobar, if you have a lot of WSH panel, it parsing all WSH script together at startup.. Even if you don't have all that panel active, it start all WSH, and thus slows down the rising time.
Is there a way to make something, which would specify to raise only selected WSH scripts in selected panel at startup, and others to be inactive?
Or to specify that in each script separately ?
I'm trying to find a way to disable-enable installed WSH script at startup...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-08-10 11:37:07
you can try the delay load checkbox in the editor. but having numerous scripts really shouldn't affect startup time much at all. i guess it depends on what your script does. i have 17 scripts in my layout and it adds 0.2 seconds to the startup time compared to without. that's nothing in the grand scheme of things.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-08-10 13:20:48
you can try the delay load checkbox in the editor. but having numerous scripts really shouldn't affect startup time much at all. i guess it depends on what your script does. i have 17 scripts in my layout and it adds 0.2 seconds to the startup time compared to without. that's nothing in the grand scheme of things.

Well i have 12 scripts, and startup time is 0.04 sec. It's nothing, but it would be good to add something, that would (disable-enable) script that I don't use that often.
Maybe some WSH client, with dropdown menu, then i can choose, what script i want to use in that panel..
But I don't know if it would help at all..
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-08-13 10:38:33
Marc, i edited your script to show 'album art' on my WSH 1.4.2. , and it works beautifuly. There's no better script anywhere. No image distortion at all, like in other script i try.
But i have small problem, when i click on button in xch4nge to enlarge panel, image  for a short shaking, then stop.
It happens especially when the image is large..
Do you know what causes this? And can you help me to  fix this?

Here is script: http://pastebin.com/pCTpyvDD (http://pastebin.com/pCTpyvDD)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-08-13 12:31:45
But i have small problem, when i click on button in xch4nge to enlarge panel, image  for a short shaking, then stop.


i have no idea what you mean by this. all i know is that my script behaves just like any other panel when resized normally in a standard default UI or columns UI layout. i'm certainly not downloading the theme to test it.

perhaps the issue is with the panel stack splitter code used to resize panels? have you tried other panels in its place?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-08-13 13:45:17
But i have small problem, when i click on button in xch4nge to enlarge panel, image  for a short shaking, then stop.


i have no idea what you mean by this. all i know is that my script behaves just like any other panel when resized normally in a standard default UI or columns UI layout. i'm certainly not downloading the theme to test it.

perhaps the issue is with the panel stack splitter code used to resize panels? have you tried other panels in its place?



I tested, it behaves normal in DUI, but in xch4nge it has some interaction with WSH panel stack splitter, because it has fast resizing..
Sorry I bothered you with that...
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-08-19 10:11:23
May I ask a question, How to show or hide a Columns UI panel using WSH script ?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-08-19 19:52:13
May I ask a question, How to show or hide a Columns UI panel using WSH script ?


quick reply on the way to do it but not a full example (not time and no example on the hand ... just how i've done it in my skin TECH for example ==> http://br3tt.deviant.art (http://br3tt.deviant.art))

So, the only way i've found (and use) is to use file as parameters, to share/update panel status between a WSH panel (the WSH panel create the file, update its status on action in the WSH panel) and a Panel Stack Splitter in Columns UI (use the $findfile command to read the file created from WSH panel to get the value of the status, 0 panel is to hide (cf. $showpanel ... commands , read Panel Stack Splitter help file for more information)

that's it.

for example, if i want to hide/show a panel like "album list", in the WSH panel, i create in a settings folder (i.e foobar2000/WSH_settings/) the file "albumlist_0"
and in the PSS panel, i get the last character of the filename that begins with "albumlist_" with $right($findfile(albumlist_*),1) and so i retrieve "0" or "1", depending of that value with a $select, i execute a $showpanel_c(...) set to visible or hidden of the album list panel...

tips, when updating the file from WSH, to force Panel Stack Splitter to refresh, you have to code in the WSH panel a Pause & Play foobar2000 command
there is the function i use to do it:
Code: [Select]
function RefreshBG() {
    if(fb.IsPlaying||fb.IsPaused) {
        fb.RunMainMenuCommand("Playback/Play or Pause");
        fb.RunMainMenuCommand("Playback/Play or Pause");
    } else {
        fb.RunMainMenuCommand("Playback/Play");
        fb.RunMainMenuCommand("Playback/Stop");
    }
}

HTH
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-08-20 06:14:32
@Falstaff : Thanks you so much!
Title: WSH Panel Mod script discussion/help
Post by: hkg196418 on 2013-08-29 23:21:32
I am sorry, May I ask is it possible to drag&drop new songs like below?

for example:

playlist before drag&drop
1. SONG ONE
2. SONG TWO

playlist after drag&drop (I want to drop "SONG THREE" between "SONG ONE" and "SONG TWO")
1. SONG ONE
2. SONG THREE
3. SONG TWO

but not
1. SONG ONE
2. SONG TWO
3. SONG THREE

I am now viewing the old replies on this post, but it's very long, hope anyone can help me.

thank you very much
Title: WSH Panel Mod script discussion/help
Post by: Noose6767 on 2013-09-06 08:50:17
Could someone tell me where to download the latest samples from please ?
(I think i'm interested in thumbs.txt and last fm bio etc)

The links I've found here seem to be down

Thanks a lot
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-06 08:56:13
here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

make sure to check the readme. also, i saw your other post about reading the contents of a text file. there is a script in here called simple text reader which can do that.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-09-11 23:55:40
ExtremeHunter

I've been playing around again with your Spinning Disc Image Viewer script, version 2013-08-08, which you pasted online here [pastebin.com] (http://pastebin.com/nfnwQWK8) .

I've been editing your script for the past few hours, trying to create a context menu having these three items:
------------------------------
Open folder of this disc
Open folder of this panel
Configure...

-------------------------------

The context menu works except for one problem . . . . . Selecting "Open folder of this disc" opens the "Now Playing" folder and the active track is selected in Windows Explorer.
Unfortunately, this is not what I want . . . . . What I want is to open the folder containing the current spinning disc image and the image is selected in Windows Explorer.
Here is the code I have added to your script:
Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
MF_GRAYED = 0x00000001;
MF_STRING = 0x00000000;

function on_mouse_rbtn_up(x, y) {
    metadb = fb.GetNowPlaying();
    var folder_path_disc = metadb ? metadb.Path : "";    
    var folder_path_panel = fb.ProfilePath + "user-addons\\wsh-spinning-disc-image";
    var _menu = window.CreatePopupMenu();
    var idx = 0;
    _menu.AppendMenuItem(fso.FileExists(folder_path_disc) && metadb ? MF_STRING : MF_GRAYED, 1,  "Open folder of this disc");
    _menu.AppendMenuSeparator();
    _menu.AppendMenuItem(fso.FolderExists(folder_path_panel) && metadb ? MF_STRING : MF_GRAYED, 2,  "Open folder of this panel");
    _menu.AppendMenuSeparator();    
    _menu.AppendMenuItem(MF_STRING, 100, "Configure...");
    idx = _menu.TrackPopupMenu(x, y);
    if (idx == 1) try {
        WshShell.Run("explorer /select," + "\"" + folder_path_disc + "\"");        
        }            
        catch(e) { }
    if (idx == 2) try {
        WshShell.Run("explorer /n," + folder_path_panel);        
        }            
        catch(e) { }        
    if (idx == 100) window.ShowConfigure();
    _menu.Dispose();
    return true;    
}


NOTES:
I use foobar2000 in portable mode.
All default resources used for this panel are contained in one folder: "<fb2k_dir>\user-addons\wsh-spinning-disc-image\"
All disc image targets for the script are placed at the same location as the tracks.

ONE MORE QUESTION:
If I was to add one more context menu item named Help, and if this is selected a Message Box pops up with some text,
does anybody have the code for doing this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-12 00:19:41
Code: [Select]
fb.ShowPopupMessage("Some help text.", "Window title");


you can put in \n if you want line breaks. i'll let Extremehunter answer the rest.

edited: i forgot you can customise the window title as well but it's optional. if you omit it, it will just display WSH Panel Mod.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-09-12 11:36:56
derty2

pastebin link (http://pastebin.com/gzexrerN)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-12 12:47:39
i think derty2 was asking for it to work in portable mode. this line of code only works on a standard install.

Code: [Select]
var folder_path_panel = WshShell.ExpandEnvironmentStrings("%APPDATA%") + "\\foobar2000\\user-addons\\wsh-spinning-disc-image";


you should use fb.ProfilePath as that caters for both scenarios. it points to %appdata%\foobar2000 when running a standard foobar install. if running a portable install, it points directly at the foobar2000 program folder.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-09-12 13:17:57
I know fb.ProfilePath .

I misunderstood  "<fb2k_dir>\user-addons\wsh-spinning-disc-image\"

I tried to access default installation %appdata% <fb2k_user_profile_dir> from portable version
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-12 13:23:25
Quote
<fb2k_dir>


i'd assume that to mean the program folder, not %appdata%\foobar2000.

your code would only work if his portable install was inside his %appdata% folder. why hardcode something when you have the flexibility to let people use whatever mode they like and if using portable mode, they can put their foobar folder anywhere and it will just work.

edit: i see you've edited your post. hopefully it's cleared up now.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-12 13:30:21
Sorry for the stupid questions, but i need help.
Which function to call to cycle image. I want to cycle the front, back and icon image, and set time delay for that.
Here is script: http://pastebin.com/jvQ9z6Jc (http://pastebin.com/jvQ9z6Jc)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-12 13:41:10
this might work (untested)

Code: [Select]
window.SetInterval(function() {
    a.id++;
    if (a.id > 4) a.id = 0;
    a.metadb_changed();
}, 5000);


the 5000 is milliseconds. you can edit that bit.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-12 13:47:11
this might work (untested)

Code: [Select]
window.SetInterval(function() {
    a.id++;
    if (a.id > 4) a.id = 0;
    a.metadb_changed();
}, 5000);


the 5000 is milliseconds. you can edit that bit.


I got error: object doesn't suport that property or metod. i guess that is because i use wsh 1.4.2.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-12 14:02:22
Code: [Select]
var timer = window.CreateTimerInterval(5000);

function on_timer() {
    a.id++;
    if (a.id > 4) a.id = 0;
    a.metadb_changed();
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-12 14:15:23
Code: [Select]
var timer = window.CreateTimerInterval(5000);

function on_timer() {
    a.id++;
    if (a.id > 4) a.id = 0;
    a.metadb_changed();
}


Oh, works great now.. thank you so much Marc !
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-09-12 18:07:29
ExtremeHunter

Thankyou for the new script of your Spinning Disc Image Viewer, version 2013-09-12, pasted online here [pastebin.com] (http://pastebin.com/gzexrerN)

I still have a problem with your edition of the context-menu item Open folder of this disc; it doesn't work exactly as I want.

I performed this action in foobar2000 (with your new script):
Quote
Start playing a track whose containing folder is known to contain a target disc image . . . Panel displays the target disc.
Right click the Panel and choose "Open folder of this disc" . . . Explorer opens with target disc selected.
While playback continues, change playlists.
Start playing a track whose containing folder is known to not contain a target disc image . . . Panel displays the default disc.
Right click the Panel and choose "Open folder of this disc" . . . Explorer opens with previous target disc selected !!!!!!!!!!
Stopped playback and restarted foobar2000 (to refresh all).
Start playing the track whose containing folder is known to not contain a target disc image . . . and the Panel displays the default disc.
Right click the Panel and choose "Open folder of this disc" . . .  and the context-menu item "Open folder of this disc" is grayed out.

It seems there is some kind of refresh bug.

What I specifically want from the the context-menu item Open folder of this disc is this:
. . . never be grayed out; this context-menu item is always selectable.
. . . if default disc is showing, then Explorer opens with default disc selected.
. . . if target disc is showing, then Explorer opens with target disc selected.

Your code needs to be modified with some kind of IF...ELSE statement for the context-menu item. Can you please have another look. Thanks ++++

_______________________________________________________________

I also enhanced your script with more functionality.
I added this code (read the comments):
Code: [Select]
// --- mouse left-click effects.
// --- simulate putting your finger on the turntable platter stopping it from spinning,
// --- and playback pauses until mouse is released.

function on_mouse_lbtn_down(x, y) {
    if (!fb.IsPaused) fb.Pause();
    else return;
}
function on_mouse_lbtn_up(x, y) {
    if (fb.IsPaused) fb.Play();
    else return;
}
function on_mouse_lbtn_dblclk() {
}


_______________________________________________________________

marc2003 - thanks a lot for the code to make the popup message box +++++++
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-09-12 19:59:39
Sorry I forgot to add default image path before.

It should work now.

pastebin (http://pastebin.com/gzexrerN#)




Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2013-09-13 00:02:09
ExtremeHunter, thankyou for the new edit to the script. It has fixed the "Default Disc vs. Target Disc" issue ++++

Unfortunately for me, I noticed another problem with your current script . . .

In my foobar2000 at "Preferences > Display > Album art - Disc (tab)" I have this search pattern:    disc*[%discnumber%].*
It is only one line; I have no other search patterns for 'Disc'.

My tagging scheme for Vinyl Rips is to use the %discnumber% tag as a reference to the sides ...and to choose a disc image to load.

EXAMPLE 1:
Quote
A 1-LP album having 4 tracks:    2 are on Side-A  |  2 are on Side-B
- The folder containing the tracks will have two disc images: disc-a.jpg,   disc-b.jpg
- In the %discnumber% Tag of the tracks:
  Track No: 1     has value: A
  Track No: 2     has value: A
  Track No: 3     has value: B
  Track No: 4     has value: B

EXAMPLE 2:
Quote
A 2-LP album having 8 tracks:    2 are on Disc-1/Side-A  |  2 are on Disc-1/Side-B  |  2 are on Disc-2/Side-A  |  2 are on Disc-2/Side-B
- The folder containing the tracks will have four disc images: disc-1a.jpg,   disc-1b.jpg,   disc-2a.jpg,   disc-2b.jpg
- In the %discnumber% Tag of the tracks:
  Track No: 1     has value: 1A
  Track No: 2     has value: 1A
  Track No: 3     has value: 1B
  Track No: 4     has value: 1B
  Track No: 5     has value: 2A
  Track No: 6     has value: 2A
  Track No: 7     has value: 2B
  Track No: 8     has value: 2B

The current script does not take into account my artwork loading preference for disc image, which is conditional on the discnumber tag.
I'm not sure where in your script I can make the appropriate edit.

FYI, I had the same problem with the WSH Vinyl Turntable script by marc2003, and marc helped me to fix it. See this post here... (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=830405)

Thanks +++++

__________________________________________________

One more feature request (if you are going to dig into the code again). . .

I want to add another right-click context menu item named Resize disc to fit the panel
I have no idea what the code is for this. Do you have some code for this please.

Thanks again ++++++

__________________________________________________

* EDIT *

ExtremeHunter, you can ignore the first part of my post (regarding loading multiple disc images for an album) . . . . I fixed it!
I had another read of my discussion with marc2003 and dived into your code myself. The fix was pretty much identical, change one line like this:
Quote
old:    var currentAlbum = fb.TitleFormat("%album%").EvalWithMetadb(metadb);
new:   var currentAlbum = fb.TitleFormat("%album%%discnumber%").EvalWithMetadb(metadb);
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-09-13 11:04:13
Added Fit image to context menu.
pastebin (http://pastebin.com/gzexrerN)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-13 13:44:30
Marc, i set Auto Cycle Image, i only have one question. How to tell script to skip image if no exist in attached pictures? I want that cycling always be on, and if more image exist then to cycle, if not then to show only front image?
http://pastebin.com/MpAUVKcg (http://pastebin.com/MpAUVKcg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-13 14:42:06
line 350 is this:
Code: [Select]
this.img = utils.GetAlbumArtV2(p.metadb, this.id);


insert this after it.
Code: [Select]
if (!this.img) {
    this.id++;
    if (this.id > 4) this.id = 0;
    this.metadb_changed();
    return;
}


i see a lot of your global callbacks at the start contain these 2 lines.

Code: [Select]
a.metadb_changed();
p.item_focus_change();


you can remove the first line because it gets called as a result of the p.item_focus_change function.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-13 14:56:30
line 350 is this:
Code: [Select]
this.img = utils.GetAlbumArtV2(p.metadb, this.id);


insert this after it.
Code: [Select]
if (!this.img) {
    this.id++;
    if (this.id > 4) this.id = 0;
    this.metadb_changed();
    return;
}


i see a lot of your global callbacks at the start contain these 2 lines.

Code: [Select]
a.metadb_changed();
p.item_focus_change();


you can remove the first line because it gets called as a result of the p.item_focus_change function.



ok, i enter this line , but it still cycle image
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-13 15:03:57
it cycles images that are present but skips any type that is missing. that's what you asked for? previously it would sit waiting with a blank screen if there wasn't an image for the current type.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2013-09-13 15:06:20
mire777

I also improved your timers, they were mess.

pastebin (http://pastebin.com/dsTqY6G1)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-13 15:14:23
it cycles images that are present but skips any type that is missing. that's what you asked for? previously it would sit waiting with a blank screen if there wasn't an image for the current type.

oh yes after i clear properties, it work's. Thanks Marc
thank's ExtremeHunter i will try how it work
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-13 23:17:32
ExtremeHunter thanks again. I tried your script edit, works much beter than mine. But i was have error ''out of memory'', and foobar crashes if i didn't set ''no artist image'' in preferences..

Also i can't change front,back,icon... manualy from menu.
*EDIT: ok, it can do that because auto cycle is on.

I try to fix this...
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-15 00:19:45
I edited script, and fix problem.
Thanks Marc and ExtremeHunter for help..
http://pastebin.com/qe9ysR2s (http://pastebin.com/qe9ysR2s)
Title: WSH Panel Mod script discussion/help
Post by: drm200 on 2013-09-18 11:34:52
I have a problem with display of special characters.  The same code results in a different outputs in two different panels.

In the first WSH panel is the following line of code:

      gr.DrawString("★", gdi.Font("segoe ui symbol", 17, 1), RGB(250,0,0), 10, 10, ww, wh);

The result is to display the "★" properly.

I now cut and paste the same code into a different WSH panel within the same application.  In this panel, the displayed output is completely different:
The result is something like this (as shown between the quotemarks):  "â~..." 

What would cause the code to display the star differently in the second panel?





Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-09-19 03:06:59
marc2003, can't state strongly enough how much I enjoy your scripts.  I use your Musicbrainz script quite a bit to understand the releases of artists as I play music, and appreciate the ability to use the primary and secondary filters you've included.  It would be great if you could consider adding filters for MB secondary types of "compilation" and "remix" (in addition to the existing filter for the secondary type of "live").  If it's a pain, don't bother, but if straightforward it would be much appreciated.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-19 10:02:59
done. just right click>Update script.

full download here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-09-19 10:53:10
Thanks - works great!
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-23 16:43:00
I need help..
I played a little with Br3tt Library Search, and add some genre preset, and change the look: http://pastebin.com/twt4qigJ (http://pastebin.com/twt4qigJ)
I love how it works...
The only thing I don't know is how to tell script to search, not only Library but single playlist?
Does anyone know how to do that?
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-09-26 17:12:38
Hey guys, I'm working on a rather large WSH script which has as an optional feature the lyrics panel that Falstaff wrote 3 years ago. He (and now I) is using the FSO object to open the text files on your computer and then parsing and displaying them. This works great, except for the little problem with Unicode characters. They show up as gibberish on the screen.

Someone asked him about the Unicode issue, and he said it wasn't possible to read them correctly from files (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&view=findpost&p=731871). I'm not entirely convinced this is true, because the FSO.OpenTextFile function has an optional 4th parameter, where if you pass -1 you can open the file as Unicode (http://www.w3schools.com/asp/met_opentextfile.asp). However, when I do this, it's not just the unicode characters that are gibberish, it's even the ASCII characters. Last file I tried it on had Unicode apostrophe's and when I open it as Unicode, the entire thing shows as Chinese characters for some reason. Has anybody seen this before and figured out how to work around it?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-26 18:09:26
i use utils.ReadTextFile(filename).
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-09-26 20:48:58
i use utils.ReadTextFile(filename).

Well that simplifies things quite a bit and I can rip out all the old FSO stuff that Falstaff was originally using (in rereading this thread it seems that at some point he did the same although he never published that code), however I still have the same problem. My .lrc files which have unicode in them are still showing the unicode characters as gibberish:

See for yourself with the following sample .lrc file (https://dl.dropboxusercontent.com/u/23987869/Halford%20-%20Temptation.lrc).

My code essentially looks like this:
    fb.trace(utils.ReadTextFile(pathName));
   
and the first line of lyrics is shown in the console as: [00:19.29]I know what’s going on inside your crooked mind

Obviously I can keep doing what I'm doing, and replace special characters that I know about, but this won't work for lyrics with foreign characters in them which seems extremely bad.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-26 21:21:53
that function takes an optional argument of a codepage...

Quote
utils.ReadTextFile(filename, codepage)


there is a codepages.txt file listing them all in the docs folder of the component but i tried the one for your file and it doesn't work

Code: [Select]
utils.ReadTextFile(filename, 28605);


it changes slightly but it's still not right.

edit: codebox removed, the forum or browser is mangling what WSH panel mod is displaying. it looks like this...

(https://dl.dropboxusercontent.com/u/22801321/2013/september/wrong.png)

can you change how the lrc files are saved in the first place? other than that, i have no idea. i'll be honest and say i don't really understand all this codepage stuff because i've never needed it.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-09-26 21:59:23
can you change how the lrc files are saved in the first place? other than that, i have no idea. i'll be honest and say i don't really understand all this codepage stuff because i've never needed it.

Thanks for looking into it.

As far as I know, nothing is happening to the lrc files when they're saved. I just use the lyrics_show_panel3 to download them because I don't have the capability to search and don't want to reinvent the wheel when someone is doing it much better than I could. What I don't get is why the lyrics can load perfectly in every other editor, but not from WSHPanelMod.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-09-26 22:23:17
After further playing around with it, and doing a little light reading, it turns out that the encoding listed is actually wrong. There's also no way to read the codepage from the file. You either have to know it, or you have to guess it using heuristics, which is seemingly what almost everybody does.

Loading that file as UTF-8 (codepage 65001) correctly fixes everything. Of course, that's only useful for 8-bit characters. If I were to get a UTF-16 file (i.e. Japanese lyrics) it would completely barf on them. Not sure what I can do about that. I'll see if things are generally okay with Roman alphabets if I use 65001 for everything.

Edit:
Actually, I'm wrong and stupid. UTF-8 can handle multibyte characters (i.e. Japanese)... that's why they are multibyte in the first place. UTF-16 would be 16-bit wide characters and isn't very common. Since UTF-8 is the web standard, and typically these lyrics are being downloaded from the web I think it's safe to assume that's what they are. I'll test it and make sure, but I think I'm okay now.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-27 11:06:44
Actually, I'm wrong and stupid. UTF-8 can handle multibyte characters (i.e. Japanese)... that's why they are multibyte in the first place. UTF-16 would be 16-bit wide characters and isn't very common. Since UTF-8 is the web standard, and typically these lyrics are being downloaded from the web I think it's safe to assume that's what they are. I'll test it and make sure, but I think I'm okay now.


I interested for lyrics script you work, i also edited falstaff lyrics, and add posibility to force save option in lyrics show 3, so you can see lyrics at first play, exactly in same time when it's find from net.. http://mire777.deviantart.com/art/Lyrics-R...h4nge-393946997 (http://mire777.deviantart.com/art/Lyrics-Reader-For-Xch4nge-393946997)
Please upload your script when you finish. Thanks..


I found a way to disable WSH script to load on startup and parsing file if their panel is hidden.
This is useful if you have a lot of scripts that are not in use.

(http://imageshack.us/a/img407/163/8lm.png)

You can see that 'Tabed Playlist', 'Album Art' and 'Spinning disc' are initialized in 0 sec.

This can be done simply adding backslash before @import.


//==PREPROCESSOR==
//@name"Tabed Playlist"
///@import"%fb2k_profile_path%scripts\WSH scripts\Tabed Playlist.txt"
//==/PREPROCESSOR==


I think now if posible to make some menu, that can manipulate with this caracter at the beginning, and disable-enable script in panel.
If that menu initialize on startup in 5sec or less it can be useful, because it will consuming less memory than script do on startup..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-27 14:35:33
This can be done simply adding backslash before @import.


really? doing that breaks my scripts because the file isn't loaded at all.

as for delaying load, what is the point? we're talking fractions of a second on startup. i have 17 scripts taking around 0.4s. honestly, what is this going to affect.... nothing. 

edited: my scripts add around 0.4s to foobar's startup time, not 0.3s as i said originally.
Title: WSH Panel Mod script discussion/help
Post by: fbuser on 2013-09-27 15:30:36
I think now if posible to make some menu, that can manipulate with this caracter at the beginning, and disable-enable script in panel.
This is pointless as marc2003 already mentioned. Besides this, this is not possible anyway.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-27 15:33:57
This can be done simply adding backslash before @import.


really? doing that breaks my scripts because the file isn't loaded at all.

as for delaying load, what is the point? we're talking fractions of a second on startup. i have 17 scripts taking around 0.4s. honestly, what is this going to affect.... nothing. 

edited: my scripts add around 0.4s to foobar's startup time, not 0.3s as i said originally.


Yes it stops, and you can enable script later if you want to use it again.
It is useful, because you can't have all script active in same time,it waste your space, it's not possible..(but they are running in the background, even if you don't use them).
If you have option to disable some of them, you can save your memory on startup. I was now disable 3 of them i don't use, and my startup is faster for 2sec now.
Only problem is i must do this manually...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-27 16:17:12
Quote
you can save your memory on startup
.

what kind of numbers are we talking about here? i presume you've been looking at task manager.... 

what are you doing with this memory that you have "saved"?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-27 16:43:18
Quote
you can save your memory on startup
.

what kind of numbers are we talking about here? i presume you've been looking at task manager.... 

what are you doing with this memory that you have "saved"?


Ok, i don't look in task manager at all.I looked in console. I now that 2sec is nothing..
But if i dont use some script now, i want to have it fast acessible in menu for later use, then i want to disable them.
Because, i have possibility to add more than 50 sripts in my config in drop-down menu, do you think that this will not affect performance, if i fill all 50?
I need that saved memory for later use.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-09-27 16:48:03
I interested for lyrics script you work, i also edited falstaff lyrics, and add posibility to force save option in lyrics show 3, so you can see lyrics at first play, exactly in same time when it's find from net.. http://mire777.deviantart.com/art/Lyrics-R...h4nge-393946997 (http://mire777.deviantart.com/art/Lyrics-Reader-For-Xch4nge-393946997)
Please upload your script when you finish. Thanks..

If you haven't, you should try the latest beta of foo_uie_lyrics3 (http://code.google.com/p/foo-uie-lyrics3/downloads/list). It now supports batch downloading and has always (AFAIK) supported auto saving, so I'm not sure exactly what you did.

It'll be part of a much larger script (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77413&view=findpost&p=841225) that I'll be uploading very shortly. The lyrics are just a small component, but if somebody really needs them standalone, I can probably rip them out into their own script. Falstaff may already be doing this in some of his themes, but I have no idea... I just know he hasn't posted it in here in 3 years.

Once I get the last couple kinks worked out, I need to find a good screencasting program so that I can create a youtube video to show all the features my script has. It's hard to explain everything succinctly with just pictures. If anybody has some recommendations, I'd love to hear them.

what kind of numbers are we talking about here? i presume you've been looking at task manager.... 

what are you doing with this memory that you have "saved"?
I used to put my saved memory under a mattress, but then my house burned down and I lost it all. Now I have it stored in an offshore account where it's earning 6% interest every year.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-27 16:51:54
Quote
I now that 2sec is nothing..


what script(s) are you using that takes 2 seconds? that does seem like a long time for just a few.

as i mentioned, i have 17 taking less than 400ms. that's just over 20ms or 0.02seconds each. i know one of my scripts depends on how many images there are in a folder. i just tested it on a folder with the most artist images in it and it took 0.7 seconds which is a bit more noticeable.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-27 17:21:21
If you haven't, you should try the latest beta of foo_uie_lyrics3 (http://code.google.com/p/foo-uie-lyrics3/downloads/list). It now supports batch downloading and has always (AFAIK) supported auto saving, so I'm not sure exactly what you did.


I found this beta yesterday.. in last version lyrics3, you had to press 'save' , that lyrics be seen in WSH lyrics rader. I just added the 'force save' option in WSH, and set that script continuously check whether there are lyrics in the folder or not. Great if they fix this problem..


It'll be part of a much larger script (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77413&view=findpost&p=841225) that I'll be uploading very shortly. The lyrics are just a small component, but if somebody really needs them standalone, I can probably rip them out into their own script.


Wow, this looks great  I can't wait to see what config all includes.
.. and If you resolve problem with display unicode characters in lyrics, i'd like to have this version..
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-09-27 17:38:47
Quote
I now that 2sec is nothing..


what script(s) are you using that takes 2 seconds? that does seem like a long time for just a few.

as i mentioned, i have 17 taking less than 400ms. that's just over 20ms or 0.02seconds each. i know one of my scripts depends on how many images there are in a folder. i just tested it on a folder with the most artist images in it and it took 0.7 seconds which is a bit more noticeable.


My startup time was 0:04, and now is 0:02.7.
Only for test this, i disabled 'tabed playlist' from br3tt, 'album art' that i was made with your help and 'Spinning Disc'.
I don't now how this posibble
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-09-30 15:35:09
a couple of minor updates for my samples:

Code: [Select]
7.2013-09-30.03

"Now playing" & "Thumbs" now show newest images first based
on their last modified times.

7.2013-09-30.02

"Discogs" & "Musicbrainz" scripts now check for updates if
data is over a day old. Before this change, it waited a week.


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-03 17:16:56
Code: [Select]
"Discogs" & "Musicbrainz" scripts now check for updates if
data is over a day old. Before this change, it waited a week.

Hey marc2003, I looked and as I guessed, you were using fso to cache those text files on the local drive. From the documentation I've read on FSO, it seems like you can only create Text files, and what I'd really love to do would be to cache images to handle slow network connections. Is there anyway to do this with FSO, or some other object?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-03 17:28:38
i don't really understand. where are the images from and how are you downloading them?
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-03 18:04:28
i don't really understand. where are the images from and how are you downloading them?

Actually, a little further reading might have solved the issue. The images are album artwork/disk images and are on a network share. Most of them are in the 500K-1MB range, and since my script has a playlist manager (thanks ExtremeHunter!), a lot of images are being loaded initially as well. I access this network share from the same machine (obviously fast), wi-fi (still pretty fast), and remotely using SSH (really f'n slow), all using mapped drives so the paths are consistent.

However, I think all I need to do is this:
Code: [Select]
f = fso.GetFile("N:\\Audio\\Artist - Album\\folder.jpg");
f.Copy(fb.ProfilePath + "cache\\Artist - Album.jpg");


And then when retrieving in the future, just check the file sizes against each other and if they differ, get a new one from the network location.
Title: WSH Panel Mod script discussion/help
Post by: ninjasilver on 2013-10-03 22:33:36
Thanks so much for all your effort with this mod, but I'm getting an error whenever I try to add a script and I can't find a solution! I installed the mod, Safe Mode is unchecked, marc2003 is in my %appdata%\foobar2000 folder, I'm running as an admin, but when I add any of the scripts to the panel I get:

Code: [Select]
WSH Panel Mod (Art Reader by marc2003): Parsing file "C:\Users\Sean\AppData\Roaming\foobar2000\marc2003\common7.js"
Error: WSH Panel Mod (Art Reader by marc2003): Unknown error code: 0x800700b6File: C:\Users\Sean\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 1304, Col: 2

Line 1304 is
   this.doc = new ActiveXObject("htmlfile");
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-03 23:02:21
that error code would suggest something is wrong with your windows install. some missing/corrupt files perhaps? i'm just guessing but i'm pretty sure nothing in my scripts can cause that.

you can try commenting that line out because it's not even required by that script.

just add to slashes like this...

Code: [Select]
//this.doc = new ActiveXObject("htmlfile");
Title: WSH Panel Mod script discussion/help
Post by: ninjasilver on 2013-10-03 23:59:34
@marc2003 That worked, thanks a lot!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-04 01:52:25
i should mention commenting that line out will break the news/reviews/blogs and last.fm album info panels but it won't affect any of the others.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-04 15:41:04
Marc, i use your wsh biography to catch biography text.
My script is litle modified. I don't know is it already exist in original script...
I would like to have button in menu to download all biography text, for selected track in playlist? And for images also?
Is it possible?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-04 15:47:09
i really don't see the point of this. it's not like the info can be viewed or be of use with anything else. it takes barely a second to download the bio text if there isn't a cached version. you can even right click>selection mode>follow selected track. now you can select items in the playlist manually and bio text will be downloaded regardless of what is playing.

to answer the question, it is possible but i really can't be bothered to help with it.

and if you do try and make something yourself, make sure you register at the echonest and get your own API key. i will be seriously pissed off if you make multiple requests and get the key blocked for me and everyone else who uses my scripts. search for the line of code in the common file that begins....

Code: [Select]
url = "http://developer.echonest.com/api/v4/artist/biographies?api_key=


and put in your own.

http://developer.echonest.com/docs/v4 (http://developer.echonest.com/docs/v4)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-04 15:59:45
i really don't see the point of this. it's not like the info can be viewed or be of use with anything else. it takes barely a second to download the bio text if there isn't a cached version. you can even right click>selection mode>follow selected track. now you can select items in the playlist manually and bio text will be downloaded regardless of what is playing.

to answer the question, it is possible but i really can't be bothered to help with it.


Ok, thank you Marc. Your script runs faster than standard foo_uie_bigoraphy. And without this is perfect for me.
Thanks...


and if you do try and make something yourself, make sure you register at the echonest and get your own API key. i will be seriously pissed off if you make multiple requests and get the key blocked for me and everyone else who uses my scripts. search for the line of code in the common file that begins....

Code: [Select]
url = "http://developer.echonest.com/api/v4/artist/biographies?api_key=


and put in your own.

http://developer.echonest.com/docs/v4 (http://developer.echonest.com/docs/v4)


Ok, i have my API key, i don't even use this in script. I think everyone should purchase own API.
All people use this, so it's little insecure for me. Earlier i was used Romor's API , and he stopped working.
Because of that, i will continue to use my API..
I don't know  how much is limit on echonest site. So this my request for adding download option is not good.
Thanks again..

*And maybe you should not put yours API in script at all,but let people to enter own from menu?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-04 18:07:40
I think everyone should purchase own API.


purchase is the wrong word as it's absolutely free. but perhaps english isn't your first language?

obviously i'm happy for people to use my scripts with the API key i supply because it's unlikely to ever get blocked if you use my scripts as intended. before you build up a cache, you're not likely to be making more than one request every 3-4 minutes (based on standard song length). and if you listen to full albums, it could be an up to an hour between looking up different artists.

i just ask that anybody who modifies the default behaviour use their own API key.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-07 16:02:53
I think everyone should purchase own API.


purchase is the wrong word as it's absolutely free. but perhaps english isn't your first language?

obviously i'm happy for people to use my scripts with the API key i supply because it's unlikely to ever get blocked if you use my scripts as intended. before you build up a cache, you're not likely to be making more than one request every 3-4 minutes (based on standard song length). and if you listen to full albums, it could be an up to an hour between looking up different artists.

i just ask that anybody who modifies the default behaviour use their own API key.



Sorry for my bad English, you'r right it's not my first language.
Today I went on echonest site. It appears that they reduced limit to 20 calls per minute. In order to increase the limit you have to go on your account, and tell something about yourself and your program you develop and click upgrade, then you will have 120 calls again. If you did not do that, just to inform...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-07 19:27:08
thanks but i've already upgraded my account.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-08 19:01:17
updated my musicbrainz script....

Code: [Select]
7.2013-10-08.01

"Musicbrainz". Now handles multi-value artist MBID tags if
present - it looks up the first one. Also works around the
fact picard doesn't not write proper multi-value tags to mp3.


if your files do not have MBID tags but your artist tags have multiple values, you should use the Artist field remapping option found on the right click menu and use something like

Code: [Select]
$meta(artist,0)


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2013-10-08 21:03:57
Can I use this or something similar :fb.Titleformat("$puts(example,teststring)"); to pass it to DUI?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-08 21:30:56
no.
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2013-10-08 21:37:49
no.


Too bad, It would have solved my multi value sorting problems in DUI.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-11 07:51:27
a few more updates:

Code: [Select]
7.2013-10-11.02

"Musicbrainz". Added some new favicon images for
"Links" mode. This requires that you download the full
zip and extract the "marc2003" folder again.

https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip

The "Small Web Links" script also needs these new images.

7.2013-10-11.01

"Now playing" & "Thumbs". Bugfix. Images did not always update
properly after deleting a file using the right click
menu option on Windows XP.


full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
full changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed/added:
Code: [Select]
marc2003\common7.js
marc2003\images\allmusic_small.png
marc2003\images\decoda_small.png
marc2003\images\facebook_small.png
marc2003\images\google_plus_small.png
marc2003\images\instagram_small.png
marc2003\images\myspace_small.png
marc2003\images\rateyourmusic_small.png
marc2003\images\secondhandsongs_small.png
marc2003\images\soundcloud_small.png
marc2003\images\tumblr_small.png
marc2003\images\wikidata_small.png


i also need to correct myself about a comment i made about musicbrainz picard the other day. i said it doesn't write "proper" multi value tags. i was wrong and it is behaving as expected. according to the id3v2 spec, only single values should be written to TXXX frames.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-12 07:12:56
i also need to correct myself about a comment i made about musicbrainz picard the other day. i said it doesn't write "proper" multi value tags. i was wrong and it is behaving as expected. according to the id3v2 spec, only single values should be written to TXXX frames.

It's confusing because foobar will happily write and read multiple values in TXXX frames, but many other taggers can't especially if they're using a compliant lib like id3lib. It's pretty frustrating because if you want to add your own non-standard tag, it's going to be a TXXX frame, and then you have issues.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-12 11:57:19
Extremehunter, i use your Spinning Disc Image Viewer, for WSH panel mod 1.4.2. http://pastebin.com/nfnwQWK8 (http://pastebin.com/nfnwQWK8)
It works well, but when scrolling playlists, it is struggling to spin. I use EL playlist.
Why is this happening?

Also when i add folder in Media Library.  System becomes unresponsible for a while, i can not start any other program, until foobar complete is adding.

Is there something wrong with my config?
Title: WSH Panel Mod script discussion/help
Post by: bobboof on 2013-10-13 01:27:47
Hey Guys, long time lurker, first time poster.

First, thank you everyone for all the amazing scripts you post in this thread, it's chalk full of very cool additions.

At the moment I add a lot of different tag fields to my music: including record label and catalog number. I have my Foobar setup to show artist information that is pulled from Last.FM. I am wondering if it's possible to do the same for the record label? I'd love to see a picture, biography, and relevant URLs for the record label in a panel on my config. I'd even consider adding this to a tag field, but i'm unsure how to do it best.

Maybe pull from a folder where there is a set of images with the record label name? Also, there could be a text file with the record label name. That way, when a file is selected with Label X, this script would show Label X.jpg/png/gif and Label X.txt. Ideally I could control how the text is formatted with maybe html or something similar?

Any ideas?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-13 03:07:59
my simple text reader script can display the contents of a text file based on title formatting.

Code: [Select]
d:\labels\%label%.txt


obviously, it's only plain text. you can't style it apart from changing the font/colours in your main display preferences.

my thumbs script can display images from any custom folders you like. you have to specify the folder name though - and it would display all images inside that folder.

Code: [Select]
d:\labels\%label%


by default it downloads images from last.fm so you'd have to right click the panel image source>custom folder.

as with all my scripts, all these options are found on the right click menus.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-13 17:02:28
Last.fm has crappy logos. There might be good information about them, at least for the major labels, but the logos will typically look awful. Fortunately for you, I'm about to release my theme which uses record labels, about half of which I created myself and the rest were uploaded by other users of fanart.tv.

Download recordlabels.rar (http://goo.gl/3yeFT6).

The images come in two sizes: 400x270 which is the majority, and 161x109 (which is 2.48x smaller than the larger ones). The smaller size ones generally suck, but they are hard to find good art to replace. My theme strips out " Music", " Records" and " Recordings" so that I don't have to keep two images when musicbrainz or other places decide to list a label as "Electra Records" in one place and "Electra" in another.

Here's the code I'm using to retrieve them from a specific folder where you've unrar'd them, but I'll leave it up to you how you want to display them:

Code: [Select]
pref["label_base"]  	= fb.ProfilePath+"images/recordlabel/";

function LoadLabelImage(publisherString) {
recordLabel = null;
d = new Date();
labelStr = fb.TitleFormat(publisherString).Eval().replace(']','').replace('[','').replace(':',"");
if (labelStr) {
/* First check for record label folder */
lastSrchYear = d.getFullYear();
fb.trace(lastSrchYear);
dir = pref["label_base"]; // also used below
if (utils.FileTest(dir+labelStr, "d") ||
utils.FileTest(dir + (labelStr = labelStr.replace(/ Records$/,"").replace(/ Recordings$/,"").replace(/ Music$/,"")),"d")) {
year = parseInt(fb.TitleFormat("%date%").Eval());
for (; year <= lastSrchYear; year++) {
yearFolder = dir + labelStr + "\\" + year;
if (utils.FileTest(yearFolder, "d")) {
fb.trace("Found folder for "+labelStr+" for year "+year+".");
dir += labelStr+"\\"+ year + "\\";
break;
}
}
if (year > lastSrchYear) {
dir += labelStr+"\\"; /* we didn't find a year folder so use the "default" logo in the root */
}
}
/* actually load the label from either the directory we found above, or the base record label folder */
labelStr = fb.TitleFormat(publisherString).Eval().replace(']','').replace('[','').replace(':',"");  // start over with the original string to be safe
label = dir+labelStr+".png";
if (utils.FileTest(label, "e"))
recordLabel = gdi.Image(label);
else {
labelStr = labelStr.replace(/ Records$/,"").replace(/ Recordings$/,"").replace(/ Music$/,"");
label = dir+labelStr+".png";
if (utils.FileTest(label, "e")) {
recordLabel = gdi.Image(label);
} else {
label = dir+labelStr+" Records.png";
if (utils.FileTest(label, "e"))
recordLabel = gdi.Image(label);
}
}
}
return recordLabel;
}

This assumes you unrar the file to "%appdata%/foobar2000/images/". publisherString would be a title formatted string something like: $meta(label,0), although in my theme I build up an array of strings to try, and then iterate through them looking for labels which allows me to display more than one label if needed. One of the cool features is that for labels that have changed their logo over time (like Epic) I have a sub folder with different years for when the logo changed. So an album with %date% of 1975 would pull from "Epic/1976/epic.png" to display the old sunburst logo while anything after 2010 would use the current Epic logo.
Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2013-10-18 08:39:58
Thanks marc2003 for all your works, and above all, your sharings !

My foobar config must have at least 7 scripts from you, and all awesome.


But, I have a little problem with thumbs script, yesterday it downloaded artist pics perfectly and today it's not working, it says, no fetching art... My tags are good and I tried on several artists, I don't know why I'm getting this...

Is this a well known bug with Last FM ? When I "Online Update", my console says : Thumbs: HTTP error: 0

I tried your thumbs script and thumbs2, not working. Weird no ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-18 11:01:16
the rotten gits at last.fm have deprecated the service. it's no surprise as they did remove the documentation some time ago. now they've finally turned it off.

Code: [Select]
<lfm status="failed"><error code="27">
    The artist.getImages method has been deprecated.
</error></lfm>


i'll have to try and find another source.

as for your update error, that was introduced when my host (dropbox) messed around with their domain name and re-directions. you need to extract the marc2003 folder from the full zip here- https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip) - make sure the scripts in panels get updated as well. all future updates should work.


Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2013-10-18 11:25:47
Thanks for the explanations marc2003
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-18 11:39:55
samples updated 

Code: [Select]
7.2013-10-18.01

"Now playing" & "Thumbs". Last.fm have removed their artist
images service so I've disabled the menu options.

http://www.last.fm/group/Last.fm+Web+Services/forum/21604/_/2216689


obviously the script will continue to display any images you've already acquired or you can put it into custom folder mode via the right click menu.

(https://dl.dropboxusercontent.com/u/22801321/2013/october/thumbs.png)

existing users: right click>Update script.
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2013-10-19 10:00:22
Hi marc2003, is it possible to add a search button next to the artist name like on your last.fm similar artists script on the Last FM Charts script ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-19 18:38:22
^it's certainly possible. i'll think about it.

for anyone who is suffering withdrawal symptoms from not being able to download last.fm images for the last day or so, i've made a little replacement

if anyone wants to test it, save these 2 files in your marc2003 folder

https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)
https://dl.dropboxusercontent.com/u/2280132...mp/download.vbs (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/download.vbs) << you might need to right click the saved file>properties>unblock.

if foobar is running, you'll need to restart.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-19 19:39:58
Marc, which version WSH you use, and where to download?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-19 19:42:58
1.5.6: http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-19 19:55:01
1.5.6: http://code.google.com/p/foo-wsh-panel-mod/downloads/list (http://code.google.com/p/foo-wsh-panel-mod/downloads/list)


Thank you, works fine.. No problems
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-19 21:42:31
Tested...
I am satisfied how it works. Well done Marc..
We would be lost without you.
I am more than happy
I Only must to modify script for my config. It would be good if you provide support for the WSH before 1.5.6 , (problem is only in ''AppendTo'' ,menu)
If you have time and if you want. Thanks a lot for this..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-20 08:18:29
It would be good if you provide support for the WSH before 1.5.6


no chance.   
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-20 08:58:43
It would be good if you provide support for the WSH before 1.5.6


no chance.   


FYI, the only differences between v1.5.4 and the v1.5.6 are:
- FIX: Fix a bug that preprocessor "tooltip" didn't work at all.
- ADD: Added GetColorScheme() method to IGdiBitmap interface.

so if these two features are not used, you can use v1.5.4 as well, it make sense when you know that v1.5.6 is not stable when using complex script that use timers and create a lot of objects (even if they are free from memory properly). The fix about tooltip brought by v1.5.5 & v1.5.6 has broken something in the handle of memory usage
TIPS: a way to fix this bug in v1.5.6 is to code a CollectGarbage() many times in the life of the script / memory usage done.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-20 09:01:09
my scripts only require 1.5.0 but IIRC from a previous post, mire777 is using that hacked 1.4. something for aero.

edit: i've never encountered memory problems in 1.5.6 and i don't use garbage collection in any of my scripts. i'll try 1.5.4 to see if usage is lower??? 

edit2: from the hints/tips...

Quote
11. Consider using Dispose() method instead of CollectGarbage() function.


i do use Dispose on images and menu items but that's it. i don't even know what else it can be used on??
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-20 13:45:55
issue with v1.5.6 is only linked with timers use and refreshing on_paint, a kind of overflow may appear then and will make panels crash (not only the source one but other wsh panel mod that may use some graphics methods) and sometimes worth with a total lock/unresponse of foobar2000 itself.

it's extremely rare but it's happens if you do not take care. v1.5.4 is clear of this kind of issue.

it's just an information for those who may encounter a such issue, since T.P Wang is no more involved in this component.

New panel i'm working on: Album browser like itunes does, but better than the original in some ways (scroll, expands ...):

(http://imageshack.us/a/img594/2262/i1e9.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-20 14:03:06
my seekbars all user timers with an interval of 150 and they've been fine in 1.5.6 for me. i don't know how many other people use them but i've had no reports of any problems.

your new panel looks pretty cool. i assume it's getting colours from the album art? very clever. 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-20 14:07:55
happens with smaller interval size and heavy work on repaint. "Normal" scripts are not affected.

Yep, thanx, background color based on the cover color scheme, that's why i need v1.5.6
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-20 15:58:35
samples updated:

Code: [Select]
7.2013-10-20.02

"Simple tag reader". Now displays a warning if foobar v1.3 is detected.
Because of internal changes made to the handling of extra long tags, this
script is unable to display them anymore. Depending on what happens with
foobar v1.3 final, I might remove the script entirely.

7.2013-10-20.01

"Now playing" & "Thumbs". Restore Last.fm image download
functionality. The only difference is that it's restricted to
a max limit of 5.


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-21 02:13:25
happens with smaller interval size and heavy work on repaint. "Normal" scripts are not affected.

Yep, thanx, background color based on the cover color scheme, that's why i need v1.5.6

How small an interval size? I typically have about 2-3 interval timers going with the shortest one often as low as 35ms and firing off a RepaintRect. My on_paint is currently about 1000 lines of code and does a lot of image drawing (full refresh takes about 200ms fully optimized, although the interval redraws for my seekbar typically are only 1-2ms). I've never noticed an issue with memory usage either.

Has TP Wang really disappeared? I thought he was participating in this thread fairly recently.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-21 02:55:14
Has TP Wang really disappeared? I thought he was participating in this thread fairly recently.


according to his profile (http://www.hydrogenaudio.org/forums/index.php?showuser=44175), he's not even browsed the site while logged in since last december.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-21 13:55:06
I would suggest future request for thumbs:


I noticed that on_metadb_changed(), script not search for image, only when you press play it search image from last.fm. Because of that we have empty panel(or am I missing something in the settings).
I changed this in script for me..

About speed for catch image(it's good), but script wait that folder be full of 5 images, and after that it display's it in foobar.
If you click re-scan, you will see that it is alredy download 1-3 images. It would be good that script not wait, and immediately show that 1-3 images.


And finally. It would be good, that script continues to cycle images even if not pressed play.

besides this, script is perfect...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-21 14:14:45
I noticed that on_metadb_changed(), script not search for image, only when you press play it search image from last.fm.


that's intended. when foobar isn't playing, selection changes can be rapid and i don't want to trigger loads of requests at once.

Quote
If you click re-scan, you will see that it is alredy download 1-3 images. It would be good that script not wait, and immediately show that 1-3 images.


for performance reasons, the thumbnail strip you see is actually one image generated by "stitching" all the images together. rescanning the folder destroys all the current images, gets a list of files, creates new image objects and creates the "stitched" image from scratch. if you ever see a delay when loading folders full of images that already exist, it's because of this "stitching". i don't think it would be a good idea to trigger this after each image has been downloaded.

whilst i'm not really sure why you'd be looking at the images in foobar when nothing is playing, i suppose i could use a timer to cycle images instead.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-21 14:38:07
I noticed that on_metadb_changed(), script not search for image, only when you press play it search image from last.fm.


that's intended. when foobar isn't playing, selection changes can be rapid and i don't want to trigger loads of requests at once.

Quote
If you click re-scan, you will see that it is alredy download 1-3 images. It would be good that script not wait, and immediately show that 1-3 images.


for performance reasons, the thumbnail strip you see is actually one image generated by "stitching" all the images together. rescanning the folder destroys all the current images, gets a list of files, creates new image objects and creates the "stitched" image from scratch. if you ever see a delay when loading folders full of images that already exist, it's because of this "stitching". i don't think it would be a good idea to trigger this after each image has been downloaded.

whilst i'm not really sure why you'd be looking at the images in foobar when nothing is playing, i suppose i could use a timer to cycle images instead.

Ok,i don't like an empty panel, so i changed this for me, now it search images on_metadb_changed().
Here script don't uses api, so i think it's not problem..
About re-scan i think you're right, i modified script to do that only once after 5 sec. play, and work ok.
Only that cycle is what missing..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-21 15:03:00
Only that cycle is what missing..


done. right click>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-21 15:20:05
Only that cycle is what missing..


done. right click>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)


Great Marc, thanks a lot!
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-21 17:38:27
according to his profile (http://www.hydrogenaudio.org/forums/index.php?showuser=44175), he's not even browsed the site while logged in since last december.
Ugh, that sucks. I recently saw he posted two pages ago in the official WSH component thread, but I hadn't realized that was almost a year ago.

At least all the code is in a public repository so someone can make changes and improvements if he's really gone for good.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-21 18:13:10
update for a silly bug i introduced. right click>Update script

Code: [Select]
7.2013-10-21.03

"Now playing" & "Thumbs". A change earlier today meant images with
uppercase lettters in their filename extension were ignored.
This has now been fixed.

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-21 20:44:19
according to his profile (http://www.hydrogenaudio.org/forums/index.php?showuser=44175), he's not even browsed the site while logged in since last december.
Ugh, that sucks. I recently saw he posted two pages ago in the official WSH component thread, but I hadn't realized that was almost a year ago.

At least all the code is in a public repository so someone can make changes and improvements if he's really gone for good.


yep, someone to take the relay of T.P seems to be the way to go, unfortunatly for T.P that miss some news about him... but who is interrested and have the skills and time for ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-21 23:56:22
but who is interrested and have the skills and time for ?


the problem is that all the people who are interested in it don't have the skills -afterall, that's why we're using it. and the people with the skills probably aren't interested.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-22 12:58:23
Bug report for Thumbs & Now Playing:
In some cases, right click menu becomes unresponsible until ''download.vbs'' search image..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-22 14:22:27
sorry but it's kind of unavoidable. i don't want to spawn multiple processes downloading all the images at once plus i'd have no way to tell when it's finished and when to rescan the folder.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-22 15:51:22
the problem is that all the people who are interested in it don't have the skills -afterall, that's why we're using it. and the people with the skills probably aren't interested.

That's not necessarily true. I'm guessing I have most of the skills required and could probably pick up the rest if really needed. But I'd prefer not to as I don't really have the time to chase down hard to reproduce bugs.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-22 15:53:40
so if these two features are not used, you can use v1.5.4 as well, it make sense when you know that v1.5.6 is not stable when using complex script that use timers and create a lot of objects (even if they are free from memory properly). The fix about tooltip brought by v1.5.5 & v1.5.6 has broken something in the handle of memory usage
TIPS: a way to fix this bug in v1.5.6 is to code a CollectGarbage() many times in the life of the script / memory usage done.

After saying that I had never encountered this, I might have encountered it yesterday. Can you explain what the symptom is? Does foobar crash? Does the WSHPanel script crash? Does foobar's memory usage skyrocket?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-22 16:18:52
I'm guessing I have most of the skills required and could probably pick up the rest if really needed.


oh that's cool. we can start directing all bugs and feature requests at you now. 

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-22 22:38:51
so if these two features are not used, you can use v1.5.4 as well, it make sense when you know that v1.5.6 is not stable when using complex script that use timers and create a lot of objects (even if they are free from memory properly). The fix about tooltip brought by v1.5.5 & v1.5.6 has broken something in the handle of memory usage
TIPS: a way to fix this bug in v1.5.6 is to code a CollectGarbage() many times in the life of the script / memory usage done.

After saying that I had never encountered this, I might have encountered it yesterday. Can you explain what the symptom is? Does foobar crash? Does the WSHPanel script crash? Does foobar's memory usage skyrocket?


generally panel crash on a gdiDrawText method, or if not crashing the panel become white (no repaint) for a little lapse of time, then came back on mouse move. Experiencing this repaint bug more than 2 times generate WSH panel Mod panel to freeze (a WSH panel mod window open over the fooobar2000 window and foobar2000 freezed until it crashed.

that's the common symptoms encountered.

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-23 09:53:57
sorry but it's kind of unavoidable. i don't want to spawn multiple processes downloading all the images at once plus i'd have no way to tell when it's finished and when to rescan the folder.


if you run 'download.vbs' as a fully independent process, and set that wsh only check folder if is full with 5 images, maybe you can do something.. Or that wsh monitor process in task mngr. , and when it ends to rescan folder.
It stuck because wsh wait .vbs to end.
I'm sure that you can prevent this..
Not big problem, but it's best to fix...
If not possible at all, ok...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-23 10:31:18
i've already given the reasons for why i'm not changing it. if you can't suppress your need to right click the panel for a few seconds then don't use it.

i have updated it to display a little hourglass when it's working. at least that shows it's doing something. right click>Update script.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-23 10:45:14
i've already given the reasons for why i'm not changing it. if you can't suppress your need to right click the panel for a few seconds then don't use it.

i have updated it to display a little hourglass when it's working. at least that shows it's doing something. right click>Update script.


That's great  . Not problem at all, i use it, and love. in many ways it's better than the standard 'foo_uie_biography' was.
I just asked if possible, if you missed something...
Thanks
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-23 11:16:54
Hi marc2003, i'd like to visualize the seven weblinks buttons in the middle of the wsh panel, would it be possible?
Reading the script i can see that changing the first number for every button i can move it orizzontally, but i'd like to have it always centered, also if i resize the panel.
Is there a way to achieve it?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-23 11:29:21
if you have 7 buttons and they are each 32px in width, that's 224. now subtract that from the panel width and divide it by 2. that gives you the x co-ordinate of where the first button should be....

Code: [Select]
var but_x = Math.round((p.w - 224) / 2);


use but_x for the first button and then increment each one by 32 (but_x + 32, but_x + 64 etc)

you also need to make sure you call the b.update() function inside the on_size function like this...

Code: [Select]
function on_size() {
    p.size();
    b.update();
}
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-23 12:08:42
if you have 7 buttons and they are each 32px in width, that's 224. now subtract that from the panel width and divide it by 2. that gives you the x co-ordinate of where the first button should be....

Code: [Select]
var but_x = Math.round((p.w - 224) / 2);


use but_x for the first button and then increment each one by 32 (but_x + 32, but_x + 64 etc)

you also need to make sure you call the b.update() function inside the on_size function like this...

Code: [Select]
function on_size() {
    p.size();
    b.update();
}


This shouldn't be hard at all, but i'm missing something...
That's the panel where i'd like to center the icons:
(http://i.imgur.com/y4lZafg.jpg)

That's how i edited your original weblinks script:
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common7.js"
// @name "Web Links"
// @author "marc2003. Images by komodomedia.com and mjm716"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var p = new panel("Web Links", ["custom_background", "metadb"]);
p.version = "7.2013-04-20.02";
p.filename = "web links.txt";
var b = new buttons();
var but_x = Math.round((p.w - 224) / 2);
p.check_version();

b.update = function() {
        if (!p.metadb) return;
        var artist = encodeURIComponent(p.eval("%artist%"));
        var title = encodeURIComponent(p.eval("%title%"));
        var lastfm = "http://www.last.fm/music/" + artist + "/_/" + title;
        var google = "https://www.google.co.uk/search?q=" + artist;
        var wikipedia = "http://en.wikipedia.org/wiki/" + artist;
        var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
        var discogs = "http://www.discogs.com/search?q=" + artist;
        var myspace = "http://www.myspace.com/search/music?q=" + artist;
        var allmusic = "http://www.allmusic.com/search/artists/" + artist;
      
        b.buttons = {
                lastfm: new button(but_x, 0, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
                google: new button(but_x+32, 0, 32, 32, {normal: "google.png", hover: "google_h.png"}, function() { p.browser(google); }, google),
                youtube: new button(but_x+64, 0, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
                wikipedia: new button(but_x+96, 0, 32, 32, {normal: "wikipedia.png", hover: "wikipedia_h.png"}, function() { p.browser(wikipedia); }, wikipedia),
                discogs: new button(but_x+128, 0, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
                myspace: new button(but_x+160, 0, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
                allmusic: new button(but_x+192, 0, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic),
              
        }
        window.Repaint();
}

on_item_focus_change();

function on_size() {
    p.size();
    b.update();
}

function on_paint(gr) {
        p.draw_background(gr);
        b.draw(gr);
}

function on_metadb_changed() {
        b.update();
}

function on_mouse_move(x, y) {
        b.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
        b.lbtn_up(x, y);
}


And that's how i end up having the panel:
(http://i.imgur.com/ODf6k9b.jpg)

There's no doubt i'm a noob, sorry...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-23 12:16:12
sorry it's my fault for not being clear. this...

Code: [Select]
var but_x = Math.round((p.w - 224) / 2);


should go inside the b.update() function.

Code: [Select]
var but_x = Math.round((p.w - 224) / 2);
b.buttons = {
   lastfm:
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-23 12:25:36
sorry it's my fault for not being clear. this...

Code: [Select]
var but_x = Math.round((p.w - 224) / 2);


should go inside the b.update() function.

Code: [Select]
var but_x = Math.round((p.w - 224) / 2);
b.buttons = {
   lastfm:


I did some "random" test with the position of the string but i didn't the right one 
Thank you very much, it's perfect now!!
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-23 12:29:40
I didn't thought that I will enjoy in this 'wait image' 

(http://imageshack.us/a/img543/8175/y5tr.png)


How to make this image to spin?
If split this in 8 images
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-23 16:27:36
I didn't thought that I will enjoy in this 'wait image' 

(http://imageshack.us/a/img543/8175/y5tr.png)


How to make this image to spin?
If split this in 8 images

This code is not debugged or tested in anyway, so there will probably need to be changes.

This assumes all the images are saves as wait_img0.png, wait_img1.png, etc. The path variable contains the path to those images.
Code: [Select]
var waitImgs = [];
var curWaitImg;
var curWaitIndex = 0;
for (i=0;i<8;i++)
    waitImgs.push(gdi.image(path + "/wait_img" + i + ".png");
curWaitImg=waitImgs[curWaitIndex++];

waitTimer = window.SetInterval(function() {
    curWaitIndex = (curWaitIndex + 1) % 8;
    curWaitImg = waitImgs[curWaitIndex];
    window.Refresh();
    }, 100);


Then just draw curWaitImg in the on_paint. You'd probably want to use a refresh rect and pass it the coordinates of where you want the wait image to be shown.
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-23 16:34:37
generally panel crash on a gdiDrawText method, or if not crashing the panel become white (no repaint) for a little lapse of time, then came back on mouse move. Experiencing this repaint bug more than 2 times generate WSH panel Mod panel to freeze (a WSH panel mod window open over the fooobar2000 window and foobar2000 freezed until it crashed.

that's the common symptoms encountered.

Sounds like that isn't what I ran into then. My theme crashed in an unexpected spot for no reason I could understand.

I did encounter a weird redraw bug though that might be related. The window would just stop updating. It was going through the on_paint, but the screen only redrew when I paused playback. Never went white though and the theme was still responsive to the mouse (menus would still drop down, etc.) I've seen stuff like that before where it's attempting to redraw too fast, or something else is stealing all the CPU cycles, but that shouldn't have been the issue in this case.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-23 18:05:18
samples updated;

for my thumbs & now playing scripts, when there weren't enough thumbs to fill the whole strip, you'd see an ugly gap with your default background colour. i've now improved this by taking up the whole panel with the main image and drawing thumbs over the top.

(https://dl.dropboxusercontent.com/u/22801321/2013/october/new%20thumbs.png)

right click>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: kaller on 2013-10-23 22:24:02
Maybe somebody can help me:
If I update a tag using IFbMetadbHandle.UpdateFileInfoSimple and then try to read it using IFbFileInfo.MetaValue without a delay, it reads the previous value back. I suppose the reason is that the file content itself is not updated immediately.
Does anybody have a best practice on how to avoid this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-23 23:01:46
as you've written the value, why do you need to read it back immediately?  you'll get prompted if tag updates fail - just like you would if you were updating the usual way through the properties dialog.

Title: WSH Panel Mod script discussion/help
Post by: kaller on 2013-10-23 23:06:50
I need it to perform some calculations afterwards like getting average values of certain track groups. I think I can solve it by just passing in the changed values manually in the calculation, but I was just wondering. Actually I would expect the read and write operations to be properly synchronized.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-23 23:12:10
if you've not seen any tag update errors, i think it's fair to assume the values you have written are ok to use. try using UpdateFileInfoSimple on a read only file and you'll see what i mean.

edit: bad advice removed.
Title: WSH Panel Mod script discussion/help
Post by: kaller on 2013-10-23 23:20:29
Ok, thanks for the hint, I might take that route.
Also thanks for your plugin, the customizations you can do with it are really great!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-23 23:30:02
i completely forgot, you could use the on_metadb_changed callback for this. that gets called automatically when tags are updated.

you need this preprocessor stuff at the start..
Code: [Select]
// ==PREPROCESSOR==
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==


then use this
Code: [Select]
function on_metadb_changed() {
    //something
}
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-24 08:33:29
I didn't thought that I will enjoy in this 'wait image' 

(http://imageshack.us/a/img543/8175/y5tr.png)


How to make this image to spin?
If split this in 8 images


why having 8 images when it's easy to rotate the image with gr.DrawImage() ? Increase angle value by (360 / 8) at each time interval you want (with a timer and a public variable for the angle) and just use this angle value in the gr.DrawImage() as parameter.

void DrawImage(IGdiBitmap, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, angle = 0, alpha = 255);
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-24 09:35:42
i would say don't attempt to draw a spinning image over the top of any kind of background image because the CPU usage is ridiculous. it might be ok in a blank panel.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2013-10-24 14:01:29
I didn't thought that I will enjoy in this 'wait image' 

why having 8 images when it's easy to rotate the image with gr.DrawImage() ?


you only need 2 positions to create the same illusion... alternate between your example as is and same rotated 22.5deg
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-24 15:14:09
I didn't thought that I will enjoy in this 'wait image' 

(http://imageshack.us/a/img543/8175/y5tr.png)


How to make this image to spin?
If split this in 8 images


why having 8 images when it's easy to rotate the image with gr.DrawImage() ? Increase angle value by (360 / 8) at each time interval you want (with a timer and a public variable for the angle) and just use this angle value in the gr.DrawImage() as parameter.

void DrawImage(IGdiBitmap, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, angle = 0, alpha = 255);


You're right..  this is simple rotate scipt, but i don't know where to put it inside 'Thumbs' script, to display only when downloading image:

Code: [Select]
var wait = gdi.Image(fb.FoobarPath + "images\\wait5.png");
var angle = 0;

function on_paint(gr) {

gr.DrawImage(wait, 0, 0, 30, 30, 0, 0, wait.width, wait.height, angle);

}

var timer = window.CreateTimerInterval(10);
function on_timer() {

if(angle >= 360) angle = 10;
angle += 10;
window.Repaint();

}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-24 15:33:32
you really want to use it inside the thumbs script? 

luckily for you there is a variable which you can check the value of: im.working.

Code: [Select]
if (im.working) ....


also, i'd use window.RepaintRect so it doesn't redraw the whole panel.

but even re-drawing such a small area, i still think you'll have CPU usage issues. try it and look at task manager.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-24 15:37:43
Since you're talking also about the Thumbs script i have a question...
In my config it doesn't work anymore, it tries to load pics from Lastfm but nothing appears.  [No image].
Is there something i can do to have it working?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-24 15:41:37
last.fm made some changes last week which means my old script stopped working. i've updated it with a workaround so you just need to right click>Update script.

you might find it's slower now but i can't do anything about that. like it or lump it.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-24 15:45:02
I already tried it but with no luck...
It found an update, i restarted foobar but i can't still see any image in the thumbs panel.
I'll try to recreate the whole panel, maybe something it's corrupted idk
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-24 15:52:18
are you trying it manually or using the automatic download option? the latter only works when you start playing a track and no images exist for that artist.

look inside the marc2003 folder and see if a file named download.vbs exists. the script should download it if it's not found but this might have failed?? also check the foobar console? any messages/HTTP error codes?
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-24 16:17:05
Tried both method and the download.vsb file it's in the right folder...
In console i can see a "Thumbs: HTTP error: 0 " !
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-24 16:39:59
have you been trying many different artists? are you getting that error with all of them?

you could try clearing the temp files in internet explorer to see if that helps. even if you don't use the browser, this script still uses parts of it to work.

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-24 20:35:50
you really want to use it inside the thumbs script? 

luckily for you there is a variable which you can check the value of: im.working.

Code: [Select]
if (im.working) ....


also, i'd use window.RepaintRect so it doesn't redraw the whole panel.

but even re-drawing such a small area, i still think you'll have CPU usage issues. try it and look at task manager.


cpu usage is 8-12 if you set slow spining. Looking nice, but i will consider will i use it?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-24 20:40:42
to meditate : why having a cpu if it's not for using it ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-24 21:15:16
^if the flashing play icon in your playlist took 10% cpu, you wouldn't enable it.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-24 21:39:56
cpu is not important. But i'm not able to do what I intended. so i'll leave it to you, to make, if some of you or Marc thinks that it is useful..you will do this better..
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-10-24 22:19:18
^if the flashing play icon in your playlist took 10% cpu, you wouldn't enable it.


10% is saying nothing, all depends of the cpu power of course

on an atom (1st gen.) it's quite acceptable even for a flashinf icon
Title: WSH Panel Mod script discussion/help
Post by: MordredKLB on 2013-10-24 22:46:23
^if the flashing play icon in your playlist took 10% cpu, you wouldn't enable it.


10% is saying nothing, all depends of the cpu power of course

on an atom (1st gen.) it's quite acceptable even for a flashinf icon

CPU usage isn't necessarily the important part, it's the time it takes in the on_paint. It's a small image, so it wouldn't take that long, unless you have a lot of different images below, or around it. Probably 5-10ms tops. If you do it with 8 images the way I wrote it (even if you just load one image, but draw it rotated into 8 different images that you create) it's probably <1ms to draw. All depends on what you want to do.
Title: WSH Panel Mod script discussion/help
Post by: bobboof on 2013-10-25 07:10:45
I'm trying to combine the 'Now Playing' script with the simple text reader script. Instead of pulling info from Last.FM or Wikipedia to populate the artist info, can I pull that info from a text file instead? Not sure what to change to get that done.

Thanks so much!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-25 09:04:22
that's nice and easy. find line 33...

Code: [Select]
var p = new panel("Now Playing", ["custom_background", "now_playing", "lastfm_wiki", "remap"]);


replace "lastfm_wiki" with "simple_text" so it becomes...

Code: [Select]
var p = new panel("Now Playing", ["custom_background", "now_playing", "simple_text", "remap"]);


to configure the text file options, make sure you right click over the text area.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-25 14:16:22
Hey marc2003, don't hate me but i have another question about one of your script...
I use DUI and i'm looking for a component that display the tags and info of tracks, and i'd like to have one that allows me to follow the selected track, not only the currently playing one.
Your script seems perfect for that aim, but if i create a panel with your script it stay all empty, with only the title of the track at the top.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-25 14:25:45
if you're using a Selection properties panel then go to file>preferences>display>selection viewers>prefer current selection.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-25 14:34:30
if you're using a Selection properties panel then go to file>preferences>display>selection viewers>prefer current selection.


It works with the standard playlist viewer but it won't work with the WSH Playlist that i'm currently using. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-25 14:42:44
ok, i might knock something up.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-25 14:56:17
ok, i might knock something up.


Thank you   
I don't know if it's a "bug" or it's just wanted as this form the developer of the wsh playlist...
i don't have a deviantart account otherwise i'd write him about it
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-25 15:52:55
so here's my quick bodge, tested with falstaff's WSH playlist to select items.

(https://dl.dropboxusercontent.com/u/22801321/2013/october/item%20details.png)

it only displays the detail of a single item, regardless of how many you select. scroll with your mouse wheel if there is too much to display.

first save this in your marc2003 folder...

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common7.js)

then this is the script that goes in the new panel.

https://dl.dropboxusercontent.com/u/2280132...m%20details.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples/item%20details.txt)

it defaults to prefer the playing track but you can change that via the right click menu.

it's also included inside my full pack of scripts here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-25 16:19:07
wow, i didn't expect it so soon, so fast!
Thank you, it's perfect.
Title: WSH Panel Mod script discussion/help
Post by: bobboof on 2013-10-25 19:50:39
that's nice and easy. find line 33...

Code: [Select]
var p = new panel("Now Playing", ["custom_background", "now_playing", "lastfm_wiki", "remap"]);


replace "lastfm_wiki" with "simple_text" so it becomes...

Code: [Select]
var p = new panel("Now Playing", ["custom_background", "now_playing", "simple_text", "remap"]);


to configure the text file options, make sure you right click over the text area.


Wonderful, thank you so much marc2003

Another question for you regarding the Selection Panel you have just described. Is there a way to easily turn the "Now Playing" script into a script where I can choose whether to track the selected track or currently playing track?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-25 20:25:07
edit the same line 33 as above, adding "metadb"

Code: [Select]
var p = new panel("Now Playing", ["custom_background", "now_playing", "simple_text", "remap", "metadb"]);


also you need to delete line 41 which is

Code: [Select]
p.selection_mode = 1;


now you'll have a menu like most other scripts.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-25 22:00:26
Marc, is possible to change something in thumbs script, that image names be saved in format %artist%. example: "jennifer lopez_1,, 2..3... and so on.. Then with mp3tag editor, i can use that image to tag mp3 files? I know that this is not intended, but would be good. and for bio text too... can you point me where to edit this. i hope that i'm not bothering you too much.. thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-25 23:53:13
no but if you read this pdf about how to get foobar to display images downloaded by my script, you can use exactly the same folder location when batch attaching images in foobar itself (via the tagging menu)

https://dl.dropboxusercontent.com/u/2280132...rtist%20art.pdf (https://dl.dropboxusercontent.com/u/22801321/wsh/configuring%20the%20foobar2000%20core%20to%20display%20Last.fm%20artist%20art.pdf)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-26 11:54:49
no but if you read this pdf about how to get foobar to display images downloaded by my script, you can use exactly the same folder location when batch attaching images in foobar itself (via the tagging menu)

https://dl.dropboxusercontent.com/u/2280132...rtist%20art.pdf (https://dl.dropboxusercontent.com/u/22801321/wsh/configuring%20the%20foobar2000%20core%20to%20display%20Last.fm%20artist%20art.pdf)


Wow, this is great!  Actually this is what i wanted to do..
I don't have to waste my time for tagging anymore..

I would ask you one more thing.. is it possible to set: 1st image from folder as front, 2nd as back,  3rd as artist, and 4th as disc?
don't need to be exactly in that order.
If some title formatting can do this?

EDIT: Ok, i somehow menaged myself:


front:
\foobar2000\wsh_lastfm\$crc32(%artist%)\*0.*
\foobar2000\wsh_lastfm\$crc32(%artist%)\*1.*
\foobar2000\wsh_lastfm\$crc32(%artist%)\*2.*

back:
\foobar2000\wsh_lastfm\$crc32(%artist%)\*3.*
\foobar2000\wsh_lastfm\$crc32(%artist%)\*4.*

artist:
\foobar2000\wsh_lastfm\$crc32(%artist%)\*5.*
\foobar2000\wsh_lastfm\$crc32(%artist%)\*6.*

disc:
\foobar2000\wsh_lastfm\$crc32(%artist%)\*7.*
\foobar2000\wsh_lastfm\$crc32(%artist%)\*8.*
\foobar2000\wsh_lastfm\$crc32(%artist%)\*9.*


Each field have a different image then..
Maybe just to improve this...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-26 14:09:07
seems odd why you want artist art to appear as all these other types. 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-26 15:42:00
seems odd why you want artist art to appear as all these other types. 



Because if something again happen with last.fm, i will probably embedded this downloaded image in mp3, and use your WSH artreader to cycle them(modified), but maybe i will like to keep them external. I want both options..
For now i use 'thumbs' , and 'last.fm-wikipedia bio' , i'd like to stay that forever, and last.fm continue to work..
But who knows..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-26 16:10:08
even with no internet, my scripts still display all the bio text and images that have already been saved. in the past, a few people have complained about the fact my scripts save files permanently but i think it's a good thing. people can always delete the files themselves if they want to.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-26 16:52:26
even with no internet, my scripts still display all the bio text and images that have already been saved. in the past, a few people have complained about the fact my scripts save files permanently but i think it's a good thing. people can always delete the files themselves if they want to.


yes, my problem is that i still don't now if i want to use embedded or an external image, if something happen.. because of that i want to keep both options.
you're right, it's a good thing, one of the reasons why this plugin exist is to save all that useful informations for later use. People can delete files if they can not afford that space on the hard disk. I personally want to keep that information. without this script, i don't now how will i properly enjoy in music..
Title: WSH Panel Mod script discussion/help
Post by: Hatatta on 2013-10-26 17:26:34
i would open foobar after changing default foobar to a them i downloaded to get this message Start Up Error message (http://gyazo.com/f3924e704357fe9922ca7cec0124fa48.png)
after going to the console to see the error i get this Console Message (http://gyazo.com/9d450b1cb94dbb8e66cacd48be720799.png). what would i do to fix this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-26 17:42:03
read the instructions that come with the theme you downloaded. i'm guessing they told you to extract some folders/files into your foobar folder but you haven't done this because the scripts can't find them.
Title: WSH Panel Mod script discussion/help
Post by: Hatatta on 2013-10-26 18:08:50
I downloaded all the things that the theme needed like ELPlaylist, Quicksearch, and some others. At this point i'm not sure if it's the theme or WSH
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-26 18:14:10
i found the theme and everything you need - including instructions - is inside the archive. http://fanco86.deviantart.com/art/Mnlt2-183867648 (http://fanco86.deviantart.com/art/Mnlt2-183867648)


Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-27 14:53:36
marc...probably it's something you've already answered but i can't find it in the forum...
Would it be possible to change colour to your themed seekbar? I'm looking for something simple like that but i'd like to have other colours.
Do you know also if somewhere i can find a volume bar that have the same characteristic?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-27 15:42:49
no, it comes from your windows style so you'd have to change that to a 3rd party one to see a different colour.

but you can draw whatever colour rectangles you like instead. just replace the on_paint function with this...

Code: [Select]
function on_paint(gr) {
    //solid red background colour for whole panel.
    gr.FillSolidRect(0, 0, p.w, p.h, RGB(255,0,0));

    if (fb.IsPlaying && fb.PlaybackLength > 0) {
        s.calc_pos();
        //solid blue seekbar
        gr.FillSolidRect(s.x, s.y, s.pos, s.h, RGB(0,0,255));
    }
}


obviously that will look hideous but you can look at using gradients and rounded rectangles. from the docs.

Code: [Select]
    void FillSolidRect(x, y, w, h, color);
    // [1.3.4] Updated:
    // focus: Specify where the center color will be at its highest intensity, from 0.0 to 1.0
    void FillGradRect(x, y, w, h, angle, color1, color2, focus = 1.0);
    void FillRoundRect(x, y, w, h, arc_width, arc_height, color);


and you can use these to draw rectangles with borders

Code: [Select]
    void DrawLine(x1, y1, x2, y2, line_width, color);
    void DrawRect(x, y, w, h, line_width, color);
    void DrawRoundRect(x, y, w, h, arc_width, arc_height, line_width, color);
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-27 16:11:02
Done! Thank you!
I'm just trying to create a small panel with a bunch of wsh script for a simpe dUI config, it's not that horrible c'mon...
is it?
(http://i.imgur.com/CQmbiJy.png)
I miss the volume, in the style of the seekbar and a "menù" button or something like that, i'll look if i can find them in other existing skin and re-arrange them.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-27 17:19:28
i've added a volume function into my common file. you can right click any of my panels>Update script, restart when prompted and then you can add this into a new panel....

https://dl.dropboxusercontent.com/u/2280132...le%20volume.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples/simple%20volume.txt)

you can style it exactly the same way inside the on_paint function.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed/added:
Code: [Select]
marc2003\common7.js
samples\simple volume.txt


Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-27 19:47:45
i've added a volume function into my common file. you can right click any of my panels>Update script, restart when prompted and then you can add this into a new panel....

https://dl.dropboxusercontent.com/u/2280132...le%20volume.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples/simple%20volume.txt)

you can style it exactly the same way inside the on_paint function.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed/added:
Code: [Select]
marc2003\common7.js
samples\simple volume.txt


Nice, thank you so much!!
The volumebar created with this script act a bit different from the standard foobar2000 one, seems to be a different scale.
But i can live with that, it works
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-27 20:46:56
well i know nowt about volume scales so i added the first one i found when searching. i've just tried another and it seems to be a better match when put next to the default UI volume slider. it's not a perfect sync but pretty close.

right click>yada yada..
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-27 21:17:40
Marc,when i set transparency in my skin , bio text also becomes transparent. Until today i did not change this..
How to do that?

(http://imageshack.us/a/img202/4749/qjmu.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-27 21:39:31
don't ask me because i haven't got a clue. it looks like a problem with that hacked component you're using.

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-27 21:44:06
don't ask me because i haven't got a clue. it looks like a problem with that hacked component you're using.


Yea that's a problem, because it uses aero transparency, I don't know how to avoid this..

It uses this to enable-disable glass i think:

Code: [Select]
function on_paint(gr) {
    // Apply Glass Effect
    if(glass_enabled) utils.CreateGlass(Foobar_hWnd, -1, -1, -1, -1);
    
    if(opt_bg_alpha=="255") {
        if(glass_enabled) utils.CreateGlass(Foobar_hWnd, 4, 4, 4, 4);
    } else {
        if(glass_enabled) utils.CreateGlass(Foobar_hWnd, -1, -1, -1, -1);
    }
    
    
    if(glass_enabled) {
        gr.SetSmoothingMode(2);
        gr.FillRoundRect(0, 0, ww-0, wh-0, 3, 3, RGBA(10,10,10,10));
        gr.FillRoundRect(0, 0, ww-1, wh-1, 3, 3, RGBA(10,10,10,20));
        gr.FillRoundRect(1, 1, ww-3, wh-3, 2, 2, RGBA(10,10,10,80));
        gr.DrawRoundRect(2, 2, ww-5, wh-5, 1, 1, 1.0, RGBA(255,255,255,30));
    } else {
        gr.FillSolidRect(0,0,ww,wh,RGB(0,0,0));
        gr.FillSolidRect(1,1,ww-2,wh-2,RGB(120,120,120));
    }
}
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-27 23:02:05
well i know nowt about volume scales so i added the first one i found when searching. i've just tried another and it seems to be a better match when put next to the default UI volume slider. it's not a perfect sync but pretty close.

right click>yada yada..


Way better now!!
your help is priceless 
Title: WSH Panel Mod script discussion/help
Post by: kaller on 2013-10-28 22:30:33
Is there any way to display a text box or something where I can enter values manually?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-28 22:53:58
you can use this but it's limited to 254 characters. "safe mode" needs to be disabled in the WSH panel mod preferences.

Code: [Select]
var vb = new ActiveXObject("ScriptControl");
vb.Language = "VBScript";

function InputBox(prompt, title, value) {
        prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
        title = title.replace(/"/g, '" + Chr(34) + "');
        value = value.replace(/"/g, '" + Chr(34) + "');
        var temp_value = vb.eval('InputBox' + '("' + prompt + '", "' + title + '", "' + value + '")');
        if (typeof temp_value == "undefined") return value;
        else return temp_value;
}

var text_input = InputBox("Enter some text!", "Window Title", "");


if you like, that last set of quotes can be replaced by a default value.

Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-10-29 18:35:29
@Marc

First off, thanks for all your efforts.

I have a question in regards to your "thumbs" script. Currently I can direct other panels to the last fm folder to use the downloaded images with this
Code: [Select]
$drawimage(xx,yy,ww,hh,%foobar2000_path%\lastfm\artist\%artist%.jpg,nodelay nokeepaspect,)


but with the way your script names the images I don't know how to direct panels to them. Is it possible to have the images placed in an a sub folder that uses the artist's name or in the file name itself?

cheers

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-29 19:07:21
if using panel stack splitter then no. the filenames generated are random and i don't think it supports wildcards.

for any other components that are made with the foobar v1.0 SDK and newer, it is possible to display images saved by my script because you can configure the core preferences (file>preferences>album art>artist) and this supports wildcards. a full description for that can be found here: https://dl.dropboxusercontent.com/u/2280132...rtist%20art.pdf (https://dl.dropboxusercontent.com/u/22801321/wsh/configuring%20the%20foobar2000%20core%20to%20display%20Last.fm%20artist%20art.pdf)

if you're using ELplaylist, that can take advantage of this newer feature. use the function named $albumart instead of $drawimage.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-10-29 21:34:14
marc2003, thanks for the revised thumbs to download images from last.fm despite their recent changes.  It works, but it does not seem to prepend the artist name and underscore to the lastfm image name as thumbs did previously.  It would be great if you can tweak the image file name to follow the previous convention.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-29 22:22:28
i don't even know if it's worth using anymore. i just tested a few artists and found it was taking 50 seconds to a minute for 5 images. 

when i tested the other day it was noticeably slower than the old version but nothing quite as tragic as this. is it this bad for anyone else or is it just me?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-30 00:09:27
if using panel stack splitter then no. the filenames generated are random and i don't think it supports wildcards.

for any other components that are made with the foobar v1.0 SDK and newer, it is possible to display images saved by my script because you can configure the core preferences (file>preferences>album art>artist) and this supports wildcards. a full description for that can be found here: https://dl.dropboxusercontent.com/u/2280132...rtist%20art.pdf (https://dl.dropboxusercontent.com/u/22801321/wsh/configuring%20the%20foobar2000%20core%20to%20display%20Last.fm%20artist%20art.pdf)

if you're using ELplaylist, that can take advantage of this newer feature. use the function named $albumart instead of $drawimage.


I was changed this, also add custom folder path, so i can download images in any folder i want..
My names for images are: 'Jennifer Lopez_01.png'...'Jennifer Lopez_02.png'.. 'Jennifer Lopez_03.png'
Folder names are: 'Jennifer Lopez'
Json file: 'Jennifer Lopez.json
Custom folder: 'last_fm'
Why you using this random '$crc32'?
Is this necessary or useful?

i don't even know if it's worth using anymore. i just tested a few artists and found it was taking 50 seconds to a minute for 5 images.  blink.gif

when i tested the other day it was noticeably slower than the old version but nothing quite as tragic as this. is it this bad for anyone else or is it just me?


I think it's ok (maybe little to improve), to download 6 images(even more 10, it takes 50sec-1min), if i set 3 images it takes 15sec.
It depends on image size..
To prevent this i was set on cycle timer, that after 10sec it force 'im.update', so it always display first image after 10sec, until other images are downloading in process. When download is finish, it displays all images, and start cycling..
I was tested this speed with other low quality '252' image, and works much faster, for 6 images every time, download speed is 15 sec. But image quality is uhh..
If you want something faster, then this script must display image directly from web page, before downloading...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-30 00:49:10
Why you using this random '$crc32'?
Is this necessary or useful?


because i was too lazy to validate filenames. if you base file/folder names on tags you have to make sure they don't contain illegal characters like <>?:/\|"

i saw no downside to using $crc32 on the artist because it was for storing cached bio text only. i figured the files are completely useless to anyone or anything else so i used what was in foobar already.

it wasn't until later i made a script that fetched images and i just thought i'd stick them in the same folder. as i have no use for the images outside of foobar, i don't really care about how accessible they are. people can always change it if they don't like it - like you have done.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-10-30 01:01:59
i don't even know if it's worth using anymore. i just tested a few artists and found it was taking 50 seconds to a minute for 5 images. 

when i tested the other day it was noticeably slower than the old version but nothing quite as tragic as this. is it this bad for anyone else or is it just me?



If you're talking about the revised thumbs script, then I found it worked pretty quickly today, which is the first and only day I've tried it.  Five images downloaded in less than 10 seconds for several artists.  I agree it will probably only work for a brief time per the latest comments at last.fm that hinted that either access will be further restricted or all images eliminated, but if prepending the name is doable with just a little effort I'd like to grab a few images that are named in a manner as previously named, before lastfm further degrades their site and access.

And if you choose not to mod it further, no big deal, and many thanks for your efforts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-30 01:16:05
godrick, i've updated it as requested. right click>Update script.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-10-30 01:47:18
i don't even know if it's worth using anymore. i just tested a few artists and found it was taking 50 seconds to a minute for 5 images. 

when i tested the other day it was noticeably slower than the old version but nothing quite as tragic as this. is it this bad for anyone else or is it just me?



If you're talking about the revised thumbs script, then I found it worked pretty quickly today, which is the first and only day I've tried it.  Five images downloaded in less than 10 seconds for several artists.  I agree it will probably only work for a brief time per the latest comments at last.fm that hinted that either access will be further restricted or all images eliminated, but if prepending the name is doable with just a little effort I'd like to grab a few images that are named in a manner as previously named, before lastfm further degrades their site and access.

And if you choose not to mod it further, no big deal, and many thanks for your efforts!


It probably depends on the internet speed. for me it takes 50sec..
where is that comments on last.fm? I really hope this will not happen..
but how things are going, i would not be surprised if they completely close access to certain countries..
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-10-30 03:15:42
if using panel stack splitter then no. the filenames generated are random and i don't think it supports wildcards.

for any other components that are made with the foobar v1.0 SDK and newer, it is possible to display images saved by my script because you can configure the core preferences (file>preferences>album art>artist) and this supports wildcards. a full description for that can be found here: https://dl.dropboxusercontent.com/u/2280132...rtist%20art.pdf (https://dl.dropboxusercontent.com/u/22801321/wsh/configuring%20the%20foobar2000%20core%20to%20display%20Last.fm%20artist%20art.pdf)

if you're using ELplaylist, that can take advantage of this newer feature. use the function named $albumart instead of $drawimage.

Thank you

I couldn't get it to work however following the instructions on your pdf using $albumart as there didn't seem to be any code(at least in what I read) that would allow me to use artreader_artist, only artreader_front, _back, etc... It would only display the cover but I'm sure I entered something wrong. However thanks to you mentioning that it does indeed use wildcards I was able to get it working using this code directly in the panel itself
Code: [Select]
$imageabs(xx,yy,ww,hh,wsh_lastfm\$crc32(%artist%)\*.*,wc nodelay nokeepaspect,)


One last thing(for now any ways  ), will you be able to use a different source for the images or is it all doom and gloom thanks to last.fm? Also, I'm still getting 5 images with your script in spite of the restrictions while the biography panel is only able to fetch 1, why is that?

Thanks again
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-10-30 03:23:10
i don't even know if it's worth using anymore. i just tested a few artists and found it was taking 50 seconds to a minute for 5 images. 

when i tested the other day it was noticeably slower than the old version but nothing quite as tragic as this. is it this bad for anyone else or is it just me?


it has been happening for me as well. some artists load within 10 sec and others don't seem to load at all until I use the "Download artist art...." option
Title: WSH Panel Mod script discussion/help
Post by: harumscarum on 2013-10-30 09:40:47
than you very much Marc for your WSH scripts! here I have an issue with Discogs script - not all releases are displayed

http://joxi.ru/uploads/prod/2013/10/30/8a8...3a3fa873909.jpg (http://joxi.ru/uploads/prod/2013/10/30/8a8/a7e/62336fdee67d7157c2ba19cd2945d3a3fa873909.jpg)
here is script info

and discogs site
http://joxi.ru/uploads/prod/2013/10/30/30e...f8a.jpg (http://joxi.ru/uploads/prod/2013/10/30/30e/33d/16fd6011d3d1199c6092df7b51974a8ecc9c7f8a.jpg?v=2.3.8)

unfortunatelly it happens with most of artists - could it be fixed?

by the way is it possible to add also release info (album, ep, etc)?

thank you!
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-30 11:36:59
Do you guys know if there's a simple script that display the current playing track with a scrolling effect?
I mean an horizontal scrolling, as if it was on a toolbar.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-30 11:59:44
it has been happening for me as well. some artists load within 10 sec and others don't seem to load at all until I use the "Download artist art...." option


automatic download only works when a) you start playing a track and b) there are no existing images. you should see the hourglass as soon as it starts working. i think i'll update the menu with a little help dialog to explain this.

than you very much Marc for your WSH scripts! here I have an issue with Discogs script - not all releases are displayed


my script only displays masters. if i configure it to show releases, it shows too many duplicates when looking at popular artists and you can get thousands of results. my script only displays 100.

(https://dl.dropboxusercontent.com/u/22801321/2013/october/discogs%20releases.png)

now given that example you posted shows different titles for most items, i'm confused why they are releases and not masters? you'd think each release would have a master?

Quote
by the way is it possible to add also release info (album, ep, etc)?


no. discogs doesn't return that info in the API. musicbrainz does though. using that artist of yours as an example...

(https://dl.dropboxusercontent.com/u/22801321/2013/october/musicbrainz.png)
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-10-30 14:35:49
Do you guys know if there's a simple script that display the current playing track with a scrolling effect?
I mean an horizontal scrolling, as if it was on a toolbar.


Edit: doesn't matter, i managed to find one
PS: don't know why but i couldn't edit my previous message, probably it was because i wrote it some hours ago...
Title: WSH Panel Mod script discussion/help
Post by: harumscarum on 2013-10-30 16:01:55
my script only displays masters. if i configure it to show releases, it shows too many duplicates when looking at popular artists and you can get thousands of results.

i see. thank you anyways. seems that most of artist in my library doesnt have masters ))

now tried all your scripts and found useful most of them - let me ask some more questions:
is it possible to make "album - artist" string in album charts? some of artist have very long name so no album visible
(http://joxi.ru/uploads/prod/2013/10/30/7e8/cbc/acda8c530c404d6ee0a0f1630d0110dd410c4190.jpg)

and how to change background in panels so it will match splitter color
(http://joxi.ru/uploads/prod/2013/10/30/cb9/2c4/0a182bd01c60d7b703efd85617c5a31594406b26.jpg)

thank you for efforts once again!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-30 16:32:19
i see. thank you anyways. seems that most of artist in my library doesnt have masters ))


you should try musicbrainz instead. i've always preferred it over discogs.

Quote
is it possible to make "album - artist" string in album charts?


yup, it's done. right click your panel>Update script and restart foobar when prompted.

Quote
and how to change background in panels so it will match splitter color


open the editor and edit line 12...

Code: [Select]
var p = new panel("Last.fm Album Info", ["metadb", "lastfm_album"]);


add "custom_background" like this...

Code: [Select]
var p = new panel("Last.fm Album Info", ["metadb", "lastfm_album", "custom_background"]);


this trick works for most panels. i didn't include it by default because i assumed most people would be happy with the default. that changes whenever you change your colours through the main foobar display preferences.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-30 17:47:58
another update 

Code: [Select]
7.2013-10-30.04

"Now playing" & "Thumbs". Added "download size" options. For some people,
using original images might be overkill so now there are options for
small (250px) and medium (500px) images. The default is still "Original".


existing users can right click>Update script. full download links in post above.
Title: WSH Panel Mod script discussion/help
Post by: harumscarum on 2013-10-30 18:22:07
thank you very much! now i have background in all panels i needed.

last question - is it possible to ajust font size and row height in lastfm charts?
and feature request - display lastfm biography if "nothing found" in lastfm album info panel (would be great for rare albums which have not any info to see at least artist info rather than "nothing found")

thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-30 18:56:39
last question - is it possible to ajust font size and row height in lastfm charts?


first right click panel>Update script. afterwards, you can hold shift>right click panel>properties and edit the value of list_font_size. the row heights are still the same so you can't go too mad with the values.

Quote
and feature request - display lastfm biography if "nothing found" in lastfm album info panel (would be great for rare albums which have not any info to see at least artist info rather than "nothing found")


i'm not doing that. it's too much hassle. you can always use tabs to switch between the 2 panels.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-31 15:28:48
samples updated

i renamed item details to properties.

i've also updated it so that all displayed values are clickable to create autoplaylists. this tooltip should illustrate it...

(https://dl.dropboxusercontent.com/u/22801321/2013/october/properties.png)

it works on all tech fields as well.

existing users, right click>Update script.
optionally, the script in the panel can be re-imported to show the new name but it's not required for the new functionality.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: minlik on 2013-10-31 17:28:50
I followed you introduction and just simply added a WSH Panel Mod to my layout. The console shows that
Quote
Last.fm Playcount Sync: Use the right click menu to set your Last.fm username.


But I cannot find a menu to right click on my foobar.

Just want to know where to input my last.fm username and password.

Thanks very much.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-10-31 17:32:04
in the panel, you should see an exclamation mark button. right click on that.
Title: WSH Panel Mod script discussion/help
Post by: harumscarum on 2013-11-01 09:22:55
please give me a hint how change column size for names and bars in lastFM chart
and row height if possible
thanks

PS would be very appreciate if there any way to do like this
(http://joxi.ru/uploads/prod/2013/11/01/d7c/4c4/5f258eb9d94438d5e23c13070ff2e6ebb777efe9.jpg)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-06 10:50:55
Marc is possible to edit this part to download image also from google?
From this page: https://www.google.com/search?q=michelle+br...348&bih=647 (https://www.google.com/search?q=michelle+branch&source=lnms&tbm=isch&sa=X&ei=PSF6Uqa9GomRswbTnIDIDg&sqi=2&ved=0CAcQ_AUoAQ&biw=1348&bih=647)

It would be good to have 2 servers in one script..


Code: [Select]
this.download = function() {
        if (p.artist == "" || p.artist == "?") return;
        this.working = true;
        var folder = this.folder + "\\";
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+images", true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("div");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("img");
                    var urls = [];
                    for (i = 0; i < data.length; i++) {
                        if (data[i].src.indexOf("http://userserve-ak.last.fm/serve/126s") == 0) urls.push(data[i].src.replace("126s", size == "low" ? "252" : size == "medium" ? "500" : size == "high" ? "_" : "_"));
                    }
                    for (i = 0; i < Math.min(urls.length, im.limit, 50); i++) {
                    p.WshShell.Run("cscript //nologo \"" + p.script_path + "download.vbs\" \"" + urls[i] + "\" \"" + [folder + i] + urls[i].substring(urls[i].lastIndexOf("/")+1) + "\"" , 0, true);
                    }
                    im.working = false;
                    im.doc.close();
                    im.update();
                    window.NotifyOthers("images", "update");
                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
                }
            }
        }
    }
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-06 12:35:54
pick apart google.boo from album art downloader and integrate it yourself.
Title: WSH Panel Mod script discussion/help
Post by: bobboof on 2013-11-06 17:09:12
Is there any way to parse URLs in a text file on the simple text reader script? Or even style the text in some way?
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-11-06 17:50:10
marc i'm quite sure that some days ago i saw, in some of your scripr like the musicbrainz and lastfm similar artists, the option to change the font of the list.
i tried again today but i can't find it anymore, am i blind or i was drunk before?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-06 20:21:02
pick apart google.boo from album art downloader and integrate it yourself.

Thanks. I will try. if i have problem, i'l ask you again.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-07 11:56:32
Marc i'm trying to get this to work with Google, but i don't know exactly what to write?
Can you help me, please?  When you have time..

I get: HTTP error: 0.



Code: [Select]
this.download = function() {
        if (p.artist == "" || p.artist == "?") return;
        this.working = true;
        var folder = this.folder + "\\";
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://images.google.com/images?gbv=1&q=" + encodeURIComponent(p.artist), true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("div");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("img");
                    var urls = [];
                    for (i = 0; i < data.length; i++) {
                        if (data[i].src.indexOf("https://encrypted-tbn3.gstatic.com/images?q=tbn:") == 0);
                    }
                    for (i = 0; i < Math.min(urls.length, im.limit, 10); i++) {
                    p.WshShell.Run("cscript //nologo \"" + p.script_path + "download.vbs\" \"" + urls[i] + "\" \"" + [folder + i] + urls[i].substring(urls[i].lastIndexOf(":")+1) + "" , 0, true);
                    }
                    im.working = false;
                    im.doc.close();
                    im.update();
                    window.NotifyOthers("images", "update");
                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
                }
            }
        }
    }
Title: WSH Panel Mod script discussion/help
Post by: ssego on 2013-11-09 07:45:02
Is there any way to make buttons that change output device? I have my stereo hooked to SPDIF out, and also use my PC Speakers when someone is watching TV.  I have the buttons made, but can't figure out what command to use to change devices.  I tried fb.runmainmenucommand, thinking that you can make a keyboard shortcut to accomplish this task, but evidently I'm not wording something right.  Any help would be appreciated.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-09 08:53:36
if you want a keyboard shortcut, just configure it under file>preferences>keyboard shortcuts.

or if you want to make a button in your script, just type out the command as it appears in the main menu. you can hold down shift and then click the Playback menu to see all items.

Code: [Select]
fb.RunMainMenuCommand("Playback/Device/BLAH");
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-11-09 17:38:33
marc i'm quite sure that some days ago i saw, in some of your scripr like the musicbrainz and lastfm similar artists, the option to change the font of the list.
i tried again today but i can't find it anymore, am i blind or i was drunk before?


edit: don't know if it is because of an update or for some other reason but the option seems to be back again, thank you marc.

a question about the "rights" of your scrips:
i have a friend that gave me his .fth file to adjust his skin. it uses lots of your scripts but some of them are a little bit modified (removed lastfm buttons, some layouts changed, stuff like that).
Once finished he'd like to post it on deviantart, can this be done or have he to use your script 100% as they are?
Also...when there is an update ... the customization of a script will be lost?
Title: WSH Panel Mod script discussion/help
Post by: harumscarum on 2013-11-09 21:20:51
is it possible to skip playing album (play nex one in queue) by button or shortcut?
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-11-10 00:40:45
@marc(or someone else who can help)

In the artreader and info scripts, how do I get an image to show rather than the "No Image" and "Nothing found" text?

Thanks

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-10 16:35:21
@marc(or someone else who can help)

In the artreader and info scripts, how do I get an image to show rather than the "No Image" and "Nothing found" text?

Thanks


In artreader you can set image in foobar preferences>display>stub image path..
For info script don't now, you must modify that script...
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-11-10 16:47:03
@marc(or someone else who can help)

In the artreader and info scripts, how do I get an image to show rather than the "No Image" and "Nothing found" text?

Thanks


In artreader you can set image in foobar preferences>display>stub image path..
For info script don't now, you must modify that script...


Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-10 19:26:46
@foomark, i'm past caring what people do with these scripts. i've lost count of the times people have modified them so they don't even work properly and then post them on DA. 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-10 22:36:02
Marc , i made your script to work with Google.
The problem is how to define the size of the pictures? If you can help me with this?
I think you should also include this in your script?

Code: [Select]
this.download = function() {
        if (p.artist == "" || p.artist == "?") return;
        this.working = true;
        var folder = this.folder + "\\";
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
         this.xmlhttp.open("GET", "https://www.google.com/search?q=" + encodeURIComponent(p.artist) + "/&sei=GAKAUuvmD-WC4gTL9IC4AQ&gbv=2&tbm=isch", true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("div");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("img");
                    var urls = [];
                    for (i = 0; i < data.length; i++) {
                        if (data[i].src.indexOf("https://encrypted-tbn2.gstatic.com/images?q=tbn:") == 0) urls.push(data[i].src.replace(":", ":"));
                    }
                    for (i = 0; i < Math.min(urls.length, im.limit, 50); i++) {
                    p.WshShell.Run("cscript //nologo \"" + p.script_path + "download.vbs\" \"" + urls[i] + "\" \"" + [folder + i] + urls[i].substring(urls[i].lastIndexOf(":")+1) + ".jpg" + "\"" , 0, true);
                    }
                    im.working = false;
                    im.doc.close();
                    im.update();
                    window.NotifyOthers("images", "update");
                } else {
                    p.console("HTTP error: " + im.xmlhttp.status + urls);
                }
            }
        }
    }

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-11 01:48:15
@falstaff, i noticed a little display glitch in your duitunes top panel. it happens for tracks with over an hour remaining....

(https://dl.dropboxusercontent.com/u/22801321/2013/november/falstaff.png)
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-11-11 08:28:00
@foomark, i'm past caring what people do with these scripts. i've lost count of the times people have modified them so they don't even work properly and then post them on DA. 


Got it, thank you, i'll report him!

@falstaff: your wsh album view panel is fantastic!! I'd pay to have a version that follow the selected item in library
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-11-11 10:13:23
@falstaff, i noticed a little display glitch in your duitunes top panel. it happens for tracks with over an hour remaining....

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-11 10:25:59
^a quick question for you: are there any changes worth mentioning between the WSH playlist in your new theme and 0.0.8?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2013-11-11 11:10:23
^a quick question for you: are there any changes worth mentioning between the WSH playlist in your new theme and 0.0.8?


no significative changes, you can keep 0.0.8 for now. My next challenge, a playlist viewer with the same smooth scrolling as my Album View panel, will give more like to it
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2013-11-12 03:53:19
Hey guys hopefully someone can help me with this, Marc? Haha.

I'm trying to give my friend my foobar layout. I've given it to another friend and it's worked fine, I've also copied it from my home computer to my work one and it works fine.

It's a portable install, so I'm just saving the foobar folder as a zip and sending it to my friend.

When he opens it though, all of his scripts crash.

This is what it should look like:
(http://i.imgur.com/t9KkBOr.jpg)

This is what he gets:
(http://puu.sh/5fRa6.png)
(http://puu.sh/5fRDF.png)

Not sure why it's only happening to him but not me and my other friend.

I just did a quick search of the thread and found that the error is the same as the one mentioned by ninjasilver. I've told my friend to do 2 slashes // in front of "//this.doc = new ActiveXObject("htmlfile");" hopefully that does the trick.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-12 04:46:39
Quote
Unexpected error code 0x800700b6


i have no idea. if my scripts are at fault, i usually get meaningful errors. that might indicate a problem with the component itself or maybe even their windows install. but i'm just guessing.... 

i can also see it's code on line 1297 causing the problem but it isn't anything meaningful on my current version so i'm guessing it's slightly earlier?? as a workaround, it might be possible to comment it out if it's not required by the panels in the layout. you can either check what code is actually on line 1297 and report it. or you could just download the latest common7.js and save it inside the marc2003 folder. restart foobar and then error line number would change to what i've got here.

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common7.js)
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2013-11-12 06:06:37
Yep, commenting out the line worked, as it did for ninjasilver. I should've searched this thread more thoroughly.

Thanks heaps marc, you always reply so quickly.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-12 06:24:35
i searched but didn't find anything. at least you got it sorted.

BTW, my current version doesn't include that line by default so it won't crash for all scripts like it did before. it's just last.fm album info and news-reviews-blogs that require that function and it's all only created when required.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-12 07:37:29
samples updated: simple volume, simple seekbar, nyan cat seekbar, themed seekbar, spectrogram seekbar. added mouse wheel support.

scripts inside the panel need updating manually so a full download is required.

https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

files changed:
Code: [Select]
marc2003\common7.js
samples\nyan cat seekbar.txt
samples\simple seekbar.txt
samples\simple volume.txt
samples\spectrogram seekbar.txt
samples\themed seekbar.txt
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-12 23:15:20
Marc, will you consider to add 'google and yahoo' image server for thumbs? I test this 2 sources for me, and works almost like last.fm. Images are the same quality. I didn't recieve any image that not artist. I think that this is ok as alternative source, if something happen with last.fm..
Maybe i'm not doing this properly, so i would like that you do this ,as it should..
Sorry if i'm bothering you with this..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 03:14:15
Images are the same quality.


i disagree. images on the left were from your code snippet. i don't think they'd look very good made to fill my panel. yes, last.fm is a bit slow but there options for smaller images which is much faster if people are prepared to compromise.

(https://dl.dropboxusercontent.com/u/22801321/2013/november/google.jpg)

Quote
I didn't recieve any image that not artist.


well i found plenty. i suppose you can modify the search term by adding artist/band/musician etc. but i'm just not interested. you can of course do what you like.





Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-13 04:34:40
Images are the same quality.


i disagree. images on the left were from your code snippet. i don't think they'd look very good made to fill my panel. yes, last.fm is a bit slow but there options for smaller images which is much faster if people are prepared to compromise.

Quote
I didn't recieve any image that not artist.


well i found plenty. i suppose you can modify the search term by adding artist/band/musician etc. but i'm just not interested. you can of course do what you like.



Ok Marc, thanks a lot. Yes, i add posibility to enter custom search terms in properties. My problem is only in html, i must to point script to go in ''a>href'' tag,  and inside that is a path for full image size. but that string looks like this: hlj:fjoddfnaDBOVHFRS34[path]HFfjosofiodppdff. And it is not static. Don't now how to tell script to read only that part in the middle, and to download image from there?
I have only low image from: ''img>src''. Must to do something with that..
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-13 05:26:28
2marc2003

I switched to windows 8.1, I previously worked on windows 7.
I copied the folder c:\program files (86)\foobar2000 and c:\users\my name\appdata\rouming\foobar2000 to the new location.

With new OS player works fine, except that the window with the script "now playing" stopped to load images from the website last.fm.
In the same configuration on windows 7, these images are loaded fine.

What is the reason?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 05:38:51
the OS is irrelevant so that shouldn't be the issue.

but there have been changes at last.fm recently meaning any script not updated since 20th october won't work. right click panel>Update script if you need to.

also, you should check the automatic download setting is on. this setting should be remembered if you transferred your old config but it's worth double checking. i assume it's still displaying all your previously saved images ok? that's because they should have been inside your foobar2000 profile folder.

Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-13 07:16:46
marc2003

automatic download setting is on - of course.

I start foobar2000 on win 8.1  (your scripn at 12.11.2013 - last), images not download.
Then copy  foobar2000 and profile folders to win 7, now I start foobar2000 on win 7 (configuration from  win 8.1  ), images download fine.

i assume it's still displaying all your previously saved images ok?  - Yes, old playeyd on win 7 songs  displayed fine, when I play its on win 8.1.

This is wsh_lastfm/3052340555 folder from win 7.1 (displayed)
Линда_5904281.jpg
artist.getInfo_mod.json

Code: [Select]
{"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "start": 0, "total": 2, "biographies": [{"text": "Linda is a russian singer performing trip-hop with ethnic influences. She was born on April 29, 1975 in Kentau, Kazakhstan. Her real name is Svetlana Geyman. Linda's family has later moved to Togliatti, then to Moscow, Russia.   1993: Linda releases her breakthrough debut album \"Песни Тибетских Лам\" (\"Pesni Tibetskih Lam\" - \"Songs of Tibetan Lamas\"), followed by a remix album \"Dances of Tibetan Lamas\". She surpasses her debut with her next album (her biggest selling to date) - \"Ворона\" (\"Vorona\" - \"Crow\"). The album achieves unprecedented popularity in Russia and every single from \"Vorona\" reaches number 1 in Russian charts.  During the \"Vorona\" era, Linda maintains a mysterious and exotic public image . She tells the media about her mystic experiences, music and her attitude to food (\"if I could, I wouldn't eat at all\"). Linda achieves commercial success with her producer Maxim Fadeev, who will later record his own album, resembling his work with Linda.  1999: Linda's third album, \"Плацента\" (\"Placenta\"), is released. The album is darker and more personal, as Linda describes in an interview. However, she is subsequently dropped by her record label and producer due to financial issues.  2001: Linda signs to a new label, BMG and releases her fourth album \"Зрение\" (\"Zreniye\" - \"Vision\" or \"Sight\"). The overall sound becomes more electronic, guitar-driven and with nonsense lyrics. Due to low sales, Linda gets dropped by her label again.  2003: Linda signs a record deal with Universal. The promo single \"Цепи и Кольца\" (\"Chains and Rings\") is subsequently released, along with an English version. The single achieves moderate success, but does not match \"Vorona\"'s sales.  October, 2004: her fifth album \"АтакА\" (\"AtakA\" - \"Attack\") is released. The album is recorded with the some of the best producers and showcases another change in Linda's sound. \"AtakA\" goes on to sell 100,000 copies in the first 2 weeks in Moscow alone.   Fall of 2005: Linda promots \"AtakA\" in London. There are rumors about Linda's plans to collaborate with Moby and Björk, but they are never confirmed.  December 2005: Linda starts working with a new producer from Greece, who is offered to pick one artist from Universal to work with. After listening to all artists' demos he chooses Linda. 2 tracks are thus recorded for the new album.  March 2006: Linda's new single \"Я Украду\" (\"Ya Ukradu\" - \"I Will Steal\") becomes her biggest airplay hit since \"Беги\" (\"Begi\") from \"AtakA\" in 2004.   October 2006: Linda's sixth album \"АлеАда\" (\"AleAda\") is released.   Linda later parted with her old style and collaborated with Stefanos Korkolis. She can be found on the web using the name Linda Geyman. Their band is called Bloody Faeries.", "site": "last.fm", "url": "http://www.last.fm/music/%D0%9B%D0%B8%D0%BD%D0%B4%D0%B0/+wiki", "license": {"type": "cc-by-sa", "attribution": "Last.fm", "attribution-url": "http://www.last.fm/music/%D0%9B%D0%B8%D0%BD%D0%B4%D0%B0/+wiki", "url": "http://creativecommons.org/licenses/by-sa/3.0/", "version": "3.0"}}, {"text": ".. ..................One Linda (Линда) was born on April 29th, 1975 ...", "site": "myspace", "url": "http://www.myspace.com/zrenie", "license": {"type": "unknown", "attribution": "myspace", "attribution-url": "http://www.myspace.com/zrenie", "url": "n/a", "version": "n/a"}, "truncated": true}]}}

and this is new folder 961077930 (created in win 8.1)
artist.getInfo_mod.json

Code: [Select]
{"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "start": 0, "total": 11, "biographies": [{"text": "Dire Straits emerged during the post-punk era of the late ...", "site": "aol", "url": "http://music.aol.com/artist/dire-straits/biography", "license": {"type": "unknown", "attribution": "aol", "attribution-url": "http://music.aol.com/artist/dire-straits/biography", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "Dire Straits emerged during the post-punk era of the late ...", "site": "mtvmusic", "url": "http://www.mtvmusic.com/dire_straits", "license": {"type": "unknown", "attribution": "mtvmusic", "attribution-url": "http://www.mtvmusic.com/dire_straits", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "Dire Straits were a british rock band from Newcastle, United Kingdom,  formed in 1977 by Mark Knopfler (guitar and vocals), his brother David Knopfler (guitar), John Illsley (bass), and Pick Withers (drums), and subsequently managed by Ed Bicknell. Dire Straits emerged during the post-punk era of the late '70s, and while their sound was minimalistic and stripped down, they owed little to punk. If anything, the band was a direct outgrowth of the roots revivalism of pub rock, but where pub rock celebrated good times, Dire Straits were melancholy. Led by guitarist/vocalist Mark Knopfler, the group built their sound upon the laid-back blues-rock of J.J. Cale, but they also had jazz and country inflections, occasionally dipping into the epic song structures of progressive rock. The band's music was offset by Knopfler's lyrics, which approximated the winding, stream-of-conscious narratives of Bob Dylan. As their career progressed, Dire Straits became more refined and their new maturity happened to coincide with the rise of MTV and the compact disc. These two musical revolutions from the mid-'80s helped make Dire Straits' fifth studio album, Brothers in Arms, an international blockbuster. The band - along with Eric Clapton, Phil Collins, and Steve Winwood - became one of the leaders of a group of self-consciously mature veteran rock & rollers in the late '80s that designed their music to appeal to aging baby boomers. Despite the band's international success, they couldn't sustain their stardom, waiting a full six years to deliver a follow-up to Brothers in Arms, by which time their audience had shrunk significantly.  Knopfler (born August 12, 1949) was always the main force behind Dire Straits. The son of an architect, Knopfler studied English literature at Leeds University and worked briefly as a rock critic for the Yorkshire Evening Post while at college. He began teaching English after his graduation, leading a pub rock band called \"Brewer's Droop\" at night. By 1977, Mark was playing with his brother David (guitar) and his roommate John Illsley (bass). During the summer of 1977, the trio cut a demo with drummer Pick Withers. A London DJ named Charlie Gillett heard the demo and began playing \"Sultans of Swing\" on his BBC show Honky Tonkin'. Following a tour opening for Talking Heads, the band began recording their debut for Vertigo Records with producer Muff Winwood in early 1978. By the summer, they had signed with Warner in America, releasing their eponymous debut in the fall. Thanks to the Top Ten hit \"Sultans of Swing\", Dire Straits was a major success in both Britain and America, with the single and album climbing into the Top Ten on both sides of the Atlantic.  The LP \"Dire Straits\" established Dire Straits as a major force on album-oriented radio in America, and their second album, \"Communiqué\" (1979), consolidated their audience, selling three million copies worldwide. As the group was recording its third album, David Knopfler left the band to pursue a solo career; he was replaced by former Darling member Hal Lindes. Like its predecessor, \"Making Movies\" was a sizable hit in America and Britain, even though the band was criticized for musically treading water. Nevertheless, the record went gold on the strength of the radio and MTV hits \"Romeo and Juliet\" and \"Skateaway\". Dire Straits followed the album two years later with \"Love Over Gold\", an album filled with long, experimental passages, plus the single \"Private Investigations\", which became a number two hit in the United Kingdom. The album went gold in America and spent four weeks at number one in Britain. Shortly after the release of \"Love Over Gold\", former Rockpile drummer Terry Williams replaced Withers.  During 1982, Knopfler began exploring musical avenues outside of Dire Straits, scoring the Bill Forsyth film \"Local Hero\" and playing on Van Morrison's \"Beautiful Vision\". Apart from releasing the \"Twisting by the Pool\" EP early in 1983, Dire Straits were quiet for the majority of 1983 and 1984, as Knopfler produced Bob Dylan's \"Infidels\", as well as Aztec Camera and Willy DeVille; he also wrote \"Private Dancer\" for Tina Turner's comeback album of the same name.   In the spring of 1984, the band released the double album \"Alchemy: Dire Straits Live\" and by the end of the year, they had begun recording their fifth studio album with their new keyboardist, Guy Fletcher.   Released in the summer of 1985, \"Brothers in Arms\" was Dire Straits' breakthrough album, making the band international stars. Supported by the groundbreaking computer-animated video for \"Money for Nothing\", a song which mocked music videos, the album became a blockbuster, spending nine weeks at the top of the American charts and selling over nine million copies; in England, the album became the biggest-selling album of the '80s. \"Walk of Life\" and \"So Far Away\" kept \"Brothers in Arms\" in the charts through 1986, and Dire Straits played over 200 dates in support of the album.   Once the tour was completed, Dire Straits went on hiatus for several years, as Knopfler produced records by Randy Newman and Joan Armatrading, scored films, toured with Eric Clapton, and recorded a duet album with Chet Atkins: \"Neck and Neck\" (1990). In 1989, he formed the country-rock group Notting Hillbillies, whose sole album, \"Missing...Presumed Having a Good Time\", became a British hit upon its spring 1990 release. During the extended time off, John Illsley recorded his second album; the first appeared in 1984.  In 1990, Knopfler reconvened Dire Straits, which now featured Illsley, Clark, Fletcher, and various session musicians. The band released \"On Every Street\" in autumn 1991 to great anticipation. However, the album failed to meet expectations - it only went platinum in America but went to number one in the UK charts and most of Europe - it failed to generate a hit single in the UK.  The tour embarked on was massive but may have been a bit of a disappointment, with many tickets going unsold in both the U.S. and Europe. Once the tour was completed, the live album \"On the Night\" was released in the spring of 1993 and the band again went on hiatus.   Dire Straits released one last album in 1995, Live at the BBC, as a contractual album release to Vertigo Records.  That same year, Knopfler disbanded the group.  In 1996, Knopfler launched his solo career.", "site": "last.fm", "url": "http://www.last.fm/music/Dire+Straits/+wiki", "license": {"type": "cc-by-sa", "attribution": "Last.fm", "attribution-url": "http://www.last.fm/music/Dire+Straits/+wiki", "url": "http://creativecommons.org/licenses/by-sa/3.0/", "version": "3.0"}}, {"text": "..Dire Straits was a British rock band, formed in 1977 ...", "site": "myspace", "url": "http://www.myspace.com/sultansofdirestraits", "license": {"type": "unknown", "attribution": "myspace", "attribution-url": "http://www.myspace.com/sultansofdirestraits", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "The U.K.'s Dire Straits became one of the world's most ...", "site": "7digital", "url": "http://us.7digital.com/artists/dire-straits/", "license": {"type": "unknown", "attribution": "7digital", "attribution-url": "http://us.7digital.com/artists/dire-straits/", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "Dire Straits were a British rock band, formed in 1977 by Mark Knopfler (lead vocals and lead guitar), his younger brother David Knopfler (rhythm guitar and backing vocals), John Illsley (bass guitar and backing vocals), and Pick Withers (drums and percussion). Dire Straits' sound drew from a variety of musical influences, including jazz, folk, blues, and came closest to beat music within the context of rock and roll. Despite the prominence of punk rock during the band's early years, the band's stripped-down sound contrasted with punk, demonstrating a more \"rootsy\" influence that emerged out of pub rock. Many of Dire Straits' compositions were melancholic. Dire Straits' biggest selling album, Brothers in Arms, has sold over 30 million copies. \nThey also became one of the world's most commercially successful bands, with worldwide album sales of over 120 million. Dire Straits won numerous music awards during their career, including four Grammy Awards, three Brit Awards--winning Best British Group twice, and two MTV Video Music Awards. The band's most popular songs include \"Sultans of Swing\", \"Lady Writer\", \"Romeo and Juliet\", \"Tunnel of Love\", \"Telegraph Road\", \"Private Investigations\", \"Money for Nothing\", \"Walk of Life\", \"So Far Away\", \"Your Latest Trick\" and \"Brothers in Arms\". \nDire Straits' career spanned a combined total of 15 years. The band originally split up in 1988, but reformed in 1991. Dire Straits disbanded for good in 1995 when Mark Knopfler launched his career full-time as a solo artist. There were several changes in personnel over both periods, leaving Mark Knopfler and John Illsley as the only two original bandmates who had remained throughout the band's career. \n\nContents\n\n1 History\n1.1 1977-1979: Early years and first two albums, \n1.2 1980-1984: Increased musical complexity and early success, \n1.3 1985-1986: The Brothers in Arms era and international success, \n1.4 1987-1990: First break-up, \n1.5 1991-1995: Resurrection, final albums and final dissolution, \n1.6 1996-present, \n, \n2 Band members, \n3 Discography\n3.1 Studio albums, \n, \n4 Awards\n4.1 Award nominations, \n, \n5 References, \n6 External links, \n\nHistory:\n\n1977-1979: Early years and first two albums:\n\nBrothers Mark and David Knopfler, and friends John Illsley, and Pick Withers formed the band in 1977. In 1977, Dire Straits (a name given to the band by a musician flatmate of drummer Pick Withers), recorded a five-song demo tape which included their future hit single, \"Sultans of Swing\", as well as \"Water of Love\", \"Down to the Waterline\", \"Wild West End\" and David Knopfler's \"Sacred Loving\". They took the tape to DJ Charlie Gillett, who had a radio show called \"Honky Tonk\" on BBC Radio London. The band simply wanted advice, but Gillett liked the music so much that he played \"Sultans of Swing\" on his show. Two months later, Dire Straits signed a recording contract with Phonogram Records. In October 1977, the band recorded demo tapes of \"Southbound Again\", \"In the Gallery\" and \"Six Blade Knife\" for BBC Radio London; in November demo tapes were made of \"Setting Me Up\", \"Eastbound Train\" and \"Real Girl\". \nThe group's first album, Dire Straits, was recorded at Basing Street studios in West London in February 1978, at a cost of £12,500. Produced by Muff Winwood, the album had little promotion when initially released in the United Kingdom on Vertigo Records, then a division of Phonogram, and was not well received. However, the album came to the attention of A&R representative Karin Berg, working at Warner Bros. Records in New York City. She felt that it was the kind of music audiences were hungry for, but only one person in her department agreed at first. Many of the songs on the album reflected Mark Knopfler's experiences in Newcastle, Leeds and London. \"Down to the Waterline\" recalled images of life in Newcastle; \"In the Gallery\" is a tribute to Leeds sculptor/artist Harry Phillips (father of Steve Phillips); \"Wild West End\" and \"Lions\" were drawn from Knopfler's early days in the capital. \nThat same year, Dire Straits began a tour as opening band for the Talking Heads after the re-released \"Sultans of Swing\" finally started to climb the UK charts. This led to a United States recording contract with Warner Bros. Records; before the end of 1978, Dire Straits had released their self-titled debut worldwide. They received more attention in the United States, but also arrived at the top of the charts in Canada, Australia and New Zealand. Dire Straits eventually went top 10 in every European country. \nThe following year, Dire Straits embarked on their first North American tour. They played 51 sold-out concerts over a 38-day period. \"Sultans of Swing\" scaled the charts to number four in the United States and number eight in the United Kingdom. The song was one of Dire Straits' biggest hits and became a fixture in the band's live performances. Bob Dylan, who had seen the band play in Los Angeles, was so impressed that he invited Mark Knopfler and drummer Pick Withers to play on his next album, Slow Train Coming. \nRecording sessions for the group's second album, Communiqué, took place in December 1978 at Compass Point Studios in Nassau, Bahamas. Released in June 1979, Communiqué was produced by Jerry Wexler and Barry Beckett and went to #1 on the German album charts, with the debut album Dire Straits simultaneously at #3. In the United Kingdom the album peaked at #5 in the album charts. Featuring the single \"Lady Writer\", the second album continued in a similar vein as the first and displayed the expanding scope of Knopfler's lyricism on the opening track, \"Once Upon a Time in the West\". In the coming year, however, this approach began to change, along with the group's lineup. \n\n1980-1984: Increased musical complexity and early success:\n\nIn 1980, Dire Straits were nominated for two Grammy Awards for Best New Artist and Best Rock Vocal Performance by a Duo or Group for \"Sultans Of Swing\". In July 1980 the band started recording tracks for their third album. Produced by Jimmy Iovine with Mark Knopfler also sharing credit, Making Movies was released in October 1980. During the recording sessions, tension between Mark and David Knopfler took its toll on the band, and David Knopfler left over creative differences with his brother to pursue a solo career; he was uncredited on the album. The sessions continued with Sid McGinnis on rhythm guitar and keyboardist Roy Bittan from Bruce Springsteen's E Street Band. After the recording sessions were completed, keyboardist Alan Clark and Californian guitarist Hal Lindes joined Dire Straits as full-time members for tours of Europe and North America. \nMaking Movies received mostly positive reviews and featured longer songs with more complex arrangements, a style which would continue for the rest of the band's career. The album featured many of Mark Knopfler's most personal compositions. The most successful chart single was \"Romeo and Juliet\" (number 8 in the UK singles chart), a song about a failed love affair, with Knopfler's trademark in keeping personal songs under fictitious names. Although never released as a hit single, \"Solid Rock\" was featured in all Dire Straits' live shows from this point on for the remainder of their career, while the album's lengthy opening track, \"Tunnel of Love\", with its intro \"The Carousel Waltz\" by Richard Rodgers and Oscar Hammerstein II, was featured in the film An Officer and a Gentleman. Although \"Tunnel of Love\" only reached the position of #54 in the UK Singles Chart when released as a single in 1981, it remains one of Dire Straits' most famous and popular songs and immediately became a favourite at concerts. Making Movies stayed in the UK Albums Chart for 5 years, peaking at number 4. \nDire Straits' fourth studio album Love Over Gold, an album of songs filled with lengthy, experimental passages that featured Alan Clark's piano and keyboard work, was well received when it was released in September 1982, going gold in America and spending four weeks at number one in the United Kingdom. The title was inspired by graffiti seen from the window of Knopfler's old council flat in London. The phrase was taken from the sleeve of an album by Captain Beefheart. Love Over Gold was the first Dire Straits album produced solely by Mark Knopfler, and its main chart hit, \"Private Investigations\", gave Dire Straits their first top 5 hit single in the United Kingdom, where it reached the number 2 position despite its almost seven-minute length, and became another of the band's most popular live songs. \n\nIn other parts of the world, \"Industrial Disease\", a song that looks at the decline of the British manufacturing industry in the early 1980s, focusing on strikes, depression and dysfunctionality, was the main single from the album, particularly in Canada, where it became a top 10 hit. As well as the title track and \"It Never Rains\", Love Over Gold featured the 14-minute-long epic \"Telegraph Road\". Also written by Knopfler for inclusion on the album was \"Private Dancer\", a song which eventually went to Tina Turner for her comeback album of the same name. Love Over Gold reportedly sold two million copies during the first six weeks after its release. Shortly after the release of Love Over Gold, drummer Pick Withers left the band. His replacement was Terry Williams, formerly of Rockpile and a range of other Welsh bands including Man. \nIn 1983, a four-song EP titled ExtendedancEPlay was released while Love Over Gold was still in the album charts. It featured the hit single \"Twisting By the Pool\" which reached the Top 20 in the UK and Canada. Dire Straits also embarked on a world tour. The double album Alchemy Live, a recording of two live concerts of the group at London's Hammersmith Odeon in July 1983, was released in March 1984. Reportedly released without studio overdubs, it reached the Top 3 in the UK Albums Chart. The concert was also issued on VHS and was remastered and released on DVD and Blu-ray in 2010 - the only performance on the new format to date. \nDuring 1983 and 1984 Mark Knopfler was also involved in other projects outside of the band. He wrote the music scores for the films Local Hero and Cal, which were also released as albums. Also, during this time Knopfler produced Bob Dylan's Infidels album which featured Alan Clark on keyboards, as well as Aztec Camera and Willy DeVille. Also in 1984, John Illsley released his first solo album, Never Told a Soul, to which Mark Knopfler, Alan Clark and Terry Williams contributed. \n\n1985-1986: The Brothers in Arms era and international success:\nDire Straits returned to the recording studios at the end of 1984, and began recording tracks at Air Studios Montserrat for their upcoming fifth studio album, Brothers in Arms, produced by Knopfler with Neil Dorfsman. There were further personnel changes, with the addition of a second keyboardist, Guy Fletcher, who had previously worked as a session musician with Roxy Music and on the Cal soundtrack. Guitarist Hal Lindes left the band during the recording sessions. His replacement was New York guitarist Jack Sonni, and Andy Kanavan also joined briefly on drums; although neither was credited as an official band member for the new album release. \n\n\"Money for Nothing\"\n\nSorry, your browser either has JavaScript disabled or does not have any supported player., \nYou can download the clip or download a player to play the clip in your browser.\n\n\" Money for Nothing\" was notable for its controversial lyrics, groundbreaking music video, and a cameo appearance by Sting singing the song's falsetto introduction and backing chorus, \"I want my MTV.\"\n\nProblems playing this file? See media help. \n According to a Sound on Sound magazine interview with Neil Dorfsman, a month after the recording sessions began, drummer Terry Williams was temporarily replaced by jazz session drummer, Omar Hakim, who recorded all the drums for the album tracks during a two day stay before leaving for other commitments. Both Hakim and Williams are credited on the album, although Williams' only contribution is the improvised crescendo at the beginning of \"Money for Nothing\". The remainder of the album features Hakim on drums, but Williams would be back in the band for the music videos and the subsequent world tour. \nReleased in May 1985, Brothers In Arms entered the UK Albums Chart at number 1 and spent a total of 228 weeks in the charts. It went on to become the best-selling album of 1985 in the UK.Brothers in Arms was similarly successful in the US, peaking at No. 1 on Billboard 200 for nine weeks, going multi-platinum, selling nine million copies. The album spent thirty-four weeks at number 1 on the Australian ARIA Chart, making it the longest-running number one album in Australia. The album featured a more lavish production and overall sound than Dire Straits' earlier work, and spawned several big chart singles: \n\"Money for Nothing\", which reached number 1 on the US Billboard Hot 100, and number 4 in the UK Singles Chart, \"So Far Away\" (#20 UK, #19 US), \"Brothers In Arms\" (#16 UK), \"Walk of Life\" (#2 UK, #7 US), and \"Your Latest Trick\" (#26 UK). \"Money for Nothing\" was the first video to be played on MTV in Britain and featured guest vocals by Sting, who is credited with co-writing the song with Mark Knopfler, although in fact, it was just the inclusion of the melody line from \"Don't Stand So Close To Me\" that triggered the copyright credit, no actual lyrics were written by Sting. It also won a Grammy Award for Best Rock Performance by a Duo or Group with Vocal at the 28th Grammy Awards in February 1986. \nBrothers in Arms was among the first albums recorded on digital equipment due to Knopfler pushing for improved sound quality. The album's title track is reported to be the world's first CD single. It was issued in the UK as a promotional item distinguished with a logo for the tour, Live in '85, while a second to commemorate the Australian leg of the tour marked Live in '86. Containing just four tracks, it had a very limited run. \"Walk of Life\" meanwhile was nearly excluded from the album when co-producer Neil Dorfsman voted against its inclusion, but the band members out-voted him. The result was Dire Straits' most commercially successful hit single in the UK, peaking at number two. \"Money for Nothing\", \"Walk of Life\", and \"Brothers in Arms\" immediately became live concert favourites. \n\nThe album is listed in the Guinness Book of World Records as the first compact disc to sell a million copies, and has been credited with helping to popularise the CD format. The Brothers in Arms CD featured the full version of the \"Money for Nothing\" cut, rather than the version that appears on the LP. In fact, the CD includes extended versions of all tracks featured on the first side of the original LP, with the exception of \"Walk of Life\". \nThe 1985-86 world tour which followed the album's release was phenomenally successful. Saxophonist Chris White joined the band, and the tour began on 25 April 1985 in Split, Yugoslavia (now Croatia). While playing a 13-night residency at Wembley Arena, the band moved down the road to Wembley Stadium on the afternoon of 13 July 1985, to appear in a Live Aid slot, in which their set included \"Money For Nothing\" with Sting as guest vocalist. The tour ended at the Entertainment Centre in Sydney, Australia, where Dire Straits still holds the record for consecutive appearances at 21 nights. The band also made an impromptu attempt at the famous Australian folk song \"Waltzing Matilda\". In a two-year span, Dire Straits played 247 shows in over 100 different cities. \nAdditionally in 1985, a group set out from London to Khartoum to raise money for famine relief led by John Abbey, was called The Walk of Life. Dire Straits donated the Brothers in Arms Gold disc to the participants in recognition of what they were doing. \nThe band's 10 July 1985 concert at Wembley Arena, in which they were accompanied by Nils Lofgren for \"Solid Rock\" and Hank Marvin joined the band at the end to play \"Going Home\" (the theme from \"Local Hero\"), was televised in the United Kingdom on The Tube on Channel 4 in January 1986. (Although never officially released, bootleg recordings of the performance entitled Wembley does the Walk (2005) have been circulated.) \nIn 1986 Brothers In Arms won two Grammy Awards, and also won Best British Album at the 1987 Brit Awards.Q magazine placed the album at number 51 in its list of the 100 Greatest British Albums Ever in 2000. The album also ranked number 351 on Rolling Stone magazine's list of the \"500 Greatest Albums of All Time\" in 2003.Brothers in Arms is also ranked number 3 in the best albums of 1985 and number 31 in the best albums of the 1980s, and as of April 2012, the album was ranked the seventh best-selling album in UK chart history, and is the 107th best-selling album in the United States. In August 1986, MTV Europe was launched with Dire Straits \"Money for Nothing\". \n\n1987-1990: First break-up:\nAfter the Brothers in Arms tour ended Mark Knopfler took a break from Dire Straits and during 1987 he concentrated on solo projects and film soundtracks. Dire Straits regrouped in 1988 for the Nelson Mandela 70th Birthday Tribute concert staged on 11 June 1988 at Wembley Stadium, in which they were the headline act. They were joined for their set by Eric Clapton who performed his hit \"Wonderful Tonight\" with the group and played rhythm guitar on the other songs performed by the band, while guitarist Jack Sonni was absent. Soon afterwards, Williams left the band. \nMark Knopfler announced the official dissolution of Dire Straits in September 1988. He told Rob Tannenbaum in Rolling Stone: \"A lot of press reports were saying we were the biggest band in the world. There's not an accent then on the music, there's an accent on popularity. I needed a rest\". The tremendous success of the Brothers in Arms album and the tour that went with it left the band members under a significant amount of stress, and Knopfler announced that he wanted to work on more personal projects. A greatest hits album, Money for Nothing, was released in October 1988 and reached the number one position in the United Kingdom. Also in 1988, John Illsley released his second solo album, Glass which featured Mark Knopfler, Alan Clark, Guy Fletcher and Chris White. \nIn 1989, over a meal at a Notting Hill wine bar, Knopfler formed The Notting Hillbillies, a country-focused band whose lineup featured Guy Fletcher, Brendan Croker, and Steve Phillips and manager Ed Bicknell on drums. The Notting Hillbillies' one album, Missing...Presumed Having a Good Time with its minor hit single \"Your Own Sweet Way\", was released in 1990. The Notting Hillbillies toured for the remainder of the year, and also appeared on Saturday Night Live. Knopfler would further emphasize his country music influences on his 1990 collaboration with guitarist Chet Atkins, Neck and Neck. \nIn 1990, Dire Straits performed alongside Elton John and Eric Clapton at Knebworth Festival, playing three songs: \"Solid Rock\", \"Money for Nothing\" and a song which Knopfler prefaced as an experimental song, unsure if they should record it on a following record. The song, titled, \"I Think I Love You Too Much\", a blues rock piece with solos by both Knopfler and Clapton; this song also appeared on the 1990 album, \"Hell To Pay\" as a gift to Canadian blues/jazz artist, Jeff Healey from Knopfler. This was prior to the time that Knopfler, Illsley and manager Ed Bicknell decided to reform the band the following year. \n\n1991-1995: Resurrection, final albums and final dissolution:\nIn early 1991, Knopfler and Illsley resurrected Dire Straits, bringing back with them former keyboardists Alan Clark, and Guy Fletcher. Retaining Bicknell as their manager, Dire Straits was trimmed down and comprised only four members once again. The band began recording tracks for a new album, integrating new session players who included steel guitarist Paul Franklin, and percussionist Danny Cummings. Saxophonist Chris White returned, and guitarist Phil Palmer filled the vacancy left by Sonni. During the recording sessions, American drummer Jeff Porcaro performed in place of Williams. Afterwards, he was invited to join the band full-time but declined because of a prior commitment to Toto. \nDire Straits released their final studio album On Every Street, in September 1991, which, although a highly anticipated release, met with more moderate success and mixed reviews, as well as a significantly reduced audience, despite Dire Straits' previous international success. Some reviewers including the All Music Guide dubbed On Every Street as an 'underwhelming' follow-up to Brothers in Arms. However, it still managed to sell 8 million copies, reaching number one in the United Kingdom and number 12 in the United States. \nThe album failed to produce a major hit single in the United Kingdom. The first single release was the opening track \"Calling Elvis\", which had a video based on the 1960s television show Thunderbirds. It charted at no 21 in the UK but dropped out of the charts within four weeks. The follow-up single, \"Heavy Fuel\", failed to reach the Top 50 in the UK singles chart, however in the United States the track reached number one on the Billboard Mainstream Rock Tracks chart, their second song to do so (after \"Money for Nothing\"). Similarly, the album's title track was also relatively unsuccessful, failing to reach the UK Top 40. The final single released from the album and from the band in the United Kingdom was \"The Bug\", which contains backing vocals by Vince Gill, who was also invited to join the band full-time and declined. \nSession drummer Chris Whitten joined Dire Straits as a sideman when the band embarked on an extensive two-year, 300-show tour, playing in front of some 7.1 million ticket-buying fans. While musically more elaborate than the previous 1985-1986 world tour, the band's gruelling final tour was not as successful. It proved to be too much for Dire Straits, and by this time Mark Knopfler had had enough of such massive operations. This led to the group's second and final break-up. Bill Flanagan described the sequence of events in Gentleman's Quarterly: \"The subsequent world tour lasted nearly two years, made mountains of money and drove Dire Straits into the ground. When the tour was over, both Knopfler's marriage and his band were gone\". The last stop on the tour and the final touring concert of the group took place on 9 October 1992 in Zaragoza, Spain. \nAfter the end of the tour, Mark Knopfler expressed a wish to give up touring on a big scale, and took some time out from the music business. A live album On the Night was released in May 1993, which documented the tour, again to very mixed reviews. Nevertheless, it reached the UK Top 5, a rare achievement for a live album. The four track Encores EP was also released and rose to number one in the French singles chart. \nDire Straits' final album, Live at the BBC, was a collection of live recordings spanning the years 1978-81, which mostly featured the original lineup of the band. Released in June 1995, their third and final live album was a contractual release to Vertigo Records (now a division of Mercury Records). At this time, Mark Knopfler quietly disbanded Dire Straits and prepared to work on his first fully-fledged solo album (still signed to Mercury Records). \n\n1996-present:\nHaving disbanded Dire Straits, Mark Knopfler started his career as a solo artist, releasing his first solo album Golden Heart in March 1996 after nearly 20 years of collaborations. \nBrothers in Arms was certified nine times platinum in the U.S. in August 1996. During that year, the entire Dire Straits catalogue was remastered by Bob Ludwig and re-released on CD on Mercury Records, in most of the world outside the United States. The remasters were released in September 2000 in the United States, on Warner Bros. \nKnopfler, John Illsley, Alan Clark and Guy Fletcher reunited for one last time on 19 June 1999, with Ed Bicknell on drums, playing five songs including a performance of Chuck Berry's \"Nadine\" for Illsley's wedding. \nIn 2002, Mark Knopfler was joined by John Illsley, Guy Fletcher, Danny Cummings and Chris White for four charity concerts. Brendan Croker joined Knopfler during the first half, playing mainly material composed with The Notting Hillbillies. Illsley came on for a Dire Straits session, toward the end of which, at a Shepherd's Bush concert, Jimmy Nail came on to provide backing vocals for Knopfler's solo composition, \"Why Aye Man\". \nThe most recent compilation, The Best of Dire Straits & Mark Knopfler: Private Investigations, was released in November 2005 and reached the UK Top 20. Featuring material from the majority of Dire Straits' studio albums as well as Mark Knopfler's solo and soundtrack material, it was released in two editions, a single CD with grey cover and a double CD in blue cover. The only previously unreleased track on the album, All The Roadrunning, is a duet with singer Emmylou Harris. The album was well received. Also in 2005 Brothers in Arms was re-released in a limited 20th anniversary edition, which was a success, winning a Grammy Award for Best Surround Sound Album at the 48th Grammy Awards ceremony. \nSince the break-up of Dire Straits Mark Knopfler has shown no interest in reforming the band and is quoted as saying \"Oh, I don't know whether to start getting all that stuff back together again\", and telling reporters that \"I would only do that for a charity. I'm glad I've experienced it all - I had a lot of fun with it - but I like things the way they are.\" However, keyboardist Guy Fletcher has been associated with almost every piece of Knopfler's solo material to date, and Danny Cummings has frequently contributed, notably to three of Knopfler's most recent solo album releases All the Roadrunning (with Emmylou Harris), Kill to Get Crimson and Get Lucky. \nIn 2007, Knopfler said he did not miss the global fame that came his way at the height of the band's success, explaining that \"It just got too big\". In October 2008, John Illsley told the BBC that he wanted Knopfler to agree to reform Dire Straits for a comeback tour. Knopfler declined, saying that in the past he was often reluctant to reform the group and insisting that he \"isn't even a fan of Dire Straits' early hits\". In the same interview, Illsley also suggested that Knopfler is enjoying his continued success as a solo artist, saying that \"He's doing incredibly well as a solo artist, so hats off to him. He's having a perfectly good time doing what he's doing\". \nIn December 2009, the band was commemorated with a Heritage Award from PRS for Music. A plaque was placed on a block of flats in Deptford, London, the location where Dire Straits played their first gig. \nIn 2011, Alan Clark, Chris White, and Phil Palmer, with Tom Petty, and the Heartbreakers' drummer Steve Ferrone, put together a band called \"The Straits\", to perform at a charity show at the Albert Hall, and the band has continued to perform since. \n\nBand members:\nMain article: [url=http://en.wikipedia.org/wiki/List_of_Dire_Straits_band_members&quot;]http://en.wikipedia.org/wiki/List_of_Dire_...d_members"[/url], "site": "wikipedia", "url": "http://en.wikipedia.org/wiki/Dire_Straits", "license": {"type": "cc-by-sa", "attribution": "wikipedia", "attribution-url": "http://en.wikipedia.org/wiki/Dire_Straits", "url": "http://creativecommons.org/licenses/by-sa/3.0/", "version": "3.0"}}, {"text": "1977 - 1995", "site": "facebook", "url": "http://www.facebook.com/pages/Dire-Straits/135608713145370", "license": {"type": "unknown", "attribution": "facebook", "attribution-url": "http://www.facebook.com/pages/Dire-Straits/135608713145370", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "Biography by Stephen Thomas Erlewine Dire Straits emerged during the ...", "site": "amazon", "url": "http://www.amazon.com/Dire-Straits/e/B000ARA0V2/", "license": {"type": "unknown", "attribution": "amazon", "attribution-url": "http://www.amazon.com/Dire-Straits/e/B000ARA0V2/", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "Dire Straits emerged during the post-punk era of the late ...", "site": "mog", "url": "http://mog.com/artists/bio/mn8489/dire%20straits", "license": {"type": "all-rights-reserved", "attribution": "mog", "attribution-url": "http://mog.com/artists/bio/mn8489/dire%20straits", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "Dire Straits emerged during the post-punk era of the late ...", "site": "rdio", "url": "http://www.rdio.com/artist/Dire_Straits/", "license": {"type": "all-rights-reserved", "attribution": "", "attribution-url": "", "url": "n/a", "version": "n/a"}, "truncated": true}, {"text": "Dire Straits emerged during the post-punk era of the late ...", "site": "itunes", "url": "https://itunes.apple.com/us/artist/dire-straits/id648427", "license": {"type": "unknown", "attribution": "", "attribution-url": "", "url": "n/a", "version": "n/a"}, "truncated": true}]}}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 08:04:44
there wasn't any point in posting the content of those json files. they're from my last.fm/wikipedia bio script - nothing to do with images.

can you browse to your foobar profile\marc2003 folder, click file>open command prompt. paste in this...

Code: [Select]
cscript download.vbs http://userserve-ak.last.fm/serve/_/12048127/Dire+Straits+expresso+love.jpg "Dire Straits_12048127.jpg"


see if it works - the image should be saved in that folder.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-13 08:30:57
there wasn't any point in posting the content of those json files. they're from my last.fm/wikipedia bio script - nothing to do with images.

can you browse to your foobar profile\marc2003 folder, click file>open command prompt. paste in this...

Code: [Select]
cscript download.vbs http://userserve-ak.last.fm/serve/_/12048127/Dire+Straits+expresso+love.jpg "Dire Straits_12048127.jpg"

see if it works - the image should be saved in that folder.

I did all you  want. Result:
Code: [Select]
C:\Users\pIv>ver

Microsoft Windows [Version 6.3.9600]


C:\Users\pIv>cd c:\Users\pIv\AppData\Roaming\foobar2000\marc2003\

c:\Users\pIv\AppData\Roaming\foobar2000\marc2003>dir
 Том в устройстве C имеет метку WINDOWS 8
 Серийный номер тома: BAF4-4C55

 Содержимое папки c:\Users\pIv\AppData\Roaming\foobar2000\marc2003

13.11.2013  08:39    <DIR>          .
13.11.2013  08:39    <DIR>          ..
12.11.2013  08:19          303 024 common7.js
19.10.2013  22:19              707 download.vbs
13.11.2013  08:39    <DIR>          images
              2 файлов        303 731 байт
              3 папок  21 670 334 464 байт свободно

c:\Users\pIv\AppData\Roaming\foobar2000\marc2003>cscript download.vbs [url=http://userserve-ak.last.fm/serve/_/12048127/Dire+Straits+expresso+love.jpg]http://userserve-ak.last.fm/serve/_/120481...presso+love.jpg[/url] "Dire Straits_12048127.jpg"
Сервер сценариев Windows (Microsoft R) версия 5.8
Copyright © Корпорация Майкрософт 1996-2006, все права защищены.


c:\Users\pIv\AppData\Roaming\foobar2000\marc2003>dir
 Том в устройстве C имеет метку WINDOWS 8
 Серийный номер тома: BAF4-4C55

 Содержимое папки c:\Users\pIv\AppData\Roaming\foobar2000\marc2003

13.11.2013  12:21    <DIR>          .
13.11.2013  12:21    <DIR>          ..
12.11.2013  08:19          303 024 common7.js
[b]13.11.2013  12:21          168 291 Dire Straits_12048127.jpg[/b]
19.10.2013  22:19              707 download.vbs
13.11.2013  08:39    <DIR>          images
              3 файлов        472 022 байт
              3 папок  21 669 863 424 байт свободно

c:\Users\pIv\AppData\Roaming\foobar2000\marc2003>

But when I start foobar  Dire Straits_12048127.jpg don't load to c:\Users\pIv\AppData\Roaming\foobar2000\wsh_lastfm\961077930\ folder!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 08:48:50
strange. the purpose of that last test was checking connectivity to last.fm and also making sure .vbs files run ok on your system. obviously that's fine.

i suppose the last thing to check is to see if the original request to fetch links from last.fm is ok. save this file in your marc2003 folder: https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)

restart foobar if it's running. this time it should output a list of image links in the foobar console. if that works, then i am stumped.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-13 09:46:29
strange. the purpose of that last test was checking connectivity to last.fm and also making sure .vbs files run ok on your system. obviously that's fine.

i suppose the last thing to check is to see if the original request to fetch links from last.fm is ok. save this file in your marc2003 folder: https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)

restart foobar if it's running. this time it should output a list of image links in the foobar console. if that works, then i am stumped.

I replace common7.js with new one. Result:
Win 8:
Code: [Select]
WSH Panel Mod (Now Playing by marc2003): Parsing file "C:\Users\pIv\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Now Playing by marc2003): initialized in 71 ms
Opening track for playback: "C:\Users\pIv\Music\Foreign\Dire Straits\The Very Best Of DIRE STRAITS\04. Brothers In Arms.mpc"
Now Playing: HTTP error: 0

Win 7:
Code: [Select]
WSH Panel Mod (Now Playing by marc2003): Parsing file "C:\Users\GO\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Now Playing by marc2003): initialized in 334 ms
User Interface initialized in: 0:01.631172
Opening track for playback: "C:\Users\GO\Music\Foreign\Dire Straits\The Very Best Of DIRE STRAITS\04. Brothers In Arms.mpc"
Now Playing: [url=http://userserve-ak.last.fm/serve/_/12048127.jpg]http://userserve-ak.last.fm/serve/_/12048127.jpg[/url]
Now Playing: [url=http://userserve-ak.last.fm/serve/_/135149.jpg]http://userserve-ak.last.fm/serve/_/135149.jpg[/url]
Now Playing: [url=http://userserve-ak.last.fm/serve/_/38129505.png]http://userserve-ak.last.fm/serve/_/38129505.png[/url]
Now Playing: [url=http://userserve-ak.last.fm/serve/_/7624741.jpg]http://userserve-ak.last.fm/serve/_/7624741.jpg[/url]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 09:56:40
you can try clearing temporary files in Internet Explorer. also check it's not blocked by any security software. try browsing the last.fm site as well.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-13 10:59:53
you can try clearing temporary files in Internet Explorer. also check it's not blocked by any security software. try browsing the last.fm site as well.


My win 8.1 is clear, I don't install any antivirus and firewall software.
But foo_uie_biography work fine. This plugin load artist and album images into c:\Users\my name\AppData\Roaming\foobar2000\lastfm\album and
c:\Users\my name\AppData\Roaming\foobar2000\lastfm\artist. No any secure software blocked it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 11:23:48
My win 8.1 is clear


but did you actually go into the IE options and clear the temporary files or not? anyway, the answer doesn't really matter to me because that's my last suggestion. i can't think of anything else.

and what foo_uie_biography does is about as relevant as what i had for breakfast.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-13 12:09:18
marc2003
Of course, I clear all temporary files of IE, and also folder c:\users\piv\appdata\local\temp\. The result is the same.
In my opinion, this error occurs only on win 8.1, but not in win 7 or win 8. I check this error  too  with foobar 1.29  and foobar 1.30.



Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-13 12:17:08
marc2003
Of course, I clear all temporary files of IE, and also folder c:\users\piv\appdata\local\temp\. The result is the same.
In my opinion, this error occurs only on win 8.1, but not in win 7 or win 8. I check this error  too  with foobar 1.29  and foobar 1.30.


did your win 7 is also 64 bit?
try to install foobar in portable mode..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 12:21:50
In my opinion, this error occurs only on win 8.1, but not in win 7 or win 8.


i already mentioned it's not the OS. i'm using 8.1 myself and i've tested everything from XP SP3 (unpatched, running IE6) upwards.

Code: [Select]
I check this error  too  with foobar 1.29  and foobar 1.30.


my scripts need WSH panel mod version 1.5.0 or above and that in turn requires foobar v1.1 or above. if you didn't meet these requirements, the script wouldn't even load.
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2013-11-13 13:31:16
I had some similar problem days ago, but i don't know why suddently they were solved...
Do you have IE as default browser?
The Lasfm scripts in my config turned back fully functional when i setted Chrome ad my default browser.
marc2003 told me it was just a coincidence (and if he say so it surely is) but give it a try.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-13 17:29:29
maybe it was chrome?? but if it is, it's a pretty nasty bug on their side. having browser X installed should never, ever affect the behaviour of browser Y.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-14 00:14:24
maybe it was chrome?? but if it is, it's a pretty nasty bug on their side. having browser X installed should never, ever affect the behaviour of browser Y.


Marc, i noticed that when i delete all files in artist folder like 0124976 , it wont again download bio and image untill i clear IE temporary files. I am forced to do this every time when i delete something. This happen for bio text srcipt and thumbs. Is this normal, or i have problem?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 01:09:52
IE caches files and echonest/last.fm files have an expiry time of 24 hours if you view them. it's fairly obvious they don't want you hitting them up for the same page more than once a day. but as you can see, musicbrainz doesn't seem to care...

(https://dl.dropboxusercontent.com/u/22801321/2013/november/cache.png)

when you delete my own cached files, i guess my script hits the IE cache and displays nothing. i don't know why that is.

if you didn't delete the files my script creates, you wouldn't have this issue.

edit: i should say you can bypass this by adding a random string to the url. because the URL is "new", it bypasses whatever is in the cache. this is already implmented on some of my last.fm scripts but it cannot be implented on my bio script which uses the echonest because it rejects anything without required parameters.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-14 02:25:56
IE caches files and echonest/last.fm files have an expiry time of 24 hours if you view them. it's fairly obvious they don't want you hitting them up for the same page more than once a day. but as you can see, musicbrainz doesn't seem to care...

(https://dl.dropboxusercontent.com/u/22801321/2013/november/cache.png)

when you delete my own cached files, i guess my script hits the IE cache and displays nothing. i don't know why that is.

if you didn't delete the files my script creates, you wouldn't have this issue.

edit: i should say you can bypass this by adding a random string to the url. because the URL is "new", it bypasses whatever is in the cache. this is already implmented on some of my last.fm scripts but it cannot be implented on my bio script which uses the echonest because it rejects anything without required parameters.



thanks,i thought something was wrong with my.. i tried to disable IE to create temporary files completely, but it doesn't seem's possible..
I guess there was nothing to do, except to create option in menu to clear cache if needed, or to clear cache every time when it runs download.vbs, because you can do this from there.. but not necessary needed..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 02:32:55
to be fair, the idea of deleting the files my script creates only to download them again immediately is idiotic.

i can understand people might want to clear it out if they've accumulated a lot of info for artists which they no longer play. but that's something you'd do once a week/month- not multiple times a day.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-14 02:42:11
to be fair, the idea of deleting the files my script creates only to download them again immediately is idiotic.

i can understand people might want to clear it out if they've accumulated a lot of info for artists which they no longer play. but that's something you'd do once a week/month- not multiple times a day.


I know. I did it just to test how work google and yahoo..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 02:57:26
well you could have just said you testing your own image scripts instead of mentioning that you were deleting my bio panel's json files as well.

a quick google found this if you want a quick way to clear it.

Code: [Select]
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8


you could even launch it from within one of my panels using

Code: [Select]
p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-14 03:03:01
well you could have just said you testing your own image scripts instead of mentioning that you were deleting my bio panel's json files as well.

a quick google found this if you want a quick way to clear it.

Code: [Select]
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8


you could even launch it from within one of my panels using

Code: [Select]
p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");


thanks a lot, i think i will not need this for now, but i'll make an option in the menu for later testing. I'm trying to figure out how to download a full size image..
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-14 04:48:17
marc2003

My last experiment and perhaps this will end.
I installed a portable version of foobar2000 v. 1.30b5, then added the only component foo_uie_wsh_panel_mod (latest version), as well as your folders - samples & mark2003 (last version).
Windows 7 - the images are downloaded to the corresponding subfolders of wsh_lastfm folder.
In VirtualBox I create new VM, install Windows 8.1 only (no adds  software). I move Foobar2000 portable from Win 7 to Win 8.1 and start it.
Now for new artist the images not download to the corresponding subfolders of wsh_lastfm folder.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 05:28:54
i assume you're seeing reports of http error code 0 in the console, even on this brand new 8.1 install?

well i really am out of ideas. like i said, i'm running 8.1 myself and it works fine for me. i never test clean foobar installs either. i just copy my own folder between various OSes and it works the same in all of them.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-14 06:16:48
I add my lable (pIv) in your script  - common7.js
function images(x, y, w, h)
line 1662:
p.console("(piv) HTTP error: " + im.xmlhttp.status);

Then I start foobar on win 8.1.
Console log:
"Opening track for playback: "C:\Users\pIvMusic\Foreign\Yes\1977 - Going For The One\01. Going For The One.mp3"
Now Playing: (piv) HTTP error: 0"

That's all.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-11-14 06:28:01
hi marc,

I was wondering why you don't use allmusic for an album review/info script like the one romor made for the bio plugin instead of last.fm? it would be great to be able to download them to a text file like your other scripts enable.

Sorry if this has been answered already but my search rendered way too many results for me to sift through.

cheers
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 06:49:40
well there isn't much need as romor's script also caches data. you might have to edit the .vbs file to enable it. IIRC, it just creates one large file.

i don't think have the skills to adapt it to work with my scripts. i'm useless at understanding vbscript and parsing webpages. i might have a look later if i get really bored.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-14 09:25:11
I add my lable (pIv) in your script  - common7.js
function images(x, y, w, h)
line 1662:
p.console("(piv) HTTP error: " + im.xmlhttp.status);

Then I start foobar on win 8.1.
Console log:
"Opening track for playback: "C:\Users\pIvMusic\Foreign\Yes\1977 - Going For The One\01. Going For The One.mp3"
Now Playing: (piv) HTTP error: 0"

That's all.



Perhaps this is because in Windows 64 bit(if you use this OS, don't now), you have 2 internet explorer, one is for 32 bit , and second is for 64 bit. If foobar or script(32 bit) call's folder ''C:\program files''  windows redirects  all usage to ''C:\program files(x86)'' , i'm just guessing what might causing this problem. Don't now if foobar have support for windows 64 bit or use 32 bit version instead? It also use redirection for dll's and cscript.exe..
Also this can be some bug in window 8 install, because it works for Marc and don't work for you..
I'm using foobar v1.2.9 on windows 7  64bit in portable mod without problems..
But i was also have problem with internet explorer, if i run IE for 64 bit it crashes, but if i run IE for 32 bit it works ok...
Try to update IE, maybe this will help? And in foobar>preferences>networking try to check ''no proxy''.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 10:53:18
i don't know the real technical ins and out's but i think i can say with 99.9999% certainty that the Microsoft.XMLHTTP activex object my scripts use is 32bit only.
foobar proxy preferences are irrelevant.
IE proxy settings could affect it but obviously pIv would know to use the same settings on all OSes.
and updating IE really won't help. i've recently tested on an unpatched XP SP3 system with IE6 so obviously any version of IE11 is going to work and everything in between.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2013-11-14 15:03:50
marc2003

I found the solution. My browser (IE), when I typed in the address field last.fm redirect it to lastfm.ru.
Then, on the site lastfm.ru I changed the language from Russian to English. Now, when I type in the address last.fm I get to the site last.fm (IE cookies).
Then I started foobar2000 and download images from site last.fm in the now playing window began to work.

I think that this decision is applicable to other languages ​​for the site last.fm.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 15:16:19
heh, i did ask you to test that yesterday but you didn't answer...  if you did test, i suppose you would have used your local one anyway. and i didn't know cookies re-directed it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-14 21:57:44
@blaxima, i did have a go at attempting an allmusic review script. it does not pull the artist bio.

(https://dl.dropboxusercontent.com/u/22801321/2013/november/allmusic.png)

https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

files changed / added:
Code: [Select]
marc2003\common7.js
samples\allmusic review.txt


changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: elia_is_me on 2013-11-15 11:47:38
@blaxima, i did have a go at attempting an allmusic review script. it does not pull the artist bio.

(https://dl.dropboxusercontent.com/u/22801321/2013/november/allmusic.png)

https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

files changed / added:
Code: [Select]
marc2003\common7.js
samples\allmusic review.txt


changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)


Marc2003, I hope  you permit me to share these wsh scripts at tieba@baidu (a Chinese foobar2k forum), Some people there are learning wsh mod scripting and your work could give us great help I think ~
May I ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-15 14:10:17
do what you like. good luck to anyone trying to pick apart my mess. 
Title: WSH Panel Mod script discussion/help
Post by: elia_is_me on 2013-11-16 01:32:38
do what you like. good luck to anyone trying to pick apart my mess. 


Thank you ~
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-11-16 03:18:39
@blaxima, i did have a go at attempting an allmusic review script. it does not pull the artist bio.


THANKS!! I'll give it a go

I did take a peak at romors script and saw that cache is on by default but if I'm not connected to the net, no review displays. 

as for fetching the artist art, I'll be damned if I can get the elplaylist to get it from the art reader. I've read your pdf and added
Code: [Select]
D:\apps\foobar\wsh_lastfm\$crc32(%album artist%)\*.*
%fb2k_profile_path%\wsh_lastfm\$crc32(%album artist%)\*.*


hoping one of those would work but I'm not getting anything.
I added it to the artist and back tab as I wasn't sure if artist was supported in el

the elplaylist code is

Code: [Select]
$imageabs(xx,yy,ww,hh,%path%\%path%,artreader_artist)
$imageabs(xx,yy,ww,hh,%path%\%path%,artreader_back)


but no dice. I can get it to fetch album art with $albumart(blablahblah) but that's it. What I'm I doing wrong?

cheers, again
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-16 03:36:04
you replace $imageabs with $albumart....

Code: [Select]
$albumart(x,y,w,h,0,artist)


read the bundle text file for more options. it's tested and working fine here. and you must use an absolute folder path in the foobar artwork preferences. %fb2k_profile_path% is not recognised anywhere outside of the WSH panel mod preprocessor section.

Quote
I did take a peak at romors script and saw that cache is on by default but if I'm not connected to the net, no review displays. 


well i don't know why that is. mine most definitely displays cached data when there is no internet.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-11-16 05:11:54
you replace $imageabs with $albumart....

Code: [Select]
$albumart(x,y,w,h,0,artist)


read the bundle text file for more options. it's tested and working fine here. and you must use an absolute folder path in the foobar artwork preferences. %fb2k_profile_path% is not recognised anywhere outside of the WSH panel mod preprocessor section.

Quote
I did take a peak at romors script and saw that cache is on by default but if I'm not connected to the net, no review displays. 


well i don't know why that is. mine most definitely displays cached data when there is no internet.


any time I use $albumart, it displays only the front cover regardless of what I specify. oh well, it's not really a question for this thread I suppose.

Thanks for the allmusic script though, it's working great 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-16 05:37:58
any time I use $albumart, it displays only the front cover regardless of what I specify. oh well, it's not really a question for this thread I suppose.


there really is nothing to it. check your ELplaylist version is 0.6.9.1.2(beta) as that's what i have.

(https://dl.dropboxusercontent.com/u/22801321/2013/november/elp.png)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-16 18:27:54
In the past two days, i tested how thumbs work with yahoo. If in the search terms you enter last.fm, you get image usually from last.fm. Or if you enter allmusic you recieve image from allmusic, etc... Image quality is low, but i can't improve this. If anyone is interested to improve and modify this i can send him a link...

This is how thumbs with yahoo looks in small panel. I think it's not bad at all..

(http://img811.imageshack.us/img811/2109/bi72.png)
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-11-16 20:48:27
any time I use $albumart, it displays only the front cover regardless of what I specify. oh well, it's not really a question for this thread I suppose.


there really is nothing to it. check your ELplaylist version is 0.6.9.1.2(beta) as that's what i have.



(https://dl.dropboxusercontent.com/u/54662330/2013-11-16_154056.png)

but I guess it's a moot point if the path has to be absolute as I would want it to be more portable. I can still use the bio panel for that


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-16 21:15:30
This is how thumbs with yahoo looks in small panel. I think it's not bad at all..

200px? wow that is small. even my last.fm script set to small mode downloads 252px images. if people want to modify my script to display ridiculously small thumbs like those 40px ones, they can hold shift>right click panel>properties and edit the value of thumbs_px to whatever they like.


i don't even know what you're trying to show me?? is that 2 halves of different images? 

Quote
but I guess it's a moot point if the path has to be absolute as I would want it to be more portable. I can still use the bio panel for that

just add multiple paths in the preferences. you can't have that many different locations?? it will stop processing as soon as it encounters an image.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2013-11-16 21:52:51
i don't even know what you're trying to show me?? is that 2 halves of different images? 


yes the top was the artist image that is from the bio panel path and the bottom half($albumart) is the the album front in spite of declaring artist

just add multiple paths in the preferences. you can't have that many different locations?? it will stop processing as soon as it encounters an image.


but that won't work for my portable drive when on other systems.

again though, no worries, if the built in artreader can't do it, it can't do it. The allmusic script was what I was really after so thanks again.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-16 21:55:25
200px? wow that is small. even my last.fm script set to small mode downloads 252px images. if people want to modify my script to display ridiculously small thumbs like those 40px ones, they can hold shift>right click panel>properties and edit the value of thumbs_px to whatever they like.

My thumbs is 40px, because i use small panel, i can set larger thumbs if i want..
Dimensions of that images from yahoo is 300x 300, and i don't now how to download full size. That's why i'm saying if someone wants to modify this. I don't know is it worth to use, if stays like this..
Beside this, yahoo is good to download image, if you set right search terms in properties, as i did..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-16 22:04:32
yes the top was the artist image that is from the bio panel path and the bottom half($albumart) is the the album front in spite of declaring artist


i guess one of your $imageabs functions is being drawn but i can't really tell from here. you should check all those $if conditions again.

Quote
but that won't work for my portable drive when on other systems.


why not? the folder structure on the USB stick will be the same. so you need a new line for each possible drive letter that will be assigned to your USB stick.

Code: [Select]
D:\Applications\foobar2000\wsh_lastfm\$crc32(%album artist%)\*.*
E:\Applications\foobar2000\wsh_lastfm\$crc32(%album artist%)\*.*


i can't imagine needing more than 3-4 entries but i guess that depends on the range of pcs you use and how many partitions/optical drives they have.

if you have administrator permissions on each PC, you can even assign a drive letter well outside the range that would normally be automatically assigned like T: or something. it will then be remember the next time you plugin that same device. use disk management (diskmgmt.msc) to do that.

Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2013-11-18 22:46:12
Just for information, I also get the HTTP error: 0 with the thumbs script (or the now playing one) since I have updated to Win 8.1.
- I tried the command line from Post #2767 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77883&st=2750&p=849969&#entry849969) and it worked.
- I also changed the language from French to English since last.fm used to redirect it to lastfm.fr with IE but I still get the HTTP error: 0

Too bad
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-19 07:05:40
clear all cookies in IE and try again.

if you don't want to clear all of them, open internet options>browsing history>settings>browse files. now find and delete just the last.fm cookie(s).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-19 09:48:47
samples updated: thumbs & now playing

i've tried added in support for local last.fm sites meaning you shouldn't have to change your preference to the english site if you normally use IE when browsing.

right click>Update script and restart foobar when prompted.
now hold shift and right click the panel>properties.
edit the value of images_domain. the default is http://www.last.fm but you can try things like http://www.lastfm.de, http://www.lastfm.ru etc....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-19 11:27:26
samples updated again:

Code: [Select]
7.2013-11-19.03

"Allmusic review". Improve matching of results by converting artists &
albums to ascii strings. Also "&" and "and" are ignored.


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: Decalicatan_Decalicatan on 2013-11-19 23:32:37
samples updated: thumbs & now playing

Thank you, it's working perfectly !
Title: WSH Panel Mod script discussion/help
Post by: danny.d on 2013-11-20 10:56:16
I downloaded Marc's config (Thanks Marc, it looks awesome!!!!) on both my 32 bit Vista machine and on my 64 bit windows 7 computer.  The Vista works perfect, but I get this error on the Win 7 computer.  Also, I have the Safe Mode unchecked.

Code: [Select]
Watching: C:\Users\DANNY\Documents\FLAC
WSH Panel Mod (Autoplaylists by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Autoplaylists by marc2003): initialized in 81 ms
WSH Panel Mod (Properties by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Properties by marc2003): initialized in 10 ms
WSH Panel Mod (Art Reader by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Art Reader by marc2003): initialized in 10 ms
WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): initialized in 10 ms
WSH Panel Mod (Thumbs by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Thumbs by marc2003): initialized in 10 ms
WSH Panel Mod (Last.fm Similar Artists by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Last.fm Similar Artists by marc2003): initialized in 5 ms
WSH Panel Mod (Musicbrainz by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Musicbrainz by marc2003): initialized in 10 ms
WSH Panel Mod (Musicbrainz by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Musicbrainz by marc2003): initialized in 10 ms
WSH Panel Mod (Menu by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Menu by marc2003): initialized in 10 ms
WSH Panel Mod (WSH Playlist Viewer 2013 v0.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\wsh_br3tt\js\WSHcommon.js"
WSH Panel Mod (WSH Playlist Viewer 2013 v0.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\wsh_br3tt\js\WSHplaylist.js"
Error: WSH Panel Mod (WSH Playlist Viewer 2013 v0.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
'test' is null or not an object
File: C:\Users\DANNY\AppData\Roaming\foobar2000\wsh_br3tt\js\WSHplaylist.js
Ln: 2, Col: 1
<source text only available at compile time>
WSH Panel Mod (Playback Buttons by marc2003): Parsing file "C:\Users\DANNY\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Playback Buttons by marc2003): initialized in 10 ms
Startup time : 0:00.498933


Thanks for any help!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-20 11:06:44
yeah, that's my fault. with foobar closed, download it again and extract just the wsh_br3tt folder into your profile folder.

https://dl.dropboxusercontent.com/u/2280132...olumns%20ui.zip (https://dl.dropboxusercontent.com/u/22801321/2013/october/columns%20ui.zip)
Title: WSH Panel Mod script discussion/help
Post by: danny.d on 2013-11-20 11:22:13
Worked like a charm!  Thanks again Marc!!!
Title: WSH Panel Mod script discussion/help
Post by: bluesky2308 on 2013-11-22 12:42:06
yeah, that's my fault. with foobar closed, download it again and extract just the wsh_br3tt folder into your profile folder.

https://dl.dropboxusercontent.com/u/2280132...olumns%20ui.zip (https://dl.dropboxusercontent.com/u/22801321/2013/october/columns%20ui.zip)

How to add Refesh menu when right click Bio Tab?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-22 13:03:05
not possible but i've just updated it so it automatically updates if cached data is more than 24 hours old. due to the way the site works, you cannot check any more often that.

also, because it uses a 3rd party (theechonest.com), any changes made to the last.fm wiki pages or wikipedia articles are unlikely to show for quite sometime anyway. i must confess i have no idea how often or even IF it updates.

right click your pane>Update script to apply the change.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-22 14:23:49
just posting to say i fixed a bug introduced with the last update. if you can't right click a panel to update, this file can be saved into your marc2003 folder - https://dl.dropboxusercontent.com/u/2280132...2003/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common7.js)
Title: WSH Panel Mod script discussion/help
Post by: SilentQ on 2013-11-22 14:24:57
not possible but i've just updated it so it automatically updates if cached data is more than 24 hours old. due to the way the site works, you cannot check any more often that.

also, because it uses a 3rd party (theechonest.com), any changes made to the last.fm wiki pages or wikipedia articles are unlikely to show for quite sometime anyway. i must confess i have no idea how often or even IF it updates.

right click your pane>Update script to apply the change.
Good morning. Thanks for the great scripts. I think I have converted most of my layout to use your scripts now.

I updated this script this morning using the built-in update feature. It crashed on loading:

Error message:
"Scripting Engine Initialization Failed (Last.fm & Wikipedia Biography by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

Console message:
WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): Parsing file "C:\Users\310130299\AppData\Roaming\foobar2000\marc2003\common7.js"
Error: WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): Microsoft JScript runtime error:
'this.file.DateLastModified' is null or not an object
File: C:\Users\310130299\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 3368, Col: 6
<source text only available at compile time>

I deleted that tab from my layout, then added a new tab, set it for WSH panel mod, and pasted in a clean copy of the script from the sample archive I downloaded form your site last week, but the error still happens whenever it tries to load that script. Without the "last.fm & wikipedia biography" script everything runs great.[/s]

Edit: nvm... I update the common7.js script as listed in your post, and it works now. Thanks for the updates.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-22 19:42:52
not possible but i've just updated it so it automatically updates if cached data is more than 24 hours old. due to the way the site works, you cannot check any more often that.

also, because it uses a 3rd party (theechonest.com), any changes made to the last.fm wiki pages or wikipedia articles are unlikely to show for quite sometime anyway. i must confess i have no idea how often or even IF it updates.

right click your pane>Update script to apply the change.



Is there updates for images also? Because i modified script i don't now if this alredy exist in menu? Something that will delete old images and update with new?
and also i have problem to delete image from menu, this not work for me. i recieve error ''file is opened in foobar'' for wsh 1.4.2.
I can't use timeout in this wsh.. How to fix this?
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-11-23 17:12:51
@marc2003 : about your thumbs script, it's seem make foobar unable to exit or open console when it's still downloading image.
I notice that when thums download image, it make a process cscript for each image to download. When cscript.exe still available, foobar can't be close until you use task manager to kill cscript.exe or foobar2000.exe. 
Can you fix that
(http://i.imgur.com/ACe81qQ.png)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-23 18:14:55
yeah, that is pretty crappy behaviour. i'll see what i can do.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-23 19:07:08
it should be fixed now. right click panel>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

because of the changes i've had to make, there is no hourglass image to show it's working. i can no longer tell when images have finished downloading. instead i check the folder for new images on a timer. for that same reason, the re-scan folder option has been removed from the right click menu because it's not needed. (it's still there in custom folder mode though)
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-11-23 20:58:59
so fast, problem seem be gone, thanks you very much
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-11-24 10:12:17
When I click the last.fm link in the bio script, it says "unable to launch your default browser."

foobar seems to be able to launch other things in the browser with foo_run. Any idea what could cause this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-24 10:20:57
2 things...

-if you hover your mouse over the button, do you see a tooltip? does the URL look properly formed?
-press winkey + R to bring up the Run dialog. does typing a web address (eg http://www.hydrogenaudio.org) (http://www.hydrogenaudio.org)) into that launch your browser?
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-11-24 11:09:06
I don't see a tooltip when I hover over the button.

Launching with the Run dialog does work.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-24 11:19:38
i think i've fixed what's wrong. right click panel>Update script.

thanks for spotting it.
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-11-24 12:04:52
I updated and now the panel just crashes immediately.

EDIT: That's not entirely accurate. It crashes as soon as I select an artist. On the plus side, the button does work without anything selected.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-24 12:14:17
oops, let's try again. if you don't have another one of my panels to run the update from, save this in your marc2003 folder.

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common7.js)
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2013-11-24 12:16:19
Everything looks good now. Thanks for the quick fixes!
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-24 14:09:01
it should be fixed now. right click panel>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

because of the changes i've had to make, there is no hourglass image to show it's working. i can no longer tell when images have finished downloading. instead i check the folder for new images on a timer. for that same reason, the re-scan folder option has been removed from the right click menu because it's not needed. (it's still there in custom folder mode though)


great, the problem is gone, thanks for update
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-11-24 16:45:36
@marc2003 : One more small thing about thumbs script (and probably artreader too)
When show image in center or stretch type, left & top border seem not sharp like right & bottom border.
For me it's not a big problem, but can you fix it
(http://i.imgur.com/KvHysP5.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-24 18:23:54
update your script and see if it's any better.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2013-11-25 00:38:01
@marc2003
I'm new to this site. First, thanks for all your work on these scripts. I have one request. lastfm does not always have photos or bios of artists I play. Your "now playing" script still creates a folder with the "artist.getInfo_mod.json" file. I would like the "open containing folder" option to always be available. That way I can add my own photos to the folder.
Otherwise, it is very difficult for me to find out which folder belongs to which artist because the filenames are crc32 coded.
Thanks in advance.
Title: WSH Panel Mod script discussion/help
Post by: Godly on 2013-11-25 04:02:21
Just want to say thanks Marc2003 for all the scripts and the work you put into them. I made the switch from itunes to f2k last week and have spent the time since then playing around with them, trying to get the perfect layout. I think I've managed it now. Cheers!
Title: WSH Panel Mod script discussion/help
Post by: kjllmeplz on 2013-11-25 05:48:43
update your script and see if it's any better.


yes, it's work, thank you 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-11-25 08:08:02
I would like the "open containing folder" option to always be available. That way I can add my own photos to the folder.


done. right click panel>Update script.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2013-11-25 08:37:40
@marc2003
Much Thanks! Works great.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-11-28 17:09:59
WTF.  Today i go on last.fm.. radio works again. It's now based on youtube, not bad  , it would be good if we can listen radio in foobar as before.
..I check this again, it is based on youtube, but it seems that sound is converted in mp3 format while you listen..
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-12-01 17:36:17
marc2003 - thanks for the new allmusic review script.  If easy to do, can you expose the artist and album values passed to the function that does the search (via the properties menu in the allmusic review script would be fine), so that users can tweak these with title formatting?  Such an ability will help with finding more matches.  Thanks as always for your efforts.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-01 18:40:04
done. right click panel>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-12-01 21:24:35
That you also added it to the context menu for the script is great.  Thanks!
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-12-01 23:43:38
Is possible to somehow tell script that read 'artist_tf' from %title%, if i don't have tagged files. Example: When i have song in format %artist% - %title%. What titleformating to use to extract only first part of that string, which is the artist? Basically i have ''%artist% _something'' or ''%artist% - something'' in title?

Would be good if i don't have to waste my time for tagging..
Title: WSH Panel Mod script discussion/help
Post by: d125q on 2013-12-09 11:07:49
What is the sanest way to check if a certain metadata field is present in a track? Would it be fb.TitleFormat("$meta_num(field)").EvalWithMetadb(metadb) > 0 or something else entirely?

EDIT: Okay, I guess fb.TitleFormat("[%field%]").EvalWithMetadb(metadb) does the trick much better.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2013-12-09 22:05:53
marc2003, regarding your lastfm & wiki biography script: it works great, but if not too difficult it would be even better if it could handle multivalues for the artist variable.  For now, I manually modify the number in "$meta(artist,0)" in the artist remapping to see the bios of different artists in songs with multiple artists (common for my jazz and classical songs).  If you see value in it and not difficult, it would be great if a user could choose from the context menu one of the artists when more than one artist is detected.  Thanks as always!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-10 01:30:21
it's a bit too tricky really so i won't be doing it.

you can try this button i made instead. when clicked, it provides a menu listing all values in the artist tag and will launch the last.fm website when you select one.

https://dl.dropboxusercontent.com/u/2280132...io%20button.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/bio%20button.txt)
Title: WSH Panel Mod script discussion/help
Post by: gothfox on 2013-12-10 18:10:25
Is it possible to (optionally) only show artists existing in the database in last.fm similar artists panel? Either that or display those in a different color. When set to generate autoplaylists on click it would make sense to see if the playlist is not going to be empty because you don't have the artist in the database.

I tried to figure it out but I'm afraid this foobar scripting is way over my head.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-10 18:20:27
sorry but that isn't possible. there are no library functions in WSH panel mod.
Title: WSH Panel Mod script discussion/help
Post by: foo_csx on 2013-12-10 22:41:29
Hey is this a known bug, where .FillGradRect() focus is off by one pixel on certain positions with certain heights?

Code: [Select]
var ww = 0, wh = 0;

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

a = 0xfff00000;
b = 0xff000000;
function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, 0xff666666);
    for(var j = 0; j < 50; j++)
        for(var i = 0; i < 100; i++)
            gr.FillGradRect(1 + i + j, j + 1, 1, 100 - i - 10, 90, a, b);
    gr.FillGradRect(60, 60, 50, 51, 90, a, b);
}
shouldn't result in this:

(http://i.imgur.com/iA0QhfB.png)

or am I missing something?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-10 23:13:28
it definitely looks like a bug. just that square on its own with the odd number height illustrates that. as the component is no longer developed, you'll probably have to find a workaround for this yourself.
Title: WSH Panel Mod script discussion/help
Post by: foo_csx on 2013-12-10 23:45:55
Setting the angle a bit offset seems to work out okay I guess. For now probably better than digging through the whole sourcode.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2013-12-11 10:49:27
Marc. I put a modified version of your script here: http://mire777.deviantart.com/art/WSH-Biog...C2000-419126433 (http://mire777.deviantart.com/art/WSH-Biography-for-xch4nge-MARC2000-419126433)
,especially for xch4nge skin. Is this ok? I hope you do not mind?
If this is a problem, i will delete file.. I ask for your permission?
I wanted to help people who use this skin, because default script wont work..
Title: WSH Panel Mod script discussion/help
Post by: ehrgeiz on 2013-12-16 20:00:59
hey marc,
i ran into a problem using your "now playing script": it doesn't download any artist pictures any more.
console says "Now Playing: HTTP error: 0 "
if there are existing pictures it works fine, also fetching biography works, just downloading pictures wont.
i replaced all files and scripts with the newest version using foobar2000 v1.2.6 (edit: updated to 1.2.9)
do you have any advice how to find out whats causing the problem?

thx a lot

edit: thank you for the quick answer although you told someone else already a few pages earlier (i blame it on the shitty search function ;P)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-16 20:10:12
this happens if you use IE to browse any localised version of the last.fm website (not the english one). hold shift and right click the panel. edit the value of images_domain to whichever last.fm site you use like http://www.lastfm.de, http://www.lastfm.ru etc....

edit: i've updated the script and put a "Help" dialog in a more prominent place with an explanation of recent changes:

(https://dl.dropboxusercontent.com/u/22801321/2013/december/help.png)

right click panel>Update script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-17 01:17:29
i just realised i forgot to bump the version number on the last update meaning the Update script feature would not work. it's fixed now. 
Title: WSH Panel Mod script discussion/help
Post by: redsky on 2013-12-21 23:26:34
Hi marc,

Was hoping you could help, I'm running Br33t's DUiTunes skin using WSH Panel Mod 1.5.6 and I'm seeing:

Code: [Select]
Error: WSH Panel Mod (DUiTunes Playlist Viewer v1.0.0 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
Invalid procedure call or argument
File: C:\foobar2000 1.2.9_3\wsh_br3tt\js\WSHplaylist.js
Ln: 2186, Col: 17


Not sure if this is related to the plugin or Playlist Viewer (it happens when I switch to the Playlist Viewer) but was hoping you could point me in the right direction.

Many thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-22 06:41:44
i can't help with that. i generally provide help for scripts i make or i can help people stuck with their own simpler scripts. i'm not looking at thousands of lines of code i didn't make....  just like you wouldn't expect anyone else to fix a problem with my scripts.

falstaff will probably read this at some point so you should wait for his answer or you can post on his deviantart page.
Title: WSH Panel Mod script discussion/help
Post by: vanhoivanbinh on 2013-12-25 04:25:52
Hello Marc2003
I appreciate your works to customize Foobar2000 very much
I look at your Rating panel (separate panel using WSH panel mod) but the download links are outdated.
Could you provide me the updated link since I really need a separated rating panel to rate my current playing song quickly rather than browse my whole library.

THANK YOU VERY VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Title: WSH Panel Mod script discussion/help
Post by: vanhoivanbinh on 2013-12-25 04:30:01
here's another script for DUI. it's a ratings panel that displays the current rating and of course lets you set it. it works with the official playback statistics component. it has the same context menu options as the "buttons" panel above to set the background colour.

when foobar is playing it sticks to now playing. and when playback is stopped, it follows the cursor.

just copy/paste this code into a new panel and download these images and extract them to your foobar folder.

(credit to NEMO7538 for providing the original rating code)

script: http://javascript.pastebin.com/f5450d71a (http://javascript.pastebin.com/f5450d71a)
images: http://cid-649d3bfeaf541fbb.skydrive.live....uide/rating.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/rating.zip)
screenshot: http://k5sbdw.blu.livefilestore.com/y1pQER...-BTE/rating.png (http://k5sbdw.blu.livefilestore.com/y1pQEROMvP8PeG-iiDic9gDEb2TxQrfW45PGezY61A9hdyduzWqDXS-Sa3RLcYHr9lLW4ecDYwTRkyiy1DHBRx9fqlsVp9B-BTE/rating.png)


This is the panel I cannot download
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-25 09:28:03
https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

the script you want is named rating.txt and make sure to check the readme as well.
Title: WSH Panel Mod script discussion/help
Post by: mrlex on 2013-12-26 12:12:23
Hi Marc, I have been using your scripts for over a year now and the are all amazing!
I logged back on today and grabbed your most up to date versions and have updated my config

Since updating though I seem to get errors. Whenever I right click a panel the component crashes due to a script error.

This seems to be the case for most of the scripts I use (Bio, Similar Artists, AllMusic Review).
I made sure I had Safe mode unticked

Do you have any ideas what the issue might be?

Thanks again!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2013-12-26 12:25:46
if it happens when right clicking, i expect it's because your WSH panel mod component is out of date. my latest scripts require v1.5.0 or above (current version is 1.5.6 available here (http://code.google.com/p/foo-wsh-panel-mod/downloads/list).)
Title: WSH Panel Mod script discussion/help
Post by: mrlex on 2013-12-26 13:02:56
Genius! Thanks so much

For some reason I never even though to check this (pretty stupid of me)
Title: WSH Panel Mod script discussion/help
Post by: foomark on 2014-01-03 09:50:24
I'm using this WSH playlist (Link (http://www.deviantart.com/art/WSH-Playlist-2013-v0-0-8-368997689)) and until today i had no problem.
Yesterday i installed the new version od foobar2000 (1.3) and now the playlist crash at startup, it give me a run-time error:

'oList' undefinied
File: <main>
Ln: 349, Col: 9
<source text only available at compile time>

Any idea on how to solve it?

Title: WSH Panel Mod script discussion/help
Post by: foomark on 2014-01-03 11:19:50
I'm using this WSH playlist (Link (http://www.deviantart.com/art/WSH-Playlist-2013-v0-0-8-368997689)) and until today i had no problem.
Yesterday i installed the new version od foobar2000 (1.3) and now the playlist crash at startup, it give me a run-time error:

'oList' undefinied
File: <main>
Ln: 349, Col: 9
<source text only available at compile time>

Any idea on how to solve it?


Auto quote

Solved, sorry for the stipid question.
Title: WSH Panel Mod script discussion/help
Post by: Vectronic on 2014-01-06 01:57:17
I don't know if this is a stupid question, but how can you set a (any) property of an item in a playlist?

I'm trying to create a script that compares the active playlist to a "Favorites" playlist, if there are matching items... then... .. . ?

Right now I'm just using nested for() loops... and it can find items, and I can copy/add/remove them from a playlist, but I would rather keep them in-place, and just change the background color, or change any sort of tag at all.

tl;dr... is there a .Item(i).tag("x") = "y" .. sort of possibility?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-06 03:55:07
you can use UpdateFileInfoSimple to update the tags. presumably you're looping through playlist items something like this...

Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
for (i = 0; i < items.count; i++) {
    //this code would update every file but you'll have if statements or whatever...
    items.item(i).UpdateFileInfoSimple("TAG", "VALUE");
}
Title: WSH Panel Mod script discussion/help
Post by: Vectronic on 2014-01-06 04:26:01
Thank you... I was already half-way through coding my own playlist. Being able to make use of the existing/default one is much easier.

And yes, simplified: for each Favorite {find in CurrentList { do stuff;break; }}... since one of the playlists is always at least 1700 songs... it's not particularly speedy, but it makes tracking favorites much easier to reduce duplicates, or just find them in other playlists.
Title: WSH Panel Mod script discussion/help
Post by: Vectronic on 2014-01-06 15:05:19
Found a bug/error/freeze... this thread is too long to search, and a quick web search didn't result in anything, might be a known issue.

Code: [Select]
        var x = 100;
        var y = 100;
        while(x--){
            while(y--){
                fb.trace(y);
            }
        }


That while will cause WSH/FB to freeze... when it shouldn't. It doesn't completely freeze Foobar instantly... just the UI... if a song is playing it will continue until the end, but not the next track.

A single while(--) loop works well and is slightly quicker than comparable for(--/++) loop... but nesting them crashes... the second loop seems to go past 0... 5, 4, 3, 2, 1, -2...etc... it's strange.

JScript, Windows 8, Foobar 1.3.1 B1, WSH 1.5.6

It's not a CPU limit/freeze either... it's only using about 40 to 70% of one core (i5 3570K @ 4.5GHz - completely stable 24/7 overclock).

For anyone interested, I went with the custom playlist (http://i.imgur.com/Iasqtxd.png) anyways... it's the small one at middle bottom, those 3 auto-hide.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-06 17:39:18
i'd expect the script to hang because you're not telling it when to stop. i tried the code in a browser using console.log and that also hangs.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2014-01-07 00:29:17
Hi marc,

I've got another question for ya mate.

What would be the path be to get the bio and reviews saved to the corresponding playing songs folder? Right now I have an "Image" folder created by the bio panel that places an album.jpg and artist.jpg and I think I would prefer files to be placed within the albums and genre media folders rather than inside the foobar install. For example the artist  path is      $replace(%path%,%filename_ext%,Images\%artist%)    which I would assume isn't the same for the WSH panel, or am I wrong?

Cheers
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-07 01:37:14
unless you had all tracks by the same artist in the same folder, it would break my scripts.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2014-01-07 03:27:20
All the tracks in some folders are;

Structure is like this
Genre\Artist\2014 - Album\01 - track, 02 - track, etc..

but I do have some random songs in just the genre folder so I guess that's were I would run into problems

thanks for the quick response
Title: WSH Panel Mod script discussion/help
Post by: Vectronic on 2014-01-07 13:31:36
i'd expect the script to hang because you're not telling it when to stop. i tried the code in a browser using console.log and that also hangs.

It evaluates to a boolean... so while(int > 0) it's "true"... so stepping any positive integer by -- will become "false" when it gets to zero, or -1 depending on the boolean method... so while(i--) should stop when it reaches 0 and it does for a single while() loop, but not for a nested while().

2 = true
1 = true
0 = false
-1 = false
etc...

It should only fail if the value starts at 0 or -1... since then it will always be "false", so it becomes while(false) which will always be true. :| ...lol

Edit: answered my own problem... second loop is comparing false to false once it has passed the first sub loop... so need to re-set Y to > 0... forehead/desk, etc.

For anyone interested:
Code: [Select]
var x = list.length/count/ubound/etc;
var y = list.length/count/ubound/etc;
var z = y;
while(x--){
    //do something with x, A = B(x) etc.
    y = z;
    while(y--){
        //do stuff with x/y
    }
}

Is WAY quicker than any for() loops... in my loop, when using: *.item(x).Compare(*.item(y)) ... it's easily 3 times as quick.

Also... using WSH item.compare() is quicker than fb.TitleFormat()... and slightly quicker than item(x).Path === item(y).Path... I dropped my list comparison from about 5 seconds, down to about 300ms.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-07 13:53:32
well that just shows how much i (don't) know.

i thought the while loop would continue below 0.
Title: WSH Panel Mod script discussion/help
Post by: d125q on 2014-01-07 20:55:21
i'd expect the script to hang because you're not telling it when to stop. i tried the code in a browser using console.log and that also hangs.

It evaluates to a boolean... so while(int > 0) it's "true"... so stepping any positive integer by -- will become "false" when it gets to zero, or -1 depending on the boolean method... so while(i--) should stop when it reaches 0 and it does for a single while() loop, but not for a nested while().

2 = true
1 = true
0 = false
-1 = false
etc...[/code]
Is WAY quicker than any for() loops... in my loop, when using: *.item(x).Compare(*.item(y)) ... it's easily 3 times as quick.

Also... using WSH item.compare() is quicker than fb.TitleFormat()... and slightly quicker than item(x).Path === item(y).Path... I dropped my list comparison from about 5 seconds, down to about 300ms.


You're wrong on this one. Only 0 and -0 are considered false. All other values (1, -1, 2, -2...) are considered true. The issue with your original loop is the following: the inner loop (dependent on y) exits during the first iteration of the outer loop when y reaches 0 (and is decremented to -1). All subsequent runs of the inner loop will pick y up from -1 and go downwards, never able to reach 0 again and thus exit, resulting in an infinite loop.

EDIT: To put it simply, while(y) is equivalent to while(y != 0), not while(y > 0) (where y is an int).
Title: WSH Panel Mod script discussion/help
Post by: Pintu on 2014-01-14 21:47:58
Hi Marc, thanks a lot for your great work over the years. I've been using the "Now Playing" panel for a while, and is it possible that the Auto Download function is not longer working? I'm aware of the changes, i.e. that downloads are slower, but that does not appear to be the issue:

Essentially, images are not being loaded unless I specifically click on "Download Artist Art", and then it's downloaded within a few seconds. But with download on automatic and without a manual click nothing is being downloaded for the length of a full song.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-14 23:06:12
automatic downloads are still working here. even though i had to make changes to the way my script gets images, the automatic download bit is still the same as before.
Title: WSH Panel Mod script discussion/help
Post by: Pintu on 2014-01-16 11:52:50
I've narrowed the problem down a bit, and the problem appears to be quite specific. You are right, automatic downloads work fine when playing local files.

But I'm streaming music from my Android (via Cast To UPnp/DLNA (https://play.google.com/store/apps/details?id=com.bubblesoft.android.upnpcast)). Automatic downloads work most of the time when manually starting a track on Google Music, but not when playing a playlist and tracks automatically change. In that case, image downloads are never triggered, but work fine when clicking on image download.

I realise this is a very specific problem. But is there something you could do about it?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-17 04:20:59
sorry but i have no idea how upnp works and i have no way to reproduce the scenario you are faced with.
Title: WSH Panel Mod script discussion/help
Post by: Pintu on 2014-01-17 11:16:05
Sure, I realise this is an unusual scenario. Would it be possible to associate a keyboard shortcut to manually trigger downloads? That way I could use my remote control...
Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2014-01-18 10:54:55
Hi marc2003, I see you added AUTOPLAYLIST function to your last fm charts script, this is awesome !

Thank you for this hundred time  !

But every time I reboot or restart foobar, it's automatically on lastfm, i have to change to autoplaylist every time, I know it's not a big deal but how is it possibl to let it on Autoplaylist ?

Thanks  !
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-18 12:33:02
@Pintu, i know it's possible to make WSH panel mod respond to key presses but it can't be global. foobar must have focus and it has to the last panel you clicked. if anything else has focus it won't work. also, i can't really build a UI to change the setting. you need to need to tell me which key you want to use and i'll try and make it work.

@jahtimes, that's a bug - well spotted! it's now fixed. right click panel>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2014-01-18 12:35:27
@Pintu, i know it's possible to make WSH panel mod respond to key presses but it can't be global. foobar must have focus and it has to the last panel you clicked. if anything else has focus it won't work. also, i can't really build a UI to change the setting. you need to need to tell me which key you want to use and i'll try and make it work.

@jahtimes, that's a bug - well spotted! it's now fixed. right click panel>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)


Thanks for the quick reply, as usual... Perfect !
Title: WSH Panel Mod script discussion/help
Post by: ubercow on 2014-01-18 17:09:49
hi marc, I love the option to click in the charts to make playlists - makes a lot of sense. Do you think you could add an option to make normal playlists not autoplaylists though? If your library is stable there isn't much need for autoplaylists and having many of them slows down foobar noticably on startup when all the queries have to be run again. Thanks, hope you're well 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-18 23:41:30
using autoplaylists is the only way i can create a playlist with a given artist/album/track. i suppose it might be possible to create a hack that creates an autoplaylist, copies the content to a new playlist and then removes the autoplaylist. i might have a go at that tomorrow.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-19 00:55:08
i've just done it now and it seems to work ok. open the editor dialog and replace the very last function....

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    li.lbtn_up(x, y);
}


with

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    if (li.lastfm_link == "autoplaylist" && li.in_range && x > li.x + li.text_x && x < li.x + li.text_x + Math.min(li.names_widths[li.index], li.text_width)) {
        fb.CreateAutoPlaylist(fb.PlaylistCount, li.names[li.index], li.queries[li.index]);
        plman.DuplicatePlaylist(fb.PlaylistCount - 1, li.names[li.index])
        plman.RemovePlaylist(fb.PlaylistCount - 2);
        fb.ActivePlaylist = fb.PlaylistCount - 1;
    } else {
        li.lbtn_up(x, y);
    }
}
Title: WSH Panel Mod script discussion/help
Post by: ubercow on 2014-01-19 02:58:20
Yeah I realised that it would require a different method completely just after I posted - thanks though this way seems to work great! I'm going to use this a lot, really appreciate it
Title: WSH Panel Mod script discussion/help
Post by: Pintu on 2014-01-19 11:59:13
@Pintu, i know it's possible to make WSH panel mod respond to key presses but it can't be global. foobar must have focus and it has to the last panel you clicked. if anything else has focus it won't work. also, i can't really build a UI to change the setting. you need to need to tell me which key you want to use and i'll try and make it work.


Marc, thanks a lot. F9 would be a good one, but I (or anyone else) could remap it with Autohotkey to use a different one, as long as there is some hotkey programmed.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-19 13:05:29
it's easy enough to change the key in the script. i just wasn't prepared to make any kind of UI to do it. just stick this in the panel somewhere.

Code: [Select]
function on_key_down(vkey) {
    if (p.metadb && vkey == 120) im.download();
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-01-22 08:21:51
Marc i need your help, is it possible to tell script to open properties window in desired size? I want that most of my settings be in properties, not in the menu, so i need that window be longer than usual to be able to see all text..
It should look like this:

(http://imageshack.com/a/img600/2383/1k3v.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-22 08:32:15
of course not. you can open it with window.ShowProperties() and that's it. there are no options.

i suppose you could fix the size to something larger if you downloaded the source code, made adjustments and re-compiled it.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-01-22 08:47:14
of course not. you can open it with window.ShowProperties() and that's it. there are no options.

i suppose you could fix the size to something larger if you downloaded the source code, made adjustments and re-compiled it.


Uh, not worth . I'll use menu then. Thanks..
Btw, do you know what compiler to use and what program i need to change foobar equalizer color? It's possible, it have source code somewhere on net..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-22 08:52:03
obviously you could do it with visual studio. i have no idea if it's possible with anything else.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-01-22 08:55:02
obviously you could do it with visual studio. i have no idea if it's possible with anything else.


I'll try this. Thanks..
Title: WSH Panel Mod script discussion/help
Post by: Pintu on 2014-01-22 11:51:39
it's easy enough to change the key in the script. i just wasn't prepared to make any kind of UI to do it. just stick this in the panel somewhere.


Excellent, that works great. I've combined it with the following AutoHotKey Script to trigger the Keypress in the Panel every time the foobar2000 window title changes (which for shows "foobar2000 - %artist%).

Code: [Select]
#Persistent
SetTitleMatchMode, 1

WinGetTitle, TitleLast, foobar2000
SetTimer, CheckChanged, 1000;Check every quarter-second
return

CheckChanged:
WinGetTitle, Title, foobar2000
If (Title <> TitleLast)
{
    click 1000, 200
    Send {F9}
}
TitleLast := Title
return
Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2014-01-22 19:44:08
Hi marc2003 !

In your autoplaylists WSH panel mod, is it possible to "SORT DESCENDING BY"

For example, in my media library search when I type : %added% DURING LAST WEEK SORT DESCENDING BY %added%
I have a playlist with most recent added album at the top of my playlist. With your autoplaylists WSH I have the most recent added album at the bottom of my playlist.
I don't know if it's possible to change this.

Sorry for bad english, hope you've understood me.
Title: WSH Panel Mod script discussion/help
Post by: colagen on 2014-01-23 21:37:16
Hi,

Do you know if someone out there developed a script for WSH similar to foo_graphical_browser ?
I tried quickly yesterday to adapt the coverflow script made by falstaff to make it display a grind of covers instead of just one row of covers, but it seems to require quite some work, i gave up.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-24 07:19:42
In your autoplaylists WSH panel mod, is it possible to "SORT DESCENDING BY"


i assume you're talking about either my last.fm similar artists or last.fm charts script? right click the panel>configure and replace this function right at the end...

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    li.lbtn_up(x, y);
}


with

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    if (li.lastfm_link == "autoplaylist" && li.in_range && x > li.x + li.text_x && x < li.x + li.text_x + Math.min(li.names_widths[li.index], li.text_width)) {
        fb.CreateAutoPlaylist(fb.PlaylistCount, li.names[li.index], li.queries[li.index] + " SORT DESCENDING BY %date%");
        fb.ActivePlaylist = fb.PlaylistCount - 1;
    } else {
        li.lbtn_up(x, y);
    }
}


@colagen, i don't know of any WSH script. facets and/or esplaylist can display your library in a grid view showing all covers. obviously you don't have much control over appearance. you can enable/disable/customise text and that's about it.
Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2014-01-24 09:33:07
Quote
i assume you're talking about either my last.fm similar artists or last.fm charts script? right click the panel>configure and replace this function right at the end...


Nope marc2003, I talk about your autoplaylists script this one :

(http://i.imgur.com/y7S9HXZ.png)

Is it possible to sort descending by with this script ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-24 09:39:06
you must be joking? 

you set that yourself when you create the query. also, you can edit existing queries. check the icon tooltips when you hover you mouse over the panel.

make sure you edit the main query, not the sort pattern. the sort pattern dialog only accepts standard title formatting, not the query syntax.
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-01-24 10:19:53
Hello guys, got a question here.

I'm trying to implement AutoDJ/iTunesDJ button for my layout and I've gotten this far:
with Random pools plugin I made a playlist that's automatically being filled up with tracks depends on few priority rules (excluding some genres, considering rating etc.), then with Playlist Attributes I modify playback order of this particular playlist and remove played tracks to keep it nice and clean.

So at this point what I want is to create a button that would select this "Auto DJ" playlist and start playback.

I tried to make such a button with PSS script,
Code: [Select]
$textbutton(0,$sub(%_height%,15),%_width%,18,AutoDJ,AutoDJ,COMMAND:View/Switch to playlist/Auto DJ,fontcolor:250-250-250,fontcolor:170-220-255)

but it didn't work, so can somebody please assist me with creating WSH panel with button like this?

Thinking about that again... It would also be really cool if that button could remove all the tracks from that playlist except the last one (before starting playback). Is that even possible?

EDIT: oh yes, this is what I've done so far:
Code: [Select]
function on_mouse_lbtn_down(){
    if(DJButton.Down()){
        var pl_dj;
        for (var i = 0; i < plman.PlaylistCount; i++) {
            if (plman.GetPlaylistName(i) == "Auto DJ") {
                //return i;
                pl_dj = i
            }
        }
        fb.ActivePlaylist = pl_dj;
    }
}

So it selects this playlist, but how do I focus (lets say last item) from this playlist and start playback?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-24 15:48:05
Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
plman.ExecutePlaylistDefaultAction(plman.ActivePlaylist, items.count - 1);
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-01-24 21:16:46
Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
plman.ExecutePlaylistDefaultAction(plman.ActivePlaylist, items.count - 1);

Great, thanks, man, playback works!

And the other part of my question concerning removing tracks from the playlist... here's what I did:
Code: [Select]
    if(DJButton.Down()){
        var pl_dj;
        
        for (var i = 0; i < plman.PlaylistCount; i++) {
            if (plman.GetPlaylistName(i) == "Auto DJ") {
                pl_dj = i;
                break;
            }
        }
        plman.ActivePlaylist = pl_dj;
        var items = plman.GetPlaylistItems(plman.ActivePlaylist);
        plman.ExecutePlaylistDefaultAction(plman.ActivePlaylist, items.count - 1);

        //var itc = fb.PlaylistItemCount(plman.ActivePlaylist)
        for (var i = 0; i < items.count; i++) {
            if (i < (items.count - 10)) {
                plman.SetPlaylistSelectionSingle(plman.ActivePlaylist, i, 1);
                plman.RemovePlaylistSelection(plman.ActivePlaylist);
                }
        }
    }
}

aaand it somewhat works, but the playback doesn't _always_ start, when i have some items selected from this playlist it removes more than it's required and doesn't start the playback.

There must be a better and more efficient way of doing this, that's what I tried:
Code: [Select]
        var pl_dj;
        
        for (var i = 0; i < plman.PlaylistCount; i++) {
            if (plman.GetPlaylistName(i) == "Auto DJ") {
                pl_dj = i;
                break;
            }
        }
        plman.ActivePlaylist = pl_dj;
        var items = plman.GetPlaylistItems(plman.ActivePlaylist);
        plman.ExecutePlaylistDefaultAction(plman.ActivePlaylist, items.count - 1);

        var tracks = new Array()
        for (var i = 0; i < items.count; i++) {
            tracks.push(items.item(i));
        }
        for (var i = 0; i < (tracks.length - 10); i++) {
            plman.SetPlaylistSelection(plman.PlaylingPlaylist, tracks[i], 1)
            plman.RemovePlaylistSelection(plman.PlaylingPlaylist);
        }
        tracks.length = 0;
    }
}

aaaand it didn't work :/ (Invalid procedure call or argument Ln: 83, Col: 13 [plman.SetPlaylistSelection(plman.PlaylingPlaylist, tracks, 1) <-- this line] )
So what's the proper way of doing this ?

Once again, sorry for my lack of JS knowledge, it's been quite a while since I've done any coding, not to mention I've never touched JS...
Title: WSH Panel Mod script discussion/help
Post by: colagen on 2014-01-24 21:37:47
@colagen, i don't know of any WSH script. facets and/or esplaylist can display your library in a grid view showing all covers. obviously you don't have much control over appearance. you can enable/disable/customise text and that's about it.


I did something finally today, it's quite a harsh edit of the coverflow script, the scrollbar behave a little bit oddly now, and some features won't work anymore, i did this only for myself so i won't go further
But if someone here want a basic cover browser and isn't afraid of bugs, the code is here (http://pastebin.com/sZcxk3j8). Personally i use it with a column UI "genre" filter on the left, it's quite eye candy
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-25 01:17:14
plman.PlaylingPlaylist


Playling should be Playing. there was typo in the file interface.api (inside the component folder) which provides auto-completion in the editor. the latest version of the component doesn't have this problem.

also, i'd use this to play the last track and remove everything else....

Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
plman.ExecutePlaylistDefaultAction(plman.ActivePlaylist, items.count - 1);
plman.ClearPlaylistSelection(plman.ActivePlaylist);
plman.SetPlaylistSelectionSingle(plman.ActivePlaylist, items.count -1, true);
plman.SetActivePlaylistContext();
fb.RunMainMenuCommand("Edit/Selection/Crop");
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-25 01:53:19
But if someone here want a basic cover browser and isn't afraid of bugs, the code is here (http://pastebin.com/sZcxk3j8). Personally i use it with a column UI "genre" filter on the left, it's quite eye candy


for something with such a simple appearance, you might as well use EsPlaylist. you can have it bound to a playlist but i prefer to have it display my library.

(https://dl.dropboxusercontent.com/u/22801321/2014/january/esp.png)
Title: WSH Panel Mod script discussion/help
Post by: colagen on 2014-01-25 09:14:17
for something with such a simple appearance, you might as well use EsPlaylist. you can have it bound to a playlist but i prefer to have it display my library.


Yes, i've saw that, but i'm more confortable with WSH than the pseudo-code of esplaylist, and wsh allow me to have exactly the behaviour or the options i want, (well, at the expense of the time spent to code them myself)
i'll probably edit this script later to browse by artist by default, and by albums of the selected artist when i'll click on an artist or something like that ...
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-01-26 02:19:19
plman.PlaylingPlaylist


Playling should be Playing. there was typo in the file interface.api (inside the component folder) which provides auto-completion in the editor. the latest version of the component doesn't have this problem.

also, i'd use this to play the last track and remove everything else....

Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
plman.ExecutePlaylistDefaultAction(plman.ActivePlaylist, items.count - 1);
plman.ClearPlaylistSelection(plman.ActivePlaylist);
plman.SetPlaylistSelectionSingle(plman.ActivePlaylist, items.count -1, true);
plman.SetActivePlaylistContext();
fb.RunMainMenuCommand("Edit/Selection/Crop");


woah thanks for a quick reply, that works much better! 

It was pretty much last thing I needed to 'complete' my layout (yeah right...)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-01-26 09:41:43
Marc, this is great, i tested plugin foo_youtube.dll with your thumbs, and it can display ''artist image'' and ''bio text'' if i use my ''google mode', and enter %title% in artist format.
There's no need to have taged files at all, for me this is great..

My question, is it possible to set, that your script first look in %artist% if not find, then to look in %title%. Something like: %artist% | %title% etc..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-26 10:23:32
no. my scripts only use sources where a single artist is required. supplying anything else isn't going to retun any results. the fact you've modded yours with a "google mode" means you're on your own if you want to change it.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-01-26 11:20:12
no. my scripts only use sources where a single artist is required. supplying anything else isn't going to retun any results. the fact you've modded yours with a "google mode" means you're on your own if you want to change it.


I was thinking if it support foobar title formatting, and it works.
I use this: $if(%artist%,%artist%,%title%)
Thanks..
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-01-30 09:56:41
Is last.fm remove artist images or what?
This is not first time to see this..

http://www.last.fm/music/2Pac/+images (http://www.last.fm/music/2Pac/+images)
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-01-30 13:43:00
I can not find any information on how to properly use plman.InsertPlaylistItems(playlistIndex, base, handles[, select])

Can someone give me an example how to use it (lets say I want to add currently selected or playing track to the specific playlist)?

Code: [Select]
        if (items.count < 1) {
            var handles = fb.GetSelections(0);
            plman.InsertPlaylistItems(pl_dj, 0, handles);
        }



Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-01-30 17:30:35
this code on it's own works for me.

Code: [Select]
selection = fb.GetSelections(0);
plman.InsertPlaylistItems(plman.ActivePlaylist, 0, selection);


this is testing the active playlist but if you're using a different one, you may want to switch focus to it so you can see your results. also remember that using 0 as the base will put the selection at the start of the playlist. use plman.PlaylistItemCount(idx) if you want to append to the end.
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-02-01 13:43:39
Switching focus did the trick for me, thanks again marc.

Getting InsertPlaylistItems to work finally helped me making a button to queue tracks not to the playback queue list but rather to PlayingPlaylist, which is what I'm used to with other players like MediaMonkey & MusicBee! <3
Title: WSH Panel Mod script discussion/help
Post by: Devrim on 2014-02-13 03:07:48
Anyone knows how to merge the thumbs script and last.fm/wikipedia script from marc2003? Together it will look pretty nice I think. Thanks!
Title: WSH Panel Mod script discussion/help
Post by: Devrim on 2014-02-13 03:53:05
Welp, not needed anymore. I found out I can add vertical splitters

It works pretty nice now, thanks for the scripts marc2003!

(http://kthnxbai.info/PicAyzo/22bfc9.png)

The only annoying thing is the little white bar on top of the picture. Any idea what that is?
Seems to be the seperator of the vertical splitter, any way to remove that?
Title: WSH Panel Mod script discussion/help
Post by: Devrim on 2014-02-13 09:26:10
And I got the white line fixed by using a stack splitter. Thanks to tedgo for the tip

(http://kthnxbai.info/PicAyzo/2002de.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-13 09:27:54
use panel stack splitter instead. you must already be using it already because there are no visible borders around the other edges.

edit: what timing. 
Title: WSH Panel Mod script discussion/help
Post by: Devrim on 2014-02-13 09:33:37
use panel stack splitter instead. you must already be using it already because there are no visible borders around the other edges.

edit: what timing. 




Btw, the DarkOne (v3) theme uses a pretty nice faded transition for front cover/back cover etc. It gives it a nice smooth effect. Do you think you can apply that to the thumbnail.txt?

I think the code is in here: http://pastebin.com/4qr9wZZF (http://pastebin.com/4qr9wZZF)
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2014-02-14 03:34:51
Hi marc need your help my prince! A friend using the now playing script says he isn't getting images? The console reads

WSH Panel Mod: Warning: Could not load file C:\Users\Penfold\AppData\Roaming\foobar2000\user-components\foo_uie_wsh_panel_mod\jscript.api
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-14 04:58:02
that missing file doesn't affect functionality - all it does is provide auto-complete when typing in the editor dialog. but here is how to install components properly so you won't see that error: http://wiki.hydrogenaudio.org/index.php?ti...all_a_component (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:How_to_install_a_component)

as for the now playing script not downloading, check the console for errors? check the right click menu options because automatic downloads are off on fresh installs. i've done this because it's so slow now. also, browse the last.fm site to make sure there are images for that artist.
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2014-02-15 22:41:05
that missing file doesn't affect functionality - all it does is provide auto-complete when typing in the editor dialog. but here is how to install components properly so you won't see that error: http://wiki.hydrogenaudio.org/index.php?ti...all_a_component (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:How_to_install_a_component)

as for the now playing script not downloading, check the console for errors? check the right click menu options because automatic downloads are off on fresh installs. i've done this because it's so slow now. also, browse the last.fm site to make sure there are images for that artist.

Ah good to know but there is still a problem with the now playing not displaying images, did everything you said. Here is the console.

Code: [Select]
Components loaded in: 0:00.080539
Configuration read in: 0:00.006299
Watching: D:\Music
Filter Panel - Album Artist: initialised in 0.021 s
Filter Panel - Album: initialised in 0.024 s
Filter Panel - Album Artist: initialised in 0.020 s
Filter Panel - Genre: initialised in 0.026 s
WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): initialized in 27 ms
WSH Panel Mod (Musicbrainz by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Musicbrainz by marc2003): initialized in 10 ms
Custom bitmap C:\Users\Nate\AppData\Roaming\foobar2000\themes\Slides\qsearch.bmp could not be loaded
WSH Panel Mod (Art Reader by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Art Reader by marc2003): initialized in 8 ms
WSH Panel Mod (Now Playing by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Now Playing by marc2003): initialized in 30 ms
WSH Panel Mod ({5AB6CF2C-C671-4F1A-BF08-A96BD9F962C2}): initialized in 0 ms
Error: Image draw failed (h_iml)
Error: Image draw failed (h_iml)
Seekbar: taking Direct3D9 path.
Seekbar: Frontend initialized.
User Interface initialized in: 0:01.248419
Startup time : 0:01.472080
Opening track for playback: "D:\Music\A Day To Remember\2013 - Common Courtesy\01 - City Of Ocala.mp3"
Error: Image draw failed (h_iml)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-15 23:25:46
make sure you have the latest version (right click>Update script). also, make sure it actually displays images ok by putting an image in a folder manually. right click the panel>open containing folder and put any test image in. the script will detect it after a second or 2.

if that all works but it's still failing to download then try saving this in the marc2003 folder and restart foobar.

https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)

it should show a bit more console output like this.

Code: [Select]
Now Playing: Looking up http://www.last.fm/music/HAIM/+images 
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/93366011.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/90639285.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/92179611.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/86235493.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/85776687.png

Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2014-02-16 01:01:54
Still not working  Any other ideas? The console is displaying like you pasted but there is no image being displayed? If I drop an image inside it will display it though?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-16 01:18:27
i can't help when you post such a vague reply. let's try again.... 

does it display an image when you add it to a folder manually? read the previous post for how to do this. a simple yes or no answer would be sufficient.
does the console display anything at all when trying to download images? even with no internet it would still display the URL it's trying to lookup. if you can't even confirm that, what else do you expect me to do?
Title: WSH Panel Mod script discussion/help
Post by: Bratman on 2014-02-16 01:30:52
i can't help when you post such a vague reply. let's try again.... 

does it display an image when you add it to a folder manually? read the previous post for how to do this. a simple yes or no answer would be sufficient.
does the console display anything at all when trying to download images? even with no internet it would still display the URL it's trying to lookup. if you can't even confirm that, what else do you expect me to do?


Shit sorry man! Yeah it displays an image. The console says basically what you pasted. If I search the images they are not going into the right folder. They are in C:\Users\Penfold\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\R8XAR7JC
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-16 01:51:01
all content fetched my scripts will end up in the IE cache so that should be irrelevant. you can open internet explorer and clear it to see if that helps.

i've also updated the script to display in the console where it's trying to save to... https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)

if you could post a full example like this so i can see the URLS and file paths.

Code: [Select]
Thumbs: Looking up http://www.last.fm/music/Electric%20Youth/+images 
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/75817356.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_75817356.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/52334493.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_52334493.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/37913895.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_37913895.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/37913835.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_37913835.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/52909963.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_52909963.png"
Title: WSH Panel Mod script discussion/help
Post by: penfold1992 on 2014-02-16 21:45:12
all content fetched my scripts will end up in the IE cache so that should be irrelevant. you can open internet explorer and clear it to see if that helps.

i've also updated the script to display in the console where it's trying to save to... https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)


hello, I am the one with the issue...

the link doesnt work so I am unable to download that file. could you re-upload?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-16 23:02:26
try again now.
Title: WSH Panel Mod script discussion/help
Post by: penfold1992 on 2014-02-16 23:22:00
Code: [Select]
Opening track for playback: "D:\Music\Falling In Reverse\Fashionably Late\02 - Bad Girls Club.flac"
Now Playing: Looking up http://www.last.fm/music/Falling%20In%20Reverse/+images
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/89238007.png
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_89238007.png"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/71750766.png
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_71750766.png"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/70467528.png
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_70467528.png"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/68549426.jpg
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_68549426.jpg"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/67632608.jpg
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_67632608.jpg"
Autobackup: Backed up 34 items to autobackup.20140216-232135.zip
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-16 23:41:31
browse the marc2003 folder and check the contents of the file named download.vbs match this: https://dl.dropboxusercontent.com/u/2280132...03/download.vbs (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/download.vbs)

Title: WSH Panel Mod script discussion/help
Post by: penfold1992 on 2014-02-17 00:24:55
browse the marc2003 folder and check the contents of the file named download.vbs match this: https://dl.dropboxusercontent.com/u/2280132...03/download.vbs (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/download.vbs)

yep, its identical to this.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-17 00:41:32
save this in your marc2003 folder and double click to run it...

https://dl.dropboxusercontent.com/u/2280132...h/temp/test.vbs (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/test.vbs)

it should save an image in the same folder and if not, display an error.
Title: WSH Panel Mod script discussion/help
Post by: penfold1992 on 2014-02-17 01:45:53
save this in your marc2003 folder and double click to run it...

https://dl.dropboxusercontent.com/u/2280132...h/temp/test.vbs (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/test.vbs)

it should save an image in the same folder and if not, display an error.


issue was due to me not being able to run vbscript files... i think installing notepad++ caused some error along the way.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-02-17 02:22:33
^that would only affect the test.vbs file i posted. the original is called from the command line with cscript.exe so file associations shouldn't have come into it.
Title: WSH Panel Mod script discussion/help
Post by: room302 on 2014-02-25 09:00:52
hi everyone i have a little problem,
i wanna to change this script background black (default white), is it possible ?

[code]// Maxim Terpilovsky's script
// Track Info Panel
// Updated 31-12-2013

// ==PREPROCESSOR==
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==


var string_height, string_number, min_width, column_number, max_elements, rating_view, btns_ready, updated;
var Buttons = [];
var btn;
var hover_button = null;


MF_STRING = 0x00000000;
DT_TOP = 0x00000000;
DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_BOTTOM = 0x00000008;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_EDITCONTROL = 0x00002000;
DT_END_ELLIPSIS = 0x00008000;


try { var folder = gdi.Image(fb.FoobarPath + "s7e_files\\images\\big_folder.png"); }
catch(e) {var folder = false;  }

try { var empty_selection = gdi.Image(fb.FoobarPath + "s7e_files\\images\\empty_selection.png"); }
catch(e) {var empty_selection = false;  }

try { var checked_star = gdi.Image(fb.FoobarPath + "s7e_files\\images\\star.png"); }
catch(e) { var checked_star = false;}

try { var empty_star = gdi.Image(fb.FoobarPath + "s7e_files\\images\\star_grey.png"); }
catch(e) { var empty_star = false;}


if ( utils.CheckFont( "Segoe UI" ) ) {
    var font            = gdi.Font("Segoe UI", 12, 0);
    var font_p1         = gdi.Font("Segoe UI", 13, 0);
    var font_p1_under   = gdi.Font("Segoe UI", 13, 4);
    var font_big        = gdi.Font("Segoe UI", 80, 1);
    var font_bold       = gdi.Font("Segoe UI", 12, 1);
    var font_under      = gdi.Font("Segoe UI", 12, 4);
} else {
    var font            = gdi.Font("Tahoma", 11, 0);
    var font_p1         = gdi.Font("Tahoma", 12, 0);
    var font_p1_under   = gdi.Font("Tahoma", 11, 4);
    var font_big        = gdi.Font("Segoe UI", 80, 1);
    var font_bold       = gdi.Font("Tahoma", 11, 1);
    var font_under      = gdi.Font("Tahoma", 11, 4);
}


fso = new ActiveXObject("Scripting.FileSystemObject");

ini_tag_write       = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'write-rating-to-tag', 0) );
mode                = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'track-info-mode', 1) );
rects               = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'rectangular-backs', 0) );
valign              = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'vertical-align', 0) );
show_cover_instead  = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'show-cover-instead', 0) );


function RGBA(r, g, b, a) {    return ((a << 24) | (r << 16) | (g << 8) | (b)); }
function RGB(r, g, b) { return (0xff000000 | (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);
}

function isArray(input){
    return typeof(input)=='object'&&(input instanceof Array);
}

unique = function(arr) {
    var o = {}, i, l = arr.length, r = [];
    for(i=0; i<l;i+=1) o[arr[i]] = arr[i];
    for(i in o) r.push(o[i]);
    return r;
};

max = function(arr) {
  return Math.max.apply(null, arr)
}

min = function(arr) {
  return Math.min.apply(null, arr)
}

indexOf = function(value, arr, start) {
    var i;
    if (!start) {
        start = 0;
    }
    for(i=start; i<arr.length; i++) {
        if(arr[i] == value) {
        return i;
        }
    }
    return -1;
}
function trim(string)
{
return string.replace(/(^\s+)|(\s+$)/g, "");
}


function calculate_dims() {

    string_height = font.Height + 5;
    string_number = Math.floor( window.Height / string_height );

    min_width = 200;
    column_number = Math.floor( ( window.Width - window.Height - 6 ) / min_width );
    max_elements = column_number * string_number;
    //fb.trace('max_elements ' + max_elements);
}

function dump(arr,level) {
    var dumped_text = "";
    if(!level) level = 0;
    
    //The padding given at the beginning of the line.
    var level_padding = "";
    for(var j=0;j<level+1;j++) level_padding += "    ";
    
    if(typeof(arr) == 'object') { //Array/Hashes/Objects
        for(var item in arr) {
            var value = arr[item];
            
            if(typeof(value) == 'object') { //If it is an array,
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += dump(value,level+1);
            } else {
                dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
            }
        }
    } else { //Stings/Chars/Numbers etc.
        dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
    }
    return dumped_text;
}







function Button(x, y, w, h, label_size, update, name, hover, func) {
    this.name = name;
    this.func = func;
    this.hover = hover;
    this.update = update;

    this.traceMouse = function(x, y) {
        var b = (this.left <= x) && (x <= this.right) && (this.top <= y) && (y <= this.bottom);
        return b;

    };

    this.onHover = function( x, y) {
        this.hover && this.hover(  x, y, this.left, this.label_size );
    };
    

    this.onClick = function( x, y ) {
        this.func && this.func( x, y, this.left, this.label_size );
    };
}

function ClearButtonCoords() {
    for ( var n=Buttons.length; n--; ) {
        Buttons[n].x = 0;
        Buttons[n].y = 0;
        Buttons[n].w = 0;
        Buttons[n].h = 0;

        Buttons[n].left = 0;
        Buttons[n].top = 0;
        Buttons[n].right = 0;
        Buttons[n].bottom = 0;
        Buttons[n].label_size = 0;
    }
}

function OnFilename() { window.SetCursor(32649); }
function Filename() {

    try { fb.RunMainMenuCommand('View/Columns playlist/Activate now playing' ); }
    catch(e) { }

}


function OnTitle() { window.SetCursor(32649); }
function Title() {

    try { fb.RunContextCommandWithMetadb('Tagging/Discogs/Write Tags...', ItemInfo.CachedMetadb ); }
    catch(e) { }

}


function OnTags() { window.SetCursor(32649); }
function Tags() {

    try { fb.RunContextCommandWithMetadb('Tagging/MP3 tag types...', ItemInfo.CachedMetadb ); }
    catch(e) { }

}


function OnCue() { window.SetCursor(32649); }
function Cue() {

    try { fb.RunContextCommandWithMetadb('Utilities/Edit cuesheet', ItemInfo.CachedMetadb ); }
    catch(e) { }

}


function OnArtist() { window.SetCursor(32649); }
function Artist() {

    try { fb.RunContextCommandWithMetadb('Quicksearch for same/Artist', ItemInfo.OutputMetadb(true) ); }
    catch(e) { }

}


function OnAlbum() { window.SetCursor(32649); }
function Album() {

    try { fb.RunContextCommandWithMetadb('Quicksearch for same/Album', ItemInfo.OutputMetadb(true) ); }
    catch(e) { }

}


function OnPath() { window.SetCursor(32649); }
function Path() {

    try { fb.RunContextCommandWithMetadb('Open containing folder', ItemInfo.OutputMetadb(true) ); }
    catch(e) { }

}



function ViewRating(x, y, left, label_size) {

    var meta = ItemInfo.OutputMetadb();
    if ( meta ) {

        x -= left + label_size;

        if ( x < 90 && x > 0 ) {
            rating_view = Math.min(5,Math.floor( x / (90/5) ) + 1);
            //window.SetCursor(32649);
        }
        else {
            rating_view = 0;
            //window.SetCursor( 32512 );
        }

    }

}

GetRating = function() {

    var meta = ItemInfo.OutputMetadb();
    if ( meta ) {

        if ( meta.Count != null ) {

            rating = 0;
            for ( i = 0; i < meta.Count; i++ ) {
                var item = meta.Item( i );
                rating += parseInt( fb.TitleFormat("$if3(%rating%,%rating_sql%,0)").EvalWithMetadb( item ) );
            }
            rating = rating / meta.Count;

        }
        else if ( meta ) {

            //fb.trace( meta.Path );
            rating = fb.TitleFormat("$if3(%rating%,%rating_sql%,0)").EvalWithMetadb( meta );
            if ( isNaN ( rating ) ) rating = 0;

        }

        return rating;
    }

}

function SetRating(x, y, left, label_size) {

    x -= left + label_size;
    //fb.trace(x+ y+ left+ label_size);

    if ( x < 90 && x > 0 ) {


        var rating_current = GetRating();
        rating_view = Math.min(5, Math.floor( x / (90/5) ) + 1);
        if ( rating_current == rating_view ) rating_view = 0;
        meta = ItemInfo.OutputMetadb();

        if ( meta ) {

            if ( utils.CheckComponent("foo_customdb", true) ) {

                fb.RunContextCommandWithMetadb("Legacy Commands (unsorted)/Set Rating " + rating_view, meta);
                ItemInfo.Update();

            }
            else if ( utils.CheckComponent("foo_playcount", true) ) {

                fb.RunContextCommandWithMetadb("Playback Statistics/Rating/" + (rating_view == 0 ? '<not set>' : rating_view), meta);
                ItemInfo.Update();

            }
            else {

                if ( ini_tag_write == 1 ) {

                    if ( meta.Count != null ) {
                        for ( i = 0; i < meta.Count; i++ ) {
                            var item = meta.Item( i );
                            item.UpdateFileInfoSimple('Rating', rating_view);
                        }
                    }
                    else {
                        meta.UpdateFileInfoSimple('Rating', rating_view);
                    }
                    ItemInfo.Update();

                }

            }

        }
        rating_view = 0;
    }

    
}




buttons = {

    filename:       new Button(0,0,0,0,0,0, "Filename", OnFilename, Filename ),
    codec:          new Button(0,0,0,0,0,0, "Codec", false, false ),
    artist:         new Button(0,0,0,0,0,0, "Artist", OnArtist, Artist ),
    album:          new Button(0,0,0,0,0,0, "Album", OnAlbum, Album ),
    title:          new Button(0,0,0,0,0,0, "Title", OnTitle, Title ),
    date:           new Button(0,0,0,0,0,0, "Date", false, false ),
    rating:         new Button(0,0,0,0,0,1, "Rating", ViewRating, SetRating ),
    played:         new Button(0,0,0,0,0,0, "Played", false, false ),
    genre:          new Button(0,0,0,0,0,0, "Genre", false, false ),
    filesize:       new Button(0,0,0,0,0,0, "File size", false, false ),
    duration:       new Button(0,0,0,0,0,0, "Duration", false, false ),
    firstplayed:    new Button(0,0,0,0,0,0, "First played", false, false ),
    lastplayed:     new Button(0,0,0,0,0,0, "Last played", false, false ),
    path:           new Button(0,0,0,0,0,0, "Path", OnPath, Path ),
    lastmodified:   new Button(0,0,0,0,0,0, "Last Modified", false, false ),
    cuesheet:       new Button(0,0,0,0,0,0, "Cuesheet", OnCue, Cue ),
    tagtype:        new Button(0,0,0,0,0,0, "Tag Type", OnTags, Tags )

}



for (var i in buttons ) {
    Buttons.push(buttons[i]);
}


function ClearButtonsVars() {
    
    rating_view = 0;
    window.SetCursor(32512);
    
}

// fb.trace( dump(Buttons) );

function inArray(arr, val) {
    var i = arr.length;
    while (i--) {
        if (a[i] === val) return true;
    }
    return false;
}








function ItemInfo() {

    this.Selection = 0;
    this.ButtonsReady   = 0;
    this.Info   = false;
    this.Labels = false;
    this.CachedMetadb = undefined;
    this.Extension = '';

    this.Eval = function( meta, field ) {

        path = meta ? meta.Path : '';
        return path.indexOf('://') > 0 ?  fb.TitleFormat( field ).Eval( true ) : fb.TitleFormat( field ).EvalWithMetadb( meta );

    }

    this.OutputMetadb = function( force ) {
        force = force ? force : false;

        if ( force ) {
            if ( mode == 2 ) return fb.GetFocusItem(true);
            else return ( fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem() );
        }
        else {
            //if ( mode == 2 ) return (( fb.GetSelections().Count > 1 && fb.GetSelectionType() ) ? fb.GetSelections() : fb.GetFocusItem(true) );
            //else return ( fb.IsPlaying ? ( ( fb.GetSelections().Count > 1 && fb.GetSelectionType() ) ? fb.GetSelections() : fb.GetNowPlaying() ) : ( fb.GetFocusItem() && fb.GetSelectionType() && fb.GetSelections().Count > 1 ? fb.GetSelections() : (fb.GetFocusItem() ? fb.GetFocusItem() : false) ));
            if ( mode == 2 ) return (( fb.GetSelections().Count > 1 ) ? fb.GetSelections() : fb.GetFocusItem(true) );
            else return ( fb.IsPlaying ? ( ( fb.GetSelections().Count > 1 ) ? fb.GetSelections() : fb.GetNowPlaying() ) : ( fb.GetSelections().Count > 1 ? fb.GetSelections() : (fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false) ));

        }
    }

    this.GetInfo = function( metadb ) {

        //fb.trace('GetInfo called');
        if ( metadb ) {

            labels = [];
            general = [];

            if ( metadb.Count != null && metadb.Count > 0 ) {

                

                //d = new Date();
                //t = d.getTime();

                // Constant values
                //var first_played  = '(multiple values)';
                //var last_played   = '(multiple values)';
                //var last_modified = '(multiple values)';

                this.Extension  = [];
                var count = metadb.Count;

                if ( count > 100 ) {
                    var rating    = false;
                    var playcount = false;
                }
                else {
                    var rating    = 0;
                    var playcount = new Number();
                }

                var duration = 0;
                var filesize = 0;
                var bitrate = 0;

                var date_max    = 0;
                var date_min    = 10000;
                var filename    = '';
                var path        = false;

                var artist  = [];
                var album   = [];
                var codec   = [];
                var genre   = [];
                var style   = [];

                var cue_embedded = [];
                var tagtype      = [];
                var extensions   = [];

                //this.Extension  = new Array('fpl', 'fpl');
                var title        = count + ' titles';

                    
                function iterate( item ) {

                        var info = item.GetFileInfo();

                        var artist_current = info.MetaValue( info.MetaFind('artist'), 0);
                        if ( artist_current ) artist.push( artist_current );

                        var album_current = info.MetaValue( info.MetaFind('album'), 0);
                        if ( album_current ) album.push( album_current );


                        var codec_current = info.InfoValue( info.InfoFind('codec') );
                        if ( codec_current ) codec.push( codec_current );

                        var style_current = fb.Titleformat("[%style%]").EvalWithMetadb(item);
                        if ( style_current ) style.push( style_current );

                        var genre_current = fb.Titleformat("[%genre%]").EvalWithMetadb(item);
                        if ( genre_current ) genre.push( genre_current );

                        var date_current = parseInt( info.MetaValue( info.MetaFind('date'), 0) );
                        if ( date_current && date_current > date_max ) date_max = date_current;
                        if ( date_current && date_current < date_min ) date_min = date_current;


                        var tagtype_current = fb.Titleformat("[%__tagtype%]").EvalWithMetadb(item);
                        tagtype_current = tagtype_current.toUpperCase();
                        tagtype_current = tagtype_current.replace(/\|/g,',');
                        if ( tagtype_current )  tagtype.push( tagtype_current );

                        var cue_current = info.InfoValue( info.InfoFind('cue_embedded') );
                        if ( cue_current )  cue_embedded.push( cue_current );

                        var bit_cur  = info.InfoValue( info.InfoFind('bitrate' ) );
                        bitrate     += bit_cur ? parseInt( bit_cur ) : 0;

                        if ( rating !== false  ) rating  += parseInt( fb.TitleFormat("$if3(%rating%,%rating_sql%,0)").EvalWithMetadb( item ) );
                        
                        if ( playcount  ) playcount      += parseInt( fb.TitleFormat("$if3($meta(play_count),%play_count%,%play_count_sql%,0)").EvalWithMetadb( item ) );

                        var dur_cur  = item.Length;
                        duration    += parseInt( dur_cur );
                        filesize    += bit_cur / 8 * 1024 * dur_cur;

                        extensions.push( item.RawPath.replace(/.*\.(\w+)$/,"$1") );

                    }


                    function duff(iterations) {
                      var i = iterations % 8;
                      var n = 0;
                      if( i>0 ) {
                        do {
                           var item = metadb.Item( n++ );
                           iterate(item);
                        }
                        while(--i);
                      }
                      i = parseInt( iterations / 8 );
                      if( i>0 ) {
                        do {

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                        }
                        while(--i);
                      }
                    }


                    duff( metadb.Count );

                    if ( duration > 86400 ) {
                        x = duration;
                        seconds = parseInt( x % 60 );
                        x /= 60;
                        minutes = parseInt( x % 60 );
                        x /= 60;
                        hours = parseInt( x % 24 );
                        x /= 24;
                        days = parseInt( x );


                        seconds += seconds > 1 ? ' seconds ' : ' second ';
                        minutes += minutes > 1 ? ' minutes ' : ' minute ';
                        hours   += hours   > 1 ? ' hours '   : ' hour ';
                        days    += days    > 1 ? ' days '    : ' day ';
                        duration = days + hours + minutes + seconds;
                    }
                    else {
                        duration = TimeFmt(duration);
                    }
                    //fb.trace(rating);
                    if ( rating )    rating      = rating / metadb.Count;
                    if ( playcount ) playcount   = Math.round(playcount / metadb.Count);
                    bitrate     = Math.round(bitrate / metadb.Count);

                    //fb.trace( 'playcount==' + playcount );
                    if ( filesize >= 1073741824 ) filesize = Math.round(filesize / 1073741824 * 100)/100 + "GB";
                    else if ( filesize >= 1048576 ) filesize = Math.round(filesize / 1048576 * 100)/100 + "MB";
                    else if ( filesize >= 1024 ) filesize = Math.round(filesize / 1024 * 100)/100 + "KB";
                    else filesize += 'B';

                    artist = unique(artist);
                    if ( artist.length > 2 ) artist = artist.length + ' artists';
                    else {
                        artist = artist.join(", ");
                    }

                    album = unique(album);
                    if ( album.length > 2 ) album = album.length + ' albums';
                    else {
                        album = album.join(", ");
                    }

                    codec = unique(codec);
                    if ( codec.length > 2 )  codec  = codec.length +  ' codecs';
                    else {
                        codec  = codec.join(", ");
                    }
                    codec = '? ' + bitrate + ' kbps, ' + codec;

                    if ( genre.length > 1 ) {
                        genre      = genre.join(',');
                        genre      = genre.replace(/\&\//g,',');
                        genre      = genre.split(',');
                        genre      = unique(genre);
                    }

                    if ( style.length > 1) {
                        style      = style.join(',');
                        style      = style.split(',');
                        style      = unique(style);
                    }

                    if ( style.length > 2 )  style  = style.length + ' styles';
                    else {
                        style.sort();
                        style  = style.join(", ");
                    }

                    if ( genre.length > 2 )  genre  = genre.length + ' genres';
                    else {
                        genre.sort();
                        genre  = genre.join(", ");
                    }
                    if ( style && genre ) genre += ' / ' + style;

                    var date         = date_min != date_max ? (date_min != 10000 ? (date_min + '…') : '') + (date_max ? date_max : '') : date_max;


                    tagtype      = tagtype.join(',');
                    tagtype      = tagtype.split(',');
                    tagtype      = unique(tagtype);
                    tagtype.sort();
                    tagtype      = tagtype.join(', ');

                    cue_embedded    = unique(cue_embedded);
                    cue_embedded    = cue_embedded.length > 1 ? 'Yes, partly' : cue_embedded[0];

                    filename = 'Selection (' + metadb.Count + ' items)';

                    this.Extension = unique(extensions);



                if ( filename ) { general.push(filename); labels.push("Filename");}

                if ( codec )    { general.push(codec); labels.push("Codec");}

                if ( artist )   { general.push(artist); labels.push("Artist");}

                if ( album )    { general.push(album); labels.push("Album");}

                if ( title )    { general.push(title); labels.push("Title");}

                if ( date )     { general.push(date); labels.push("Date");}

                if ( genre )            { general.push(genre); labels.push("Genre");}

                
                if ( typeof rating == 'number' ) { general.push(rating); labels.push("Rating"); }

                if ( playcount ) {
                    playcount = ( playcount > 1 ? '? ' + playcount + ' times played each' : playcount > 0 ? 'Each once played' : 'Never played');
                    general.push(playcount);
                    labels.push("Played");
                }

                if ( filesize )         { general.push(filesize ); labels.push("File size");}

                if ( duration )         { general.push(duration); labels.push("Duration");}

                if ( cue_embedded )     { general.push(cue_embedded ); labels.push("Cuesheet");}

                if ( tagtype )          { general.push(tagtype); labels.push("Tag Type");}

                this.Info = general.join("|||");
                this.Labels = labels.join("\n");

                //fb.trace(rating);
                //d = new Date();
            &nbs
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-02-25 16:37:43
Marc, where in your thumbs script to edit ''library mode'' , when i listen radio stream, i want in that mode, that script continue to download image, but in different folder inside ''wsh_lastfm'' in ''@temp'' folder.  Example: ''wsh_lastfm\\@temp''.

Because, when i listen radio, i don't have images in that mode at all(is empty), i want to have images displayed when listen radio, but also to be able to delete that ''@temp'' folder easily when not listen radio.
Thanks..
Title: WSH Panel Mod script discussion/help
Post by: Kai_cologne on 2014-02-28 10:28:47
Hi!
is there a way to build a button that change the setting of the Selection viewers status?


i need it because of this:
http://www.hydrogenaudio.org/forums/index....mp;#entry859479 (http://www.hydrogenaudio.org/forums/index.php?showtopic=104831&st=0&#entry859479)


thank u


Title: WSH Panel Mod script discussion/help
Post by: SilentQ on 2014-02-28 18:00:23
Install WSH Panel Mod.
Grab a copy of marc2003's sample scripts.

(You can find both of these from various links in this thread.)

Set up a tabbed control with two tabs.
Install a WSH panel mod control with marc2003's "item details.txt" in both of them.
In one of the tabs: Right click > Selection Mode> Prefer Now Playing
In the other tab: Right click > Selection Mode > Follow Selected Track
Title: WSH Panel Mod script discussion/help
Post by: Kai_cologne on 2014-02-28 21:03:14
Great! Thank U
Title: WSH Panel Mod script discussion/help
Post by: lillibot on 2014-03-08 21:37:17
I've been at work on a script and I've gathered that click events seem to be throttled.

Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }

var n = 0;
font = gdi.Font("Calibri", 10, 0);

function on_paint(gr) {
    gr.DrawString(n, font, RGB(255, 0, 0), 0, 0, 16, 16);
}

function on_mouse_lbtn_down(x, y) {
    n += 1;
    window.Repaint();
}


Basically, n doesn't increment as fast as I click. Others' scripts I use don't have the same limitation. What have I done?
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2014-03-08 21:56:38
add

Code: [Select]
function on_mouse_lbtn_dblclk(x, y){
    on_mouse_lbtn_down(x, y);
}
Title: WSH Panel Mod script discussion/help
Post by: lillibot on 2014-03-08 22:01:34
^ Dang. Thanks!
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-03-12 12:40:43
I'm tryin to make simply script that open another youtube(recommended) video in foobar playlist after first is finished, but i have problem.
In url i recieve: ''about:/watch?v=26PAgklYYvo ''


How to delete that ''about:/'' and leave only: ''watch?v=26PAgklYYvo'' ?

This is script:

Code: [Select]
    if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://www.youtube.com/watch?v=I7HahVwYpwo" + encodeURIComponent(p.artist) + "/+images", true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("div");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("a");
                    var urls = [];
                    for (i = 33; i < data.length; i++)
                    {
                        if (data[i].href.indexOf("/watch?v=") == 0) urls.push(data[i].href.replace("", ""));
                    }
                    
                    for (i = 33; i < Math.min(urls.length, 50, 50); i++)
                    {
                    }
//check path                    
p.console("HTTP: " + data[i]);

//open YT clip in playlist
var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
p.run(tmppath+"\\foobar2000.exe /immediate /add "+"\""+"http://www.youtube.com"+ data[i] + "\"");
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2014-03-12 13:10:31
You can do it with regex, for example:
Code: [Select]
var url = "about:/watch?v=26PAgklYYvo"
url = url.replace(/about:\//,"")
fb.trace(url)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-12 13:16:25
Quote
this.xmlhttp.open("GET", "http://www.youtube.com/watch?v=I7HahVwYpwo" + encodeURIComponent(p.artist) + "/+images", true);


that part in bold is left behind from the last.fm script and should be removed. 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-03-12 13:40:08
You can do it with regex, for example:
Code: [Select]
var url = "about:/watch?v=26PAgklYYvo"
url = url.replace(/about:\//,"")
fb.trace(url)

Yes, in your example this will work..
But i must use something like this(Because i don't know what will come after "about:/''):

Code: [Select]
var url = data[i];

var url = url.replace('about:/','/');

//open YT in playlist
var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
p.run(tmppath+"\\foobar2000.exe /immediate /add "+"\""+"http://www.youtube.com"+ url + "\"");

Output now should be : ''http://www.youtube.com/watch?v=26PAgklYYvo''
But i recieve error: ''Object doesn't support this property or method''

Problem is that actualy ''data'' is 'html element tag'(if u see script above) not string.
So this didn't work for me..


Quote
this.xmlhttp.open("GET", "http://www.youtube.com/watch?v=I7HahVwYpwo" + encodeURIComponent(p.artist) + "/+images", true);

that part in bold is left behind from the last.fm script and should be removed. 

I was removed this, i use your script at the begining(to not write all), i learned a lot from from you  .
Do you know how to remove this: "about:/'' from url?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-12 14:53:45
i don't know what you're doing with this???

for (i = 33; i < data.length; i++)
{
   if (data.href.indexOf("/watch?v=") == 0) urls.push(data.href.replace("", ""));
}


what you want to do is loop through all of them and just keep the ones that begin about:/watch?v=

Code: [Select]
for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/watch?v=") == 0) urls.push("http://www.youtube.com/" + data[i].href.replace(/about:\//,""));
}


now urls is an array containing only links to playable videos.

Code: [Select]
for (i = 0; i < urls.length; i++) {
    //do something with urls[i]
}




Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-03-12 15:32:09
i don't know what you're doing with this???

for (i = 33; i < data.length; i++)
{
   if (data.href.indexOf("/watch?v=") == 0) urls.push(data.href.replace("", ""));
}


what you want to do is loop through all of them and just keep the ones that begin about:/watch?v=

Code: [Select]
for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/watch?v=") == 0) urls.push("http://www.youtube.com/" + data[i].href.replace(/about:\//,""));
}


now urls is an array containing only links to playable videos.

Code: [Select]
for (i = 0; i < urls.length; i++) {
    //do something with urls[i]
}



Ah, Marc your the best, as always, it works
I was think that i keep only that one clip at end: on every played clip in foobar, it (recieve url where clip is) open new clip from that page(last clip), and so on... Trying to make some sistem recomendation, and that same clips are not be repeated..

Title: WSH Panel Mod script discussion/help
Post by: Nixdagibts on 2014-03-18 22:47:11
Hello,

Can I somehow bind a shortcut (e.g CTR+1) to a button created via WSH Panel Mod and Marc's WebLinks script? (My code (https://gist.github.com/nixdagibts/0d46527c5e91eabf053a))
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-19 02:28:08
you can get WSH panel mod to accept keyboard input but foobar must have focus and the WSH panel must be the last thing you clicked so it's not particular useful if you want to make keyboard shortcuts. you can't make them "global".

if you want to try it anyway, here is a bit of code to get you started....

Code: [Select]
function on_key_down(vkey) {
    //p.console(vkey); //uncomment this to get the code of the button you've pressed. it's used in the switch statement below.
    if (p.metadb && utils.IsKeyPressed(0x11)) { //check something is selected and ctrl is held
        switch(vkey) {
            case 49: //1
                b.buttons.google.func();
                break;
            case 50: //2
                b.buttons.myspace.func();
                break;
        }
    }
}


Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-03-19 14:19:30
Is it possible to script WSH so it mimics the functions of the DUI 'Tabs' feature? I've tried to google-fu an answer but that one has proven to be elusive when DUI is the main interface.
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2014-03-19 15:23:14
marc2003, big thank you for the samples. I use almost all of them.

I have one suggestion for "musicbrains" script. Can you add an option to choose sorting order for releases: chronological or reversed.
or at least tell me how to change that myself. (btw I did search this topic and previous solution seems not to work any more)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-19 16:51:13
Is it possible to script WSH so it mimics the functions of the DUI 'Tabs' feature? I've tried to google-fu an answer but that one has proven to be elusive when DUI is the main interface.


if you want to show/hide other panels then no. if you want to show some "tabs" for stylistic purposes to show/hide content in a single WSH panel then you can use the thememanager functions described in interfaces.txt and this online documentation: http://msdn.microsoft.com/en-us/library/bb...28VS.85%29.aspx (http://msdn.microsoft.com/en-us/library/bb773210%28VS.85%29.aspx)

Can you add an option to choose sorting order for releases: chronological or reversed.


i've added an option to the right click menu so this can be toggled. reverse is still the default though. i've added this to my discogs script as well as they share the same sorting functions.

right click>Update script

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2014-03-19 19:28:29
marc, thank you for update.

I found issue in musicbrains script. It works well with all artists in my library (which is big) except "AC/DC" and "Guns N' Roses". Other scripts works ok with them. I think it may be because of / and ' symbols in artist's name but its just a guess(http://s1.postimg.org/kkvmn84u7/foobar.jpg)

my english probably bad, sorry
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-19 20:21:11
in their editing guidelines, musicbrainz don't like people using the apostrophe on their keyboard. they prefer the "typographically" correct character which is this ’

that's why my script didn't match any results. i might be able to work around this.

as for AC/DC, they aren't even accepting that as a search parameter. i'm doing things right so i think it's a problem their end. it's something i'll have to look in to.

you can of course get around any of these tagging issues if your files are tagged with musicbrainz_artistid as my script will look up those directly without doing an artist search.

this is the id for Guns n' Roses... eeb1195b-f213-4ce1-b28c-8565211f8e43
and AC/DC... 66c662b6-6e2f-4930-8610-912e24c63ed1

also, just in case you hadn't realised, you can turn off the Show timestamp option so the text doesn't go over the arrow at the bottom. i guess it's only usable on wider panels.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-19 22:19:11
i've updated the musicbrainz script so the type of apostrophe doesn't matter any more.

right click>Update script.

edit: updated so AC/DC should work as well. i still think the problem is at musicbrainz's end but i'm working around it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-20 06:18:09
another little update for my musicbrainz script. right click to update.

a few bugfixes and i also worked around a few more characters that were previously refused by the musicbrainz search server.
Title: WSH Panel Mod script discussion/help
Post by: lillibot on 2014-03-21 01:15:52
Can someone get me started on a script that rates the currently playing track? I can't figure how to make use of the many "meta" methods.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-21 03:46:09
first you need the handle of the now playing track and then you use UpdateFileInfoSimple with the tag name and value like this...

Code: [Select]
var metadb = fb.GetNowPlaying();
metadb.UpdateFileInfoSimple("RATING", 5);


if you want to delete a tag, just use double quotes...

Code: [Select]
metadb.UpdateFileInfoSimple("RATING", "");


i actually have a full rating script already if you want to take a look.

https://dl.dropboxusercontent.com/u/2280132...om%20rating.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/custom%20rating.txt)

these are the images i use.

(https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/images/off.png)(https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/images/on.png)

you might need to look at editing the paths to the images on lines 102 & 103. also, the number 24 on line 11 is the image size so might need changing if you use your own images.
Title: WSH Panel Mod script discussion/help
Post by: lillibot on 2014-03-21 05:07:06
Thanks for the response.

I'm actually hoping to get my script to complement PlaybackStatistics. It took me some time to realize that it doesn't actually write metadata.

Is it at all possible to outsource a query to foobar, as in "%RATING%"? I'm also unclear as to the usage of RunContextCommand, if that's even helpful here.

Sorry if I'm a bit of a bother. I'm not a programmer first.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-21 05:13:05
in that case, just download this pack of scripts i made.

https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

you'll want the script named rating.txt - this is already made to work with foo_playcount. just read the instructions. you don't need to edit the script at all.

if you don't like the bundled images, i can tell you how to modify the code to use your own.
Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-23 09:42:42
Thank you for creating amazing components and scripts for fb2k. Life wouldn't be the same without them, i'm not kidding.

Is there any way to add/append "scrobbles" and "listeners" (to artists, albums etc.) in your last.fm script?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-23 10:40:50
i only make crappy scripts. i certainly didn't have anything to do with creating the component.

anyway, i had a look at the data i can get from last.fm and it's a bit odd. only the toptracks and topalbums feeds return playcounts but they don't seem to correlate with anything on the website. for example, i see the top track for who i'm listening to has 59,000 plays. i thought this was far too low so checked the website and it has  ~1.9 million. the only other playcounts i can see are for the last week (1438) and the last 6 months (21,600). i have no idea where the 59,000 is coming from so i think it's a bit pointless showing it. obviously i double checked the raw data from last.fm so my script is not at fault.

edit: if you want to see for yourself, you can add this code to the panel. on line 30, you find this....

Code: [Select]
        case li.items > 0:
            li.draw(gr);
            break;


replace it with...

Code: [Select]
        case li.items > 0:
            li.draw(gr);
            if (li.lastfm_mode > 2) {
                for (i = 0; i < Math.min(li.items, li.rows); i++) {
                    p.right_text(gr, li.data[i + li.offset].playcount.addCommas() + " plays", p.list_font, p.textcolour_hl, li.x, li.y + 15 + (i * li.row_height), li.w, li.row_height);
                }
            }
            break;
Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-23 11:51:25
i only make crappy scripts. i certainly didn't have anything to do with creating the component.


Even so, I can't sing enough praises for your scripts.

Quote
anyway, i had a look at the data i can get from last.fm and it's a bit odd. only the toptracks and topalbums feeds return playcounts but they don't seem to correlate with anything on the website. for example, i see the top track for who i'm listening to has 59,000 plays. i thought this was far too low so checked the website and it has  ~1.9 million. the only other playcounts i can see are for the last week (1438) and the last 6 months (21,600). i have no idea where the 59,000 is coming from so i think it's a bit pointless showing it. obviously i double checked the raw data from last.fm so my script is not at fault.

edit: if you want to see for yourself, you can add this code to the panel. on line 30, you find this....

Code: [Select]
        case li.items > 0:
            li.draw(gr);
            break;


replace it with...

Code: [Select]
        case li.items > 0:
            li.draw(gr);
            if (li.lastfm_mode > 2) {
                for (i = 0; i < Math.min(li.items, li.rows); i++) {
                    p.right_text(gr, li.data[i + li.offset].playcount.addCommas() + " plays", p.list_font, p.textcolour_hl, li.x, li.y + 15 + (i * li.row_height), li.w, li.row_height);
                }
            }
            break;


I modified the script. I checked the playcounts and found the count reported by the script in most cases are just over double that of the playcount number for 6 months. So I am guessing it could be for 1 year?

Anyway, playcounts for individual tracks are not really important for me. What I am interested in is getting "scrobbles" for  artists and "listeners" for artists and albums.

For e.g. Björk has total of 87,901,733 scrobbles 1,957,941  listeners. and the following top albums:

Homogenic: 455,342 listeners
Post: 644,504 listeners
Debut: 534,509 listeners
Vespertine: 309,415 listeners

I update them to the tags for use while sorting in the library. Presently I am doing it manually by visiting the artist page on last.fm periodically. Of course I use your web-links to visit the page which makes it a bit easier than usual, but it would be great if I could get the data on panel.

Thank your for the quick reply.



Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-23 12:20:06
if you use my last.fm album info panel, this can display total listeners/playcount for the current album.

add this as the last line inside the on_paint function - it should end up on line 28...

Code: [Select]
if (t.json_data && t.json_data.album) p.left_text(gr, t.json_data.album.listeners.addCommas() + " listeners. " + t.json_data.album.playcount.addCommas() + " plays.", p.list_font, p.textcolour_hl, t.x, t.y + t.h - 15, t.w, 15);


edit:


For e.g. Björk has total of 87,901,733 scrobbles 1,957,941  listeners. and the following top albums:

Homogenic: 455,342 listeners
Post: 644,504 listeners
Debut: 534,509 listeners
Vespertine: 309,415 listeners


this is clealy nonsense. vespertine is by far her best album. 
Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-23 13:12:00
if you use my last.fm album info panel, this can display total listeners/playcount for the current album.

add this as the last line inside the on_paint function - it should end up on line 28...

Code: [Select]
if (t.json_data && t.json_data.album) p.left_text(gr, t.json_data.album.listeners.addCommas() + " listeners. " + t.json_data.album.playcount.addCommas() + " plays.", p.list_font, p.textcolour_hl, t.x, t.y + t.h - 15, t.w, 15);


edit:


For e.g. Björk has total of 87,901,733 scrobbles 1,957,941  listeners. and the following top albums:

Homogenic: 455,342 listeners
Post: 644,504 listeners
Debut: 534,509 listeners
Vespertine: 309,415 listeners


this is clealy nonsense. vespertine is by far her best album. 



Done. Works fine. I find the previous track playcount useful too. I checked a few more tracks, the sorting order is for "last week". Sorting order going by the playcount would be quite different, and hence more and more seems to me to be for 1 year. I find it useful nevertheless.

So no chance to add "scrobbles" and "listeners" to artists/albums which can be be displayed in "top albums" and "similar artists" panel?. Will make discovering new music easier. Maybe I am being a bit too greedy here. . Your scripts as it is, are doing quite enough.

RYM ratings are more reliable/meaningful. Some artists who are very popular on last.fm have hardly a standing there. Unfortunately there is no API for it. I have added RYM button to your web-links script

Thanks for everything.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-23 13:22:55
So no chance to add "scrobbles" and "listeners" to artists/albums which can be be displayed in "top albums" and "similar artists" panel?


nope. the information simply is not there....

(https://dl.dropboxusercontent.com/u/22801321/2014/march/similar%20json.png)
Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-23 14:01:19
So no chance to add "scrobbles" and "listeners" to artists/albums which can be be displayed in "top albums" and "similar artists" panel?


nope. the information simply is not there....

(https://dl.dropboxusercontent.com/u/22801321/2014/march/similar%20json.png)



A couple of years back I had come across a Audio player (I can't seem to remember now which one) based on last.fm API, which used to display the data which I am referring to. It was some player which was listed on the last.fm website. I naturally assumed it would be possible to fetch the data using your script.

I just now tried Clementine, unlike the playcount we are getting from the script, it correctly reports the "scrobbles" and "listeners" for the track which is found on the song page. I will try to find out the name of the other audio player.

Sorry for putting you through so much of trouble.

Thanks again.

Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-23 15:48:44
You are right. I checked the last.fm site. There is no provision in API to fetch that data, at least in the way I mentioned. Perhaps the other player which I referred to uses a HTML parser.

I do not know how to write scripts. So I have some requests.

(1) Would it possible to put the "artist.getInfo" (it contains similar artists info too) data in a panel. Perhaps in the following format in a single panel. I can use it in lieu of "similar artists" panel. Also, this way I will have a clickable link to the artist page (currently I am using web-link button). This would save me some visits to the last.fm site. I think it also has a similarity match percentage. Would be great if that too could be added.

[blockquote]artist info
Name: Cher
Listeners : 1,000,000
Plays: 10,000,000

Similar artists:
Sonny & Cher
Kylie Minogue
Madonna
RuPaul
Céline Dion
Cyndi Lauper[/blockquote]


(2) 'artist.getTopAlbums' has got "listeners" info. Would it be possible to add that data to the "top albums" panel?. Just like you added the playcount to "top tracks" panel.

(3) Panel for similar tracks using 'track.getSimilar'.


All in your own time......no rush.....at all. 

Hope I am not imposing.

Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-23 16:45:55
i generally only make stuff i'm interested in using myself and i'm just not interested in this. i don't mind helping out with a few lines of code to mod existing scripts but i'm not making any new ones.

as for point 2, you're wrong. top album does not contain listener info - only top tracks does.




Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-23 17:11:03
It's alright.

I do not have any way of now knowing what the API acutally returns. I was just referring to the sample response given on the last.fm website for 'artist.getTopAlbums'. It contains "listeners" field.

Code: [Select]
<topalbums artist="Cher">
  <album rank="1">
    <name>Believe</name>
    <mbid>61bf0388-b8a9-48f4-81d1-7eb02706dfb0</mbid>
    <listeners>24486</listeners>
    <url>http://www.last.fm/music/Cher/Believe</url>
    <image size="small">...</image>
    <image size=" medium">...</image>
    <image size="large">...</image>
  </album>
  ...
</topalbums>

Thank your for your time. Appreciate everything you have done.
Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-23 17:42:14
The "playcount" code you gave works on albums too. In most cases (although there is some difference) it returns the correct data.

I also wanted to ask, for some artists (e.g The xx) "top albums" returns "[nothing found]". What can I do to get to it work in such cases?
Title: WSH Panel Mod script discussion/help
Post by: lillibot on 2014-03-25 06:41:42
Question: how can I create an empty instance of IFbMetadbHandleList?  I can only figure to clone and remove the contents of an existing playlist but that just seems hacky.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-26 03:10:47
I was just referring to the sample response given on the last.fm website for 'artist.getTopAlbums'. It contains "listeners" field.


well it's wrong. if you register for own api key, you will get links to live results on the docs page and you'll see it's missing. last.fm rarely if ever respond to bug reports so i wouldn't waste my time even trying.

I also wanted to ask, for some artists (e.g The xx) "top albums" returns "[nothing found]". What can I do to get to it work in such cases?


there's good news and bad news.

the good: you've found a "bug" in my script where it won't display anything if there is one result. i blame last.fm for their inconsistent response and me having to implement hacks to fix it. having said that, it is now done. right click>Update script
the bad: there should be 24 results for The xx on last.fm and it even gives that total in the response. but for whatever reason, it is only returning 1 actual result. this is something else that would need to fixed at last.fm's end. i wouldn't hold my breath waiting for it.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-03-28 12:45:29
Marc2003 First I would like to thank you for the scripts ,great work !!!

If I may request an update to the now playing & thumbs scripts to include :

im.download();

in

function on_metadb_changed()

so that artist artwork gets downloaded when dynamic metadata changes ( Internet Radio Streams ).


The script only downloads on play start / track change , as you mention in the recent changes.
Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-29 18:20:47
I updated the script.

I am finding the "listeners" & "Plays" code for album panel very useful. Would it be possible to ad the same stats in your bio panel for "artist"?

Thanks marc.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-03-30 22:14:27
I modified marc2003 themed toolbar buttons script , to create an internet radio playlist importer.
All playlists are created through lab.rolisoft.net  , credits to them.

External Shoutcast Explorer https://sourceforge.net/projects/shoutcastexplor/ (https://sourceforge.net/projects/shoutcastexplor/)


(https://www.dropbox.com/s/etqdndajkl3au3b/screenshot.jpg)
https://www.dropbox.com/s/etqdndajkl3au3b/screenshot.jpg (https://www.dropbox.com/s/etqdndajkl3au3b/screenshot.jpg)
Download : https://www.dropbox.com/s/1bepm2sw58c5gww/i...net%20radio.rar (https://www.dropbox.com/s/1bepm2sw58c5gww/internet%20radio.rar)


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-03-31 09:07:59
@zeremy, i'm not changing the default behaviour because i have no way to test it at the moment.

@mgpai, although my bio text originates from last.fm, i actually fetch it from a completely different webservice (theechonest.com) and that does not provide playcount/listener info.
Title: WSH Panel Mod script discussion/help
Post by: mgpai on 2014-03-31 09:19:03
@mgpai, although my bio text originates from last.fm, i actually fetch it from a completely different webservice (theechonest.com) and that does not provide playcount/listener info.


OK. Thank you marc.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-04-02 11:54:49
Marc i need your help, i'm tryin to make last.fm radio. To include this in foobar 'youtube radio'.
It's really amazing how great it works, in same way as the web last.fm radio.
For now everything is ok.

But i must to make these 3 function, that every function start after previously is finished.
I want to use 'im.working=false;' to start next function.
But how to do that?

I think to make all this as one function, and then use: 'im.working=false;' to start next part?
Is this possible?

(till now i used timer for this).



Code: [Select]
//Open Similar Artist

this.Similar_Art = function()
  
    {
     //Select Random Page
      var randomnumber=Math.floor(Math.random()*18)
      var a=randomnumber;

        this.working=true;
        
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://www.last.fm/music/" + START_ARTIST + "/+similar"+ "?page=" + a, true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("div");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("a");
                    var urls = [];
    
            

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/music/") == 0) urls.push("http://www.last.fm/music/" + data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0","").replace("6","").replace("4","").replace("3","").replace("2","").replace("5","").replace("9","") + "/+tracks");    
}

//Select Random Artist(num)

var randomnumber = Math.floor(Math.random()*(17-46)+46);
i=randomnumber;


{

p.console("Random Artist: " + urls[i]);

server = window.SetProperty("Download  source", urls[i]);
server = urls[i];
window.SetProperty("Download  source", urls[i]);
                  
}
                                             im.doc.close();
                                    im.working=false;

                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
}
}
}    
}                    








//Find Track(For Selected Artist)

this.Track = function()
  
           {

      //Select Random Page

      var randomnumber=Math.floor(Math.random()*18)
      var a=randomnumber;

   this.working=true;
        
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", server + "?page=" + a, true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("td");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("a");
                    var urls = [];
    
            

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("?page=1","").replace("/+videos/","").replace("?page=2","").replace("+Video","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0/","/").replace("6/","/").replace("4/","/").replace("3/","/").replace("2/","/").replace("5/","").replace("9/","/"));        
}


// Select Random Track

var randomnumber = Math.floor(Math.random()*(18-117)+117);
i=randomnumber;


{

//Track Name

p.console("Random Track: " + urls[i]);

ooo2 = window.SetProperty("ART2", urls[i]);
ooo2 = urls[i];
window.SetProperty("ART2", urls[i]);

}
      
          im.doc.close();
                    im.working=false;

                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
                im.download();
                
}
}
}
}






        
//Open Youtube-Track in Foobar
    
this.Open_Youtube_Track = function()
  
    {
     this.working=true;
      
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://www.youtube.com/results?search_query=" + ooo2, true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("li");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("a");
                    var urls = [];
    
            

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/watch?v=") == 0) urls.push("http://www.youtube.com/" + data[i].href.replace(/about:\//,""));
}

//Open first youtube video(found)

i = 1;

{

p.console("YT Video" + urls[i]);

var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
p.run(tmppath+"\\foobar2000.exe /add "+"\ " + urls[i] + "\"");                  
                    

}
        
            

         im.doc.close();
                 im.working=false;
                
                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
                }
            }
        }
    }
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-04-03 20:43:13
I have a question about the rating panel in foobox (http://dramawake.deviantart.com/art/foobox-3-7-foobar2000-CUI-config-338022305) that maybe someone here can answer. When I rate something from the panel on the right it writes to file tags instead of the database. Is there a relatively painless method to change that to playback stats database instead?  I believe the code snippet below is what needs to be altered but am not familiar enough with scripting to be certain.

Code: [Select]
ButtonUI.prototype.MouseUp = function(i){
    if(i== mouse_on_flag){
        if (derating_flag){
            g_metadb.UpdateFileInfoSimple("RATING","");
        } else g_metadb.UpdateFileInfoSimple("RATING",i);
        return true;
    }else return false;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-04-03 21:14:34
i think this should do it...

Code: [Select]
ButtonUI.prototype.MouseUp = function(i){
    if (i== mouse_on_flag){
        fb.RunContextCommandWithMetadb("Rating/" + (derating_flag ? "<not set>" : i), g_metadb, 8);
        return true;
    } else {
        return false;
    }
}

Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-04-03 21:27:53
i think this should do it...

It did indeed. Thank you.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-04-03 22:27:08
Code: [Select]
//Open Similar Artist

this.Similar_Art = function()
 
{
//Select Random Page
  var randomnumber=Math.floor(Math.random()*18)
  var a=randomnumber;

this.working=true;

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + START_ARTIST + "/+similar"+ "?page=" + a, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];



for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("about:/music/") == 0) urls.push("http://www.last.fm/music/" + data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0","").replace("6","").replace("4","").replace("3","").replace("2","").replace("5","").replace("9","") + "/+tracks");
}

//Select Random Artist(num)

var randomnumber = Math.floor(Math.random()*(17-46)+46);
i=randomnumber;


{

p.console("Random Artist: " + urls[i]);

server = window.SetProperty("Download  source", urls[i]);
server = urls[i];
window.SetProperty("Download  source", urls[i]);
 
}
im.doc.close();
im.working=false;

} else {
p.console("HTTP error: " + im.xmlhttp.status);
}
}
}
}








//Find Track(For Selected Artist)

this.Track = function()
 
  {

  //Select Random Page

  var randomnumber=Math.floor(Math.random()*18)
  var a=randomnumber;

  this.working=true;

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", server + "?page=" + a, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("td");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];



for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("?page=1","").replace("/+videos/","").replace("?page=2","").replace("+Video","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0/","/").replace("6/","/").replace("4/","/").replace("3/","/").replace("2/","/").replace("5/","").replace("9/","/"));
}


// Select Random Track

var randomnumber = Math.floor(Math.random()*(18-117)+117);
i=randomnumber;


{

//Track Name

p.console("Random Track: " + urls[i]);

ooo2 = window.SetProperty("ART2", urls[i]);
ooo2 = urls[i];
window.SetProperty("ART2", urls[i]);

}
 
  im.doc.close();
im.working=false;

} else {
p.console("HTTP error: " + im.xmlhttp.status);
im.download();

}
}
}
}







//Open Youtube-Track in Foobar

this.Open_Youtube_Track = function()
 
{
this.working=true;
 
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.youtube.com/results?search_query=" + ooo2, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("li");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];



for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("about:/watch?v=") == 0) urls.push("http://www.youtube.com/" + data[i].href.replace(/about:\//,""));
}

//Open first youtube video(found)

i = 1;

{

p.console("YT Video" + urls[i]);

var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
p.run(tmppath+"\\foobar2000.exe /add "+"\ " + urls[i] + "\"");  


}



im.doc.close();
im.working=false;

} else {
p.console("HTTP error: " + im.xmlhttp.status);
}
}
}
}
Yikes, use codebox instead of code for large posts, please.
Title: WSH Panel Mod script discussion/help
Post by: Aldem on 2014-04-04 00:42:37
Well, the spectrogram script seems to ''work'', but the window stays white.

Using Windows 8 - 64 bits

(https://dl.dropboxusercontent.com/u/59380156/FoobarWSHspectro.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-04-04 01:21:00
it looks like sox and/or ffmpeg haven't been put in the right place. here are the notes contained in the script itself.

Quote
/*
SETUP

Download and extract sox.exe to a folder named sox in your foobar2000 profile folder

http://sourceforge.net/projects/sox/files/sox/ (http://sourceforge.net/projects/sox/files/sox/)

Download and extract ffmpeg.exe into the sox folder

http://ffmpeg.zeranoe.com/builds/ (http://ffmpeg.zeranoe.com/builds/)

If you already have these programs installed you can modify the paths below. note the double backslashes.
*/

var sox_exe = fb.ProfilePath + "sox\\sox.exe";
var ffmpeg_exe = fb.ProfilePath + "sox\\ffmpeg.exe";


i guess i could display a more helpful prompt rather than just leaving a blank panel.

Title: WSH Panel Mod script discussion/help
Post by: Aldem on 2014-04-04 01:51:56
I'm stupid, I copied SoX's shortcut instead of the exe by mistake.

Thanks ! 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-04-04 21:11:18
Yikes, use codebox instead of code for large posts, please.


Sorry, i didn't know for codebox..
Anyway i made this to work..
Title: WSH Panel Mod script discussion/help
Post by: Godly on 2014-04-08 17:04:50
Is there any way to remove these 2 options from the art reader?

(http://i.imgur.com/n5e5IxS.png)

I figured out how to remove them from the list there but if I use the scroll wheel on the mouse it's as if they're still there. I'd like to be able to scroll through just front, back and disc.

What does the icon option do btw? I have no idea.



Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-04-08 17:23:12
open the editor dialog and add this right at the end...

Code: [Select]
a.wheel = function(step) {
    if (!this.trace(p.mx, p.my)) return false;
    this.id -= step;
    if (this.id < 0) this.id = 2;
    if (this.id > 2) this.id = 0;
    window.SetProperty("artreader_id", this.id);
    this.metadb_changed();
    return true;
}
Title: WSH Panel Mod script discussion/help
Post by: Godly on 2014-04-08 17:25:12
open the editor dialog and add this right at the end...

Code: [Select]
a.wheel = function(step) {
    if (!this.trace(p.mx, p.my)) return false;
    this.id -= step;
    if (this.id < 0) this.id = 2;
    if (this.id > 2) this.id = 0;
    window.SetProperty("artreader_id", this.id);
    this.metadb_changed();
    return true;
}



Great! Thanks.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-04-15 08:00:33
Need some help again. I have been altering fooRazor bit by bit to something that suits me better but have ran into a snag of sorts. The control bar. I like the functionality and general feel of the config but the rounded corners of the control bar seem out of place. My lack of script knowledge isn't helping and I can't seem to pinpoint how to change them to just a squared corner. I've tried commenting parts out of the control bar config to see what did what but still no luck. Any tips appreciated.

Image pointing out my question. (http://i.imgur.com/BrLbyEi.png)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-04-20 11:53:52
@marc2003 -

Couple of questions about some of your sample scripts. I have been messing around with your themed toolbar script and was wondering if there was a way to state location relative to the window. EG: Place button images in center of window without the need for stating offsets. Currently it's close (http://i.imgur.com/3VHuAqP.png), but was curious if there was a simpler (or more precise) way to make this happen. My problem is not having an example to look at to try and work this out myself.

Next, was wondering if it is possible to use the cover art in that same screenshot as a means to trigger the now playing call back to the playlist? Sort of like the status bar double click. Figured it would be useful if one were to use ui_hacks to hide the status bar.

Also, my question above regarding the rounded corners of fooRazor have been sorted thanks to bb10.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-04-20 12:26:36
you can center the buttons if you replace your on_size function with this.

Code: [Select]
function on_size() {
    p.size();
    var bx = Math.round((p.w - (bw * 6)) / 2);
    b.buttons = {
        b1: new button(bx, 5, bw, bh, {normal: "stop.png"}, function() { fb.Stop(); }, "Stop", true),
        b2: new button(bx + bw, 5, bw, bh, {normal: "pause.png"}, function() { fb.Pause(); }, "Pause", true),
        b3: new button(bx + (bw * 2), 5, bw, bh, {normal: "play.png"}, function() { fb.Play(); }, "Play", true),
        b4: new button(bx + (bw * 3), 5, bw, bh, {normal: "previous.png"}, function() { fb.Prev(); }, "Previous", true),
        b5: new button(bx + (bw * 4), 5, bw, bh, {normal: "next.png"}, function() { fb.Next(); }, "Next", true),
        b6: new button(bx + (bw * 5), 5, bw, bh, {normal: "preferences.png"}, function() { fb.ShowPreferences(); }, "Preferences", true)
    }
}


you can't mimic the double clicking of the status bar in default UI as there is no menu command to do it. it's only possible with columns. that also allows you to hide the status bar without using banned components.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-04-20 16:39:43
Thanks again.

And one more if you don't mind... Your Autoplaylist script has save slots. Can those slots be represented by buttons which are accessible in that panel? Sorry to pester, but I'm curious about what can be done with this scritpting stuff.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-04-22 10:56:27
you can't mimic the double clicking of the status bar in default UI as there is no menu command to do it. it's only possible with columns.


Had to ask directly and was promptly reminded that some things are hidden by default. Shift+click on View shows there is a menu item for this. Thought it might be useful for you if you get more silly question like mine in the future.

Thanks again for all your help.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-04-22 12:23:48
Shift+click on View shows there is a menu item for this.


if you're talking about show now playing then you're mistaken. that only shows a tooltip in the notification area. it does not make the cursor jump back to the playing track.
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2014-04-22 13:01:07
Huh? "View/ Show Now Playing" works for me in DUI since ages. It behaves like the doubleclick on the statusbar and jumps to the playing track, even if I'm in another playlist.

I use your your WSH buttons script with: function() { fb.RunMainMenuCommand("View/Show Now Playing"); }, "Show Now Playing", true)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-04-22 13:14:05
you're both right. i tried a fresh portable install and it works. i guess some option or maybe other component is interfering on my main install? 

edit: file>preferences>display>default user interface>always show notification icon is the culprit. if i turn that off, it works as expected.
Title: WSH Panel Mod script discussion/help
Post by: Koyber on 2014-04-22 23:32:32
Hi, I have a question for marc2003:

I'm using Simple Tag Reader for quite a good time now for showing lyrics and always worked perfect, but I was going to read some lyrics today and for no apparent reason it just shows a dot (.) instead of the lyrics.
I've tried using another tag and works perfect, it's not because of multiple lines inside the tag because it can display lyrics if I put them in "composer", for example. But it just not displays anything that is inside lyrics. If there is something written it displays a dot, and if not then a question mark, but that's normal.

Any ideas?
Thanks.
Title: WSH Panel Mod script discussion/help
Post by: elia_is_me on 2014-04-23 03:08:13
Hi, I have a question for marc2003:

I'm using Simple Tag Reader for quite a good time now for showing lyrics and always worked perfect, but I was going to read some lyrics today and for no apparent reason it just shows a dot (.) instead of the lyrics.
I've tried using another tag and works perfect, it's not because of multiple lines inside the tag because it can display lyrics if I put them in "composer", for example. But it just not displays anything that is inside lyrics. If there is something written it displays a dot, and if not then a question mark, but that's normal.

Any ideas?
Thanks.

find out your "LargeFieldsConfig.txt" file (maybe in %appdata%\foobar2000 or your foobar2000's root path) and change three lines below:

Code: [Select]
defaultMetaMax=8000
#fieldSpam=lyrics
#fieldSpam=unsynced lyrics
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-04-23 03:58:54
Wouldn't it be better to remove those two entries from the fieldSpam list and add them to the fieldBasic list and leave the defaultMetaMax size set to 1000?

The basicMetaMax (which governs the size limit of the fieldBasic list) is set to 2000 and that should be big enough for most Latin-based alphabets, esp. when the lyrics are in English.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-04-23 09:18:03
I was going to read some lyrics today and for no apparent reason it just shows a dot (.) instead of the lyrics.


the reason is that you must have upgraded foobar to a new version. 1.3 and above have this new feature where certain tags are no longer cached by foobar's library/playlist mechanism. it's supposed to improve performance on large collections.

it's mentioned in the changelog here: http://www.foobar2000.org/changelog (http://www.foobar2000.org/changelog)


Title: WSH Panel Mod script discussion/help
Post by: Koyber on 2014-04-23 13:33:53
You are right marc2003, I've upgraded this week to the last version, but I did what elia_is_me says plus adding "fieldBasic=lyrics" in the Basic field section (no need for the "defaultMetaMax" change) and now it works perfect!!

Thanks to both!!
Title: WSH Panel Mod script discussion/help
Post by: StealthX on 2014-04-28 16:22:44
Getting this error on a standard installation

Code: [Select]
Scripting Engine Initialization Failed (News / Reviews / Blogs by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).


Works fine on a portable installation. What am I doing wrong, it seems like I can not get anything to work on a standard installation that works fine on my portable.

Edit: Was missing common7.js and now that script works, at least that is one problem solved. Sorry!

Edit 2: You May be able to help me with this though

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common7.js"
// @name "News / Reviews / Blogs"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var p = new panel("News / Reviews / Blogs", ["remap", "metadb", "echonest"]);
var li = new list(6, 30, p.w - 12, p.h - 30);

on_item_focus_change();

function on_size() {
    p.size();
    li.w = p.w - 12;
    li.h = p.h - 30;
    li.size();
}

function on_paint(gr) {
    p.draw_background(gr);
    p.left_text(gr, p.artist + ": " + li.echonest_modes[li.echonest_mode], p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
    gr.DrawLine(6, 29, p.w - 6, 29, 1, p.textcolour_hl);
    switch(true) {
        case !p.metadb:
            p.centre_text(gr, "[no selection]", p.normal_font, p.textcolour, 0, 0, p.w, p.h);
            break;
        case li.items > 0:
            li.draw(gr);
            break;
        default:
            p.centre_text(gr, "[nothing found]", p.normal_font, p.textcolour, 0, 0, p.w, p.h);
            break;
    }
}

function on_metadb_changed() {
    li.metadb_changed();
}

function on_mouse_wheel(step) {
    li.wheel(step);
}

function on_mouse_move(x, y) {
    p.move(x, y);
    if (li.move(x, y)) return;
}

function on_mouse_lbtn_up(x, y) {
    if (li.lbtn_up(x, y)) return;
}


This displays the date as DAY-MONTH-YEAR what can I do to make it display it as MONTH/DAY/YEAR ?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-05-02 11:08:54
Does someone know how to access html ''class'' element?
I have to access: class ''name''.
I try to use this: getElementsByClass(String className) , but didn't work?

script i use is:
Code: [Select]
for (i = 0; i < data.length; i++) {
     if (data[i].href.indexOf("about:/tag/" + encodeURIComponent(START_ARTIST).replace("*","")) == 0) urls.push(data[i].href.replace(/about:\//,""));
}


html looks like this: <a class=''name'' href=''/music/metalica/''>

I must to determinate if before 'href' exist tag class=''name'', and to use only this 'href'..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-02 12:16:50
simply use className eg

Code: [Select]
var data = div.getElementsByTagName("a");
for (i = 0; i < data.length; i++) {
    if (data[i].className == "name") //do something
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-05-02 13:10:29
simply use className eg

Code: [Select]
var data = div.getElementsByTagName("a");
for (i = 0; i < data.length; i++) {
    if (data[i].className == "name") //do something
}


Great, thanks Marc, it work

Code: [Select]
for (i = 0; i < data.length; i++) {
    if (data[i].className.indexOf("name") == 0)
    if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.replace(/about:\//,"");
}

Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2014-05-04 19:29:35
Marc, I want to add "stop after current" button to your playback buttons script (simple one)
I tried to add this line in "b.update = function()" section, but script crashed after clicking on the button.

Quote
button8: new button(126, 0, 32, 32, {normal: "sac.png", hover: "sac_h.png"}, function() { fb.StopAfterCurrent(); }, "Stop After Current"),


I have added a few buttons before and they work. Is there a way to fix this button? 

is it possible to make stop after current button, which indicates whether the button is pressed or not
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-04 20:06:33
try this...

Code: [Select]
button8: new button(126, 0, 32, 32, {normal: fb.StopAfterCurrent ? "sac_h.png" : "sac.png", hover: fb.StopAfterCurrent ? "sac.png" : "sac_h.png"}, function() { fb.StopAfterCurrent = !fb.StopAfterCurrent; }, "Stop After Current"),

Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2014-05-04 21:28:22
Thank you

Button works but highlighting does not. Button still turns gray after I press it and move cursor away. Highlights only after i manually pause song. Same with unchecking
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-04 22:01:44
replace this bit...

Code: [Select]
function() { fb.StopAfterCurrent = !fb.StopAfterCurrent; }


with

Code: [Select]
function() { fb.StopAfterCurrent = !fb.StopAfterCurrent; b.update(); }
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2014-05-04 22:23:39
Now it works perfectly. Thanks again 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-04 22:31:17
thinking about it, you should revert that code back to what it was before. now add this function at the end of the script.

Code: [Select]
function on_playlist_stop_after_current_changed() {
    b.update();
}


now the button image will also update if you change the setting from the Playback menu or preferences.

Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-08 21:19:41
Hey marc, any idea why your scripts don't see dynamic info from a radio stream accessed through an m-TAGS file? All I see is the static info from the m-TAGS file.

So is this a limitation of WSH Panel Mod or is it all your fault?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-08 22:27:04
edit: temporary link removed. permanent fix can be had by right clicking panel>Update script.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-08 22:54:51
Yeah, that's got it working. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-08 23:44:07
i just realised that wasn't a proper fix i posted. it broke other things so i've reverted it. i'll need to look into this some more.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-09 20:21:47
I guess I didn't test it thoroughly enough because all the scripts I tried (almost all of them) functioned.

The Thumbs script initially worked but after you removed the link and I used "Update script", it crashed and will not work.

Anyway, I guess I'll continue to use the broken version as I really only want to use the scripts for information regarding artists I know nothing about (and I only hear those artists in radio streams). I won't stop using m-TAGS as it's very handy for tagging radio streams which otherwise would lack the info, have wrong info or point to the fact they were tagged by an idiot.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-09 20:25:21
can you provide a sample tags file pointing at a stream with dynamic titles because i'm not familiar with the component. then i can have a go at properly fixing it.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-09 21:29:10
As you can see there's nothing particularly special about a file itself. Once you load a playlist file or stream url in foobar, creating an m-TAGS file simply saves the information in a text file. You can then edit this static information.

Code: [Select]
[
  {
      "@" : "http://50.7.77.114:8114/",
      "GENRE" : "House",
      "TITLE" : "EDM1.fm -- House Party",
      "URL" : "EDM1.fm/HouseParty"
  },
  {
      "@" : "http://50.7.77.114:8399/",
      "GENRE" : "Progressive (Underground)",
      "TITLE" : "EDM1.fm -- Progressions",
      "URL" : "EDM1.fm/Progressions"
  },
  {
      "@" : "http://50.7.77.114:8573/",
      "GENRE" : "Vocal Trance, Progressive House",
      "TITLE" : "EDM1.fm -- Sublime (Pure Vocal melodies)",
      "URL" : "EDM1.fm/Sublime"
  },
  {
      "@" : "http://50.7.77.114:8387/",
      "GENRE" : "Tech House",
      "TITLE" : "EDM1.fm -- **NEW** Tech House",
      "URL" : "http://www.EDM1.fm/TechHouse"
  },
  {
      "@" : "http://50.7.77.114:8540/",
      "GENRE" : "Electro, Progressive House",
      "TITLE" : "EDM1.fm -- The Drop",
      "URL" : "EDM1.fm/The Drop"
  },
  {
      "@" : "http://50.7.77.114:8408/",
      "GENRE" : "Trance",
      "TITLE" : "EDM1.fm -- Trancemitter",
      "URL" : "EDM1.fm/Trancemitter"
  },
  {
      "@" : "http://50.7.77.114:8418/stream",
      "GENRE" : "Downtempo",
      "TITLE" : "EDM1.fm Chillzone -- Chillout Classics",
      "URL" : "http://edm1.fm/chilloutclassics"
  }
]

If you open the Properties dialog and view the Properties tab for a playlist entry, you'll see, for example:
Code: [Select]
File name : EDM1.fm.tags
Folder name : C:\Users\~\Music\MTags
File path : C:\Users\~\Music\MTags\EDM1.fm.tags
Subsong index : 4
File size : 1.23 KB (1 263 bytes)
Last modified : 2014-05-09 14:47:33
Sample rate : 44100 Hz
Channels : 2
Bitrate : 256 kbps
Codec : MP3
Encoding : lossy
Added : 2014-05-09 14:41:55
<@> : http://50.7.77.114:8387/
<@REFERENCED_FILE> : http://50.7.77.114:8387/
<@REFERENCED_INDEX> : 0
<MP3_STEREO_MODE> : joint stereo
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-10 00:38:23
those streams you gave didn't appear to have dynamic titles?? anyway, i found something else to test with. try this....

https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-10 23:12:02
Hmm I don't know what was up with those streams when you tried them.

Anyhow the Thumbs script doesn't crash WSH Panel Mod now, but the automatic downloading only works maybe 20% of the time. Console only gives a 404 message. It does work if I manually trigger it.

The main issues I'm seeing are related to album info. That's expected since that is often not present in streams; however, I've tried some scripts (where possible) which grab the album info when it's in the title tag or in the URL, but nothing happens.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-10 23:37:35
from the foo_tags thread...

Now m-TAGS merges its tags with the dynamic info. Please note that m-TAGS takes precedence, i.e. the dynamic tag is shown if the m-TAGS file does NOT contain that tag.


if you have title defined in your tags file, you can't access the dynamic title in the stream.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-11 01:41:56
That statement by the developer just doesn't mesh with my use of the component. I can see and manipulate dynamic titles and URLs for display purposes and for use in foo_audioscrobbler.

When I tried inputting my "album" scripts into your scripts, I got a message from the component they were too long lol or your script gave me a "Not Found", crashed or did nothing.

Any idea what the issue with the Thumbs script could be?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-11 02:31:31
That statement by the developer just doesn't mesh with my use of the component.


well that conflicts with my own testing. for me, it behaves like the developer said it would.

admittedly i'm not using anything with dynamic album or title - just the artist. i tested this bbc radio stream...

http://bbc.co.uk/radio/listen/live/r2.asx (http://bbc.co.uk/radio/listen/live/r2.asx)

if i start with a blank WSH panel and add this bit of code to output the artist to the console every second.

Code: [Select]
window.SetInterval(function() {
    fb.trace(fb.TitleFormat("%artist%").Eval(true));
}, 1000);


it displays BBC when playback is stopped and BBC Radio 2 when the stream is playing.

when i create a tags file with the artist set to BBC test, that's all the console outputs.

Code: [Select]
[
   {
      "@" : "mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio2/radio2_bb_live_ep1_sl0?BBC-UID=a5d3267e7c5e856658f4445661b55373b9b59192605021f414ffa4a6e3baa91a&SSO2-UID=|0",
      "ARTIST": "BBC test"
   }
]


it never changes to BBC Radio 2 when playing. as soon as i edit the tags file to remove the artist and reload the file in the playlist, it does then display the dynamic BBC Radio 2 title when playing. this is completely at odds with what you're saying.

as for the thumbs script, it doesn't support automatically downloading when the stream artist changes. i guess i should add something in the readme to clarify this.

Quote
I got a message from the component they were too long lol


hold shift and right click the panel>properties. you should be able to enter longer title formatting strings there. it's generally artist_tf for most scripts. the values in the allmusic script should be self explanatory if you're using that.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-11 04:48:24
Here's what I see in the Console with your code

using %artist% (No artist tags in my m-TAGS files)

(http://i1000.photobucket.com/albums/af128/Benjobr/artist_zpsa48dd7ab.gif)

using %title% (I do have title tags in my m-TAGS files)

(http://i1000.photobucket.com/albums/af128/Benjobr/title_zps779ef38b.gif)

using %url%  (I do have url tags in my m-TAGS files)

(http://i1000.photobucket.com/albums/af128/Benjobr/url_zpsb2e55a31.gif)

Maybe we have different versions of the component?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-11 12:33:05
Maybe we have different versions of the component?


perhaps?? i'm using 0.1

anyway, what started it all was this...

Quote from: BenB link=msg=0 date=
The main issues I'm seeing are related to album info. That's expected since that is often not present in streams; however, I've tried some scripts (where possible) which grab the album info when it's in the title tag or in the URL, but nothing happens.


you're going to have to be more specific about what you're doing and what you're expecting to happen. what script, what custom title formatting are you using, what stream? what happens when you bypass foo_tags and play the stream directly?
Title: WSH Panel Mod script discussion/help
Post by: oatmeal769 on 2014-05-11 17:09:17
Sorry to resurrect...

This is a great mod, Glad I found it!

I'm wondering if anyone knows how to show an image named "front.jpg" or "cover.jpg" which is located in the same folder as the "disc.png" image used for the spinning disc? The plain gray background is kinda boring, I thought it'd be cool to use the album front cover as the background.

Thanks!


Updated Spinning disc script here (http://pastebin.com/Z8TCfmj7)

Added: Display now playing disc first, if not available  display default disc image.
(set source in Preferences/Display-Album art Disc)

Added: gradient background.
Added: disc mask. (now you can display non transparent disc images like  jpg. just use correctly cropped images (edge to edge)).

screen-shot with jpg disc image

(http://img33.imageshack.us/img33/360/24012013220819.png)

Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-12 03:50:14
perhaps?? i'm using 0.1

I have a few versions and they're all 0.1 LMAO

Anyhow I think I know why I can access the info and you can't. Look at the properties of a station referenced by an m-TAGS file. If <@REFERENCED_FILE> is blank, your scripts cannot access the dynamic info (although foobar can). I'm fairly sure you can solve this by ticking "Only use absolute paths in references" in foo_tags' Advanced Preferences. (I also have "Ignore source tags" and "Replace existing files" ticked. I don't think they'd have any effect, but who knows?).

you're going to have to be more specific about what you're doing and what you're expecting to happen. what script, what custom title formatting are you using, what stream? what happens when you bypass foo_tags and play the stream directly?

I've managed to get the Allmusic script working somewhat. I'll do some more testing before I bitch and whine at you some more 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-12 14:58:25
If <@REFERENCED_FILE> is blank, your scripts cannot access the dynamic info (although foobar can).


that's because i was checking the value of @REFERENCED_FILE to see if it was a stream. if it was missing, it was falling back to %path%. i've changed it to check the value of the @ field instead.

https://dl.dropboxusercontent.com/u/2280132...temp/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common7.js)

@oatmeal769, drawing one image over the top of the other and spinning results in pretty much unusable performance. it's not worth it.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-13 21:42:17
Thanks marc. It seems to be working better now, but I'm still having having some issues with the Allmusic album script. I've tried several scripts and this version of the part for grabbing the album info from the url seems to work best (although some seem to match but return nothing):

Quote
$if($and(%url%,$strstr(%url%,&album=),$not($strstr(%url%,&album=&))),
$replace($substr(%url%,$add($strstr(%url%,&album=),7),$sub($strstr(%url%,&duration),1)),
%%20, ,%%21,!,%%22,",%%23,#,%%24,$,%%25,%%,%%26,&,%%27,'',%%28,'(',%%29,')',%%2A,*,%%2B,+,%%2C,',',%%2D,-,%%2E,.,%%2F,/,%%3A,:,
%%3B,;,%%3C,<,%%3D,=,%%3E,>,%%3F,?,%%40,@,%%5B,'[',%%5C,\,%%5D,']',%%5E,^,%%5F,_,%%60,`,%%7B,{,%%7C,|,%%7D,},%%7E,~,%%A1,¡,%%A2,¢,%%A3,£,%%A9,©,
%%AA,ª,%%AE,®,%%B0,°,%%B2,²,%%B3,³,%%B4,´,%%B9,¹,%%BA,º,%%BF,¿,%%C0,À,%%C1,Á,%%C2,Â,%%C3,Ã,%%C4,Ä,%%C5,Å,%%C6,Æ,%%C7,Ç,%%C8,È,%%C9,É,%%CA,Ê,
%%CB,Ë,%%CC,Ì,%%CD,Í,%%CE,Î,%%CF,Ï,%%D0,Ð,%%D1,Ñ,%%D2,Ò,%%D3,Ó,%%D4,Ô,%%D5,Õ,%%D6,Ö,%%D7,×,%%D8,Ø,%%D9,Ù,%%DA,Ú,%%DB,Û,%%DC,Ü,%%DD,Ý,%%DE,Þ,
%%DF,ß,%%E0,à,%%E1,á,%%E2,â,%%E3,ã,%%E4,ä,%%E5,å,%%E6,æ,%%E7,ç,%%E8,è,%%E9,é,%%EA,ê,%%EB,ë,%%EC,ì,%%ED,í,%%EE,î,%%EF,ï,%%F0,ð,%%F1,ñ,%%F2,ò,%%F3,ó,
%%F4,ô,%%F5,õ,%%F6,ö,%%F7,÷,%%F8,ø,%%F9,ù,%%FA,ú,%%FB,û,%%FC,ü,%%FD,ý,%%FE,þ,%%FF,ÿ,),%album%)

However, I'm having an issue with double quotes (emphasized in red, above). It's inclusion breaks your script and my code. If I escape it with single quotes, it fixes that particular problem, but those single quotes also break the script/code. The only way to make it work is to remove the double quote character, but that potentially breaks the album matching. Any ideas on how I can fix it?

Also, how are the albums matched, and must they be exact matches or is there a little wiggle room?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-14 02:05:01
i tried re-creating your scenario and your code works fine. you did use the properties dialog and didn't try editing the script??

(https://dl.dropboxusercontent.com/u/22801321/2014/may/benb.png)

there is a javascript function i could use to get rid of that massive replace string that does it all for you called decodeURIComponent. if i add it, i'll let you know.

as for matching, it has to be pretty much exact. i use the $ascii title formatting function on the search term/results and also ignore &/and and make everything lower case.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-14 21:27:46
i tried re-creating your scenario and your code works fine. you did use the properties dialog and didn't try editing the script??

I somehow introduced an error into the script at some point adding it in the properties dialog. I also added it to the script in the panel where the double quotes cause my code to break (which is where I got the idea it was also breaking your script).

there is a javascript function i could use to get rid of that massive replace string that does it all for you called decodeURIComponent. if i add it, i'll let you know.

This would help as I think I will have to add another $replace() to clean up some of the junk in order to get more matches. That replace string is actually pared down to what I thought I could get away with. It was much bigger. I might be able to pare it down a little more.

as for matching, it has to be pretty much exact. i use the $ascii title formatting function on the search term/results and also ignore &/and and make everything lower case.

I figured it was fairly tight because sometimes what appears to be matches return nothing. I've yet to find the cause in those instances.

Many times what's in the url for album is incorrect or incomplete. Album subtitles are either missing or are used in place of the album title    and a missing initial "The" and Allmusic's extraneous information in brackets/parentheses following the actual album title seems to be also preventing matches. I can see why most media players ignore the information. I'm about ready to give up and use it solely for display purposes because it's not really worth the aggravation of constantly tweaking it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-15 00:50:22
i really can't be bothered to test this properly but you can try adding to the allmusic panel. just stick it at the end.

Code: [Select]
t.tidy = function(text) {
    return decodeURIComponent(fb.TitleFormat("$replace($lower($ascii(" + text + ")), & ,, and ,)").Eval(true));
}


then your own title format code can be simplified to only extract the album from the URL if present.

Code: [Select]
$if($and(%url%,$strstr(%url%,&album=),$not($strstr(%url%,&album=&))),$substr(%url%,$add($strstr(%url%,&album=),7),$sub($strstr(%url%,&duration),1)),%album%)


i just don't have the skills to make it better at matching. i expect something better is possible but i wouldn't know where to begin.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-15 03:51:41
@BenB, ignore that function in the post above. it won't work. it doesn't do anything to the search term before it's sent. i'll have to think about it some more.
Title: WSH Panel Mod script discussion/help
Post by: oatmeal769 on 2014-05-16 01:11:12
Anyone? It can't be too hard, but I'm a novice at writing this stuff, and don't want to mess it up.
Thanks!

Sorry to resurrect...
This is a great mod, Glad I found it!

I'm wondering if anyone knows how to show an image named "front.jpg" or "cover.jpg" which is located in the same folder as the "disc.png" image used for the spinning disc? The plain gray background is kinda boring, I thought it'd be cool to use the album front cover as the background.

Thanks!


Updated Spinning disc script here (http://pastebin.com/Z8TCfmj7)

Added: Display now playing disc first, if not available  display default disc image.
(set source in Preferences/Display-Album art Disc)

Added: gradient background.
Added: disc mask. (now you can display non transparent disc images like  jpg. just use correctly cropped images (edge to edge)).

screen-shot with jpg disc image

[img]


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-16 03:03:34
i did answer your question but you must have missed it as it was bolted onto the end of one of my posts.

@oatmeal769, drawing one image over the top of the other and spinning results in pretty much unusable performance. it's not worth it.
Title: WSH Panel Mod script discussion/help
Post by: oatmeal769 on 2014-05-16 04:29:49
i did answer your question but you must have missed it as it was bolted onto the end of one of my posts.
Yes, I did, sorry.  Thank you though, at least I know.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-16 16:08:57
@BenB, ignore that function in the post above. it won't work. it doesn't do anything to the search term before it's sent. i'll have to think about it some more.

I saved it, but only got a chance to test it this morning. I should've read the forum first. Thanks for trying
Title: WSH Panel Mod script discussion/help
Post by: oatmeal769 on 2014-05-16 17:38:39
Well, I figured out how to make the BG a solid black, which is better than the gray I suppose.
i did answer your question but you must have missed it as it was bolted onto the end of one of my posts.

@oatmeal769, drawing one image over the top of the other and spinning results in pretty much unusable performance. it's not worth it.


Title: WSH Panel Mod script discussion/help
Post by: NokTham on 2014-05-17 01:03:56
Hey marc2003 I've been getting this on the console

Quote
Last.fm & Wikipedia Biography: <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.4.7</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->


dunno if it's a problem form my end or from something else
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-17 05:35:30
it's working fine for me at the moment so hopefully it was just a temporary glitch at the time you posted??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-17 06:36:00
@BenB, ignore that function in the post above. it won't work. it doesn't do anything to the search term before it's sent. i'll have to think about it some more.

I saved it, but only got a chance to test it this morning. I should've read the forum first. Thanks for trying


edit: i did post something but i need to test it first. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-17 08:27:56
@BenB, just right click your allmusic panel and Update script. make sure the script inside the panel is untouched (without that snippet i posted the other day). now you should be able to get rid of that super long $replace function.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-17 20:18:04
Thanks a lot marc. Now I can work on my script and hopefully will get better/more matches.

One question: Does the Allmusic script only look for matches with an artist's albums? It seems like it because I don't think I've ever got matches for any artist compilations/anthologies.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-17 21:37:44
it looks up albums without an artist name first. it then tries to match artist/album on only the first page of results. the more generic the album title is (like greatest hits), the less likely you are to get a result.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-05-17 22:58:20
Just a thought: in the VBS script he created for the same kind of allmusic searches, Romor added a feature that would include both album artist and album in the search string if the album tag field had fewer than a certain number of characters.  It is very effective in bringing up the desired result to the first page of results for short album tag fields or album tag fields that contain common words like "greatest" or "best of" or similar, if the number of characters to trigger appending is less than 8 for these two examples or another user-set number to subsume other common terms.  Perhaps consider creating a variable reachable via the properties menu to set the minimum number of characters in the album tag field to trigger the appending action.
Title: WSH Panel Mod script discussion/help
Post by: NokTham on 2014-05-17 23:55:02
it's working fine for me at the moment so hopefully it was just a temporary glitch at the time you posted??


You were right marc2003, it was a temporary glitch. Thank you
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2014-05-18 03:41:34
updates!

WSH Playlist Viewer v2.0 (final)
WSH CoverFlow v1.4

* Scripts available at http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

* I have included them in a simple DefaultUI config (just a .fth to import), for those who are interested, get it at http://fav.me/d4z1j0w (http://fav.me/d4z1j0w)



I have a general question about Coverflow. maybe for Brett or for Marc?

When a cover is selected in coverflow, simplaylist will update to show the selection, but not other (marc2003) WSH panels; those panels remain on now playing and not the selection. I need to select the item again in simplaylist before other WSH panels are updated.

Is this a WSH limitation?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-18 05:43:07
i don't usually use the falstaff's coverflow script but i did a quick test and it behaved exactly as expected with my scripts.

are you sure you have the right setting set on the right click menu>Selection mode? this setting is not shared - they need to be set on a per panel basis.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-18 14:27:12
Just a thought: in the VBS script he created for the same kind of allmusic searches, Romor added a feature that would include both album artist and album in the search string if the album tag field had fewer than a certain number of characters.  It is very effective in bringing up the desired result to the first page of results for short album tag fields or album tag fields that contain common words like "greatest" or "best of" or similar, if the number of characters to trigger appending is less than 8 for these two examples or another user-set number to subsume other common terms.  Perhaps consider creating a variable reachable via the properties menu to set the minimum number of characters in the album tag field to trigger the appending action.


i've updated the script so it appends the artist to all searches. right click panel>Update script.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2014-05-18 15:15:47
are you sure you have the right setting set on the right click menu>Selection mode? this setting is not shared - they need to be set on a per panel basis.


I had chosen: selection mode>use display preferences.

my display prefs are: "Prefer current selection"

with those settings, your/my discogs script (update script says most current version is running) does not change when a coverflow item is selected.
However, simplaylist does update and if I make a selection in simplaylist, only then will the discogs view also update.

If I change: selection mode>prefer now playing, discogs always displays the now playing regardless of selection

If I change: selection mode>follow selected track, discogs *will* display the coverflow item when selected.

----

I guess the behaviour 'issue' is that:

selection mode>use display preferences

with simplaylist: clicking in the playlist, the discogs panel will update to show selection. clicking off of the playlist (on app edges for example) reverts the discogs panel to the now playing info. so you can switch back and forth easily between a selection and now playing.

coverflow interaction does not follow this behavior for some reason?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-18 16:04:34
Quote
clicking off of the playlist (on app edges for example) reverts the discogs panel to the now playing info.


are you sure that's with the main foobar preference to prefer the selected track? that's different from what i experience. i find doing that makes my panel makes my panel display details of the first item in the playlist.

anyway, using coverflow doesn't update the default UI selection properties either so it looks to be a limitation of the WSH component as a playlist viewer/default UI preferences set to prefer current track.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2014-05-18 16:21:01
Quote
clicking off of the playlist (on app edges for example) reverts the discogs panel to the now playing info.


are you sure that's with the main foobar preference to prefer the selected track?


yep, clicking on any interface edges (hastily drawn in red for example)


thanks for checking.

----

btw, I do have another interesting undocumented feature in your scripts.

with "Enable layout editing mode" on and selecting 'properties' of your scripts, enhanced custom settings can be made - such as setting custom thumbnail sizes for example.

One tweak I'm wondering about is on your "Simple Tag Reader" script.

If I edit the properties as described above, I can use a really long custom tag, but if I try the same custom tag in the normal interface settings, I get a tag too long error, visit forums.

Just wondering why the restriction?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-19 22:36:24
yes you can use the properties dialog to enter strings that are long. the dialog i use has a max limit of 254 characters which is why you get a message.

also, you don't have to enable layout editing mode. you can hold shift before right clicking and you'll get the Properties option on the right click menu.
Title: WSH Panel Mod script discussion/help
Post by: Sequest on 2014-05-23 16:07:34
I had a trouble getting last.fm panel to work. When I start foobar I get

Quote
Scripting Engine Initialization Failed (WSH Last.fm panel, CODE: 0x80020101)


and console says

Quote
Error: WSH Panel Mod (WSH Last.fm panel): Error compiling Microsoft JScript:
Assumed presence of identificator, line or number
File <main>
Ln: 381, Col: 9
}


That's not a direct quote but close translation of it. I've looked around and found no solution to this problem

Not sure if this is the wrong place to post this, I am sorry if it is.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-23 23:13:26
i've never seen that before. can you link to what script you're trying to use.
Title: WSH Panel Mod script discussion/help
Post by: Sequest on 2014-05-24 02:44:14
It's a custom last.fm script based on the one made by so_kindly, it's a part of StrigUI.

http://pastebin.com/7iu12STp (http://pastebin.com/7iu12STp)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2014-05-24 10:27:30
It's a custom last.fm script based on the one made by so_kindly, it's a part of StrigUI.

http://pastebin.com/7iu12STp (http://pastebin.com/7iu12STp)


line 380, remove the comma set at the end, it has nothing to do here...

380:      CursorFollowMode: window.GetProperty("B01.Panel.CursorFollowMode", CursorFollowMode.OnlyStopped),

HTH
Title: WSH Panel Mod script discussion/help
Post by: Sequest on 2014-05-24 12:07:02
It worked! Thank you very much!
Title: WSH Panel Mod script discussion/help
Post by: musikomaniak on 2014-05-25 17:58:07
@Falstaff, WSH Playlist Viewer 2013
It would ne great if it was possible to rename playlist. It would be very useful for example to rename radio stations, like it is possible with eSPlaylist.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-25 18:13:22
i've updated the script so it appends the artist to all searches. right click panel>Update script.

This helps return more matches, esp. with generic album titles. My main nuisance now is various artist albums, but that's my problem to figure out. Anyway, thanks again for all the help.
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-25 23:33:11
I'm curious as to whether %list_index% is accessible for the playing track and to know if anyone has contemplated or actually made a status bar script either as an adjunct (or a replacement for use in CUI) ?

I'm asking because of this thread (http://www.hydrogenaudio.org/forums/index.php?showtopic=104707) and others in a similar vein.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-26 00:46:55
My main nuisance now is various artist albums, but that's my problem to figure out. Anyway, thanks again for all the help.


only one of my various artist albums exists on allmusic and it's rather odd that it's not found if various artists is sent as part of the search. it is found if i omit it and search for the album title only. if you want to try this yourself, open the file common7.js (inside the marc2003 folder) and find this line of code..

Code: [Select]
this.allmusic_search = "http://www.allmusic.com/search/albums/" + encodeURIComponent(this.album + " " + this.artist);


replace it with

Code: [Select]
this.allmusic_search = "http://www.allmusic.com/search/albums/" + encodeURIComponent(this.album + (this.artist.toLowerCase() == "various artists" ? "" : " " + this.artist));


here's a quick and dirty status bar which shows the playing item index.

https://dl.dropboxusercontent.com/u/2280132...tatus%20bar.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/status%20bar.txt)

(it is reliant on having the marc2003 folder from my pack of scripts being present)
Title: WSH Panel Mod script discussion/help
Post by: Z4g5r on 2014-05-27 18:08:47
Hi guys. Is this a place to request a little something based on WSH? I hope so, because I'm in need of cover retriever. A one that would simply grab a cover image from junodownload, basing on Artist/Album info.

Though actually, I was thinking that it could be simpler to make it sweep across google images. For example - it runs a search on query "Artist - Title" or "Publisher - Catalog number"(which it automatically grabs from tags) plus it has a little configuration window where one can punch in some additional words like "junodownload", "bandcamp" or maybe "-itunes" to remove it from search and set dimensions and image size so that it would narrow the final results. Why then you just see the results, press the picture and it automatically saves it to a folder under name of "cover.jpg" or any other one, maybe the one you'd choose it configuration window of a Mod.

Would such thing take a long to make?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-05-27 20:06:24
Hi guys. Is this a place to request a little something based on WSH? I hope so, because I'm in need of cover retriever. A one that would simply grab a cover image from junodownload, basing on Artist/Album info.

Though actually, I was thinking that it could be simpler to make it sweep across google images. For example - it runs a search on query "Artist - Title" or "Publisher - Catalog number"(which it automatically grabs from tags) plus it has a little configuration window where one can punch in some additional words like "junodownload", "bandcamp" or maybe "-itunes" to remove it from search and set dimensions and image size so that it would narrow the final results. Why then you just see the results, press the picture and it automatically saves it to a folder under name of "cover.jpg" or any other one, maybe the one you'd choose it configuration window of a Mod.

Would such thing take a long to make?


I have already made ''biografy photos'' modified Marc ''thumbs script'' that use google or yahoo to search pic.
You can enter in search query ''custom search terms''- ''junodownload'' , ''last.fm'' , ''itunes'' ex., it should work, but it's not perfect.
You don't have control what google will display in search results, so you must create filter...
Anyway this is possible..

Problem is that my script loads small pictures only (Marc can do this better..)

Did you try this?: http://www.hydrogenaud.io/forums/index.php?showtopic=103907 (http://www.hydrogenaud.io/forums/index.php?showtopic=103907)
Title: WSH Panel Mod script discussion/help
Post by: Z4g5r on 2014-05-27 20:42:25
Awesome. Thanks, mire777.
Now I just need to learn how to limit the dimensions and size.


Can't seem to set a hotkey to it - what's up with that? Using google component.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-05-28 11:46:19
Awesome. Thanks, mire777.
Now I just need to learn how to limit the dimensions and size.


Can't seem to set a hotkey to it - what's up with that? Using google component.


For hotkey you go here:
File>preferences>keyboard shortcuts>

Find: [context] download picture / cover

For dimensions and size limit, seems that there is no such option, so you must ask developer for this..
Title: WSH Panel Mod script discussion/help
Post by: BenB on 2014-05-28 19:12:36
Code: [Select]
this.allmusic_search = "http://www.allmusic.com/search/albums/" + encodeURIComponent(this.album + " " + this.artist);

Code: [Select]
this.allmusic_search = "http://www.allmusic.com/search/albums/" + encodeURIComponent(this.album + (this.artist.toLowerCase() == "various artists" ? "" : " " + this.artist));

How does the second line differ from the first in how a search is conducted? I could offer a guess but I already make myself look stupid on a regular basis without guessing lol.

here's a quick and dirty status bar which shows the playing item index.

https://dl.dropboxusercontent.com/u/2280132...tatus%20bar.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/status%20bar.txt)

(it is reliant on having the marc2003 folder from my pack of scripts being present)

Hmmm. That was fast. I don't use the status bar, but I might find a use for this even if those people I was asking for do not. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-05-28 20:47:55
How does the second line differ from the first in how a search is conducted? I could offer a guess but I already make myself look stupid on a regular basis without guessing lol.


only one of my various artist albums exists on allmusic and it's rather odd that it's not found if various artists is sent as part of the search. it is found if i omit it and search for the album title only.


like i said, i only have one example that uses Various Artists (most of my compilations are DJ mixes and i use the DJ name as the album artist)

artist: Various artists
album: Verve Remixed
original query: http://www.allmusic.com/search/albums/Verve Remixed Various artists finds no matches.

the modified query omits sending the artist if it is Various Artists

modified query: http://www.allmusic.com/search/albums/Verve Remixed gets the right match. obviously testing one album is hardly conclusive which is why i posted that bit of code for you to try yourself.
Title: WSH Panel Mod script discussion/help
Post by: Z4g5r on 2014-06-01 06:51:27
Hi again. It's regarding marc2003's splendid Spectrogram Seekbar. I often find myself in need to check spectrograms with Audition you see, and this thing has possibilities to work as a quick and proper replacement.

Hence if you'll have time, could you please remove the seekbar and modify it so the pannel would a] go fullscreen and back on middle mouse key click for better view(like a default 'Spectrogram' component does) b] display spec of a file selected in the playlist, not the one that's playing(like 'Album Art Viewer' does) c] start processing only after LM click on WSH pannel. I hope you'll make it possible, with those features foobar becomes much more cozy.

Thanks in advance.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-01 09:47:40
a) not possible with WSH panel mod
b) i'm not changing the behaviour of my panel but you can display the images created by my seekbar. as they are just png files, you can configure the album art display in the main foobar preferences (file>preferences>display>album art). here you need to choose an album art type not in use like back or artist. then you need to configure it something like this....

Code: [Select]
c:\users\marc\appdata\roaming\foobar2000\spectrogram_cache\$crc32(%path%)channels 1 spectrogram -Y 130.png


or if running foobar in portable mode

Code: [Select]
E:\foobar2000\spectrogram_cache\$crc32(%path%)channels 1 spectrogram -Y 130.png


if you've changed the sox params in the seekbar script then you need to update the paths above.

you can then use my artreader panel to display them. right click and choose the right album art type and make sure to select Stretch as well. lastly, right click>Selection mode>follow selected track.

c) i'm not making that change.
Title: WSH Panel Mod script discussion/help
Post by: Z4g5r on 2014-06-01 10:32:27
a) not possible with WSH panel mod


So then... Could you mod the panel itself? With the next update maybe?

b) i'm not changing the behaviour of my panel


Maybe you could just let foobar control it (http://i.imgur.com/I4mIpfU.jpg)? Would that be possible? This way the end-user will be able to set it as he needs.

I don't really need B if I can't make it go fullscreen. Maybe there still is a way?

c) i'm not making that change.


I'm not asking you to change the thing entirely, just show a way how that could be achieved? (if that is achievable currently?)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-01 11:48:46
a) i have nothing to do with component development. that requires serious c++ skills which i do not have.
b) yeah you can do that with the default artwork panel or you can right click my artreader panel>selection mode>use display preferences.
c) i'm not making any changes to make it scan on demand. it takes less than a second on a normal length track so there is no point.
Title: WSH Panel Mod script discussion/help
Post by: Z4g5r on 2014-06-01 12:19:08
Okay man, I hear you. Then how about making spectrogram open via default image viewer on middle mouse click?
Title: WSH Panel Mod script discussion/help
Post by: saviord on 2014-06-13 04:43:23
Heyho,
I was looking a long time for a Foobar skin I really liked, and I finally found this one: http://foo-nation.deviantart.com/#/art/Foo...-396911955?hf=1 (http://foo-nation.deviantart.com/#/art/FooMetrox-II-396911955?hf=1)
I made a few adjustments of things I didnt like about it. I also disabled the Windows aero border completly, because it looks ugly with this skin. 
That opened up problems: I could not minimize, close or move the window the same as before.
I now move the window with the middle mouse button, which is fine.
I also added a button to fb.exit(); the window.

I minimize the window by pressing escape, but I'd much rather would like to have a button I can click on to minimize in some situations.
Is there a way to do that?

Any help would be very much appreciated
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-13 05:41:27
Code: [Select]
fb.RunMainMenuCommand("View/Hide");
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2014-06-20 10:58:33
Hi Marc.  In the past, I have used your scripts as a basis to create mine.  Among them, I have modified your script that downloads artist art from last.fm using the standalone art.exe.  Currently, I'm unable to download the artist images any more.  As far as I know, art.exe doesn't do its job:
Code: [Select]
"C:\Users\rol\AppData\Roaming\foobar2000\wsh_scripts\art.exe" "Fleetwood Mac" "D:\My Music\lastfm_artist_data\Fleetwood Mac" 10
artist:Fleetwood Mac

save_path:D:\My Music\lastfm_artist_data\Fleetwood Mac\

images:10 images
images to be fetched:

Then the exe returns immediately, without having downloaded anything.

Is it a new version of art.exe that works correctly?  If it's the case, where can I download it?  (I can't find it in your recent Samples archive.)
Or is it an alternative that doesn't need art.exe?  In the latter case, what script should I use?

Sorry if that question has already been answered.  I really can't search the numerous post of the whole thread.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-20 12:44:08
that stopped working months ago when last.fm shut down their artist images API feed.

i have a workaround in place. the thumbs script in my current pack (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip) downloads exactly the same images but it's quite a bit slower than the old method. if you use it, make sure you read the Help dialog on the right click menu as it explains a few things.

the code is bit of a mess so i just suggest using as it is rather than trying to pick it apart.
Title: WSH Panel Mod script discussion/help
Post by: r0lZ on 2014-06-20 12:47:16
OK, thanks.
I've also noticed changes in the last.fm behaviour, but I was not sure for the images.  Pity!  :-(
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-22 16:48:09
i've just updated my allmusic review script.

as it doesn't always find what you're looking for, i've added a new option to the right click menu - Paste text from clipboard. if you find the review text manually or just want to add your text for albums that haven't been found, this is a quick way to save it. it will save/overwrite without prompting and the display will update immediately.

right click panel>Update script

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

Title: WSH Panel Mod script discussion/help
Post by: alwayswrming on 2014-06-24 22:58:46
so ive downloaded the latest samples package and opened the text for the spectrogram seekbar, ive installed the dependencies into *\sox\ and now im confused.. i see a whole mess of code, but no idea what to do with it. ive never used any scripts for foobar, only components or wsh panel (which is scripted, but i know where those scripts are located).. so, any chance someone could tell me what to do with the code thats found in spectrogram seekbar.txt ??

thx
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-24 23:14:48
you need to check steps 1-5 of the bundled readme.pdf file.
Title: WSH Panel Mod script discussion/help
Post by: alwayswrming on 2014-06-24 23:18:03
you need to check steps 1-5 of the bundled readme.pdf file.


derp im an idiot. sry.
Title: WSH Panel Mod script discussion/help
Post by: alwayswrming on 2014-06-25 04:20:36
very nice indeed. im impressed. I spent a lot of time manually mapping all of these colors to the standard spectrogram panel that is used for DefaultUI, and took a very long time to do but now i have an intimate understanding of the color scheme and such. anyways, im curious how you did the mapping? is that something you did yourself or is that done by sox alone? the colors are pretty similar to audition, so i probably wouldnt change much anyways, but just curious if it's even possible.
thx for this great tool.. ill have to look through all of your others and surely ill find something else worth using. cheers

Edit: also, is there a way to add the axes and legend? I read about it in the sox documentation but it seems maybe you wrote it out?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-25 06:09:46
i automatically apply the -r command line option which gives the "raw" output without axes. doing this means i don't have to do any extra work making the progress marker/seekbar functionality fit the image. no matter how you resize the panel, the progress marker should always line up with what you see. if i was to consider allowing axes, i can no longer use the full width/height of the panel and i'd have to try and calculate the dimensions of just the spectrogram part of the image. if the borders were fixed size no matter what options you set, it may be possible to get it right but i've not tried it.

you can use most other SoX spectrogram options from the manual by right clicking the panel>SoX options.  the colours you're seeing are the default. -m, -h and -p let you tinker with them a bit but you don't get much control. check sox.pdf for more details.
Title: WSH Panel Mod script discussion/help
Post by: alwayswrming on 2014-06-25 21:22:11
i automatically apply the -r command line option which gives the "raw" output without axes. doing this means i don't have to do any extra work making the progress marker/seekbar functionality fit the image. no matter how you resize the panel, the progress marker should always line up with what you see. if i was to consider allowing axes, i can no longer use the full width/height of the panel and i'd have to try and calculate the dimensions of just the spectrogram part of the image. if the borders were fixed size no matter what options you set, it may be possible to get it right but i've not tried it.

you can use most other SoX spectrogram options from the manual by right clicking the panel>SoX options.  the colours you're seeing are the default. -m, -h and -p let you tinker with them a bit but you don't get much control. check sox.pdf for more details.


i see now.. well, this is pure genius. I had always wished the default ui version would be a static spectrogram instead of scrolling throughout the track.. and this is exactly what i wanted.. its just like Audition! Thanks a lot for the work you put into this!
Title: WSH Panel Mod script discussion/help
Post by: hkg196418 on 2014-06-28 22:15:49
May want to ask, is this Panel Mod allows us to drag&drop songs into the playlist between other existing songs but not add to last?

for example, I got a playlist like this:

1. A
2. B
3. C
4. D
5. E

If I drop new songs (lets call it Z) into this playlist, it will add to the last as 6th song in the playlist, like this:

1. A
2. B
3. C
4. D
5. E
6. Z <== new song

But what I want to do is I want to add the new song between 2nd and 3rd , like this

1. A
2. B
3. Z <== new song
4. C
5. D
6. E

I have searched long time for this in google, seems no one talk about this....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-06-30 11:09:43
it's not possible directly. the drag/drop function built-in to the component doesn't appear to accept any parameters.

it *might* be possible to hack something together yourself though. after the mouse button is released, you may be able to move the dropped tracks using plman.MovePlaylistSelection. i've never used these functions myself though so i can't be any more specific. maybe if falstaff/extremehunter read this, they might have some ideas as they have both coded their own WSH playlists.
Title: WSH Panel Mod script discussion/help
Post by: ExtremeHunter on 2014-06-30 18:53:26
hkg196418

Code: [Select]
function on_playlist_items_added(playlist) {

    var selectionCount = plman.GetPlaylistSelectedItems(playlist).Count;
    var move = 2; // move items between 2 and 3
    //if(filesDropped)
    plman.MovePlaylistSelection(playlist, -plman.PlaylistItemCount(playlist) + move + selectionCount);

}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-07-09 23:17:17
just updated the thread to say i'm no longer supporting my discogs script. next month it will stop working because it will require user accounts and authorisation. i'm not messing about with that.

Title: WSH Panel Mod script discussion/help
Post by: lamename on 2014-07-23 19:22:05
First of all, i have no idea how foobar scripting works, i tried to copy & paste from other skins, always ends in trial & error.

\user-components\foo_uie_wsh_panel_mod\samples\MainMenuManager All-In-One.txt

Code: [Select]
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "MainMenuManager All-In-One"
// @author "YBStone"
// Modded by T.P Wang
// ==/PREPROCESSOR==

// Flags, used by Menu
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;

function on_mouse_lbtn_up(x, y) {

    var basemenu = window.CreatePopupMenu();
    var contextman = fb.CreateContextMenuManager();

    contextman.InitNowPlaying();

    var child1 = window.CreatePopupMenu(); //File
    var child2 = window.CreatePopupMenu(); //Edit
    var child3 = window.CreatePopupMenu(); //View
    var child4 = window.CreatePopupMenu(); //Playback
    var child5 = window.CreatePopupMenu(); //Library
    var child6 = window.CreatePopupMenu(); //Help
    var child7 = window.CreatePopupMenu(); //Now playing

    var menuman1 = fb.CreateMainMenuManager();
    var menuman2 = fb.CreateMainMenuManager();
    var menuman3 = fb.CreateMainMenuManager();
    var menuman4 = fb.CreateMainMenuManager();
    var menuman5 = fb.CreateMainMenuManager();
    var menuman6 = fb.CreateMainMenuManager();

    child1.AppendTo(basemenu, MF_STRING, "File");
    child2.AppendTo(basemenu, MF_STRING, "Edit");
    child3.AppendTo(basemenu, MF_STRING, "View");
    child4.AppendTo(basemenu, MF_STRING, "Playback");
    child5.AppendTo(basemenu, MF_STRING, "Library");
    child6.AppendTo(basemenu, MF_STRING, "Help");
    child7.AppendTo(basemenu, MF_STRING, "Now Playing");

    menuman1.Init("file");
    menuman2.Init("edit");
    menuman3.Init("View");
    menuman4.Init("playback");
    menuman5.Init("library");
    menuman6.Init("help");

    menuman1.BuildMenu(child1, 1, 200);
    menuman2.BuildMenu(child2, 201, 200);
    menuman3.BuildMenu(child3, 401, 200);
    menuman4.BuildMenu(child4, 601, 300);
    menuman5.BuildMenu(child5, 901, 300);
    menuman6.BuildMenu(child6, 1201, 100);

    contextman.InitNowPlaying();
    contextman.BuildMenu(child7, 1301, -1);
    ret = 0;

    ret = basemenu.TrackPopupMenu(x, y);

    // fb.trace(ret);
    switch (true) {
    case(ret >= 1 && ret < 201):
        menuman1.ExecuteByID(ret - 1);
        break;

    case (ret >= 201 && ret < 401):
        menuman2.ExecuteByID(ret - 201);
        break;

    case (ret >= 401 && ret < 601):
        menuman3.ExecuteByID(ret - 401);
        break;

    case (ret >= 601 && ret < 901):
        menuman4.ExecuteByID(ret - 601);
        break;

    case (ret >= 901 && ret < 1201):
        menuman5.ExecuteByID(ret - 901);
        break;

    case (ret >= 1201 && ret < 1301):
        menuman6.ExecuteByID(ret - 1201);
        break;

    case (ret >= 1301):
        contextman.ExecuteByID(ret - 1301);
        break;
    }

    basemenu.Dispose();
    contextman.Dispose();
    menuman1.Dispose();
    menuman2.Dispose();
    menuman3.Dispose();
    menuman4.Dispose();
    menuman5.Dispose();
    menuman6.Dispose();
}


Above sample is 99% fine, the only problem is that whereever you click in the panel (blank space), the menu pops out. What i want is to have a clickable button with the following image (don't know why imagebam made it .jpg, it's actually a .png), meaning only a click on the image/button pops out the menu...

(http://thumbnails111.imagebam.com/34070/2af9ac340699168.jpg) (http://www.imagebam.com/image/2af9ac340699168)

Workaround is to use WSH Panel Mod within a Panel Stack Splitter (imagebutton) and adjusting the size, but i'm not fond of this idea.

Anyone with the skills to help me out? btw is it possible to port above script to Panel Stack Splitter?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-07-24 22:49:34
First of all, i have no idea how foobar scripting works, i tried to copy & paste from other skins, always ends in trial & error.

\user-components\foo_uie_wsh_panel_mod\samples\MainMenuManager All-In-One.txt


Above sample is 99% fine, the only problem is that whereever you click in the panel (blank space), the menu pops out. What i want is to have a clickable button with the following image (don't know why imagebam made it .jpg, it's actually a .png), meaning only a click on the image/button pops out the menu...

(http://thumbnails111.imagebam.com/34070/2af9ac340699168.jpg) (http://www.imagebam.com/image/2af9ac340699168)

Workaround is to use WSH Panel Mod within a Panel Stack Splitter (imagebutton) and adjusting the size, but i'm not fond of this idea.

Anyone with the skills to help me out? btw is it possible to port above script to Panel Stack Splitter?

I changed your script , so you can set your button image. Menu pops up -only on button left click.
Your buttons must be located in '[foobar main folder]\image'
Buttons must be named: menu1.png, menu2.png.

Edit this 295 line, to set 'button position' and 'image path':

//Button position
var top_margin = 5;
var left_margin = 5;
 
var image_path0 = window.GetProperty("Button Path", fb.ProfilePath + "image");
var image_path = (image_path0 + "\\");

Paste this script:

Code: [Select]
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:
// ==PREPROCESSOR==
// @name "MainMenuManager All-In-One"
// @author "YBStone"
// Modded by T.P Wang
// ==/PREPROCESSOR==

// Flags, used by Menu
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;

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

function up(x, y) {

    var basemenu = window.CreatePopupMenu();
    var contextman = fb.CreateContextMenuManager();
    contextman.InitNowPlaying();

    var child1 = window.CreatePopupMenu(); //File
    var child2 = window.CreatePopupMenu(); //Edit
    var child3 = window.CreatePopupMenu(); //View
    var child4 = window.CreatePopupMenu(); //Playback
    var child5 = window.CreatePopupMenu(); //Library
    var child6 = window.CreatePopupMenu(); //Help
    var child7 = window.CreatePopupMenu(); //Now playing

    var menuman1 = fb.CreateMainMenuManager();
    var menuman2 = fb.CreateMainMenuManager();
    var menuman3 = fb.CreateMainMenuManager();
    var menuman4 = fb.CreateMainMenuManager();
    var menuman5 = fb.CreateMainMenuManager();
    var menuman6 = fb.CreateMainMenuManager();

    child1.AppendTo(basemenu, MF_STRING, "File");
    child2.AppendTo(basemenu, MF_STRING, "Edit");
    child3.AppendTo(basemenu, MF_STRING, "View");
    child4.AppendTo(basemenu, MF_STRING, "Playback");
    child5.AppendTo(basemenu, MF_STRING, "Library");
    child6.AppendTo(basemenu, MF_STRING, "Help");
    child7.AppendTo(basemenu, MF_STRING, "Now Playing");

    menuman1.Init("file");
    menuman2.Init("edit");
    menuman3.Init("View");
    menuman4.Init("playback");
    menuman5.Init("library");
    menuman6.Init("help");

    menuman1.BuildMenu(child1, 1, 200);
    menuman2.BuildMenu(child2, 201, 200);
    menuman3.BuildMenu(child3, 401, 200);
    menuman4.BuildMenu(child4, 601, 300);
    menuman5.BuildMenu(child5, 901, 300);
    menuman6.BuildMenu(child6, 1201, 100);

    contextman.InitNowPlaying();
    contextman.BuildMenu(child7, 1301, -1);
    ret = 0;

    ret = basemenu.TrackPopupMenu(x, y);

    // fb.trace(ret);
    switch (true) {
    case(ret >= 1 && ret < 201):
        menuman1.ExecuteByID(ret - 1);
        break;

    case (ret >= 201 && ret < 401):
        menuman2.ExecuteByID(ret - 201);
        break;

    case (ret >= 401 && ret < 601):
        menuman3.ExecuteByID(ret - 401);
        break;

    case (ret >= 601 && ret < 901):
        menuman4.ExecuteByID(ret - 601);
        break;

    case (ret >= 901 && ret < 1201):
        menuman5.ExecuteByID(ret - 901);
        break;

    case (ret >= 1201 && ret < 1301):
        menuman6.ExecuteByID(ret - 1201);
        break;
   
    case (ret >= 1301):
        contextman.ExecuteByID(ret - 1301);
        break;
    }
   
    basemenu.Dispose();
    contextman.Dispose();
    menuman1.Dispose();
    menuman2.Dispose();
    menuman3.Dispose();
    menuman4.Dispose();
    menuman5.Dispose();
    menuman6.Dispose();
}

//Buttons---------------------------------------------------
 
var Buttons;
var g_tooltip = window.CreateTooltip();
var g_down = false;
 
var btn_down = null;
var cur_btn = null;
 
ButtonStates = {
        normal: 0,
        hover: 1,
        down: 2
}
 
function Button(x, y, w, h, img_src, func, tiptext)  {
        this.left = x;
        this.top = y;
        this.w = w;
        this.h = h;
        this.right = x + w;
        this.bottom = y + h;
        this.func = func;
        this.tiptext = tiptext;
        this.state = ButtonStates.normal;
        this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
        this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
        this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
        this.img = this.img_normal;
     
        this.alterImage = function(img_src) {
    this.img_normal = img_src && img_src.normal ? gdi.Image(img_src.normal) : null;
    this.img_hover = img_src && img_src.hover ? gdi.Image(img_src.hover) : this.img_normal;
    this.img_down = img_src && img_src.down ? gdi.Image(img_src.down) : this.img_hover;
             
    this.changeState(this.state);
        }
     
    this.traceMouse = function (x, y) {
    var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);
    if (b)
    g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
    else
    this.changeState(ButtonStates.normal);
    return b;
        }
     
    this.changeState = function (newstate) {
    if (newstate != this.state)
    window.RepaintRect(this.left, this.top, this.w, this.h);
    this.state = newstate;
    switch (this.state)
    {
    case ButtonStates.normal:
    this.img = this.img_normal;
    break;
                     
    case ButtonStates.hover:
    this.img = this.img_hover;
    break;
                     
    case ButtonStates.down:
    this.img = this.img_down;
    break;
                     
    default:
    this.img = null;
                }
        }
     
    this.draw = function (gr) {
    this.img && gr.DrawImage(this.img, this.left, this.top, this.w, this.h, 0, 0, this.w, this.h);
        }
     
    this.onClick = function () {
    this.func && this.func(x,y);
        }
     
    this.onMouseIn = function() {
    g_tooltip.Text = this.tiptext;
    g_tooltip.Activate();
        }
     
    this.onMouseOut = function() {
    g_tooltip.Deactivate();
        }
}
 
function buttonsDraw(gr) {
    for (i in Buttons) {
    Buttons[i].draw(gr);
        }
}
 
function buttonsTraceMouse(x, y) {
        var btn = null;
        for (i in Buttons) {
    if (Buttons[i].traceMouse(x, y) && !btn)
    btn = Buttons[i];
        }
 
        return btn;
}
 
function on_mouse_move(x, y) {
        var btn = buttonsTraceMouse(x, y);
     
        if (btn != cur_btn) {
    cur_btn && cur_btn.onMouseOut();
    btn && btn.onMouseIn();
        }
     
        cur_btn = btn;
}
 
function on_mouse_lbtn_down(x, y) {
        g_down = true;
        btn_down = cur_btn;
 
        if (cur_btn) {
    cur_btn.changeState(ButtonStates.down);
        }
}
 
function on_mouse_lbtn_up(x, y) {
        if (cur_btn) {
    cur_btn.changeState(ButtonStates.hover);
    if( btn_down == cur_btn )
    cur_btn.onClick(x, y);
        }
        g_down = false;
}
 
function on_mouse_leave() {
        if (cur_btn) {
    cur_btn.changeState(ButtonStates.normal);
        }
}
 
function on_size() {
        ww = window.Width;
        wh = window.Height;
    window.Repaint();
}
 
//Background
this.dui = window.InstanceType;
function on_paint(gr) {
     
    if (this.dui) {
    col = window.GetColorDUI(1);
    gr.FillSolidRect(0, 0, ww, wh, col);
    }
    else
    {
    col = window.GetColorCUI(3);   
    }
 
        buttonsDraw(gr);
     
}
 
function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}
 
function on_colors_changed() {
window.Repaint();
}
 
//Init Buttons--------------------------------------------
 
//Custom colour
var custom = RGB(255,255,255);
 
//Button width
var bw = 24;
 
//Button height
var bh = 20;
 
//Button position
var top_margin = 5;
var left_margin = 5;
 
var image_path0 = window.GetProperty("Button Path", fb.ProfilePath + "image");
var image_path = (image_path0 + "\\");
 
//These 2 lines of code lock the panel size.
//window.MinWidth = window.MaxWidth = 24;
//window.MinHeight = window.MaxHeight = 20;
 
 
Buttons = {
        but1: new Button(left_margin,top_margin,bw,bh, {normal: image_path + "menu1.png", hover: image_path + "menu2.png"}, function(){
    up(24, 17);
    }, "Menu")

}

function on_mouse_rbtn_up(x, y) {
return true;
}
Title: WSH Panel Mod script discussion/help
Post by: Vittorio on 2014-07-24 23:54:06
Hi there, I could need some help with understanding the whole WSH thing.

Sample: SimpleFollowCursor.txt
http://pastebin.com/25wFZUqb (http://pastebin.com/25wFZUqb)
Code: [Select]
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "SimpleFollowCursor"
// @author "T.P Wang"
// ==/PREPROCESSOR==

// This is a helper function, for generating flags in DrawString()/MeasureString()
// args: h_align, v_align, trimming, flags
function StringFormat() {
    var h_align = 0,
        v_align = 0,
        trimming = 0,
        flags = 0;
    switch (arguments.length) {
        // fall-thru
    case 4:
        flags = arguments[3];
    case 3:
        trimming = arguments[2];
    case 2:
        v_align = arguments[1];
    case 1:
        h_align = arguments[0];
        break;
    default:
        return 0;
    }
    return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}

// h_align/v_align:
// [url=http://msdn.microsoft.com/en-us/library/ms534177(VS.85).aspx]http://msdn.microsoft.com/en-us/library/ms534177(VS.85).aspx[/url]
StringAlignment = {
    Near: 0,
    Center: 1,
    Far: 2
};

// trimming:
// [url=http://msdn.microsoft.com/en-us/library/ms534403(VS.85).aspx]http://msdn.microsoft.com/en-us/library/ms534403(VS.85).aspx[/url]
StringTrimming = {
    None: 0,
    Character: 1,
    Word: 2,
    EllipsisCharacter: 3,
    EllipsisWord: 4,
    EllipsisPath: 5
};

// flags, can be combined of:
// [url=http://msdn.microsoft.com/en-us/library/ms534181(VS.85).aspx]http://msdn.microsoft.com/en-us/library/ms534181(VS.85).aspx[/url]
StringFormatFlags = {
    DirectionRightToLeft: 0x00000001,
    DirectionVertical: 0x00000002,
    NoFitBlackBox: 0x00000004,
    DisplayFormatControl: 0x00000020,
    NoFontFallback: 0x00000400,
    MeasureTrailingSpaces: 0x00000800,
    NoWrap: 0x00001000,
    LineLimit: 0x00002000,
    NoClip: 0x00004000
};

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


// APPLICATION - START
g_focus_metadb = fb.GetFocusItem();
g_font = gdi.Font("Tahoma", 12, 0);
g_tfo = fb.TitleFormat("%title%[ - %artist%][' ['%playback_time%']']\n$if(%ispaused%,' (Paused)')");
g_stringformat = StringFormat(StringAlignment.Center, StringAlignment.Center);

// Key point

function on_item_focus_change() {
    g_focus_metadb = fb.GetFocusItem();
    var info = g_focus_metadb.GetFileInfo();
    window.Repaint();
}

function on_paint(gr) {
    // Draw info
    if (g_focus_metadb) {
        gr.DrawString(g_tfo.EvalWithMetadb(g_focus_metadb), g_font, RGB(0, 0, 0), 0, 0, window.Width, window.Height, g_stringformat);
    }
}
// APPLICATION - END

First of all some basic JavaScript stuff...

Quote
29.  return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);

65.  function RGB(r, g, b) {
66.    return (0xff000000 | (r << 16) | (g << 8) | (b));
67.  }
I'm not very familiar with all these bit shift operations. Could someone explain what's happening here like I'm 6?

Now the WSH part... (There is no real documentation of the API, just lists of available functions, variables, etc.)

Quote
on_paint(gr) {}
function on_paint(gr) is something like window.onload() in JS DOM, so everything within this function is only executed once, static. Am I right?
How can I manage to have dynamic output?

Quote
DrawString(str, IGdiFont, color, x, y, w, h, flags = 0);
flags... I'm really struggling with them

After looking at the script for a while and according to MSDN:
Quote
87.  gr.DrawString(g_tfo.EvalWithMetadb(g_focus_metadb), g_font, RGB(0, 0, 0), 0, 0, window.Width, window.Height, g_stringformat);
g_stringformat = StringFormat(StringAlignment.Center, StringAlignment.Center);
g_stringformat = StringFormat(1, 1);
=>
  h_align = 0,
  v_align = 1,
  trimming = 0,
  flags = 0;
=>
    return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);

And that's where I get lost. Could somebody explain that too?

Quote
function on_playback_new_track() {}
function on_playback_dynamic_info_track() {}
What's the difference between those two?

My code so far (which is not working anyway)
Code: [Select]
var $tf = fb.TitleFormat("%artist% - %title%");
var $text = $tf.Eval();
// PAINT UI
var $textcolor = 0xff000000;
var $font = gdi.Font("Tahoma", 14, 1);
var $x = 0;
var $y = 0;
var $w = window.Width;
var $h = window.Height;
var $stringformat = 0;

function $upd() {
    $tf = fb.TitleFormat("%artist - %title%");
    window.Repaint();
    }

function on_playback_new_track() {
    $upd();
    }

function on_paint(gr) {
    gr.DrawString($text, $font, $textcolor, $x, $y, $w, $h, $stringformat);
    }

It only displays the Tag info once at code startup/initialize.
What am I doing wrong?
Title: WSH Panel Mod script discussion/help
Post by: lamename on 2014-07-26 01:22:51
@mire777, thank you very much.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2014-08-19 13:48:20
that stopped working months ago when last.fm shut down their artist images API feed.

i have a workaround in place. the thumbs script in my current pack (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip) downloads exactly the same images but it's quite a bit slower than the old method. if you use it, make sure you read the Help dialog on the right click menu as it explains a few things.

the code is bit of a mess so i just suggest using as it is rather than trying to pick it apart.



I've also tried using your thumbs script - no errors, no new images automatically, however manually activating still works?

Damn feeds and their pesky APIs...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-08-19 15:43:25
the automatic download option is nothing to do with last.fm - it's my script that determines whether or not to download automatically.

first thing is check the automatic download option is turned on. i turned it off by default for new panels because it seemed quite slow when i last tested it. having said, i tried it recently and it was much faster. also, if you right click the panel and check the Help, it explains in more detail how automatic downloads are triggered. for example, it doesn't automatically do it on dynamic title changes from streams,
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2014-08-19 22:14:47
the automatic download option is nothing to do with last.fm - it's my script that determines whether or not to download automatically.

first thing is check the automatic download option is turned on. i turned it off by default for new panels because it seemed quite slow when i last tested it. having said, i tried it recently and it was much faster. also, if you right click the panel and check the Help, it explains in more detail how automatic downloads are triggered. for example, it doesn't automatically do it on dynamic title changes from streams,



I'm using thumbs; latest version (checked update)

[automatic download / all tracks]

There is no action in the console and I don't think it's used, but art.exe never seems to get called from task manager.

when you mention "It will not download on a selection change" does that mean it won't activate when actual songs change? (e.g. shuffle play)
I also tried stopping and starting, but still nothing.

[manually selecting download artist art does always work]
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-20 00:38:33
Marc, i was now switch to DUI, so now i can use your thumbs script with wsh 1.5.6.

Only thing that i miss from my modified script, is:
-when select -crop on top image , it doesn't move picture completely on top
-custom folder location where to save images
-And why it doesn't download images on dynamic title changes from streams?

In biography text script, i would like to have option to hide red last.fm button, and artist name..


Also i have suggestion how to improve your script to load images after download.
Your script download all images at once, but after one picture is downloaded script do ''im.update'' this brakes thumbs images until download is finished..

What you can do? You can check how many images web page have(''Math.min(urls.length..'') and what is download limit, then after download them all in folder(check on timer), you can do ''im.update''.
Or what i was do, after download first image -do update once, and after download them all do ''im.update'' again.
This work great on my script.. First image appear after 12-15 sec, and other after 30 sec...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-08-20 10:58:26
but art.exe never seems to get called from task manager.


that is obsolete and can be deleted. it uses the old API which last.fm have disabled.

Quote
when you mention "It will not download on a selection change"


the panel can be configured to follow the cursor so what i mean by that is that it will not download when you select something else in the playlist. it will display any existing images for the selected track but won't automatically download new images.

for it to download automatically, the following conditions musts be met:

the file being played must be local and not a stream. playback order should be irrelevant.
an appropriate automatic download option must be selected.
no images must exist for the artist.
the artist must be different from the previous track (if the artist is the same, the panel does nothing)
the download gets triggered when the playback time hits one second. if you somehow skip past this or use foo_skip to jump to another point in the track, the automatic download will not trigger.
if selection mode is not set to prefer to now playing, the selected item must also be the playing track. if you have it set to follow selected track then you should probably enable Cursor follows playback on the main Playback menu.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-08-20 11:01:25
Only thing that i miss from my modified script, is:


modify the new one?? i'm not making any changes.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2014-08-20 13:52:33
for it to download automatically, the following conditions musts be met:



My current install meets all of those criteria. The only thing I can think of:

does it check for empty image folder, or is there a flag in the database for 'artist images exist'?

I'm running a new Foobar install with a copy of an old library db (to keep playcounts etc intact) - there are no artist images yet.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-08-20 14:58:49
images are stored in a separate folder for each artist so it simply checks to see if any images already exist.

there is no database. that is only used by my playcount sync script.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2014-08-21 03:01:42
images are stored in a separate folder for each artist so it simply checks to see if any images already exist.

there is no database. that is only used by my playcount sync script.


thanks Marc

I'm still not sure what the problem is - some sort of conflict with another script (or # of scripts?) - I tried just making the panel it's own theme to test and it worked fine.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-08-21 09:17:28
some sort of conflict with another script (or # of scripts?)


i doubt this. all panels should work independently of each other. i certainly have most of my scripts in a single layout and automatic downloading works fine.

i suppose one thing you could try is resetting all the defaults in your normal layout?? hold shift and right click the panel>properties. from there click the clear button. obviously automatic downloads will be off and you'll also need to change any other custom settings you had.

and not that it matters but i just realised this part of my previous post is untrue. 

Quote
the artist must be different from the previous track (if the artist is the same, the panel does nothing)


if there are no images each time a track is played, it will check everytime regardless of what the previous artist was.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-08-22 13:56:42
Regarding dynamic titles from streams did you ever look into my solution in post
http://www.hydrogenaud.io/forums/index.php...st&p=861702 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&view=findpost&p=861702)

It is working for me .
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-22 20:26:45
Regarding dynamic titles from streams did you ever look into my solution in post
http://www.hydrogenaud.io/forums/index.php...st&p=861702 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&view=findpost&p=861702)

It is working for me .


Yes it works fine for me..
All you must to do is to put im.download(); in on_metadb_changed();
I would like at least: custom folder where to save images and to download images on_metadb_changed(); .
I want to use original script, but i must to use my, or to change script every time when Marc do update, pity...
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-23 08:50:46
@Zeremy

I downloaded your ''internet radio playlist importer'' looks nice..
But it have problem on this line: p.browser("http://lab.rolisoft.net/playlists.html"); }, "Provider", false) ,
You must remove ' , ' on end, or script will crash.
Also you don't need this: ''if (p.dui) window.MinHeight = window.MaxHeight = bh + 12;''
This line -lock panel size, and then you see only buttons. Idea is great, but menu must be better done if you have images you need scrollbar also, or use simple menu instead..
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-08-23 10:31:24
@Zeremy

I downloaded your ''internet radio playlist importer'' looks nice..
But it have problem on this line: p.browser("http://lab.rolisoft.net/playlists.html"); }, "Provider", false) ,
You must remove ' , ' on end, or script will crash.
Also you don't need this: ''if (p.dui) window.MinHeight = window.MaxHeight = bh + 12;''
This line -lock panel size, and then you see only buttons. Idea is great, but menu must be better done if you have images you need scrollbar also, or use simple menu instead..


@mire777

I removed your suggestions and the script still works or me. (I updated the download link)
My scripting knowledge is limited , and I adapted it to my window size needs on my laptop.

Maybe I will try the  simple menu solution when I find the time.
I'm glad someone found it useful.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-08-26 09:59:18
Regarding dynamic titles from streams did you ever look into my solution in post
http://www.hydrogenaud.io/forums/index.php...st&p=861702 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&view=findpost&p=861702)

It is working for me .


that "solution" is beyond awful.  a new web request to download images is being launched everytime the selection changes in the playlist regardless of what foobar is doing or what preferences you have set. potentially you be launching dozens of requests at a time if navigating a playlist with a keyboard or just randomly clicking stuff with your mouse. 
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-08-26 11:06:26
Regarding dynamic titles from streams did you ever look into my solution in post
http://www.hydrogenaud.io/forums/index.php...st&p=861702 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&view=findpost&p=861702)

It is working for me .


that "solution" is beyond awful.  a new web request to download images is being launched everytime the selection changes in the playlist regardless of what foobar is doing or what preferences you have set. potentially you be launching dozens of requests at a time if navigating a playlist with a keyboard or just randomly clicking stuff with your mouse. 


@marc2003

I'm sorry I don't see that problem.
Only when the metabase is changed , I see network traffic downloading from last.fm.
Yes, requests are made on PLAY and when dynamic titles are changed in the stream , but not when navigating / selecting items in  the playlists.

If you need more information about my config , I am more than willing to share with you.

The only settings I changed are

function on_metadb_changed() {
   b.update();
   im.download();
    r.metadb_changed();
   im.metadb_changed();
   t.metadb_changed();
   c.metadb_changed();
   if (p.metadb) {
      line1.text = p.eval(line1.tf);
      line2.text = p.eval(line2.tf);
      line3.text = p.eval(line3.tf);
   }
   window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-08-26 11:20:36
@Zeremy

I downloaded your ''internet radio playlist importer'' looks nice..
But it have problem on this line: p.browser("http://lab.rolisoft.net/playlists.html"); }, "Provider", false) ,
You must remove ' , ' on end, or script will crash.
Also you don't need this: ''if (p.dui) window.MinHeight = window.MaxHeight = bh + 12;''
This line -lock panel size, and then you see only buttons. Idea is great, but menu must be better done if you have images you need scrollbar also, or use simple menu instead..


@mire777

I removed your suggestions and the script still works or me. (I updated the download link)
My scripting knowledge is limited , and I adapted it to my window size needs on my laptop.

Maybe I will try the  simple menu solution when I find the time.
I'm glad someone found it useful.


@mire777
Internet Radio Playlist Importer v2

I created the simple menu solution.

It now requires the component foo_cmd_playlist from http://www.hydrogenaud.io/forums/index.php?showtopic=47148 (http://www.hydrogenaud.io/forums/index.php?showtopic=47148) , as each selection in the menu now creates a new playlist of your selection.

https://www.dropbox.com/s/t5q0xmz101r5ysf/s...nshot2.png?dl=0 (https://www.dropbox.com/s/t5q0xmz101r5ysf/screenshot2.png?dl=0)

https://www.dropbox.com/s/h9b1b3ydvh2h40j/w...simple.rar?dl=0 (https://www.dropbox.com/s/h9b1b3ydvh2h40j/wsh%20internet%20radio%20simple.rar?dl=0)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-26 12:55:15
@mire777
Internet Radio Playlist Importer v2

I created the simple menu solution.

It now requires the component foo_cmd_playlist from http://www.hydrogenaud.io/forums/index.php?showtopic=47148 (http://www.hydrogenaud.io/forums/index.php?showtopic=47148) , as each selection in the menu now creates a new playlist of your selection.

https://www.dropbox.com/s/t5q0xmz101r5ysf/s...nshot2.png?dl=0 (https://www.dropbox.com/s/t5q0xmz101r5ysf/screenshot2.png?dl=0)

https://www.dropbox.com/s/h9b1b3ydvh2h40j/w...simple.rar?dl=0 (https://www.dropbox.com/s/h9b1b3ydvh2h40j/wsh%20internet%20radio%20simple.rar?dl=0)



Works great. Only one thing, you don't need  ''foo_cmd_playlist''.
Use something like this to create playlist:

Code: [Select]
//Make Playlist
function PlaylistID(Playlist_Name)
{
for (var i = 0; i < fb.PlaylistCount; i++)
{
if (fb.GetPlaylistName(i) == Playlist_Name)
{
return i;
}
}

//Create playlist if it doesn't exist
fb.CreatePlaylist(fb.PlaylistCount, Playlist_Name);
return i;
}


//Focus on playlist
function set_focus()
{  
fb.ActivePlaylist = (PlaylistID("your name for playlist"));
}
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-08-26 13:08:38
zeremy, concerning when on_metadb_changed() is called in thumbs.txt:

add the following line under function on_metadb_changed() in thumbs.txt:
Code: [Select]
fb.trace("function on_metadb_changed was called");

Then navigate around a playlist.  What do you see in the console?
Try this for any of the context menu selection modes.  Do you see any different behavior in what is shown in the console?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-26 13:16:25
zeremy, concerning when on_metadb_changed() is called in thumbs.txt:

add the following line under function on_metadb_changed() in thumbs.txt:
Code: [Select]
fb.trace("function on_metadb_changed was called");

Then navigate around a playlist.  What do you see in the console?
Try this for any of the context menu selection modes.  Do you see any different behavior in what is shown in the console?


I was put only im.download(); in metadb, this trigger double download, if download is start, and something other in playlist is focused..
This can be solved i think..

Edit:

Solution:
This trigger download only on 'playback new track'. But works for streams also:

Code: [Select]
function on_metadb_changed() {

im.metadb_changed();

if (on_playback_time(1)) {

im.download();

}
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-08-26 13:48:23
zeremy, concerning when on_metadb_changed() is called in thumbs.txt:

add the following line under function on_metadb_changed() in thumbs.txt:
Code: [Select]
fb.trace("function on_metadb_changed was called");

Then navigate around a playlist.  What do you see in the console?
Try this for any of the context menu selection modes.  Do you see any different behavior in what is shown in the console?


Yes , using the thumbs.txt , when selecting other item in playlist function on_metadb_changed was called and artwork gets downloaded.
I don't use that script and thats why it probably had no difference.

I was originally taking only about the Now Playing script , which was the only script I modified with the im.download entry and it doesn't affect my navigation.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-26 14:03:13
My solution works  on 'playback new track' only but this include radio streams
There can be added option for this in 'selection menu'. Why not?...
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-08-27 07:33:57
After further investigation , I have to admit that marc2003 was correct as multiple requests are made while browsing the playlist entries.

The if statement on metadb_changed  that we need could be if %path% begins with "http" then im.download.

That way requests will be made only when streams are playing.

What would the code be to implement such a solution?
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-08-29 18:32:09
After further investigation , I have to admit that marc2003 was correct as multiple requests are made while browsing the playlist entries.

The if statement on metadb_changed  that we need could be if %path% begins with "http" then im.download.

That way requests will be made only when streams are playing.

What would the code be to implement such a solution?

@mire777
Forget about on metadb_changed solution.
Can you test my code  please?

Code: [Select]
function on_playback_dynamic_info_track() {
    fb.trace("playback_dynamic_info_track called");
    fb.trace("Current Title");
   
    im.metadb_changed();
   
    p.console (fb.TitleFormat("%_path_raw%").Eval());
    p.console (fb.TitleFormat("%artist%").Eval());
    var url = new RegExp("http://", "i");
        if(fb.TitleFormat("%_path_raw%").Eval(true).match(url))
        {
            fb.trace("http:// url true - forcing last.fm artist image download ");
            im.download();
        }
        else
        {
           
            fb.trace("not a http:// url - ignoring ");
        }
 
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-30 19:37:30
@mire777
Forget about on metadb_changed solution.
Can you test my code  please?

Code: [Select]
function on_playback_dynamic_info_track() {
    fb.trace("playback_dynamic_info_track called");
    fb.trace("Current Title");
   
    im.metadb_changed();
   
    p.console (fb.TitleFormat("%_path_raw%").Eval());
    p.console (fb.TitleFormat("%artist%").Eval());
    var url = new RegExp("http://", "i");
        if(fb.TitleFormat("%_path_raw%").Eval(true).match(url))
        {
            fb.trace("http:// url true - forcing last.fm artist image download ");
            im.download();
        }
        else
        {
           
            fb.trace("not a http:// url - ignoring ");
        }
 
}

Yes, seems that this work, but i want to 'force download' on ''focus change'' when track is not playing -if there's no images...
I use this:

Code: [Select]
function on_metadb_changed() {
    im.metadb_changed();
    if (im.images.length==0)
    {im.download();}
    else
    {}
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-08-31 17:18:23
Does someone know is it possible trough WSH panel to display image directly from internet without downloading ''.png''?
I recently discovered that if you enter url in preferences>display>stub image path.. Album panel will load that image..

Is possible to use something like this, and then display image in WSH panel..
What will be the code?

Code: [Select]
URL url = new URL("http://userserve-ak.last.fm/serve/_/44209321.png");
Image image = ImageIO.read(url);





Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-09-03 18:01:18
@marc2003

With the simple text script , text file gets loaded only on_paint . Is it possible to load a text file that is created after the script is loaded while playing?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-04 12:57:13
text file gets loaded only on_paint.


no it isn't. as the path to the text file or folder it looks in is based on title formatting, it checks to see if that changes on tag updates, selection changes, playing new tracks or you changing title formatting settings via the script.

anyway, i've just added a Refresh command to the right click menu. right click panel>Update script.

@mire777, you can't do anything like that with WSH panel mod. maybe the gdi.Image function could be extended if you know c++. if you really don't want to save files, use a temporary location and then delete them when done.

Quote
display image directly from internet without downloading ''.png''?


i'm not a proper programmer so don't actually know for sure but i doubt this is happening. it's still going to be downloaded in the background somewhere. the same bandwidth will be used.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-09-04 15:04:45
text file gets loaded only on_paint.


no it isn't. as the path to the text file or folder it looks in is based on title formatting, it checks to see if that changes on tag updates, selection changes, playing new tracks or you changing title formatting settings via the script.

anyway, i've just added a Refresh command to the right click menu. right click panel>Update script.


@marc2003
Thanks . 
Refresh solution works OK.
Title: WSH Panel Mod script discussion/help
Post by: millzeyweb on 2014-09-07 02:20:43
Quick question if I may please.. pulling hair out

Does anyone have Jscript-WSHPM.xml and Jscript-WSHPM_udl.xml language definition for Notepad++?

A fella on this blog posts said it was on the Notepad mediawiki (which is currently down) but I couldnt find any trace of it on archive.org or even a google search.

Here is the post:
http://p774.blog.fc2.com/blog-entry-26.html (http://p774.blog.fc2.com/blog-entry-26.html)

If not, would anyone happen to have one for any other editor? Which editor do you use for code hinting panel mod functions? 

Thanks
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-09-09 15:39:04
Hello guys!

Yesterday I noticed high CPU usage of my uh.. lets call it "control bar" (WSH panel with all sorts of buttons and seek/volume bars). So I dug into it to see what was wrong and apparently my on_mouse_move function was the reason. I decided to introduce few timers (SetInterval()/SetTimeout()) to delay the repainting of few key areas and it actually helped. However I'm not entirely sure I actually did it right...

I'll use my rating area as example, here's what I did:
Code: [Select]
var rate_timer = false;
function rating_on_mouse_move (x, y) {
    XYinRate = ((hofset <= x) && (x <= hofset + rate_w+5) && (vofset <= y) && (y <= vofset + imgw));
    if (g_metadb && XYinRate) {
        g_drag = 1;
        nrating = Math.ceil((x-hofset)/imgw);
        if (nrating > 5) nrating = 5;
        if (nrating != lrating) {
            lrating = nrating;
        }
    }
    // mouse enters stars area
    if (!rate_timer) rate_timer = window.SetInterval(function() {
        if (g_metadb && XYinRate) {
            window.RepaintRect(hofset, vofset, imgw*5, imgw+5); //Repaint RATING area;
        }
    }, 70); // 70 ms refresh rate seems smooth enough
    
    // mouse leaving stars area
    if (!XYinRate && lrating !=rating) {
        g_drag = rating;
        rate_timeout = window.SetTimeout(function() { // timeout to kill timer
            if (rate_timer) window.ClearInterval(rate_timer);
                rate_timer = false;
                window.RepaintRect(hofset, vofset, imgw*5, imgw+5); //Repaint RATING area;
        }, 150);
    };
}


So is it the right way of doing it? I'm kind of new to JScript coding so don't judge me for stupid questions please
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-10 11:30:41
if you're using windows 8 or newer, make sure the script engine setting in the editor dialog is set to the default jscript and not jscript9. that causes silly cpu usage even with an empty on_mouse_move function.
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2014-09-12 10:00:30
marc2003, just one question.

Is it possible to replace something in your Web Links script for one of the buttons to execute Run Service (foo_run) whenever clicked? I've tried using var viewer = fb.RunContextCommand("Run service/Open Novel"); -- which opens calibre program in my case -- but does not work as planned. Whenever the title is playing, it executes Run Service on its own, and multiple times, without me actually clicking the button.

Here's how the whole script currently looks like. I don't really have much experience with scripting, if at all, save for changing some small things, like different sites in example below, so would really appreciate some help.

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common6.js"
// @name "Web Links"
// @author "marc2003, Images by komodomedia.com and mjm716"
// @version "6.2012-12-05.01"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var p = new panel("Web Links", ["custom_background", "metadb"]);
var b = new buttons();
b.update = function() {
    if (!p.metadb) return;
    var artist = encodeURIComponent(p.eval("%artist%"));
    var title = encodeURIComponent(p.eval("%title%"));
    var album = encodeURIComponent(p.eval("%album%"));
    var fantasticfiction = "http://www.fantasticfiction.co.uk/search/?searchfor=book&keywords=" + album;
    var goodreads = "https://www.goodreads.com/search?utf8=%E2%9C%93&query=" + album;
    var wwe = "https://www.worldswithoutend.com/searchwwe.asp?st=" + album;
    var wikipedia = "http://en.wikipedia.org/w/index.php?search=" + album;
    var viewer = fb.RunContextCommand("Run service/Open Novel");
        b.buttons = {
        but1: new button(12, 5, 32, 32, {normal: "ff1.png", hover: "ff1_h.png"}, function() { p.browser(fantasticfiction); }, fantasticfiction),
        but2: new button(54, 5, 32, 32, {normal: "goodreads2.png", hover: "goodreads2_h.png"}, function() { p.browser(goodreads); }, goodreads),
        but3: new button(96, 5, 64, 32, {normal: "wwe2.png", hover: "wwe2_h.png"}, function() { p.browser(wwe); }, wwe),
        but4: new button(170, 5, 32, 32, {normal: "wiki.png", hover: "wiki_h.png"}, function() { p.browser(wikipedia); }, wikipedia),
        but5: new button(212, 5, 32, 32, {normal: "viewer.png", hover: "viewer_h.png"}, function() { p.browser(viewer); }, viewer)
    }
    window.Repaint();
}

on_item_focus_change();

function on_size() {
    p.size();
}

function on_paint(gr) {
    p.draw_background(gr);
    b.draw(gr);
}

function on_metadb_changed() {
    b.update();
}

function on_mouse_move(x, y) {
    b.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
    b.lbtn_up(x, y);
}

function on_mouse_rbtn_up(x, y) {
    p.rbtn_up(x, y);
    return true;
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-12 11:24:06
whatever you're calling from foo_run could be called from within the script itself.

however, you could get it to work by changing this line.....

Code: [Select]
but5: new button(212, 5, 32, 32, {normal: "viewer.png", hover: "viewer_h.png"}, function() { fb.RunContextCommandWithMetadb("Run service/Open Novel", p.metadb, 8) }, "Open novel")
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2014-09-12 11:45:52
Works like a charm.

Thank you a lot!
Title: WSH Panel Mod script discussion/help
Post by: rksn on 2014-09-14 21:06:26
Hello folks...

There is a problem which i can't solve by myself and google. Hope you can help.
So, I'm trying to get my artwork script to refresh by itself after i changed the artwork on an playing file:
e.g.: Tagging -> Remove pictures.

So far i tryed to get an response of almost every given callback, but wasn't successful.
Even "on_metadb_changed()" and "on_playback_edited()" will not be triggered by "Reopening played file after update: [...]".

Any suggestions on this?
Thank you for your time :]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-15 12:32:25
^that issue has been discussed before and i don't think we can do anything about it. IIRC, someone did discover that one/both of those callbacks can be triggered if the playlist is an autoplaylist but that isn't much use.

i'm thinking perhaps it might even be an issue with foobar itself. i'd have thought foobar would notify the component when artwork changes in the same way it does when tags are updated but this is not the case.

disclaimer: of course i'm only speculating with that last sentence. i could be completely wrong.
Title: WSH Panel Mod script discussion/help
Post by: rksn on 2014-09-17 11:17:54
i'd have thought foobar would notify the component when artwork changes in the same way it does when tags are updated but this is not the case.


Maybe, but I think the panel mod just does not process the event from foobar correctly.
So it's more a problem with the component - Can't imagine such a glitch within the foobar core :D
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-17 12:57:34
So it's more a problem with the component - Can't imagine such a glitch within the foobar core


i'd have to disagree.  in my mind, i think foobar should send the same event as when tags have been updated. there's no reason at all why the component couldn't process that.

having looked at the changelog, foobar only supported the adding/removing of embedded art with version 1.1.7 and this was released after the last version of this component. if the foobar SDK has a separate callback for when embedded art has changed then obviously it won't have been implemented in the the component but to me, embedded art is just a tag so i don't see why it would need something separate.

as a workaround, you might want to consider adding your own button/menu command to the panel that refreshes the artwork. i've done this in my own scripts.
Title: WSH Panel Mod script discussion/help
Post by: rksn on 2014-09-17 19:37:28
having looked at the changelog, foobar only supported the adding/removing of embedded art with version 1.1.7 and this was released after the last version of this component.


Okay, you win!
Under these circumstances, your theory makes perfect sense to me :]
Maybe there is a chance to get this fixed with the currently developed version, if we report it.
Title: WSH Panel Mod script discussion/help
Post by: foosion on 2014-09-17 23:03:13
Actually the situation is much simpler. foobar2000 does not define or implement any callback for changed album art, no matter whether it was updated by foobar2000 itself or another application.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-18 10:42:24
^is there any chance it could be updated to trigger the same callback as when normal tags are updated? obviously this would only be for embedded art added/removed/modified by foobar itself. i think this makes more sense than adding anything new as all components could use it without modification.
Title: WSH Panel Mod script discussion/help
Post by: foosion on 2014-09-18 13:30:57
^is there any chance it could be updated to trigger the same callback as when normal tags are updated?
I cannot speak for Peter but this feels like a hack for me.
i think this makes more sense than adding anything new as all components could use it without modification.
This is not guaranteed to trigger a reload or repaint of the displayed album art. Especially components which check the changes in the metadata to avoid unnecessary repaints will not update the displayed album art. Therefore the "without modification" part of your argument is moot and introducing a separate callback would be much safer than changing the meaning of an existing one.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-18 13:42:14
fairy nuff. it doesn't even effect me as i don't use embedded art.  i just thought it would handy for those who do.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-09-18 21:59:23
fairy nuff. it doesn't even effect me as i don't use embedded art.  i just thought it would handy for those who do.



@Marc you are say that ''gdi.image'' can be extended to display image from net, without download?
How to do that?

I'm tryin to send url from WSH to preferences>display>stub image path
Because foobar can read url image and display it in album art panel.
But this isn't possible with WSH?

Also when i use foobar to load image from net(in album art panel), i didn't find that foobar download that image..
But, when i use WSH, same picture are downloaded in: ''C:\Users\[user]\AppData\Local\Microsoft\Windows\Temporary Internet Files'' and in ''wsh_last.fm'' folder..


Second thing, why people must to download image for artwork?
Isn't be simply solution that when you navigate trough playlist that it load images from net only for tracks that are visible on that moment, and then when you go trough playlist down it load images for second part, and so on. No needs to download images at all, i have 15gb images and this is too much..
My library constantly growing, what will be in future?

Also, why foobar doesn't have some network share site, where will be available automaticaly upload and download for artwork biography and other song info?
What i mean is that all users can be connected to this site, and when you play some song, site will collect info for that song(genre, biography, embedded art..) and share this with other? Then when you play same song you will automaticaly receive all that info..
In that way we will be independent from such sites like last.fm..
Is there any legal restriction, and is such site expensive?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-19 13:23:00
this is what i said before...

Quote
maybe the gdi.Image function could be extended if you know c++.


what i mean by that is that you'd have to download the source code for WSH panel mod and make an updated component.

this will still download images in the background the same bandwidth will be used. the only difference is that there won't be any temporary or cached files left behind. just because you can't see it, doesn't mean it's not happening.

with WSH panel mod as it is, you can just delete the files on a semi-regular basis to keep the size under control.

Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2014-09-20 03:14:27
I'm not sure if this is the right thread to ask, I'm having trouble sorting my albums into multiple discs. I'm using Falstaff's WSH Playlist.

(http://i.imgur.com/LaDcykh.jpg)

So I have the tracks labelled disc number 1, 2, and total discs set to 2. For some reason it still puts all the tracks in the same album. It does sort them by disc 1, disc 2, but I want to have them split into 2 albums so it will say at the top "[disc 1/2]" then another album underneath "[disc 2/2]".

Code: [Select]
$swapprefix(%album artist%)|%date%|$swapprefix(%album%)|%discnumber%|%tracknumber%|playcount=%play_count%


This is my sort script. Is there any way I can achieve this?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2014-09-20 17:31:49
right place.

be sure you haven't changed the GROUP PATTERN properties of the panel, default one should contains discnumber TAG to split multi-disc albums as well ;-)

(https://imagizer.imageshack.us/v2/998x805q90/661/MWJMC6.png)

HTH
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2014-09-21 03:33:06
You're a legend. Thanks so much Falstaff.
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2014-09-28 12:30:15
Marc, I have a small problem with your script again. 
"Now playing" panel can't automatically re-download artist's biography from both last.fm and wikipedia after I manually deleted folder with artist's information inside "wsh-lastfm" folder. Allmusic reviews can't be re-downloaded sometimes too, but I can use "paste text from clipboard" feature with them now, so its ok. Everything else re-downloads fine for this artist (images,similar artists, top tracks, musicbrainz files). New added artists work perfect as always.
If this re-download issue is intended behavior, can you add "paste text from clipboard" feature for artist's bio too?
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2014-09-28 23:38:54
Marc, I have a small problem with your script again. 
"Now playing" panel can't automatically re-download artist's biography from both last.fm and wikipedia after I manually deleted folder with artist's information inside "wsh-lastfm" folder. Allmusic reviews can't be re-downloaded sometimes too, but I can use "paste text from clipboard" feature with them now, so its ok. Everything else re-downloads fine for this artist (images,similar artists, top tracks, musicbrainz files). New added artists work perfect as always.
If this re-download issue is intended behavior, can you add "paste text from clipboard" feature for artist's bio too?

oops. It actually downloaded now after a day. So maybe it was a problem on server side or there is some kind of timeout for biography downloads  .
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-09-29 06:48:26
Quick question if I may please.. pulling hair out

Does anyone have Jscript-WSHPM.xml and Jscript-WSHPM_udl.xml language definition for Notepad++?

A fella on this blog posts said it was on the Notepad mediawiki (which is currently down) but I couldnt find any trace of it on archive.org or even a google search.

Here is the post:
http://p774.blog.fc2.com/blog-entry-26.html (http://p774.blog.fc2.com/blog-entry-26.html)

If not, would anyone happen to have one for any other editor? Which editor do you use for code hinting panel mod functions? 

Thanks


Think this is what you're looking for.

Dropbox link (https://www.dropbox.com/s/966ey3pnzk7lf4i/JScript-WSHPM.zip?dl=0)
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2014-09-29 07:05:15
I'm trying to make a playlist for a party. Since there's multiple artists I got rid of the group pattern in Falstaff/Br3tt's WSH Playlist.

(http://i.imgur.com/zvqnUX9.jpg)

I'm able to drag the tracks around, but I don't want them to get messed up by any sorting and have to start over again.

Is there a way I can automatically change the track numbers to match how they are ordered in the playlist? I know there's the "auto track number" option when you press tools in the properties dialogue, but since these tracks are just individual songs from different folders, it just names them "1, 1, 1, 1" etc. Is there a component or something I could use to automatically name them in the sequence they are in after drag and dropping them? I know I could export the playlist and have all the tracks in the same folder, and then run the "auto track number" but since I'm constantly adding songs to this playlist I'd have to export it every time I add new tracks.

Is there a better way to create playlists like this?

EDIT:
I just realised that "auto track number" changed the metadata of the track in all the playlists lol. Hmm is there some kind of playlist panel/component that ignores the metadata track number and just allows you to drag the tracks around into their own order? I want to do this without messing with my other playlists.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-09-29 07:15:07
Quick question if I may please.. pulling hair out

Does anyone have Jscript-WSHPM.xml and Jscript-WSHPM_udl.xml language definition for Notepad++?

A fella on this blog posts said it was on the Notepad mediawiki (which is currently down) but I couldnt find any trace of it on archive.org or even a google search.

Here is the post:
http://p774.blog.fc2.com/blog-entry-26.html (http://p774.blog.fc2.com/blog-entry-26.html)

If not, would anyone happen to have one for any other editor? Which editor do you use for code hinting panel mod functions? 

Thanks


Think this is what you're looking for.

Dropbox link (https://www.dropbox.com/s/966ey3pnzk7lf4i/JScript-WSHPM.zip?dl=0)


Thanks, Perfect.... 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-09-29 09:59:33
oops. It actually downloaded now after a day. So maybe it was a problem on server side or there is some kind of timeout for biography downloads  .


if this happens again, just clear all temporary files from within internet explorer.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-09-29 22:21:39
Is there a way I can automatically change the track numbers to match how they are ordered in the playlist? [...]


Instead of using track numbers in a playlist like this try Index instead. Uncheck the track number column from being displayed and use Index in its place. It will not alter any tags and it will show (act) like a temporary track number and update accordingly to the position in the playlist. Change positions by dragging the index number of the file to wherever you want it in the playlist.
Title: WSH Panel Mod script discussion/help
Post by: Solynth on 2014-09-30 00:48:50
Is there a way I can automatically change the track numbers to match how they are ordered in the playlist? [...]


Instead of using track numbers in a playlist like this try Index instead. Uncheck the track number column from being displayed and use Index in its place. It will not alter any tags and it will show (act) like a temporary track number and update accordingly to the position in the playlist. Change positions by dragging the index number of the file to wherever you want it in the playlist.


That's just what I was looking for, thank you so much.
Title: WSH Panel Mod script discussion/help
Post by: millzeyweb on 2014-10-01 00:56:03
Quick question if I may please.. pulling hair out

Does anyone have Jscript-WSHPM.xml and Jscript-WSHPM_udl.xml language definition for Notepad++?

A fella on this blog posts said it was on the Notepad mediawiki (which is currently down) but I couldnt find any trace of it on archive.org or even a google search.

Here is the post:
http://p774.blog.fc2.com/blog-entry-26.html (http://p774.blog.fc2.com/blog-entry-26.html)

If not, would anyone happen to have one for any other editor? Which editor do you use for code hinting panel mod functions? 

Thanks


Think this is what you're looking for.

Dropbox link (https://www.dropbox.com/s/966ey3pnzk7lf4i/JScript-WSHPM.zip?dl=0)


Oh man 1000 thank you very muches
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-10-01 20:46:11
I want to insert within WSH a playlist item(s)  from one playlist (b) to another playlist (a) , but into the item's same position(index)  in playlist (a) which gets removed.

With this code the new entries are added to the end.
Code: [Select]
//target playlist
var a = plman.ActivePlaylist;
var idxa = plman.GetPlaylistFocusItemIndex(a);
plman.RemovePlaylistSelection(a);

//source playlist
playlist_name = "b";

var idxp = -1;

    // Find the playlist first.
    for (var i = 0; i < fb.PlaylistCount; ++i)
    {
        if (fb.GetPlaylistName(i) == playlist_name)
        {
            idxp = i;
            break;
        }
    }

    // Switch to the playlist
    fb.ActivePlaylist = idxp;

//copy items to target

var srcIndex = plman.ActivePlaylist;
   
if (srcIndex < 0) return;
   
    var items = plman.GetPlaylistItems(srcIndex);
           
    plman.InsertPlaylistItems(a, 0, items);      <------------Want to insert new items starting at index idxa
    plman.ActivePlaylist = a;
   
    items.Dispose();


Is it possible??
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2014-10-02 11:27:19
From the docs:

plman.InsertPlaylistItems(playlistIndex, base, handles, select = false);

So the second item specifies the position & the below ought to work so long as the rest of your code is correct.

Code: [Select]
plman.InsertPlaylistItems(a, idxa, items);
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-10-02 11:58:51
From the docs:

plman.InsertPlaylistItems(playlistIndex, base, handles, select = false);

So the second item specifies the position & the below ought to work so long as the rest of your code is correct.

Code: [Select]
plman.InsertPlaylistItems(a, idxa, items);


Thanks for verifying,

I had read the docs , and I guessed that base was the index but I had a  typo in my code.
Works now 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-10-02 21:04:10
One question for Marc or other who know..
I have windows xp professional(version 2002 , service pack 2) on my work, and i'm set to listen Foobar Youtube Radio (http://www.hydrogenaud.io/forums/index.php?showtopic=105108&st=50) , everything works, but can't open input box from WSH, here's code i'm use:

Code: [Select]
//Input Box    
    this.InputBox = function(prompt, title, value) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    value = value.replace(/"/g, '" + Chr(34) + "');
    var temp_value = this.vb.eval('InputBox' + '("' + prompt + '", "' + title + '", "' + value + '")');
    if (typeof temp_value == "undefined") return value;
    if (temp_value.length == 254) this.MsgBox("Your entry was too long and will be truncated.\n\nSee the WSH panel mod script discussion thread on hydrogenaudio forums for help.", 0, "Youtube Radio");
    return temp_value.trim();
    }

this.vb = new ActiveXObject("ScriptControl");
this.vb.Language = "VBScript";
this.artist = "%artist%";




I have error on this:
Code: [Select]
this.vb = new ActiveXObject("ScriptControl");
this.vb.Language = "VBScript";
this.artist = "%artist%";


Console:

Code: [Select]
Scripting Engine Initialization Failed (Youtube Radio by Mire777, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).


Error: WSH Panel Mod (Youtube Radio by Mire777): Microsoft JScript runtime error:
Automation server can't create object
File: <main>
Ln: 395, Col: 2
<source text only available at compile time>


What is the problem?
Did i have to install some support for windows xp , is this possible?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-02 21:47:02
Quote
Automation server can't create object


this error usually means you haven't turned off safe mode in the WSH panel mod preferences (under tools).

i'm cursed with using XP at the moment and all my scripts using the input box function work just fine. i'm running SP3 though. i don't know if this makes any difference or not.

if the script still crashes on theses lines of code, you can comment them out.

Quote
this.vb = new ActiveXObject("ScriptControl");
this.vb.Language = "VBScript";


then you can hold shift when you right click the script and select properties. here you can change variables and all my scripts with an editable artist string have a value named artist_tf - or you can edit the script itself.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-10-03 00:30:12
this error usually means you haven't turned off safe mode in the WSH panel mod preferences (under tools).

i'm cursed with using XP at the moment and all my scripts using the input box function work just fine. i'm running SP3 though. i don't know if this makes any difference or not.


No, safe mode is turned off.
I think this is because of SP2.
I was also try your thumbs script with same line, and it crashes right there.

Console:
Code: [Select]
Error: WSH Panel Mod (Thumbs by marc2003): Microsoft JScript runtime error:
Automation server can't create object
File: C:\Program Files\STUFF\foobar2000\marc2003\common7.js
Ln: 1396, Col: 2
<source text only available at compile time>



if the script still crashes on theses lines of code, you can comment them out.


For now i was excluded this line from script, and script works fine, but..
Why is this happening?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-03 00:36:27
Quote
Why is this happening?


i think you've already answered your own question....

Quote
I think this is because of SP2.


i know my scripts work on a totally naked SP3 install with no other updates installed. i can't test an earlier version myself because SP3 is integrated into my install disk. you should install SP3 or maybe find the changelog that details which update you need to install. but doing that might be easier said than done..... 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-10-03 00:51:32
i know my scripts work on a totally naked SP3 install with no other updates installed. i can't test an earlier version myself because SP3 is integrated into my install disk. you should install SP3 or maybe find the changelog that details which update you need to install. but doing that might be easier said than done..... 


Thank you..
Then i must download and install Service Pack 3.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-03 01:16:36
i hope installing SP3 works out for you. if it doesn't, i really can't think what else it could be.

as you can see here, it just works for me....

(https://dl.dropboxusercontent.com/u/22801321/2014/october/input.png)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-10-03 18:11:23
i hope installing SP3 works out for you. if it doesn't, i really can't think what else it could be.

as you can see here, it just works for me....


I see, thanks..
Maybe is something messed up even in OS, i found update for this, but don't know , if i'm gonna do this, i'm afraid that something goes wrong..
I'll probably just modify the script and set input box in panel..
Thank God i'm using windows 7 on home
Title: WSH Panel Mod script discussion/help
Post by: Daeron on 2014-10-03 20:11:18
Marc (or anyone else), do you think it would take a lot of work to create a script to list all cover arts from the currently highlighted playlist in a gridlike fashion?

Currently I'm using foo_uie_graphical_browser for this purpose, but it seems to freeze foobar until all covers are loaded, which, in case of large playlists becomes a problem. Es/ELPlaylist are simply extremely slow to load them in my experience.

The point is to identify albums (therefore folders) with missing external cover art by simply looking at the blank spaces in the list of covers. Location is always $directory_path(%path%)\cover.* (next to the tracks). Clicking on a cover art (even if blank) should open the directory of said path. Not sure if possible, but disabling the scrollbar would be highly preferred. Giving a colorized border to highlighted or currently playing album would be a bonus but not important.

http://i.imgur.com/ou4Sbch.png (http://i.imgur.com/ou4Sbch.png)

Above is how I have it currently. It's that vertical because it goes along the side of an actual playlist. The blank in the middle is the album without cover art. The one with orange border is the currently playing album and the blue is the currently highlighted.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-03 20:25:19
i know falstaff made a script that displays all covers for the current playlist. i don't use it though so i have no idea what performance is like with large playlists.

http://pastebin.com/TTxyjjcQ (http://pastebin.com/TTxyjjcQ)

edit: thinking about this from a completely different angle, this album art download XUI program can interface with foobar and i will list albums with missing art. you can search by library or select a playlist.

i've just tested it and you can see from this screenshot what it is capable of.

(https://dl.dropboxusercontent.com/u/22801321/2014/october/xui.png)

program: http://www.hydrogenaud.io/forums/index.php?showtopic=57392 (http://www.hydrogenaud.io/forums/index.php?showtopic=57392)
required foobar component: http://www.hydrogenaud.io/forums/index.php?showtopic=39946 (http://www.hydrogenaud.io/forums/index.php?showtopic=39946)
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-10-03 22:51:49
Is it possible to create a WSH panel for lastFm similar tracks
I tried using track.getSimilar methoed but got this error in console :Track not found
Title: WSH Panel Mod script discussion/help
Post by: Daeron on 2014-10-03 23:01:49
Falstaff's script shows that in terms of performance WSH is definitely the way to go. I have problems with it aesthetically (minimum window size is too big, the cover selected is always centered) which I can hopefully hack for my taste given some time.

I knew about Album Art Downloader, however for me the aim in the current situation is to have an immediate idea of what albums are missing covers by a simple glance with the least amount of input required. The program does pretty much the same thing, it's just one more click away. Also I think it can't discern between embedded and external artwork (in terms of actually letting me select only the ones with one or the other, not just show it), but I could be wrong on that.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-03 23:27:50
Is it possible to create a WSH panel for lastFm similar tracks
I tried using track.getSimilar methoed but got this error in console :Track not found


yes, this should be possible. i just checked the example links on the docs page and they work as expected. did you start your own script from scratch or are you modifying something created by someone else?

2 things you must pay attention to is that you pass all the required parameters as part of the url you supply and that you check and parse the response correctly. if using JSON, it's returned in a pretty much un-readable wall of text so you can either use a website (http://jsonlint.com/) that will format it nicely so you can analyse the structure or use a decent text editor like notepad++ and the jstool plugin.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-10-04 07:57:15
Is it possible to create a WSH panel for lastFm similar tracks
I tried using track.getSimilar methoed but got this error in console :Track not found

yes, this should be possible. i just checked the example links on the docs page and they work as expected. did you start your own script from scratch or are you modifying something created by someone else?

2 things you must pay attention to is that you pass all the required parameters as part of the url you supply and that you check and parse the response correctly. if using JSON, it's returned in a pretty much un-readable wall of text so you can either use a website (http://jsonlint.com/) that will format it nicely so you can analyse the structure or use a decent text editor like notepad++ and the jstool plugin.

Actually I modified your code marc2003 
Im trying to do this by editing your similar artist script
I just edited the cmmon7.js files 2449 line as this :
Code: [Select]
url = l.get_url() + "&method=" + this.lastfm_methods[this.lastfm_mode] +  "&artist=" + encodeURIComponent(this.artist) + "&track=" + encodeURIComponent(this.track) + "&autocorrect=" + (l.auto_correct ? 1 : 0);
and i changed lastfm_mode : artist.getSimilar  to track.getSimilar
artist HAS to title HAS in line 2284
I thought it would work but it gives the error: Last.fm Similar Artists: Track not found
I'm kinda new to programming so I'll be very thankful if you help me out
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-04 10:05:50
there is so much more work to do than changing that one line of code.   

there is even a lot more to do than the 2 things i outlined in my previous post. at the moment, my similar artists script only triggers on an artist change but it needs to trigger on a track change and you must consider a whole new file naming scheme for the cached data. at the moment, it stores one file artist as that is all it currently needs. when you've considered how do detect track changes/save the data, you need figure out how to parse the response - that's something i mentioned previously about working with JSON. track.getsimilar will have a different internal structure to artist.getsimilar. i expect only minor changes would be required but the current code will ignore it.

tbh, it might be easier if i just did it myself. i might take a look over the next few days. 
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-04 10:29:54
It's been awhile since I switched to a Mac and... you guessed it, I am missing foobar2000.
Long back, I had made my own foobar2000 theme which I recently converted to an app using WineBottler.
The task was fairly simple. Everything works fine except for 3 WSHMod panel scripts.

One of them is a simple script that lets me cycle through different playback orders.
The error i get on this is:
Quote
Scripting Engine Initialization Failed (Playback Order Button, CODE: 0x80004001): Unknown error code (2147500033)

Maybe I need to modify my WineBottler settings to include some crucial dll file (maybe?).

The WSHMod panel script goes like this:

Code: [Select]
//...
window.MinWidth = window.MaxWidth = 27;
window.MinHeight = window.MaxHeight = 20;

var path = fb.ProfilePath + "exdb\\Buttons\\PBO\\";
var PBO;
var icon;

checkPBO();

function checkPBO(){
    PBO = fb.PlayBackOrder;
    icon = gdi.Image(path + "pbo_" + PBO + ".png");
}

//... code continues but irrelevant


Bascially, It screws up when
Code: [Select]
gdi.Image
comes into the picture.
Would anyone be kind enough to shed some light on this. What is needed to support this?

Like, what are it's dependencies? ...something like that
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-04 10:49:56
i've only ever used WINE on ubuntu linux (many years ago ) so i have no idea if this works on a mac but i assume you have winetricks available?

if so, try installing these packages

gdiplus
wsh56

i also installed these because my scripts needed internet access but you might not need them??

winhttp
wininet
ie8
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-04 11:11:06
i've only ever used WINE on ubuntu linux (many years ago ) so i have no idea if this works on a mac but i assume you have winetricks available?

if so, try installing these packages

gdiplus
wsh56

i also installed these because my scripts needed internet access but you might not need them??

winhttp
wininet
ie8
aah, some direction.
thanks marc2003

i am not so good with winetricks. it just confuses me  but now that you mentioned it, i'll try those out.

PS: One of those 3 malfunctioning scripts is your amazing last.fm script. Hopefully that'll start working as well.
Thanks,
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-04 11:45:46
tbh, it might be easier if i just did it myself. i might take a look over the next few days. 


i quickly cobbled something together but i won't release it just yet. i think some more testing is required.

one thing i have noticed is that the cached data files using this track.getSimilar are much larger than from other feeds (around 300-400KB). when you combine that with the fact you're fetching a new file for every track rather than one per artist, the size of the cached data could build up rather quickly - say 4-5MB for a normal length album.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-04 14:17:01
@samithaj, i'm not particularly happy about the amount of bandwidth/storage space this track.getSimilar script uses so i'm not making it part of my main download. i have uploaded it here for you try it out if you want to....

https://dl.dropboxusercontent.com/u/2280132...ilar/common7.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/similar/common7.js) << save this in your marc2003 folder when foobar is not running.

additionally, for it to properly display the track title in the panel header area, you'll need to import this file into your panel.

https://dl.dropboxusercontent.com/u/2280132...r%20artists.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/similar/last.fm%20similar%20artists.txt)

it's a modification of my existing similar artists script and you can switch to similar tracks using the right click menu.

edit: why not have a screenshot as well...

(https://dl.dropboxusercontent.com/u/22801321/wsh/temp/similar/pic.png)
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-10-04 18:43:19
Big thanks to marc 2003 providing a working script  .It very premature of me to think that script will work just by changing 2 lines of code : 
I think adding (limit (Optional) : Maximum number of similar tracks to return) parameter will reduce cached data size
I use your awesome  scripts in my foobar and they are very usefull, again thanks!!!
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-05 13:35:05
i've only ever used WINE on ubuntu linux (many years ago ) so i have no idea if this works on a mac but i assume you have winetricks available?

if so, try installing these packages

gdiplus
wsh56

i also installed these because my scripts needed internet access but you might not need them??

winhttp
wininet
ie8
Awesome!!

I used the winetricks you suggested and it now renders 2 of the 3 WSHmod scripts.
Your script still shows no sign of life.

Anyways, it solved one major issue of not exiting properly but it brought up a new major issue.
The foobar volume control won't work

It worked before any winetricks

Any ideas what to do?

In the meantime I try different sets of those winetricks to see which is most optimized for me.

EDIT:
Ok, i recreated using only WSH56js, gdiplus_winxp and winxp
All good but your script is still crashing.

What all dependencies would your script technically need?
As I stated earlier, I had tried winhttp, wininet and ie8 and it still hadn't worked.

Sql somethings?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-05 22:49:15
I think adding (limit (Optional)


blindingly obviously. that's why i didn't think of it.  i'm sure you can make that change yourself. you found the right line of code before so just add something like &limit=25

@matav, i'm pretty sure i had my last.fm playcount script working with just those things i've already listed. i know when i used ubuntu, i had to make sure sqlite3.exe file inside the marc2003 folder was executable. i just right clicked the file>properties in whatever file manager i was using. as it's a basic command line program, there are no other dependencies.

as for the "crashing", i assume when you're getting the harmless blue background with the "aw crashed " message? you need to read the dialog as it tells you to look at the foobar console. this gives great clues such as the line number containing the errant code or other helpful error messages. i can't diagnose problems without the details.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-06 07:29:18
...
@matav, i'm pretty sure i had my last.fm playcount script working with just those things i've already listed. i know when i used ubuntu, i had to make sure sqlite3.exe file inside the marc2003 folder was executable. i just right clicked the file>properties in whatever file manager i was using. as it's a basic command line program, there are no other dependencies.

as for the "crashing", i assume when you're getting the harmless blue background with the "aw crashed " message? you need to read the dialog as it tells you to look at the foobar console. this gives great clues such as the line number containing the errant code or other helpful error messages. i can't diagnose problems without the details.
whoops, my bad.

I forgot that the console is a bit more descriptive than simply
Code: [Select]
Scripting Engine Initialization Failed (Last.fm Playcount Sync by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

the error is:
Code: [Select]
Error: WSH Panel Mod (Last.fm Playcount Sync by marc2003): Microsoft JScript runtime error:
Automation server can't create object
File: C:\winebottler\marc2003\common4.js
Ln: 398, Col: 1

the version of your script that I have has this at line 398:
Code: [Select]
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
Title: WSH Panel Mod script discussion/help
Post by: elia_is_me on 2014-10-06 13:16:48
news about wsh panel mod --
theophile stopped developing wsh panel mod for a long time, while now ttsping start to dev a mod version named wsh-panel-mod-plus, simillar to wsh-panel-mod-sp(by neon), anybody interested ?

Code: [Select]
//窗口风格 详见http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx
//扩展窗口风格 详见http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543%28v=vs.85%29.aspx


interface IWindow{
Properties:
  (read,write) Left;//窗口左坐标
  (read,write) Top;
  (read,write) Width;
  (read,write) Height;
  (read,write) Style; //窗口风格
  (read,write) ExStyle;//窗口扩展风格
  (read,write) Caption;//窗口标题
Methods:
IWindow GetChild(class_name,index);//获取类名为class_name的第index个面板
//flag=1 同GetParent
//flag=2 获取根窗口句柄
//详见 [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms633502%28v=vs.85%29.aspx]http://msdn.microsoft.com/en-us/library/wi...v=vs.85%29.aspx[/url]
IWindow GetAncestor(flag = 1);
void SetParent(IWindow parent);
void SendMsg(msg,wp,lp);
//详细及flag见 [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx]http://msdn.microsoft.com/en-us/library/wi...v=vs.85%29.aspx[/url]
void Show(flag);
void Move(x,y,w,h,redraw = false);
boolean IsVisible();
boolean IsMinimized();
boolean IsMaximized();
//vista+
//mode = 0时,l t r b对应左/上/右/底边距
//mode = 1时,对应点(l,t)与(r,b)为左上/右下的矩形区域
void CreateGlass( l, r, t , b, mode = 0);
//color 透明色
void SetWindowTransparency(opacity,color);
int MsgBox(caption,prompt,type);
String InputBox(caption="",prompt="",defval="",num_only = false);
//mode:
// 0 打开文件 1 保存文件 2 打开目录
// 打开目录时,参数除title 其他忽略
String FileDialog(mode = 0,title="Open",filetype="All Files|*.*",defext="*");
IGdiBitmap PrintWindow(client_only = false);
}

interface IPrivateFontCollection{
Properties:
(readonly) FamilyCount;
Methods:
int AddFont(path);
IGdiFont GetFont(name,size,style);
}

//实验性质
interface IHttpRequest{
Methods:
    void AddHeader(str);
    void AddPostData(name,value);
    String Run(url);
    int RunAsync(url);//异步url请求,返回cookie值,完成后调用on_http_run_done(cookie,string);
}

interface WSHUtils{
Methods:
IWindow GetWND(class_name);
IWindow CreateWND(window_id);
IWindow ReleaseCapture();
boolean IsAeroEnabled();
IGdiBitmap DecodeBase64Image(str);
String GetClipboardText();
void SetClipboardText(str);
void PlaySound(path,flag);
HCURSOR LoadCursorX(path);
HCURSOR SetCursorX(handle);
void ReleaseCursorX(handle);
boolean IsVistaOrGreater();
//详见http://msdn.microsoft.com/en-us/library/windows/desktop/dd318700%28v=vs.85%29.aspx
String LCMapString(str,lcid,flag);
//type_str:
//"GET"
//"POST"
IHttpRequest CreateHttpRequest(type_str);
VBArray GetWindowsVersion();
}

interface IThemeManager {
Methods:
//Vista+
void DrawThemeTextEx(IGdiGraphics, text, color, x, y, w, h, iGlowSize = 5 , format = 0);
}

interface IGdiUtils {
Methods:
//返回值0:成功
int AddFontResEx( path,fl=0);
//fl必须与AddFontResEx中的值相同
int RemoveFontResEx( path,fl=0);
IPrivateFontCollection CreatePrivateFontCollection();
IGdiBitmap CloneGraphics(IGdiGraphics,x,y,w,h);
}

interface IGdiGraphics{
Methods:
  void FillPie(x,y,w,h,start_angle,sweep_angle,color);
  void DrawPie(x,y,w,h,start_angle,sweep_angle,color);
}

interface IFbPlaylistManager {
Methods:
  string PlaylistGetAutoName(playlistIndex);//自动获取播放列表名称(根据列表曲目)
  //锁定播放列表
  //FLAGs:
  //FLAG_ADD = 0x00000001
  //FLAG_REMOVE = 0x00000002
  //FLAG_REORDER  = 0x00000004
  //FLAG_REPLACE  = 0x00000008
  //FLAG_RENAME = 0x00000010
  //FLAG_REMOVE_PLAYLIST = 0x00000020
  void PlaylistLock(playlistIndex,flag);
  //注:锁定后的播放列表index更改后,请使用更改后的new_index进行unlock
  void PlaylistUnlock(playlistIndex);
  void ProcessLocationsAsync(urls);//完成后调用on_process_locations_done(metadbs)
}

//improve
interface IFbTitleFormat {
Methods:
    //对于foobar2000 v1.3.0 以上,请注意fromfile参数
    String Eval(force = false,fromfile = false);
    String EvalWithMetadb(IFbMetadbHandle,fromfile = false);
    void Dispose();
}

interface IFbMetadbHandle {
Methods:
    //对于foobar2000 v1.3.0 以上,请注意参数
    IFbFileInfo GetFileInfo(fromfile = false);
    void UpdateFileInfo(IFbFileInfo,force = false);
}

interface IFbUtils {
Methods:
    boolean IsMediaLibraryEnabled();
    IFbMetadbHandleList GetAllItemsInMediaLibrary();
    //query_string同媒体库搜索
    IFbMetadbHandleList QueryMulti(handles,query_string);
    //返回菜单命令项状态flag,如选中、禁用等
    //flag_disabled = 1
    //flag_checked = 2
    //flag_radiochecked = 4
    int GetMainMenuCommandStatus(command);
    void ShowPreferences(guid_str="");
    boolean LoadPlaylistV2(path);
    boolean SavePlaylistV2(path,handles,overwrite = false);//当overwrite=true时,将备份原文件为"原播放列表文件名.bak"
}

interface IWSHUtils {
Methods:
    //输出设置页面GUID至控制台
    void PrintPreferencePageGUID();
    //pattern: 设置项-显示-封面模板方式,即按行分割,e.g.  "c:\\%album%.jpg\ncover.jpg";
    IGdiBitmap GetAlbumArtV3(metadb, pattern , art_id = 0, need_stub = true, load_embed = true , use_fallback = true);
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-06 15:28:40
Automation server can't create object


and you definitely have safe mode disabled under tools>preferences>wsh panel mod.

open a brand new panel with no code in it, paste in this section and see if it will load all these without crashing....

Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var vb = new ActiveXObject("ScriptControl");
vb.Language = "VBScript";


if it does work but then crashes if you add the xmlhttp line, then we know there is come kind of problem with the wine configuration. how to fix that, i would have no idea?? i know it worked for me on ubuntu/wine because it is absolutely necessary for all my scripts that fetch info from the internet and i have a whole bunch of those.

i assume when you used winetricks, you didn't get any errors and everything appeared to install correctly? for example, with ie8, you should see the full GUI installer like you get running the setup program on windows xp.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-06 22:05:08
Automation server can't create object
and you definitely have safe mode disabled under tools>preferences>wsh panel mod.
yes, "safe mode" is unchecked. ain't it meant to be disabled?

----
open a brand new panel with no code in it, paste in this section and see if it will load all these without crashing....
Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var vb = new ActiveXObject("ScriptControl");
vb.Language = "VBScript";
Crashed with the following:

Quote
Scripting Engine Initialization Failed ({D157A5FE-9B29-4F57-B2EC-6D4D046BDB04}, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).
Code: [Select]
Error: WSH Panel Mod ({A587D636-7EA4-4AF2-BE88-744A30E6C055}): Microsoft JScript runtime error:
Automation server can't create object
File: <main>
Ln: 3, Col: 1
something related to VB ...maybe?

----
if it does work but then crashes if you add the xmlhttp line, then we know there is come kind of problem with the wine configuration.
i forgot to mention but i got this error fixed by including the `msxml3` winetrick.

----
i assume when you used winetricks, you didn't get any errors and everything appeared to install correctly? for example, with ie8, you should see the full GUI installer like you get running the setup program on windows xp.
yes, but ie8 disables foobar's inbuilt volume control and messes with the folder structure a bit so I ditched it for ie6.

----
The winetricks I think are going good for me are: gdiplus_winxp, msxml3, wsh56js, winhttp, wininet, ie6, winxp

I have noticed that out of the 3 wsh winetricks available: wsh56js (js only), wsh56vb (vb only) & wsh57, only wsh56js works.

----
sorry for the long, troubling post, marc

the current status is:
Code: [Select]
Error: WSH Panel Mod (Last.fm Playcount Sync by marc2003): Microsoft JScript runtime error:
Automation server can't create object
File: C:\winebottler\marc2003\common4.js
Ln: 400, Col: 1
line 400 has:
Code: [Select]
var vb = new ActiveXObject("ScriptControl");
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-06 23:18:10
as you're using a very old version of my script, stick with that. it's just newer versions of my scripts that require ie8.

as for the vb thing not working - it doesn't matter. just comment out those 2 lines like this.

Code: [Select]
//var vb = new ActiveXObject("ScriptControl");
//vb.Language = "VBScript";


make sure you don't trigger the option to set your last.fm username via the right click menu because that relies on the above code.

if you're using a portable version of foobar that was previously setup with your last.fm username then it should just work. that means there should be a file named username (no extension) inside a folder named wsh_settings. if it's not there, you can create it manually using notepad - the content of the file should obviously be your username.

i'll await the next report because something else is bound to go wrong.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-07 09:03:24
...
as for the vb thing not working - it doesn't matter. just comment out those 2 lines like this.

Code: [Select]
//var vb = new ActiveXObject("ScriptControl");
//vb.Language = "VBScript";
It works now o_O Thank you so much! \o/

make sure you don't trigger the option to set your last.fm username via the right click menu because that relies on the above code.
aye-aye, it does crash if i use those options

if you're using a portable version of foobar that was previously setup with your last.fm username then it should just work. that means there should be a file named username (no extension) inside a folder named wsh_settings. if it's not there, you can create it manually using notepad - the content of the file should obviously be your username.
it seems that I'll have to manually create the file, which... i did but what about the API key? I have it but how do I specify it? and... got api_key set as well.

but... now what? it shows the exclamation with the tooltip reading:
Quote
Please use the context menu to set your Last.fm username and API KEY.
I did my primitive debugging and this case executes
Code: [Select]
case username.length == 0:
so, it would seem that the following doesn't work:
Code: [Select]
var username = read(username_file);
----
marc, thank you so much for your help. you have no idea how much i appreciate it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-07 13:01:00
so, it would seem that the following doesn't work:
Code: [Select]
var username = read(username_file);


it uses this bit of code i posted earlier...

Code: [Select]
var fso = new ActiveXObject("Scripting.FileSystemObject");


this seems to load with crashing the panel but for whatever reason it's not working. maybe some other dependency? but seeing as you can edit the script directly, it's not important.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-10-07 18:19:59
@marc2003 Is there a way to point all Last.fm Similar Artists panal's Autoplaylist links to same playlist rather than creating a new plalist every time i click on a link
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-07 19:11:33
...
but seeing as you can edit the script directly, it's not important.
ok, so i hardcoded my username and api key into the script and the heart appears now but "Create and import SQL file" doesn't work and neither does pressing the love button.

Both crash with the same error:
Quote
Error: WSH Panel Mod (Last.fm Playcount Sync by marc2003): Microsoft JScript runtime error:
Exception thrown and not caught
File: C:\winebottler\marc2003\common4.js
Ln: 374, Col: 1
<source text only available at compile time>
line 374 has:
Code: [Select]
throw new SyntaxError('JSON.parse');};}}());

and... the whole block would be, as you already know, but still:
Code: [Select]
var JSON;if(!JSON){JSON={};}
(function(){'use strict';function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-07 19:57:47
@samithaj, it's not possible to re-use an autoplaylist but when using a fixed name, it's possible to delete old ones first before creating a new one. obviously you'd want a playlist name that won't conflict with anything else. open the panel, scroll to the end and replace the entire last function with this....

Code: [Select]
function on_mouse_lbtn_up(x, y) {
switch(true) {
case li.up_btn.lbtn_up(x, y):
case li.down_btn.lbtn_up(x, y):
break;
case li.in_range && x > li.x + li.text_x && x < li.x + li.text_x + Math.min(li.names_widths[li.index], li.text_width):
switch(true) {
case li.lastfm_mode != 2 && li.lastfm_link == "autoplaylist":
var i = 0;
while(i < fb.PlaylistCount) {
if (fb.GetPlaylistName(i) == "Last.fm Similar") fb.RemovePlaylist(i);
else i++;
}
fb.CreateAutoPlaylist(fb.PlaylistCount, "Last.fm Similar", li.queries[li.index]);
fb.ActivePlaylist = fb.PlaylistCount - 1;
break;
default:
p.browser(li.urls[li.index]);
break;
}
break;
}
}

@matav, i actually didn't realise my scripts in the old common4.js file used JSON. this is why i thought it would work - i even said that newer scripts require ie8 in WINE because i knew about this crash in that block of JSON code. ie8 actually updates the windows scripting host components with native JSON support without the need for that code. it gets bypassed if it's detected. the reason that code is in my common file is for people running windows XP with IE6/7 where of course it works perfectly.

obviously, that code has nothing to do with me but i've looked at the site i originally got it from and it has been updated since i last checked so it might now magically work but i wouldn't hold your breath. trying to use the code with windows scripting host on a mac is not exactly a common usage scenario.

you can check it out here: https://github.com/douglascrockford/JSON-js...master/json2.js (https://github.com/douglascrockford/JSON-js/blob/master/json2.js)
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-08 09:27:50
...
@matav, i actually didn't realise my scripts in the old common4.js file used JSON. this is why i thought it would work - i even said that newer scripts require ie8 in WINE because i knew about this crash in that block of JSON code. ie8 actually updates the windows scripting host components with native JSON support without the need for that code. it gets bypassed if it's detected. the reason that code is in my common file is for people running windows XP with IE6/7 where of course it works perfectly.

obviously, that code has nothing to do with me but i've looked at the site i originally got it from and it has been updated since i last checked so it might now magically work but i wouldn't hold your breath. trying to use the code with windows scripting host on a mac is not exactly a common usage scenario.

you can check it out here: https://github.com/douglascrockford/JSON-js...master/json2.js (https://github.com/douglascrockford/JSON-js/blob/master/json2.js)
dang, seems like I hit a brick wall.
I tried the updated code as in that git and it was the same error.
 

Anyways... I'll peruse through the code and try to figure something out ...with my shady debugging skills
As per the comment, that exception is thrown when the JSON is not parseable.

I have a feeling it's something with the internet related winetricks because although foo_audioscrobbler & foo_uie_biography work fine & foo_softplaylists can love a track fine but will crash when it tries to get a list of top tracks for an artist or the like.
So it would seem that anything to do with large datasets causes problems.

I'll direct my attention here now and if it's just not happening then i'll update my foobar setup, your script and all and winebottler it once again.
So... you might hear from me again.
...
nah! i won't bug you no more


thanks for all your help, marc.

EDIT:
I tried to manually hit the ws.audioscrobbler.com/2.0/?format=json&api_key=&username=&s= link through the browser and i see:
Code: [Select]
{"error":3,"message":"Invalid Method - No method with that name in this package","links":[]}
any ideas?
ok, checked http://www.last.fm/api/show/user.getLovedTracks (http://www.last.fm/api/show/user.getLovedTracks) and it seems the script needs an update after all
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-08 10:31:23
EDIT:
I tried to manually hit the ws.audioscrobbler.com/2.0/?format=json&api_key=&username=&s= link through the browser and i see:
Code: [Select]
{"error":3,"message":"Invalid Method - No method with that name in this package","links":[]}
any ideas?
ok, checked http://www.last.fm/api/show/user.getLovedTracks (http://www.last.fm/api/show/user.getLovedTracks) and it seems the script needs an update after all
um... sorry, scratch this part as everything i said is incorrect
:/
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-08 13:43:42
^you only used a portion of the URL - that's why you didn't get any results. 

Quote
So it would seem that anything to do with large datasets causes problems.


no, it's nothing to do with that. foo_softplaylists crashes because the api_key has been revoked. if you search the relevant thread, you'll find romor has built a patched version which doesn't crash.

and i suspect the components that work do because they're built using c++ which use windows APIs which are better supported in WINE.

either install ie8 and deal with the consequences or forget it.

Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-09 20:50:58
^you only used a portion of the URL - that's why you didn't get any results. 
yes, i realized that

Quote
So it would seem that anything to do with large datasets causes problems.
no, it's nothing to do with that. foo_softplaylists crashes because the api_key has been revoked. if you search the relevant thread, you'll find romor has built a patched version which doesn't crash.
On it. Thanks


----
PS: I think I'll just upgrade my entire foobar setup with all the new jazz.

Thanks for your help.
Much appreciated
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-09 21:51:08
install windows in bootcamp (or even a virtual machine). problem solved.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-10 10:11:25
install windows in bootcamp (or even a virtual machine). problem solved.
haha! bootcamp? that would be one big bloated waste of space.
Virtual machine? ...no less which is why I opted for Wine or CrossOver.

PS: romor's foo_softplaylists mod works (thanks for the tip).
So... It's just your script, marc2003, that's not working now

PPS: Just to have your script working again is why I'm even considering upgrading foobar ...and WineBottle it
Title: WSH Panel Mod script discussion/help
Post by: tarkus721 on 2014-10-10 15:50:56
@matav @marc2003 Just a little info.
I have foobar2000 1.2.9 (copied from existing portable Windoze install) with marc's wsh scripts running in wine 1.6.2 (winxp 32bit prefix) on Linux Mint 17 KDE 64bit. After commenting out these offending lines in common7.js:
Code: [Select]
//var vb = new ActiveXObject("ScriptControl");
//vb.Language = "VBScript";

they basically work except for downloading images from last.fm and the allmusic scripts. I have no problem with marc's last.fm playcount sync.

fake ie6 (default in wine), installed wmplite (for playing wma files).
winetricks:
gdiplus_winxp
wsh57
vb6run
corefonts

I've tried using ie8, but after installing ALL of my images will not display except for album art in DUI IIRC.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-10 16:17:02
i must admit, it has to be a few years since i last tried linux/wine. i know i've not tried it since 2012 because i haven't had decent internet since then. downloading an ISO would be impossible for me now.

if scripts based on my common7.js are working with only ie6 installed in wine, then obviously wine must have been updated so it supports the JSON parsing script that i include. perhaps matav can check to see if there are newer versions of winebottler available on his mac.

@tarkus721, both my last.fm images and allmusic scripts rely on this activex object...

Code: [Select]
new ActiveXObject("htmlfile");


if you can find out what dependency it needs with winetricks, it might be possible to get it working.

i also find columns UI is better under wine as it doesn't have as many re-draw glitches as default ui. this also might be why installing ie8 didn't cause me any problems??
Title: WSH Panel Mod script discussion/help
Post by: tarkus721 on 2014-10-10 17:24:12
if scripts based on my common7.js are working with only ie6 installed in wine, then obviously wine must have been updated so it supports the JSON parsing script that i include. perhaps matav can check to see if there are newer versions of winebottler available on his mac.

Apparently as the last.fm/wikipedia bio panel works flawlessly. The thumbs panel can display images already present in foobar2000/wsh_lastfm directory or in the custom folder, but not download them (crash: line1701: col18: new ActiveXObject ("htmlfile")). There's another wsh panel error in wine I've banged my head against a wall for: "file already exists".

Quote
i also find columns UI is better under wine as it doesn't have as many re-draw glitches as default ui. this also might be why installing ie8 didn't cause me any problems??

I'm using cui with a modded config by eXtremeHunter1972 (CaTRox). If I add ie8, there goes all of my images (wsh, esplaylist, elplaylist, simpleplaylist etc). I may try a new wine prefix to test it out.

Quote
i must admit, it has to be a few years since i last tried linux/wine. i know i've not tried it since 2012 because i haven't had decent internet since then. downloading an ISO would be impossible for me now. tongue.gif

If I may suggest; find a friend or neighbor that does have a fast connection, bring a usb stick and download that sucker...
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-10 20:41:06
...
I have no problem with marc's last.fm playcount sync.

fake ie6 (default in wine), installed wmplite (for playing wma files).
winetricks:
gdiplus_winxp
wsh57
vb6run
corefonts
Thanks!!! Got it working with just gdiplus_winxp, wsh57, msxml3 alongwith the following script modifications in common4:
Code: [Select]
//var doc = new ActiveXObject("htmlfile");
//var vb = new ActiveXObject("ScriptControl");
//vb.Language = "VBScript";

Oh... at first it gave an error when i tried to Create/Import SQL file but it worked the 2nd time.

I can love again!
\o/

@tarkus721, both my last.fm images and allmusic scripts rely on this activex object...
Code: [Select]
new ActiveXObject("htmlfile");
if you can find out what dependency it needs with winetricks, it might be possible to get it working.
As per my observation, ie6 or alike is needed.

But in my case, if i select ie6 then wsh57 goes bonkers so now I retried with with gdiplus_winxp, msxml3, wsh56js & ie6 and:
Code: [Select]
//var vb = new ActiveXObject("ScriptControl");
//vb.Language = "VBScript";
Everything is back in business!

Weird, i bet i had tried this set but maybe the script modifications were incomplete that time.
Anyways, am so glad it all works now


----
Do note that I am definitely using common4 and not common7 and it seems I absolutely need the msxml3 winetrick on my Mac.
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-10 22:07:29
... in my case, if i select ie6 then wsh57 goes bonkers so now I retried with with gdiplus_winxp, msxml3, wsh56js & ie6 and:
Code: [Select]
//var vb = new ActiveXObject("ScriptControl");
//vb.Language = "VBScript";
Everything is back in business.

Weird, i bet i had tried this set but maybe the script modifications were incomplete that time.

@marc2003, in retrospect, the wininet winetrick was causing that JSON exception else we had it nailed then!


EDIT:
Actually, I reverted to wsh57 + gdiplus_winxp + msxml3 winetricks set because ie6 really screws up things. It somehow hinders the "Create and Import SQL file" process
:/
*sigh* i'd rather take my chances with
Code: [Select]
//var doc = new ActiveXObject("htmlfile");


----
Seems like the set of winetricks that work on a Linux don't necessarily work the same on a Mac.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-10 22:37:14
so i've been providing bad advice all round. woops. 

my scripts have new system requirements: WINDOWS. 

glad you got there in the end though...
Title: WSH Panel Mod script discussion/help
Post by: matav on 2014-10-10 23:08:20
so i've been providing bad advice all round. woops. 
still... it was fun.
I was itching to experiment with wine for a long time now anyways
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-11 00:01:07
i prefer experimenting with CIDER. and no, it's not a computer related term or acronym.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-12 00:53:25
OMG, i found a bug and squished it. this is for anyone who uses the musicbrainz script.

right click panel>Update script. restart foobar when prompted.
full download here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js


Code: [Select]
7.2014-10-12.01

"Musicbrainz". A change to the MB webservices broke the artist lookup feature (for when
files are not tagged with a musicbrainz artist id). This has now been fixed.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-10-14 12:44:26
wsh_stream (wsh panel internet radio add-on for foobar2000/marc2003 scripts)

New Version now includes:



(http://i.imgur.com/b3mOifL.png)

Installation:

https://www.dropbox.com/s/jj510019d3v5g68/w...stream.rar?dl=0 (https://www.dropbox.com/s/jj510019d3v5g68/wsh_stream.rar?dl=0)



Thanks to marc2003 for his scripts & to Rolisoft for their web services.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-16 02:36:13
i just pushed out another tiny update. this time i've added a DURATION field to my Properties script. i'm sure most people have their playlist and status bar configured to show this value but it didn't seem right that it was missing from my panel.

existing users can right click>Update script.
full download here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-16 04:18:56
ooh another update. i actually have no idea how long it's been broken but i've noticed the myspace button in my Web links script does not work anymore. i can't even fix it because it looks like myspace are not giving away the link to search results. the button has now been removed.

this requires updating the script in the panel manually: https://dl.dropboxusercontent.com/u/2280132...web%20links.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples/web%20links.txt)
full download here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

files changed:
Code: [Select]
samples\web links.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-17 02:08:32
a couple more updates 

existing users can right click>Update script.
full download here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/changelog.txt)

files changed:
Code: [Select]
marc2003\common7.js


Code: [Select]
7.2014-10-17.01

"Last.fm Charts". New "Font size" option in previous update truncates some text if
font is changed to largest size. This update should fix it.

7.2014-10-16.02

"Autoplaylists", "Musicbrainz", "Last.fm Similar artists", "Last.fm Charts",
"Properties". Add new "Font size" option to the right click menu.


please report any appearance bugs as i'm too lazy to check all scripts/settings.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-17 16:36:43
Is there a way to merge the simple seekbar into your themed toolbar buttons script, marc2003?

Image below shows current settings. Would like to get the seekbar from where it is now (red arrow) to somewhere between the buttons (blue arrows and defined location - centered top to bottom w/equal spaces at the ends). My attempts have all ended in failure. Not sure it is even possible with the scripts provided so figured I'd ask before continuing on.


Image. (https://i.imgur.com/qIBOhnD.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-17 18:32:10
https://dl.dropboxusercontent.com/u/2280132...e%20seekbar.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/themed%20toolbar%20buttons%20-%20simple%20seekbar.txt)

look at the comments for how to customise colours/placement/size.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-17 19:40:00
i had just had to re-upload the above script because there was a silly re-drawing glitch in it - just a few minutes too late to edit the post... 
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-17 19:41:56
look at the comments for how to customise colours/placement/size.


Remind me to buy you a beer if you're ever in the neighborhood. 

Thank you. Works wonderfully.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-10-17 20:38:00
The new capabilities work well based on a few hours of play. marc2003, many thanks for your extremely useful scripts, diligence in maintaining and improving them and lots of scripting help for other scripts.
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-10-18 19:10:35
Hello guys, I've got some issue with one of my scripts and I don't seem to be able to solve it on my own...

The problem is with my control bar script at the bottom (http://i.imgur.com/V2WwA7Y.png) which normally functions well and doesn't produce any errors but if I start skipping through tracks rapidly (like 10 tracks in a row or so) the script sort of hangs and (which is even more weird) prevents other scripts (like album art) from updating. Another strange thing is that the buttons (on the bar itself), seek bar and even timers keep functioning as they normally are. If I restart the script (configure -> apply) everything fixes and other scripts start working properly again.

I'll provide latest version of my UI for testing:
https://www.dropbox.com/s/by322bn3m0nurkm/S...-beta1.zip?dl=0 (https://www.dropbox.com/s/by322bn3m0nurkm/StrigUI-3.0-beta1.zip?dl=0)

the script in question is located in themes\strigUI\scripts\WSH_ControlBar.js (http://pastie.org/private/rqm6wdgncteldudf9ak7a#)

This issue must be somehow connected to on_playback_starting or on_playback_new_track callbacks since it only happens when I skip through tracks rapidly, but I'm not sure...

And it's also worth a note that if I disable that bar and skip through tracks in the same manner - nothing fails, so the problem must be somewhere here.

I know it could be too much to ask (skimming through someone's code), but i'm kinda lost on this one, so any assistance would be appreciated.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-18 22:21:59
ha, i just tried it and it is hilariously awful. it certainly makes me feel a whole lot better about some of the hack jobs i share. 

looking at task manager, i'm seeing 40% cpu usage for well over half a minute. at that point i closed it because i had no idea how much longer it was going to be. 

i always try and keep an eye on resource usage so nothing like this happens. yes i've made mistakes and i've occasionally posted some bad updates but nothing quite on this scale. 

my guess it's something timer related. really there is no need to be killing them and re-creating. just create one and leave it running. this has no impact on resources so long as you're not doing anything stupid with them.
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-10-19 14:10:43
my guess it's something timer related. really there is no need to be killing them and re-creating. just create one and leave it running. this has no impact on resources so long as you're not doing anything stupid with them.

Yeah, I thought about that. Though most of the scripts I checked do that (kill timers when they are not needed) so I mimicked that
Gonna see if that helps.

edit: also I wanted to ask if SetTimeout keeps 'counting' when it expires, i.e. do I need to kill it at all or not? (logic says I don't  )
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-19 15:22:30
SetTimeout is a one time event only. you can check that out for yourself...

Code: [Select]
window.SetTimeout(function() {
    fb.trace("boo!");
}, 100);


BTW, when i said "hilariously awful" before, i was only talking about the performance issue - not the thing as a whole.   

for my seekbar scripts i just create a timer at startup and leave it alone....

Code: [Select]
window.SetInterval(function() {
    if (!fb.IsPlaying || fb.IsPaused || fb.PlaybackLength == 0) return;
    window.RepaintRect(...);
}, 150);
Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-10-20 01:01:03
BTW, when i said "hilariously awful" before, i was only talking about the performance issue - not the thing as a whole. 


Uh, something must be really wrong, I'm not seeing any performance issues with my setup 

What you said actually made me find my pretty ancient laptop (1,73 centrino, 1gb ram) and check it there with my entire library (35k-ish tracks on external drive) and I didn't see extensively high CPU usage, here's screenshot:

http://i.imgur.com/EWwisCh.png (http://i.imgur.com/EWwisCh.png) (first start right after connecting external hdd)

So I actually wonder what happened there... Foobar only uses high amount of CPU power when it re-scans library folders for me or when Track Info panel counts stats on large number of tracks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-20 01:35:11
it seems we've crossed wires. i was talking about the specific issue you reported - when you skip a load of files at once. that's what i did to cause the excessive cpu load. like you said, when you remove that one panel, the problem goes away.

when running normally, performance seems ok.

edit: this screenshot shows what's happening on the pathetic athlon64 system i'm using. it is monitoring foobar2000 only.

(https://dl.dropboxusercontent.com/u/22801321/2014/october/cpu.png)

the bit i've scribbled with green at the top is when the display/seekbar panel is empty
the blue bit is when i've added the code but playback is running normally (around 2-5%)
the red bit is after i've skipped several tracks in quick succession. 25-30% for well over a couple of minutes and i got bored of waiting. it is lower than the 40% i saw last night though.

edit: i've fixed the code for you... http://pastebin.com/4hZAA8CR (http://pastebin.com/4hZAA8CR)

in this screenshot, that little 2nd spike is what happens when i skipped a load of tracks at once. after that, it immediately settles itself.

(https://dl.dropboxusercontent.com/u/22801321/2014/october/cpu2.png)

Title: WSH Panel Mod script discussion/help
Post by: Strigoy on 2014-10-20 08:55:38
marc2003
Thanks for clarifying!
Even more so thanks for the fix you provided, it seems to work pretty smooth now. I'll be more careful with timers from now on.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-22 16:16:24
How would I declare an X coordinate for a volume slider position that's always N-increments away from the right edge? I managed to get it positioned vertically in the panel and length of slider is set, etc. But "p.w - N" doesn't behave quite the same as the playback buttons.

Pictures, because I suck at explaining stuff.

Static placement: https://i.imgur.com/NEf4klo.png (https://i.imgur.com/NEf4klo.png)

Dynamic attempt: https://i.imgur.com/MRMvyqV.png (https://i.imgur.com/MRMvyqV.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-22 17:47:32
when the value is going to be dynamic, it doesn't really matter what you put in the new volume bit at the start because that value is only temporary. you actually need to update this value inside the on_size function. at the very bottom of your screenshot, you can see where i've defined the value of s.w which is also dynamic. you just need to add a new line after it:

Code: [Select]
v.x = p.w - v.w - 11;


i noticed you've tried 11 in your attempt but you need to remember this value is the left most edge of the volume bar. it looks like you want a gap of 11 plus the width of the bar itself.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-22 18:10:03
Yeah, I was trying to ferret that 11 out. Thanks again.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-22 20:16:28
Functions seem to be fighting with each other when the whole lot is merged into one.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-22 21:01:50
they should all work together. the problem is i've never documented how to do and there are no comments either.

edit: this should work... remove all functions below on_paint and replace them with this...

Code: [Select]
function on_playback_seek() {
s.playback_seek();
}

function on_playback_stop() {
s.playback_stop();
}

function on_mouse_wheel(step) {
if (s.wheel(step)) return;
if (v.wheel(step)) return;
}

function on_volume_change(vol) {
v.volume_change(vol);
}

function on_mouse_move(x, y) {
p.move(x, y);
if (s.move(x, y)) return;
if (v.move(x, y)) return;
b.move(x, y);
}

function on_mouse_lbtn_down(x, y) {
if (s.lbtn_down(x, y)) return;
if (v.lbtn_down(x, y)) return;
}

function on_mouse_lbtn_up(x, y) {
if (s.lbtn_up(x, y)) return;
if (v.lbtn_up(x, y)) return;
b.lbtn_up(x, y);
}

and i do seem to have found a bug. tooltips are only working on the seekbar. i'll try and figure that out.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-22 21:35:38
Thanks again. Working like it should now. I kept getting conflicts with mouse button actions before.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-22 23:35:32
i did announce a few months back that i wasn't supporting my discogs script anymore. at the time it was still working so anyone who already had it and didn't run Update script could keep it working.

but the changes that i knew were coming have been done in the last week. now it won't update anymore. it may still give the appearance that it's working because it will display old cached entries just fine but you'll never see any new changes to the discogs database on it. i just thought i'd give people a heads up.

to tidy up, you can browse into your foobar profile\wsh_lastfm folder, search for and delete all discogs.json files.

as an alternative, my musicbrainz script is still supported.
Title: WSH Panel Mod script discussion/help
Post by: D.Sync on 2014-10-23 08:52:28
Hi there. Recently starting to mod my skin and started to recall programming using WSH script mod.

Is there anyway to retrieve the tags in the currently playing music such as %album%? The issue here is to change the state of the playback item such as display a darkened skip icon if %SKIP% tag value is present and is 1 in the currently playing track.

This would have been easy if it were done in panel splitter as I have experience in that. E.g. $ifequal(%skip%,1,$imagebutton(...),$imagebutton(...))
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-23 09:43:53
i don't understand. how do you expect to query a track tagged with SKIP when it's going to get um.... skipped?

if you were building some kind of playlist displaying multiple tracks then of course you could do something like that. but i doubt you're taking that on, are you? 
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-23 20:44:41
Thanks again for all your help, Marc. This will keep me busy for a while debating on which I like best for various themes. I have more questions on how one would format item properties like in EH's FooAero (http://extremehunter1972.deviantart.com/art/fooAero-DUI-v1-4-6-182948477) theme (his info tab is lovely) but I don't wanna push my luck until I look into a bit more myself. 

(http://i.imgur.com/mA2PUB3l.png) (http://imgur.com/mA2PUB3)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-26 21:43:16
@marc2003,

Made a mistake in copying some things in the initial script that baffled me until I realized what the conflict was.

eg:  var p = new panel("Themed Toolbar Buttons / Simple Seekbar / Simple Volume", ["themes","custom_background"]);

Aha! Cannot have "custom_background" in a themed element as it will not do anything in the popup menu. Since changed to "themes" only in the brackets.

So now I'm curious what controls the colors in your themed examples? I'm leaning toward something defined in the common7.js but that's just a guess.

Maybe more importantly, can these examples pull the color info from within FB2K's color options so it gels with the rest of the UI? In other words - if I set background to blue in color options it changes the theme of the toolbar to match.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-27 09:13:49
you can have a custom background with themed buttons. it's just that particular panel is hardcoded to have a background that matches your windows theme.

you can edit your panel to change this - just find the on_paint function and remove this line...

Code: [Select]
p.themed_header.DrawThemeBackground(gr, 0, -p.h, p.w, p.h * 2);


replace it with

Code: [Select]
p.draw_background(gr);


now the background will match whatever you set in the main foobar preferences. optionally you may add "custom_background" in the initial panel declaration and your popup menu should work as before.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-10-29 17:18:28
you're both right. i tried a fresh portable install and it works. i guess some option or maybe other component is interfering on my main install? 

edit: file>preferences>display>default user interface>always show notification icon is the culprit. if i turn that off, it works as expected.


Addressed in latest.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-30 10:25:30
samples updated: quite a serious bug when it comes to matching results in my allmusic review script.  oops... 

this has now been fixed, right click>Update script.

full download here: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)

this will probably be the last update for this pack as i've been messing around changing a few things for the next update.

thumbs script users wanted!

i would like some people to test my new version. i'm ditching the old wsh_lastfm folder which converted the artist name using the $crc32 function (i was incredibly lazy when i made that. ). i'm now using plain text with the correct illegal character replacement to make it work with foobar which means it easier to find/populate/delete folders.

this file needs saving in your marc2003 folder: https://dl.dropboxusercontent.com/u/2280132...2003/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common8.js)
this needs to go in your panel. all previous preferences will be lost and you'll need to set them up again: https://dl.dropboxusercontent.com/u/2280132...emp/thumbs8.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/thumbs8.txt)

if you have a big stash of artwork already saved in your wsh_lastfm folder, i've made a dirty script that will copy them into the new folder structure.

this will only work for artists in your library as i create an autoplaylist to get them all. you shouldn't even see the playlist as it gets created and then deleted automatically.

when done, a little report box should pop up telling you what it's done. there will be a new folder called wsh_data in your profile folder and inside that will be a folder named artists.

the script itself is a blank white panel and you double click to run. i have no idea how it works on large collections so you may want to backup your configuration first. it only copies files though - the originals will be left intact. download here: https://dl.dropboxusercontent.com/u/2280132...file%20copy.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common%207-8%20file%20copy.txt)
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-10-30 13:02:09
@marc2003

Tested it out as you requested and all works ok.
All Library artists artwork + musicbrainz.txt got imported to the new folder and panel works fine.

If I may submit some suggestions  since you are changing the script to wsh_data.

Make a folder structure like this to keep things tidy and separate.
wsh_data\artist\artwork
wsh_data\artist\musicbrainz
wsh_data\artist\lastfm

As to downloaded artists artwork  instead of those numeric ids from last.fm, maybe a filename scheme artist_1.png.

Modified Code:
Code: [Select]
	this.download = function() {
if (!this.folder.is_folder() || p.artist == "" || p.artist == "?") return;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var folder = this.folder;


f = fso.GetFolder(folder);
fi = f.files.Count;
p.console("Files Count:" + fi);
f.Close;


var url = this.domain + "/music/" + encodeURIComponent(p.artist) + "/+images";
var func = function() {
var text = th.xmlhttp.responsetext;
doc.open();
var div = doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("img");
var urls = [];
for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("http://userserve-ak.last.fm/serve/126s") == 0) urls.push(data[i].src.replace("126s", th.download_size == th.download_sizes.small ? "252" : th.download_size == th.download_sizes.medium ? "500" : "_"));

}
for (i = 0; i < Math.min(urls.length, th.limit, 5); i++) {



p.console(urls[i]);
var index = i + 1;
p.console(index);
var increment = (fi + index);
p.console(increment);




p.run_cmd("cscript //nologo \"" + p.script_path + "download.vbs\" \"" + urls[i] + "\" \"" + folder + p.artist.validate() + "_" + increment + "." + urls[i].substring(urls[i].lastIndexOf(".") + 1) + "\"", false);



}
doc.close();
}
this.xmlhttp.open("GET", url, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (th.xmlhttp.readyState == 4) {
if (th.xmlhttp.status == 200) {
func();
} else {
p.console("HTTP error: " + th.xmlhttp.status);
}
}
}
}


Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-10-30 16:51:25
The folder conversion script worked well for me. the foobar2000 display was nonresponsive while the conversion took place, but that was no big deal. I'll respect whatever you do marc2003, but a few thoughts:

1) Whatever character replacement you do, please either don't ever change it once you formally release the common8 approach, or please release another conversion script at the time of any character replacement change so that folder names can remain aligned with what common8 is doing with respect to character replacements.

2) While zeremy's suggestions might work for him and a few others, they will prevent me from ever adopting the common8 scripts and possibly others with many existing pictures. The redownloading of existing pictures and collisions with existing image names that will result from diverging from last.fm's image naming approach will be a pain with no benefit.  The folder location changes will trigger many personal script changes with no benefit, and also make the "open containing folder" command that much less useful.

3) Since you're making changes, it would be great if you could add the "open containing folder" option to at least the Musicbrainz, Last.fm Similar Artists, Allmusic review, and Last.fm & Wikipedia Biography scripts.

4) I would generally like to avoid downloading images when the artist is "Various Artists", "traditional", "anonymous" or similar artist strings that contain those characters. I currently mod your common7 to accomplish that, but it would be great if you could consider incorporating that in common8.

Thanks for your efforts!
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-10-30 17:55:50
One other suggestion: I've found that eliminating concatenation of this.artist to the allmusic review search string in cases where this.artist = various artists results in far better album review search successes for VA albums. I don't know why, but it is consistently much better for just this specific case. I can't address that with just the artist tf, since if I pass a blank as the artist tf to the search, the search will find the correct review but store it in the artist folder of a blank instead of "various artists" as it should per what is my actual album artist. I currently accomplish what I want with a change to common 7 as follows, so please consider something similar for VA albums review searches:
Code: [Select]
            case "allmusic":
var temp_album = p.eval(this.allmusic_album_tf);
var temp_artist = p.eval(this.allmusic_artist_tf);
if (this.album == temp_album && this.artist == temp_artist) return false;
this.artist = temp_artist;
this.album = temp_album;
this.folder = p.data_folder + p.eval("$crc32(" + this.allmusic_artist_tf + ")");
if (!p.fso.FolderExists(this.folder)) p.fso.CreateFolder(this.folder);
this.filename = this.folder + "\\Allmusic - " + p.clean_filename(this.album) + ".txt";
                fb.trace("filename sought equals  "+this.filename);
this.text = "Nothing found.";
if (p.fso.fileExists(this.filename)) {
this.text = p.open(this.filename);
} else {
                    if (this.artist == "Various Artists") {
                      this.allmusic_search = "http://www.allmusic.com/search/albums/" + encodeURIComponent(this.album);
                    } else {
  this.allmusic_search = "http://www.allmusic.com/search/albums/" + encodeURIComponent(this.album + " " + this.artist);
                    }
                    fb.trace("allmusic search string equals  "+this.allmusic_search);
this.allmusic_url = false;
this.get();
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-31 09:28:04
but a few thoughts:


1) the illegal character replacement is actually done to match what the foobar core expects in the display preferences. if you use a a component like foo_facets or esplaylist to browse the artists in your library with artist art enabled, they should pick up all the artwork saved my script. simply configure the artist art in the core options with c:\path\to\wsh_data\artists\%artist%. if foobar changes the replacement in future, i guess i'd have to update to match it and make another conversion script for existing folders.

2) absolutely. the id from last.fm will always be kept as part of the filename. i always check the file exists locally and will skip trying to download it if it already does. changing this would indeed be useless and quite frankly, irresponsible.

3) i guess i could do that.

4) you can already do this with the artist field remapping option found on the right click menu. if the artist is of zero length (or a ?) then no lookup will even be attempted.

Code: [Select]
$if($or($stricmp(%artist%,traditional),$stricmp(%artist%,anonymous)),,%artist%)


i'll address the allmusic question later. i don't have time to read/digest it now.

@zeremy, i won't be considering subfolders because i just don't see any point. you are of course free to do what you like.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-31 11:21:48
@godrick, about allmusic various artists, i already discovered this myself back in may. 

http://www.hydrogenaud.io/forums/index.php...st&p=866515 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=866515)

as i could only verify the benefit on a single album, i just left it as it was. i'll definitely add it into the new script.

i'll probably upload a whole new pack of scripts over the weekend for testing. i'm sure there is something glaring in there that i will have missed.


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-10-31 19:42:28
typo in post #3243 - i forgot to include filename wildcards in the path...

Quote
simply configure the artist art in the core options with c:\path\to\wsh_data\artists\%artist%\*.*
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-01 16:03:39
I just discovered that about 33% of my images did not come over to the new directory, and about 22% of .txt files did not come over. I'm baffled as to why: the popup summary didn't show any failures or find any existing files (nor should it have). The reported tracks in my library was accurate, but the artist count is not the same as what foobar2000 reports. Yesterday I assumed that the artist count mismatch was a result of having artists with no images (of which I have many), but in looking at the script I think it should report the same number of artists as my facets column. I looked over the script and don't see anything that jumps out as a problem, keeping in mind I'm a script amateur.  Of the artists that are missing images and folders, the artist names do not have unusual characters, nor can I find any pattern to the misses. From what I can tell, the script seemed to skip an entire artist folder when it missed something, as opposed to just bringing over some of the images in an artist folder.

My gut tells me there is something different I need to do with the artist tf - I have lots of albums with multiple artists - but I'm not sure what else to try since $meta_branch(artist) and %<artist>% are both unrecognized by the script.

Suggestions appreciated!
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-01 16:39:49
I just discovered that about 33% of my images did not come over to the new directory, and about 22% of .txt files did not come over. I'm baffled as to why: the popup summary didn't show any failures or find any existing files (nor should it have). The reported tracks in my library was accurate, but the artist count is not the same as what foobar2000 reports. Yesterday I assumed that the artist count mismatch was a result of having artists with no images (of which I have many), but in looking at the script I think it should report the same number of artists as my facets column. I looked over the script and don't see anything that jumps out as a problem, keeping in mind I'm a script amateur.  Of the artists that are missing images and folders, the artist names do not have unusual characters, nor can I find any pattern to the misses. From what I can tell, the script seemed to skip an entire artist folder when it missed something, as opposed to just bringing over some of the images in an artist folder.

My gut tells me there is something different I need to do with the artist tf - I have lots of albums with multiple artists - but I'm not sure what else to try since $meta_branch(artist) and %<artist>% are both unrecognized by the script.

Suggestions appreciated!

Here's a vbs script that will analyze any folder contents , and export it to a excel file.
You can run it on wsh_lastfm , and then on wsh_data and compare them (sort by size)  to  try to identify what is missed during the migration.

Save code as folder2excel.vbs

Code: [Select]
If (WScript.Arguments.Count <> 1) Then
WScript.Quit
End If

wsh_folder = WScript.Arguments(0)

Dim oFS, oFolder
Dim objExcel, r, lnameArray, lname, nameLength
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
set oFolder = oFS.GetFolder(wsh_folder)

Set objExcel = createobject("Excel.application") 
objExcel.Visible = True
objExcel.Workbooks.add

'Sheet1
Set objWorksheet = objExcel.Worksheets("Sheet1")
objWorksheet.Activate
objWorksheet.Name = "Folder Sizes"

objExcel.Cells(1, 1).Value = "Folder Name"
objExcel.Cells(1, 2).Value = "Size (bytes)"
objExcel.Cells(1, 3).Value = "Size (KB)"
objExcel.Cells(1, 4).Value = "Size (MB)"
objExcel.Cells(1, 5).Value = "# Files"
objExcel.Cells(1, 6).Value = "# Sub Folders"
objExcel.Cells(1, 7).Value = "DateCreated"
objExcel.Cells(1, 8).Value = "Last Accessed"
objExcel.Cells(1, 9).Value = "Last Modified"
objExcel.Cells(1, 10).Value = "Path"

Set objRange = objExcel.Worksheets.Item(1).UsedRange
objRange.Font.Size = 12
objRange.Interior.ColorIndex = 36
objRange.Autofilter
Wscript.Sleep 300
r=2

ShowFolderDetails oFolder, r

objExcel.Columns(1).AutoFit()
objExcel.Columns(2).AutoFit()    
objExcel.Columns(3).AutoFit()
objExcel.Columns(4).AutoFit()
objExcel.Columns(5).AutoFit()
objExcel.Columns(6).AutoFit()
objExcel.Columns(7).AutoFit()
objExcel.Columns(8).AutoFit()
objExcel.Columns(9).AutoFit()
objExcel.Columns(10).AutoFit()

Set objRange2 = objExcel.Range("A1")
objRange2.Range("A2").Select
objExcel.ActiveWindow.FreezePanes = "True"

'Sheet2
Set objWorksheet = objExcel.Worksheets("Sheet2")
objWorksheet.Activate
objWorksheet.Name = "Files List"

objExcel.Cells(1, 1).Value = "File Name"
objExcel.Cells(1, 2).Value = "File Path"

Set objRange = objExcel.Worksheets.Item(2).UsedRange
objRange.Font.Size = 12
objRange.Interior.ColorIndex = 36
Wscript.Sleep 300
r=2

GetFiles(wsh_folder)

objExcel.Columns(1).AutoFit()
objExcel.Columns(2).AutoFit()

'Sheet3
Set objWorksheet = objExcel.Worksheets("Sheet3")
objWorksheet.Activate
objWorksheet.Delete


'Return to Sheet1
Set objWorksheet = objExcel.Worksheets("Folder Sizes")
objWorksheet.Activate



Function ShowFolderDetails(oF,r)
    Dim F
    objExcel.Cells(r, 1).Value = oF.Name
objExcel.Cells(r, 2).Value = oF.Size
objExcel.Cells(r, 3).Value = Round(oF.Size /1024)
objExcel.Cells(r, 4).Value = Round(((oF.Size /1024)/1024),2)
objExcel.Cells(r, 5).Value =  oF.Files.Count
objExcel.Cells(r, 6).Value =  oF.Subfolders.count
objExcel.Cells(r, 7).Value =  oF.DateCreated
    objExcel.Cells(r, 8).Value =  oF.DateLastAccessed
objExcel.Cells(r, 9).Value =  oF.DateLastModified
objExcel.Cells(r, 10).Value =  oF.Path
r = r+1
    for each F in oF.Subfolders
        ShowFolderDetails F, r
    next
End Function


Function GetFiles(FolderName)
On Error Resume Next

Dim ObjFolder
Dim ObjSubFolders
Dim ObjSubFolder
Dim ObjFiles
Dim ObjFile
Set ObjFolder = oFS.GetFolder(FolderName)
Set ObjFiles = ObjFolder.Files


For Each ObjFile In ObjFiles

objExcel.Cells(r, 1).Value = ObjFile.Name
objExcel.Cells(r, 2).Value = ObjFile.Path
r = r+1

Next

Set ObjSubFolders = ObjFolder.SubFolders

For Each ObjFolder In ObjSubFolders

GetFiles(ObjFolder.Path)

Next
End Function



From cmd line run: cscript //NOLOGO folder2excel.vbs "add_folder_path_here"


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-01 20:53:45
The reported tracks in my library was accurate, but the artist count is not the same as what foobar2000 reports.


i don't have anyway to determine the artist from the old folder name which is why my script creates an autoplaylist of everything in your library. it then force sorts that playlist, loops through it and skips trying to do anything if the artist of the current track is the same as the previous. when a new artist is found, the counter increments by 1. i cannot explain why there would be any kind of mismatch here??

possible reasons for my script not detecting the old folders are as follows:

-you used artist field remapping on the old script. you can edit %artist% on line 1 to account for this. the default title formatting for the allmusic review script is actually %album artist% so that might account for a few folders. you'd have to edit the script and run it again.
-folders were created by the old script playing artists that are not in your library. this could include streams.
-the biggest flaw in my old script was that it was case sensitive....  if you've edited the artist tags during the use of the old script, new folders would have been created leaving the old ones obsolete.

Quote
I have lots of albums with multiple artists


albums are irrelevant. i'm only looking at the artist - or rather the title formatting defined on line 1.

all tracks in my library have a single value for the artist but i did a quick test with a multi value tag and it works as expected. i loaded up the old script, let it create the folder and dumped a load of files in it. the conversion script copied the files into a new folder where the artists were separated with a comma. however, the presence of multi value tags is unlikely to ever find anything online which is why i provided the artist field remapping option. you can use things like $meta(artist,0) to get the first value...
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-01 21:35:26
Yup, that's what I'm doing right now - using the artist tf capability you created in the copy script so that I can iterate through the different multivalues using $meta(artist,n) and changing n with each run and then merging directories. I'm getting it done with little pain at this point - computer time is cheap!  Once I'm done with those, then dealing with any case-sensitive issues will be easy to deal with manually, so thanks for that tip.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-01 23:27:28
i've made a slightly more risky version of the copy script. only try this on a COPY of your wsh_lastfm folder.

this one actually deletes the original folders of any artists that exist in your library (after copying the files). when done, at least you may have a clearer idea of what to do with the remaining folders.

https://dl.dropboxusercontent.com/u/2280132...emp/godrick.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/godrick.txt)
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2014-11-02 04:02:21
Hi Marc,

I try to modify your "Themed Toolbar Buttons" script to switch between my audio card and headphones. I have two buttons for that:

Code: [Select]
b12: new button(p.w - (bw * 6) - 36, 5, bw, bh, {normal: "audio-card.png"}, function() { fb.RunMainMenuCommand("Playback/Device/M-Audio Delta AP Multi"); }, "Audiocard", true),
b13: new button(p.w - (bw * 5) - 37, 5, bw, bh, {normal: "headphones.png"}, function() { fb.RunMainMenuCommand("Playback/Device/USB Audio CODEC"); }, "Headphones", true),


Sadly it doesn't work. Could you give me a hint what to do?

Here is a screenshot of the device menu:

[a href="http://abload.de/image.php?img=fb2k_devicesf6u2f.png" target="_blank"]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-02 05:54:58
as i don't have your hardware, i tested 2 buttons on my layout with these commands and they work fine.

Code: [Select]
fb.RunMainMenuCommand("Playback/Device/Null Output");
fb.RunMainMenuCommand("Playback/Device/Primary Sound Driver");


presumably the menu and keyboard shortcuts work?? i can't explain why they're not working from the button.    it looks like you've typed in everything correctly.
Title: WSH Panel Mod script discussion/help
Post by: Bollerkopp on 2014-11-02 06:19:43
Yes, the menu and keyboard shortcuts work.

If I change "USB Audio CODEC" to "Null Output", I can switch between "M-Audio Delta AP Multi" and "Null Output" without problems. There seems a problem with the "USB Audio CODEC" name. This thing is a cheap "BEHRINGER U-CONTROL UCA 202".
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-02 06:40:53
can you check under the keyboard shortcut preferences that it appears with the same name?? i have vague recollections of DSP chains not working from a button and when i checked the keyboard shortcuts it appeared as something like DSP #1 instead of its given name. changing the script to that made it work.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-02 06:59:33
The delete script was helpful in narrowing down problems. Still trying to convert everything, but it seems most problems remaining are:
1) artist images from streams (I guess I'll just lose those if I don't convert them manually)
2) artist images with an apostrophe and their associated album reviews (artists with ctrl 0146 character) - I don't want to lose those. It appears that a new folder was created, but with an altered name (prime mark instead of ctrl 0146 character)

Any suggestions especially on #2 are appreciated.

FWIW, for artists with nonenglish letters (grave accents, umlauts and the like), a new folder was created with the correct letters and images were moved, but reviews were copied. I just deleted the leftover reviews manually.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-02 07:41:13
i don't think i can do much about number 1. i guess the images inside are named after the artist so that might help you if you decide to do some manually.

edit: thinking about it, i suppose it would be possible to loop through folders and try and parse the filename upto the first underscore and use that to create the new folder.

as for 2, i can't reproduce that. all my artists are tagged with the "wrong" apostrophe on my keyboard but i did a quick test with the typographically correct one and it works as expected. it's a legal character for filenames and the foobar title formatting function isn't doing anything weird with it either.

i just noticed you edited your post...

Quote
It appears that a new folder was created, but with an altered name (prime mark instead of ctrl 0146 character)


that's not happening here. the folder is created use the exact characters from the artist tag. the first folder here was created by my copy script. i'm now using the properties dialog>artist to try and create a new folder manually...

(https://dl.dropboxusercontent.com/u/22801321/2014/november/apostrophe.png)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-02 07:49:18
The looping through method as a separate little script sounds like an efficient way to deal with leftovers like streamed artists as well as the apostrophe artists, and I can just move the reviews manually as a last step. I edited problem 2 after your last response that clarifies the issue, but in any case a looping script would probably solve it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-02 08:20:11
Quote
but in any case a looping script would probably solve it.


no it wouldn't. the copy script uses the same method for naming folders as the new scripts. IF characters get changed then they will be ignored and new folders will be created. but if you see my edit with screenshot above, i just don't see how that could happen. 

i've also thought again about creating new folders based on the filenames of what's inside. i'm willing to give it a try but if the files inside the folders were created by very old versions of my script that used art.exe to download files, they will be useless because the illegal character substitution is different. it replaces everything with a hyphen (-). as i mentioned before, mine uses the characters that foobar expects and does the following:

/\|: get replaced with -
* gets replaced with x
" gets replaced with ''
<> get replaced with _
? is stripped completely
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-02 11:12:51
@godrick, i've had a bash at making something that will create new folders based on the filename inside the old folder.

again i'd be working on a copy of the wsh_lastfm folder preferably after running the script that deletes folders that exist for artists in your library.

first download this into the root of your wsh_lastfm folder

https://dl.dropboxusercontent.com/u/2280132.../clean%20up.cmd (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/clean%20up.cmd)

double click to run and it will remove all json files and empty folders.

now add this new script into a panel. again it's blank white and you double click to run. it actually creates a temp folder in your profile directory. this is so you can inspect the folder names before merging the results into your "good" wsh_data folder.

it simply finds the first image in a folder that contains an underscore and uses the characters before it for the new name.

https://dl.dropboxusercontent.com/u/2280132...mp/godrick2.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/godrick2.txt)
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2014-11-02 11:24:03
? is stripped completely

Although it always seems difficult to find definitive information, I thought the foobar2000 hardcoded substitution was to replace ? with _

e.g. see http://www.hydrogenaud.io/forums/index.php...st&p=635843 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=71931&view=findpost&p=635843)

http://wiki.hydrogenaud.io/index.php?title...ions#Usage_Tips (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:File_operations#Usage_Tips)

Although the latter link is for the file operations component, I believe Frank Bicking has said somewhere that the album art viewer uses the same scheme.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-02 11:39:36
it would seem those references are outdated...

(https://dl.dropboxusercontent.com/u/22801321/2014/november/rename.png)

Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-02 20:08:41
marc2003, he additional scripts were very helpful - I've gotten everything converted. But in testing, I have a few problems for which I don't have solutions yet:

1) AC/DC images are not recognized in my scripts, but they are in yours. The artist folder name has what seems to be the correct string: AC-DC (reflecting the character substitution as discussed above) when the artist field is AC/DC. But no joy in my script displays.

2) Artists with double quotes in their names also do not display in my scripts, but again display in thumbs8. The artist folder names again appear correct in that the double quotes have been replaced with double primes.


My scripts currently use lines like the following to evaluate the artist value:
Code: [Select]
fb.TitleFormat("$meta(artist,0)").Eval()

It seems the way I evaluate tag field values is the issue.  Is there a better or different way to evaluate to try? I looked at the thumbs section of common8, but I've never gotten up to speed on how to use objects with "this" constructs.

Thanks again for the help!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-03 00:07:33
the filenames are purely cosmetic. the script will load all images in a given folder regardless of how they are named. the important bit is how you determine the folder name where they live. if you check inside the common8 file, it's the code on line 1451.

Code: [Select]
this.folder = p.new_artist_folder(p.artist_tf);


p.new_artist_folder is a function shared by all my other scripts and this is the code that does the work....

Code: [Select]
    this.new_artist_folder = function(tf) {
        return this.artists_folder + this.eval(tf).validate() + "\\";
    }


this.artists_folder will resolve to your profile path\wsh_data\artists.
tf is the title formatting usually defined by using the artist field remapping option (default is %artist%)
this.eval is my fb.TitleFormat function and finally, validate() does the illegal character replacement.

because i provide the artist field remapping option, you could just right click the panel and put $meta(artist,0) in there and not edit the script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-03 04:39:37
@godrick and any other gluttons for punishment... here are the rest of my scripts updated to use the new folder naming scheme. there is no readme so it is assumed you already are a user of my previous scripts

https://dl.dropboxusercontent.com/u/2280132...amples8beta.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8beta.zip)

you must download the zip and extract the contents of the marc2003 folder into your foobar profile folder. it contains a new images folder rendering the old images folder inside obsolete. i've now split them into subfolders making them easier to manage/replace.

first of all, i must say there is no compelling reason for people to update. there is nothing new. i've done this out of boredom more than anything else. these scripts will run side by side with my old scripts just fine as they are independent of each other.

there are some minor changes which i will list here:
-any scripts that fetch info online will no longer use the wsh_lastfm folder to cache data. instead, a new folder named wsh_data will be created. inside that will be an artists folder and inside that, each artist will have its own folder which is actually readable - rather than using the $crc32 function which generated folders with a bunch of random numbers.
-new scripts will not pick up your old settings so will need to be re-configured using the right click menu. exceptions to this rule are autoplaylist queries and last.fm user credentials which are stored in files.
-when no info is found online, the panel will remain blank instead of displaying text saying nothing was found.
-artreader / cd jewel case will open the art in your default image viewer when double clicked. the previous version opened the containing folder. there is a new option on the right click menu should you want the old behaviour.
-playcount sync / rating have new images
-allmusic review will display a bit more info in the console about what it's doing. i found it's quite common for some albums to have pages on the website but no review. this just lets you know.
-web links and now playing have been removed. if enough people cry about it, i may consider doing something new.
-spectrogram seekbar now uses a different file naming scheme meaning all previous images are useless. the old cache folder can be deleted to save space. this uses a new pattern which ignores the first 3 letters of the path. this means it won't rescan files when the drive letters have changed. the script will also warn you if ffmpeg and/or sox are missing.
-all scripts that fetch info online now have an open containing folder option on the right click menu taking you to the cached file.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-03 13:49:39
Got the pictures transferred - the tips on validation were the missing thing for me and I didn't get it until your last post on the topic. Thanks!

The new scripts seem to work well so far, with one exception: inexplicably, some artist bios are not picked up that are definitely there on the last.fm and wiki websites, and appear in my old config. Since I started over with no json files, the new script should be acquiring new bios and writing new json files for these, but about 10% of the time the script fails to find a bio. Examples: Aimee Mann, Robert Plant, Fiona Apple. The new script is using the same default artist tf as the old script on the same music files, and even for the artists with missing bios the similar artists, links and releases are successfully found and create new jsons.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-03 14:17:11
all those artists work fine for me so they definitely should be downloaded. the bio actually comes from the most restrictive of the web services i use (the echonest). we have a limit of 120 requests per minute shared by all users of my script. if that limit is hit, there should be an error in the console.

there will usually be a cached file generated even if the artist does not exist on their site. it's named lastfm_wiki.json in the artist folder. i spammed it with my username and to my amazement, i'm not on there...

if you open the file in notepad...

Code: [Select]
{"response": {"status": {"version": "4.2", "code": 5, "message": "The Identifier specified does not exist"}}}


and even for the artists with missing bios the similar artists, links and releases are successfully found and create new jsons.


these all use different websites. similar artists comes from lastfm and releases/links come from musicbrainz. news-reviews-blogs is the only other script to use the echonest.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-03 14:34:17
I was still spamming my console from yesterday's efforts so any message rolled off before I could look. But after waiting a few minutes and seeing your message, the missing bios now appear. It was likely the request limit. thanks again!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-04 11:00:25
i've updated the beta zip from a few posts up.

https://dl.dropboxusercontent.com/u/2280132...amples8beta.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8beta.zip)

there have been complete changes to how my buttons scripts work. i've edited several scripts to accommodate this.

if you modify scripts to add/replace buttons, changes are detailed below:

old versions expected stop.png and stop_h.png to live in the marc2003\images folder.

Code: [Select]
b.buttons.stop = new button(0, 0, 32, 32, {normal: "stop.png", hover: "stop_h.png"}, function() { fb.Stop(); }, "Stop");


now you must supply a gdi.Image object. just create these once at the beginning of your panel script, not inside any function.

Code: [Select]
var stop_btn = gdi.Image(fb.ProfilePath + "my_theme\\images\\stop.png");


then when creating a new button, you do it like this...
Code: [Select]
b.buttons.stop = new button(0, 0, 32, 32, {normal: stop_btn", hover: stop_h_btn}, function() { fb.Stop(); }, "Stop");


files changed:
Code: [Select]
marc2003\common8.js
samples8\autoplaylists.txt
samples8\playback buttons.txt
samples8\playcount sync.txt
samples8\rating.txt
samples8\themed toolbar buttons.txt


i've actually completely removed the add button from the autoplaylists script. you now right click and use the menu.

the reason i've made these changes is because i'd really like to discourage people from editing the main file, especially if you're going to share it. you can customise pretty much anything by creating your own custom code in the panel. this means you can still use the Update script feature to get bug fixes but not worry about overwriting any changes that you want to make. obviously it's not easy because i still haven't commented anything but if you do want to make your own customisations, then just ask.

edit: i've actually posted a bug fix for my old scripts as well. autoplaylists would have a blank entry when starting a fresh panel with no save file present. that went unnoticed for a long old time.  just right click panel>Update script.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-04 13:32:02
In  both the version from yesterday and the version downloaded today, hitting the "update script" menu item returns "Unexpected error. Not updating"
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-04 18:02:53
oh balls, thanks for spotting that. this should fix it but obviously you'll need to save it manually...

https://dl.dropboxusercontent.com/u/2280132...2003/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common8.js)

Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-11-06 13:44:44
oh balls, thanks for spotting that. this should fix it but obviously you'll need to save it manually...

https://dl.dropboxusercontent.com/u/2280132...2003/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common8.js)

can you please update the now playing panel as well,
and if could add the a lastFm "Love" button and playback buttons into that it would be perfect.
And what is the editor that you use to write these scripts? , Is there any documentation for wsh scripts and panel stack splitter that can be added for a IDE??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-06 19:36:57
i have to say the chances of me making a new panel are slim. instead, i'll write a tutorial explaining how people can include multiple elements in the same panel. it's really quite easy so long as you understand simple concepts of positioning stuff with x,y, w and h. hopefully someone a bit more creative than me can make something nice looking.

as for editing, i just use notepad++. because i have one big file, i have auto-complete available for everything that already exists in it so that saves a bit of time.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-06 22:59:33
i've now decided to take samples8 out of beta. i've put up a basic setup guide online. it can be read here (http://marc2003.x10host.com/?p=setup). the site needs a lot more work before it's done. 

the download will still be hosted on dropbox but it has a slightly different name

https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-07 01:19:50
marc2003, your helpfulness in scripting and the capability of your scripts are simply outstanding. Many thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-07 08:28:13
thanks for the kind words.... and thanks for helping with the testing. i hope to make a more user friendly version of the folder renaming script at some point today. i really should have done that first.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-11-08 12:56:07
i've now decided to take samples8 out of beta. i've put up a basic setup guide online. it can be read here (http://marc2003.x10host.com/?p=setup). the site needs a lot more work before it's done. 

the download will still be hosted on dropbox but it has a slightly different name

https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

This is awesome.Looking forward to some tutorials in editing wsh scripts.
And thanks for all the effort you have put to foobar a more feature full player! 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-08 13:48:50
i'm updating the webpage (http://marc2003.x10host.com/intro) with notes for all scripts today - including screenshots. i'm about half way at the moment.

then tomorrow, i'll have to start on the customisation guide.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-09 21:59:07
@samithaj, i've started the customisation guide with a couple of basics but i've not done the bit about merging multiple scripts yet. i'll do that in the next day or 2.

click (http://marc2003.x10host.com/customisation)
Title: WSH Panel Mod script discussion/help
Post by: orbtwin on 2014-11-10 13:00:43
it's possible to automatic retrieve artist pictures from last.fm in the biography view (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=70955&view=findpost&p=879844) plugin like the script (http://marc2003.x10host.com/thumbs)provided by marc2003 ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 13:05:39
i'd recommend ditching the biography component but then i would say that.

but IIRC, it has options to permanently save the files with a path you specify. look around in the server options.
Title: WSH Panel Mod script discussion/help
Post by: Daeron on 2014-11-10 13:05:44
it's possible to automatic retrieve artist pictures from last.fm in the biography view (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=70955&view=findpost&p=879844) plugin like the script (http://marc2003.x10host.com/thumbs)provided by marc2003 ?

Yes.
Title: WSH Panel Mod script discussion/help
Post by: orbtwin on 2014-11-10 13:20:58
it's possible to automatic retrieve artist pictures from last.fm in the biography view (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=70955&view=findpost&p=879844) plugin like the script (http://marc2003.x10host.com/thumbs)provided by marc2003 ?

Yes.



Well...that's the point...i've checked all the options for the plugin...and only found an option to save "manually" artist picture in *.png. for this extension it's valid to accomodate my code into trackinofmod. But i don't see the "automatic" mode.
I'm using a portable installation of foobar2000 in c:// and my database are in shared folder in my other PC-server in my LAN....
thanks!...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 13:28:58
file>preferences>tools>biography server>artist tab. specify path in the image box and it works automatically??

you can't change the extension because the component saves the file as-is. you'll have to account for this with multiple $if $fileexists statements in your info panel. (or you might look to see if it supports wildcards - i have no idea)

edit: that biography view component is weird. when i play a new artist, it displays the image for the previous one?? if it takes time to download a new one, i'd rather see a blank panel than the wrong image.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-11-10 18:00:54
@samithaj, i've started the customisation guide with a couple of basics but i've not done the bit about merging multiple scripts yet. i'll do that in the next day or 2.

click (http://marc2003.x10host.com/customisation)

Thank you @marc2003  It's really helpful !!
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-10 19:36:23
@samithaj, i've started the customisation guide with a couple of basics but i've not done the bit about merging multiple scripts yet. i'll do that in the next day or 2.

click (http://marc2003.x10host.com/customisation)

@marc2003
I'm trying use your migrate.txt script to move my old thumbs to the new method. I had over 6GB of folders and files to migrate.
It seemed to work.  But I got the following messages.  I'm trying to understand what they mean. Please help?

Folders without image/txt files deleted: 1147  [I'm assume these are empty folders where last.fm failed to provide an artist photo?]
Folders without image/txt files not deleted due to errors: 0

Folders with image/txt files to keep: 9192

Of those folders to keep, 7425 were matched against artists in your library and moved successfully.
There were 874 errors moving folders for artists in your library.  [What does this mean?  And what should I do now to fix/change this?]

There are 1767 folder(s) remaining that don't match artists in your library.  [What does this mean?  Artists with different names spellings/changes/deleted songs/or what?

Also - What happened to the nowplaying.txt it's not in the samples8 folder? It was my main window, so now after the move I have a big Aw crashed!  I wouldn't have migrated if I'd know it was missing. Is this a mistake or has it been replace by another script?

P.S. I backed up my old folders in case I need to redo this process.
Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 20:11:01
6GB? **** me. foobar must have ground to a halt when you ran that? 

Quote
Folders without image/txt files deleted: 1147 [I'm assume these are empty folders where last.fm failed to provide an artist photo?]


yep.

Quote
Of those folders to keep, 7425 were matched against artists in your library and moved successfully.


this is good!

Quote
There were 874 errors moving folders for artists in your library.


this is not so good. have you tried running it again just to see if the same number fail? i'll post another version in a bit that will give more detailed logging information so i can investigate it.

Quote
There are 1767 folder(s) remaining that don't match artists in your library. [What does this mean? Artists with different names spellings/changes/deleted songs/or what?


all these folders were generated by you playing artists that don't exist in your library. i do have another script that attempts to work around that, i'll post it up in a bit.





Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-10 20:11:39
This is just a heads-up to anyone using marc2003 migrate.txt script to change artists info to the new method.

Some of my other foobar panels stopped showing artist info after the migration.
After much searching, I found that in the Preferences>Display>Album Art
I had a search pattern. C:\Users\....\AppData\Roaming\foobar2000\wsh_lastfm\$crc32(%artist%)\*.*

Since this folder path is no longer used it must be changed to
C:\Users\....\AppData\Roaming\foobar2000\wsh_data\artists\%artist%\*.*
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 20:18:24
there is a note about that on this page (http://marc2003.x10host.com/thumbs).
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-10 20:27:21
6GB? **** me. foobar must have ground to a halt when you ran that? 

Quote
Folders without image/txt files deleted: 1147 [I'm assume these are empty folders where last.fm failed to provide an artist photo?]


yep.

Quote
Of those folders to keep, 7425 were matched against artists in your library and moved successfully.


this is good!

Quote
There were 874 errors moving folders for artists in your library.


this is not so good. have you tried running it again just to see if the same number fail? i'll post another version in a bit that will give more detailed logging information so i can investigate it.

Quote
There are 1767 folder(s) remaining that don't match artists in your library. [What does this mean? Artists with different names spellings/changes/deleted songs/or what?


all these folders were generated by you playing artists that don't exist in your library. i do have another script that attempts to work around that, i'll post it up in a bit.


@marc2003
Thanks for the quick reply.

Yes, foobar did come to stop while it ran the script :-)

Which brings up a suggestion. When I double-clicked the panel to start it did nothing. It'd be nice if a pop-up (or something) indicating the script had actually started running. I ended up double-clicking 3 or 4 times because I couldn't tell anything had happened. Eventually foobar froze and I guessed it was processing the migration.

Thanks for explaining the errors. I'm still not sure what the "1767 remaining that don't match" means? How can i play files not in my library? My library monitors my entire hard drive for new mp3's. Do you mean, that the CRC coded folder was generated and then the artist name got changed or deleted later?

I'll run it again on the remaining folders and let you know the results. I wasn't sure if you could repeat a migration like that?

UPDATE.
I got the same result.

Folders with image/txt files to keep: 1767

Of those folders to keep, 0 were matched against artists in your library and moved successfully.
There were 874 errors moving folders for artists in your library.

There are 1767 folder(s) remaining that don't match artists in your library.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 20:32:18
oops, i really do need to protect against people double clicking multiple times. i agree some sort of message would help as well. i'll get on it.

Do you mean, that the CRC coded folder was generated and then the artist name got changed or deleted later?


yup, that's a possibility.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-10 20:39:55
there is a note about that on this page (http://marc2003.x10host.com/thumbs).

Ok. That's what I get for not reading the fine print. Would have saved me a lot of time.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-10 20:44:51
Breaking this out so its not lost in migrate.txt thread.

What happened to the nowplaying.txt it's not in the samples8 folder?
It was my main window, so now after the move I have a big Aw crashed! I wouldn't have migrated if I'd know it was missing. Is this a mistake or has it been replace by another script?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 20:45:48
Folders with image/txt files to keep: 1767
There were 874 errors moving folders for artists in your library.
There are 1767 folder(s) remaining that don't match artists in your library.


ah that's a bug.    of course i should subtract any artists in library errors from the total folders left. you actually have 893 folders that aren't matched to your library.

i'll see what i can do about the now playing script. i really was planning not to support it because it was one big ugly hack. if i clean it up, i might post it in a few days. i'll add it to my ever increasing list of things to do.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 21:13:19
@hurricane, try this in your panel... https://dl.dropboxusercontent.com/u/2280132...emp/migrate.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/migrate.txt)

any errors should be reported in the foobar console. i don't need to see them all - just a few will do.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-10 22:13:27
@hurricane, try this in your panel... https://dl.dropboxusercontent.com/u/2280132...emp/migrate.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/migrate.txt)

any errors should be reported in the foobar console. i don't need to see them all - just a few will do.


@marc2003
Results using your latest migrate.txt script. Progress! Some hundreds more were moved over. And the new 'be patient' message is great!

Folders without image/txt files deleted: 0
Folders without image/txt files not deleted due to errors: 0

Folders with image/txt files to keep: 1767

Of those folders to keep, 488 were matched against artists in your library and moved successfully.
There were 169 errors moving folders for artists in your library.

There are 1110 folder(s) remaining that don't match artists in your library.

Here are the console errors. They are all the same thing 'path not found' so I only copied a few.
Migrate: Error: Path not found
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_lastfm\3052812039
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_data\artists\Cutting Crew 
Migrate: Error: Path not found
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_lastfm\3373205482
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_data\artists\Cypress Hill 
Migrate: Error: Path not found
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_lastfm\1592663918
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_data\artists\David Grant & Jaki Graham 
....
Migrate: Error: Path not found
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_lastfm\1643774920
Migrate: C:\Users\Andy\AppData\Roaming\foobar2000\wsh_data\artists\Whitney Houston

@marc2003

I did some checking on the folders that did not migrate. Here's some examples.

Case 1: Is your migrate.txt script case-sensitive?
Cece Winans did not migrate. She actually spells her name CeCe Winans with upper and lower case letters. So at some point in the past, I went through and mass renamed all her files in my library from Cece to CeCe. So there is no artist with the lower-case spelling left in my library. I guess that's why it didn't migrate.

I did get another folder with all the CeCe Winans photos that did migrate ok.

Case 2: Extra spaces in names. (this one is probably 80% of what i found)
Artists have extra space(s) before or between or after their names did not get migrated. Again this probably because I occasionally run a script that corrects spacing errors in mp3 tags with MP3TAG.
So the old folders are gone from my library and did not migrate.

Case 3: Bad ID3 tags.
There were a number of folders/files with ID3 tags which had incorrect artist info. A typical example is where the song title and artist are put together into the artist tag.  Again after I correcting these tags, the migrate script would not move the old folder. So that's good.

So bottomline, it looks like in most cases, I'm not actually missing any folders or files in the migration. Just old junk.
BUT there are few, that I can't figure out why they didn't migrate? All the tags and names look good.
In any case when I play them in foobar now, new artist photos are downloaded so it's not a big deal. And probably not worth the effort to troubleshoot.

Hope this helps with your script.
Title: WSH Panel Mod script discussion/help
Post by: orbtwin on 2014-11-10 22:26:56
file>preferences>tools>biography server>artist tab. specify path in the image box and it works automatically??

you can't change the extension because the component saves the file as-is. you'll have to account for this with multiple $if $fileexists statements in your info panel. (or you might look to see if it supports wildcards - i have no idea)

edit: that biography view component is weird. when i play a new artist, it displays the image for the previous one?? if it takes time to download a new one, i'd rather see a blank panel than the wrong image.




Finally i managed to work...see picture1 (https://drive.google.com/open?id=0B2vZ6lUhEr87QUMwM0dQNXpzLTg&authuser=0) and picture2 (https://drive.google.com/open?id=0B2vZ6lUhEr87bllIRE9LUmJ4eWM&authuser=0)

i can refine a bit the configuration to "write" in lowercase the name of the artists. the artists pictures are displayed correctly in the trackinfomod ...but sometimes last.fm and the biography view saves pictures in *.jpg and many sometimes in *.png. And i don't know to tweak my code to show both types of files...

Code: [Select]
//Artists Pictures
$puts(pos.horizon2,$muldiv(%_height%,4,7))
$puts(pos.shadow2,100)
$puts(pos.artx2,$sub($div(%_width%,2),868))
$puts(pos.arty2,$sub($get(pos.horizon2),167))
$puts(path.noartist,/images/cui/noartist.png)
$puts(path.artistPath,$if($fileexists(Z:\artists pictures\%artist%.jpg),Z:\artists pictures\%artist%.jpg,$get(path.noartist)))
$puts(text.noartist,no picture)
$puts(text.artist,$if($fileexists(Z:\artists pictures\%artist%.jpg),%artist%,$get(text.noartist)))


there sometype of *.bat file to "auto-convert" newly adde files in the folder into *.jpg ??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 22:58:40
Case 1: Is your migrate.txt script case-sensitive?

not the migrate script but unfortunately the old thumbs/now playing script was. every time you changed the case of an artist tag, a new folder would have been created because i used the $crc32 function without using $upper or $lower. now i'm using actual artist names, it's no longer an issue.

the fact my updated script found more folders to move successfully does indicate that you still have lots of artists in library tagged with different cases. the reason the migrate script failed before is because the "move" folder function i used doesn't work when the new folder already exists. i changed it to "copy" instead and that's why we got better results.

edit: you might try foo_facets. that actually lists the same artists with different case separately. i thought album list did this as well but i'm mistaken on that - unless it used to but has been changed

obviously trimming spaces will affect the folder naming - infact my new script would have that same issue. edit2: i've fixed this. leading/trailing spaces are trimmed on all title formatting. users of new scripts can right click the panel>Update script.

i'm at bit of a loss to explain those "path not found" errors. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 23:06:08
And i don't know to tweak my code to show both types of files...


try this.

Code: [Select]
$puts(path.artistPath,$if($fileexists(Z:\artists pictures\%artist%.jpg),Z:\artists pictures\%artist%.jpg,$if($fileexists(Z:\artists pictures\%artist%.png),Z:\artists pictures\%artist%.png,$get(path.noartist)))


and please post in bio component thread with any more issues. this is bit off topic for in here.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-10 23:36:31
Case 1: Is your migrate.txt script case-sensitive?


not the migrate script but unfortunately the old thumbs/now playing script was. every time you changed the case of an artist tag, a new folder would have been created because i used the $crc32 function without using $upper or $lower. now i'm using actual artist names, it's no longer an issue.

the fact my updated script found more folders to move successfully does indicate that you still have lots of artists in library tagged with different cases. the reason the migrate script failed before is because the "move" folder function i used doesn't work when the new folder already exists. i changed it to "copy" instead and that's why we got better results.

edit: you might try foo_facets. that actually lists the same artists with different case separately. i thought album list did this as well but i'm mistaken on that - unless it used to but has been changed

obviously trimming spaces will affect the folder naming - infact my new script would have that same issue. i guess i could trim the leading/trailing spaces when creating folders. please don't tell me there are artists out there who use that intentionally. 

i'm at bit of a loss to explain those "path not found" errors. 


My guess on the "path not found" is that its probably a difference between the script language and Windows. Windows folder names do not respect trailing spaces. So to Windows Madonna and Madonna (space) are the same folder. In fact Windows won't let you create a folder with trailing spaces. It gets truncated with no warning message. So if your script is looking for Madonna (space) folder that it just created, because that's what the ID3 tag artist name was, then it won't find it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-10 23:42:49
btw, you mentioned mp3tag before but foobar can find leading/trailing spaces for you. Library>Search

Code: [Select]
"$ifgreater($len(%artist%),$len($trim(%artist%)),1,0)" IS 1


select all results>properties>right click the artist field and select Clean up
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-10 23:55:10
The changeover to readable folder names from $crc32 folder names I think is an improvement in the long run, in part because it makes it easier to find artist strings in one's library or image folders with problems.

I found that the following facets filters were helpful in tracking down folders that didn't migrate:

artists with leading or trailing spaces:  artist IS " *" OR artist IS "* "
artists with double spaces:                  artist HAS "  "

In most cases of hits from the above filters, I had a tag field problem and I fixed them.  In some cases, the error was on the last.fm source - I had few enough of them that I just corrected the bad image file names manually.  For example, on the folders not migrated, I ran *.* as a windows explorer search and then sorted by name to find artists on last.fm that had leading spaces. Same thing with weird characters and case sensitivity - I found it more efficient to just manually scroll through the  new and remaining folders to find anomalies and make manual corrections as needed than try to figure out a script change to do the same.

I also think some of my migration problems with non-english characters were related to character set weirdness on my computer that I first noticed in using the biography component that I explored with Romor that were just easier to resolve manually in this transition.

Since it's just a one-time transition, the migration filtering that marc2003 provided was appropriate to identify potential issues and then cleanup the exceptions manually. For me, anyway.  Once you've convinced yourself the remaining unmigrated artists are accurate but from streams (artists not in your library) and you want to keep these images, only then does doing a brute-force scraping from image names to create a new folder make sense to me. And worked well for me.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-11 00:33:43
I agree that the new artist name based folders are better than the CRC method. In fact, I've wanted it for years! I even requested marc2003 put "open containing folder" in the panel long ago to help find the artist photos.  So well done marc2003!

Having said that, going thru my playlists, I noticed that most of the artists with "." in the naming didn't get migrated. This happens a lot for me due to the current trend of artist "featuring" artist songs which is usually written as "feat." or "ft." in the tags. Example: Jennifer Lopez feat. Iggy Azalea

As mentioned before, playing the song will download new photos. So its not a concern for me but might help with the updating the script.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-11 00:50:15
@marc2003
I'm getting heavy CPU usage with the new thumbs script when downloading photos from last.fm.  Sometimes hitting 100% and causing foobar to stutter or stop playing.
There seems to be a noticeable improvement in download speed for photos. It used to be a definite wait between photos downloads. Now all 5 seem to download almost immediately. But i think the cost is too high CPU usage.

FYI. I'm running Win7 on 2.40GHz CPU Dual-Core
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-11 00:59:53
periods don't seem to be an issue for me. ah, the issue is they can't have spaces after them. more fun to workaround.

i've not even changed the download side of things so i don't know what is happening there. i guess i'll have to look into it.

edit: having a quick glance, i can't even see anything happening CPU wise with the image downloads. and i'm running a seriously ancient socket754 athlon64 with 1GB ram/XP.    the download processes are actually launched completely independently of foobar. the reason 5 spawn at once is because a previous version did do 1 at a time and waited for 1 to finish before starting the next. the problem with that is that it prevented foobar from closing which i thought was unacceptable.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-11 02:30:13
i *think* i've taken care of migrating folder names with periods in. it's not windows that has a problem with them but some of the jscript functions which i've hopefully managed to workaround.

https://dl.dropboxusercontent.com/u/2280132...emp/migrate.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/migrate.txt)

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-11 02:34:58
the reason 5 spawn at once is because a previous version did do 1 at a time and waited for 1 to finish before starting the next. the problem with that is that it prevented foobar from closing which i thought was unacceptable.

Maybe to set delay in vbs?

...I modified your old bio text script, to download biography directly from last.fm web page.
Seems to work fine

Code: [Select]
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

FontTypeCUI = {
items: 0,
labels: 1
};

ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
};

FontTypeDUI = {
defaults: 0,
tabs: 1,
lists: 2,
playlists: 3,
statusbar: 4,
console: 5
};

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

function get_font() {
if (g_instancetype == 0) {
g_font = window.GetFontCUI(FontTypeCUI.items);
} else if (g_instancetype == 1) {
g_font = window.GetFontDUI(FontTypeDUI.defaults);
}
}

function get_colors() {
if (g_instancetype == 0) {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
} else if (g_instancetype == 1) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_font_changed() {
get_font();
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

g_instancetype = window.InstanceType;
get_font();
get_colors();


g_metadb = fb.GetFocusItem();
var artist = g_text = '';
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);

                   
            var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
            var str = "id=\"wiki\">";
            st = text.indexOf(str, st) + str.length;
            var et = text.indexOf("</div>", st);
            var artt = text.substr(st, et - st);
            var ar = artt;
               
            var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&");
            fb.trace("bio: " + ar);
            {save_file(ar);};
                }
                   
                this.doc.close();
               
} else {
fb.trace("HTTP error: " + im.xmlhttp.status);
}}}}

function save_file(x) {
try {
g_text = x;
g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = g_text;
g_text = div.innerHTML;
g_text = g_text;
} catch(e) {
g_text = "This artist does not have a biography";
}
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(g_text);
ts.close();
} catch(e) {
g_text = "Error saving biography for this artist";
}
calc();
}

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
if(g_metadb) {
gr.GdiDrawText(g_text, g_font, g_textcolor, 6, offset + 8, ww-16, wh-offset-16,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
gr.FillSolidRect(-1000, -1000, ww, 38, g_backcolor);
//gr.GdiDrawText(artist, gdi.Font("Segoe UI", 16, 1), g_textcolor_hl, 6, 5, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
//gr.DrawLine(5, 29, ww-10, 29, 1, RGB(137,140,149));
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)
filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
if(fso.fileExists(filename)) {
try {
ts = fso.OpenTextFile(filename,1, false, -1);
g_text = ts.ReadAll();
ts.close();
} catch(e) {
g_text = "Error opening file!";
}
calc();
} else {
get_bio();
}
}

function calc() {
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
offset = 0;
window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Force update");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) get_bio();
if(idx == 2) window.ShowConfigure();
_menu.Dispose();
return true;
}

function on_mouse_wheel(delta) {
step = g_font.height * 1;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;
} else {
temp = -textheight + wh;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-11 03:12:56
i still can't see anything wrong with downloads and i'm using a 10 year old piece of crap pc with an even worse 3G internet connection. i'm looking at task manager and foobar isn't using any cpu at all. 5 instances of cscript.exe are spawned to run a bit of vbscript i found online and they barely use 1-2% each for a second or 2???
Title: WSH Panel Mod script discussion/help
Post by: orbtwin on 2014-11-11 07:44:04
And i don't know to tweak my code to show both types of files...


try this.

Code: [Select]
$puts(path.artistPath,$if($fileexists(Z:\artists pictures\%artist%.jpg),Z:\artists pictures\%artist%.jpg,$if($fileexists(Z:\artists pictures\%artist%.png),Z:\artists pictures\%artist%.png,$get(path.noartist)))


and please post in bio component thread with any more issues. this is bit off topic for in here.


i think this part of the code is corrupting my panel:

Code: [Select]
$puts(text.artist,$if($fileexists(Z:\artists pictures\%artist%.jpg),%artist%,$get(text.noartist)))


Mmmm. oohh! i'm sorry i thought it were
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-11 22:43:27
i still can't see anything wrong with downloads and i'm using a 10 year old piece of crap pc with an even worse 3G internet connection. i'm looking at task manager and foobar isn't using any cpu at all. 5 instances of cscript.exe are spawned to run a bit of vbscript i found online and they barely use 1-2% each for a second or 2???


I've tried rebooting and still get the CPU spikes when I use the thumbs.txt. Its very repeatable for me. I just have to click on the "download artist art...".
Obviously if I'm doing something else while the foobar is playing in the background, the spike is worse and causes the stuttering playback.
I installed a CPU monitor and got the following after I click. I'm assuming its the sum of all the CPU that causes the problem?  Hope this helps.
11/11/2014 14:25   conhost.exe   8028   Process terminated   Ran for 208 ms. Average CPU use 3.74%.
11/11/2014 14:25   conhost.exe   7876   Process terminated   Ran for 292 ms. Average CPU use 5.34%.
11/11/2014 14:25   conhost.exe   6472   Process terminated   Ran for 198 ms. Average CPU use 7.87%.
11/11/2014 14:25   cscript.exe   3428   Process terminated   Ran for 294 ms. Average CPU use 10.61%.
11/11/2014 14:25   cscript.exe   1064   Process terminated   Ran for 205 ms. Average CPU use 15.21%.
11/11/2014 14:24   cscript.exe   3524   Process terminated   Ran for 200 ms. Average CPU use 11.69%.
11/11/2014 14:24   conhost.exe   7876   Process launched   Parent csrss.exe (624), PATH: C:\Windows\system32\conhost.exe
11/11/2014 14:24   cscript.exe   3428   Process launched   Parent foobar2000.exe (3464), PATH: C:\Windows\System32\cscript.exe
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-11 23:08:18
i *think* i've taken care of migrating folder names with periods in. it's not windows that has a problem with them but some of the jscript functions which i've hopefully managed to workaround.

https://dl.dropboxusercontent.com/u/2280132...emp/migrate.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/migrate.txt)

@marc2003
Thanks for fixing the problem. I can't confirm nor deny its been fixed. I ran the latest migrate.txt but when I went to the new wsh_data folder but couldn't find any files newly created. Does your script keep the original file date?  In any case, I spent a few hours last night cleaning up my artists and filenames. So the old ones are of little value to me now.

Here is the result log.
Quote
Folders without image/txt files deleted: 0
Folders without image/txt files not deleted due to errors: 0

Folders with image/txt files to keep: 1279

Of those folders to keep, 11 were matched against artists in your library and moved successfully.
There are 1268 folder(s) remaining that don't match artists in your library.


Again, I'm not surprised by the low "moved successfully" count because I've cleaned up.  And as you mentioned, a lot of those "remaining" were cause by separate files CRC created every time i changed capitalization or spacing over the past 4 or 5 years.

Thanks again for making this process change! It's a lot easier to manage the artist info now.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-11 23:46:11
Obviously if I'm doing something else while the foobar is playing in the background, the spike is worse and causes the stuttering playback.


wow. i don't have anything to explain stuttering playback? each process there is running for 1/5th of a second which is nothing. i mentioned i have a crap pc now but my previous pc was slightly less crap (ivybridge pentium dual core/8GB ram/windows 7) and that could handle foobar playing without stuttering under 100% cpu load when running intensive programs like vmware workstation or games like GTA4.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 02:34:02
marc2003, please advise a correct command to locate currently playing file, (same as double click on status bar). Want to use it on left click down.

ps. why fb.RunContextCommandWithMetadb("Open containing folder", meta_focus); - make art reader script crash, temporary put that:
fb.RunContextCommand("Open containing folder");
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-11-12 02:50:55
marc2003, please advise a correct command to locate currently playing file, (same as double click on status bar). Want to use it on left click down.


Code: [Select]
function() { fb.RunMainMenuCommand("View/Show now playing in playlist"); }, "Show Now Playing", true),


This is what is assigned to a button on mine. Note that this is for latest fb2k (1.3.5). It's slightly different for earlier versions.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 03:00:15

hmm.. just checked on 1.3.5 - though, it works as i want, but i am on 1.2.9. Any tricks possible?
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-11-12 03:13:56
hmm.. just checked on 1.3.5 - though, it works as i want, but i am on 1.2.9. Any tricks possible?


Code: [Select]
function() { fb.RunMainMenuCommand("View/Show Now Playing"); }, "Show Now Playing", true),


No reason not to upgrade to latest, but this should work for older versions.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 03:33:36
MachineHead, it's not. nothing happened, i remember had already try it few years ago.

after 1.2.9 it loads almost a second slower, volume control is not same, fullscreen-restore is slower, and i dont like djing with folders/dlls from version to version.
As for me to 1.2.9 was not easy step to switch to, but don't see the reason for update now if my config still works well for me.

Just checked 1.3.5 - little things uncomfortable for me is still there. How can run elevated cdtect from non admin instance, how to set different spectrum bands on fullscreen mode (40 to 80), what is variable for %home_dir%, variable for internal covers in a file .. and etc..etc.. fb2000 is not a media player, it's a media files organizer.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-11-12 03:51:01
MachineHead, it's not. nothing happened, i remember had already try it few years ago.


If it is not triggering then see here: reasons. (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=878907) I asked Peter that this be addressed and he kindly fixed that issue.

So you have two options.

1) Untick always show notification.

2) Update to current version and use newest code.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 04:19:14
1) Untick always show notification.

hehe, works, but you already know that tray icon is important thing.. =)

what the main reason for you to update this program all the time, it's pretty stable for years already, not say about earlie versions which i just ignore as it was so square boxed and raw..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-12 05:29:44
ps. why fb.RunContextCommandWithMetadb("Open containing folder", meta_focus); - make art reader script crash, temporary put that:
fb.RunContextCommand("Open containing folder");


you can't be talking about my artreader script because i don't use that code. that would locate the playing/selected file?? with my artreader script, it locates the image which could be anywhere and it actually checks the file exists before trying to locate it....

Code: [Select]
    this.explorer = function(path) {
        if (path.is_file()) this.run("explorer /select,\"" + path + "\"");
    }


even this.run is coded to fail silently so it should never crash the script.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 05:53:32
marc2003,
OK, now i got it why i start playing with it, it was not about locate playing file or open in explorer media file at first, but:
if use this code, it's opening explorer but not always highlight on a image file! need to double click again if not.

Code: [Select]
a.lbtn_dblclk(x, y);

then i try to find a way to open that image another way. after, if no way doing it well, try to add some locate currently playing file and finally search for image though opening currently playing file folder, though i store images not always at the same dir. i bit awkward when decide to spend few mins to change covers for betterresolution/quality and cannot open exaclty showing image immidiately. any ideas?
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2014-11-12 06:09:46
marc2003,

When I use old version of your script  - "last.fm & wikipedia biography.txt"  I  have bio for band "Ekseption".

But with new version  script from samples8 bio for this band is clear.

(http://i63.fastpic.ru/thumb/2014/1112/b9/456de9f221e8bb08c8db8b394ddbefb9.jpeg) (http://fastpic.ru/view/63/2014/1112/456de9f221e8bb08c8db8b394ddbefb9.jpg.html)

It is a bug?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-12 06:10:40
Code: [Select]
a.lbtn_dblclk(x, y);


how the double click function works depends on what version of script you're using. if you right click the panel>Configure and look at the top to see if imports common7 or common8.js

common7 always locates the file in explorer. the only time it won't point at an image is if the album art is embedded. if that is the case, it will locate the audio file itself.

common8 will open the default image viewer for the file type. windows handles this so if you've installed 3rd party programs that have taken over jpg/png file associations, they will open in that. if the art is embedded then i locate the audio file in explorer. i've added the open containing folder on the right click menu for people who want the explorer option.

Quote
i bit awkward when decide to spend few mins to change covers for betterresolution/quality and cannot open exaclty showing image immidiately. any ideas?


you should use the Refresh option on the right click menu if you edit the image during playback. the image it points at will depend on file>preferences>display>album art. it always uses the first match it finds and ignores the rest.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-12 06:20:30
When I use old version of your script  - "last.fm & wikipedia biography.txt"  I  have bio for band "Ekseption".


the problem here is that the first script you use will fetch the bio just fine but it leaves an entry in the internet explorer cache for 24 hours preventing the other script from fetching the bio. i don't know why it can't use the file in the internet explorer cache.

i'm stuck with IE8 so apologies if these directions don't exactly match what you see, click on tools>internet options>browsing history>delete. make sure temporary internet files is selected and you can untick everything else. click delete and you're done. reload the common8 script and it should work.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 06:20:41

i am on common6.js 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-12 06:24:25
ha, i don't even keep code that old so i can't check it.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 06:29:45
can share with you, if you have some necro-desire..hehe
okay, gonna check out common7, and will tell if it has visible improvements, url?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-12 06:38:25
common7 is no longer supported so i really would recommend using the latest common8.

https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

as you're using very old scripts, you need to make sure your WSH panel mod component is new enough to run new ones. 1.5.0 or above is required. latest version is 1.5.6 https://code.google.com/p/foo-wsh-panel-mod/ (https://code.google.com/p/foo-wsh-panel-mod/)

also, make sure you extract the whole marc2003 folder and overwrite any files if prompted.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 06:49:22
foo_uie_wsh_panel_mod is 1.5.6, probably 'get update' button works well sometimes.
the same folder i store scripts too. common8 is same as 7? i just not like the idea to open bitmaps files in paintbrush as you mentioned.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-12 07:28:54
use the latest 8 and later on, i'll add a new setting where you can choose what double clicking does. at the moment, you can right click the panel>open containing folder.

when i post the update, you can just right click the panel>Update script.

Quote
probably 'get update' button works well sometimes.


well no. WSH panel mod is not on the official component repository.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 07:46:46
well no. WSH panel mod is not on the official component repository.
hehe, rite, probably i did update it by myself during one of my sleepwalking trips.. ok

hm.. many new menu options, probably somebody needs it, not me.

hold on, i should enable dl.dropboxlamerscontent.com on my zisco first

okay, no need to update for me, just modified double click and checked it - THE SAME behavior == not always highlight..

PS. funny:
Code: [Select]
common6.js"
WSH Panel Mod (Art Reader by marc2003): initialized in 6 ms

common8.js"
WSH Panel Mod (Art Reader by marc2003): initialized in 7 ms

1ms price for opening covers still incorrectly, without hightlight.

Title: WSH Panel Mod script discussion/help
Post by: pIv on 2014-11-12 07:49:40
When I use old version of your script  - "last.fm & wikipedia biography.txt"  I  have bio for band "Ekseption".


the problem here is that the first script you use will fetch the bio just fine but it leaves an entry in the internet explorer cache for 24 hours preventing the other script from fetching the bio. i don't know why it can't use the file in the internet explorer cache.

i'm stuck with IE8 so apologies if these directions don't exactly match what you see, click on tools>internet options>browsing history>delete. make sure temporary internet files is selected and you can untick everything else. click delete and you're done. reload the common8 script and it should work.


It's work.

Second answer: why script "now playing.txt" not included in samles8.zip. This is my favorite script, and so I have to use the previous version of your package.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-12 08:03:07
hold on, i should enable dl.dropboxlamerscontent.com on my zisco first


what the fuck are you talking about? do you have to whitelist every website before you visit it.

Quote
okay, no need to update for me, just modified double click and checked it - THE SAME behavior == not always highlight..


you modified it yourself and you're complaining to ME that's not working. 

Quote
1ms price


price? 0.001 of a second. well i shall just remove all my scripts from the internet because they're clearly fucking useless.
Title: WSH Panel Mod script discussion/help
Post by: w00w000 on 2014-11-12 08:34:53
what the fuck are you talking about? do you have to whitelist every website before you visit it.
not all, but ie api. 
Quote
you modified it yourself and you're complaining to ME that's not working. 
no complaints if it's win problem, you can reconstruct even with your version if don't trust - just right click and choose 'open folder' (~20% highlight fails), always was the same behavior with common6.js, was thinking first i double click too fast and/or too many entries in search patters, but cmon it's not 286 now, everything counts on 0.0001 seconds, but even if you do it as retired the same 20% there, so it's not a case.
Quote
price? 0.001 of a second. well i shall just remove all my scripts from the internet because they're clearly fucking useless.
i like the idea of "now playing", especially in fullscreen mode!

okay, will switch to album art viewer for now, as it open folder and highlight images on 100% clicks.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 05:14:54
hi @marc2003,

im new to foobar. i've found your website with the wsh panel mod installation instruction...

im stuck and cant follow this instructions

"Next, click on the WSH panel to open the configuration dialog. I recommend leaving all settings at their defaults. Now simply add the script you want to use. These are located in the samples8 folder inside the zip. If you extract that somewhere, you may use the Import button to browse for it otherwise you can just copy/paste the text. To access this dialog in future, you'll need to right click the panel and choose Configure from the menu.

Click OK to close the dialog and hopefully we won't see any errors!!"

this is where i'm at.

(http://i.imgur.com/Oh4fh4N.jpg)

where's the WSH panel and how to add your scripts...?

cheers...
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-11-13 07:05:12
where's the WSH panel and how to add your scripts...?


You need to add a WSH element to your layout. The best way to get familiar with this is to use a scratchbox (View>Layout>Create scratchbox) and get creative. You can create more than one scratchbox to compare or use as a sort of staging box for different elements. Splitters divide the UI into sections and will probably be your first added elements. They can be resized or locked (r-click on the splitter) depending on what you want to accomplish. Once you have the UI layout sectioned as you wish you can start adding the main elements (those being things like Facets, playlist renderers, WSH panels, etc.).

Basic layout example (https://imgur.com/a/ga2pD).

Explanation of above images:

1) Splitters. First one is top and bottom. Then the left and rights were added above. You can do these any way you want. If you don't like it you can right click on a splitter and remove it or simply make a new scratchbox and start again.

2) Added elements. Three WSH panels and one tab element. Note - you can also add splitters and other elements in the tabbed elements. Click and try various options.

3) Configuring WSH panel. Simply click on the one you wish to configure and then Tools > Import. Browse to where the text file is (in your case marc2003 > samples*) and choose which one you need. Hit apply or OK. You can also use a text editor, select all then copy & paste into the configuration editor if you are using something besides marc2003's samples.

That should be enough to get you started. If you like what you have created then you can do a couple of things. First, you may want to export the theme you have created in case you want to continue exploring your options. Click the edit button (upper left of the scratchbox window) and export with a name besides theme. That's the default name and you will need to differentiate. You can save them anywhere. Second, after saving you can apply your new theme under the scratchbox edit button as well. Just select apply and your new layout is now applied ready to use. Just close the scratchbox when you're done.

* marc2003 has provided several versions of his samples (eg: 6,7,8). You'll need to browse to the one that corresponds to the common.js in the main marc2003 folder. Probably common8.js if you are using the most recent. Earlier versions can reside in the main marc2003 folder with generally no conflicts, too.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 08:45:49
where's the WSH panel and how to add your scripts...?


You need to add a WSH element to your layout. The best way to get familiar with this is to use a scratchbox (View>Layout>Create scratchbox) and get creative. You can create more than one scratchbox to compare or use as a sort of staging box for different elements. Splitters divide the UI into sections and will probably be your first added elements. They can be resized or locked (r-click on the splitter) depending on what you want to accomplish. Once you have the UI layout sectioned as you wish you can start adding the main elements (those being things like Facets, playlist renderers, WSH panels, etc.).

Basic layout example (https://imgur.com/a/ga2pD).

Explanation of above images:

1) Splitters. First one is top and bottom. Then the left and rights were added above. You can do these any way you want. If you don't like it you can right click on a splitter and remove it or simply make a new scratchbox and start again.

2) Added elements. Three WSH panels and one tab element. Note - you can also add splitters and other elements in the tabbed elements. Click and try various options.

3) Configuring WSH panel. Simply click on the one you wish to configure and then Tools > Import. Browse to where the text file is (in your case marc2003 > samples*) and choose which one you need. Hit apply or OK. You can also use a text editor, select all then copy & paste into the configuration editor if you are using something besides marc2003's samples.

That should be enough to get you started. If you like what you have created then you can do a couple of things. First, you may want to export the theme you have created in case you want to continue exploring your options. Click the edit button (upper left of the scratchbox window) and export with a name besides theme. That's the default name and you will need to differentiate. You can save them anywhere. Second, after saving you can apply your new theme under the scratchbox edit button as well. Just select apply and your new layout is now applied ready to use. Just close the scratchbox when you're done.

* marc2003 has provided several versions of his samples (eg: 6,7,8). You'll need to browse to the one that corresponds to the common.js in the main marc2003 folder. Probably common8.js if you are using the most recent. Earlier versions can reside in the main marc2003 folder with generally no conflicts, too.



heya! thanks for the explanations

you see on that post, the bottom right is the WSH panel. after that i dont know what i have to do next to use his scripts...

(maybe the screenshot above is too messy, i apologize for that. here's another screenshot).

Screenshot A... the WSH panel on the right side

[/b]
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-11-13 08:52:20
what should i do the next?


Probably use iTunes if the step by step was too difficult.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 10:55:50
what should i do the next?


Probably use iTunes if the step by step was too difficult.


no. i want to use foobar.

hi... have you seen my latest post? kindly let me know if my posts and screenshots are unclear for you, i'll try to make it clearer which part i got lost...

thanks for helping by the way 


=====
where's the WSH panel and how to add your scripts...?


You need to add a WSH element to your layout. The best way to get familiar with this is to use a scratchbox
Basic layout example (https://imgur.com/a/ga2pD).

Explanation of above images:

1) Splitters. First one is top and bottom. Then the left and rights were added above. You can do these any way you want. If you don't like it you can right click on a splitter and remove it or simply make a new scratchbox and start again.

2) Added elements. Three WSH panels and one tab element. Note - you can also add splitters and other elements in the tabbed elements. Click and try various options.

3) Configuring WSH panel. Simply click on the one you wish to configure and then Tools > Import. Browse to where the text file is (in your case marc2003 > samples*) and choose which one you need. Hit apply or OK. You can also use a text editor, select all then copy & paste into the configuration editor if you are using something besides marc2003's samples.

That should be enough to get you started. If you like what you have created then you can do a couple of things. First, you may want to export the theme you have created in case you want to continue exploring your options. Click the edit button (upper left of the scratchbox window) and export with a name besides theme. That's the default name and you will need to differentiate. You can save them anywhere. Second, after saving you can apply your new theme under the scratchbox edit button as well. Just select apply and your new layout is now applied ready to use. Just close the scratchbox when you're done.

* marc2003 has provided several versions of his samples (eg: 6,7,8). You'll need to browse to the one that corresponds to the common.js in the main marc2003 folder. Probably common8.js if you are using the most recent. Earlier versions can reside in the main marc2003 folder with generally no conflicts, too.


maybe i should address your posts.

i did put wsh panel on my layout.
i've used splitters yes.
i've used scratchbox yes.
i did use export and import theme on my experiments yes.

so...  this is my first image before your posts...


(http://i.imgur.com/Oh4fh4N.jpg)



more than half of the foobar is covered by the folder view, but that's the wsh panel on the right side. and i used scratchbox and splitters and export import themes on my experimentations.

because it seems like my first screenshot didn't get the message through... i made another screenshot (basically my last post before this)

fullview of my current foobar created by import export theme from scratchbox... (the WSH panel is on the right side) (splittered left right with playlist)

(http://i.imgur.com/0lEwBP2.jpg)


my problem with couldn't follow mark's web instruction is these... (from the last post screenshots...)

when i clicked the WSH panel, the panel mod configs comes out => tools => import => marc2003 => images8 (there's nothing there) => buttons cd lastfm etc etc => when those are clicked, the inside are empty

(http://i.imgur.com/09mrEka.jpg)

(http://i.imgur.com/nsYHVu6.jpg)

you see when i click the WSH panel mod on the "create your script click here to open editor" => WSH panel mod configuration => tools => import => appdata => roaming => foobar2000 => marc2003 => images8... there's nothing there... => inside images8 => there's the buttons cd mb misc etc folders, but it's also empty...

i think i missed a step somewhere. let me know if there's any of my explanatiosn that are unclear for you, but for now, kindly check out my screen shots because.. that's probably the best i could do to describe my problem, in addition to words...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-13 11:09:29
"Next, click on the WSH panel to open the configuration dialog. I recommend leaving all settings at their defaults. Now simply add the script you want to use. These are located in the samples8 folder inside the zip. " lost... hehe


why did you stop reading there? the next sentence is kind of important.

Quote
These are located in the samples8 folder inside the zip. If you extract that somewhere, you may use the Import button to browse for it otherwise you can just copy/paste the text.


i'd have thought the last part about copy/pasting the text would be obvious?? you actually have to open the txt file inside the samples8 folder. just double click and it will typically open in notepad.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 11:14:32
"Next, click on the WSH panel to open the configuration dialog. I recommend leaving all settings at their defaults. Now simply add the script you want to use. These are located in the samples8 folder inside the zip. " lost... hehe


why did you stop reading there? the next sentence is kind of important.

Quote
These are located in the samples8 folder inside the zip. If you extract that somewhere, you may use the Import button to browse for it otherwise you can just copy/paste the text.


i'd have thought the last part about copy/pasting the text would be obvious?? you actually have to open the txt file inside the samples8 folder. just double click and it will typically open in notepad.


ahhh i see what i missed!! basically.. i didn't know that "script" means notepad...
hehehehehehe. well i know now...

fyi... i've read everything over and over and over before posting here. i didn't know that script means notepad. i went to samples8 folder inside the zip, and i couldn't find a script. i just found bunch of notepads. so there that was.

yeah no. i have no experience with tweaking digital stuffs whatsoever, particularly coding. this is my first experience. no yeah... it's obvious now that you've explained it to me... but it's completely oblivious to me when i tried it out by myself.

thanks for pointing it out marc2003.

(http://i.imgur.com/tEPUnc3.jpg)

thanks to you, and machinehead...

(http://i.imgur.com/tFhWptx.jpg)

yeahhh!!

i tried rating, similar artists, and bios... hehe!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-13 11:38:33
you may congratulate yourself for being the 1st person in over 4 years that i've had to explain that to.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 11:52:02
you may congratulate yourself for being the 1st person in over 4 years that i've had to explain that to.


i know you didn't mean it as a compliment. but im genuinely happy. no hard feelings over here mate.
and terribly sorry to made you have to explained that.

yeayy!!

the way i cut your explanations made it looks like that i seemingly didn't read the subsequent sentences. i'd like to reiterate that that's not true... i did read it. and didn't understand it. but it's a good lesson.

when people write script it meant notepad with bunch of codes inside of it. i see thanks!

i um... checking out and reading all your scripts explanations now. im reading about thumb at the moment... probably will have question/s about it after a while...

cheers
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-13 12:58:31
i know you didn't mean it as a compliment.


heh, i was only having a bit of fun. i suppose i should learn a lesson as well. not everyone is at the same level when it comes to using computers. i see this on a regular basis at my local library. i go there because the internet is exponentially faster than what i have at home and i do see lots of new people struggling with the very basics. unless you're instructed by someone competent, it's not always easy to pick it all up by yourself.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 13:10:52
i know you didn't mean it as a compliment.


heh, i was only having a bit of fun. i suppose i should learn a lesson as well. not everyone is at the same level when it comes to using computers. i see this on a regular basis at my local library. i go there because the internet is exponentially faster than what i have at home and i do see lots of new people struggling with the very basics. unless you're instructed by someone competent, it's not always easy to pick it all up by yourself.


i guess its fairly obvious that script equals code if you know computers and your first language is english. mine isn't hehehe!

it's all fine and good. yeah! your thumbs script is the reason i was looking for your wsh panel mod. thank you for releasing it to the masses.

now in relation to "fairly obvious" stuff and "english language" related questions again...

these are all thumbs options that i dont understand after i tried it by myself (either because i cant see / missed the differences or nothing happens that jumped out in my eye)

automatic download => library tracks only and all tracks
1) what's the difference?

limit 1 - 3 - 5
2) is there option where i don't have to choose? (is it possible to leave this blank instead of choosing 1,3,5?

selection mode
the explanation written are "Selection mode allows certain scripts to prefer either the playing or selected item"
3) what's the difference between now playing and selected track?

what's a selected track anyway?

*particularly number 3, you see, it's a language barrier more than anything. hahaha
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-13 13:38:55
1) if you use the foobar media library (file>preferences>media library), then the library tracks only option will only work if the track lives in one of the monitored folders. if you play file that isn't inside one of these folders, no attempt will be made to automatically download an image. just remember that it will display images for any previously saved artists and the manual download artist art from last.fm option always works regardless of the setting you have chosen.

2) ???? you have to make a choice of how many images you download. if you want it to be none then don't use the script in last.fm mode. instead you can use custom folder mode where it will look for existing folders that already contain images.

3) the selected track can be anything else you select (click) in your playlist. consider this screenshot.

(https://dl.dropboxusercontent.com/u/22801321/2014/november/select.png)

with the playlist, you can see the playing icon is next the to the Björk track but selected track is by CHVRCHES. if the panel was configured to prefer now playing, i'd see a picture of Björk but i have it configured to follow selected track.

Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 14:01:00
1) if you use the foobar media library (file>preferences>media library), then the library tracks only option will only work if the track lives in one of the monitored folders. if you play file that isn't inside one of these folders, no attempt will be made to automatically download an image. just remember that it will display images for any previously saved artists and the manual download artist art from last.fm option always works regardless of the setting you have chosen.


2) for number 2 question i actually meant more than 5.
how complicated is it to change the script to have number more than 5 by myself? both on the graphical option and to appear to be more than 5?

1) for number 1...
a. at the moment i drag and drop around 20 albums on my experimental playlist.
b. my automatic download is set on "library track only" option
c. my media library music folders path are set to monitored  my main music folder (the MUSIC folder there on the SS) (it contains around 100 something albums)

(http://i.imgur.com/xwsCOer.jpg)

my question is regarding thumbs artist art last fm download activity...

1) say i have 2 playlists. the default (usually all my music, but at the moment i left it empty). and the experimental playlist with 20 albums above.

Question a) when the automatic download is set on library track only option while exp. playlist songs are playing, does it snatch artist arts only on those 20 albums, or all my 100 something albums due to my main music folder being monitored?
(does it matter that the default playlist are empty, and not all 100+ albums are being loaded into foobar?


Question b) regardless of A answer, when does the snatch continue going on? only when foobar is actively playing songs, or also when foobar is not playing songs but active (say, minimized), or does it works in the background process even when foobar isn't active?

that's probably all...

oh my internet speed is pathetic around 1 to 1.5Mbps so that's why i ask.


cheers....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-13 14:22:05
the automatic download only works on 2 conditions:

when you start playing a new track AND there are no images saved for that playing artist.

it does not look at your library or playlists to do anything in the background.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-13 14:35:42
the automatic download only works on 2 conditions:

when you start playing a new track AND there are no images saved for that playing artist.

it does not look at your library or playlists to do anything in the background.


sweet! this is a really amazing script (i meant the work for getting the thumbs alone to work flawlessly)

the scrolling up and down with mouse. the options to switch pictures every couple seconds, the works. beautiful.

last question would be regarding relocation of saved files. is it possible to change the artists => artists name folder to be moved to say a different disk

my local SSD is only 120gb so it get full pretty quick...

what kinds of adjustments in codes / paths do i need to make to change the path from roaming = foobar2000 = wsh_data to say, my D hard drive...


(or is it just easier to scrap everything and install foobar on my D hard drive and not in C program files...?)

will that messed with your scripts and other plugins (like foo uie lyrics3)...
Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2014-11-13 16:58:04
Please ignore, I accidentally posted in the wrong thread.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-13 23:40:20
@marc2003
I just started using your lastfm/wiki script for bios. Is there a way to manually refresh the info? I have just updated some bios on last.fm and can't seem to get them to download again.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-14 00:42:02
no. i use a 3rd party webservice provided by the the echonest (http://developer.echonest.com/). last time i checked, it took about a week for a new edit to show on their site. the reason i use this and not last.fm directly is because i can get the full text for the article. last.fm only provide the first few sentences. my script will eventually show the edited page because it checks to see if the locally saved page is a day old. if it is, it checks for updates.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-14 03:02:25
no. i use a 3rd party webservice provided by the the echonest (http://developer.echonest.com/). last time i checked, it took about a week for a new edit to show on their site. the reason i use this and not last.fm directly is because i can get the full text for the article. last.fm only provide the first few sentences. my script will eventually show the edited page because it checks to see if the locally saved page is a day old. if it is, it checks for updates.


Why you don't want to use web page directly?
I modified your old bio text script, and i receive full bio text directly from last.fm> link (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=880255)
You can do this also for wikipedia...
Then user can also use different language etc..
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-14 07:12:13
@marc2003

hi marc...

i'd like to ask a last question about relocation of saved files. my local SSD is only 120gb so it get full pretty quick...

is it possible to change the artists => artists name folder to be moved to say a different disk

what kinds of adjustments in codes / paths do i need to make to change the path from roaming = foobar2000 = wsh_data to say, my D hard drive...

(or is it just easier to scrap everything and install foobar on my D hard drive and not in C program files...?)

*also if i installed the foobar on D hard drive... will that messed with your scripts and other plugins (like foo uie lyrics3) as well... ?

rvpio
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-14 10:58:26
@mire777, if wiki editors must see instant changes, they can use your script. i'm not changing mine.

@rovopio, installing foobar2000 in portable mode on another drive is the best solution. just copy the entire contents of %appdata%\foobar2000 in to your new foobar2000 folder and all your previous settings and components should work just fine.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-14 12:02:35
nice @marc2003,

thanks a lot!!

again, thank you for the thumb script
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2014-11-14 12:37:25
Just updated to common8, I didn't realize common7 wasn't supported anymore. Is there no Now Playing script with this one? I don't see it in the samples.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-14 15:19:31
i was going to update it but i can't be bothered anymore. there's no reason to think the old one will stop working. if you need to download it again, it's here: https://dl.dropboxusercontent.com/u/2280132...mp/samples7.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/samples7.zip)
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-14 16:58:34
I'm seeing some weirdness in using the musicbrainz script with both common7 and common8, and it would be great of someone can confirm if they see something similar or not to determine if the problem is  unique to my setup or not.

With entities that MB called a "group" (for example, the Beach Boys), the MB script will fail to list the "live" releases listed for a group.  Compilations are listed, albums are listed, but not live releases.

If the MB entity is an "artist", then everything seems fine with respect to live releases.  I haven't had time to see if there is anything similar going on with EPs, singles or remixes.

edit: I made sure to delete the previous json to ensure the script downloaded new data, and I updated the common8 script to what reports as the latest as of an hour ago.
edit 2: I just found a "group" that shows live releases in the MB script, and the MB website under the discography listing shows an "artist" column the for group (The Crystal Method), but The Beach Boys shows no such "artist" column for their discography listing.  No idea if that's relevant or not to the script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-14 17:09:56
it's purely down to how many release groups the artist has. artists with a bigger back catalogue will exhibit this problem because i can only fetch 100 in a single request and i've never implemented pagination. albums are listed first, then compilations, then live releases, then singles and finally, EPs.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-14 17:12:45
Thanks for the explanation. 100 sounds good enough for the script's purposes, so knowing that limit  I'm fine with the existing script.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-14 17:49:59
no. i use a 3rd party webservice provided by the the echonest (http://developer.echonest.com/). last time i checked, it took about a week for a new edit to show on their site. the reason i use this and not last.fm directly is because i can get the full text for the article. last.fm only provide the first few sentences. my script will eventually show the edited page because it checks to see if the locally saved page is a day old. if it is, it checks for updates.

I'll wait and see how long the updates take to show up. A week seems like a very long time for updates. Hopefully its not always that long.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-14 17:58:48
no. i use a 3rd party webservice provided by the the echonest (http://developer.echonest.com/). last time i checked, it took about a week for a new edit to show on their site. the reason i use this and not last.fm directly is because i can get the full text for the article. last.fm only provide the first few sentences. my script will eventually show the edited page because it checks to see if the locally saved page is a day old. if it is, it checks for updates.


Why you don't want to use web page directly?
I modified your old bio text script, and i receive full bio text directly from last.fm> link (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=880255)
You can do this also for wikipedia...
Then user can also use different language etc..

@mire777
I tried your modified bio script. Works ok and I can see all updates immediately. Great! But for some reason it doesn't have any pagination/spacing. So the text shows up as one big paragraph. The original script shows paragraph spacing, so what changed?
FYI. Some time ago last.fm changed their policy to limit retrieving to the first few sentences, looks like they may have changed their policy again as the full text is being retrieved now.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-14 18:09:14
i was going to update it but i can't be bothered anymore. there's no reason to think the old one will stop working. if you need to download it again, it's here: https://dl.dropboxusercontent.com/u/2280132...mp/samples7.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/samples7.zip)

I tried using the  old now_playing script. It didn't work.

I changed the following line to use common8.
// @import "%fb2k_profile_path%marc2003\common8.js"

Now I get a error.
Error: WSH Panel Mod (Now Playing by marc2003): Microsoft JScript runtime error: 'images' is undefined

I noticed that the images are now in subfolders where as before they were in the root "images" folder. What do I have to do to get them working?

Thanks.

Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-11-14 18:14:28
i was going to update it but i can't be bothered anymore. there's no reason to think the old one will stop working. if you need to download it again, it's here: https://dl.dropboxusercontent.com/u/2280132...mp/samples7.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/samples7.zip)

I tried using the  old now_playing script. It didn't work.

I changed the following line to use common8.
// @import "%fb2k_profile_path%marc2003\common8.js"

Now I get a error.
Error: WSH Panel Mod (Now Playing by marc2003): Microsoft JScript runtime error: 'images' is undefined

I noticed that the images are now in subfolders where as before they were in the root "images" folder. What do I have to do to get them working?

Thanks.

I think you have to put common7.js inside your marc2003 folder ,mine works fine without any changes.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-14 18:45:53
i was going to update it but i can't be bothered anymore. there's no reason to think the old one will stop working. if you need to download it again, it's here: https://dl.dropboxusercontent.com/u/2280132...mp/samples7.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/samples7.zip)

Quote
I tried using the  old now_playing script. It didn't work.

I changed the following line to use common8.
// @import "%fb2k_profile_path%marc2003\common8.js"

Now I get a error.
Error: WSH Panel Mod (Now Playing by marc2003): Microsoft JScript runtime error: 'images' is undefined

I noticed that the images are now in subfolders where as before they were in the root "images" folder. What do I have to do to get them working?

Thanks.

I think you have to put common7.js inside your marc2003 folder ,mine works fine without any changes.

Just tried that and it doesn't work for me.  I get the following error. I even tried recreating the wsh panel. And moved the now_playing script into "samples".

Code: [Select]
WSH Panel Mod (Now Playing by marc2003): Parsing file "C:\....\foobar2000\marc2003\common7.js"
WSH Panel Mod (Now Playing by marc2003): initialized in 24 ms
Error: WSH Panel Mod (Now Playing by marc2003): Microsoft JScript runtime error:
Object required
File: C:\....\foobar2000\marc2003\common7.js
Ln: 1576, Col: 4
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-11-14 18:56:45
Did you place the "images" folder as well in the marc2003 folder from the common7 download?
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-14 19:08:50
Did you place the "images" folder as well in the marc2003 folder from the common7 download?

I think I would need the "images" folder from the common8 download to use the other newer scripts.
Update. I tried moving just the files from the old images folder to marc2003 but that didn't work either. Same error.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-14 19:42:02
here's a simplified now playing script to work with my new pack: https://dl.dropboxusercontent.com/u/2280132...w%20playing.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8/now%20playing.txt)

edit: if anyone downloaded this in the last 25 minutes, they should grab it again. i just fixed a silly bug...

because large chunks of underlying code have changed, i've had to get rid of some features...
no right click options to toggle things on/off. just edit the variables at the top of the script to false if you want.
no top/bottom option for trackinfo/rating. it's locked to the bottom.
no web links
thumbs are disabled. you can cycle through multiple images using your mouse wheel.
users of the old common7 script will need to run the migrate script in the full samples8.zip download if they want their images to show in this.

@mire777
FYI. Some time ago last.fm changed their policy to limit retrieving to the first few sentences, looks like they may have changed their policy again as the full text is being retrieved now.


he's not using the webservice. instead he's scraping the html source of the webpage to get it.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-11-14 21:35:46
@marc2003
I tried to to build a now playing script with with last fm play count sync button
I added the relevant function calls separately
But when i add  ps.metadb_changed();  in  function on_metadb_changed() methored i got this error:

Error: WSH Panel Mod (Thumbs by marc2003): Microsoft JScript runtime error:
'ps' is null or not an object
File: <main>
Ln: 148, Col: 5
<source text only available at compile time>

This is my full script:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common8.js"
// @name "Thumbs"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==



 //the track info section displays 3 lines of title formatted text. you can customise that here/////////////////////////////////////////////
var line1 = {
text: "", //leave this blank
tf: "%artist%", //enter any title formatting
font: gdi.Font("Segoe UI", 36, 1), //font name, size, style. 1 means bold and 0 is normal.
colour: RGB(240, 240, 240), //colour
y: 0 //change this value to move text up or down.
}
var line2 = {
text: "",
tf: "%title%",
font: gdi.Font("Segoe UI", 28, 1),
colour: RGB(210, 210, 210),
y: 38
}
var line3 = {
text: "",
tf: "[%album%]",
font: gdi.Font("Segoe UI", 20, 1),
colour: RGB(180, 180, 180),
y: 70
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////






var p = new panel("Thumbs", ["metadb", "remap", "custom_background"]);

window.SetProperty("2k3.musicbrainz_releases", false);
var li = new list("musicbrainz", 0, 0, 0, 0);
var th = new thumbs();
var r = new rating(0, 4, 24);
var bt = new buttons("playback");
var b = new buttons();
var bs = 32; //button size
var c = new cd(0, 0, p.w, p.h);
p.item_focus_change();
var l = new lastfm();
//function takes 3 values: x, y, size. see on_size function if you want to update these relative to panel width/height
var ps = new playcount_sync(3, 0, 32);

if (fb.IsPlaying) ps.playback_new_track();
else if (p.metadb) p.item_focus_change();
else ps.update_button();


bt.update = function() {
bt.buttons = {
stop: new button((p.w - bs*6) , p.h-bs*3, bs, bs, {normal: this.images.stop}, function() { fb.Stop(); }, "Stop"),
play: new button((p.w - bs*6)+bs, p.h-bs*3, bs, bs, {normal: !fb.IsPlaying || fb.IsPaused ? this.images.play : this.images.pause}, function() { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? "Play" : "Pause"),
previous: new button((p.w - bs*6)+bs * 2, p.h-bs*3, bs, bs, {normal: this.images.previous}, function() { fb.Prev(); }, "Previous"),
next: new button((p.w - bs*6)+bs * 3, p.h-bs*3, bs, bs, {normal: this.images.next}, function() { fb.Next(); }, "Next")
}
window.Repaint();
}

bt.update();

function on_playback_time() {
ps.playback_time();
}
function on_playback_time(time) {
th.playback_time(time);
 
   
}




function on_size() {
p.size();
    pos_x = 0;
    pos_y = p.h-15;
th.size();
    bt.update();
    r.x = p.w - 125;
r.y = p.h - 25;
c.w = 200;
c.h = 200;
    c.x=0;
    c.y=p.h-200;
    ps.x = p.w - 220;
ps.y = p.h - 95;
ps.update_button();
 
   
}

function on_paint(gr) {
p.draw_background(gr);
th.draw(gr);
    r.draw(gr);
   


    for (var i = 0; i < li.items; i++) {
p.draw_image(gr, li.musicbrainz_images[li.images[i]], pos_x + (i * 20), pos_y, 16, 16);
}
   
   
    gr.FillSolidRect(0, p.h-150, p.w, 110, RGBA(0, 0, 0, 196));
p.left_text(gr, line1.text, line1.font, line1.colour, 210, p.h-150, 500, line1.font.Height);
p.left_text(gr, line2.text, line2.font, line2.colour, 210, p.h-150+ line2.y, 500, line2.font.Height);
p.left_text(gr, line3.text, line3.font, line3.colour, 210, p.h-150 + line3.y, 500, line3.font.Height);
    c.draw(gr);   
    bt.draw(gr);
    b.draw(gr);   
}


function on_playback_stop() {
bt.update();
}

function on_playback_pause() {
bt.update();
}

function on_playback_starting() {
bt.update();
}



function on_metadb_changed() {
th.metadb_changed();
    r.metadb_changed();
    li.metadb_changed();
    c.metadb_changed();
    line1.text = p.eval(line1.tf);
    line2.text = p.eval(line2.tf);
    line3.text = p.eval(line3.tf);
    ps.metadb_changed();
}

function on_playback_new_track() {
ps.playback_new_track();
}


function on_playback_edited() {
ps.playback_edited();
}



function on_get_album_art_done(metadb, art_id, im, ip) {
c.get_album_art_done(ip);
}

function on_mouse_wheel(step) {
th.wheel(step);
}

function on_mouse_move(x, y) {
p.move(x, y);
th.move(x, y);
bt.move(x, y);
    r.move(x,y);
    //c.move(x, y);
    if (x > pos_x && x < pos_x + (li.items * 20) && y > pos_y && y < pos_y + 20) p.tt(li.urls[Math.floor((x - pos_x) / 20)]);
else p.ttd();
    b.move(x, y);

}

function on_mouse_lbtn_up(x, y) {
th.lbtn_up(x, y);
    r.lbtn_up(x,y);
    bt.lbtn_up(x, y);
    if (x > pos_x && x < pos_x + (li.items * 20) && y > pos_y && y < pos_y + 20) p.browser(li.urls[Math.floor((x - pos_x) / 20)]);
    b.lbtn_up(x, y);
}


function on_mouse_lbtn_dblclk(x, y) {
th.lbtn_dblclk(x, y);
    r.lbtn_dblclk(x, y);
    c.lbtn_dblclk(x, y);
}




Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-14 22:07:45
@mire777
I tried your modified bio script. Works ok and I can see all updates immediately. Great! But for some reason it doesn't have any pagination/spacing. So the text shows up as one big paragraph. The original script shows paragraph spacing, so what changed?
FYI. Some time ago last.fm changed their policy to limit retrieving to the first few sentences, looks like they may have changed their policy again as the full text is being retrieved now.

No, nothing was changed on last.fm..
If you use Last.fm API you cant receive full text, because last.fm service  truncated text to 300 char.
Instead this Marc use Echonest, which have directly access to last.fm page, and then this service provide text in json or xtml format.
But there is problem with text upadate , they do that one in week or one in month, i edited some bio and wait all month to appear .

What this script does is to have direct access to last.fm web page, no API no other services, no echonest.
This is only test to show that this work, so i didn't fix ''spacing''' there.

Here's fix for ''spacing'':

Code: [Select]
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

FontTypeCUI = {
items: 0,
labels: 1
};

ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
};

FontTypeDUI = {
defaults: 0,
tabs: 1,
lists: 2,
playlists: 3,
statusbar: 4,
console: 5
};

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

function get_font() {
if (g_instancetype == 0) {
g_font = window.GetFontCUI(FontTypeCUI.items);
} else if (g_instancetype == 1) {
g_font = window.GetFontDUI(FontTypeDUI.defaults);
}
}

function get_colors() {
if (g_instancetype == 0) {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
} else if (g_instancetype == 1) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_font_changed() {
get_font();
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

g_instancetype = window.InstanceType;
get_font();
get_colors();


g_metadb = fb.GetFocusItem();
var artist = g_text = '';
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);

                   
            var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
            var str = "id=\"wiki\">";
            st = text.indexOf(str, st) + str.length;
            var et = text.indexOf("</div>", st);
            var artt = text.substr(st, et - st);
            var ar = artt;
               
            var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---");
            fb.trace("bio: " + ar);
            {save_file(ar);};
                }
                   
                this.doc.close();
               
} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
}}}}

function save_file(x) {
try {
g_text = x;
g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "").replace(/<br>/g,"---");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = g_text;
g_text = div.innerHTML;

//Check if biography exist
if (g_text.indexOf("TYPE")==0) {g_text = "This artist does not have a biography";}
else
{g_text = g_text;}

} catch(e) {
g_text = "This artist does not have a biography";
}
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(g_text);
ts.close();
} catch(e) {
g_text = "Error saving biography for this artist";
}
calc();
}

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
if(g_metadb) {
gr.GdiDrawText(g_text.replace(/---/g,"\n"), g_font, g_textcolor, 6, offset + 8, ww-16, wh-offset-16,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
gr.FillSolidRect(-1000, -1000, ww, 38, g_backcolor);
//gr.GdiDrawText(artist, gdi.Font("Segoe UI", 16, 1), g_textcolor_hl, 6, 5, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
//gr.DrawLine(5, 29, ww-10, 29, 1, RGB(137,140,149));
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)
filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
if(fso.fileExists(filename)) {
try {
ts = fso.OpenTextFile(filename,1, false, -1);
g_text = ts.ReadAll();
ts.close();
} catch(e) {
g_text = "Error opening file!";
}
calc();
} else {
get_bio();
}
}

function calc() {
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
offset = 0;
window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Force update");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) get_bio();
if(idx == 2) window.ShowConfigure();
_menu.Dispose();
return true;
}

function on_mouse_wheel(delta) {
step = g_font.height;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;
} else {
temp = -textheight + wh;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: Reith on 2014-11-14 23:24:28
The new now playing script works great, thank you.
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-14 23:48:42
@mire777
I tried your modified bio script. Works ok and I can see all updates immediately. Great! But for some reason it doesn't have any pagination/spacing. So the text shows up as one big paragraph. The original script shows paragraph spacing, so what changed?
FYI. Some time ago last.fm changed their policy to limit retrieving to the first few sentences, looks like they may have changed their policy again as the full text is being retrieved now.

No, nothing was changed on last.fm..
If you use Last.fm API you cant receive full text, because last.fm service  truncated text to 300 char.
Instead this Marc use Echonest, which have directly access to last.fm page, and then this service provide text in json or xtml format.
But there is problem with text upadate , they do that one in week or one in month, i edited some bio and wait all month to appear .

What this script does is to have direct access to last.fm web page, no API no other services, no echonest.
This is only test to show that this work, so i didn't fix ''spacing''' there.

Here's fix for ''spacing'':

Code: [Select]
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

FontTypeCUI = {
items: 0,
labels: 1
};

ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
};

FontTypeDUI = {
defaults: 0,
tabs: 1,
lists: 2,
playlists: 3,
statusbar: 4,
console: 5
};

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

function get_font() {
if (g_instancetype == 0) {
g_font = window.GetFontCUI(FontTypeCUI.items);
} else if (g_instancetype == 1) {
g_font = window.GetFontDUI(FontTypeDUI.defaults);
}
}

function get_colors() {
if (g_instancetype == 0) {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
} else if (g_instancetype == 1) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_font_changed() {
get_font();
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

g_instancetype = window.InstanceType;
get_font();
get_colors();


g_metadb = fb.GetFocusItem();
var artist = g_text = '';
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);

                   
            var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
            var str = "id=\"wiki\">";
            st = text.indexOf(str, st) + str.length;
            var et = text.indexOf("</div>", st);
            var artt = text.substr(st, et - st);
            var ar = artt;
               
            var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---");
            fb.trace("bio: " + ar);
            {save_file(ar);};
                }
                   
                this.doc.close();
               
} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
}}}}

function save_file(x) {
try {
g_text = x;
g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "").replace(/<br>/g,"---");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = g_text;
g_text = div.innerHTML;

//Check if biography exist
if (g_text.indexOf("TYPE")==0) {g_text = "This artist does not have a biography";}
else
{g_text = g_text;}

} catch(e) {
g_text = "This artist does not have a biography";
}
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(g_text);
ts.close();
} catch(e) {
g_text = "Error saving biography for this artist";
}
calc();
}

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
if(g_metadb) {
gr.GdiDrawText(g_text.replace(/---/g,"\n"), g_font, g_textcolor, 6, offset + 8, ww-16, wh-offset-16,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
gr.FillSolidRect(-1000, -1000, ww, 38, g_backcolor);
//gr.GdiDrawText(artist, gdi.Font("Segoe UI", 16, 1), g_textcolor_hl, 6, 5, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
//gr.DrawLine(5, 29, ww-10, 29, 1, RGB(137,140,149));
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)
filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
if(fso.fileExists(filename)) {
try {
ts = fso.OpenTextFile(filename,1, false, -1);
g_text = ts.ReadAll();
ts.close();
} catch(e) {
g_text = "Error opening file!";
}
calc();
} else {
get_bio();
}
}

function calc() {
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
offset = 0;
window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Force update");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) get_bio();
if(idx == 2) window.ShowConfigure();
_menu.Dispose();
return true;
}

function on_mouse_wheel(delta) {
step = g_font.height;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;
} else {
temp = -textheight + wh;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}

Works great. Thanks!
I noticed that the retrieved text is being displayed in the foobar console. Can that be stopped?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-14 23:57:53
@marc2003
I tried to to build a now playing script with with last fm play count sync button


i fixed it up for you. http://pastebin.com/EWbdwVri (http://pastebin.com/EWbdwVri)

with playcount sync in the panel, you can't have a choice of prefer now playing/follow selected track. it must always prefer the playing track. also take a look at what i've done to the mouse move/click functions to make them work.

i presume you're going to do more work on it? it's hard to see those icons without a contrasting background and the button positioning is a bit odd too?? 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-15 01:13:00
Works great. Thanks!
I noticed that the retrieved text is being displayed in the foobar console. Can that be stopped?

Yes.
Here is new script:

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Text"
// @author "Mire777"
// ==/PREPROCESSOR==

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

FontTypeCUI = {
items: 0,
labels: 1
};

ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
};

FontTypeDUI = {
defaults: 0,
tabs: 1,
lists: 2,
playlists: 3,
statusbar: 4,
console: 5
};

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

function get_font() {
if (g_instancetype == 0) {
g_font = window.GetFontCUI(FontTypeCUI.items);
} else if (g_instancetype == 1) {
g_font = window.GetFontDUI(FontTypeDUI.defaults);
}
}

function get_colors() {
if (g_instancetype == 0) {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
} else if (g_instancetype == 1) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_font_changed() {
get_font();
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

g_instancetype = window.InstanceType;
get_font();
get_colors();


g_metadb = fb.GetFocusItem();
var artist = g_text = '';
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);


var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "id=\"wiki\">";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</div>", st);
var artt = text.substr(st, et - st);
var ar = artt;

var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---");
//fb.trace("bio: " + ar);
{save_file(ar);};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
}}}}

function save_file(x) {
try {
g_text = x;
g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "").replace(/<br>/g,"---");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = g_text;
g_text = div.innerHTML;

//Check if biography exist
if (g_text.indexOf("TYPE")==0) {g_text = "This artist does not have a biography";}
else
{g_text = g_text;}

} catch(e) {
g_text = "This artist does not have a biography";
}
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(g_text);
ts.close();
} catch(e) {
g_text = "Error saving biography for this artist";
}
calc();
}

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
if(g_metadb) {
gr.GdiDrawText(g_text.replace(/---/g,"\n"), g_font, g_textcolor, 6, offset + 8, ww-16, wh-offset-16,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
gr.FillSolidRect(-1000, -1000, ww, 38, g_backcolor);
//gr.GdiDrawText(artist, gdi.Font("Segoe UI", 16, 1), g_textcolor_hl, 6, 5, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
//gr.DrawLine(5, 29, ww-10, 29, 1, RGB(137,140,149));
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)
filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
if(fso.fileExists(filename)) {
try {
ts = fso.OpenTextFile(filename,1, false, -1);
g_text = ts.ReadAll();
ts.close();
} catch(e) {
g_text = "Error opening file!";
}
calc();
} else {
get_bio();
}
}

function calc() {
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
offset = 0;
window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Force update");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) get_bio();
if(idx == 2) window.ShowConfigure();
_menu.Dispose();
return true;
}

function on_mouse_wheel(delta) {
step = 50;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;
} else {
temp = -textheight + wh-5000;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-15 02:25:18
@Marc.
Can you look at this code please?
I use this script to receive bio from wikipedia, but i have high cpu on scroll text.
Don't know where is the problem?


Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Wikipedia"
// @author "Mire777"
// ==/PREPROCESSOR==

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

FontTypeCUI = {
items: 0,
labels: 1
};

ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
};

FontTypeDUI = {
defaults: 0,
tabs: 1,
lists: 2,
playlists: 3,
statusbar: 4,
console: 5
};

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

function get_font() {
if (g_instancetype == 0) {
g_font = window.GetFontCUI(FontTypeCUI.items);
} else if (g_instancetype == 1) {
g_font = window.GetFontDUI(FontTypeDUI.defaults);
}
}

function get_colors() {
if (g_instancetype == 0) {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
} else if (g_instancetype == 1) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_font_changed() {
get_font();
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

g_instancetype = window.InstanceType;
get_font();
get_colors();


g_metadb = fb.GetFocusItem();
var artist = g_text = '';
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://en.wikipedia.org/wiki/" + encodeURIComponent(artist) + "", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i]);

                   
            var st = text.indexOf( data[i].className.replace("about:/wiki/", ""));
            var str = "<p>";
            st = text.indexOf(str, st) + str.length;
            var et = text.indexOf("</html>", st);
            var artt = text.substr(st, et - st);
            var ar = artt;
               
            var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&");
            //fb.trace("bio: " + ar);
            {save_file(ar);};
                }
                   
                this.doc.close();
               
} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
}}}}

function save_file(x) {
try {
g_text = x;
g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "").replace(/<br>/g,"---");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = g_text;
g_text = div.innerHTML;

//Check if biography exist
if (g_text.indexOf("TYPE")==0) {g_text = "This artist does not have a biography";}
else
{g_text = g_text;}

} catch(e) {
g_text = "This artist does not have a biography";
}
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(g_text);
ts.close();
} catch(e) {
g_text = "Error saving biography for this artist";
}
calc();
}

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
if(g_metadb) {
gr.GdiDrawText(g_text.replace(/---/g,"\n").replace(/amp;/g,""), g_font, g_textcolor, 6, offset + 8, ww-16, wh-offset-16,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
gr.FillSolidRect(-1000, -1000, ww, 38, g_backcolor);
//gr.GdiDrawText(artist, gdi.Font("Segoe UI", 16, 1), g_textcolor_hl, 6, 5, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
//gr.DrawLine(5, 29, ww-10, 29, 1, RGB(137,140,149));
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)
filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
if(fso.fileExists(filename)) {
try {
ts = fso.OpenTextFile(filename,1, false, -1);
g_text = ts.ReadAll();
ts.close();
} catch(e) {
g_text = "Error opening file!";
}
calc();
} else {
get_bio();
}
}

function calc() {
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
offset = 0;
window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Force update");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) get_bio();
if(idx == 2) window.ShowConfigure();
_menu.Dispose();
return true;
}

function on_mouse_wheel(delta) {
step = 50;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;
} else {
temp = -textheight + wh-5000;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-11-15 03:56:35
@marc2003
I tried to to build a now playing script with with last fm play count sync button


i fixed it up for you. http://pastebin.com/EWbdwVri (http://pastebin.com/EWbdwVri)

with playcount sync in the panel, you can't have a choice of prefer now playing/follow selected track. it must always prefer the playing track. also take a look at what i've done to the mouse move/click functions to make them work.

i presume you're going to do more work on it? it's hard to see those icons without a contrasting background and the button positioning is a bit odd too?? 

Thanks for improvements and fixing the code @marc2003  . I'm still trying to get to the buttons positioned by relatively to the panel. Your comments in your scripts has been a great help.Still a WIP
I 'm trying to get last fm tags with autoplaylist links under track info (seperated by commas ) any thoughts on that??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-15 13:18:18
I use this script to receive bio from wikipedia, but i have high cpu on scroll text.


i'm not sure you ventured so far into the past find a script to modify?? IIRC, that's one of the originals that comes bundled with the component itself? you've even posted modifications of my scripts before that don't have any of the problems that one does. the main issues i see are insane CPU usage, you can't read all content because scrolling won't let you get to the end and dodgy character replacement. i might have a go and making something a bit more usable later. i must admit, i have no idea how you're getting the content. i don't understand what you've written at all. 

I 'm trying to get last fm tags with autoplaylist links under track info (seperated by commas ) any thoughts on that??


if you have the small web links function in your panel, you cannot use last.fm tags at all. the one limitation is that you can't have more than one instance of something using the same object... (actually, this isn't strictly true but it is for most of them)

small web links needs this...

Code: [Select]
var li = new list("musicbrainz", 0, 0, 0, 0);


and the last.fm script needs this...

Code: [Select]
var li = new list("lastfm", 6, 30, p.w - 12, p.h - 30);


as they both use the list function, you can only have one.

if you decided to get rid of small web links, it's a lot more work to get text values display on the same line and have mouse click functionality work. you have to consider the width of every value and append that to the previous value when displaying the 2nd, 3rd, 4th value etc.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-15 14:43:23
i have no idea how you're getting the content. i don't understand what you've written at all. 

Just this:

For Wikipedia:

(It goes from <p> to </html> in web page where is text.)

Code: [Select]
function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://en.wikipedia.org/wiki/" + encodeURIComponent(artist) + "", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i]);


var st = text.indexOf( data[i].className);
var str = "<p>";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</html>", st);
var artt = text.substr(st, et - st);
var ar = artt;

var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&");

//Func. to save text
//fb.trace("bio: " + ar);
//{save_file(ar);};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
}}}}


And for Last.fm:

(It goes from id=''wiki''> to </div> in web page)

Code: [Select]
function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);


var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "id=\"wiki\">";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</div>", st);
var artt = text.substr(st, et - st);
var ar = artt;

var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---");

//Func. to save text
//fb.trace("bio: " + ar);
//{save_file(ar);};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
}}}}


Very useful because this can be used for other sites too..
Problem is insane CPU usage on scroll, because this old script i modified cause this.
You can use this part for your bio script, and should work fine..
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-15 22:51:43
Works great. Thanks!
I noticed that the retrieved text is being displayed in the foobar console. Can that be stopped?

Yes.
Here is new script:

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Text"
// @author "Mire777"
// ==/PREPROCESSOR==

DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000;

ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

FontTypeCUI = {
items: 0,
labels: 1
};

ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
};

FontTypeDUI = {
defaults: 0,
tabs: 1,
lists: 2,
playlists: 3,
statusbar: 4,
console: 5
};

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

function get_font() {
if (g_instancetype == 0) {
g_font = window.GetFontCUI(FontTypeCUI.items);
} else if (g_instancetype == 1) {
g_font = window.GetFontDUI(FontTypeDUI.defaults);
}
}

function get_colors() {
if (g_instancetype == 0) {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
} else if (g_instancetype == 1) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_font_changed() {
get_font();
window.Repaint();
}

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
try { on_metadb_changed(); } catch(e) {}
window.WatchMetadb(g_metadb);
}
}

g_instancetype = window.InstanceType;
get_font();
get_colors();


g_metadb = fb.GetFocusItem();
var artist = g_text = '';
folder = fb.ProfilePath + "wsh_lastfm";
fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
on_item_focus_change();

String.prototype.count=function(s1) {
return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;
}

function get_bio() {

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);


var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "id=\"wiki\">";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</div>", st);
var artt = text.substr(st, et - st);
var ar = artt;

var ar = ar.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---");
//fb.trace("bio: " + ar);
{save_file(ar);};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
}}}}

function save_file(x) {
try {
g_text = x;
g_text = g_text.replace(/<\/?[^>]+(>|$)/g, "").replace(/<br>/g,"---");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = g_text;
g_text = div.innerHTML;

//Check if biography exist
if (g_text.indexOf("TYPE")==0) {g_text = "This artist does not have a biography";}
else
{g_text = g_text;}

} catch(e) {
g_text = "This artist does not have a biography";
}
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(g_text);
ts.close();
} catch(e) {
g_text = "Error saving biography for this artist";
}
calc();
}

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);
if(g_metadb) {
gr.GdiDrawText(g_text.replace(/---/g,"\n"), g_font, g_textcolor, 6, offset + 8, ww-16, wh-offset-16,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
gr.FillSolidRect(-1000, -1000, ww, 38, g_backcolor);
//gr.GdiDrawText(artist, gdi.Font("Segoe UI", 16, 1), g_textcolor_hl, 6, 5, ww-77, 24,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
//gr.DrawLine(5, 29, ww-10, 29, 1, RGB(137,140,149));
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb || artist == fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb)
filename = folder + "\\" + fb.TitleFormat("$crc32(%artist%).txt").EvalWithMetadb(g_metadb);
if(fso.fileExists(filename)) {
try {
ts = fso.OpenTextFile(filename,1, false, -1);
g_text = ts.ReadAll();
ts.close();
} catch(e) {
g_text = "Error opening file!";
}
calc();
} else {
get_bio();
}
}

function calc() {
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh/2) + (g_text.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
offset = 0;
window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Force update");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) get_bio();
if(idx == 2) window.ShowConfigure();
_menu.Dispose();
return true;
}

function on_mouse_wheel(delta) {
step = 50;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;
} else {
temp = -textheight + wh-5000;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-15 23:29:23
i just fixed a rather embarrassing bug in my new scripts - when changing the font size in scripts that display text, the number of rows wasn't recalculated. right click panel>Update script.

full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

my old scripts are fine, i just fudged up during the update. 
Title: WSH Panel Mod script discussion/help
Post by: hurricane on 2014-11-15 23:41:22
here's a simplified now playing script to work with my new pack: https://dl.dropboxusercontent.com/u/2280132...w%20playing.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8/now%20playing.txt)

edit: if anyone downloaded this in the last 25 minutes, they should grab it again. i just fixed a silly bug...

because large chunks of underlying code have changed, i've had to get rid of some features...
no right click options to toggle things on/off. just edit the variables at the top of the script to false if you want.
no top/bottom option for trackinfo/rating. it's locked to the bottom.
no web links
thumbs are disabled. you can cycle through multiple images using your mouse wheel.
users of the old common7 script will need to run the migrate script in the full samples8.zip download if they want their images to show in this.

@marc2003
Thanks much for updating this script!!  I know you said you weren't going to bother but it has really helped and is much appreciated. I got used to using it over the years and somehow foobar didn't feel the same not having it has my main panel. Getting set in my ways I guess.

Although you said thumbs are disabled - the timed cycling is working for me. Which is what i use most. So added bonus! Thanks again!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-16 00:04:39
@mire777, i've been messing around making a script that accesses wikipedia directly but the problem is disambiguation. so many artists/bands share names with common words or phrases and i have no idea how to narrow the search. my googling has failed me so far and i can't be bothered anymore. i'll continue with the echonest.

here's a fixed last.fm bio script though. double clicking the panel updates it instantly.

https://dl.dropboxusercontent.com/u/2280132...temp/lastfm.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/lastfm.txt) (requires latest samples8.zip)

you can always add your own wikipedia bit into the status code 200 bit of the get function and make sure you edit the filename on line 31.

Code: [Select]
t.filename = t.folder + "lastfm.txt";


only edit the bit in quotes. the folders are automatically created for you.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-16 15:00:30
i've updated the new now playing script with a button in the top right corner. it only appears when your mouse is over the panel and it provides an easy means to toggle things on/off.

(https://dl.dropboxusercontent.com/u/22801321/2014/november/np.png)

script for existing users: https://dl.dropboxusercontent.com/u/2280132...w%20playing.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8/now%20playing.txt)
it's also been added to the full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

edit: oops, i bodged the upload 10 minutes ago. it's unlikely anyone has even read this let alone downloaded it but it would need downloading again if you have.

edit2: description added to website: http://marc2003.x10host.com/now-playing (http://marc2003.x10host.com/now-playing)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-17 04:37:17
@mire777, i've been messing around making a script that accesses wikipedia directly but the problem is disambiguation. so many artists/bands share names with common words or phrases and i have no idea how to narrow the search. my googling has failed me so far and i can't be bothered anymore. i'll continue with the echonest.

here's a fixed last.fm bio script though. double clicking the panel updates it instantly.

https://dl.dropboxusercontent.com/u/2280132...temp/lastfm.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/lastfm.txt) (requires latest samples8.zip)

you can always add your own wikipedia bit into the status code 200 bit of the get function and make sure you edit the filename on line 31.

Code: [Select]
t.filename = t.folder + "lastfm.txt";


only edit the bit in quotes. the folders are automatically created for you.


Thanks Marc, works great.
But how to put all in one script?
Actually i don't know where in common8 to look, there are bunch of stuff
If you can help me with one script instead. Thanks.

I want to use this in my DUI config.
Then i can always modify script if something on site change, or use other source.
I already did that with Thumbs script, but if i must again to analize code, uhhhhhhh
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-17 07:40:11
@marc2003

With common8 the new autoplaylists script crashes, for me.
Downloaded full version from yesterday's post.

[09:35:13] Error: WSH Panel Mod (Autoplaylists by marc2003): Microsoft JScript runtime error:
'b.buttons.add' is null or not an object
File: <main>
Ln: 14, Col: 2
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-17 08:16:08
i last edited that file on the 4th of november but forgot to put it inside the zip. thanks for spotting it. 

direct link to save downloading the whole zip again: https://dl.dropboxusercontent.com/u/2280132...toplaylists.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8/autoplaylists.txt)

Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2014-11-17 13:17:17
i last edited that file on the 4th of november but forgot to put it inside the zip. thanks for spotting it. 

direct link to save downloading the whole zip again: https://dl.dropboxusercontent.com/u/2280132...toplaylists.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8/autoplaylists.txt)


Where i put this text ? Because i have this message :

The script reports that the update file has not been found. It could be a temporary problem with dropbox but if this error persists then it is most likely due to support stopping for this version. Check the hydrogenaudio thread or the full zip for updates.

http://www.hydrogenaud.io/forums/index.php?showtopic=77883 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883)
https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-17 17:20:40
it's probably hard to follow this thread but that script only works with my latest package of samples available here: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

you'd need to extract the whole marc2003 folder into your profile if you want to use it.

@mire777, i'm not re-writing to a single file. the whole point of that code i gave you was so that you have full and absolute control over everything it does with regards to fetching/processing the text response without ever having to touch the common file. all that does is manage the text display and scrolling. it also handles things like letting the user use the right click menu to prefer now playing/follow selected track, set font sizes and use artist field remapping. everything else is controllable by you. you might have been put off by my code that creates the folders so we'll ignore that and i'll show you how to use any folder/filename structure you like. i'll put together a "dummies" guide later.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-17 19:13:29
right.... *deep breath*. here's a guide to creating a full customisable script for fetching online text and displaying it.

***PART ONE***

as mentioned before, you need my samples 8 pack: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

we'll start with a blank panel....

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common8.js"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==


you can add your own @name & @author here but do not change the rest.

next we'll add these 2 lines....

Code: [Select]
var p = new panel("My Super Script", []);
p.console("Hello world!");


click OK to close the editor.

in the foobar console, you should see something like

Code: [Select]
WSH Panel Mod ({9991F8EC-9361-42E0-9561-A6F78C5C4C5E}): Parsing file "D:\Applications\foobar2000\marc2003\common8.js"
My Super Script: Hello world!


basically the text My Super Script can be anything you want and you don't have to worry about it conflicting with anything else because it's only used for console messages and dialog inputs. you can access it with p.name. therefore p.console(message) is just short for fb.trace(p.name + ": " + message)

now if you right click the panel, you'll only find 2 options: Update script and Configure. we'll use Configure to open the editor again. remove the p.console line and we'll consider the options we can add to our panel.

first we want to decide how the panel behaves with regards to preferring the playing track or selected item. to give the user full control, we simply declare "metadb" in our first line of code...

Code: [Select]
var p = new panel("My Super Script", ["metadb"]);


click OK to close the panel, right click and you now have the following menu available.

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-18 03:24:36
@mire777, i'm not re-writing to a single file. the whole point of that code i gave you was so that you have full and absolute control over everything it does with regards to fetching/processing the text response without ever having to touch the common file. all that does is manage the text display and scrolling. it also handles things like letting the user use the right click menu to prefer now playing/follow selected track, set font sizes and use artist field remapping. everything else is controllable by you. you might have been put off by my code that creates the folders so we'll ignore that and i'll show you how to use any folder/filename structure you like. i'll put together a "dummies" guide later.

....PART TWO will show how to display some more interesting text. tongue.gif


Ok, thanks for guide Marc
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-18 03:53:24
i was planning to post part 2 earlier but i got waylaid updating my web pages instead. documentation for my last.fm playcount sync script is now online (http://marc2003.x10host.com/lastfm-playcount-sync). a few other pages have a bit more content as well (but not much).

i've got a good chunk of it done but it's too incomplete to post yet.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2014-11-18 09:04:32
If I keep an old script artist pics and now playing it will download ALL images from last.fm?

I have the panel on last.fm but my last.fm plays remain at 0 when I read on foobar

In fact I like the layout of the ancient scripts, if I do not update it does not matter? I would still have the same info in such a long time in 2/3 years?

If last.fm changes its "code" I am blown?
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-18 12:51:55
@marc2003

I guess you are busy with your website guide and customizing guides, but could you look into the possibility of using mtv's artist pages for scraping photos.
lastfm +image is really slow!!!!!!

eg. http://www.mtv.com/artists/madonna/photos/ (http://www.mtv.com/artists/madonna/photos/)
Artists with space use - ( eg. Killswitch Engage) http://www.mtv.com/artists/killswitch-engage/photos/ (http://www.mtv.com/artists/killswitch-engage/photos/)


The site also has bio's , news ,etc.

http://www.mtv.com/artists/madonna/biography/ (http://www.mtv.com/artists/madonna/biography/)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-18 16:17:29
If last.fm changes its "code" I am blown?


yep. if you're happy with the old ones then carry on. the only difference is that i won't be supporting them if something happens to break them.

lastfm +image is really slow!!!!!!


i remember putting a notice in my script when i first made it saying it was a bit slower than i expected but actually, it's got pretty fast recently. it barely takes a second or two now.

i'm not really interested in mtv but when i post part two of my guide later, it should be easy enough for someone like mire777 to figure out.


Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-18 18:17:15
lastfm +image is really slow!!!!!!


i remember putting a notice in my script when i first made it saying it was a bit slower than i expected but actually, it's got pretty fast recently. it barely takes a second or two now.

i'm not really interested in mtv but when i post part two of my guide later, it should be easy enough for someone like mire777 to figure out.


Let me poke you with something you might find interesting.......

Music Artwork @ fanart.tv
https://fanart.tv/music-fanart/ (https://fanart.tv/music-fanart/)
http://docs.fanarttv.apiary.io/ (http://docs.fanarttv.apiary.io/)


HD CLEARLOGO
CLEARLOGO
BACKGROUND
CDART
ALBUM COVER
ARTIST THUMB
BANNER

Search with Musicbrainz Artist ID or release-group.
API included.
All HD Artwork / Transparent.

eg. https://fanart.tv/artist/4bd95eea-b9f6-4d70...6c-cfea77431553 (https://fanart.tv/artist/4bd95eea-b9f6-4d70-a36c-cfea77431553)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-18 22:40:57
I guess you are busy with your website guide and customizing guides, but could you look into the possibility of using mtv's artist pages for scraping photos.
lastfm +image is really slow!!!!!!


You can scrap any photo from any website if Marc do same as it was already with Last.fm bio script.
You can then modify script how you like..
I already do this with Last.fm bio text, now i would like to do same for thumbs, and to include google and yahoo there.
So Marc , can this part ''this.download'' be moved in 2nd script?
Thanks.
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2014-11-19 09:18:07
marc2003, one question if you're not too busy.

In Thumbs script (maybe older version), is it possible to make foobar display specific images from the custom folder? In my specific case, I'd like it to display images based on tag, so if my custom tag %dynamic range% has value of 14 for specific track, would like Thumbs script to display 14.jpg/png from custom folder. So far, my syntax combinations didn't work, displays the first image (if no Cycle) only.

Cheers.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-19 14:46:28
no. those scripts are designed to display all images in a given folder without caring about the filenames inside.

it would actually be easier for you to configure the main foobar preferences and look at a type you don't use like back or disc and configure that with some thing like

d:\my dr images\%dynamic range%.*

then use the normal artwork panel or my artreader script and configure it to display that type.
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2014-11-19 15:14:17
Great idea, and it worked perfectly! Much appreciated again.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2014-11-20 08:49:30
I have foobar, i extract only marc2003 folder ?

After right click in script > configure > load ?

Because i see import migration scripts but i don't know what it is

My last.fm script don't move

And can't have bio

(http://image.noelshack.com/fichiers/2014/47/1416475003-sans-titre.png)
(http://image.noelshack.com/fichiers/2014/47/1416476131-sans-titre.png)

And how i can import this foobar portable installation in my normal installation ?

(http://image.noelshack.com/fichiers/2014/47/1416476581-sans-titre.png)
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2014-11-20 09:56:48
And finally, do I UPDATE ONLY scripts that I want? (Art reader, artist bio, and similar artists) and leave others? If so how?

(I want mean with your .txt files)

And after that, when i have install etc, how backup foobar for other PC ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-20 11:48:30
Because i see import migration scripts but i don't know what it is


i must admit, i didn't word the readme very well so i've had another go:

Quote
When I made the original "Thumbs" & "Now playing" scripts, I was very lazy when it came
to creating folder names to save images in. I created one folder per artist using the
foobar2000 $crc32 title formatting function which created a bunch of randomly numbered
folders. These are stored inside a folder named "wsh_lastfm" inside your foobar2000
profile.

This new script creates new folders using the actual artist name so this means it won't
recognise any images that you have previously saved. I know people have
built up large collections of art they won't want to lose which is why I've created this
script. It checks all artists in your foobar2000 library and then matches them against
the old folders and moves them into a new folder named "wsh_data" inside your foobar2000
profile. Now when you import the new "thumbs.txt" or "now playing.txt" into a panel, it
should display all your previous images just fine.

At the moment, this script will ignore any old folders that were created by playing artists
that are not in your library.

Before using "migrate.txt" in a panel, make sure you backup your "wsh_lastfm" folder.
This script will destroy it's contents so you'll want a copy just incase this does not work
as expected.


any customisations that you may have made to old scripts will be lost if you upgrade because you have to replace all the scripts in your panels with the .txt files from my new zip.

you can run new and old side by side but i don't see much point to that. if you're going to use at least one new script, you might as well upgrade them all.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2014-11-20 13:02:16
Oh great thank's for reply  i try it

And how i can import this portable installation in my normal installation ?

(http://image.noelshack.com/fichiers/2014/47/1416476581-sans-titre.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-20 13:10:30
you are joking, right? i was thinking i recently answered a similar question and after checking, it was you. 

http://www.hydrogenaud.io/forums/index.php?showtopic=107334 (http://www.hydrogenaud.io/forums/index.php?showtopic=107334)
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2014-11-20 13:17:57
Yes yes yes yes yes but it's another install dude

And for now playing y have this

(http://image.noelshack.com/fichiers/2014/47/1416476131-sans-titre.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-20 14:31:26
the instructions for that install are no different. also, you seem to have a stray floating rectangle in your script???
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2014-11-20 14:42:32
the instructions for that install are no different. also, you seem to have a stray floating rectangle in your script???


Have this

http://pastie.org/private/zraqskbfzomorwvwezdgq (http://pastie.org/private/zraqskbfzomorwvwezdgq)

I think it's for text of bio but doesn't have text info (bio) :/
Title: WSH Panel Mod script discussion/help
Post by: Takaji on 2014-11-23 22:58:23
I'm editing an existing WSH script I found in another user's layout. It displays a cover image and a few other neat things. However, if the cover image is not in a 1:1 ratio, it inserts white padding to make the cover image 1:1. I'd like to turn this off but I'm not very good with Javascript.

I think it might be in the CalcNewImgSize() function, but I can't be sure. Can anyone tell me if I'm going in the right direction?

Code: [Select]
function CalcNewImgSize (img, dstW, dstH, srcW,srcH, strch, kar, fill) {        // Calculate image's new size and offsets in new width and height range. 
if (!img) return;
if (!srcW) srcW = img.width;
if (!srcH) srcH = img.height;
if (strch==undefined) strch = Properties.Image.Stretch;
if (kar==undefined) kar = Properties.Image.KeepAspectRatio;
    if (fill==undefined) fill = Properties.Image.Fill;
   
var size;
    if(fill){
        size = {x:0, y:0, w:dstW, h:dstH};
        if(srcH/srcW < dstH/dstW)
            size.w = Math.ceil(srcW*dstH/srcH);
        else
            size.h = Math.ceil(srcH*dstW/srcW);
    } else if (strch) {
        size = {x:0, y:0, w:dstW, h:dstH};
if (kar) {
size.w = Math.ceil(srcW*dstH/srcH);
if (size.w>dstW) {
size.w = dstW;
size.h = Math.ceil(srcH*dstW/srcW);
}
}
} else {
        size = {x:0, y:0, w:srcW, h:srcH};
if (kar) {
if (srcH>dstH) {
size.h = dstH;
size.w = Math.ceil(srcW*dstH/srcH);
}
if (size.w>dstW) {
size.w = dstW;
size.h = Math.ceil(srcH*dstW/srcW);
}
} else {
size.w = Math.min(srcW, dstW);
size.h = Math.min(srcH, dstH);
}
}
size.x = Math.floor((dstW-size.w)/2);
size.y = Math.floor((dstH-size.h)/2);
return size;
}

The entire code is here: http://pastebin.com/9Nj4cTW3 (http://pastebin.com/9Nj4cTW3)

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-24 00:17:04
from a quick glance at that, it already appears to support different display options like fill, stretch and keep aspect. are you sure there aren't any options on the right click menu or in the panel properties?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-24 04:52:08
finally, i've uploaded a full customisation page. it's bound to be full of typos and errors.

http://marc2003.x10host.com/customisation (http://marc2003.x10host.com/customisation)

it doesn't cover topics like fetching stuff off the internet yet. i'll get round to it oneday. 
Title: WSH Panel Mod script discussion/help
Post by: Takaji on 2014-11-24 10:07:06
from a quick glance at that, it already appears to support different display options like fill, stretch and keep aspect. are you sure there aren't any options on the right click menu or in the panel properties?


Yep, I tried playing around with those options... there's nothing to remove the extra white space added to the image to make it 1:1.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-24 11:47:25
i suggest going back to whoever made it?? i can't see anyone else wanting to trawl 2000 lines of code they didn't write to figure it out. i don't mind helping out with little code snippets but i'm not even going to attempt to look at that.

edit: maybe someone more generous than me will take a look for you??
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-11-24 14:25:30
finally, i've uploaded a full customisation page. it's bound to be full of typos and errors.

http://marc2003.x10host.com/customisation (http://marc2003.x10host.com/customisation)

it doesn't cover topics like fetching stuff off the internet yet. i'll get round to it oneday. 


Really nice tutorial for beginners marc, I really appreciate it
It's so much easy to have website because it's really a pain to find anything in this long thread.
Title: WSH Panel Mod script discussion/help
Post by: rovopio on 2014-11-24 23:39:47
hi marc2003, it's rovopio.

haha

i googled a bit and found this on deviant art..

http://marc2k3.deviantart.com/art/yuck-foo...arc2k3&qo=0 (http://marc2k3.deviantart.com/art/yuck-foo-updated-17-10-2014-466739797?q=gallery%3Amarc2k3&qo=0)

1) i have a question.. which wsh panel mod script that does the heart icon color thing...?
2) i saw on the description something about last.fm server response. can the heart clicking be done without having an account on last.fm?

by the way, another question after reading your deviantart page. as you know i've been using your thumb script to view artist art...
i don't have a last.fm account. my question is... why thumb script still works without last.fm account?

3) is it fetching the artist art from your last.fm account or something?

(if that's the case, i'd like to thank you again for releasing your scripts into the masses)

as always, apologies for the seemingly silly question. it's all genuine though. and thank you too
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-25 06:52:59
1) it's a combination of 2 scripts. the main script that does all the work contacting last.fm and updating loved track status and fetching last.fm playcounts is the last.fm logo in the top right corner. all its options are found on the right click menu, as i mention on that webpage, the playlist is a WSH script and that was created by br3tt (http://br3tt.deviantart.com/) (he calls himself falstaff (http://www.hydrogenaud.io/forums/index.php?showuser=37463) on these forums though). this displays that information and also lets you love/unlove tracks with the click of the heart icon displayed for each track. this only works when the last.fm logo in the top right is red - and this only happens when you correctly set your last.fm username and password. if the icon is grey it means something is not right and clicking the hearts will have no effect.

2) no

3) you don't need a last.fm account for images or most other information either. you only need an account to fetch personal information such as the charts script or playcounts/loved tracks.
Title: WSH Panel Mod script discussion/help
Post by: Takaji on 2014-11-25 09:43:14
i don't mind helping out with little code snippets but i'm not even going to attempt to look at that.



And that's why I pasted that little code snippet  at least, I figured that there would be something in there saying to fill extra space with white in order to make the image 1:1. But I will definitely try and contact the original developer.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-25 10:04:35
the problem with that snippet is that it only deals with returning dimensions. it show nothing about the actual drawing of the image.

what you can do is look for instances of FillSolidRect in the code. i expect one of them will be what draws the whitespace so if you comment out the entire line, it might work.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-25 21:55:42
Does someone know some other biography site beside wiki and last.fm?
I try to use MTV bio, but they don't have a huge database..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-25 22:20:40
last.fm is probably the best because even the most obscure artists will have something added by some user of the site. ok, it's not always quality but i've yet to see anything better.
Title: WSH Panel Mod script discussion/help
Post by: Takaji on 2014-11-25 22:20:59
what you can do is look for instances of FillSolidRect in the code.


Thanks Marc, that was exactly the hint I needed! That led me to the exact area where I could change everything I wanted.
Title: WSH Panel Mod script discussion/help
Post by: MuhdNurHidayat on 2014-11-26 03:42:04
The title of this topic is "WSH Panel Mod script discussion/help"

So, maybe this is the best place to ask...

[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]First question:[/size]
I tried to make my own script based on few other codes I found, my script shows the metadata of currently playing song, the metadata successfully appeared but why did the ampersand sign (&) in song title changed into underline when I already specify DT_NOPREFIX = 0x00000800; ?? Even DT_END_ELLIPSIS = 0x00008000; is not functioning??

This is how it appeared:
(http://www.muhdnurhidayat.com/wp-content/uploads/2014/11/Metadata.png)
The title for the song is "Mosh & Dive" but it appeared "Mosh _Dive".
This is as seen on Wikipedia, the title (second song) contained an ampersand:
(http://www.muhdnurhidayat.com/wp-content/uploads/2014/11/mosh.png)

This is the metadata opened via "Properties" in foobar2000
(http://www.muhdnurhidayat.com/wp-content/uploads/2014/11/dive.png)

This is my code:
Code: [Select]
// Use with GdiDrawText() 
// {{
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 DT_END_ELLIPSIS = 0x00008000;
// }}

var albumartist = title = album = trackartist = year = genre = bitrate = samplerate = codec = tracknumber = metadata = "";

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

var textFont = gdi.Font("Yu Gothic", 12, 1);
var textFont2 = gdi.Font("Arial", 14, 1);
var textColour = RGB(255, 0, 128);
var textColour2 = RGB(100, 0, 100);

function on_paint(gr) {
   
    gr.FillSolidRect(0, 0, ww, wh, RGB(0, 0, 0));

    var info = trackartist + "\n" + title + "\n" + album + "\n" + albumartist + "\n" + year + "\n" + genre + "\n" + bitrate + "\n" + samplerate + "\n" + codec + "\n" + tracknumber;
    var whatelse = metadata;

    gr.GdiDrawText(info, textFont, textColour, 10, 20, ww - 20, wh - 10);
    gr.GdiDrawText(whatelse, textFont2, textColour2, 5, 1, ww - 20, wh - 10);

}

function update() {

    if (fb.IsPlaying) {

        metadata = fb.TitleFormat("Now playing '('English Metadata')'").Eval(true);
        trackartist = fb.TitleFormat("Artist Name      $if(%artist%,%artist%,Unknown)").Eval(true);
        title = fb.TitleFormat("Track Title        $if(%album%,$iflonger(%album%,40,$left(%album%,21) ...,%album%),Unknown)").Eval(true);
        album = fb.TitleFormat("Album Title      $if(%album%,$iflonger(%album%,40,$left(%album%,21) ...,%album%),Unknown)").Eval(true);
        albumartist = fb.TitleFormat("Album Artist    $if(%album artist%,%album artist%,$if(%artist%,%artist%,Unknown))").Eval(true);
        year = fb.TitleFormat("Release Year    $if(%date%,$year(%date%),Unknown)").Eval(true);
        genre = fb.TitleFormat("Genre                $if(%genre%,%genre%,Unknown)").Eval(true);
        bitrate = fb.TitleFormat("Bitrate              %bitrate%' kbps'").Eval(true);
        samplerate = fb.TitleFormat("Sample Rate    %samplerate% Hz").Eval(true);
        codec = fb.TitleFormat("Codec                %codec% ['('%codec_profile%')']").Eval(true);
        tracknumber = fb.TitleFormat("Track                  $if(%tracknumber%,%tracknumber%,00)  of  $if(%totaltracks%,%totaltracks%,Unknown)  $if(%discnumber%,'(' Disc %discnumber% $if(%totaldiscs%,  of  %totaldiscs%,)')',)").Eval(true);

    } else {
       
        bitrate = genre = album = title = year = trackartist = samplerate = codec = tracknumber = "";
        metadata = fb.TitleFormat("Now playing '('English Metadata')'").Eval(true);
        albumartist = fb.TitleFormat("No song is playing right now!").Eval(true);
    }
   
    window.Repaint();
}

if (fb.IsPlaying) {
    update();
}

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

function on_playback_new_track() {
    update();
}

function on_playback_stop(reason) {
    if (reason != 2) {
        update();
    }
}

function on_playback_dynamic_info() {
    update();
}

function on_playback_dynamic_info_track() {
    update();
}

Since DT_END_ELLIPSIS = 0x00008000; is not functioning, I had to use
Code: [Select]
$if(%album%,$iflonger(%album%,40,$left(%album%,21) ...,%album%),Unknown)
because I have few songs which contained in a long name single-album.
The single-album name is written in Japanese and it is 76 characters long, there's English Wikipedia article for it: Suzukake no Ki no Michi de "Kimi no Hohoemi o Yume ni Miru" to Itte Shimattara Bokutachi no Kankei wa Dō Kawatte Shimau no ka, Bokunari ni Nannichi ka Kangaeta Ue de no Yaya Kihazukashii Ketsuron no Yō na Mono (http://en.wikipedia.org/wiki/Suzukake_no_Ki_no_Michi_de_%22Kimi_no_Hohoemi_o_Yume_ni_Miru%22_to_Itte_Shimattara_Bokutachi_no_Kankei_wa_D%C5%8D_Kawatte_Shimau_no_ka,_Bokunari_ni_Nannichi_ka_Kangaeta_Ue_de_no_Yaya_Kihazukashii_Ketsuron_no_Y%C5%8D_na_Mono).

If there's something I missed inside the code, please inform me.

[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]Second question[/size]
I want to create another script that only displays properties of selected/highligted song(s) from playlist. Can anyone tell me what code I suppose to use?
For example, if I select only one then it will display properties for that song, but if I selected multiple then it will display all properties for those selected??

The things I want to display in the combined properties are:
Items selected (Number of items selected)
Artist (List of artists of items selected, separated by comma)
Track (List of tracks of items selected, separated by comma)
Album (List of albums of items selected, separated by comma)
Duration (Total duration of items selected)
Sample rate (List of sample rate of items selected, separated by comma)
Channels  (Actually all my songs are stereo, but it's nice to see it displayed)
Bitrate (Display the range, lowest - highest)
Codec (Example: MP3 - CBR, MP3 - VBR, FLAC)
Encoding (Example: lossy, lossless)

Note: I don't want to combine the first script (that display metadata for currently playing song) and the script that I want to make in second question (that display metadata for selected/highlighted song).

I'll follow this topic, thank you very much!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-26 04:32:20
DT_NOPREFIX & DT_END_ELLIPSIS are flags you have to specify in your  gr.GdiDrawText functions. you separate them with the pipe character  ( | ) like this...

Code: [Select]
gr.GdiDrawText(info, textFont, textColour, 10, 20, ww - 20, wh - 10, DT_NOPREFIX | DT_END_ELLIPSIS);


also, the end ellipsis will only work if you have a separate gdi.DrawText function per line of output. as you've wrapped all yours into a single statement with line breaks, it will only work on the last line.

as for your 2nd question, use the selection properties dialog built into default UI. it's much easier.

Title: WSH Panel Mod script discussion/help
Post by: drm200 on 2014-11-26 04:50:17
Mouse Scroll with wheel question ..

I have several wsh panels that use the mouse wheel for scrolling.

The scroll feature works fine in each panel with one small problem ..

When I move the mouse from one wsh panel to a different wsh panel .. The mouse wheel scroll is still associated with the wsh panel I just moved the mouse from until I click the mouse anywhere in the new panel ... I had expected the mouse wheel to be associated with the object that I am currently hovering over regardless of moving to a new panel ... but it seems that the focus of the mouse wheel scroll events does not change wsh panels until I click on the wsh panel that I have just moved the mouse to.

I'd like to be able to have the mouse wheel function follow the mouse when moving from one wsh panel to another without the need to click once in the new wsh panel.

Is there a method to have the mouse wheel actions automatically follow to whichever object it is hovering over without the need to click the mouse once in the new destination panel??
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-26 07:31:50
Does someone know some other biography site beside wiki and last.fm?
I try to use MTV bio, but they don't have a huge database..


http://www.artistdirect.com/artist/bio/korn/516409 (http://www.artistdirect.com/artist/bio/korn/516409)
http://allmusic.com/artist/korn-mn0000112789/biography (http://allmusic.com/artist/korn-mn0000112789/biography)
http://www.rollingstone.com/music/artists/korn (http://www.rollingstone.com/music/artists/korn)
https://music.yahoo.com/artist/korn/ (https://music.yahoo.com/artist/korn/)
http://beta.musicbrainz.org/artist/ac865b2...56-dd40d5e39f46 (http://beta.musicbrainz.org/artist/ac865b2e-bba8-4f5a-8756-dd40d5e39f46)
http://www.discogs.com/artist/18837 (http://www.discogs.com/artist/18837)
https://play.spotify.com/artist/3RNrq3jvMZxD9ZyoOZbQOD (https://play.spotify.com/artist/3RNrq3jvMZxD9ZyoOZbQOD)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-26 12:00:46
@drm200, what you want is the default behaviour. i don't know why it isn't working for you. try this example is 2 panels side by side...

Code: [Select]
var ww = 0;
var wh = 0;
var colours = [
    RGB(255, 0, 0),
    RGB(0, 255, 0),
    RGB(0, 0, 255)
];
var colour = 0;

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

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, colours[colour]);
}


function on_mouse_wheel(step) {
    colour -= step;
    if (colour < 0) colour = 2;
    if (colour > 2) colour = 0;
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-26 12:17:41
Found this list of API's which I found interesting and could be used in wsh and thought I should share.

http://www.programmableweb.com/category/music (http://www.programmableweb.com/category/music)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-26 12:31:06
i'll take a look at the spotify api later. i'm assuming it will be well populated with useful stuff.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-26 12:45:21
Does someone know some other biography site beside wiki and last.fm?
I try to use MTV bio, but they don't have a huge database..

http://www.artistdirect.com/artist/bio/korn/516409 (http://www.artistdirect.com/artist/bio/korn/516409)
http://allmusic.com/artist/korn-mn0000112789/biography (http://allmusic.com/artist/korn-mn0000112789/biography)
http://www.rollingstone.com/music/artists/korn (http://www.rollingstone.com/music/artists/korn)
https://music.yahoo.com/artist/korn/ (https://music.yahoo.com/artist/korn/)
http://beta.musicbrainz.org/artist/ac865b2...56-dd40d5e39f46 (http://beta.musicbrainz.org/artist/ac865b2e-bba8-4f5a-8756-dd40d5e39f46)
http://www.discogs.com/artist/18837 (http://www.discogs.com/artist/18837)
https://play.spotify.com/artist/3RNrq3jvMZxD9ZyoOZbQOD (https://play.spotify.com/artist/3RNrq3jvMZxD9ZyoOZbQOD)

Zeremy thanks, i will test some of this..

For now there is script that scratch bio from web (last.fm and wikipedia).
It behaves same as Marc original script(right click change source) and use common8.js
You can also change folder path for saved text..
Why i make this is because echonest( Marc use) update text only after one week or one month, as i see on some edited bio.
Wikipedia bio still has some problems(i don't use (musician),(band),(entertainer),(singer) there) , but it works on 90% artists.
Maybe i will add  (last.fm) album info later..

If someone need to see updated text instantly, that's it..

Script is also easy to modify if someone wants to add new sources..
I was needed something that i can later modify if conditions on site was changed, so now i can do this easy(or change source site), i don't depend on others anymore..

So here is script:

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Text"
// @author "Mire777"
// @import "%fb2k_profile_path%marc2003\common8.js"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

//BEGIN-->
var p = new panel("Last.fm", ["metadb", "remap"]);
var t = new text("custom", 6, 30, p.w - 12, p.h - 30);

//properties..
source = window.GetProperty("2k3.download_source", "last.fm");
var fbfolder = (fb.ProfilePath + "Artist_info");
var folder = window.GetProperty("2k3.custom_folder", fbfolder);

//metadb/playback
on_metadb_changed();
on_playback_new_track();

//Folder call
var fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");

//on size
function on_size() {
p.size();
t.w = p.w - 12;
t.h = p.h - 30;
t.size();
}

//on paint
function on_paint(gr) {
    if (t.text > "") {
p.draw_background(gr);
p.left_text(gr, p.artist, p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
gr.DrawLine(6, 29, p.w - 6, 29, 1, p.textcolour_hl);
t.draw(gr);
}}

//metadb changed
function on_metadb_changed() {
if (!p.metadb) return;
p.artist = p.eval(p.artist_tf);
if (t.artist == p.artist) return;
t.artist = p.artist;
t.text = "";
if (folder>"")
{
//Create main folder 'Artist_info'
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
   
//Create subfolder 'artist'
if(!fso.FolderExists(folder + "\\"+(p.artist.validate()))) fso.CreateFolder(folder + "\\"+(p.artist.validate()));
}

//folder + 'bio.txt'
t.filename = folder + "\\"+(p.artist.validate()) + "\\bio.txt";
   
//Check if folder exist then >continue..
if (t.filename.is_file()) {
t.text = p.open(t.filename);
if (t.filename.expired(ONE_DAY) && source=="last.fm") {get();}
else
if (t.filename.expired(ONE_DAY) && source=="wikipedia") {get2();}
} else {
if (source=="last.fm") {get();}
else
if (source=="wikipedia") {get2();}
}
t.update();
window.Repaint();
}

//wheel step
function on_mouse_wheel(step) {
t.wheel(step);
}

//on mouse move
function on_mouse_move(x, y) {
p.move(x, y);
t.move(x, y);
}

//on mouse lbtn_up
function on_mouse_lbtn_up(x, y) {
t.lbtn_up(x, y);
}

//1st bio text
function get() {
if (t.artist == "" || t.artist == "?") return;
var fn = t.filename;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(t.artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);

//find text from tag%tag
var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "id=\"wiki\">";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</div>", st);
var artt = text.substr(st, et - st);
t.text = artt;

//check if biography exist
if (t.text.indexOf("TYPE")==0) {t.text = "This artist does not have a biography";}

else

//clean text(marc)
t.text = p.strip_tags(t.text);

//clean other
{t.text = t.text.replace(/\n\r/g, "\n").replace(/\n\n/g, "\n").trim();}

//if clean not work use this:
//.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---").replace(/---/g,"\n\r");
//console
//fb.trace("bio: " + t.text);
{
p.save(t.text, fn);
t.update();
window.Repaint();
};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
{t.text = "This artist does not have a biography";}
p.save(t.text, fn);
t.update();
window.Repaint();
}}}}

//2nd bio text
function get2() {
if (t.artist == "" || t.artist == "?") return;
var fn = t.filename;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://en.wikipedia.org/wiki/" + encodeURIComponent(t.artist) + "", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);

//find text from tag%tag
var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "<p>";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</html>", st);
var artt = text.substr(st, et - st);
t.text = artt;

//check if biography exist
if (t.text.indexOf("TYPE")==0) {t.text = "This artist does not have a biography";}
if (t.text.indexOf("may refer to")>0) {t.text = "This artist does not have a biography";}
if (t.text.indexOf("can refer to")>0) {t.text = "This artist does not have a biography";}
else

//clean text(marc)
t.text = p.strip_tags(t.text);

//clean other
{t.text = t.text.replace(/\n\r/g, "\n").replace(/\n/g, "\n\n").replace(/[?[0-9]+?]/g, "").replace(/\[?edit+?]/g, "").replace(/\n+Contents?[^>]+?External links/g, "").replace(/\n+Contents?[^>]+?References/g, "").replace(/[0-9] Filmography/, "").replace(/[0-9] Discography/, "").replace(/[0-9] References/, "").replace(/[0-9] Notes/, "").split("Filmography")[0].split("Discography")[0].split("References")[0].replace(/\n\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").replace(/[?[citatio]+?n n/g, "").replace(/Sorry, your browser either has JavaScript disabled or does not have any supported player./g, "").replace(/You can download the clip or download a player to play the clip in your browser./g, "").replace(/Problems playing this file[?]/g, "").replace(/See media help./g, "").replace(/\n\r/g, "\n").replace(/\n\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").trim();}

//if clean not work use this:
//.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---").replace(/---/g,"\n\r");
//console
//fb.trace("bio: " + t.text);
{
p.save(t.text, fn);
t.update();
window.Repaint();
};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
{t.text = "This artist does not have a biography";}
p.save(t.text, fn);
t.update();
window.Repaint();
}}}}

//menu
function on_mouse_rbtn_up(x, y) {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Refresh");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Last.fm");
_menu.AppendMenuItem(MF_STRING, 3, "Wikipedia");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 4, "Open Folder");
if (source=="last.fm") _menu.AppendMenuItem(MF_STRING, 5, "Open Last.fm");
if (source=="wikipedia") _menu.AppendMenuItem(MF_STRING, 5, "Open Wiki.");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 6, "Properties");

if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 7, "Configure...");

_menu.CheckMenuRadioItem(2, 3, source == "last.fm" ? 2 : 3);

idx = _menu.TrackPopupMenu(x, y);
if(idx == 1) if (p.metadb) {if (source=="last.fm") {get();} else if (source=="wikipedia") {get2();}}
if(idx == 2) if (p.metadb) {source = idx == 2 ? "last.fm" : "wikipedia"; window.SetProperty("2k3.download_source", source); get();}
if(idx == 3) if (p.metadb) {source = idx == 3 ? "wikipedia" : "last.fm"; window.SetProperty("2k3.download_source", source); get2();}
if(idx == 4) p.run("explorer /select,\"" +  t.filename);
if(idx == 5) if (p.metadb) {if (source=="last.fm") {p.browser("http://www.last.fm/music/" + encodeURIComponent(t.artist));} else if (source=="wikipedia") {p.browser("http://en.wikipedia.org/wiki/" + encodeURIComponent(t.artist));}}
if(idx == 6) window.ShowProperties();
if(idx == 7) window.ShowConfigure();
_menu.Dispose();
return true;
}

Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-26 12:50:50
i'll take a look at the spotify api later. i'm assuming it will be well populated with useful stuff.


Things to take in mind.

http://developer.echonest.com/sandbox/spotify.html (http://developer.echonest.com/sandbox/spotify.html)
http://static.echonest.com/enspex/ (http://static.echonest.com/enspex/)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-26 13:11:45
So here is script:


the way it does a new web request every time you change the source from the menu isn't great. instead, you should store 2 files in your artist folder - one for last.fm and one for wikipedia. your filename should be generated depending on what the source is. then when you have text from each source, you can switch between them instantly without contacting the web.

i'll post some more stuff later that should help you out - i don't have time at the moment.

edit: i will just post this about creating custom menus...

make sure you have the latest common8.js in your marc2003 folder: https://dl.dropboxusercontent.com/u/2280132...2003/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common8.js)

on your first line of code, modify it like this...

Code: [Select]
var p = new panel("Last.fm", ["metadb", "remap", "custom_menu"]);


put this as the last line of code in your on_paint function....

Code: [Select]
p.menu_btn.draw(gr);


put this as the first line of code in the on_mouse_rbtn_up function..

Code: [Select]
if (p.menu_btn.lbtn_up(x, y)) return;


then at the end of the script, you can define your own custom menu with...

Code: [Select]
p.menu = function() {
    var _menu = window.CreatePopupMenu();
    //create menu items
    var idx = _menu.TrackPopupMenu(p.menu_btn.x, p.menu_btn.y);
    //process response
    _menu.Dispose();
}


the icon for the menu only appears in the top left when your mouse hovers over the panel. the reason for doing this is so you still get all the right click options like font size, selection mode, artist field remapping that are provided by my script.

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-26 13:35:30
So here is script:


the way it does a new web request every time you change the source from the menu isn't great. instead, you should store 2 files in your artist folder - one for last.fm and one for wikipedia. your filename should be generated depending on what the source is. then when you have text from each source, you can switch between them instantly without contacting the web.

i'll post some more stuff later that should help you out - i don't have time at the moment.


Yes, you're right having 2 files instead one would be better. I'll do this later.
Would be good to know how to modify Thumbs script for new sources..
I already do this, but this script don't use common8.js
Good thing is you always give support and update your samples often.
Thanks for your guide, realy helps..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-26 13:43:09
see my edit above and yes i can provide help for getting my thumbs script to use a different source. i'll try and get on it later.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-26 15:37:06
see my edit above and yes i can provide help for getting my thumbs script to use a different source. i'll try and get on it later.


Nice idea, then i can easy update script with right click menu.
But, problem is that i have icon on top left corner while this works, your menu doesn't appear.
I have only properties and configure..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-26 15:41:06
i just realised there's a stupid typo in my post above, it should on_mouse_lbtn_up. make sure you have no on_mouse_rbtn_up in the panel at all and then my right click menu will work.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-26 15:47:58
i just realised there's a stupid typo in my post above, it should on_mouse_lbtn_up. make sure you have no on_mouse_rbtn_up in the panel at all and then my right click menu will work.

Yes it works

If someone already use this, here is new script, with all the right click options provided by Marc script:

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Text"
// @author "Mire777"
// @import "%fb2k_profile_path%marc2003\common8.js"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

//BEGIN-->
var p = new panel("Last.fm", ["metadb", "remap","custom_menu"]);
var t = new text("custom", 6, 30, p.w - 12, p.h - 30);

//properties..
source = window.GetProperty("2k3.download_source", "last.fm");
var fbfolder = (fb.ProfilePath + "Artist_info");
var folder = window.GetProperty("2k3.custom_folder", fbfolder);

//metadb/playback
on_metadb_changed();
on_playback_new_track();

//Folder call
var fso = new ActiveXObject("Scripting.FileSystemObject");
WshShell = new ActiveXObject("WScript.Shell");

//on size
function on_size() {
p.size();
t.w = p.w - 12;
t.h = p.h - 30;
t.size();
}

//on paint
function on_paint(gr) {
if (t.text > "") {
p.draw_background(gr);
p.left_text(gr, p.artist, p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
gr.DrawLine(6, 29, p.w - 6, 29, 1, p.textcolour_hl);
t.draw(gr);
p.menu_btn.draw(gr);
}}

//metadb changed
function on_metadb_changed() {
if (!p.metadb) return;
p.artist = p.eval(p.artist_tf);
if (t.artist == p.artist) return;
t.artist = p.artist;
t.text = "";
if (folder>"")
{
//Create main folder 'Artist_info'
if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
   
//Create subfolder 'artist'
if(!fso.FolderExists(folder + "\\"+(p.artist.validate()))) fso.CreateFolder(folder + "\\"+(p.artist.validate()));
}

//folder + 'bio.txt'
t.filename = folder + "\\"+(p.artist.validate()) + "\\bio.txt";
   
//Check if folder exist then >continue..
if (t.filename.is_file()) {
t.text = p.open(t.filename);
if (t.filename.expired(ONE_DAY) && source=="last.fm") {get();}
else
if (t.filename.expired(ONE_DAY) && source=="wikipedia") {get2();}
} else {
if (source=="last.fm") {get();}
else
if (source=="wikipedia") {get2();}
}
t.update();
window.Repaint();
}

//wheel step
function on_mouse_wheel(step) {
t.wheel(step);
}

//on mouse move
function on_mouse_move(x, y) {
p.move(x, y);
t.move(x, y);
}

//on mouse lbtn_up
function on_mouse_lbtn_up(x, y) {
if (p.menu_btn.lbtn_up(x, y)) return;
}

//1st bio text
function get() {
if (t.artist == "" || t.artist == "?") return;
var fn = t.filename;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(t.artist) + "/+wiki", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);

//find text from tag%tag
var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "id=\"wiki\">";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</div>", st);
var artt = text.substr(st, et - st);
t.text = artt;

//check if biography exist
if (t.text.indexOf("TYPE")==0) {t.text = "This artist does not have a biography";}

else

//clean text(marc)
t.text = p.strip_tags(t.text);

//clean other
{t.text = t.text.replace(/\n\r/g, "\n").replace(/\n\n/g, "\n").trim();}

//if clean not work use this:
//.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---").replace(/---/g,"\n\r");
//console
//fb.trace("bio: " + t.text);
{
p.save(t.text, fn);
t.update();
window.Repaint();
};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
{t.text = "This artist does not have a biography";}
p.save(t.text, fn);
t.update();
window.Repaint();
}}}}

//2nd bio text
function get2() {
if (t.artist == "" || t.artist == "?") return;
var fn = t.filename;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://en.wikipedia.org/wiki/" + encodeURIComponent(t.artist) + "", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];
for (i = 0; i < 1; i++) {
if (data[i].id.indexOf("about:/wiki/") == 0);

//find text from tag%tag
var st = text.indexOf( data[i].id.replace("about:/wiki/", ""));
var str = "<p>";
st = text.indexOf(str, st) + str.length;
var et = text.indexOf("</html>", st);
var artt = text.substr(st, et - st);
t.text = artt;

//check if biography exist
if (t.text.indexOf("TYPE")==0) {t.text = "This artist does not have a biography";}
if (t.text.indexOf("may refer to")>0) {t.text = "This artist does not have a biography";}
if (t.text.indexOf("can refer to")>0) {t.text = "This artist does not have a biography";}
else

//clean text(marc)
t.text = p.strip_tags(t.text);

//clean other
{t.text = t.text.replace(/\n\r/g, "\n").replace(/\n/g, "\n\n").replace(/[?[0-9]+?]/g, "").replace(/\[?edit+?]/g, "").replace(/\n+Contents?[^>]+?External links/g, "").replace(/\n+Contents?[^>]+?References/g, "").replace(/[0-9] Filmography/, "").replace(/[0-9] Discography/, "").replace(/[0-9] References/, "").replace(/[0-9] Notes/, "").split("Filmography")[0].split("Discography")[0].split("References")[0].replace(/\n\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").replace(/[?[citatio]+?n n/g, "").replace(/Sorry, your browser either has JavaScript disabled or does not have any supported player./g, "").replace(/You can download the clip or download a player to play the clip in your browser./g, "").replace(/Problems playing this file[?]/g, "").replace(/See media help./g, "").replace(/\n\r/g, "\n").replace(/\n\n\n\n/g, "\n").replace(/\n\n\n/g, "\n").trim();}

//if clean not work use this:
//.replace(/<\/?[^>]+(>|$)/g, "").replace(/\n/g, "<br>").replace(/<BR>/g,"\n").replace(/&amp;/g,"&").replace(/<br>/g,"---").replace(/---/g,"\n\r");
//console
//fb.trace("bio: " + t.text);
{
p.save(t.text, fn);
t.update();
window.Repaint();
};
}

this.doc.close();

} else {
fb.trace("HTTP error: " + this.xmlhttp.status);
{t.text = "This artist does not have a biography";}
p.save(t.text, fn);
t.update();
window.Repaint();
}}}}

//menu
p.menu = function() {
var MF_SEPARATOR = 0x00000800;
var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Refresh");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 2, "Last.fm");
_menu.AppendMenuItem(MF_STRING, 3, "Wikipedia");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 4, "Open Folder");
if (source=="last.fm") _menu.AppendMenuItem(MF_STRING, 5, "Open Last.fm");
if (source=="wikipedia") _menu.AppendMenuItem(MF_STRING, 5, "Open Wiki.");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING, 6, "Properties");

if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 7, "Configure...");

_menu.CheckMenuRadioItem(2, 3, source == "last.fm" ? 2 : 3);

var idx = _menu.TrackPopupMenu(p.menu_btn.x, p.menu_btn.y);

if(idx == 1) if (p.metadb) {if (source=="last.fm") {get();} else if (source=="wikipedia") {get2();}}
if(idx == 2) if (p.metadb) {source = idx == 2 ? "last.fm" : "wikipedia"; window.SetProperty("2k3.download_source", source); get();}
if(idx == 3) if (p.metadb) {source = idx == 3 ? "wikipedia" : "last.fm"; window.SetProperty("2k3.download_source", source); get2();}
if(idx == 4) p.run("explorer /select,\"" +  t.filename);
if(idx == 5) if (p.metadb) {if (source=="last.fm") {p.browser("http://www.last.fm/music/" + encodeURIComponent(t.artist));} else if (source=="wikipedia") {p.browser("http://en.wikipedia.org/wiki/" + encodeURIComponent(t.artist));}}
if(idx == 6) window.ShowProperties();
if(idx == 7) window.ShowConfigure();
_menu.Dispose();
return true;
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-26 17:20:36
Marc, can i move this button on right, on right would be better, because there's no text..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-26 17:30:29
sure. just add this as the last line inside the on_size function.

Code: [Select]
p.menu_btn.x = p.w - p.menu_btn.w;
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-27 08:43:41
sure. just add this as the last line inside the on_size function.

Code: [Select]
p.menu_btn.x = p.w - p.menu_btn.w;



Great, thanks
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2014-11-27 10:44:06
finally, i've uploaded a full customisation page. it's bound to be full of typos and errors.

http://marc2003.x10host.com/customisation (http://marc2003.x10host.com/customisation)

it doesn't cover topics like fetching stuff off the internet yet. i'll get round to it oneday. 


Really nice, thanks.

"Fetching stuff off the internet", you mean like wiki/last.fm biographies? Is it hard to change those websites and use some others for infos? I have some "weird" ones in mind to use, like imdb, rottentomatoes, goodreads,... (for some other configurations of course, not for general music - last.fm is still the top there).

Great work!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-27 14:07:13
yes you could use any source you like. that's the plan anyway. the big problem is that i despise writing guides/documentation. it really sucks the life out of me which is why i'm always putting it off.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-11-27 14:40:36
sure. just add this as the last line inside the on_size function.

Code: [Select]
p.menu_btn.x = p.w - p.menu_btn.w;



Great, thanks


@mire777

You need to add  a line for the text up/down scrolling buttons

//on mouse lbtn_up
function on_mouse_lbtn_up(x, y) {
if (p.menu_btn.lbtn_up(x, y)) return;
t.lbtn_up(x, y);
}
Title: WSH Panel Mod script discussion/help
Post by: Forfit on 2014-11-27 18:47:26
I discovered the interesting script marc2003!
In the beginning, did not work, then I corrected:
line 1525:
help: gdi.Image(p.ip + "buttons\\help.png"),
in
help: gdi.Image(p.ip + "buttons\\help.png")
and it work nice.
I read
I read somewhere (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=225&p=689990&#entry689990) else that it was possible to change the language of the biography, also only for wikipedia.  We can no longer?
you can download the bio only when the panel is visible, to avoid continuous unwanted downloads?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-27 19:18:00
that comma shouldn't be there but it still worked fine for me??? anyway, i've updated the script to remove it.

as for language support, lots of things have changed since that very old post and my scripts only fetch results in english now.
Title: WSH Panel Mod script discussion/help
Post by: Forfit on 2014-11-27 19:29:57
you can download the bio only when the panel is visible, to avoid continuous unwanted downloads?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-27 19:47:46
sorry but i'm not making that change.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-27 22:49:49
I read somewhere (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=225&p=689990&#entry689990) else that it was possible to change the language of the biography, also only for wikipedia.  We can no longer?

This is why i made this script, you can change language for wikipedia and last.fm.
Top Right corner>properties>domen1 and domen2.
There you should enter example: for bio in germany: (domen1: lastfm.de ; domen2: de.wikipedia)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-28 01:11:47
@mire777, the chances of me writing more docs soon is unlikely so i've hacked your script a bit to tidy up. i even corrected some of my own mistakes - be sure to check all the comments.

https://dl.dropboxusercontent.com/u/2280132...emp/mire777.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/mire777.txt)

i'll post a modified thumbs script for you to use with your own source soon as well.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-28 05:03:08
@mire777, the chances of me writing more docs soon is unlikely so i've hacked your script a bit to tidy up. i even corrected some of my own mistakes - be sure to check all the comments.

https://dl.dropboxusercontent.com/u/2280132...emp/mire777.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/mire777.txt)

i'll post a modified thumbs script for you to use with your own source soon as well.


Yes, i see where is some problems. You corrected this..
I will wait for modified Thumbs script, i have old mod. script, and it's in totaly mess
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-28 05:36:12
can you post your equivalent get function from your mod. i need to have a look at what url you're fetching and how you're parsing the response.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-28 13:02:42
can you post your equivalent get function from your mod. i need to have a look at what url you're fetching and how you're parsing the response.

Yes, here is code.
But as you already know. I didnt care to download full size images from yahoo and google.
Script download only small images.
You should look in html and find where is link for full size images..


Code: [Select]
//Download Image
this.download = function()
        {
if (!p.fso.FolderExists(this.folder))  return;
        {

if (server=="last.fm")
        {{
        this.working=true;
        if (p.artist == "" || p.artist == "?") return;
        var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+images", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("img");
var urls = [];
for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("http://userserve-ak.last.fm/serve/126s") == 0) urls.push(data[i].src.replace("126s", size == "low" ? "252" : size == "medium" ? "500" : size == "high" ? "_" : "_"));
}
                    fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + urls[i] + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + urls[i].substring(urls[i].lastIndexOf("/")+1000) + ".jpg" + "\"" , 0, true);
//download one img and then return
if (im.images.length == 0) {im.update(); fix_limit = im.limit+1;}
//if img not downloaded return..
                    if (im.images.length == 0) {return;}
                    }
                im.doc.close();
                im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status);
}}}}}

else

if (server=="yahoo")
    {{
        this.working=true;           
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://images.search.yahoo.com/search/images?p=" + encodeURIComponent(p.artist) + "+" + terms, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("li");
div.innerHTML = text;
var data = div.getElementsByTagName("img");
var urls = [];

if (im.images.length < im.limit)
                      {
                    for (v = 0; v < data.length; v++) {
if (data[v].src.indexOf("http://ts") == 0) urls.push(data[v].src.replace("", ""));
}
                    fix_limit = im.limit;
for (v = 0; v < Math.min(urls.length, fix_limit, 50); v++) {
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + urls[v] + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + v] + urls[v].substring(urls[v].lastIndexOf("ts")+1000) + ".jpg" + "\"" , 0, true);
                    if (im.images.length == 0) {im.update(); fix_limit = im.limit;}
                    if (im.images.length == 0) {return;}
                    }
               
                    if (im.images.length < im.limit)
                    {
                    for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("http://d") == 0) urls.push(data[i].src.replace("", ""));
}
                    fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + urls[i] + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + urls[i].substring(urls[i].lastIndexOf("d")+1000) + ".jpg" + "\"" , 0, true);
                    if (im.images.length == 0) {im.update(); fix_limit = im.limit;}
                    if (im.images.length == 0) {return;}
                    }
            }
               
                   
                im.doc.close();
                im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status + urls);
                  }
               
}}}}}
else

if (server=="google")
    {{
        this.working=true;             
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "https://www.google.com/search?q=" + encodeURIComponent(p.artist) + "+" + terms + "&sei=GAKAUuvmD-WC4gTL9IC4AQ&gbv=2&tbm=isch", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("img");
var urls = [];

                  for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("https://encrypted") == 0) urls.push(data[i].src.replace("", ""));
}
                    fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + urls[i] + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + urls[i].substring(urls[i].lastIndexOf("d")+1000) + ".jpg" + "\"" , 0, true);
if (im.images.length == 0) {im.update(); fix_limit = im.limit+1;}
                    if (im.images.length == 0) {return;}
                    }
                im.doc.close();
                im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status + urls);
}}}}}}}
Title: WSH Panel Mod script discussion/help
Post by: Forfit on 2014-11-28 15:02:25
[deleted]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-11-28 19:00:18
Script download only small images.
You should look in html and find where is link for full size images..


we have a comedian in the house. there's no way i'm looking at the source of google images. 

to use this, you need the latest version of my common8.js updated today as it needed changes to suppress the options provided by my own thumbs script.

https://dl.dropboxusercontent.com/u/2280132...2003/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common8.js)

you stil get the normal options not related to the source/last.fm...

(https://dl.dropboxusercontent.com/u/22801321/2014/november/thumbs.png)

you can create your own menu using the top right button which i've included.

script here and check the comments. i've not included your code but it should be easy enough for you to add in yourself.

https://dl.dropboxusercontent.com/u/2280132...e777_thumbs.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/mire777_thumbs.txt)

if you think i've missed anything, give me a shout.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-11-29 01:18:38
we have a comedian in the house. there's no way i'm looking at the source of google images. 

to use this, you need the latest version of my common8.js updated today as it needed changes to suppress the options provided by my own thumbs script.

https://dl.dropboxusercontent.com/u/2280132...2003/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common8.js)

you stil get the normal options not related to the source/last.fm...



I know that you don't want to use google.
Google s not perfect, but, it's easy to set..
I'm use this only as alternative.
Last.fm is still no1..

I will see if something missing..
Great is that people now can use your original script with other sources.
Thank you for this
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-02 21:06:24
I have a questions for marc2003:

I'm using your scripts to build my control area. I have successfully added albums art, track info and playback time, playback buttons, a stop after current button and a volume scroller all to one WSH panel (http://pastebin.com/T2aLf35W). What I'm trying to add now is simple shuffle tracks and repeat track button. I've taken a look at the preloaded WSH sample "PBOButton" but it uses a different method of displaying buttons then your playback buttons. My question is, is there a way I can add shuffle and repeat to my script using the same method used for playback buttons? If not, what's the cleanest way to add repeat and shuffle buttons?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-02 23:32:19
if you want 3 buttons (normal, shuffle, repeat track) that simply sets the mode when clicked then simply create an image for each one.

Code: [Select]
var pbo_default_img = gdi.Image(fb.ProfilePath + "my images\\pbo_default.png")


if you want to stick your images in the same folder as my playback buttons (marc2003\images8\buttons), you can use this to get there...

Code: [Select]
var pbo_default_img = gdi.Image(p.ip + "buttons\\pbo_default.png")


now add the line of code into the b.update function

Code: [Select]
b.update = function() {
    pbo_default: new button(x, y, w, h, bw, bh, {normal: pbo_default_img}, function() {fb.PlaybackOrder = 0;}, "Normal"),
    previous: .....
    .....
}


for shuffle tracks the function would be...

Code: [Select]
fb.PlaybackOrder = 4;


then you just need to add this callback function

Code: [Select]
function on_playback_order_changed() {
    b.update();
}


Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-03 00:12:30
if you want 3 buttons (normal, shuffle, repeat track) that simply sets the mode when clicked then simply create an image for each one.

Code: [Select]
var pbo_default_img = gdi.Image(fb.ProfilePath + "my images\\pbo_default.png")


Thanks, but I actually want two buttons that have ON and OFF states. I have already created the icons, dropped them in your images8 folder, and updated common8.js to point to them. Their triggers are this.images.repeat, this.images.repeat_ON, this.images.shuffle, this.images.shuffle_ON.

I need, for example, the repeat button to go from this.image.repeat to this.images.repeat_ON when hit, and back to this.images.repeat when hit again or when repeat is turned off via the menu.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-03 00:29:27
you shouldn't edit common8.js - you can use stand alone images like my post above or extend b.images like this.

Code: [Select]
var b = new buttons("playback");
b.images.repeat = gdi.Image(....
b.images.repeat_ON =


you have to use b rather than this because the code is not inside any buttons function.

but when inside b.update, you can use this again.

Code: [Select]
b.update = function() {
    repeat: new button(x, y, w, h, bw, bh, {normal: fb.PlaybackOrder == 0 ? this.images.repeat : this.image.repeat_ON, hover: fb.PlaybackOrder == 0 ? this.images.repeat_ON : this.images.repeat}, function() {fb.PlaybackOrder = fb.PlaybackOrder == 1 ? 0 : 1;}, "Repeat"),
    previous: .....
    .....
}


edit: fix typo for hover image
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-03 00:41:53
you shouldn't edit common8.js - you can use stand alone images like my post above or extend b.images like this.

Code: [Select]
var b = new buttons("playback");
b.images.repeat = gdi.Image(....
b.images.repeat_ON =


you have to use b rather than this because the code is not inside any buttons function.

but when inside b.update, you can use this again.

Code: [Select]
b.update = function() {
    repeat: new button(x, y, w, h, bw, bh, {normal: fb.PlaybackOrder == 0 ? this.images.repeat : this.image.repeat_ON, hover: fb.PlaybackOrder == 1 ? this.images.repeat_ON : this.images.repeat}, function() {fb.PlaybackOrder = fb.PlaybackOrder == 1 ? 0 : 1;}, "Repeat"),
    previous: .....
    .....
}


It works but the button never changes it's image to repeat_on. Hmmm...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-03 00:48:38
perhaps you missed my edit. 
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-03 01:43:08
perhaps you missed my edit. 


Yup, I missed your edit

It now changes image to _on, but it also changes to _on when any of the other modes are selected. So if I select shuffle, repeat will also turn on.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-03 02:00:14
sorry, i didn't test because i'm too lazy to mess about with the images. you could try this - but again it's guess work.

Code: [Select]
repeat: new button(x, y, w, h, bw, bh, {normal: fb.PlaybackOrder == 1 ? this.images.repeat_ON : this.images.repeat, hover: fb.PlaybackOrder == 1 ? this.images.repeat : this.images.repeat_ON}, function() {fb.PlaybackOrder = fb.PlaybackOrder == 1 ? 0 : 1;}, "Repeat")


edit: typos again
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-03 03:12:51
That was almost right, the only thing that needed to change was hover's image order. Thanks for all your help.


For anyone interested, here's the finished script:

Code: [Select]
b.update = function() {
    b.buttons = {
        repeat: new button(p.w / 2 - bw * 2 - bw / 2 - b2w * 2 - 25, 0, bw, bh, {normal: fb.PlaybackOrder == 2 ? this.images.repeat_on : this.images.repeat, hover: fb.PlaybackOrder == 0 ? this.images.repeat_on : this.images.repeat}, function() {fb.PlaybackOrder = fb.PlaybackOrder == 2 ? 0 : 2;}, "Repeat"),
        shuffle: new button(p.w / 2 - bw * 2 - bw / 2 - b2w - 25, 0, bw, bh, {normal: fb.PlaybackOrder == 4 ? this.images.shuffle_on : this.images.shuffle, hover: fb.PlaybackOrder == 0 ? this.images.shuffle_on : this.images.shuffle}, function() {fb.PlaybackOrder = fb.PlaybackOrder == 4 ? 0 : 4;}, "Repeat"),
    }
    window.Repaint();
}


You also have to add this to get it to update:

Code: [Select]
function on_playback_order_changed() {
    b.update();
}


It can be inserted in any of marc2003's scripts, but you'll need to point it to your own images.
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-03 08:25:14
marc2003, I have a few more question regarding your scripts.

I'm also using your "simple volume" script in my control area at 120px x 10px and although it's working fine, it's preventing tool tips from all other elements to show. I know this because when I comment out "v.move" under "function_on_mouse_move" tool tips start showing, but volume stops responding to mouse clicks or drags.
Code: [Select]
function on_mouse_move(x, y) {
    p.move(x, y);
    a.move(x, y);
    b.move(x, y);
    v.move(x, y); // <---- THIS
}
My question is, is there an easy way to limit the area v.move effects?

Also, on a related note, I've notice that dragging the volume quickly all the way to the right doesn't actually get it to 100%. You have to drag it very slowly or use the mouse wheel to get to 100%. This issue is not related to my particular setup as it happens on the sample script as well as you theme 'yuck foo'. Was this a design decision?
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-12-03 08:40:27
Also, on a related note, I've notice that dragging the volume quickly all the way to the right doesn't actually get it to 100%. You have to drag it very slowly or use the mouse wheel to get to 100%. This issue is not related to my particular setup as it happens on the sample script as well as you theme 'yuck foo'. Was this a design decision?


I've noticed other oddities with the volume control, too. If you hover over say themed buttons you can change the volume with the mouse wheel. I think it did it while hovering over ratings as well. Note, this is when they are all crammed into one WSH panel. Singularly they behave as expected.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-03 09:19:36
Also, on a related note, I've notice that dragging the volume quickly all the way to the right doesn't actually get it to 100%. You have to drag it very slowly or use the mouse wheel to get to 100%. This issue is not related to my particular setup as it happens on the sample script as well as you theme 'yuck foo'. Was this a design decision?


the problem was that my code released the "grip" immediately after the mouse passes the right most edge of the volume bar. if you moved too quick, it couldn't keep up.

i've uploaded a fix. right click the panel>Update script.

as for the tooltip thing, i'll have to look into that. i did encounter that problem with a seekbar before but then i forgot about it. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-03 14:33:33
i fixed the tooltip problem when you have multiple scripts in the same panel.

right click>Update script.
full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

an overview of all scripts and setup guide can be found here (http://marc2003.x10host.com/intro).
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-03 19:19:03
i fixed the tooltip problem when you have multiple scripts in the same panel.


Awesome! Both tool tips and the volume have been fixed, but I did catch a small bug. Here's how to reproduce it:

1. hover over an object with a tool tip then move your mouse off the WSH panel

2. hover back over an object in WSH that does not have a tool tip

3. you should now see the tool tip of the last object you hovered over that had a tool tip

Screen shot for reference here (https://www.dropbox.com/s/glu6j5ydzi2axg8/Screenshot%202014-12-03%2010.54.19.png?dl=0). Notice the "Next" tool tip on the bottom under the track title.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-03 19:53:49
i'm not really sure how that happens but i think i've fixed it. right click>Update script.
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-03 21:02:04
i'm not really sure how that happens but i think i've fixed it. right click>Update script.


That did it. Thanks marc2003!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-05 10:52:28
@ godrick and anyone else who might be interested, my musicbrainz script now displays up to 500 releases now instead of the previous 100. there are just 25 artists on the whole of musicbrainz with more than that! bach has 2400 odd and there's no need to see all of that in one panel.

right click>Update script.
full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

an overview of all scripts and setup guide can be found here (http://marc2003.x10host.com/intro).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-05 14:46:13
another update for my musicbrainz script. previously, only releases with a primary type of album, single or EP were shown. now it can show everything with the new Include others option. mostly these will be live performances without a primary type set but it can include normal releases which haven't been tagged properly, interviews, broadcasts etc. as always, these options can be toggled on/off.

same instructions as above for update.
Title: WSH Panel Mod script discussion/help
Post by: godrick on 2014-12-05 23:37:51
The latest musicbrainz script works great! Well thought-out, as always. The improvement I see is not so much that one can scroll through to see more, but with the enhanced release limit the script can now sift though more of the sometimes spotty release info at MB, such that the short list of just albums (for example) can be reliably comprehensive for prolific artists.

Many thanks!
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-07 09:35:50
Marc, this is my old Thumbs modification.
I changed code to receive full google size images.
And it works

I have problem, that -google changes domain depending on country.
So i add 'google domain' in properties, if doesn't work, must change to your 'Google country domain'..
Can you test please, and tell if it works well?
Later I will set this to work with commons8.

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Photos"
// @author "Mire777"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

// Paths
var fbfolder = (fb.ProfilePath + "Artist_info");
var lfm_folder = window.GetProperty("Custom folder", fbfolder);

//Image download size
size = window.GetProperty("Download quality","medium");

//Download server
server = window.GetProperty("Download  source", "last.fm");

//Search terms(google)
terms = window.GetProperty("Custom search terms", "");

//Google domen
g_domain = window.GetProperty("Google domain", "com");

//Cycle
cycle2 = window.GetProperty("Image cycle", 10);

var MF_GRAYED = 0x00000001;
var MF_STRING = 0x00000000;
var IDC_ARROW = 32512;
var IDC_HAND = 32649;

function on_colors_changed() {
p.colors_changed();
}

function on_font_changed() {
//p.font_changed();
}

function on_selection_changed() {
p.item_focus_change();
}

function on_playlist_switch() {
p.item_focus_change();
}

function on_playback_new_track() {
p.item_focus_change();
}

function on_playback_dynamic_info_track() {
p.item_focus_change();
}

function on_playback_stop() {
p.item_focus_change();
}

function on_item_focus_change() {
p.item_focus_change();
}

function on_mouse_rbtn_up(x, y) {
p.rbtn_up(x, y);
return true;
}

//Start Futures
function panel(name, features) {
this.item_focus_change = function() {
if (!this.metadb_func) return;
  switch(this.selection_mode) {
  case 0:
this.metadb = fb.GetSelection();
break;
  case 1:
this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
break;
  case 2:
this.metadb = fb.GetFocusItem();
break;
}
if (this.metadb) on_metadb_changed();
}

//Size
this.size = function() {
this.w = window.Width;
this.h = window.Height;
}

//Move
this.move = function(x, y) {
this.mx = x;
this.my = y;
}

//Menu
this.rbtn_up = function(x, y) {
var _menu = window.CreatePopupMenu();

var idx;
switch(true) {
case typeof a == "object" && a.trace(x, y):

_menu.AppendMenuItem(MF_STRING, 17, "adjust");
_menu.AppendMenuItem(MF_STRING, 18, "Stretch");
_menu.CheckMenuRadioItem(15, 18, a.type == "centre" ? 15 : a.type == "top" ? 16 : a.type == "adjust" ? 17 : 18);
_menu.AppendMenuSeparator();
break;

case typeof th == "object":
case typeof im == "object" && im.trace(x, y):

var _settings = window.CreatePopupMenu();
var _auto_cycle = window.CreatePopupMenu();
var _download_source = window.CreatePopupMenu();
var _download_limit = window.CreatePopupMenu();
var _download_quality = window.CreatePopupMenu();
var _thumbs = window.CreatePopupMenu();
var MF_POPUP = 0x00000010;  

_menu.AppendMenuItem(MF_STRING, 403, "Refresh");
_menu.AppendMenuSeparator();

//Settings Menu
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _settings.ID, "Settings");
_menu.AppendMenuSeparator();
_settings.AppendMenuItem(MF_STRING | MF_POPUP, _auto_cycle.ID, "Auto Cycle");

_auto_cycle.AppendMenuItem(MF_STRING, 415, "05 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 420, "10 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 425, "15 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 430, "20 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 410, "Off");
_auto_cycle.CheckMenuRadioItem(410, 430, cycle2 + 410);


_settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_source.ID, "Download Source");

_download_source.AppendMenuItem(MF_STRING, 1902, "Last.fm");
_download_source.AppendMenuItem(MF_STRING, 1903, "Google");
_download_source.CheckMenuRadioItem(1902, 1904, server == "last.fm" ? 1902 : server == "google" ? 1903 : 1903);

_settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_limit.ID, "Download Limit");
 
_download_limit.AppendMenuItem(MF_STRING, 1905, "1x");
_download_limit.AppendMenuItem(MF_STRING, 1906, "2x");
_download_limit.AppendMenuItem(MF_STRING, 1907, "3x");
_download_limit.AppendMenuItem(MF_STRING, 1908, "4x");
_download_limit.AppendMenuItem(MF_STRING, 1909, "5x");
_download_limit.AppendMenuItem(MF_STRING, 1910, "6x");
_download_limit.CheckMenuRadioItem(1905, 1910, im.limit + 1904);


if (server=="last.fm") _settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_quality.ID, "Download Quality");
_download_quality.AppendMenuItem(MF_STRING, 1911, "Low");
_download_quality.AppendMenuItem(MF_STRING, 1912, "Medium");
_download_quality.AppendMenuItem(MF_STRING, 1913, "High");
_download_quality.CheckMenuRadioItem(1911, 1913, size == "low" ? 1911 : size == "medium" ? 1912 : size == "high" ? 1913 : 1913);

_settings.AppendMenuItem(MF_STRING | MF_POPUP, _thumbs.ID, "Thumbs");

_thumbs.AppendMenuItem(MF_STRING, 1201, "Left");
_thumbs.AppendMenuItem(MF_STRING, 1202, "Right");
_thumbs.AppendMenuItem(MF_STRING, 1203, "Top");
_thumbs.AppendMenuItem(MF_STRING, 1204, "Bottom");
_thumbs.AppendMenuItem(MF_STRING, 1205, "Off");
_thumbs.CheckMenuRadioItem(1200, 1205, th.mode == "grid" ? 1200 : th.mode == "left" ? 1201 : th.mode == "right" ? 1202 : th.mode == "top" ? 1203 : th.mode == "bottom" ? 1204 : 1205);

if (th.mode == "left" | th.mode == "right" | th.mode == "top" | th.mode == "bottom")
{
_thumbs.AppendMenuSeparator();
_thumbs.AppendMenuItem(MF_STRING, 1240, "40px");
_thumbs.AppendMenuItem(MF_STRING, 1250, "50px");
_thumbs.AppendMenuItem(MF_STRING, 1260, "60px");
_thumbs.AppendMenuItem(MF_STRING, 1270, "70px");
_thumbs.AppendMenuItem(MF_STRING, 1280, "80px");
_thumbs.AppendMenuItem(MF_STRING, 1290, "90px");
_thumbs.AppendMenuItem(MF_STRING, 1300, "100px");
_thumbs.AppendMenuItem(MF_STRING, 1350, "150px");
_thumbs.AppendMenuItem(MF_STRING, 1400, "200px");
_thumbs.AppendMenuItem(MF_STRING, 1450, "250px");
_thumbs.AppendMenuItem(MF_STRING, 1500, "300px");
_thumbs.CheckMenuRadioItem(1240, 1500, th.px + 1200);
}
  {
_menu.AppendMenuItem(MF_STRING, 400, "Open Folder");
if (server=="last.fm") _menu.AppendMenuItem(MF_STRING, 21, "Open Last.fm");
if (server=="google")  _menu.AppendMenuItem(MF_STRING, 21, "Open Google");
//_menu.AppendMenuItem(MF_STRING, 402, "Delete image");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING, 405, "Top");
_menu.AppendMenuItem(MF_STRING, 404, "Centre");
_menu.AppendMenuItem(MF_STRING, 406, "Adjust");
_menu.AppendMenuItem(MF_STRING, 407, "Stretch");
_menu.CheckMenuRadioItem(404, 407, im.type == "centre" ? 404 : im.type == "top" ? 405 : im.type == "adjust" ? 406 : 407);
_menu.AppendMenuSeparator();
}
break;
}

if (typeof ps == "object") _menu.AppendMenuItem(l.username.length > 0 ? MF_STRING : MF_GRAYED, 1901, "Last.fm password...");

_menu.AppendMenuItem(MF_STRING, 9, "Properties...");
if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {

case 9:
window.ShowProperties();
break;
case 10:
window.ShowConfigure();
break;

case 15:
case 16:
case 17:
case 18:
a.type = idx == 15 ? "centre" : idx == 16 ? "top" : idx == 17 ? "adjust" : "stretch";
window.SetProperty("artreader_image_type", a.type);
window.RepaintRect(a.x, a.y, a.w, a.h);
break;

case 21:
if (server=="last.fm") this.browser("http://www.last.fm/music/" + encodeURIComponent(p.artist));
else
if (server=="google")  this.browser("https://www.google.rs/search?&tbm=isch&q=" + encodeURIComponent(p.artist) + "+" + terms);
break;

case 400:
this.run("explorer /select,\"" + im.files[im.index] + "\"");
break;

case 403:
if (im.images.length < im.limit)
{
p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
//fix_limit = im.limit;
im.download();
im.update();
}
else
p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
im.update();
break;
case 404:
case 405:
case 406:
case 407:
im.type = idx == 404 ? "centre" : idx == 405 ? "top" : idx == 406 ? "adjust" : "stretch";
window.SetProperty("Image type", im.type);
window.Repaint();
break;
case 410:
case 415:
case 420:
case 425:
case 430:
cycle2 = idx - 410;
window.SetProperty("Image cycle", cycle2);
cicleTimer = undefined;
cicleTimerStarted = false;
stopTimer();
startTimer();
cicleTimerStarted = true;
break;

case 1200:
case 1201:
case 1202:
case 1203:
case 1204:
case 1205:
th.mode = idx == 1200 ? "grid" : idx == 1201 ? "left" : idx == 1202 ? "right" : idx == 1203 ? "top" : idx == 1204 ? "bottom" : "off";
window.SetProperty("Thumbs mode", th.mode);
th.nc = true;
on_size();
window.Repaint();
break;
case 1240:
case 1250:
case 1260:
case 1270:
case 1280:
case 1290:
case 1300:
case 1350:
case 1400:
case 1450:
case 1500:
th.px = idx - 1200;
window.SetProperty("Thumbs px", th.px);
th.nc = true;
on_size();
window.Repaint();
break;

case 1902:
case 1903:
case 1904:
server = idx == 1902 ? "last.fm" : idx == 1903 ? "google" : "google";
window.SetProperty("Download  source", server);
break; 

case 1905:
case 1906:
case 1907:
case 1908:
case 1909:
case 1910:
im.limit = idx - 1904;
window.SetProperty("Download limit", im.limit);
break;

case 1911:
case 1912:
case 1913:
size = idx == 1911 ? "low" : idx == 1912 ? "medium" : idx == 1913 ? "high" : "high";
window.SetProperty("Download quality", size);
break;
}
_menu.Dispose();

}

//Futures Init
this.features_init = function() {
for (i = 0; i < this.features.length; i++) {
switch(this.features[i]) {

case "metadb":
this.selection_mode = window.GetProperty("Selection mode", 1);
break;

case "remap":
this.artist_tf = window.GetProperty("Artist format", "%artist%");
break;
}}}

//Check Future
this.check_feature = function(f) {
for (i = 0; i < this.features.length; i++) {
if (this.features[i] == f) return true;
}
return false;
}

//Eval Title/Format
this.eval = function(tf) {
if (!this.metadb || tf == "") return "";
if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
return fb.TitleFormat(tf).Eval();
} else {
return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
}}

//Console
this.console = function(message) {
fb.trace(this.name + ": " + message);
}

//Msg Box
this.MsgBox = function(prompt, buttons, title) {
prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
title = title.replace(/"/g, '" + Chr(34) + "');
return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
}

//Open In Browser
this.browser = function(command) {
if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, this.name);
}

//Run Command
this.run = function(command) {
try {
  this.WshShell.Run(command);
  return true;
  } catch(e) {
  return false;
}}

//Display Image
this.draw_image = function(gr, img, pos_x, pos_y, width, height, type, border, alpha) {
if (!img) return;
gr.SetInterpolationMode(7);
  switch(type) {
case "centre":
case "top":
  {
var sr = img.Width / img.Height;
var dr = width / height;
if (sr < dr) {
var r = img.Width / width;
var ch = height * r;
var sy = Math.round((img.Height - ch) / (type == "top" ? 1000 : 2));
var cw = img.Width;
var sx = 0;
} else {
var r = img.Height / height;
var cw = width * r;
var sx = Math.round((img.Width - cw) / 2);
var ch = img.Height;
var sy = 0;
}
  {
gr.DrawImage(img, pos_x, pos_y, width, height, sx + 5, sy + 5, cw - 10, ch - 10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, width - 1, height - 1, 1, border);
  }
}
break;
case "stretch":
//strech
gr.DrawImage(img, pos_x, pos_y, width, height, 5, 5, img.Width-10, img.Height-10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, width - 1, height - 1, 1, border);

break;
case "adjust":
default:
//adjust
var s = Math.min(width / img.Width, height / img.Height);
var nw = Math.round(img.Width * s);
var nh = Math.round(img.Height * s);
pos_x += Math.round((width - nw) / 2);
pos_y += Math.round((height - nh) / 2);

gr.DrawImage(img, pos_x, pos_y, nw, nh, 5, 5, img.Width-10, img.Height-10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, nw - 1, nh - 1, 1, border);
break;

}
}

//Remove false string from file names
this.clean_filename = function(filename) {
return filename.replace(/[\/\\|:]/g, '-').replace(/\*/g, 'x').replace(/"/g, "''").replace(/[?<>]/g, '_');
}

this.name = name;
this.features = features;
this.dui = window.InstanceType;
this.script_path = fb.ProfilePath;
this.w = 0;
this.h = 0;
this.mx = 0;
this.my = 0;
this.metadb = fb.GetFocusItem();
this.WshShell = new ActiveXObject("WScript.Shell");
this.fso = new ActiveXObject("Scripting.FileSystemObject");

this.data_folder = lfm_folder + "\\";
if (lfm_folder==fb.ProfilePath + "Artist_info") if (!this.fso.FolderExists(this.data_folder)) this.fso.CreateFolder(this.data_folder), this.data_folder=this.data_folder;
if (!this.fso.FolderExists(this.data_folder)) return; 
this.artist = "";
this.artist_tf = "%artist%";

this.metadb_func = typeof on_metadb_changed == "function";
this.features_init();
}

function artreader(x, y, w, h) {
this.draw = function(gr) {
if (!this.img) return;
p.draw_image(gr, this.img, this.x, this.y, this.w, this.h, this.type);
}

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

this.wheel = function(step) {
if (!this.trace(p.mx, p.my)) return false;
this.id -= step;
if (this.id < 0) this.id = 4;
if (this.id > 4) this.id = 0;
window.SetProperty("artreader_id", this.id);
this.metadb_changed();
return true;
}

this.move = function(x, y) {
if (this.trace(x, y)) {
if (this.img) p.tt("Original size: " + this.img.Width + "x" + this.img.Height + "px");
return true;
} else {
p.ttd();
return false;
}}

this.lbtn_dblclk = function(x, y) {
if (!this.trace(x, y)) return false;
if (this.img) p.run("explorer /select,\"" + this.path + "\"");
return true;
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.img = null;
this.path = null;
}

function images(x, y, w, h) {
this.playback_time = function(time) {
}

this.draw = function (gr) {
if (this.images.length == 0) return;
p.draw_image(gr, this.images[this.index], this.x, this.y, this.w, this.h, this.type);
}

//MetaDB
this.metadb_changed = function() {
if (!p.metadb) return false;
switch(this.mode) {
case "last.fm":
p.artist = p.eval(p.artist_tf);
if (this.artist == p.artist) return false;
this.artist = p.artist;
this.folder = p.data_folder + p.clean_filename(p.artist);
if (!p.fso.FolderExists(this.folder)) p.fso.CreateFolder(this.folder);
break;
}
this.update();
return true;
}

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

this.wheel = function(step) {
if (!p.metadb || this.images.length < 2 || !this.trace(p.mx, p.my) || (typeof th == "object" && th.mode == "grid" && !th.overlay)) return false;
this.index -= step;
if (this.index < 0) this.index = this.images.length - 1;
if (this.index >= this.images.length) this.index = 0;
window.RepaintRect(this.x, this.y, this.w, this.h);
return true;
}

//Db-Click
this.lbtn_dblclk = function(x, y) {
if (!this.trace(x, y)) return false;
p.run("\"" + this.files[this.index] + "\"");
return true;
}

//Download Image
this.download = function()
{
if (!p.fso.FolderExists(this.folder))  return;
{

if (server=="last.fm")
{{
this.working=true;
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+images", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("img");
var urls = [];
for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("http://userserve-ak.last.fm/serve/126s") == 0) urls.push(data[i].src.replace("126s", size == "low" ? "252" : size == "medium" ? "500" : size == "high" ? "_" : "_"));
}
fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + urls[i] + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + urls[i].substring(urls[i].lastIndexOf("/")+1000) + ".jpg" + "\"" , 0, true);
if (im.images.length == 0) {im.update(); fix_limit = im.limit+1;}
if (im.images.length == 0) {return;}
}
im.doc.close();
im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status);
}}}}}

else

if (server=="google")
{{
this.working=true;  
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "https://www.google." + g_domain + "/search?&tbm=isch&q=" + encodeURIComponent(p.artist) + terms + "&tbm=isch&tbs=isz:m", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];

  for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("imgurl=") > 0) urls.push(decodeURIComponent(data[i].href).replace("http://www.google.rs/imgres?imgurl=", "").split("&imgrefurl")[0]);
}
fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
p.console("HTTP: " + urls[i]);
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls[i]) + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + decodeURIComponent(urls[i]).substring(decodeURIComponent(urls[i]).lastIndexOf("d")+1000) + ".jpg" + "\"" , 0, true);
if (im.images.length == 0) {im.update(); fix_limit = im.limit+1;}
if (im.images.length == 0) {return;}
}
im.doc.close();
im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status + urls);
}}}}}}}


this.update = function() {
this.index = 0;
for (i = 0; i < this.images.length; i++) {
try { this.images[i].Dispose(); } catch(e) {}
}
this.folders = this.folder.split("|");
this.files = [];
for (i = 0; i < this.folders.length; i++) {
if (p.fso.FolderExists(this.folders[i])) this.files = this.files.concat(utils.Glob(this.folders[i] + "\\*.jpg").toArray(), utils.Glob(this.folders[i] + "\\*.jpeg").toArray(), utils.Glob(this.folders[i] + "\\*.png").toArray(), utils.Glob(this.folders[i] + "\\*.gif").toArray());
}

this.images = [];
for (i = 0; i < this.files.length; i++) {
this.images[i] = gdi.Image(this.files[i]);
}
if (typeof th == "object") {
th.nc = true;
th.calc();
}
  window.Repaint();
}

//Delete Image
this.delete_image = function() {
if (!this.app) this.app = new ActiveXObject("Shell.Application");
this.app.Namespace(10).MoveHere(this.files[this.index]);
window.SetTimeout(function() {
im.update();
window.NotifyOthers("images", "update");
}, 100);
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.files = [];
this.images = [];
this.index = 0;
this.artist = "";
this.folder = "";
this.limit = window.GetProperty("Download limit", 6);
this.mode = ("last.fm");
this.type = window.GetProperty("Image type", "adjust");
this.auto_download = window.GetProperty("Download  [on/off]", "on");
}

//Thumbs
function thumbs() {
this.trace = function(x, y) {
return (x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h);
}

this.draw = function(gr) {
switch(true) {
case im.images.length == 0:
break;
case this.mode == "off":
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
case !this.img:
break;
case this.mode == "grid":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, 0, this.offset * this.px, this.w, this.h);
if (this.overlay) {
gr.FillSolidRect(this.x, this.y, this.w, this.h, RGBA(0, 0, 0, 126));
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "adjust");
}
break;
case this.mode == "left":
case this.mode == "right":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, 0, this.offset * this.px, this.w, this.h);
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
case this.mode == "bottom":
case this.mode == "top":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, this.offset * this.px, 0, this.w, this.h);
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
}}

this.calc = function() {
this.offset = 0;
switch(true) {
case p.w < this.px || p.h < this.px || this.mode == "off":
this.nc = true;
this.img && this.img.Dispose();
this.img = null;
im.x = 0;
im.y = 0;
im.w = p.w;
im.h = p.h;
break;
case this.mode == "grid":
this.x = 0;
this.y = 0;
this.w = p.w;
this.h = p.h;
im.x = 40;
im.y = 40;
im.w = this.w - 80;
im.h = this.h - 80;
if (!this.nc && this.columns != Math.floor(this.w / this.px)) this.nc = true;
this.overlay = false;
this.rows = Math.ceil(this.h / this.px);
this.columns = Math.floor(this.w / this.px);
this.img_rows = Math.ceil(im.images.length / this.columns);
if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(Math.min(this.columns, im.images.length) * this.px, this.img_rows * this.px);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
var ci = 0;
var row, col;
for (row = 0; row < this.img_rows; row++) {
for (col = 0; col < this.columns; col++) {
if (ci == im.images.length) continue;
p.draw_image(temp_gr, im.images[ci], col * this.px, row * this.px, this.px, this.px, "top");
ci++;
}}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
case this.mode == "left":
case this.mode == "right":
this.x = this.mode == "left" ? 0 : p.w - this.px;
this.y = 0;
this.w = this.px;
this.h = p.h;
im.x = this.mode == "right" ? 0 : this.px;
im.y = 0;
im.w = p.w - this.px;
im.h = p.h;
this.rows = Math.ceil(this.h / this.px);

if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(this.px, this.px * im.images.length);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
for (i = 0; i < im.images.length; i++) {
p.draw_image(temp_gr, im.images[i], 0, i * this.px, this.px, this.px, "top");
}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
case this.mode == "bottom":
case this.mode == "top":
this.x = 0;
this.y = this.mode == "top" ? 0 : p.h - this.px;
this.w = p.w;
this.h = this.px;
im.x = 0;
im.y = this.mode == "bottom" ? 0 : this.px;
im.w = p.w;
im.h = p.h - this.px;
this.columns = Math.ceil(this.w / this.px);

if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(this.px * im.images.length, this.px);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
for (i = 0; i < im.images.length; i++) {
p.draw_image(temp_gr, im.images[i], i * this.px, 0, this.px, this.px, "top");
}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
}}

this.wheel = function(step) {
switch(true) {
case !this.trace(p.mx, p.my):
case this.overlay:
return false;
case this.mode == "grid":
if (this.img_rows < this.rows) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.offset > this.img_rows - this.rows) this.offset = this.img_rows - this.rows + 1;
break;
case this.mode == "left":
case this.mode == "right":
if (im.images.length < this.rows) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.rows + this.offset > im.images.length) this.offset = im.images.length - this.rows + 1;
break;
case this.mode == "bottom":
case this.mode == "top":
if (im.images.length < this.columns) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.columns + this.offset > im.images.length) this.offset = im.images.length - this.columns + 1;
break;
}
window.RepaintRect(this.x, this.y, this.w, this.h);
return true;
}

this.move = function(x, y) {
switch(true) {
case !this.trace(x, y):
window.SetCursor(IDC_ARROW);
return false;
case this.overlay:
window.SetCursor(IDC_ARROW);
return true;
case this.mode == "grid":
this.index = Math.floor((x - this.x) / this.px) + (Math.floor((y - this.y) / this.px) * this.columns) + (this.offset * this.columns);
break;
case this.mode == "left":
case this.mode == "right":
this.index = Math.floor((y - this.y) / this.px) + this.offset;
break;
case this.mode == "bottom":
case this.mode == "top":
this.index = Math.floor((x - this.x) / this.px) + this.offset;
break;
}
window.SetCursor(this.index < im.images.length ? IDC_HAND : IDC_ARROW);
return true;
}

this.lbtn_up = function(x, y) {
switch(true) {
case !this.trace(x, y):
return false;
case this.mode == "grid" && this.overlay && im.trace(x, y):
this.overlay = false;
window.Repaint();
break;
case this.mode == "grid" && this.index < im.images.length && !this.overlay:
this.overlay = true;
im.index = this.index;
window.Repaint();
break;
case this.overlay:
break;
case this.index < im.images.length:
im.index = this.index;
window.Repaint();
}
return true;
}

this.lbtn_dblclk = function(x, y) {
if (!im.trace(x, y) || th.mode == "grid") return false;
p.run("\"" + im.files[im.index] + "\"");
return true;
}

this.nc = false;
this.mode = window.GetProperty("Thumbs mode", p.check_feature("now_playing") ? "off" : "off");
this.px = window.GetProperty("Thumbs px", 40);
this.img = null;
}

//START---->
var p = new panel("Thumbs", ["remap", "metadb"]);
var im = new images(0, 0, 0, 0);
var th = new thumbs();

on_item_focus_change();

function on_playback_time(time) {
im.playback_time(time);
}

function on_size() {
p.size();
th.calc();
}

function on_paint(gr) {
th.draw(gr);
}

function on_metadb_changed() {
im.metadb_changed();
if (im.images.length == 0 && im.auto_download=="on")
im.download();
}

function on_mouse_wheel(step) {
if (th.wheel(step)) return;
if (im.wheel(step)) return;
}

function on_mouse_move(x, y) {
p.move(x, y);
th.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
th.lbtn_up(x, y);
}

function on_mouse_lbtn_dblclk(x, y) {
th.lbtn_dblclk(x, y);
}

//Auto Cycle Image
var cicleTimerStarted = false;
var cicleTimer = null;
 
(function startTimer(){
 
if(!cicleTimerStarted){

cicleTimer = window.CreateTimerInterval(cycle2+"000");
cicleTimerStarted = true;
}
 
})();
 
function stopTimer(){
 
if(!cicleTimerStarted) return;
window.KillTimer(cicleTimer);
cicleTimer = undefined;
cicleTimerStarted = false;
 
}
 
function on_timer(id) {
if(cicleTimer && id == cicleTimer.ID){
 
{
do{
im.index++
if (im.index == im.images.length) im.index=0;
window.Repaint();
}while (im.index==-1);
}}}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-08 09:16:01
@mire777, i'll take a look at your script later.

I've noticed other oddities with the volume control, too. If you hover over say themed buttons you can change the volume with the mouse wheel.


i only just discovered this bug. it has now been fixed.

right click>Update script.

i've also made improvements to how tooltips appear. although my "fix" last week sort of worked, it wasn't the best.

these changes may have broken small web links if anyone uses that. if so, it can be downloaded again here: https://dl.dropboxusercontent.com/u/2280132...web%20links.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8/small%20web%20links.txt)


Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-12-08 16:01:20
@marc2003,
How can we add two last.fm similar artists panels in same panel?
I created two objects but they have the same write click options so they both display the same thing(top tags ,similar artists).How to do this??

And following method you gave to me doesn't work with common8.js .I tried to make relevant changes but i failed :/ so please can you provide a new script
Quote
@samithaj, it's not possible to re-use an autoplaylist but when using a fixed name, it's possible to delete old ones first before creating a new one. obviously you'd want a playlist name that won't conflict with anything else. open the panel, scroll to the end and replace the entire last function with this....

Code: [Select]
function on_mouse_lbtn_up(x, y) {
switch(true) {
case li.up_btn.lbtn_up(x, y):
case li.down_btn.lbtn_up(x, y):
break;
case li.in_range && x > li.x + li.text_x && x < li.x + li.text_x + Math.min(li.names_widths[li.index], li.text_width):
switch(true) {
case li.lastfm_mode != 2 && li.lastfm_link == "autoplaylist":
var i = 0;
while(i < fb.PlaylistCount) {
if (fb.GetPlaylistName(i) == "Last.fm Similar") fb.RemovePlaylist(i);
else i++;
}
fb.CreateAutoPlaylist(fb.PlaylistCount, "Last.fm Similar", li.queries[li.index]);
fb.ActivePlaylist = fb.PlaylistCount - 1;
break;
default:
p.browser(li.urls[li.index]);
break;
}
break;
}
}




@mire777,
I tested your script and google images doesn't work even i put the Google domain,I think you need to provide bio_photos.vbs??
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-08 21:10:25
@mire777,
I tested your script and google images doesn't work even i put the Google domain,I think you need to provide bio_photos.vbs??

Just copy 'download.vbs' from 'marc2003 folder', rename file in 'bio_photos.vbs'
And put this in main foobar folder.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-09 02:20:09
How can we add two last.fm similar artists panels in same panel?


that's not possible. autoplaylists, properties, musicbrainz, news-reviews-blogs, last.fm similar artists and last.fm charts all start off with this bit of code...

Code: [Select]
var li = new list(....


you can't have more than one instance of that in the same panel.

Quote
And following method you gave to me doesn't work with common8.js


replace

Code: [Select]
case li.lastfm_mode != 2 && li.lastfm_link == "autoplaylist":


with

Code: [Select]
case li.lastfm_mode != 2 && !li.lastfm_link:
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-09 02:54:34
@mire777, i'll take a look at your script later.

I've noticed other oddities with the volume control, too. If you hover over say themed buttons you can change the volume with the mouse wheel.


i only just discovered this bug. it has now been fixed.

right click>Update script.

i've also made improvements to how tooltips appear. although my "fix" last week sort of worked, it wasn't the best.

these changes may have broken small web links if anyone uses that. if so, it can be downloaded again here: https://dl.dropboxusercontent.com/u/2280132...web%20links.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8/small%20web%20links.txt)


How do I revert this back so it the scroll wheel takes over the whole panel? I liked being able to control the volume with the wheel no matter where I was in the panel.

Also, is there a way to make double click on art reader open the media's containing folder even when there's no cover image? Right now, it's taking me to the stub image's folder when there is no cover image.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-09 08:04:38
How do I revert this back so it the scroll wheel takes over the whole panel?


open the panel and inside the on_mouse_wheel function, replace

Code: [Select]
v.wheel(step);


with

Code: [Select]
fb.Volume += step;


Quote
Also, is there a way to make double click on art reader open the media's containing folder even when there's no cover image?


my script doesn't know or care about your stub image not being actual art. it's presented as an image by the preferences! but you can modify the code. inside on_mouse_lbtn_dblclk, replace

Code: [Select]
a.lbtn_dblclk(x, y);


with

Code: [Select]
if (p.metadb) p.explorer(p.metadb.Path);


edit: that code makes the whole panel react to the double click. if the artreader only takes a smaller area, you can use this so it only triggers when the mouse is over it.

Code: [Select]
if (p.metadb && a.trace(x, y)) return p.explorer(p.metadb.Path);
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-12-09 11:37:35
@mire777,
I tested your script and google images doesn't work even i put the Google domain,I think you need to provide bio_photos.vbs??

Just copy 'download.vbs' from 'marc2003 folder', rename file in 'bio_photos.vbs'
And put this in main foobar folder.

I did and now last.fm images are working but still no on google images :/.I looked at Artist_info folder folders are created but no images.
Console shows like this:
Thumbs: HTTP: http://www.google.lk/imgres?imgurl=http://...e_firsttime.jpg (http://www.google.lk/imgres?imgurl=http://upload.wikimedia.org/wikipedia/en/1/18/Lifehouse_firsttime.jpg)


Can some one tell me how to get "%playback time%/ %length%" to display on WSH panal??
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-09 15:58:23
I did and now last.fm images are working but still no on google images :/.I looked at Artist_info folder folders are created but no images.
Console shows like this:
Thumbs: HTTP: http://www.google.lk/imgres?imgurl=http://...e_firsttime.jpg (http://www.google.lk/imgres?imgurl=http://upload.wikimedia.org/wikipedia/en/1/18/Lifehouse_firsttime.jpg)

Uh, my mistake
Try this. Should work now..

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Photos"
// @author "Mire777"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

// Paths
var fbfolder = (fb.ProfilePath + "Artist_info");
var lfm_folder = window.GetProperty("Custom folder", fbfolder);

//Image download size
size = window.GetProperty("Download quality","medium");

//Download server
server = window.GetProperty("Download  source", "last.fm");

//Search terms(google)
terms = window.GetProperty("Custom search terms", "");

//Google domen
g_domain = window.GetProperty("Google domain", "com");

//Cycle
cycle2 = window.GetProperty("Image cycle", 10);

var MF_GRAYED = 0x00000001;
var MF_STRING = 0x00000000;
var IDC_ARROW = 32512;
var IDC_HAND = 32649;

function on_colors_changed() {
p.colors_changed();
}

function on_font_changed() {
//p.font_changed();
}

function on_selection_changed() {
p.item_focus_change();
}

function on_playlist_switch() {
p.item_focus_change();
}

function on_playback_new_track() {
p.item_focus_change();
}

function on_playback_dynamic_info_track() {
p.item_focus_change();
}

function on_playback_stop() {
p.item_focus_change();
}

function on_item_focus_change() {
p.item_focus_change();
}

function on_mouse_rbtn_up(x, y) {
p.rbtn_up(x, y);
return true;
}

//Start Futures
function panel(name, features) {
this.item_focus_change = function() {
if (!this.metadb_func) return;
  switch(this.selection_mode) {
  case 0:
this.metadb = fb.GetSelection();
break;
  case 1:
this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
break;
  case 2:
this.metadb = fb.GetFocusItem();
break;
}
if (this.metadb) on_metadb_changed();
}

//Size
this.size = function() {
this.w = window.Width;
this.h = window.Height;
}

//Move
this.move = function(x, y) {
this.mx = x;
this.my = y;
}

//Menu
this.rbtn_up = function(x, y) {
var _menu = window.CreatePopupMenu();

var idx;
switch(true) {
case typeof a == "object" && a.trace(x, y):

_menu.AppendMenuItem(MF_STRING, 17, "adjust");
_menu.AppendMenuItem(MF_STRING, 18, "Stretch");
_menu.CheckMenuRadioItem(15, 18, a.type == "centre" ? 15 : a.type == "top" ? 16 : a.type == "adjust" ? 17 : 18);
_menu.AppendMenuSeparator();
break;

case typeof th == "object":
case typeof im == "object" && im.trace(x, y):

var _settings = window.CreatePopupMenu();
var _auto_cycle = window.CreatePopupMenu();
var _download_source = window.CreatePopupMenu();
var _download_limit = window.CreatePopupMenu();
var _download_quality = window.CreatePopupMenu();
var _thumbs = window.CreatePopupMenu();
var MF_POPUP = 0x00000010;  

_menu.AppendMenuItem(MF_STRING, 403, "Refresh");
_menu.AppendMenuSeparator();

//Settings Menu
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _settings.ID, "Settings");
_menu.AppendMenuSeparator();
_settings.AppendMenuItem(MF_STRING | MF_POPUP, _auto_cycle.ID, "Auto Cycle");

_auto_cycle.AppendMenuItem(MF_STRING, 415, "05 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 420, "10 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 425, "15 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 430, "20 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 410, "Off");
_auto_cycle.CheckMenuRadioItem(410, 430, cycle2 + 410);


_settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_source.ID, "Download Source");

_download_source.AppendMenuItem(MF_STRING, 1902, "Last.fm");
_download_source.AppendMenuItem(MF_STRING, 1903, "Google");
_download_source.CheckMenuRadioItem(1902, 1904, server == "last.fm" ? 1902 : server == "google" ? 1903 : 1903);

_settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_limit.ID, "Download Limit");
 
_download_limit.AppendMenuItem(MF_STRING, 1905, "1x");
_download_limit.AppendMenuItem(MF_STRING, 1906, "2x");
_download_limit.AppendMenuItem(MF_STRING, 1907, "3x");
_download_limit.AppendMenuItem(MF_STRING, 1908, "4x");
_download_limit.AppendMenuItem(MF_STRING, 1909, "5x");
_download_limit.AppendMenuItem(MF_STRING, 1910, "6x");
_download_limit.CheckMenuRadioItem(1905, 1910, im.limit + 1904);


if (server=="last.fm") _settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_quality.ID, "Download Quality");
_download_quality.AppendMenuItem(MF_STRING, 1911, "Low");
_download_quality.AppendMenuItem(MF_STRING, 1912, "Medium");
_download_quality.AppendMenuItem(MF_STRING, 1913, "High");
_download_quality.CheckMenuRadioItem(1911, 1913, size == "low" ? 1911 : size == "medium" ? 1912 : size == "high" ? 1913 : 1913);

_settings.AppendMenuItem(MF_STRING | MF_POPUP, _thumbs.ID, "Thumbs");

_thumbs.AppendMenuItem(MF_STRING, 1201, "Left");
_thumbs.AppendMenuItem(MF_STRING, 1202, "Right");
_thumbs.AppendMenuItem(MF_STRING, 1203, "Top");
_thumbs.AppendMenuItem(MF_STRING, 1204, "Bottom");
_thumbs.AppendMenuItem(MF_STRING, 1205, "Off");
_thumbs.CheckMenuRadioItem(1200, 1205, th.mode == "grid" ? 1200 : th.mode == "left" ? 1201 : th.mode == "right" ? 1202 : th.mode == "top" ? 1203 : th.mode == "bottom" ? 1204 : 1205);

if (th.mode == "left" | th.mode == "right" | th.mode == "top" | th.mode == "bottom")
{
_thumbs.AppendMenuSeparator();
_thumbs.AppendMenuItem(MF_STRING, 1240, "40px");
_thumbs.AppendMenuItem(MF_STRING, 1250, "50px");
_thumbs.AppendMenuItem(MF_STRING, 1260, "60px");
_thumbs.AppendMenuItem(MF_STRING, 1270, "70px");
_thumbs.AppendMenuItem(MF_STRING, 1280, "80px");
_thumbs.AppendMenuItem(MF_STRING, 1290, "90px");
_thumbs.AppendMenuItem(MF_STRING, 1300, "100px");
_thumbs.AppendMenuItem(MF_STRING, 1350, "150px");
_thumbs.AppendMenuItem(MF_STRING, 1400, "200px");
_thumbs.AppendMenuItem(MF_STRING, 1450, "250px");
_thumbs.AppendMenuItem(MF_STRING, 1500, "300px");
_thumbs.CheckMenuRadioItem(1240, 1500, th.px + 1200);
}
  {
_menu.AppendMenuItem(MF_STRING, 400, "Open Folder");
if (server=="last.fm") _menu.AppendMenuItem(MF_STRING, 21, "Open Last.fm");
if (server=="google")  _menu.AppendMenuItem(MF_STRING, 21, "Open Google");
//_menu.AppendMenuItem(MF_STRING, 402, "Delete image");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING, 405, "Top");
_menu.AppendMenuItem(MF_STRING, 404, "Centre");
_menu.AppendMenuItem(MF_STRING, 406, "Adjust");
_menu.AppendMenuItem(MF_STRING, 407, "Stretch");
_menu.CheckMenuRadioItem(404, 407, im.type == "centre" ? 404 : im.type == "top" ? 405 : im.type == "adjust" ? 406 : 407);
_menu.AppendMenuSeparator();
}
break;
}

if (typeof ps == "object") _menu.AppendMenuItem(l.username.length > 0 ? MF_STRING : MF_GRAYED, 1901, "Last.fm password...");

_menu.AppendMenuItem(MF_STRING, 9, "Properties...");
if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {

case 9:
window.ShowProperties();
break;
case 10:
window.ShowConfigure();
break;

case 15:
case 16:
case 17:
case 18:
a.type = idx == 15 ? "centre" : idx == 16 ? "top" : idx == 17 ? "adjust" : "stretch";
window.SetProperty("artreader_image_type", a.type);
window.RepaintRect(a.x, a.y, a.w, a.h);
break;

case 21:
if (server=="last.fm") this.browser("http://www.last.fm/music/" + encodeURIComponent(p.artist));
else
if (server=="google")  this.browser("https://www.google.rs/search?&tbm=isch&q=" + encodeURIComponent(p.artist) + "+" + terms);
break;

case 400:
this.run("explorer /select,\"" + im.files[im.index] + "\"");
break;

case 403:
if (im.images.length < im.limit)
{
p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
//fix_limit = im.limit;
im.download();
im.update();
}
else
p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
im.update();
break;
case 404:
case 405:
case 406:
case 407:
im.type = idx == 404 ? "centre" : idx == 405 ? "top" : idx == 406 ? "adjust" : "stretch";
window.SetProperty("Image type", im.type);
window.Repaint();
break;
case 410:
case 415:
case 420:
case 425:
case 430:
cycle2 = idx - 410;
window.SetProperty("Image cycle", cycle2);
cicleTimer = undefined;
cicleTimerStarted = false;
stopTimer();
startTimer();
cicleTimerStarted = true;
break;

case 1200:
case 1201:
case 1202:
case 1203:
case 1204:
case 1205:
th.mode = idx == 1200 ? "grid" : idx == 1201 ? "left" : idx == 1202 ? "right" : idx == 1203 ? "top" : idx == 1204 ? "bottom" : "off";
window.SetProperty("Thumbs mode", th.mode);
th.nc = true;
on_size();
window.Repaint();
break;
case 1240:
case 1250:
case 1260:
case 1270:
case 1280:
case 1290:
case 1300:
case 1350:
case 1400:
case 1450:
case 1500:
th.px = idx - 1200;
window.SetProperty("Thumbs px", th.px);
th.nc = true;
on_size();
window.Repaint();
break;

case 1902:
case 1903:
case 1904:
server = idx == 1902 ? "last.fm" : idx == 1903 ? "google" : "google";
window.SetProperty("Download  source", server);
break; 

case 1905:
case 1906:
case 1907:
case 1908:
case 1909:
case 1910:
im.limit = idx - 1904;
window.SetProperty("Download limit", im.limit);
break;

case 1911:
case 1912:
case 1913:
size = idx == 1911 ? "low" : idx == 1912 ? "medium" : idx == 1913 ? "high" : "high";
window.SetProperty("Download quality", size);
break;
}
_menu.Dispose();

}

//Futures Init
this.features_init = function() {
for (i = 0; i < this.features.length; i++) {
switch(this.features[i]) {

case "metadb":
this.selection_mode = window.GetProperty("Selection mode", 1);
break;

case "remap":
this.artist_tf = window.GetProperty("Artist format", "%artist%");
break;
}}}

//Check Future
this.check_feature = function(f) {
for (i = 0; i < this.features.length; i++) {
if (this.features[i] == f) return true;
}
return false;
}

//Eval Title/Format
this.eval = function(tf) {
if (!this.metadb || tf == "") return "";
if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
return fb.TitleFormat(tf).Eval();
} else {
return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
}}

//Console
this.console = function(message) {
fb.trace(this.name + ": " + message);
}

//Msg Box
this.MsgBox = function(prompt, buttons, title) {
prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
title = title.replace(/"/g, '" + Chr(34) + "');
return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
}

//Open In Browser
this.browser = function(command) {
if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, this.name);
}

//Run Command
this.run = function(command) {
try {
  this.WshShell.Run(command);
  return true;
  } catch(e) {
  return false;
}}

//Display Image
this.draw_image = function(gr, img, pos_x, pos_y, width, height, type, border, alpha) {
if (!img) return;
gr.SetInterpolationMode(7);
  switch(type) {
case "centre":
case "top":
  {
var sr = img.Width / img.Height;
var dr = width / height;
if (sr < dr) {
var r = img.Width / width;
var ch = height * r;
var sy = Math.round((img.Height - ch) / (type == "top" ? 1000 : 2));
var cw = img.Width;
var sx = 0;
} else {
var r = img.Height / height;
var cw = width * r;
var sx = Math.round((img.Width - cw) / 2);
var ch = img.Height;
var sy = 0;
}
  {
gr.DrawImage(img, pos_x, pos_y, width, height, sx + 5, sy + 5, cw - 10, ch - 10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, width - 1, height - 1, 1, border);
  }
}
break;
case "stretch":
//strech
gr.DrawImage(img, pos_x, pos_y, width, height, 5, 5, img.Width-10, img.Height-10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, width - 1, height - 1, 1, border);

break;
case "adjust":
default:
//adjust
var s = Math.min(width / img.Width, height / img.Height);
var nw = Math.round(img.Width * s);
var nh = Math.round(img.Height * s);
pos_x += Math.round((width - nw) / 2);
pos_y += Math.round((height - nh) / 2);

gr.DrawImage(img, pos_x, pos_y, nw, nh, 5, 5, img.Width-10, img.Height-10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, nw - 1, nh - 1, 1, border);
break;

}
}

//Remove false string from file names
this.clean_filename = function(filename) {
return filename.replace(/[\/\\|:]/g, '-').replace(/\*/g, 'x').replace(/"/g, "''").replace(/[?<>]/g, '_');
}

this.name = name;
this.features = features;
this.dui = window.InstanceType;
this.script_path = fb.ProfilePath;
this.w = 0;
this.h = 0;
this.mx = 0;
this.my = 0;
this.metadb = fb.GetFocusItem();
this.WshShell = new ActiveXObject("WScript.Shell");
this.fso = new ActiveXObject("Scripting.FileSystemObject");

this.data_folder = lfm_folder + "\\";
if (lfm_folder==fb.ProfilePath + "Artist_info") if (!this.fso.FolderExists(this.data_folder)) this.fso.CreateFolder(this.data_folder), this.data_folder=this.data_folder;
if (!this.fso.FolderExists(this.data_folder)) return; 
this.artist = "";
this.artist_tf = "%artist%";

this.metadb_func = typeof on_metadb_changed == "function";
this.features_init();
}

function artreader(x, y, w, h) {
this.draw = function(gr) {
if (!this.img) return;
p.draw_image(gr, this.img, this.x, this.y, this.w, this.h, this.type);
}

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

this.wheel = function(step) {
if (!this.trace(p.mx, p.my)) return false;
this.id -= step;
if (this.id < 0) this.id = 4;
if (this.id > 4) this.id = 0;
window.SetProperty("artreader_id", this.id);
this.metadb_changed();
return true;
}

this.move = function(x, y) {
if (this.trace(x, y)) {
if (this.img) p.tt("Original size: " + this.img.Width + "x" + this.img.Height + "px");
return true;
} else {
p.ttd();
return false;
}}

this.lbtn_dblclk = function(x, y) {
if (!this.trace(x, y)) return false;
if (this.img) p.run("explorer /select,\"" + this.path + "\"");
return true;
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.img = null;
this.path = null;
}

function images(x, y, w, h) {
this.playback_time = function(time) {
}

this.draw = function (gr) {
if (this.images.length == 0) return;
p.draw_image(gr, this.images[this.index], this.x, this.y, this.w, this.h, this.type);
}

//MetaDB
this.metadb_changed = function() {
if (!p.metadb) return false;
switch(this.mode) {
case "last.fm":
p.artist = p.eval(p.artist_tf);
if (this.artist == p.artist) return false;
this.artist = p.artist;
this.folder = p.data_folder + p.clean_filename(p.artist);
if (!p.fso.FolderExists(this.folder)) p.fso.CreateFolder(this.folder);
break;
}
this.update();
return true;
}

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

this.wheel = function(step) {
if (!p.metadb || this.images.length < 2 || !this.trace(p.mx, p.my) || (typeof th == "object" && th.mode == "grid" && !th.overlay)) return false;
this.index -= step;
if (this.index < 0) this.index = this.images.length - 1;
if (this.index >= this.images.length) this.index = 0;
window.RepaintRect(this.x, this.y, this.w, this.h);
return true;
}

//Db-Click
this.lbtn_dblclk = function(x, y) {
if (!this.trace(x, y)) return false;
p.run("\"" + this.files[this.index] + "\"");
return true;
}

//Download Image
this.download = function()
{
if (!p.fso.FolderExists(this.folder))  return;
{

if (server=="last.fm")
{{
this.working=true;
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+images", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("img");
var urls = [];
for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("http://userserve-ak.last.fm/serve/126s") == 0) urls.push(data[i].src.replace("126s", size == "low" ? "252" : size == "medium" ? "500" : size == "high" ? "_" : "_"));
}
fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + urls[i] + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + urls[i].substring(urls[i].lastIndexOf("/")+1000) + ".jpg" + "\"" , 0, true);
if (im.images.length == 0) {im.update(); fix_limit = im.limit+1;}
if (im.images.length == 0) {return;}
}
im.doc.close();
im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status);
}}}}}

else

if (server=="google")
{{
this.working=true;  
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "https://www.google." + g_domain + "/search?&tbm=isch&q=" + encodeURIComponent(p.artist) + terms + "&tbm=isch&tbs=isz:m", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];

for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("imgurl=") > 0) urls.push(data[i].href.split("imgurl=")[1].split("&imgrefurl")[0]);
}
fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
urls[i] = decodeURIComponent(urls[i]);
p.console("HTTP: " + urls[i]);
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls[i]) + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + decodeURIComponent(urls[i]).substring(decodeURIComponent(urls[i]).lastIndexOf("d")+1000) + ".jpg" + "\"" , 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}
}
im.doc.close();
im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status + urls);
}}}}}}}


this.update = function() {
this.index = 0;
for (i = 0; i < this.images.length; i++) {
try { this.images[i].Dispose(); } catch(e) {}
}
this.folders = this.folder.split("|");
this.files = [];
for (i = 0; i < this.folders.length; i++) {
if (p.fso.FolderExists(this.folders[i])) this.files = this.files.concat(utils.Glob(this.folders[i] + "\\*.jpg").toArray(), utils.Glob(this.folders[i] + "\\*.jpeg").toArray(), utils.Glob(this.folders[i] + "\\*.png").toArray(), utils.Glob(this.folders[i] + "\\*.gif").toArray());
}

this.images = [];
for (i = 0; i < this.files.length; i++) {
this.images[i] = gdi.Image(this.files[i]);
}
if (typeof th == "object") {
th.nc = true;
th.calc();
}
  window.Repaint();
}

//Delete Image
this.delete_image = function() {
if (!this.app) this.app = new ActiveXObject("Shell.Application");
this.app.Namespace(10).MoveHere(this.files[this.index]);
window.SetTimeout(function() {
im.update();
window.NotifyOthers("images", "update");
}, 100);
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.files = [];
this.images = [];
this.index = 0;
this.artist = "";
this.folder = "";
this.limit = window.GetProperty("Download limit", 6);
this.mode = ("last.fm");
this.type = window.GetProperty("Image type", "adjust");
this.auto_download = window.GetProperty("Download  [on/off]", "on");
}

//Thumbs
function thumbs() {
this.trace = function(x, y) {
return (x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h);
}

this.draw = function(gr) {
switch(true) {
case im.images.length == 0:
break;
case this.mode == "off":
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
case !this.img:
break;
case this.mode == "grid":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, 0, this.offset * this.px, this.w, this.h);
if (this.overlay) {
gr.FillSolidRect(this.x, this.y, this.w, this.h, RGBA(0, 0, 0, 126));
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "adjust");
}
break;
case this.mode == "left":
case this.mode == "right":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, 0, this.offset * this.px, this.w, this.h);
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
case this.mode == "bottom":
case this.mode == "top":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, this.offset * this.px, 0, this.w, this.h);
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
}}

this.calc = function() {
this.offset = 0;
switch(true) {
case p.w < this.px || p.h < this.px || this.mode == "off":
this.nc = true;
this.img && this.img.Dispose();
this.img = null;
im.x = 0;
im.y = 0;
im.w = p.w;
im.h = p.h;
break;
case this.mode == "grid":
this.x = 0;
this.y = 0;
this.w = p.w;
this.h = p.h;
im.x = 40;
im.y = 40;
im.w = this.w - 80;
im.h = this.h - 80;
if (!this.nc && this.columns != Math.floor(this.w / this.px)) this.nc = true;
this.overlay = false;
this.rows = Math.ceil(this.h / this.px);
this.columns = Math.floor(this.w / this.px);
this.img_rows = Math.ceil(im.images.length / this.columns);
if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(Math.min(this.columns, im.images.length) * this.px, this.img_rows * this.px);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
var ci = 0;
var row, col;
for (row = 0; row < this.img_rows; row++) {
for (col = 0; col < this.columns; col++) {
if (ci == im.images.length) continue;
p.draw_image(temp_gr, im.images[ci], col * this.px, row * this.px, this.px, this.px, "top");
ci++;
}}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
case this.mode == "left":
case this.mode == "right":
this.x = this.mode == "left" ? 0 : p.w - this.px;
this.y = 0;
this.w = this.px;
this.h = p.h;
im.x = this.mode == "right" ? 0 : this.px;
im.y = 0;
im.w = p.w - this.px;
im.h = p.h;
this.rows = Math.ceil(this.h / this.px);

if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(this.px, this.px * im.images.length);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
for (i = 0; i < im.images.length; i++) {
p.draw_image(temp_gr, im.images[i], 0, i * this.px, this.px, this.px, "top");
}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
case this.mode == "bottom":
case this.mode == "top":
this.x = 0;
this.y = this.mode == "top" ? 0 : p.h - this.px;
this.w = p.w;
this.h = this.px;
im.x = 0;
im.y = this.mode == "bottom" ? 0 : this.px;
im.w = p.w;
im.h = p.h - this.px;
this.columns = Math.ceil(this.w / this.px);

if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(this.px * im.images.length, this.px);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
for (i = 0; i < im.images.length; i++) {
p.draw_image(temp_gr, im.images[i], i * this.px, 0, this.px, this.px, "top");
}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
}}

this.wheel = function(step) {
switch(true) {
case !this.trace(p.mx, p.my):
case this.overlay:
return false;
case this.mode == "grid":
if (this.img_rows < this.rows) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.offset > this.img_rows - this.rows) this.offset = this.img_rows - this.rows + 1;
break;
case this.mode == "left":
case this.mode == "right":
if (im.images.length < this.rows) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.rows + this.offset > im.images.length) this.offset = im.images.length - this.rows + 1;
break;
case this.mode == "bottom":
case this.mode == "top":
if (im.images.length < this.columns) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.columns + this.offset > im.images.length) this.offset = im.images.length - this.columns + 1;
break;
}
window.RepaintRect(this.x, this.y, this.w, this.h);
return true;
}

this.move = function(x, y) {
switch(true) {
case !this.trace(x, y):
window.SetCursor(IDC_ARROW);
return false;
case this.overlay:
window.SetCursor(IDC_ARROW);
return true;
case this.mode == "grid":
this.index = Math.floor((x - this.x) / this.px) + (Math.floor((y - this.y) / this.px) * this.columns) + (this.offset * this.columns);
break;
case this.mode == "left":
case this.mode == "right":
this.index = Math.floor((y - this.y) / this.px) + this.offset;
break;
case this.mode == "bottom":
case this.mode == "top":
this.index = Math.floor((x - this.x) / this.px) + this.offset;
break;
}
window.SetCursor(this.index < im.images.length ? IDC_HAND : IDC_ARROW);
return true;
}

this.lbtn_up = function(x, y) {
switch(true) {
case !this.trace(x, y):
return false;
case this.mode == "grid" && this.overlay && im.trace(x, y):
this.overlay = false;
window.Repaint();
break;
case this.mode == "grid" && this.index < im.images.length && !this.overlay:
this.overlay = true;
im.index = this.index;
window.Repaint();
break;
case this.overlay:
break;
case this.index < im.images.length:
im.index = this.index;
window.Repaint();
}
return true;
}

this.lbtn_dblclk = function(x, y) {
if (!im.trace(x, y) || th.mode == "grid") return false;
p.run("\"" + im.files[im.index] + "\"");
return true;
}

this.nc = false;
this.mode = window.GetProperty("Thumbs mode", p.check_feature("now_playing") ? "off" : "off");
this.px = window.GetProperty("Thumbs px", 40);
this.img = null;
}

//START---->
var p = new panel("Thumbs", ["remap", "metadb"]);
var im = new images(0, 0, 0, 0);
var th = new thumbs();

on_item_focus_change();

function on_playback_time(time) {
im.playback_time(time);
}

function on_size() {
p.size();
th.calc();
}

function on_paint(gr) {
th.draw(gr);
}

function on_metadb_changed() {
im.metadb_changed();
if (im.images.length == 0 && im.auto_download=="on")
im.download();
}

function on_mouse_wheel(step) {
if (th.wheel(step)) return;
if (im.wheel(step)) return;
}

function on_mouse_move(x, y) {
p.move(x, y);
th.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
th.lbtn_up(x, y);
}

function on_mouse_lbtn_dblclk(x, y) {
th.lbtn_dblclk(x, y);
}

//Auto Cycle Image
var cicleTimerStarted = false;
var cicleTimer = null;
 
(function startTimer(){
 
if(!cicleTimerStarted){

cicleTimer = window.CreateTimerInterval(cycle2+"000");
cicleTimerStarted = true;
}
 
})();
 
function stopTimer(){
 
if(!cicleTimerStarted) return;
window.KillTimer(cicleTimer);
cicleTimer = undefined;
cicleTimerStarted = false;
 
}
 
function on_timer(id) {
if(cicleTimer && id == cicleTimer.ID){
 
{
do{
im.index++
if (im.index == im.images.length) im.index=0;
window.Repaint();
}while (im.index==-1);
}}}
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-10 19:37:45
How do I revert this back so it the scroll wheel takes over the whole panel?


open the panel and inside the on_mouse_wheel function, replace

Code: [Select]
v.wheel(step);


with

Code: [Select]
fb.Volume += step;


Quote
Also, is there a way to make double click on art reader open the media's containing folder even when there's no cover image?


my script doesn't know or care about your stub image not being actual art. it's presented as an image by the preferences! but you can modify the code. inside on_mouse_lbtn_dblclk, replace

Code: [Select]
a.lbtn_dblclk(x, y);


with

Code: [Select]
if (p.metadb) p.explorer(p.metadb.Path);


edit: that code makes the whole panel react to the double click. if the artreader only takes a smaller area, you can use this so it only triggers when the mouse is over it.

Code: [Select]
if (p.metadb && a.trace(x, y)) return p.explorer(p.metadb.Path);



This worked, thanks!

On another note, is it possible to use WSH to replace playlist tabs and/or the regular DUI tabs?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2014-12-10 19:48:02
you have this script: http://pastebin.com/3Ygx5siF (http://pastebin.com/3Ygx5siF)
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-10 20:52:20
you have this script: http://pastebin.com/3Ygx5siF (http://pastebin.com/3Ygx5siF)


That's awesome! Do you have anything like that for regular (DUI) tabs?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-11 02:05:09
Do you have anything like that for regular (DUI) tabs?


that's not possible. if you used columns UI, you could use the panel stack splitter component which allows you to make buttons that will show/hide panels.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2014-12-11 09:52:06
Uh, my mistake
Try this. Should work now..

It's working now , thank you for this.It's great for local artists which don't have last.fm


@marc20003
How to display "%playback time%/ %length%" in your now playing panel??
I tried like this but playback time stays the same,
Code: [Select]
fb.TitleFormat("%playback_time%").Eval()+ "/" +p.eval("[%length%]")
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-11 10:18:14
Do you have anything like that for regular (DUI) tabs?


that's not possible. if you used columns UI, you could use the panel stack splitter component which allows you to make buttons that will show/hide panels.


Ah, I see.

By the way, I just noticed that on the latest version of your script, tooltips on buttons don't show up. Can you take a look when you get a chance?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-11 18:50:14
you know what.... i ****ing hate tooltips. and those were the bloody things that got me into this component in the first place. 

i've had yet another attempt at fixing it. try again... right click>Update script.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2014-12-11 21:41:15
" i ****ing hate tooltips"

ahah, just my words too
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-11 21:45:52
Haha... well that worked. Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-11 22:28:58
How to display "%playback time%/ %length%" in your now playing panel??
I tried like this but playback time stays the same,


you need to redraw every second for that to work. add in this extra line of code in the on_playback_time function.

Code: [Select]
function on_playback_time(time) {
    th.playback_time(time);
    window.RepaintRect(x,y,w,h);
}


hopefully you can figure out the x,y,w,h values yourself.
Title: WSH Panel Mod script discussion/help
Post by: pr0phet on 2014-12-12 18:51:02
How to display "%playback time%/ %length%" in your now playing panel??
I tried like this but playback time stays the same,


you need to redraw every second for that to work. add in this extra line of code in the on_playback_time function.

Code: [Select]
function on_playback_time(time) {
    th.playback_time(time);
    window.RepaintRect(x,y,w,h);
}


hopefully you can figure out the x,y,w,h values yourself.


I use GdiDrawText for playback time and if(!fb.IsPlaying) to place just the length there when nothing is playing but a song is selected:

Code: [Select]
    gr.GdiDrawText(fb.TitleFormat("%playback_time%[ / %length%]").Eval(), font, color, x, y, w, h, align);
    if(!fb.IsPlaying) {
        p.left_text(gr, p.eval("%length%"), font, color,x, y, w, h);
    }
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-15 12:53:14
Uh, my mistake
Try this. Should work now..


sorry, i forgot all about checking this out. i'm also seeing problems with google even using the last version you posted. i see this in the console:

Code: [Select]
Thumbs: HTTP error: 0undefined


it's also retrying on some sort of timer which is not good. i'd remove that if i were you. i'm not even going to try and pick apart what you've done. i might take a look if you post an updated common8 version with that template i gave you.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-16 04:08:25
A 140-page topic and no index at all in the first post ?...  No list of the available scripts with download links ?... Really ?... 
Sorry for the rant but I think that it's fair to say it. For all of you regular readers of this thread it's fine, but you can't expect anybody else to simply go through all 140 pages to find what s/he needs, right ?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-16 08:53:32
sorry, i forgot all about checking this out. i'm also seeing problems with google even using the last version you posted. i see this in the console:

Code: [Select]
Thumbs: HTTP error: 0undefined


it's also retrying on some sort of timer which is not good. i'd remove that if i were you. i'm not even going to try and pick apart what you've done. i might take a look if you post an updated common8 version with that template i gave you.


Yes, timer should be changed, i will post script with common8 later.
''0undefined'' mean that you didn't change google domain in properties?
Or your browser redirecting page to use ''http'' instead of ''https'' or something like that?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-16 09:28:05
@wcs13, here's a link to my completed scripts:

http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)

and some by falstaff.

http://pastebin.com/u/Br3tt (http://pastebin.com/u/Br3tt)

but it would be better to ignore the WSH playlist on that page and use this updated version: http://br3tt.deviantart.com/art/WSH-Playli...0-0-8-368997689 (http://br3tt.deviantart.com/art/WSH-Playlist-2013-v0-0-8-368997689)

@mire777, i changed domain to co.uk and at least there is no error. so i looked at it some more....
Code: [Select]
var data = div.getElementsByTagName("a");
var urls = [];

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("imgurl=") > 0) urls.push(data[i].href.split("imgurl=")[1].split("&imgrefurl")[0]);
}
p.console(data.length); //outputs 95
p.console(urls.length); //outputs 0


so the bit inside the for loop is where it fails to get any results???
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-16 11:11:32
@mire777, i changed domain to co.uk and at least there is no error. so i looked at it some more....
Code: [Select]
var data = div.getElementsByTagName("a");
var urls = [];

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("imgurl=") > 0) urls.push(data[i].href.split("imgurl=")[1].split("&imgrefurl")[0]);
}
p.console(data.length); //outputs 95
p.console(urls.length); //outputs 0


so the bit inside the for loop is where it fails to get any results???


Did you receive any images?

Is it possible that in your country html is different?
Dont know? But if string is not "imgurl=" on the beginning and "&imgrefurl" on the end,  then it will fail..
Inside that should be url for image..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-16 13:47:37
Is it possible that in your country html is different?


yes, i think so. i checked the content of data.href inside the loop and it's nothing like what you're looking for. all i can see is links to webpages that contain the images - i can't see any links to images at all.

all you can do it make it work in your area. i'm not sure if you can get around it.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-12-16 16:32:14
@mire777

I tested it and I cannot reproduce what marc2003 see.
My location if it helps is Greece.

Modified to be more verbose and as you can see the array of links is generated.

Code: [Select]
if (server=="google")
{{
this.working=true;  
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        webpage = "https://www.google." + g_domain + "/search?&tbm=isch&q=" + encodeURIComponent(p.artist) + terms + "&tbm=isch&tbs=isz:m";
       
this.xmlhttp.open("GET", webpage, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];

                    p.console(webpage);

for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("imgurl=") > 0) urls.push(data[i].href.split("imgurl=")[1].split("&imgrefurl")[0]);
}
p.console(urls);
                    p.console(urls.length);
fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
urls[i] = decodeURIComponent(urls[i]);
p.console("HTTP: " + urls[i]);
                    run ="cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls[i]) + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + decodeURIComponent(urls[i]).substring(decodeURIComponent(urls[i]).lastIndexOf("d")+1000) + ".jpg" + "\"";
p.console(run);
                    p.WshShell.Run(run, 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}
}
im.doc.close();
im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status + urls);
}}}}}}}

Console Output

Code: [Select]
[18:20:07] Thumbs: [url=https://www.google.co.uk/search?&tbm=isch&q=Lara%20Fabian&tbm=isch&tbs=isz:m]https://www.google.co.uk/search?&tbm=is...h&tbs=isz:m[/url] 
[18:20:07] Thumbs: [url=http://upload.wikimedia.org/wikipedia/commons/6/69/Lara_Fabian_2012.jpg,http://esctodaygdd.s3.amazonaws.com/wp-content/uploads/2013/01/lara_fabian_reference.jpg,http://images.uulyrics.com/cover/l/lara-fabian/album-lara-fabian.jpg,http://img3.closermag.fr/var/closermag/storage/images/actu-people/bio-de-stars/lara-fabian/815034-1-fre-FR/Lara-Fabian_exact442x442_l.jpg,http://plugnplaymusicblog.com/wp-content/uploads/2014/05/lara-fabian1.jpg,http://www.supermusic.sk/obrazky/2592843_Lara%252BFabian.jpg,http://cs10193.vk.me/u167792529/-7/x_c41aef6f.jpg,http://www.escireland.com/wp-content/uploads/2010/02/Lara%252BFabian.jpg,http://upload.wikimedia.org/wikipedia/commons/e/e0/Lara_Fabian.jpg,http://img.mypopulars.com/images/lara-fabian/Lara-Fabian-30.jpg,http://www.kboing.com.br/fotos/imagens/499c561c00cc9.jpg,http://www.360opps.com/wp-content/uploads/2011/04/Lara_Fabian.jpg,http://imstars.aufeminin.com/stars/fan/lara-fabian/lara-fabian-20061030-173926.jpg,http://musiccanada.files.wordpress.com/2011/07/lara-fabian.jpg,http://static1.purefans.com/items/5/30/17/25/%2540/301725-lara-fabian-sourire-fullscreen-1.jpg,http://s1.evcdn.com/images/edpborder500/I0-001/003/141/036-1.jpeg_/lara-fabian-36.jpeg,http://images2.fanpop.com/image/photos/11000000/Lara-Fabian-lara-fabian-11076136-624-919.jpg,http://images2.fanpop.com/image/photos/11000000/Lara-Fabian-lara-fabian-11076425-800-600.jpg,http://s.tf1.fr/mmdia/i/92/4/lara-fabian-2341924_1713.jpg%253Fv%253D1,http://www.librarising.com/astrology/celebs/images2/KL/larafabian.jpg,http://s3.evcdn.com/images/edpborder500/I0-001/004/322/234-3.jpeg_/lara-fabian-34.jpeg,http://www.inrumor.com/wp-content/uploads/2013/08/lara-fabian-no-makeup1.png,http://waytofamous.com/images/lara-fabian-03.jpg,http://img.mypopulars.com/images/lara-fabian/Lara-Fabian-4.jpg,http://mtdata.ru/u1/photo582B/20554630420-0/original.jpg,http://imstars.aufeminin.com/stars/fan/lara-fabian/lara-fabian-20080316-389541.jpg,http://libiz.net/images/36741-lara-fabian.jpg,http://www.starzik.com/Photos/Lara-Fabian-69916-E800.jpg,http://hollowverse.zippykid.netdna-cdn.com/wp-content/uploads/2013/03/lara-fabian-640x360.jpg,http://eil.com/images/main/Lara-Fabian-Sin-Ti-170170.jpg,http://images2.fanpop.com/image/photos/11000000/Lara-Fabian-lara-fabian-11076128-350-517.jpg,http://iv1.lisimg.com/image/2240013/600full-lara-fabian.jpg,http://i-cms.journaldesfemmes.com/image_cms/300/1744006-top-lara-fabian-rayonne-de-bonheur-sans-maquillage.jpg,http://4.bp.blogspot.com/-aLi2KPd3p_M/USPhCe8TK-I/AAAAAAAAF1M/yj9cEPOBL-w/s1600/Lara%252Bfabian%252Bred%252Bdress.jpg,http://www.oocities.org/pbfearme/lara_fabian_fansites_ring/lara_fabian_logo3.jpg,http://www.stars-portraits.com/img/portraits/stars/l/lara-fabian/lara-fabian-1-by-Jojemo%255B148360%255D.jpg,http://ilarge.listal.com/image/2393463/968full-lara-fabian.jpg,http://media.jukebo.com/news/Lara%252520Fabian.jpg,http://imstars.aufeminin.com/stars/fan/lara-fabian/lara-fabian-20040428-1407.jpg,http://max-pix.com/data/media/4306/Lara_Fabian_06_03.jpg,http://favimages.com/wp-content/uploads/2012/09/singer-lara-fabian-celebrity-star-interview.jpg,http://img.karaoketexty.cz/img/artists/3004/lara-fabian-58079.jpg,http://static1.purepeople.com/articles/4/13/01/64/%2540/1273746-exclusif-lara-fabian-quitte-son-950x0-1.jpg,http://userserve-ak.last.fm/serve/500/75486512/Lara%252BFabian%252B402090_306258116088488_1033905.jpg,http://cdn-premiere.ladmedia.fr/var/premiere/storage/images/tele/news-tele/lara-fabian-elle-prepare-une-emission-tele/22528804-4-fre-FR/Lara-Fabian-Elle-prepare-une-emission-tele_portrait_w532.jpg,http://s1.hubimg.com/u/7887088_f520.jpg,http://perlbal.hi-pi.com/blog-images/130471/gd/1163724643/lara-fabian.jpg,http://www.israbox.com/uploads/posts/2010-02/1266240145_5.jpg,http://www.celebirony.com/foto/cantanti/Lara_Fabian/lara_fabian_grande2.jpg,http://cdn3-public.ladmedia.fr/var/public/storage/images/news/photos/photos-lara-fabian-elle-devoile-tout-son-glamour-lors-du-new-wave-international-festival-430520/lara-fabian-lors-du-new-wave-international-festival-a-jurmala-le-27-juillet-2013-430523/5241580-1-fre-FR/Lara-Fabian-lors-du-New-Wave-International-Festival-a-Jurmala-le-27-juillet-2013_portrait_w674.jpg,http://imstars.aufeminin.com/stars/fan/lara-fabian/lara-fabian-20070313-225293.jpg,http://favimages.net/wp-content/uploads/2013/06/lara-fabian-celebrity-singer-musicians-woman-beautiful.jpg,http://cdn2.greatsong.net/photo/ext/lara-fabian-4406.jpg,http://www.oocities.org/pbfearme/lara_fabian_fansites_ring/lara_fabian_logo2.jpg,http://iv1.lisimg.com/image/2541599/600full-lara-fabian.jpg,http://images2.fanpop.com/image/photos/11000000/Lara-Fabian-lara-fabian-11076146-388-449.jpg,http://www4.pictures.zimbio.com/gi/Lara%252BFabian%252BSidaction%252BGala%252BDinner%252B2013%252BPhotocall%252BVy9ebM4Mwqul.jpg,http://img1.closermag.fr/var/closermag/storage/images/media/images-des-contenus/tele/news-tele/2013-07-27-the-best-tf1-estelle-denis-a-t-elle-ete-a-la-hauteur/lara-fabian/1535177-1-fre-FR/Lara-Fabian_exact810x609_l.jpg,http://esctodaygdd.s3.amazonaws.com/wp-content/uploads/2013/03/lara-fabian-mademoiselle-zhivago-illustration.jpg,http://www.evous.fr/local/cache-vignettes/L610xH348/Lara_Fabian_concert_Paris-52f4a.jpg,http://www.1001actus.com/wp-content/lara-fabian.jpg,http://www.jadorelespotins.com/wp-content/uploads/lara-fabian-sourde.jpg,http://www.stars-portraits.com/img/portraits/stars/l/lara-fabian/lara-fabian-by-mitsou%255B33085%255D.jpg,http://www.qnm.it/bellezze/cantanti_straniere/lara_fabian/lara_fabian_e5554fsd483.jpg,http://max-pix.com/data/media/4305/Lara_Fabian_07_02.jpg,http://www.icelebz.com/celebs/lara_fabian/images/photo21.jpg,http://imalbum.aufeminin.com/album/D20070203/260258_2C5KJ2NXVT6DUIOIPBECYSHO847FFQ_lara_fabian_carrere_big_H203514_L.jpg,http://www.celebirony.com/foto/cantanti/Lara_Fabian/lara_fabian_grande3.jpg,http://favimages.net/wp-content/uploads/2013/06/lara-fabian-celebrity-singer-artist-hairstyle.jpg,http://img213.imageshack.us/img213/9208/1291542076lfikmz.jpg,http://news.jukebo.fr/files/2010/10/larafabian.jpg,http://images2.fanpop.com/image/photos/11000000/Lara-Fabian-lara-fabian-11076426-800-600.jpg,http://max-pix.com/data/media/4305/Lara_Fabian_10_02.jpg,http://media.paperblog.fr/i/348/3487513/lara-fabian-devoile-nouvelle-chanson-anglais-L-1.jpeg,http://www.xpautographs.com/7461-3817-thickbox/lara-fabian-autograph.jpg,http://ecx.images-amazon.com/images/I/61uL8VVrvQL.jpg,http://www.inrumor.com/wp-content/uploads/2013/08/lara-fabian-no-makeup-460x453.png,http://images.lpcdn.ca/435x290/201009/07/197920-lara-fabian.jpg,http://userserve-ak.last.fm/serve/500/65719642/Lara%252BFabian%252BPNG.png,http://fc09.deviantart.net/fs71/f/2013/208/c/1/lara_fabian_by_jojemo-d6fibvq.jpg,http://lyricsmusic.name/img/photos/a1061lara-fabian.jpg,http://img.mypopulars.com/images/lara-fabian/Lara-Fabian-55.jpg,http://iv1.lisimg.com/image/81282/600full-lara-fabian.jpg,http://imstars.aufeminin.com/stars/fan/lara-fabian/lara-fabian-20071111-336882.jpg,http://max-pix.com/data/media/4306/Lara_Fabian_02_03.jpg,http://img2.bdbphotos.com/images/orig/u/t/utuxgno2r34jxunj.jpg%253Fkj8as6ye,http://www.inyourpocket.com/gallery/103002.jpg,http://www.kboing.com.br/fotos/imagens/5032426b2d114.jpg,http://eil.com/images/main/Lara-Fabian-Givin-Up-On-You-166669.jpg,http://upload.wikimedia.org/wikipedia/en/d/df/A_Wonderful_Life_album_cover.jpg,http://images2.fanpop.com/image/photos/11000000/Lara-Fabian-lara-fabian-11076135-350-517.jpg,http://max-pix.com/data/media/4305/Lara_Fabian_01_02.jpg,http://fc05.deviantart.net/fs71/f/2013/218/c/4/lara_fabian_by_jojemo-d6gzfa9.jpg,http://www.ndf.fr/files/2013/07/lara-fabian.jpg,http://i.ytimg.com/vi/wlM3XLupWBQ/hqdefault.jpg,http://static1.purepeople.com/articles/6/32/18/6/%2540/221813-lara-fabian-637x0-1.jpg,http://static1.purepeople.com/articles/6/41/72/6/%2540/296774-lara-fabian-637x0-3.jpg,http://static1.purefans.com/items/7/47/37/57/%2540/473757-lara-fabian-au-barbara-show-sur-star-tv-fullscreen-1.PNG,http://i1.ytimg.com/vi/jKtNuLG5jAo/hqdefault.jpg,http://images2.fanpop.com/image/photos/11000000/Lara-Fabian-lara-fabian-11076440-800-600.jpg]http://upload.wikimedia.org/wikipedia/comm...440-800-600.jpg[/url]
[18:20:07] Thumbs: 100
[18:20:07] Thumbs: HTTP: [url=http://upload.wikimedia.org/wikipedia/commons/6/69/Lara_Fabian_2012.jpg]http://upload.wikimedia.org/wikipedia/comm...Fabian_2012.jpg[/url]
[18:20:07] Thumbs: cscript //nologo "C:\Users\laptop\AppData\Roaming\foobar2000\bio_photos.vbs" "http://upload.wikimedia.org/wikipedia/commons/6/69/Lara_Fabian_2012.jpg" "C:\Users\laptop\AppData\Roaming\foobar2000\Artist_info\Lara Fabian\Lara Fabian_0.jpg"
[18:20:12] Thumbs: HTTP: [url=http://images.uulyrics.com/cover/l/lara-fabian/album-lara-fabian.jpg]http://images.uulyrics.com/cover/l/lara-fa...lara-fabian.jpg[/url]
[18:20:12] Thumbs: cscript //nologo "C:\Users\laptop\AppData\Roaming\foobar2000\bio_photos.vbs" "http://images.uulyrics.com/cover/l/lara-fabian/album-lara-fabian.jpg" "C:\Users\laptop\AppData\Roaming\foobar2000\Artist_info\Lara Fabian\Lara Fabian_2.jpg"
[18:20:14] Thumbs: HTTP: [url=http://img3.closermag.fr/var/closermag/storage/images/actu-people/bio-de-stars/lara-fabian/815034-1-fre-FR/Lara-Fabian_exact442x442_l.jpg]http://img3.closermag.fr/var/closermag/sto...ct442x442_l.jpg[/url]
[18:20:14] Thumbs: cscript //nologo "C:\Users\laptop\AppData\Roaming\foobar2000\bio_photos.vbs" "http://img3.closermag.fr/var/closermag/storage/images/actu-people/bio-de-stars/lara-fabian/815034-1-fre-FR/Lara-Fabian_exact442x442_l.jpg" "C:\Users\laptop\AppData\Roaming\foobar2000\Artist_info\Lara Fabian\Lara Fabian_3.jpg"
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-16 17:07:32
i found the problem - it's because i'm on XP running IE8. if i spoof the user agent to a newer browser, it works.

old code:

Code: [Select]
this.xmlhttp.open(...);
this.xmlhttp.send();


fixed code:

Code: [Select]
this.xmlhttp.open(...);
this.xmlhttp.setRequestHeader("User-Agent", "Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0;  rv:11.0) like Gecko");
this.xmlhttp.send();
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-17 16:06:08
@marc2003 : thank you !
I just wonder if some mod could update the first post of this topic with that info. Otherwise in a few pages somebody else will be asking for the same thing.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-17 18:48:50
BTW marc2003, I have some questions / requests about your excellent WSH panel "last.fm and wikipedia biography" :

1. How can we change the automatic download folder for the artists artwork ?
Right now downloads happen in C:\Program Files\foobar2000\wsh_lastfm and in C:\Program Files\foobar2000\wsh_data. I would like to change the drive and folders.

2. How can we set artist names for the download folders instead of cryptic names ?
Right now the folder names are cryptic (ex : wsh_lastfm\1237925370 when I would prefer wsh_lastfm\Ed Sheeran)
I'd like the folders to be named according to the "Artist field remapping" titleformat script.

3. At the moment I am using both your panel and the old foo_uie_biography component which seems to be no longer updated (I have version 4.2.4).
I'd like to get rid of foo_uie_biography. However, SOMETIMES foo_uie_biography happens to find nice artwork when your WSH panel doesn't.
Which is weird because my foo_uie_biography seems to be configured with the same sources as your WSH panel (last.fm and wikipedia).
[blockquote]Here are some examples :
- Mark Ronson : your WSH panel finds a nice bio (foo_uie_biography doesn't). However your WSH panel doesn't find any picture while foo_uie_biography finds a nice related picture (Bruno Mars and a group of dancers in the street).
- Usher : both panels find a bio. However your WSH panel doesn't seem to find any picture of Usher (really ?!) while foo_uie_biography finds a nice portrait of Usher.
- Nick Jonas : in this case your WSH panel finds a bio but no pictures, which is weird since Nick Jonas is one of the trendy artists right now. It could be that there's simply no picture, but that would be surprising.
[/blockquote]Could you manage to understand how foo_uie_biography finds its artwork, and then add that same functionality to your WSH panel ? In that case I would be happy to throw away foo_uie_biography. 

4. I have also noticed that when both (your WSH panel and foo_uie_biography) manage to find the same artwork, the artwork found by foo_uie_biography always happens to be the last of the 5 thumbnails that your WSH panel can display. But it also often happens to be the nicest one (dunno why, I've just noticed it over a lot of played songs). So could we configure your WSH panel to show by default the last of the 5 thumbnails instead of showing the first ?

Many thanks in advance for your help.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-17 19:22:12
even though i linked to my website in the previous post, you've somehow managed to download some out of date scripts (which have never been linked to from my site).

the current version does use proper artist names inside a folder which is now named wsh_data, not wsh_lastfm.

i'd delete the old wsh_lastfm and marc2003 folders and start again with my new scripts:

https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

for custom folder placement, you'll find this (or similar) as the first line of code in all of my panels.

Code: [Select]
var p = new panel("Thumbs", ["metadb", "remap", "custom_background"]);


insert a new line straight after it:

Code: [Select]
p.data_folder = "e:\\path\\to\\wsh_data\\";


note the double backslashes used to separate folders and the trailing backslashes at the end. also, you must make sure this folder exists before editing the script.

question 3:
what images you get depend entirely on what images appear first on the corresponding artist page. they can change order all the time because they are ranked by last.fm users who can vote on them. if you were to use my script right now with no existing images, the 5 you get will be the first 5 from here:

http://www.last.fm/music/Mark+Ronson/+images (http://www.last.fm/music/Mark+Ronson/+images)

if you're seeing different images from foo_uie_biography, you must have ran it an earlier time when that image was "top". that's because it can only download 1 image.

i tested usher and nick jonas and both are found by my script right now. perhaps there were temporary last.fm problems when you tried earlier??

sorry but i couldn't care less where foo_uie_biography saves its images. now my folders are named properly, you can easily populate the folders yourself if you find them.

question 4:
there is a reason for this. images are downloaded in order from most popular to 5th but my script actually reverse sorts by file modification time - so the last (or newest) image gets displayed first. i'll consider adding other sorting options.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 02:29:54
Questions 1, 2 & 3 :

  Sorry, I don't know how it happened, since I downloaded everything from your site. I must have messed up with something. Anyway, I've erased stuff and started all over.
I have the latest version of your marc2003 folder.
I have version 1.4 of both panels (biography and thumbs), side to side.
I have inserted in both scripts the relevant code line : p.data_folder = "X:\\PRIVATE\\marc2003\\";
So everything should work, right ? Well...

The Thumbs panel v1.4 works as expected with Mark Ronson, Nick Jonas and Usher now : it was an error in the "Artist field remapping" on my side, sorry.
It does save the artwork automatically in the X:\PRIVATE\marc2003 folder.
However, the artwork folder names are still cryptic : 207265983, 2660058763 and so on.
Those are freshly created folders : the marc2003 folder was empty before my tests.

The bio panel v1.4 crashes if there's not a wsh_data folder inside my foobar2000 folder
Once that wsh_data folder is created, the script creates an "artists" subfolder (which seems unnecessary to me BTW) and creates sub-subfolders named after the artists (non-cryptic).
So it doesn't seem to take into account the p.data_folder = "X:\\PRIVATE\\marc2003\\"; code line. Which is weird since the Thumbs panel takes it into account.
And the sub-subfolders are completely empty, so I don't see any bio info being saved nowhere (it's not saved in X:\PRIVATE\marc2003 either, I have checked).
BTW the script also creates two more folders inside my foobar2000 folder : wsh_lastfm and wsh_settings. Both folders are completely empty. 

FYI, as proof here's the beginning of both scripts :
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common8.js"
// @name "Last.fm & Wikipedia Biography"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var p = new panel("Last.fm & Wikipedia Biography", ["metadb", "remap"]);
p.data_folder = "X:\\PRIVATE\\marc2003\\";
var t = new text("lastfm_wiki", 6, 30, p.w - 12, p.h - 30);
p.item_focus_change();
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common7.js"
// @name "Thumbs"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var p = new panel("Thumbs", ["custom_background", "remap", "metadb"]);
p.data_folder = "X:\\PRIVATE\\marc2003\\";
var im = new images(0, 0, 0, 0);
var th = new thumbs();
Weird fact : Thumbs seems to use common7.js which is not a part of your last marc2003 folder (I had to copy it from your old marc2003 folder). Maybe it's a bug ? Should I change the code to common8.js and get rid of common7.js ?

Question 4 :

Yes, please add some sorting options and it will be perfect. Thank you.

Question 5 (new - sorry) :

Your bio panel doesn't seem to find any bio (last.fm or wikipedia) for Noah Guthrie when it's present on last.fm ( http://www.last.fm/music/Noah+Guthrie (http://www.last.fm/music/Noah+Guthrie) ). 
Here's a screen cap to prove it : http://i59.tinypic.com/10wt9g9.jpg (http://i59.tinypic.com/10wt9g9.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 03:12:28
Quote
Weird fact : Thumbs seems to use common7.js which is not a part of your last marc2003 folder (I had to copy it from your old marc2003 folder). Maybe it's a bug ? Should I change the code to common8.js and get rid of common7.js ?


you didn't update the script in your panel with the thumbs.txt file from the samples8.zip i linked you to. the code in the script is quite different so you can't just modify the import bit at at the top.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 03:16:26
I did, I swear I did. This is really weird. 
Please don't think I'm stupid : I'm not ! I don't know what happened. I really updated it. [EDIT - I had a foobar crash, so maybe my update wasn't saved - I don't see any other explanation]
I'll update it ONCE AGAIN and see what happens.
BTW, it's unusual that your latest version (which uses common8.js) is still numbered 1.4 like the previous version (which used common7.js).

Anyway, I guess this won't solve my other questions, so I hope you can answer them.
BTW I was editing my post while you were writing your answer, so please check it out again : many questions remain. Thank you.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 03:31:47
using any of my common7 scripts will create empty wsh_lastfm and wsh_settings folders. this gets automatically done by the very first line of code and nothing can be done to prevent it without hacking the main .js file inside the marc2003 folder.

updating scripts in all panels to versions that use common8.js will only create folders if they are required and modifying the paths like i instructed will prevent them being created in your foobar profile folder (or foobar program folder if using portable mode)

as for Noah Guthrie, a bio is found for me??

(https://dl.dropboxusercontent.com/u/22801321/2014/december/bio.png)

but for future reference, it is worth noting that not all artists on last.fm will show a bio in my script. although the original source is last.fm/wikipedia, i'm actually using a web service provided by theechonest.com and they don't store bios for all artists. if it's too obscure, it probably won't be on there.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 03:41:48
OK, I have updated stuff once again, triple-checked. Here's what happens :

Now both panels (bio and thumbs) behave consistently... which means that NONE OF THEM cares about my p.data_folder = "X:\\PRIVATE\\marc2003\\"; code line (yes, I have inserted it again at the right place and in both panels).
The thumbs panel now writes the images inside the foobar2000\wsh_data\artists folder.
The bio panel doesn't write data anywhere.
In fact the bio panel doesn't even work anymore. Don't ask me why. It doesn't display any bio anymore. Nothing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 03:45:30
using any of my common7 scripts will create empty wsh_lastfm and wsh_settings folders. this gets automatically done by the very first line of code and nothing can be done to prevent it without hacking the main .js file inside the marc2003 folder.

updating scripts in all panels to versions that use common8.js will only create folders if they are required and modifying the paths like i instructed will prevent them being created in your foobar profile folder (or foobar program folder if using portable mode)

as for Noah Guthrie, a bio is found for me??

(https://dl.dropboxusercontent.com/u/22801321/2014/december/bio.png)

but for future reference, it is worth noting that not all artists on last.fm will show a bio in my script. although the original source is last.fm/wikipedia, i'm actually using a web service provided by theechonest.com and they don't store bios for all artists. if it's too obscure, it probably won't be on there.

Quote
BTW, it's unusual that your latest version (which uses common8.js) is still numbered 1.4


that's a component specific thing. it's not anything i have control over. it means component version 1.4 (or above). i'm currently using 1.5.6 and my scripts will work with anything 1.5.0 or above.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 03:46:34
OK, I have exited foobar, emptied wsh_data, restarted foobar again.
Now the bio panel works again. 
It even writes data (lastm_wiki.json).
But both panels still write data to the local wsh_data folder.
They create an unneeded "artists" subfolder, then properly named sub-subfolders, and inside each sub-subfolder we can find both the bio data and the pictures.
So I don't know why, but it looks like the p.data_folder = "X:\\PRIVATE\\marc2003\\"; code line isn't working in both panels.
For the record, the X:\PRIVATE\marc2003 folder exists of course.

As for the Noah Guthrie bio, it definitely doesn't work but that's OK. I understand what you said about the web service provided by theechonest.com and the "if it's too obscure, it probably won't be on there".
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 03:53:53
ah sorry, i just realised i missed something important out...

Code: [Select]
p.data_folder = "X:\\PRIVATE\\marc2003\\";
p.artists_folder = p.data_folder + "artists\\";


now it should work.

As for the Noah Guthrie bio, it definitely doesn't work but that's OK. I understand what you said about the web service provided by theechonest.com and the "if it's too obscure, it probably won't be on there".


can you not see my screenshot? it's right there in my post.

direct link: https://dl.dropboxusercontent.com/u/2280132...ecember/bio.png (https://dl.dropboxusercontent.com/u/22801321/2014/december/bio.png)

edit: because we've been messing about with different folder locations, it's worth clearing the cache in internet explorer. that should hopefully get things back to normal.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 04:16:34
We're slowly getting there. I really thought I was going crazy ! 

OK, so now both panels FINALLY write data to the correct X: location.
Everything seems to work as expected...
... except that for some reason, some bios that did show up previously (ex : Lorde and Pearl Jam) don't show up anymore, be it with last.fm or with wikipedia.
I take Lorde and Pearl Jam as an example because obviously a bio of them can be found everywhere, so it's not normal.
Those bios did show up previously so maybe it's some obscure caching problem ? Maybe the script is still trying to find them in the wsh_data folder (that I've erased of course) ?
I tried restarting foobar, with no results. Any clues ?

One last thing : in the latest version of the Thumbs panel, now the thumbnails are placed OVER the main image, when in the previous version it wasn't the case (the main image could be displayed completely).
This leads to some pretty ugly stuff, like this cut face : http://i59.tinypic.com/v8mmmf.jpg (http://i59.tinypic.com/v8mmmf.jpg)
I thought it was a settings problem, but apparently I haven't found the right setting.
Is there a way that I could get back to the previous behaviour ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 04:23:15
Quote
except that for some reason, some bios that did show up previously (ex : Lorde and Pearl Jam) don't show up anymore, be it with last.fm or with wikipedia.


as i mentioned in my previous post edit, clearing the cache (temporary files) in internet explorer should sort this out. even if you don't use it, the script uses it in the background.

i'll post an update in a minute to get the old behaviour back - this will only affect images in "centre" mode like you appear to have.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 04:30:09
Yes, sorry. Our posts are overlapping so I wrote my previous one while you were writing yours.
I have cleared my IE cache (funny thing to me because I never use IE, lol).

I'm happy to report that everything seems to work now !!!  
All bios seem to be back, including Lorde and Pearl Jam... and guess what ? Noah Guthrie is there too !!! 

I am very happy and grateful so far. Thank you for your valuable help. 

Now the only two things I'd need for the Thumbs panel would be :
- The old behaviour in "centre" mode,
- More sorting options

Many thanks in advance !
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 04:38:47
the centre thing has been done. just right click the panel>Update script.

the sorting will take a bit more effort and i'll do that later on.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 04:43:40
Script updated, old behaviour restored. Everything seems to work so far. This is amazing !!! Thank you so much !!! 
I can live with that, don't worry. Do the sorting thing when you wish. It's pretty much perfect right now.
Yay !!!  (and one more happy WSH user / marc2003 scripts user)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 05:34:50
Sorting options added. right click panel>Update script.

Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 13:17:03
Awesome job !! If only everyone could be so patient and proactive as you !
Many thanks again. This is perfect.
OK, it would be REALLY perfect with one more sorting : Z-A  (no kidding, I would really like that actually)

Just FYI, for SOME artists the "newest first" or "oldest first" doesn't change anything. I guess that must come from last.fm (no time info for the images ?).
I've tried erasing the data folder, clearing IE cache and restarting foobar, but it doesn't help.
But again, it's only for some artists. The sorting works fine for all the others.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 13:33:34
the time info comes from windows when the file is saved. if your internet is fast enough, they will arrive at the same time. i just did a quick test on 5 fresh images and 4 of them have the same time.

i can't believe you really want Z-A but i'll add it later.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-18 13:36:12
I have just realized that the time info comes from Windows. I have downloaded several times the same images and yes, they arrive randomly and/or at the same time.
I was naive to expect the time info to be related to last.fm (most recently published images, etc.), but if it's only download-related then I guess it's no use.

I guess the best sorting would be if we could manually define one default image per artist and that setting would be saved for every artist, but I'm probably asking too much.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 16:09:55
I guess the best sorting would be if we could manually define one default image per artist and that setting would be saved for every artist, but I'm probably asking too much.


yep. nice idea but i don't really know how i could add such a feature cleanly.

Z-A sorting has been done. right click panel>Update script.

full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)
script overview / setup guide: http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-18 19:07:48
i've updated my Thumbs script. it now has a Set as default option on the right click menu. this takes precedence over any sorting options and will make the image always appear first. there is also an option to clear it. it only works in last.fm mode.

the settings will be stored inside your foobar profile folder (wsh_settings\thumbs.ini).
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-19 02:46:21
Wow marc, this is just beyond awesome. I have no words.     
See ? You are better than you thought yourself a couple posts ago. You have found a way to add that feature in a simple & elegant way (thumbs.ini).

I'm glad I could put you on track for that idea. I wouldn't have thought of it a couple days ago, but our discussions and testing made me finally dream about it...
... and BAM ! You made it happen in less than 24 hours, and it works beautifully.

Big respect man. Double thumbs up !

(http://i61.tinypic.com/zixagz.png)
Title: WSH Panel Mod script discussion/help
Post by: chamuco on 2014-12-19 04:11:09
I'm trying to get Marc2003's artreader script (or the columns UI Artwork view panel for that mater, but prefer Marc's) to see artist picture using relative path. I've tried
Code: [Select]
wsh_data\artists\%artist%\*.*
and
Code: [Select]
.\wsh_data\artists\%artist%\*.*
in the display settings artist tab with no results even though I've read here that it should work. Is this possible? Thanks for any help.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-19 07:50:12
you have to use an absolute path. i give a couple of examples on this web page...

http://marc2003.x10host.com/thumbs (http://marc2003.x10host.com/thumbs)

Code: [Select]
c:\users\marc\appdata\roaming\foobar2000\wsh_data\artists\%artist%\*.*
d:\portable apps\foobar2000\wsh_data\artists\%artist%\*.*


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-19 12:45:18
i just uploaded a bugfix for my Thumbs script. setting a default image would cause the Open containing folder feature to crash the script. this has now been fixed. right click>Update script.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-12-19 14:25:42
sorry, i forgot all about checking this out. i'm also seeing problems with google even using the last version you posted. i see this in the console:

Code: [Select]
Thumbs: HTTP error: 0undefined


it's also retrying on some sort of timer which is not good. i'd remove that if i were you. i'm not even going to try and pick apart what you've done. i might take a look if you post an updated common8 version with that template i gave you.

Yes, timer should be changed, i will post script with common8 later.
''0undefined'' mean that you didn't change google domain in properties?
Or your browser redirecting page to use ''http'' instead of ''https'' or something like that?

@mire777

If you port the old script (Biography Photos) to common8 here's a mod that gets artwork from fanart.tv instead of google.
If you like it you can include it in your new script.

Code: [Select]
// ==PREPROCESSOR==
// @name "Fanart Photos"
// @author "zeremy"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
 

// Paths
var fbfolder = (fb.ProfilePath + "Artist_fanart");
var lfm_folder = window.GetProperty("Custom folder", fbfolder);

//Image download size
size = window.GetProperty("Download quality","medium");

//Download server
server = window.GetProperty("Download  source", "fanart.tv");

//Search terms(google)
terms = window.GetProperty("Custom search terms", "");

//Cycle
cycle2 = window.GetProperty("Image cycle", 10);

//Fanart Type
fanart_type = window.GetProperty("Fanart Type", "musiclogo");
fanart_type_musiclogo_limit = window.GetProperty("Fanart Type - musiclogo", "3");
fanart_type_artistbackground_limit = window.GetProperty("Fanart Type - artistbackground", "0");
fanart_type_cdart_limit = window.GetProperty("Fanart Type - cdart", "0");
fanart_type_albumcover_limit = window.GetProperty("Fanart Type - albumcover", "0");
fanart_type_artistthumb_limit = window.GetProperty("Fanart Type - artistthumb", "0");
fanart_type_musicbanner_limit = window.GetProperty("Fanart Type - musicbanner", "0");


var MF_GRAYED = 0x00000001;
var MF_STRING = 0x00000000;
var IDC_ARROW = 32512;
var IDC_HAND = 32649;


function on_colors_changed() {
p.colors_changed();
}

function on_font_changed() {
//p.font_changed();
}

function on_selection_changed() {
p.item_focus_change();
}

function on_playlist_switch() {
p.item_focus_change();
}

function on_playback_new_track() {
p.item_focus_change();
}

function on_playback_dynamic_info_track() {
p.item_focus_change();
}

function on_playback_stop() {
p.item_focus_change();
}

function on_item_focus_change() {
p.item_focus_change();
}

function on_mouse_rbtn_up(x, y) {
p.rbtn_up(x, y);
return true;
}

//Start Futures
function panel(name, features) {
this.item_focus_change = function() {
if (!this.metadb_func) return;
  switch(this.selection_mode) {
  case 0:
this.metadb = fb.GetSelection();
break;
  case 1:
this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
break;
  case 2:
this.metadb = fb.GetFocusItem();
break;
}
if (this.metadb) on_metadb_changed();
}

//Size
this.size = function() {
this.w = window.Width;
this.h = window.Height;
}

//Move
this.move = function(x, y) {
this.mx = x;
this.my = y;
}

//Menu
this.rbtn_up = function(x, y) {
var _menu = window.CreatePopupMenu();

var idx;
switch(true) {
case typeof a == "object" && a.trace(x, y):

_menu.AppendMenuItem(MF_STRING, 17, "adjust");
_menu.AppendMenuItem(MF_STRING, 18, "Stretch");
_menu.CheckMenuRadioItem(15, 18, a.type == "centre" ? 15 : a.type == "top" ? 16 : a.type == "adjust" ? 17 : 18);
_menu.AppendMenuSeparator();
break;

case typeof th == "object":
case typeof im == "object" && im.trace(x, y):

var _settings = window.CreatePopupMenu();
var _auto_cycle = window.CreatePopupMenu();
var _download_source = window.CreatePopupMenu();
var _download_limit = window.CreatePopupMenu();
var _download_quality = window.CreatePopupMenu();
var _thumbs = window.CreatePopupMenu();
var _fanart_type = window.CreatePopupMenu();
var MF_POPUP = 0x00000010;  

_menu.AppendMenuItem(MF_STRING, 403, "Refresh");
_menu.AppendMenuSeparator();

//Settings Menu
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _settings.ID, "Settings");
_menu.AppendMenuSeparator();
_settings.AppendMenuItem(MF_STRING | MF_POPUP, _auto_cycle.ID, "Auto Cycle");

_auto_cycle.AppendMenuItem(MF_STRING, 415, "05 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 420, "10 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 425, "15 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 430, "20 sec");
_auto_cycle.AppendMenuItem(MF_STRING, 410, "Off");
_auto_cycle.CheckMenuRadioItem(410, 430, cycle2 + 410);


_settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_source.ID, "Download Source");

_download_source.AppendMenuItem(MF_STRING, 1902, "Last.fm");
_download_source.AppendMenuItem(MF_STRING, 1903, "fanart.tv");
_download_source.CheckMenuRadioItem(1902, 1904, server == "last.fm" ? 1902 : server == "fanart.tv" ? 1903 : 1903);

_settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_limit.ID, "Download Limit");
 
_download_limit.AppendMenuItem(MF_STRING, 1905, "1x");
_download_limit.AppendMenuItem(MF_STRING, 1906, "2x");
_download_limit.AppendMenuItem(MF_STRING, 1907, "3x");
_download_limit.AppendMenuItem(MF_STRING, 1908, "4x");
_download_limit.AppendMenuItem(MF_STRING, 1909, "5x");
_download_limit.AppendMenuItem(MF_STRING, 1910, "6x");
_download_limit.CheckMenuRadioItem(1905, 1910, im.limit + 1904);


if (server=="last.fm") _settings.AppendMenuItem(MF_STRING | MF_POPUP, _download_quality.ID, "Download Quality");
_download_quality.AppendMenuItem(MF_STRING, 1911, "Low");
_download_quality.AppendMenuItem(MF_STRING, 1912, "Medium");
_download_quality.AppendMenuItem(MF_STRING, 1913, "High");
_download_quality.CheckMenuRadioItem(1911, 1913, size == "low" ? 1911 : size == "medium" ? 1912 : size == "high" ? 1913 : 1913);

if (server=="fanart.tv") _settings.AppendMenuItem(MF_STRING | MF_POPUP, _fanart_type.ID, "Fanart Type");
_fanart_type.AppendMenuItem(MF_STRING, 4000, "Logo");
_fanart_type.AppendMenuItem(MF_STRING, 4001, "Artist Background");
_fanart_type.AppendMenuItem(MF_STRING, 4002, "CD Art");
_fanart_type.AppendMenuItem(MF_STRING, 4003, "Album Cover");
_fanart_type.AppendMenuItem(MF_STRING, 4004, "Artist Thumb");
_fanart_type.AppendMenuItem(MF_STRING, 4005, "Music Banner");
_fanart_type.CheckMenuRadioItem(4000, 4005, fanart_type == "musiclogo" ? 4000 : fanart_type == "artistbackground" ? 4001 : fanart_type == "cdart" ? 4002 : fanart_type == "albumcover" ? 4003 : fanart_type == "artistthumb" ? 4004 : fanart_type == "musicbanner" ? 4005: 4005);


_settings.AppendMenuItem(MF_STRING | MF_POPUP, _thumbs.ID, "Thumbs");

_thumbs.AppendMenuItem(MF_STRING, 1201, "Left");
_thumbs.AppendMenuItem(MF_STRING, 1202, "Right");
_thumbs.AppendMenuItem(MF_STRING, 1203, "Top");
_thumbs.AppendMenuItem(MF_STRING, 1204, "Bottom");
_thumbs.AppendMenuItem(MF_STRING, 1205, "Off");
_thumbs.CheckMenuRadioItem(1200, 1205, th.mode == "grid" ? 1200 : th.mode == "left" ? 1201 : th.mode == "right" ? 1202 : th.mode == "top" ? 1203 : th.mode == "bottom" ? 1204 : 1205);

if (th.mode == "left" | th.mode == "right" | th.mode == "top" | th.mode == "bottom")
{
_thumbs.AppendMenuSeparator();
_thumbs.AppendMenuItem(MF_STRING, 1240, "40px");
_thumbs.AppendMenuItem(MF_STRING, 1250, "50px");
_thumbs.AppendMenuItem(MF_STRING, 1260, "60px");
_thumbs.AppendMenuItem(MF_STRING, 1270, "70px");
_thumbs.AppendMenuItem(MF_STRING, 1280, "80px");
_thumbs.AppendMenuItem(MF_STRING, 1290, "90px");
_thumbs.AppendMenuItem(MF_STRING, 1300, "100px");
_thumbs.AppendMenuItem(MF_STRING, 1350, "150px");
_thumbs.AppendMenuItem(MF_STRING, 1400, "200px");
_thumbs.AppendMenuItem(MF_STRING, 1450, "250px");
_thumbs.AppendMenuItem(MF_STRING, 1500, "300px");
_thumbs.CheckMenuRadioItem(1240, 1500, th.px + 1200);
}
  {
_menu.AppendMenuItem(MF_STRING, 400, "Open Folder");
if (server=="last.fm") _menu.AppendMenuItem(MF_STRING, 21, "Open Last.fm");
if (server=="fanart.tv")  _menu.AppendMenuItem(MF_STRING, 21, "Open fanart.tv");
//_menu.AppendMenuItem(MF_STRING, 402, "Delete image");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING, 405, "Top");
_menu.AppendMenuItem(MF_STRING, 404, "Centre");
_menu.AppendMenuItem(MF_STRING, 406, "Adjust");
_menu.AppendMenuItem(MF_STRING, 407, "Stretch");
_menu.CheckMenuRadioItem(404, 407, im.type == "centre" ? 404 : im.type == "top" ? 405 : im.type == "adjust" ? 406 : 407);
_menu.AppendMenuSeparator();
}
break;
}

if (typeof ps == "object") _menu.AppendMenuItem(l.username.length > 0 ? MF_STRING : MF_GRAYED, 1901, "Last.fm password...");

_menu.AppendMenuItem(MF_STRING, 9, "Properties...");
_menu.AppendMenuItem(MF_STRING, 10, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {

case 9:
window.ShowProperties();
break;
case 10:
window.ShowConfigure();
break;

case 15:
case 16:
case 17:
case 18:
a.type = idx == 15 ? "centre" : idx == 16 ? "top" : idx == 17 ? "adjust" : "stretch";
window.SetProperty("artreader_image_type", a.type);
window.RepaintRect(a.x, a.y, a.w, a.h);
break;

case 21:
if (server=="last.fm") this.browser("http://www.last.fm/music/" + encodeURIComponent(p.artist));
else
if (server=="fanart.tv")  this.browser("https://fanart.tv/?s=" + encodeURIComponent(p.artist) + "&sect=2" + terms);
break;

case 400:
this.run("explorer /select,\"" + im.files[im.index] + "\"");
break;

case 403:
if (im.images.length < im.limit)
{
// p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
//fix_limit = im.limit;
im.download();
im.update();
}
else
// p.run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
im.update();
break;
case 404:
case 405:
case 406:
case 407:
im.type = idx == 404 ? "centre" : idx == 405 ? "top" : idx == 406 ? "adjust" : "stretch";
window.SetProperty("Image type", im.type);
window.Repaint();
break;
case 410:
case 415:
case 420:
case 425:
case 430:
cycle2 = idx - 410;
window.SetProperty("Image cycle", cycle2);
cicleTimer = undefined;
cicleTimerStarted = false;
stopTimer();
startTimer();
cicleTimerStarted = true;
break;

case 1200:
case 1201:
case 1202:
case 1203:
case 1204:
case 1205:
th.mode = idx == 1200 ? "grid" : idx == 1201 ? "left" : idx == 1202 ? "right" : idx == 1203 ? "top" : idx == 1204 ? "bottom" : "off";
window.SetProperty("Thumbs mode", th.mode);
th.nc = true;
on_size();
window.Repaint();
break;
case 1240:
case 1250:
case 1260:
case 1270:
case 1280:
case 1290:
case 1300:
case 1350:
case 1400:
case 1450:
case 1500:
th.px = idx - 1200;
window.SetProperty("Thumbs px", th.px);
th.nc = true;
on_size();
window.Repaint();
break;

case 1902:
case 1903:
case 1904:
server = idx == 1902 ? "last.fm" : idx == 1903 ? "fanart.tv" : "fanart.tv";
window.SetProperty("Download  source", server);
break; 

case 1905:
case 1906:
case 1907:
case 1908:
case 1909:
case 1910:
im.limit = idx - 1904;
window.SetProperty("Download limit", im.limit);
break;

case 1911:
case 1912:
case 1913:
size = idx == 1911 ? "low" : idx == 1912 ? "medium" : idx == 1913 ? "high" : "high";
window.SetProperty("Download quality", size);
break;
               
            case 4000:
case 4001:
            case 4002:           
            case 4003:
            case 4004:
            case 4005:
fanart_type = idx == 4000 ? "musiclogo" : idx == 4001 ? "artistbackground" : idx == 4002 ? "cdart" : idx == 4003 ? "albumcover" : idx == 4004 ? "artistthumb" : idx == 4005 ? "musicbanner" : "musicbanner";
window.SetProperty("Fanart Type", fanart_type);
                im.update();
                window.Repaint();
break;
               
}
_menu.Dispose();

}

//Futures Init
this.features_init = function() {
for (i = 0; i < this.features.length; i++) {
switch(this.features[i]) {

case "metadb":
this.selection_mode = window.GetProperty("Selection mode", 1);
break;

case "remap":
this.artist_tf = window.GetProperty("Artist format", "%artist%");
break;
}}}

//Check Future
this.check_feature = function(f) {
for (i = 0; i < this.features.length; i++) {
if (this.features[i] == f) return true;
}
return false;
}

//Eval Title/Format
this.eval = function(tf) {
if (!this.metadb || tf == "") return "";
if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
return fb.TitleFormat(tf).Eval();
} else {
return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
}}

//Console
this.console = function(message) {
fb.trace(this.name + ": " + message);
}

//Msg Box
this.MsgBox = function(prompt, buttons, title) {
prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
title = title.replace(/"/g, '" + Chr(34) + "');
return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
}

//Open In Browser
this.browser = function(command) {
if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, this.name);
}

//Run Command
this.run = function(command) {
try {
  this.WshShell.Run(command);
  return true;
  } catch(e) {
  return false;
}}

//Display Image
this.draw_image = function(gr, img, pos_x, pos_y, width, height, type, border, alpha) {
if (!img) return;
gr.SetInterpolationMode(7);
  switch(type) {
case "centre":
case "top":
  {
var sr = img.Width / img.Height;
var dr = width / height;
if (sr < dr) {
var r = img.Width / width;
var ch = height * r;
var sy = Math.round((img.Height - ch) / (type == "top" ? 1000 : 2));
var cw = img.Width;
var sx = 0;
} else {
var r = img.Height / height;
var cw = width * r;
var sx = Math.round((img.Width - cw) / 2);
var ch = img.Height;
var sy = 0;
}
  {
gr.DrawImage(img, pos_x, pos_y, width, height, sx + 5, sy + 5, cw - 10, ch - 10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, width - 1, height - 1, 1, border);
  }
}
break;
case "stretch":
//strech
gr.DrawImage(img, pos_x, pos_y, width, height, 5, 5, img.Width-10, img.Height-10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, width - 1, height - 1, 1, border);

break;
case "adjust":
default:
//adjust
var s = Math.min(width / img.Width, height / img.Height);
var nw = Math.round(img.Width * s);
var nh = Math.round(img.Height * s);
pos_x += Math.round((width - nw) / 2);
pos_y += Math.round((height - nh) / 2);

gr.DrawImage(img, pos_x, pos_y, nw, nh, 5, 5, img.Width-10, img.Height-10, 0, alpha || 255);
if (border) gr.DrawRect(pos_x, pos_y, nw - 1, nh - 1, 1, border);
break;

}
}

//Remove false string from file names
this.clean_filename = function(filename) {
return filename.replace(/[\/\\|:]/g, '-').replace(/\*/g, 'x').replace(/"/g, "''").replace(/[?<>]/g, '_');
}

this.name = "Fanart.tv";
this.features = features;
this.dui = window.InstanceType;
this.script_path = fb.ProfilePath;
this.w = 0;
this.h = 0;
this.mx = 0;
this.my = 0;
this.metadb = fb.GetFocusItem();
this.WshShell = new ActiveXObject("WScript.Shell");
this.fso = new ActiveXObject("Scripting.FileSystemObject");

this.data_folder = lfm_folder + "\\";
if (lfm_folder==fb.ProfilePath + "Artist_fanart") if (!this.fso.FolderExists(this.data_folder)) this.fso.CreateFolder(this.data_folder), this.data_folder=this.data_folder;
if (!this.fso.FolderExists(this.data_folder)) return; 
this.artist = "";
this.artist_tf = "%artist%";

this.metadb_func = typeof on_metadb_changed == "function";
this.features_init();
}

function artreader(x, y, w, h) {
this.draw = function(gr) {
if (!this.img) return;
p.draw_image(gr, this.img, this.x, this.y, this.w, this.h, this.type);
}

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

this.wheel = function(step) {
if (!this.trace(p.mx, p.my)) return false;
this.id -= step;
if (this.id < 0) this.id = 4;
if (this.id > 4) this.id = 0;
window.SetProperty("artreader_id", this.id);
this.metadb_changed();
return true;
}

this.move = function(x, y) {
if (this.trace(x, y)) {
if (this.img) p.tt("Original size: " + this.img.Width + "x" + this.img.Height + "px");
return true;
} else {
p.ttd();
return false;
}}

this.lbtn_dblclk = function(x, y) {
if (!this.trace(x, y)) return false;
if (this.img) p.run("explorer /select,\"" + this.path + "\"");
return true;
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.img = null;
this.path = null;
}

function images(x, y, w, h) {
this.playback_time = function(time) {
}

this.draw = function (gr) {
if (this.images.length == 0) return;
p.draw_image(gr, this.images[this.index], this.x, this.y, this.w, this.h, this.type);
}

//MetaDB
this.metadb_changed = function() {
if (!p.metadb) return false;
switch(this.mode) {
case "last.fm":
p.artist = p.eval(p.artist_tf);
if (this.artist == p.artist) return false;
this.artist = p.artist;
this.folder = p.data_folder + p.clean_filename(p.artist);
if (!p.fso.FolderExists(this.folder)) p.fso.CreateFolder(this.folder);
break;
}
this.update();
return true;
}

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

this.wheel = function(step) {
if (!p.metadb || this.images.length < 2 || !this.trace(p.mx, p.my) || (typeof th == "object" && th.mode == "grid" && !th.overlay)) return false;
this.index -= step;
if (this.index < 0) this.index = this.images.length - 1;
if (this.index >= this.images.length) this.index = 0;
window.RepaintRect(this.x, this.y, this.w, this.h);
return true;
}

//Db-Click
this.lbtn_dblclk = function(x, y) {
if (!this.trace(x, y)) return false;
p.run("\"" + this.files[this.index] + "\"");
return true;
}

//Download Image
this.download = function()
{
if (!p.fso.FolderExists(this.folder))  return;
{

if (server=="last.fm")
{{
this.working=true;
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+images", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("img");
var urls = [];
for (i = 0; i < data.length; i++) {
if (data[i].src.indexOf("http://userserve-ak.last.fm/serve/126s") == 0) urls.push(data[i].src.replace("126s", size == "low" ? "252" : size == "medium" ? "500" : size == "high" ? "_" : "_"));
}
fix_limit = im.limit;
for (i = 0; i < Math.min(urls.length, fix_limit, 50); i++) {
p.WshShell.Run("cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + urls[i] + "\" \"" + [folder + p.clean_filename(p.artist) + "_" + i] + urls[i].substring(urls[i].lastIndexOf("/")+1000) + ".jpg" + "\"" , 0, true);
if (im.images.length == 0) {im.update(); fix_limit = im.limit+1;}
if (im.images.length == 0) {return;}
}
im.doc.close();
im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status);
}}}}}

else

if (server=="fanart.tv")
{{
this.working=true;  
if (p.artist == "" || p.artist == "?") return;
var folder = this.folder + "\\";
       

//get mbid from wsh_data folder.

    p.data_folder2 = fb.ProfilePath + "wsh_data\\";
    p.artists_folder2 = p.data_folder2 + "artists\\";
    var fn1 = p.artists_folder2 + p.eval("%artist%") + "\\musicbrainz_artistid.txt";
    musicbrainz_id = p.eval("$if3(%musicbrainz_artistid%,%musicbrainz artist id%,)");
    musicbrainz_id = musicbrainz_id.substring(0, 36);
    p.console(fn1);
    musicbrainz_id = utils.ReadTextFile(fn1);
    p.console(p.eval("%artist%"));
    p.console(musicbrainz_id);
    fanart = "https://fanart.tv/artist/" + musicbrainz_id;
       
   


if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

        this.xmlhttp.open("GET", fanart, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");

                    var urls_musiclogo = [];
                    var urls_artistbackground = [];
                    var urls_cdart = [];
                    var urls_albumcover = [];
                    var urls_artistthumb = [];
                    var urls_musicbanner = [];
                 
                    p.console(fanart);
                 
                    //hdmusiclogo, musiclogo, artistbackground, cdart, albumcover, artistthumb, musicbanner
                   
                    for (i = 0; i < data.length; i++) {
                    if (data[i].href.indexOf("musiclogo") > 0) urls_musiclogo.push(data[i]);
                    }

                    for (i = 0; i < data.length; i++) {
                    if (data[i].href.indexOf("artistbackground") > 0) urls_artistbackground.push(data[i]);
                    }
                   
                    for (i = 0; i < data.length; i++) {
                    if (data[i].href.indexOf("cdart") > 0) urls_cdart.push(data[i]);
                    }
                   
                    for (i = 0; i < data.length; i++) {
                    if (data[i].href.indexOf("albumcover") > 0) urls_albumcover.push(data[i]);
                    }
                   
                    for (i = 0; i < data.length; i++) {
                    if (data[i].href.indexOf("artistthumb") > 0) urls_artistthumb.push(data[i]);
                    }
                   
                    for (i = 0; i < data.length; i++) {
                    if (data[i].href.indexOf("musicbanner") > 0) urls_musicbanner.push(data[i]);
                    }
                   
           
                    fix_limit = im.limit;
                   
                    //no of urls
                    p.console("Fanart.tv results");
                    p.console("urls_musiclogo: " + urls_musiclogo.length);
                    p.console("urls_artistbackground: " + urls_artistbackground.length);
                    p.console("urls_cdart: " + urls_cdart.length);
                    p.console("urls_albumcover: " + urls_albumcover.length);
                    p.console("urls_artistthumb: " + urls_artistthumb.length);
                    p.console("urls_musicbanner: " + urls_musicbanner.length);
                   
           
                    p.console("Downloading From Fanart.tv Started");
               
                    //musiclogo
                    fix_limit = fanart_type_musiclogo_limit;
                    for (i = 0; i < Math.min(urls_musiclogo.length, fix_limit, 50); i++) {
                    urls_musiclogo[i] = decodeURIComponent(urls_musiclogo[i]).replace("about:", "https://fanart.tv");
                    image_ext = urls_musiclogo[i].substr(urls_musiclogo[i].lastIndexOf('.') + 1);
                    image_name = urls_musiclogo[i].substr(urls_musiclogo[i].lastIndexOf('/') + 1);
p.console("Downloading..: " + urls_musiclogo[i]);
                    cmd = "cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls_musiclogo[i]) + "\" \"" + folder + "\musiclogo-" + image_name + "\"" ;
                    p.console(cmd);
p.WshShell.Run(cmd, 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}
}
                   
                    //artistbackground
                    fix_limit = fanart_type_artistbackground_limit;
                    for (i = 0; i < Math.min(urls_artistbackground.length, fix_limit, 50); i++) {
                    urls_artistbackground[i] = decodeURIComponent(urls_artistbackground[i]).replace("about:", "https://fanart.tv");
                    image_ext = urls_artistbackground[i].substr(urls_artistbackground[i].lastIndexOf('.') + 1);
                    image_name = urls_artistbackground[i].substr(urls_artistbackground[i].lastIndexOf('/') + 1);
p.console("Downloading..: " + urls_artistbackground[i]);
                    cmd = "cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls_artistbackground[i]) + "\" \"" + folder + "\artistbackground-" + image_name + "\"" ;
                    p.console(cmd);
p.WshShell.Run(cmd, 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}
}         
                   
                    //cdart
                    fix_limit = fanart_type_cdart_limit;
                    for (i = 0; i < Math.min(urls_cdart.length, fix_limit, 50); i++) {
                    urls_cdart[i] = decodeURIComponent(urls_cdart[i]).replace("about:", "https://fanart.tv");
                    image_ext = urls_cdart[i].substr(urls_cdart[i].lastIndexOf('.') + 1);
                    image_name = urls_cdart[i].substr(urls_cdart[i].lastIndexOf('/') + 1);
p.console("Downloading..: " + urls_cdart[i]);
                    cmd = "cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls_cdart[i]) + "\" \"" + folder + "\cdart-" + image_name + "\"" ;
                    p.console(cmd);
p.WshShell.Run(cmd, 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}
}         
                   
                    //albumcover
                    fix_limit = fanart_type_albumcover_limit;
                    for (i = 0; i < Math.min(urls_albumcover.length, fix_limit, 50); i++) {
                    urls_albumcover[i] = decodeURIComponent(urls_albumcover[i]).replace("about:", "https://fanart.tv");
                    image_ext = urls_albumcover[i].substr(urls_albumcover[i].lastIndexOf('.') + 1);
                    image_name = urls_albumcover[i].substr(urls_albumcover[i].lastIndexOf('/') + 1);
p.console("Downloading..: " + urls_albumcover[i]);
                    cmd = "cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls_albumcover[i]) + "\" \"" + folder + "\albumcover-" + image_name + "\"" ;
                    p.console(cmd);
p.WshShell.Run(cmd, 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}
}
                   
                    //artistthumb
                    fix_limit = fanart_type_artistthumb_limit;
                    for (i = 0; i < Math.min(urls_artistthumb.length, fix_limit, 50); i++) {
                    urls_artistthumb[i] = decodeURIComponent(urls_artistthumb[i]).replace("about:", "https://fanart.tv");
                    image_ext = urls_artistthumb[i].substr(urls_artistthumb[i].lastIndexOf('.') + 1);
                    image_name = urls_artistthumb[i].substr(urls_artistthumb[i].lastIndexOf('/') + 1);
p.console("Downloading..: " + urls_artistthumb[i]);
                    cmd = "cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls_artistthumb[i]) + "\" \"" + folder + "\artistthumb-" + image_name + "\"" ;
                    p.console(cmd);
p.WshShell.Run(cmd, 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}

                   
                    //musicbanner
                    fix_limit = fanart_type_musicbanner_limit;
                    for (i = 0; i < Math.min(urls_musicbanner.length, fix_limit, 50); i++) {
                    urls_musicbanner[i] = decodeURIComponent(urls_musicbanner[i]).replace("about:", "https://fanart.tv");
                    image_ext = urls_musicbanner[i].substr(urls_musicbanner[i].lastIndexOf('.') + 1);
                    image_name = urls_musicbanner[i].substr(urls_musicbanner[i].lastIndexOf('/') + 1);
p.console("Downloading..: " + urls_musicbanner[i]);
                    cmd = "cscript //nologo \"" + p.script_path + "bio_photos.vbs\" \"" + decodeURIComponent(urls_musicbanner[i]) + "\" \"" + folder + "\musicbanner-" + image_name + "\"" ;
                    p.console(cmd);
p.WshShell.Run(cmd, 0, true);
if (im.images.length == 0) {fix_limit = im.limit+1; im.update();}
if (im.images.length == 0) {return;}
}
                   
                    p.console("Downloading From Fanart.tv Finished");
                   
im.doc.close();
im.working=false;
im.update();
window.NotifyOthers("images", "update");
} else {
p.console("HTTP error: " + im.xmlhttp.status + urls);
}}}}}}}


this.update = function() {
this.index = 0;
for (i = 0; i < this.images.length; i++) {
try { this.images[i].Dispose(); } catch(e) {}
}
this.folders = this.folder.split("|");
this.files = [];
for (i = 0; i < this.folders.length; i++) {
if (p.fso.FolderExists(this.folders[i])) this.files = this.files.concat(utils.Glob(this.folders[i] + "\\" + fanart_type + "*.jpg").toArray(), utils.Glob(this.folders[i] + "\\" + fanart_type + "*.jpeg").toArray(), utils.Glob(this.folders[i] + "\\" + fanart_type + "*.png").toArray(), utils.Glob(this.folders[i] + "\\" + fanart_type + "*.gif").toArray());
                }


    p.console("Current Image Set: " + this.files);



this.images = [];
for (i = 0; i < this.files.length; i++) {
this.images[i] = gdi.Image(this.files[i]);
}
if (typeof th == "object") {
th.nc = true;
th.calc();
}
  window.Repaint();
}

//Delete Image
this.delete_image = function() {
if (!this.app) this.app = new ActiveXObject("Shell.Application");
this.app.Namespace(10).MoveHere(this.files[this.index]);
window.SetTimeout(function() {
im.update();
window.NotifyOthers("images", "update");
}, 100);
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.files = [];
this.images = [];
this.index = 0;
this.artist = "";
this.folder = "";
this.limit = window.GetProperty("Download limit", 6);
this.mode = ("last.fm");
this.type = window.GetProperty("Image type", "adjust");
this.auto_download = window.GetProperty("Download  [on/off]", "on");
}

//Thumbs
function thumbs() {
this.trace = function(x, y) {
return (x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h);
}

this.draw = function(gr) {
switch(true) {
case im.images.length == 0:
break;
case this.mode == "off":
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
case !this.img:
break;
case this.mode == "grid":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, 0, this.offset * this.px, this.w, this.h);
if (this.overlay) {
gr.FillSolidRect(this.x, this.y, this.w, this.h, RGBA(0, 0, 0, 126));
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "adjust");
}
break;
case this.mode == "left":
case this.mode == "right":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, 0, this.offset * this.px, this.w, this.h);
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
case this.mode == "bottom":
case this.mode == "top":
gr.DrawImage(this.img, this.x, this.y, this.w, this.h, this.offset * this.px, 0, this.w, this.h);
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
break;
}}

this.calc = function() {
this.offset = 0;
switch(true) {
case p.w < this.px || p.h < this.px || this.mode == "off":
this.nc = true;
this.img && this.img.Dispose();
this.img = null;
im.x = 0;
im.y = 0;
im.w = p.w;
im.h = p.h;
break;
case this.mode == "grid":
this.x = 0;
this.y = 0;
this.w = p.w;
this.h = p.h;
im.x = 40;
im.y = 40;
im.w = this.w - 80;
im.h = this.h - 80;
if (!this.nc && this.columns != Math.floor(this.w / this.px)) this.nc = true;
this.overlay = false;
this.rows = Math.ceil(this.h / this.px);
this.columns = Math.floor(this.w / this.px);
this.img_rows = Math.ceil(im.images.length / this.columns);
if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(Math.min(this.columns, im.images.length) * this.px, this.img_rows * this.px);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
var ci = 0;
var row, col;
for (row = 0; row < this.img_rows; row++) {
for (col = 0; col < this.columns; col++) {
if (ci == im.images.length) continue;
p.draw_image(temp_gr, im.images[ci], col * this.px, row * this.px, this.px, this.px, "top");
ci++;
}}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
case this.mode == "left":
case this.mode == "right":
this.x = this.mode == "left" ? 0 : p.w - this.px;
this.y = 0;
this.w = this.px;
this.h = p.h;
im.x = this.mode == "right" ? 0 : this.px;
im.y = 0;
im.w = p.w - this.px;
im.h = p.h;
this.rows = Math.ceil(this.h / this.px);

if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(this.px, this.px * im.images.length);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
for (i = 0; i < im.images.length; i++) {
p.draw_image(temp_gr, im.images[i], 0, i * this.px, this.px, this.px, "top");
}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
case this.mode == "bottom":
case this.mode == "top":
this.x = 0;
this.y = this.mode == "top" ? 0 : p.h - this.px;
this.w = p.w;
this.h = this.px;
im.x = 0;
im.y = this.mode == "bottom" ? 0 : this.px;
im.w = p.w;
im.h = p.h - this.px;
this.columns = Math.ceil(this.w / this.px);

if (this.nc && im.images.length > 0) {
this.nc = false;
this.img && this.img.Dispose();
this.img = null;
this.img = gdi.CreateImage(this.px * im.images.length, this.px);
var temp_gr = this.img.GetGraphics();
temp_gr.SetInterpolationMode(7);
for (i = 0; i < im.images.length; i++) {
p.draw_image(temp_gr, im.images[i], i * this.px, 0, this.px, this.px, "top");
}
this.img.ReleaseGraphics(temp_gr);
temp_gr = null;
}
break;
}}

this.wheel = function(step) {
switch(true) {
case !this.trace(p.mx, p.my):
case this.overlay:
return false;
case this.mode == "grid":
if (this.img_rows < this.rows) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.offset > this.img_rows - this.rows) this.offset = this.img_rows - this.rows + 1;
break;
case this.mode == "left":
case this.mode == "right":
if (im.images.length < this.rows) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.rows + this.offset > im.images.length) this.offset = im.images.length - this.rows + 1;
break;
case this.mode == "bottom":
case this.mode == "top":
if (im.images.length < this.columns) return true;
this.offset -= step;
if (this.offset < 0) this.offset = 0;
if (this.columns + this.offset > im.images.length) this.offset = im.images.length - this.columns + 1;
break;
}
window.RepaintRect(this.x, this.y, this.w, this.h);
return true;
}

this.move = function(x, y) {
switch(true) {
case !this.trace(x, y):
window.SetCursor(IDC_ARROW);
return false;
case this.overlay:
window.SetCursor(IDC_ARROW);
return true;
case this.mode == "grid":
this.index = Math.floor((x - this.x) / this.px) + (Math.floor((y - this.y) / this.px) * this.columns) + (this.offset * this.columns);
break;
case this.mode == "left":
case this.mode == "right":
this.index = Math.floor((y - this.y) / this.px) + this.offset;
break;
case this.mode == "bottom":
case this.mode == "top":
this.index = Math.floor((x - this.x) / this.px) + this.offset;
break;
}
window.SetCursor(this.index < im.images.length ? IDC_HAND : IDC_ARROW);
return true;
}

this.lbtn_up = function(x, y) {
switch(true) {
case !this.trace(x, y):
return false;
case this.mode == "grid" && this.overlay && im.trace(x, y):
this.overlay = false;
window.Repaint();
break;
case this.mode == "grid" && this.index < im.images.length && !this.overlay:
this.overlay = true;
im.index = this.index;
window.Repaint();
break;
case this.overlay:
break;
case this.index < im.images.length:
im.index = this.index;
window.Repaint();
}
return true;
}

this.lbtn_dblclk = function(x, y) {
if (!im.trace(x, y) || th.mode == "grid") return false;
p.run("\"" + im.files[im.index] + "\"");
return true;
}

this.nc = false;
this.mode = window.GetProperty("Thumbs mode", p.check_feature("now_playing") ? "off" : "off");
this.px = window.GetProperty("Thumbs px", 40);
this.img = null;
}

//START---->
var p = new panel("Thumbs", ["remap", "metadb"]);
var im = new images(0, 0, 0, 0);
var th = new thumbs();

on_item_focus_change();

function on_playback_time(time) {
im.playback_time(time);
}

function on_size() {
p.size();
th.calc();
}

function on_paint(gr) {
col = utils.GetSysColor(1);
gr.FillSolidRect(0, 0, p.w, p.h, col);
th.draw(gr);
}

function on_metadb_changed() {
  im.metadb_changed(); 
    window.SetTimeout(function()
            {
              if (im.images.length == 0 && im.auto_download=="on")
im.download();

            }, 5000);


}


function on_mouse_wheel(step) {
if (th.wheel(step)) return;
if (im.wheel(step)) return;
}

function on_mouse_move(x, y) {
p.move(x, y);
th.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
th.lbtn_up(x, y);
}

function on_mouse_lbtn_dblclk(x, y) {
th.lbtn_dblclk(x, y);
}

//Auto Cycle Image
var cicleTimerStarted = false;
var cicleTimer = null;
 
(function startTimer(){
 
if(!cicleTimerStarted){

cicleTimer = window.CreateTimerInterval(cycle2+"000");
cicleTimerStarted = true;
}
 
})();
 
function stopTimer(){
 
if(!cicleTimerStarted) return;
window.KillTimer(cicleTimer);
cicleTimer = undefined;
cicleTimerStarted = false;
 
}
 
function on_timer(id) {
if(cicleTimer && id == cicleTimer.ID){
 
{
do{
im.index++
if (im.index == im.images.length) im.index=0;
window.Repaint();
}while (im.index==-1);
}}}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-20 05:07:11
i've updated my last.fm & wikipedia biography script with full language support for last.fm. wikipedia is still english only.

(https://dl.dropboxusercontent.com/u/22801321/2014/december/lang.png)

right click>Update script.

full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)
script overview / setup guide: http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-20 09:13:53
@mire777

If you port the old script (Biography Photos) to common8 here's a mod that gets artwork from fanart.tv instead of google.
If you like it you can include it in your new script.

Don't know, i didnt receive any result, i didnt analize your code, but for me this not work..
Console:
Code: [Select]
Fanart.tv: Current Image Set:  
Fanart.tv: C:\Users\mire\Desktop\foobar2000 xch4\wsh_data\artists\Midnight Star\musicbrainz_artistid.txt
Fanart.tv: Midnight Star
Fanart.tv: 
Fanart.tv: C:\Users\mire\Desktop\foobar2000 xch4\wsh_data\artists\Midnight Star\musicbrainz_artistid.txt
Fanart.tv: Midnight Star
Fanart.tv: 
Fanart.tv: C:\Users\mire\Desktop\foobar2000 xch4\wsh_data\artists\Midnight Star\musicbrainz_artistid.txt
Fanart.tv: Midnight Star
Fanart.tv: 
Fanart.tv: [url=https://fanart.tv/artist/]https://fanart.tv/artist/[/url]
Fanart.tv: Fanart.tv results
Fanart.tv: urls_musiclogo: 0
Fanart.tv: urls_artistbackground: 0
Fanart.tv: urls_cdart: 0
Fanart.tv: urls_albumcover: 0
Fanart.tv: urls_artistthumb: 0
Fanart.tv: urls_musicbanner: 0
Fanart.tv: Downloading From Fanart.tv Started
Fanart.tv: Downloading From Fanart.tv Finished
Fanart.tv: Current Image Set:

EDIT: uh, there is no image for this artist at all: https://fanart.tv/artist/3d30a740-e36b-45b9.../midnight-star/ (https://fanart.tv/artist/3d30a740-e36b-45b9-a395-a3b3696d1d7c/midnight-star/)
Again for madonna i didnt receive anything even there is images: https://fanart.tv/artist/79239441-bfd5-4981...5c1287/madonna/ (https://fanart.tv/artist/79239441-bfd5-4981-a70c-55c3f15c1287/madonna/)
Anyway, don't know if this is useful if you don't have all artist there..

i've updated my last.fm & wikipedia biography script with full language support for last.fm. wikipedia is still english only.

Great
Why not for wiki?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-20 11:44:32
Why not for wiki?


because i'm still using the echonest. it solves the problem of not getting the artist/band related page when using common words or phrases. also, even if you do hit the right page, formatting content with just what you want is major pain and i'm just not interested in trying to work around it.

as for fanart, i think i looked at it when zeremy suggested it ages ago but i found the stats on their pages to be most disappointing. for example, there are just 13,000 artist images. i looked at that page for madonna and 4 of those are for her. i then looked up the beatles because they're rather famous and there are 16 images. when you start getting a few artists like this, you soon realise they're only going to have images for a few hundred or maybe a couple of thousand different artists. for me, that just isn't worth the effort.

----

i've added an Updates page to my website to cover new features and important bug fixes. i'll still post all updates here though.

http://marc2003.x10host.com/updates (http://marc2003.x10host.com/updates)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-20 12:56:41
Marc, i have problem with some redirecting urls, that i receive as google image links.
When you enter link in browser, it changes to another.
Link works but it is different .
How to fix this?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-20 13:10:34
i'm pretty sure you can't do anything about that. when using random sites found via google, you're at their mercy.

it's like my website is configured to redirect if you try and access a page that doesn't exist. rather than show a 404 message, i just redirect to my home page. try it: http://marc2003.x10host.com/not_a_page (http://marc2003.x10host.com/not_a_page)
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2014-12-20 13:39:58
@mire777

If you port the old script (Biography Photos) to common8 here's a mod that gets artwork from fanart.tv instead of google.
If you like it you can include it in your new script.

Don't know, i didnt receive any result, i didnt analize your code, but for me this not work..
Console:
Code: [Select]
Fanart.tv: Current Image Set:  
Fanart.tv: C:\Users\mire\Desktop\foobar2000 xch4\wsh_data\artists\Midnight Star\musicbrainz_artistid.txt
Fanart.tv: Midnight Star
Fanart.tv: 
Fanart.tv: C:\Users\mire\Desktop\foobar2000 xch4\wsh_data\artists\Midnight Star\musicbrainz_artistid.txt
Fanart.tv: Midnight Star
Fanart.tv: 
Fanart.tv: C:\Users\mire\Desktop\foobar2000 xch4\wsh_data\artists\Midnight Star\musicbrainz_artistid.txt
Fanart.tv: Midnight Star
Fanart.tv: 
Fanart.tv: [url=https://fanart.tv/artist/]https://fanart.tv/artist/[/url]
Fanart.tv: Fanart.tv results
Fanart.tv: urls_musiclogo: 0
Fanart.tv: urls_artistbackground: 0
Fanart.tv: urls_cdart: 0
Fanart.tv: urls_albumcover: 0
Fanart.tv: urls_artistthumb: 0
Fanart.tv: urls_musicbanner: 0
Fanart.tv: Downloading From Fanart.tv Started
Fanart.tv: Downloading From Fanart.tv Finished
Fanart.tv: Current Image Set:

EDIT: uh, there is no image for this artist at all: https://fanart.tv/artist/3d30a740-e36b-45b9.../midnight-star/ (https://fanart.tv/artist/3d30a740-e36b-45b9-a395-a3b3696d1d7c/midnight-star/)
Again for madonna i didnt receive anything even there is images: https://fanart.tv/artist/79239441-bfd5-4981...5c1287/madonna/ (https://fanart.tv/artist/79239441-bfd5-4981-a70c-55c3f15c1287/madonna/)
Anyway, don't know if this is useful if you don't have all artist there..

Yes, It doesn't have all artist on the site , but what it does have is criteria to what is uploaded.
e.g background images are 1920x1080 , album covers 1000x1000.
It also has Logo ( which I didn't find anywhere else).

As for the script it uses the artists/bands musicbrainz id (which if found from tag or artists wsh_data folder (thanks marc2003) ) to search and scrape the site.
If "Madonna"  did not work for you , check that it exists.

I find a search like this using mbid more accurate , I tried your google search script and it returns generic images for common words.
e.g  like the band "Heart".
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-20 18:17:09
marc, I have yet another improvement suggestion for your biography panel :

Let's say that I want to remain on last.fm most of the time.
But for some artists there is no last.fm bio, so I go to wikipedia.
Then the wikipedia bio is downloaded automatically.
Then I switch back to last.fm.
Then the next time I listen to that artist... I won't see anything because I will be back to last.fm, so the wikipedia bio won't display, even if it's in my hard drive !

So, could you think of some "fallback scenario" for your panel ?
1. We choose a "preferred site" (last.fm or wikipedia) and a "preferred language" (ex : english) (on a global basis of course, not for every artist !  )
2. The panel tries to find a bio on the preferred site and language
3. If it doesn't find anything, it automatically tries to find a bio on the other site with the same language, without us needing to switch
4. If it doesn't find anything on both sites, it looks for the bio in the hard drive

Example 1 : preferred = last.fm AND english ==> last.fm (english), then wikipedia (english), then hard drive
Example 2 : preferred = wikipedia AND french ==> wikipedia (french), then last.fm (french), then hard drive

Something like that... ;-)

Oh, and in all cases, it would be nice if the panel would display a last.fm or a wikipedia logo, so we would know where the displayed bio comes from (right now my panel doesn't display anything).

I hope this makes sense. Thanks in advance !
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-20 18:38:58
Oh, and in all cases, it would be nice if the panel would display a last.fm or a wikipedia logo, so we would know where the displayed bio comes from (right now my panel doesn't display anything).


not a logo but this will show some text next to the artist name at the top. open the panel and edit line 22. replace

Code: [Select]
t.header_text()


with

Code: [Select]
t.header_text() + ": " + (t.biography_lastfm ? "last.fm" : "wikipedia")


i'll think about the rest but i'm warning you now, do not hold your breath. also you seem to be confused into thinking wikipedia supports other languages but it doesn't - not in my script anyway. if you don't like it, feel free to use foo_uie_biography.

edit: having given it a bit more thought, i think the chances me implementing any of these fallbacks are very slim. it would be a big, ugly hack-y mess and i'm really trying to cut down on those. 
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-21 01:36:08
Hmm, it's up to you : you're the boss !

I honestly don't care about the language part. I only used it as an example that could be used by everyone. As for me, the only language I use is english, so I'm fine with that.
I'm well aware that your script doesn't support other languages in Wikipedia, and again, I'm fine with that.

Languages aside, I understand it may be complicated to implement the fallbacks. What bothers me is that no fallback leads to the above scenario, where a bio won't display even if it's in my hard drive. I would understand if there was a bio available online, but if there's nothing online and something in the hard drive, I think it's a pity that we have to remember there's something in the hard drive, switch manually, and re-switch afterwards.

A component like foo_uie_lyrics3 comes to mind, where a fallback scenario can be configured in the order we choose (ex : look first for lyrics in the tags, then look for lyrics in the hard drive, then look for lyrics online).

But again, you are the boss.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-21 01:46:50
Here's another idea instead of a fallback scenario :

- The bio panel could always scan BOTH preferred sites (ex : last.fm english, wikipedia) AND the hard drive
- Then on the top-right part, it would display 0 to 4 small buttons (e.g. "last.fm online", "wikipedia online", "last.fm local", "wikipedia local"), depending on whether there's an available bio or not
- So we would manually click the buttons to display the bio we want, the default displayed bio being of course the one we chose via the right-click menu.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-21 03:27:00
Yet another small improvement : when only 1 of the 2 online bios a is available, display it by default. Just my two cents.

EDIT - And maybe a small bug report on Thumbs :
- Sometimes downloaded images are corrupted (half-downloaded, impossible to resume download)
- Sometimes a black thumbnail appears instead of the downloaded image, but if I go to the next song then get back to the previous one, the downloaded image appears.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-21 08:37:58
i'm pretty sure you can't do anything about that. when using random sites found via google, you're at their mercy.

it's like my website is configured to redirect if you try and access a page that doesn't exist. rather than show a 404 message, i just redirect to my home page. try it: http://marc2003.x10host.com/not_a_page (http://marc2003.x10host.com/not_a_page)


Yes, this is what happens, and script then download nothing.
Only solution is to check if that url can be opened, if not, to use next url..
But then you lost speed..

I have one suggestion, because you now use html, you can also add 'album info', like foo_uie_biography.dll have..

@Zeremy

This would be good for some ''cover tag script''..
But if you want that script always  find image, this is not good..
I think that only google or yahoo should be used here.
Maybe discogs.com , i didnt try this..

As Marc said - better source than last.fm doesn't exist , but is good to have some alternative..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-21 12:40:37
- The bio panel could always scan BOTH preferred sites (ex : last.fm english, wikipedia)


well not really. the biggest problem is fetching and processing the response from 2 different sites when i have shared functions configured to use a global setting - one or the other. in theory i could break the functions down so each source can work independently of each other but i really don't want to do that.

if this is such an issue for you, i suggest running 2 instances at the same time and have them in tabs. that's fairly similar to me creating buttons in the top corner.

EDIT - And maybe a small bug report on Thumbs :
- Sometimes downloaded images are corrupted (half-downloaded, impossible to resume download)
- Sometimes a black thumbnail appears instead of the downloaded image, but if I go to the next song then get back to the previous one, the downloaded image appears.


sorry, i've never seen that before and no one else has reported it either. when the download is initiated, i launch an external script that foobar has no control over. nothing you or i could possibly do in foobar (even closing it) will affect this download. i suppose network interruptions or other background processes on your pc may cause it but that's something beyond my control.

edit: i've even tried replicating problems by disconnecting my internet while it's running and killing the process in task manager (cscript.exe) and i'm not being left with any corrupt images at all. i'm at a loss to explain that.

I have one suggestion, because you now use html, you can also add 'album info', like foo_uie_biography.dll have..


i wouldn't use html. the JSON web service still works in full for that. i even used to have it in my scripts but i ditched it a few months back because of the lack of content. i've not had a single complaint either. that just goes to show popular it was.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2014-12-21 15:20:59
i wouldn't use html. the JSON web service still works in full for that. i even used to have it in my scripts but i ditched it a few months back because of the lack of content. i've not had a single complaint either. that just goes to show popular it was.


Well that's great. I didn't know that
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-21 17:05:14
marc : fair enough  The tabs idea looks good, I'll try it. As for the download errors, I have experienced them many times already (let's say about 1 in 20 downloads or so), but honestly I can live with that.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-21 18:18:14
try saving this file in your marc2003 folder. https://dl.dropboxusercontent.com/u/2280132...mp/download.vbs (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/download.vbs)

this modified version saves images with a .tmp extension so my panel won't detect it. it only gets renamed properly when it's complete.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-22 20:28:18
marc, so far so good ! The issue seems to have been completely solved (tested on several dozen songs). Thank you.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-12-22 20:32:43
marc,

Is there a way to replace the cog icon you used in yuckfoo's menu panel with something drawn directly in the panel?

Ideally it would be round, say 20px in diameter and have three states/color states. Normal, hover, and pressed.

I stole that little gem of yours for a config I've been working on and replaced the icon. However, even that looks out of place and thought that maybe a simple round button with configurable color options would look the best.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-22 21:04:18
marc, so far so good ! The issue seems to have been completely solved (tested on several dozen songs). Thank you.


bit of an odd one that. i don't really know how the vbscript works but it looked to me like it wasn't writing the file until it was fully downloaded but something was messing it up on your setup??

Is there a way to replace the cog icon you used in yuckfoo's menu panel with something drawn directly in the panel?


yes but don't ask me how. falstaff and extremehunter know about that stuff. i don't bother with it because i have to distribute loads of images with my samples so it's not worth my time learning how. the best i can do is draw a rectangle or line.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2014-12-22 22:08:48
Paint to the rescue it is then.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-23 07:14:07
Bug report for Thumbs : "Set as default" doesn't work for artists whose name ends with a "." (ex : "Boney M.", "Sheila E.").
It works for artists with "." anywhere in their name (ex : "B.o.B"), it only fails when the name ends with a ".".
Thanks in advance.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-23 09:10:03
thanks for spotting that. it has now been fixed. right click>Update script.
Title: WSH Panel Mod script discussion/help
Post by: wcs13 on 2014-12-23 18:40:50
Problem solved ! Thanks marc.

That being said... maybe it's completely unrelated, but since the last update I'm having again some download problems with Thumbs (only from time to time, no big deal - I can live with that, I'm just reporting just in case).
Here's an example : http://i59.tinypic.com/11kl10z.jpg (http://i59.tinypic.com/11kl10z.jpg) . As you can see, 3 images have just been downloaded and appear, and 2 more have been downloaded... but they don't appear yet.
I can wait for as long as I wish (1min in this example, check the progress bar  ) but they won't appear.
However, if I switch to another artist then back again, then the 5 images display correctly and almost instantly (no new downloads) : http://i57.tinypic.com/2n83c0g.jpg (http://i57.tinypic.com/2n83c0g.jpg)
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2014-12-24 03:58:20
Hi guys

I'm hoping someone can help me out here.

At the moment I'm running a modded version of marc's Now Playing script but I've hit a brick wall trying to adjust the alignment of certain elements. I've done a search through this thread and haven't found anything on it.

So here's what the panel looks like so far:

(http://i.imgur.com/2KkSxyi.jpg)

Firstly, I'm trying to figure out a way to a $drawtextex string to align each row horizontally along the x axis.

Is there are way it can be added here, or am I barking up the wrong tree?

Code: [Select]
var line2 = {
    text: "",
    tf: "%title%",
    font: gdi.Font("Amble", 21, 1),
    colour: RGB(218, 132, 44),
    y: 43
}

I also want to center the weblink buttons too, which I'm guessing might be possible here:

Code: [Select]
this.buttons = {
            google: new button(im.x + im.w - 160, bar2y + 1, 28, 28, {normal: "google.png", hover: "google_h.png"}, function() { p.browser(google); }, google),

Sorry for the newbie questions but my understanding of scripting is quite basic!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-24 09:50:17
@wcs10, right click>Update script

@hucifer

1) that's easy. inside the on_paint function rename the 3 p.left_text functions to p.centre_text

2) replace

Code: [Select]
im.x + im.w - 160


with

Code: [Select]
im.x + Math.round((im.w - 140) / 2)


add 28 to the second button, 56 for the third and so on...

also, any chance you could upload those images? i'm useless at editing them myself and they're much nicer than the old ones i use.
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2014-12-24 14:27:25
1) that's easy. inside the on_paint function rename the 3 p.left_text functions to p.centre_text

2) replace

Code: [Select]
im.x + im.w - 160


with

Code: [Select]
im.x + Math.round((im.w - 140) / 2)


add 28 to the second button, 56 for the third and so on...


That did the trick. Thanks very much!

Quote
also, any chance you could upload those images? i'm useless at editing them myself and they're much nicer than the old ones i use.


Sure, no worries  Download (https://www.mediafire.com/?9lus2jwadp2surt)

Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2014-12-24 15:26:40
Sure, no worries  Download (https://www.mediafire.com/?9lus2jwadp2surt)


Thanks! They look lovely on dark background as well. Though, last.fm are hard to see, both on hover and not on. Per any chance have some others for it in same style, just brighter?

(http://i.imgur.com/YKxeGRE.png)
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2014-12-24 16:12:53
Sure, no worries  Download (https://www.mediafire.com/?9lus2jwadp2surt)


Thanks! They look lovely on dark background as well. Though, last.fm are hard to see, both on hover and not on. Per any chance have some others for it in same style, just brighter?

(http://i.imgur.com/YKxeGRE.png)


I don't but it's fairly easy to do.

Just open the coloured "hot" pngs with Photoshop / GIMP / other image editing program etc, desaturate them and then set their opacity to something like 90%. Save as .png (not jpeg!) and you're done.
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2014-12-24 18:56:38
Thanks again! Had to apply some lightning to that process, and now looks pretty awesome for my needs.
Title: WSH Panel Mod script discussion/help
Post by: anceps on 2014-12-26 15:05:56
Hi,

Thanks very much marc for everything you've put together here - your scripts are amazing.

I've just tried to follow your customisation tutorial (because otherwise this code is utterly opaque to me) and was going OK until the button-adding section. You say that the buttons should be visible but non-functional, but at that point you've not mentioned adding "b.draw(gr);" in the "function on_paint(gr)" section. The additional code (about adding the bio) makes that clear - but it could be clearer in the guide.

Cheers!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2014-12-26 15:42:06
^thanks for spotting that. i'll update it tomorrow. i can't do it now because the computer/internet connection i'm using right now is unbelievably restricted meaning i can barely do anything. i can't even open notepad. it's a miracle i can even post here as most message boards are blocked!

@hucifer, thanks for uploading the images. i'll grab them tomorrow when i have some better internet access.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-03 12:51:49
Thank's for your geat job, marc

My folder marc2003 look like this, it's not a problem ? I have older scripts because i don't want update for example "now playing", but i don't now if it's a problem or not

(http://image.noelshack.com/fichiers/2015/01/1420289381-marc2003.png)
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-01-03 13:49:57
Here's another alternate biography script using theaudiodb.com.

Current stats.
21,899 Artist biographies.
+ various Language Translations.

(http://i.imgur.com/98moWNf.png)

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Text theaudiodb.com"
// @author "zeremy"
// @import "%fb2k_profile_path%marc2003\common8.js"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
var p = new panel("Biographies theaudiodb.com", ["metadb", "remap", "custom_menu"]);
var t = new text("bio", 6, 30, p.w - 12, p.h - 30);

var source = window.GetProperty("download_source", "theaudiodb.com");
var lang = window.GetProperty("language", "EN");
var a_lang = "";

var folder = fb.ProfilePath + "wsh_theaudiodb\\";
folder.create();

var artist_folder = folder + t.artist.validate() + "\\";
artist_folder.create();

on_item_focus_change();

function on_size()
{
p.size();
t.w = p.w - 12;
t.h = p.h - 30;
t.size();
p.menu_btn.x = p.w - p.menu_btn.w;
}

function on_paint(gr)
{

p.draw_background(gr);
p.left_text(gr, t.artist, p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
gr.DrawLine(6, 29, p.w - 6, 29, 1, p.textcolour_hl);
t.draw(gr);
p.menu_btn.draw(gr);
gr.DrawLine(6, 50, p.w - 6, 50, 1, p.textcolour_hl);
p.left_text(gr, t.a_lang, p.normal_font, p.textcolour, 6, 26, p.w - 12, 24);
p.right_text(gr, "[theaudiodb.com] " + lang, p.normal_font, p.textcolour, 6, 6, p.w - 12, 24);

}

function on_playback_stop()
{
// t.artist = "";
t.a_lang = "";
// t.text = "";
t.update();
window.Repaint();
}

function on_metadb_changed()
{
if (!p.metadb)
return;
p.artist = p.eval(p.artist_tf);
if (t.artist == p.artist)
return;
t.artist = p.artist;
t.text = "";

var artist_folder = folder + t.artist.validate() + "\\";
artist_folder.create();

t.filename = artist_folder + source + "." + lang + ".txt";
if (t.filename.is_file())
{
t.text = p.open(t.filename);

}
else
{
get();

}
    get_a_lang();
t.update();
window.Repaint();
}

function on_mouse_wheel(step)
{
t.wheel(step);
}

function on_mouse_move(x, y)
{
p.move(x, y);
t.move(x, y);
}

function on_mouse_lbtn_up(x, y)
{
if (p.menu_btn.lbtn_up(x, y))
return;
t.lbtn_up(x, y);
}

function get()
{
if (t.artist == "" || t.artist == "?")
return;

var artist_folder = folder + t.artist.validate() + "\\";
artist_folder.create();

t.filename = artist_folder + source + ".json";
var fn = t.filename;
var url = ("http://www.theaudiodb.com/api/v1/json/1/search.php?s=" + encodeURIComponent(t.artist));
t.xmlhttp.open("GET", url, true);
t.xmlhttp.send();
t.xmlhttp.onreadystatechange = function ()
{
if (t.xmlhttp.readyState == 4)
{
if (t.xmlhttp.status == 200)
{
var text = t.xmlhttp.responsetext;
t.text = text;
}
else
{
p.console("HTTP error: " + t.xmlhttp.status);
t.text = "This artist does not have a biography";
}

p.save(t.text, fn);

if (t.filename.is_file())
{
t.text = p.open(t.filename);

try
{
t.filename = artist_folder + source;
data = t.text;
json_data = JSON.parse(data);
json_data = json_data.artists;
items = json_data.length;

//EN
for (i = 0; i < items; i++)
{
fn_en = t.filename + "." + "EN" + ".txt"
response = json_data[i].strBiographyEN;

if (response == null)
{}

else
{
p.save(response, fn_en);
}
}

//DE
for (i = 0; i < items; i++)
{
fn_de = t.filename + "." + "DE" + ".txt"
response = json_data[i].strBiographyDE;

if (response == null)
{}

else
{
p.save(response, fn_de);
}
}

//FR
for (i = 0; i < items; i++)
{
fn_fr = t.filename + "." + "FR" + ".txt"
response = json_data[i].strBiographyFR;

if (response == null)
{}

else
{
p.save(response, fn_fr);
}
}

//CN
for (i = 0; i < items; i++)
{
fn_cn = t.filename + "." + "CN" + ".txt"
response = json_data[i].strBiographyCN;

if (response == null)
{}

else
{
p.save(response, fn_cn);
}
}

//IT
for (i = 0; i < items; i++)
{
fn_it = t.filename + "." + "IT" + ".txt"
response = json_data[i].strBiographyIT;

if (response == null)
{}

else
{
p.save(response, fn_it);
}
}

//JP
for (i = 0; i < items; i++)
{
fn_jp = t.filename + "." + "JP" + ".txt"
response = json_data[i].strBiographyJP;

if (response == null)
{}

else
{
p.save(response, fn_jp);
}
}

//RU
for (i = 0; i < items; i++)
{
fn_ru = t.filename + "." + "RU" + ".txt"
response = json_data[i].strBiographyRU;

if (response == null)
{}

else
{
p.save(response, fn_ru);
}
}

//ES
for (i = 0; i < items; i++)
{
fn_es = t.filename + "." + "ES" + ".txt"
response = json_data[i].strBiographyES;

if (response == null)
{}

else
{
p.save(response, fn_es);
}
}

//PT
for (i = 0; i < items; i++)
{
fn_pt = t.filename + "." + "PT" + ".txt"
response = json_data[i].strBiographyPT;

if (response == null)
{}

else
{
p.save(response, fn_pt);
}
}

//SE
for (i = 0; i < items; i++)
{
fn_se = t.filename + "." + "SE" + ".txt"
response = json_data[i].strBiographySE;

if (response == null)
{}

else
{
p.save(response, fn_se);
}
}

//NL
for (i = 0; i < items; i++)
{
fn_nl = t.filename + "." + "NL" + ".txt"
response = json_data[i].strBiographyNL;

if (response == null)
{}

else
{
p.save(response, fn_nl);
}
}

//HU
for (i = 0; i < items; i++)
{
fn_hu = t.filename + "." + "HU" + ".txt"
response = json_data[i].strBiographyHU;

if (response == null)
{}

else
{
p.save(response, fn_hu);
}
}

//NO
for (i = 0; i < items; i++)
{
fn_no = t.filename + "." + "NO" + ".txt"
response = json_data[i].strBiographyNO;

if (response == null)
{}

else
{
p.save(response, fn_no);
}
}

//IL
for (i = 0; i < items; i++)
{
fn_il = t.filename + "." + "IL" + ".txt"
response = json_data[i].strBiographyIL;

if (response == null)
{}

else
{
p.save(response, fn_il);
}
}

//PL
for (i = 0; i < items; i++)
{
fn_pl = t.filename + "." + "PL" + ".txt"
response = json_data[i].strBiographyPL;

if (response == null)
{}

else
{
p.save(response, fn_pl);
}
}

get_a_lang();
t.update();
}
catch (err)
{}

}

t.artist = "";
on_item_focus_change();

}
}

}

function get_a_lang()
{

var artist_folder = folder + t.artist.validate() + "\\";
var a_lang = [];

//EN - 4
lang_filename = artist_folder + source + "." + "EN" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("EN");
}
//DE - 5
lang_filename = artist_folder + source + "." + "DE" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("DE");
}
//FR - 6
lang_filename = artist_folder + source + "." + "FR" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("FR");
}
//CN - 7
lang_filename = artist_folder + source + "." + "CN" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("CN");
}
//IT - 8
lang_filename = artist_folder + source + "." + "IT" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("IT");
}
//JP - 9
lang_filename = artist_folder + source + "." + "JP" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("JP");
}
//RU - 10
lang_filename = artist_folder + source + "." + "RU" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("RU");
}
//ES - 11
lang_filename = artist_folder + source + "." + "ES" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("ES");
}
//PT - 12
lang_filename = artist_folder + source + "." + "PT" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("PT");
}
//SE - 13
lang_filename = artist_folder + source + "." + "SE" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("SE");
}
//NL - 14
lang_filename = artist_folder + source + "." + "NL" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("NL");
}
//HU - 15
lang_filename = artist_folder + source + "." + "HU" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("HU");
}
//NO - 16
lang_filename = artist_folder + source + "." + "NO" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("NO");
}
//IL - 17
lang_filename = artist_folder + source + "." + "IL" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("IL");
}
//PL - 18
lang_filename = artist_folder + source + "." + "PL" + ".txt";
if (lang_filename.is_file())
{
a_lang.push("PL");
}

t.a_lang = "LNG : " + a_lang;
}

p.menu = function ()
{

var _menu = window.CreatePopupMenu();

_menu.AppendMenuItem(p.metadb ? MF_STRING : MF_GRAYED, 1, "Refresh (Download)");
_menu.AppendMenuItem(p.metadb ? MF_STRING : MF_GRAYED, 2, "Refresh (Avaliable Languages)");
_menu.AppendMenuSeparator();

_menu.AppendMenuItem(MF_STRING, 4, "EN");
_menu.AppendMenuItem(MF_STRING, 5, "DE");
_menu.AppendMenuItem(MF_STRING, 6, "FR");
_menu.AppendMenuItem(MF_STRING, 7, "CN");
_menu.AppendMenuItem(MF_STRING, 8, "IT");
_menu.AppendMenuItem(MF_STRING, 9, "JP");
_menu.AppendMenuItem(MF_STRING, 10, "RU");
_menu.AppendMenuItem(MF_STRING, 11, "ES");
_menu.AppendMenuItem(MF_STRING, 12, "PT");
_menu.AppendMenuItem(MF_STRING, 13, "SE");
_menu.AppendMenuItem(MF_STRING, 14, "NL");
_menu.AppendMenuItem(MF_STRING, 15, "HU");
_menu.AppendMenuItem(MF_STRING, 16, "NO");
_menu.AppendMenuItem(MF_STRING, 17, "IL");
_menu.AppendMenuItem(MF_STRING, 18, "PL");
_menu.CheckMenuRadioItem(4, 18, lang == "EN" ? 4 : lang == "DE" ? 5 : lang == "FR" ? 6 : lang == "CN" ? 7 : lang == "IT" ? 8 : lang == "JP" ? 9 : lang == "RU" ? 10 : lang == "ES" ? 11 : lang == "PT" ? 12 : lang == "SE" ? 13 : lang == "NL" ? 14 : lang == "HU" ? 15 : lang == "NO" ? 16 : lang == "IL" ? 17 : 18);

var idx = _menu.TrackPopupMenu(p.menu_btn.x, p.menu_btn.y);
switch (idx)
{
case 1:

if (p.metadb)
{
get();
}
break;
case 2:

if (p.metadb)
{
get_a_lang();
t.update();
window.Repaint();
}
break;
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
lang = idx == 4 ? "EN" : idx == 5 ? "DE" : idx == 6 ? "FR" : idx == 7 ? "CN" : idx == 8 ? "IT" : idx == 9 ? "JP" : idx == 10 ? "RU" : idx == 11 ? "ES" : idx == 12 ? "PT" : idx == 13 ? "SE" : idx == 14 ? "NL" : idx == 15 ? "HU" : idx == 16 ? "NO" : idx == 17 ? "IL" : "PL";
p.console("Language Changed To: " + lang);
window.SetProperty("language", lang);
var artist_folder = folder + t.artist.validate() + "\\";
get_a_lang();
t.filename = artist_folder + source + "." + lang + ".txt";
if (t.filename.is_file())
{
t.text = p.open(t.filename);

}
else
{
t.text = "No Biography Found";
}

t.update();
window.Repaint();

}

_menu.Dispose();

}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-03 13:51:32
My folder marc2003 look like this, it's not a problem ? I have older scripts because i don't want update for example "now playing", but i don't now if it's a problem or not


no, it shouldn't be a problem. that's why i rename files when there are major changes so all scripts should work side by side. i'd try and get rid what is using common6 though - that is seriously old. but i suppose if it's not using anything online then it'll be fine.

you can save a whopping 8kb by deleting that file named art. that has been obsolete for quite some time now.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-03 14:26:25
Here's another alternate biography script using theaudiodb.com.


you've made that massively more complicated than it needs to be. i'll give you some tips on monday when i have access to a pc that i can run foobar on.
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-01-06 02:24:32
Thanks for the greatest scripts.

I'd like to know if there is any method to change the vertical list of "Similar Artists" into the horizontal list of them.

According the default  'last.fm similar artists' script by marc2003, it's something liek this.

Quote
Peter Gabriel: similar artists
------------------------------------------------------------------------
Genesis
Steve Hackett
Tony Banks
Marillion
:
:


What I want is like this
Quote
Genesis, Steve Hackett, Tony Banks

Without "Head Title" & Horizontal bar,
Only similar artists no more than "3" or "4".

It would be very nice if someone could give me some hints.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-06 10:03:43
displaying them like that is easy enough but keeping them clickable would be a bit more more work.

for just the display, right click the panel>configure. replace the entire on_paint function with this.

Code: [Select]
function on_paint(gr) {
    p.draw_background(gr);
    var arr = li.names.splice(1, 5);
    p.left_text(gr, arr.join(", "), p.list_font, p.textcolour, 5, 0, p.w  - 10, p.row_height);
}
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-01-06 13:34:38
Here's another alternate biography script using theaudiodb.com.


you've made that massively more complicated than it needs to be. i'll give you some tips on monday when i have access to a pc that i can run foobar on.


I would appreciate your advise to simplify it , when you have the time.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-06 14:06:01
I would appreciate your advise to simplify it , when you have the time.


sorry i haven't posted anything but i don't have proper access to a computer at the moment. although i'm on the internet now, i can't run foobar because the pc is a thin client running windows embedded with no access to hard drive space or even usb devices. also, the internet is heavily restricted meaning i can't even access my dropbox and most other file/image hosting sites. i could theoretically edit your code in a browser window but i can't test it. i might give it a go later if i get bored.



Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-01-07 00:30:15
displaying them like that is easy enough but keeping them clickable would be a bit more more work.

for just the display, right click the panel>configure. replace the entire on_paint function with this.

Code: [Select]
function on_paint(gr) {
    p.draw_background(gr);
    var arr = li.names.splice(1, 5);
    p.left_text(gr, arr.join(", "), p.list_font, p.textcolour, 5, 0, p.w  - 10, p.row_height);
}


It worked like a cham.
Thanks for your kind help from the author.

It would be very nice if you may spend your valuable time for making "the horizontal similar artists" clickable.
As you guess, the clickable function is very critical for us to enjoy much more music from the various artists which we didn't know.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-07 09:49:48
@zeremy, i've been able to modify/test your script at my local library. here it is....

https://dl.dropboxusercontent.com/u/2280132...temp/zeremy.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/zeremy.txt)

i've put in a few comments and you might want to change the on_paint function because i just used my default so it doesn't show the language like yours did.

@widerock, i'll let you know if i think of something for clickable links.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-01-07 12:39:54
@zeremy, i've been able to modify/test your script at my local library. here it is....

https://dl.dropboxusercontent.com/u/2280132...temp/zeremy.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/zeremy.txt)

i've put in a few comments and you might want to change the on_paint function because i just used my default so it doesn't show the language like yours did.

@widerock, i'll let you know if i think of something for clickable links.


I try download, but

Quote
Unable to complete secure transaction

You tried to access the address https://dl.dropboxusercontent.com/u/2280132...temp/zeremy.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/zeremy.txt), which is currently unavailable. Please make sure that the web address (URL) is correctly spelled and punctuated, then try reloading the page.

Secure connection: fatal error (49) from server.

https://dl.dropboxusercontent.com/u/2280132...temp/zeremy.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/zeremy.txt)

The certificate is valid, but permission denied.
Make sure your internet connection is active and check whether other applications that rely on the same connection are working.
Check that the setup of any internet security software is correct and does not interfere with ordinary web browsing.
If you are behind a firewall on a Local Area Network and think this may be causing problems, talk to your systems administrator.


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-07 12:56:05
perhaps it was just a temporary error? did you try again? maybe you should check your system time to make sure it's correct (this is required when fetching files over https). also, try clearing your browser cache or another browser if you have one installed. or you could just modify the url in your address bar to use http instead.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-01-07 13:46:34
@zeremy, i've been able to modify/test your script at my local library. here it is....

https://dl.dropboxusercontent.com/u/2280132...temp/zeremy.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/zeremy.txt)

i've put in a few comments and you might want to change the on_paint function because i just used my default so it doesn't show the language like yours did.

Thanks for taking the time to share your knowledge.
Learning something new , everyday....

Works like a charm , just made a few fixes.

Here's my final script , with current selected language in title , available downloaded languages on a second row and a fix in the get() function not to download
when json returns {artists: null}.

Code: [Select]
// ==PREPROCESSOR==
// @name "Biography Text theaudiodb.com"
// @author "zeremy"
// @import "%fb2k_profile_path%marc2003\common8.js"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
var p = new panel("Biographies theaudiodb.com", ["metadb", "remap", "custom_menu"]);
var t = new text("custom", 6, 30, p.w - 12, p.h - 30);

var adb_langs = ["EN", "DE", "FR", "CN", "IT", "JP", "RU", "ES", "PT", "SE", "NL", "HU", "NO", "IL", "PL"];
var adb_lang = window.GetProperty("adb_lang", 0);

var folder = fb.ProfilePath + "wsh_theaudiodb\\";
folder.create();

text2 = "";

on_item_focus_change();

function on_size() {
    p.size();
    t.w = p.w - 12;
    t.h = p.h - 30;
    t.size();
    p.menu_btn.x = p.w - p.menu_btn.w;
}

function on_paint(gr) {
    p.draw_background(gr);
    p.left_text(gr, t.artist + ": theaudiodb.com" + "[" + adb_langs[adb_lang] + "]", p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
    gr.DrawLine(5, 29, p.w - 5, 29, 1, p.textcolour_hl & 0x45ffffff);
    p.left_text(gr, "Available Languages: " + t.text2, p.normal_font, p.textcolour_hl, 6, 26, p.w - 12, 24);
    t.draw(gr);
    p.menu_btn.draw(gr);
}

function on_metadb_changed() {
    if (!p.metadb) return;
    p.artist = p.eval(p.artist_tf);
    if (t.artist == p.artist) return;
    t.artist = p.artist;
    t.text = "";
    text2 = [];
    t.text2 = "";
    var artist_folder = folder + t.artist.validate() + "\\";
    artist_folder.create();
    t.filename = artist_folder + "audiodb.json";

    if (t.filename.is_file()) {
        var data = p.json_parse(p.open(t.filename), "artists");
        if (data.length > 0) {
            bio = data[0];
            t.text = bio["strBiography" + adb_langs[adb_lang]] || "";
        }

        if (data.length > 0) {
            for (var f = 0; f < adb_langs.length; f++) {
                if (bio["strBiography" + adb_langs[f]] == null) {} else {
                    text2.push(adb_langs[f]);
                }
            }
        }

        t.text2 = text2;

        if (t.filename.expired(ONE_DAY)) get();
        } else {
        get();
        }
       
    t.update();
    window.Repaint();
}

function on_mouse_wheel(step) {
    t.wheel(step);
}

function on_mouse_move(x, y) {
    p.move(x, y);
    t.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
    if (p.menu_btn.lbtn_up(x, y)) return;
    t.lbtn_up(x, y);
}

function get() {
    if (t.artist == "" || t.artist == "?") return;
    var fn = t.filename;
    var url = ("http://www.theaudiodb.com/api/v1/json/1/search.php?s=" + encodeURIComponent(t.artist));
    t.xmlhttp.open("GET", url, true);
    t.xmlhttp.send();
    t.xmlhttp.onreadystatechange = function() {
        if (t.xmlhttp.readyState == 4) {
            if (t.xmlhttp.status == 200) {
                var data = p.json_parse(t.xmlhttp.responsetext, "artists");
                if (data == null){
                    //error {"artists":null}
                    }
                else
                {
                p.save(t.xmlhttp.responsetext, fn);
                }
                t.artist = "";
                p.item_focus_change();
            } else {
                //error
            }
        }
    }

}

p.menu = function() {
    var _menu = window.CreatePopupMenu();
    _menu.AppendMenuItem(p.metadb ? MF_STRING : MF_GRAYED, 1, "Refresh (Download)");
    for (var i = 0; i < adb_langs.length; i++) {
        _menu.AppendMenuItem(MF_STRING, i + 2, adb_langs[i]);
    }
    _menu.CheckMenuRadioItem(2, 16, adb_lang + 2);
    var idx = _menu.TrackPopupMenu(p.menu_btn.x + p.menu_btn.w, p.menu_btn.y, TPM_RIGHTALIGN);
    switch (idx) {
        case 0:
            break;
        case 1:
            get();
            break;
        default:
            adb_lang = idx - 2;
            window.SetProperty("adb_lang", adb_lang);
            t.artist = "";
            p.item_focus_change();
            break;
    }
    _menu.Dispose();
}
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-01-07 14:36:04
perhaps it was just a temporary error? did you try again? maybe you should check your system time to make sure it's correct (this is required when fetching files over https). also, try clearing your browser cache or another browser if you have one installed. or you could just modify the url in your address bar to use http instead.


Try again - I can't download.
I think it is not because of sanctions against Russia.
I cant't download samles8.zip also from site http://marc2003.x10host.com/setup (http://marc2003.x10host.com/setup).
In the old year, everything was fine.
I used to raze browsers - the result is the same.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-07 15:59:45
I cant't download samles8.zip also from site http://marc2003.x10host.com/setup (http://marc2003.x10host.com/setup).


samples8 isn't hosted on that site. the link on that page points towards my dropbox account which is the same place where you're having problems with zeremy's file. perhaps it's dropbox who are blocking russia?? i'll think about mirroring the files on my webspace tomorrow - i can't do it now.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-01-08 04:59:27
marc2003

I download zeremy.txt now.
Thanks!
Title: WSH Panel Mod script discussion/help
Post by: elia_is_me on 2015-01-08 11:04:18
theophile has stopped developing wsh panel mod for years but his work still alive ... surprising....
and now someone has started a new project - a v8 engine panel, maybe it'll be funny.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-08 11:12:45
theophile has stopped developing wsh panel mod for years but his work still alive ...


theophile??? is that T.P Wang (http://www.hydrogenaud.io/forums/index.php?showuser=44175)

Quote
surprising....


not really. it's only 2 years since he stopped but plenty of people are using columns UI which is over 5 years old. some of ssenna (http://www.hydrogenaud.io/forums/index.php?showuser=50309)'s components (http://foo2k.chottu.net) haven't been updated since 2009/2010 either. yet they all still work fine.
Title: WSH Panel Mod script discussion/help
Post by: elia_is_me on 2015-01-08 12:21:27
Quote
theophile??? is that T.P Wang (http://www.hydrogenaud.io/forums/index.php?showuser=44175)

oh yes, and sorry i failed to mention it. it's said that he hasn't been developing windows app for a long time. maybe we should thank jensen & dreamxis that they decided to create a beautiful foobar profile with ssenna's elplaylist and pss and theo made their work(named Eiko) more complicated. it was in 2006, nearly 10 years from now...

Quote
not really. it's only 2 years since he stopped but plenty of people are using columns UI which is over 5 years old. some of ssenna (http://www.hydrogenaud.io/forums/index.php?showuser=50309)'s components (http://foo2k.chottu.net) haven't been updated since 2009/2010 either. yet they all still work fine.

i really admire ssenna's works... and am worried if one day his/her components won't be compatible with foobar2000, that ll be  great loss. nobody at the forum can get contact with him/her?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-01-08 21:23:34
i really admire ssenna's works... and am worried if one day his/her components won't be compatible with foobar2000, that ll be  great loss. nobody at the forum can get contact with him/her?


I was tried to contact ssena earlier, when foo_ui_biography.dll stopped to receive full biography from last.fm , but i never get an answer..
Don't know if he loose interest for this components?
But this will happen sooner or later, that some components die, if we don't have support team..
This plugins are essential for foobar i think, and more than one developer should work on this...
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-01-09 01:54:40
[...] But this will happen sooner or later, that some components die, if we don't have support team..
This plugins are essential for foobar i think, and more than one developer should work on this...


I've made plenty of noise on IRC about some of these components lack of maintenance and how they should have 'official' versions in future versions of foobar2000. Not just WSH but also things like Facets, TagBox, and others. Some should be genuine candidates for inclusion as stock items.

EDIT: Mainly so they do not die from lack of developer interest over time.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-09 12:36:00
anybody could develop/update WSH panel mod if they wanted to. it has a public domain license and the source code is available. unfortunately it seems the only people interested in the component don't have the c++ skills necessary to do that.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-10 11:24:18
My folder marc2003 look like this, it's not a problem ? I have older scripts because i don't want update for example "now playing", but i don't now if it's a problem or not


no, it shouldn't be a problem. that's why i rename files when there are major changes so all scripts should work side by side. i'd try and get rid what is using common6 though - that is seriously old. but i suppose if it's not using anything online then it'll be fine.

you can save a whopping 8kb by deleting that file named art. that has been obsolete for quite some time now.


I use common6 for "Now Playing" (artists images) because i don't want to change the layout of the frame and I do not know how to upload keeping available layout
Title: WSH Panel Mod script discussion/help
Post by: drm200 on 2015-01-11 13:12:17
I've noticed that when using VU Meter component jscript by Br3tt that I have a large amount of memory "leakage" ... When I start foobar it will use about 25 mb of memory ... but then its memory usage will grow over time to 30 mb .. 40 mb .. 70 mb ..100 mb.

I wasn't sure at first the cause of the problem and started eliminating panels in order to identify the source of the problem.  Eventually, I stripped all of my foobar panels down to only two:
  - Br3tt's wsh_playlist_2013_v0_0_8
  - Br3tt's VU Meter component 1.01

With the playlist panel only installed, I do not see the large growth in memory usage over time.  But immediately after installing the VU meter component (without any mods), I get the memory usage growth.  So it seems that the VU meter code is causing the memory usage growth.

I do not see any obvious changes to improve the code (but my skills are very limited) ... Is there a change in the code that can reclaim the "lost" memory?

Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-11 13:20:22
I have the "sox" folder in marc2003, it is better that I moves in foobar2000 (appdata)? Or I change the script and adds

var sox_exe = fb.ProfilePath + "marc2003\\sox\\sox.exe";

&

var ffmpeg_exe = fb.ProfilePath + "marc2003\\sox\\ffmpeg.exe";

Or I have to do differently?

Because I do not know if other scripts use that path or not ...

(http://image.noelshack.com/fichiers/2015/02/1420982367-sans-titre.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-11 14:01:02
you can edit those values and put sox/ffmpeg wherever you like.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-11 14:18:31
you can edit those values and put sox/ffmpeg wherever you like.


Okay only those 2 lines need edit ? And I edited as it should ?

var sox_exe = fb.ProfilePath + "marc2003\\sox\\sox.exe";
var ffmpeg_exe = fb.ProfilePath + "marc2003\\sox\\ffmpeg.exe";

Why i haven't Bio ? After it's all i have no problem ^^

Pastie of script : http://pastie.org/private/g2laf7wjyqrsesrv1k3uw (http://pastie.org/private/g2laf7wjyqrsesrv1k3uw)

(http://image.noelshack.com/fichiers/2015/02/1420985815-sans-titre.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-11 14:50:23
Okay only those 2 lines need edit ?


yes it's only those 2 lines. if it was any more, i would have told you. i don't expect you to be psychic.  the simplest check is to play a supported file. if the panel is blank then something is wrong. if you see a spectrogram image then it's working.

Quote
Why i haven't Bio ? After it's all i have no problem ^^


i'd try and get rid what is using common6 though - that is seriously old. but i suppose if it's not using anything online then it'll be fine.


bios are online so i suspect that is the problem. i'm not supporting scripts that old now. my latest now playing script works if you want to try that. if not, then remove it/use something else.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-11 15:55:23
I try the new script and same problem :

(http://image.noelshack.com/fichiers/2015/02/1420991710-sans-titre.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-11 18:55:39
can you see if any of these scripts work in another panel?

allmusic review
last.fm similar artists
last.fm & wikipedia biography
musicbrainz
news-reviews-blogs

i just want to see if any internet scripts are working on your machine. also, have a look in the foobar console for errors (view menu>Console).
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-11 19:48:36
can you see if any of these scripts work in another panel?

allmusic review
last.fm similar artists
last.fm & wikipedia biography
musicbrainz
news-reviews-blogs

i just want to see if any internet scripts are working on your machine. also, have a look in the foobar console for errors (view menu>Console).


allmusic review blank (no text, samples 8) EDIT: After works fine
last.fm similar artists works fine (samples8)
last.fm & wikipedia biography i have pictures but no bio (samples 8 & oldest)
musicbrainz works fine (samples8)
news-reviews-blogs works fine (samples8)

Pastie of console, maybe you can see any problems, if there are more than the ones I talk to you :

http://pastie.org/private/3jkpwcuxwzna4byob5xqqa (http://pastie.org/private/3jkpwcuxwzna4byob5xqqa)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-11 22:13:36
can you open your wsh_data folder in explorer and use the search box in the top right to look for

bio*.txt

are there any results and do they contain any text if you open them in notepad? also, what language are you using? i notice from your console you might be french based on your music folder name??? have you set the panel to use the french last.fm site? it should still work but you may get no results for less popular artists. obviously you can check this by looking at the artist page on the website.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-12 14:09:11
can you open your wsh_data folder in explorer and use the search box in the top right to look for

bio*.txt

are there any results and do they contain any text if you open them in notepad? also, what language are you using? i notice from your console you might be french based on your music folder name??? have you set the panel to use the french last.fm site? it should still work but you may get no results for less popular artists. obviously you can check this by looking at the artist page on the website.


That is, when in fact I do not have the choice of language in the script, some .txt are empty, but if I take the example of Lady Gaga that contains text in French, I still have nothing

(http://image.noelshack.com/fichiers/2015/03/1421071726-sans-titre.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-13 00:10:11
That is, when in fact I do not have the choice of language in the script


you do. from the filename i can see in your screenshot, you've selected the french site (www.lastfm.fr) from the available options.

anyway, it seems the download part is working so i can't really explain why it's not being displayed. perhaps the script doesn't like your default font? i can't think of anything else.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-13 08:54:42
That is, when in fact I do not have the choice of language in the script


you do. from the filename i can see in your screenshot, you've selected the french site (www.lastfm.fr) from the available options.

anyway, it seems the download part is working so i can't really explain why it's not being displayed. perhaps the script doesn't like your default font? i can't think of anything else.


My Font is Calibri, someone use this font and :

(http://image.noelshack.com/fichiers/2015/03/1421139227-z7orae3.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-13 16:31:56
Quote
(http://image.noelshack.com/fichiers/2015/02/1420991710-sans-titre.png)


having looked at that image again, perhaps the text area is too narrow? my script requires the text area be at least 100 pixels wide.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-14 18:21:10
Quote
(http://image.noelshack.com/fichiers/2015/02/1420991710-sans-titre.png)


having looked at that image again, perhaps the text area is too narrow? my script requires the text area be at least 100 pixels wide.


//setup text area for last.fm bio
var t = new text(20, 150, 100, 100);

Don't work ^^
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-14 19:08:18
the values set at the start don't stick - they are updated dynamically inside the on_size function for when the panel is resized. i think the default is something like the panel width divided by 3. if the panel is too narrow then you'll have the problem.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-14 20:09:54
I tried on another screen, it works well :

(http://image.noelshack.com/fichiers/2015/03/1421268341-sans-titre.png)

I can not seem to "expand" the black frame height

And then I'd like to change the frame size, but I do not have the arrow that allows me to change the window size

Is it that I could have the text in French on the old "script"?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-14 20:35:11
i give up. use foo_uie_biography instead.
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-14 20:47:29
I've edit too late^^
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-15 10:58:10
i've made the "new one" look like the old one. just paste this in a panel...

https://dl.dropboxusercontent.com/u/2280132...sh/temp/bad.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/bad.txt)
Title: WSH Panel Mod script discussion/help
Post by: escobar090 on 2015-01-15 15:33:56
Hello Everyone, I thought you guys could help me.


Im not totally sure if my question has to do with WSH but i'll give it a try.


See, I just flipped an old monitor to portrait and now my foobar skin displays the artworks like this.
(http://i.imgur.com/qqdHXYG.jpg)

How could I Make it fill the whole screen? or at least be centered?


The Skin, btw, is JAM v1.2 .


Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-15 18:23:32
to get any help here, you really need to post a bit of code you need help with, not vague details of some theme you're using. expecting someone to find, download, install and then pick apart a 3rd party's work is a bit much -especially when you don't even know what component it is. it could just as easily be panel stack splitter. what you're asking should be possible but i think you'd be better off asking the theme author.
Title: WSH Panel Mod script discussion/help
Post by: xska on 2015-01-15 19:22:25
The latest version seem to be crashing?

Code: [Select]
Scripting Engine Initialization Failed (Last.fm Playcount Sync by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

WSH Panel Mod (Last.fm Playcount Sync by marc2003): Parsing file "C:\Users\xs\AppData\Roaming\foobar2000\marc2003\common8.js"
Error: WSH Panel Mod (Last.fm Playcount Sync by marc2003): Microsoft JScript runtime error:
'undefined' is null or not an object
File: C:\Users\xs\AppData\Roaming\foobar2000\marc2003\common8.js
Ln: 1575, Col: 2
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-15 20:15:39
oh balls, that is my mistake. you'll have to download this fixed version manually because i can't access my dropbox account on the internet i'm using.

http://marc2003.x10host.com/common8.js (http://marc2003.x10host.com/common8.js)
Title: WSH Panel Mod script discussion/help
Post by: xska on 2015-01-15 20:18:29
Cheers, that fixed it. 
Title: WSH Panel Mod script discussion/help
Post by: WhistleChips on 2015-01-16 18:16:20
Hey Marc,

Thanks for all of your hard work and the great scripts.  Really makes FB2k more enjoyable!

Now a question... in the latest versions of your Last.fm Charts script, the 'Refresh' command is no longer on the right-click context menu.  Would it be possible to add it back, or better yet, is it possible to have the charts update automatically after each song change?

Perhaps I missed something.

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-17 00:57:36
sorry but i won't be making any changes to current behaviour.

if you want to see artist plays update in real time then use a combination of foo_playcount + foo_facets. just add a statistics column to an artist pane.
Title: WSH Panel Mod script discussion/help
Post by: WhistleChips on 2015-01-17 15:32:47
sorry but i won't be making any changes to current behaviour.

if you want to see artist plays update in real time then use a combination of foo_playcount + foo_facets. just add a statistics column to an artist pane.


I monkeyed with "last.fm charts.txt" a bit by incorporating items from "last.fm & wikipedia biography.txt" and got it updating the charts after each song change.  If anybody wants a live chart they can modify the latest version by:

changing line 7 to:
Code: [Select]
var p = new panel("Last.fm Charts", ["metadb", "remap"]);


insert this line below line 10:
Code: [Select]
p.item_focus_change();


insert this at line 27:
Code: [Select]
function on_metadb_changed() {
    li.metadb_changed();
}





Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-17 16:22:45
i've made the "new one" look like the old one. just paste this in a panel...

https://dl.dropboxusercontent.com/u/2280132...sh/temp/bad.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/bad.txt)


OH my god thank you it's PERFECT ! Just when double clic, Aw, crashed !  xD
Title: WSH Panel Mod script discussion/help
Post by: fuffi on 2015-01-18 02:04:20
Hi,
I got this error in foobar2000 v1.3.7:
Quote
Scripting Engine Initialization Failed (Discogs by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).

which -I guess- comes up, because the new "sample8.zip" file doesnt include a "discogs.txt" file.

I did an update from common7.js to common8.js and to all the scripts I use(d), but unfortunately, this one, isnt updateable?

Anyone any advice on how to use the script "discogs.txt"? Or is it not needed anymore and has to be replaced with some other script?

Console shows this:
Code: [Select]
[02:53:05] WSH Panel Mod (Last.fm Charts by marc2003): Parsing file "E:\foobar2000\marc2003\common8.js"
[02:53:05] WSH Panel Mod (Last.fm Charts by marc2003): initialized in 52 ms
[02:53:05] WSH Panel Mod (Autoplaylists by marc2003): Parsing file "E:\foobar2000\marc2003\common8.js"
[02:53:05] WSH Panel Mod (Autoplaylists by marc2003): initialized in 40 ms
[02:53:07] Filter Panel - Discogs: Label: initialised in 1.976 s
[02:53:07] WSH Panel Mod ({0CA26A59-6FE9-4B0A-9A8F-AB8AF7AAA4A1}): initialized in 1 ms
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): Parsing file "E:\foobar2000\marc2003\common8.js"
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): initialized in 50 ms
[02:53:07] Error: WSH Panel Mod (Discogs by marc2003): Parsing file "E:\foobar2000\marc2003\common7.js": Failed to load
[02:53:07] Error: WSH Panel Mod (Discogs by marc2003): Laufzeitfehler in Microsoft JScript:
'panel' ist undefiniert
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>
[02:53:07] WSH Panel Mod (Musicbrainz by marc2003): Parsing file "E:\foobar2000\marc2003\common8.js"
[02:53:07] WSH Panel Mod (Musicbrainz by marc2003): initialized in 25 ms
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): Parsing file "E:\foobar2000\marc2003\common8.js"
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): initialized in 13 ms
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): Parsing file "E:\foobar2000\marc2003\common8.js"
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): initialized in 11 ms
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): Parsing file "E:\foobar2000\marc2003\common8.js"
[02:53:07] WSH Panel Mod (Last.fm Similar Artists by marc2003): initialized in 12 ms
[02:53:08] User Interface initialized in: 0:02.509380
Title: WSH Panel Mod script discussion/help
Post by: firewater on 2015-01-18 05:01:35
Ohhhh, so you have your own thread! That explains not getting response on DA.

I'm running a theme (http://slowboyfast.deviantart.com/art/VERONiCA-2-502481907) that uses your star script, but instead of a 5 scale system I want to use 10 stars. I figured out how to add them on ELPlaylist, but not what part of the script I need to modify to change the 5 stars at the bottom for 10. I asked the guy that made the theme, but he said I should ask you since you made the script. This (http://pastebin.com/TUs0Eukf) is what appears when you right click > configure those 5 stars.

(http://i.imgur.com/bMJY393.jpg)
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-01-18 14:39:39
Bonjour tout le monde, de france :
" LAst-fm charts" and "similar artists" are down since update !!
What can i Do ?
thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-18 21:18:48
i can't update my dropbox so download the fixed file from here and save it in your marc2003 folder.

http://marc2003.x10host.com/common8.js (http://marc2003.x10host.com/common8.js)

@Drakebad, delete this line near the bottom on the panel script c.lbtn_dblck(x, y);

@fuffi, discogs no longer works because of changes they made to their webservices. musicbrainz does the same thing if you want to try it.

@firewater, i do respond to people on DA but you've made no attempt to contact me. i'll look at your problem in the week because i can't check your links now (censored internet!)
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-01-19 05:19:13
thanks Marc2003,
but i already done this update and paste common8.js , and "Lastfm charts" and "similar artist" only give white screen, "Now playing " works fine ....
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-01-19 06:27:31
!

thanks Marc2003,
but i already done this update and paste common8.js , and "Lastfm charts" and "similar artist" only give white screen, "Now playing " works fine ....

I delete old WHS data, and it's ok now , thanks for this great job !

Just one question, is it possible to have more than 50 artists in lastfm chart ?
thanks
Title: WSH Panel Mod script discussion/help
Post by: DrakeBAD on 2015-01-19 10:09:19
Thank you marc2003, now i have only :

function on_mouse_lbtn_dblclk(x, y) {
      if (th.lbtn_dblclk(x, y)) return;
}
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-01-19 15:13:09
marc2003,
Use your script that would take bio with last.fm, but there is a problem:
sometimes does not download bio, recorded an empty file: bio.www.lastfm.ru.txt
and that would be to upload a bio, you have to manually delete the file, and then downloaded bio. This is not often, but it happens !.
I would like to make a button pressed downloaded \ overwritten bio - tell me how to do so.
Title: WSH Panel Mod script discussion/help
Post by: fuffi on 2015-01-19 15:44:28
@fuffi, discogs no longer works because of changes they made to their webservices. musicbrainz does the same thing if you want to try it.

Thank you marc2003,
I tried the MB, but it only offers "Links" and "releases".

I cannot find a "similar artists", "Top Tracks", or "Top Albums" option here.

Where should I go or what do I need to change to use MB as a DG replacement with your Scripts? Now, its seems to be only a rudimental alternative, which I may fail to configure correctly.
(I also dl the common8.js you've linked above and it updated the file I downloaded the day before yesterday from your webpage, but with no success)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-19 16:07:44
@zsoft. downoad this and save it in your marc2003 folder. you should now have a refresh option on the right click menu. it only works in last.fm mode.

http://marc2003.x10host.com/common8.js (http://marc2003.x10host.com/common8.js)

@fuffi, discogs only ever showed releases which is why i suggested musicbrainz as an alternative. it looks like you've got them confused with last.fm similar artists which does contain all the other feeds you listed. make sure you have the common8.js linked directly above as i've had to set a new api key.

edit: if people have any problems with last.fm similar artists or charts displaying blank pages because of the api key changes, do the following:

browse wsh_data\charts and delete all files.
browse wsh_data and search for and delete all files named artist*.json (the star is a wildcard supported by windows explorer)
lastly, clear all temporary internet files in internet explorer.
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-01-19 16:21:12
Marc2003
Is it possible to have more than 50 artists in lastfm Charts ?
thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-19 16:28:30
it's now set to 100. use the download link above/instructions for clearing old files.
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-01-19 16:30:32
it's now set to 100. use the download link above/instructions for clearing old files.

Oh thanks !
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-01-19 17:16:22
I don't understand white page with the new common8.js !!!!!
Even after delete all data in WSH-data ....
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-01-19 17:29:44
@zsoft. downoad this and save it in your marc2003 folder. you should now have a refresh option on the right click menu. it only works in last.fm mode.

http://marc2003.x10host.com/common8.js (http://marc2003.x10host.com/common8.js)


Thank you.
Very handy feature!)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-19 17:50:27
I don't understand white page with the new common8.js !!!!!
Even after delete all data in WSH-data ....


which script/setting/artist? can you right click the panel>open containing folder and check the contents of the file it's pointing to.

depending on what you're trying to look at, there is no guarantee that you'll get results on everything. if it's last.fm charts, the one month track option does not work. this is a problem at last.fm's end.
Title: WSH Panel Mod script discussion/help
Post by: fuffi on 2015-01-19 18:49:55
@fuffi, discogs only ever showed releases which is why i suggested musicbrainz as an alternative. it looks like you've got them confused with last.fm similar artists which does contain all the other feeds you listed. make sure you have the common8.js linked directly above as i've had to set a new api key.


I'm sorry to bother u all again, I guess, I confuse things, but can somebody tell me, what script (or component?) is responsible for showing this:
  (http://www.bilder-hochladen.net/files/hcyg-3p-9b86.png) (http://www.bilder-hochladen.net/files/hcyg-3p-9b86-png-nb.html)
This is what i see, after right-clicking inside the WSH-Panel, which is configured in ColumnsUI.
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-01-19 19:30:56
I don't understand white page with the new common8.js !!!!!
Even after delete all data in WSH-data ....


which script/setting/artist? can you right click the panel>open containing folder and check the contents of the file it's pointing to.

depending on what you're trying to look at, there is no guarantee that you'll get results on everything. if it's last.fm charts, the one month track option does not work. this is a problem at last.fm's end.



It's oK now, all delete and reinstall.
Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-19 19:36:07
@fuffi, try reading the bit you quoted again. if that fails, i suggest getting your eyes tested.
Title: WSH Panel Mod script discussion/help
Post by: fuffi on 2015-01-19 19:59:39
@fuffi, try reading the bit you quoted again. if that fails, i suggest getting your eyes tested.

its rather understanding than eyes, but it workes again.  8-)

after deleting all files in the "wsh_data" and recognizing that "last.fm similar artists" is actually a file called "last.fm similar artists.txt", i understand now, that only the "discogs.txt" will not work, because of your writing. "last.fm similar artists.txt" will offer my mentioned features and it works without the "discogs.txt", which i thought was important for me.

so sorry for the whimsical me :-) and thank you for taking time and giving help outside the digital world.
Title: WSH Panel Mod script discussion/help
Post by: xska on 2015-01-19 21:33:20
Started getting this error recently:

Code: [Select]
Last.fm Playcount Sync: Contacting Last.fm.... 
Last.fm Playcount Sync: {"error":26,"message":"Suspended API key - Access for your account has been suspended, please contact Last.fm","links":[]}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-20 09:09:30
right click>Update script.

(files on dropbox have now been updated with the fix)
Title: WSH Panel Mod script discussion/help
Post by: trelain on 2015-01-25 17:57:02
Is there any way for a WSH to detect gaps in the track numbers within an Artist & Album?    This would be useful to detect incorrectly numbered tracks that could reveal an error in the whole file's tagging that occurred for whatever reason.  I'm picturing a process that for example would sort the library by Artist+Album+Tracknumber, then look for any numbering gaps and if found, display the 2 files with the gap in-between into a playlist for the user to evaluate for problems.  Or perhaps this is not possible?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-25 20:30:23
it's certainly possible. i might have a go at this sometime as it shouldn't be much more than a 10-20 lines of code.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-25 21:50:45
you can try this...

Code: [Select]
var album_tf = "%album artist%|%album%|%date%|%discnumber%";

//hack to create empty handle list
fb.CreatePlaylist(plman.PlaylistCount, "WSH SPAM");
var EMPTY = plman.GetPlaylistItems(plman.PlaylistCount - 1);
plman.RemovePlaylist(plman.PlaylistCount -1);

function on_mouse_lbtn_dblclk() {
    var items = plman.GetPlaylistItems(plman.ActivePlaylist);
    if (items.Count == 0) return;
    var new_items = EMPTY.Clone();
    var current_album = "", temp_album;
    var album_track = 1, track = 1;
    for (var i = 0; i < items.Count; i++) {
        temp_album = fb.TitleFormat(album_tf).EvalWithMetadb(items.item(i));
        if (temp_album != current_album) {
            current_album = temp_album;
            album_track = 1;
        }
        track = fb.TitleFormat("$num(%tracknumber%,0)").EvalWithMetadb(items.item(i));
        if (track != album_track) {
            if (i > 0) new_items.Add(items.item(i - 1));
            new_items.Add(items.item(i));
            album_track++;
        }
        album_track++;
    }
    if (new_items.Count > 0) {
        plman.CreatePlaylist(plman.PlaylistCount, "WSH suspicious items");
        plman.ActivePlaylist = plman.PlaylistCount - 1;
        plman.InsertPlaylistItems(plman.ActivePlaylist, 0, new_items);
    } else {
        fb.ShowPopupMessage("Everything seems ok!");
    }
}

it's just a blank white panel that you double click to run. it uses the active playlist so make sure it contains all your music and is sorted.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-25 23:11:52
@marc2003

Code: [Select]
//hack to create empty handle list
fb.CreatePlaylist(plman.PlaylistCount, "WSH SPAM");
var EMPTY = plman.GetPlaylistItems(plman.PlaylistCount - 1);
plman.RemovePlaylist(plman.PlaylistCount -1);

Here is an easiest way to create an empty handle list object:

Code: [Select]
var EMPTY = plman.GetPlaylistSelectedItems(-1);


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-25 23:20:23
ah, that's nicer. it means there is nothing left cluttering the playlist restore menu. thanks.
Title: WSH Panel Mod script discussion/help
Post by: trelain on 2015-01-26 00:11:04
Kinda works, although the results in the "WSH Suspicious Items" playlist shows the entry before the gap, and then every entry after the gap, but repeated, except the last one isn't repeated, weird.    So when the original playlist shows tracks numbered
1
2
3
4
5
7
7
8
9
10

with a gap between 5 and 7 (7 being accidentally repeated),  the resulting playlist shows

5
7
7
7
7
8
8
9
9
10

Thanks for whipping this up so quick, BTW...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-26 00:19:48
i must admit, my testing consisted solely of removing odd tracks from albums and then it worked...

it might be easier for me to mark the whole album as bad rather than trying to sort the differences between incorrectly numbered tracks. i'll post back when i've had a play.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-26 09:28:16
@trelain, try this.

Code: [Select]
var album_tf = "%album artist%|%album%|%date%|%discnumber%";
var EMPTY = plman.GetPlaylistSelectedItems(-1);

function on_mouse_lbtn_dblclk() {
    var items = plman.GetPlaylistItems(plman.ActivePlaylist);
    if (items.Count == 0) return;
    var current_album = "", temp_album, album_track , track, album_is_good = true;
    var album_tracks = bad_albums = EMPTY.clone();
    for (var i = 0; i < items.Count; i++) {
        temp_album = fb.TitleFormat(album_tf).EvalWithMetadb(items.item(i));
        if (temp_album != current_album) {
            if (!album_is_good && album_tracks.Count > 0) {
                bad_albums.AddRange(album_tracks);
                album_tracks.Dispose();
            }
            album_tracks = EMPTY.clone();
            album_is_good = true;
            current_album = temp_album;
            album_track = 1;
        }
        track = fb.TitleFormat("$num(%tracknumber%,0)").EvalWithMetadb(items.item(i));
        if (track != album_track) album_is_good = false;
        album_tracks.Add(items.item(i));
        album_track++;
    }
    if (bad_albums.Count > 0) {
        plman.CreatePlaylist(plman.PlaylistCount, "WSH suspicious items");
        plman.ActivePlaylist = plman.PlaylistCount - 1;
        plman.InsertPlaylistItems(plman.ActivePlaylist, 0, bad_albums);
    } else {
        fb.ShowPopupMessage("Everything seems ok!");
    }
    album_tracks.Dispose();
    bad_albums.Dispose();
}

if problems are detected with any track within an album, it sends the whole album to the playlist as it's much easier for me to do that.
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2015-01-26 11:26:10
Here's my final script , with current selected language in title , available downloaded languages on a second row and a fix in the get() function not to download
when json returns {artists: null}.


Nice seeing more sources for various infos, thanks.

You guys ever thought of doing requests?

Would love to see alternative, non-music, sources for infos (imdb, goodreads, soundtrackcollector, etc.), but don't have a clue how to do it myself. Some tutorial would be amazing as well.
Title: WSH Panel Mod script discussion/help
Post by: trelain on 2015-01-26 12:09:07
Mmm, now it appears to not be recognizing either the repeated track number '7' scenario I described above, or a gap caused by a missing file (removing #6, no dups), it's returning "Everything seems ok" for both conditions...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-26 12:44:16
it's working fine for me with both of those scenarios??? 

i've now edited to give a report at the end. this is what should happen:

example of duplicate track numbering (first number is generated by script, 2nd is actual value from tag)

Code: [Select]
-------------------------------------------------------------------
new album detected
HAIM|Days Are Gone|2013|1
1 => 1
2 => 2
3 => 3
4 => 4
5 => 5
6 => 6
7 => 6 (bad)
8 => 8
9 => 9
10 => 10
11 => 11
this album had mistmatched tracks. adding to playlist.

example of 1st track missing which throws off the matching for the entire album

Code: [Select]
-------------------------------------------------------------------
new album detected
Ivy|In The Clear|2005|?
1 => 2 (bad)
2 => 3 (bad)
3 => 4 (bad)
4 => 5 (bad)
5 => 6 (bad)
6 => 7 (bad)
7 => 8 (bad)
8 => 9 (bad)
9 => 10 (bad)
this album had mistmatched tracks. adding to playlist.

example of correctly tagged album

Code: [Select]
-------------------------------------------------------------------
new album detected
Abraham|On The Surface|2001|?
1 => 1
2 => 2
3 => 3
4 => 4
5 => 5
6 => 6
7 => 7
8 => 8
this album checked ok

updated code:

Code: [Select]
var album_tf = "%album artist%|%album%|%date%|%discnumber%";
var EMPTY = plman.GetPlaylistSelectedItems(-1);

function on_mouse_lbtn_dblclk() {
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
if (items.Count == 0) return;
var current_album = "", text = "", temp_album, album_track , track, album_is_good = true;
var album_tracks = bad_albums = EMPTY.clone();
for (var i = 0; i < items.Count; i++) {
temp_album = fb.TitleFormat(album_tf).EvalWithMetadb(items.item(i));
if (temp_album != current_album) {
if (!album_is_good) {
text += "this album had mistmatched tracks. adding to playlist.\n";
bad_albums.AddRange(album_tracks);
album_tracks.Dispose();
} else if (i > 0) {
text += "this album checked ok" + "\n";
}
text += "-------------------------------------------------------------------\n";
text += "new album detected\n";
text += temp_album + "\n";
album_tracks = EMPTY.clone();
album_is_good = true;
current_album = temp_album;
album_track = 1;
}
track = fb.TitleFormat("$num(%tracknumber%,0)").EvalWithMetadb(items.item(i));
if (track != album_track) album_is_good = false;
text += album_track + " => " + track + (track != album_track ? " (bad)" : "") + "\n";
album_tracks.Add(items.item(i));
album_track++;
}
if (bad_albums.Count > 0) {
plman.CreatePlaylist(plman.PlaylistCount, "WSH suspicious items");
plman.ActivePlaylist = plman.PlaylistCount - 1;
plman.InsertPlaylistItems(plman.ActivePlaylist, 0, bad_albums);
} else {
text = "everything seems ok!\n\n" + text;
}
fb.ShowPopupMessage(text);
album_tracks.Dispose();
bad_albums.Dispose();
}

edited so report shows even with no problems.
Title: WSH Panel Mod script discussion/help
Post by: trelain on 2015-01-26 13:50:25
That is better... with the change to unconditionally show the report, it does show the bad entry with the "seems ok" msg:

everything seems ok!

-------------------------------------------------------------------
new album detected
Stevie Wonder|Talking Book|1972|?
1 => 1
2 => 2
3 => 3
4 => 4
5 => 5
6 => 7 (bad)
7 => 7
8 => 8
9 => 9
10 => 10


However when the playlist contains multiple artists or even multiple albums for the same artist it is not working for me, even when they display properly sorted.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-26 15:11:49
That is better... with the change to unconditionally show the report, it does show the bad entry with the "seems ok" msg:


i cannot reproduce/explain that so i'm out of ideas. i didn't make any changes to the code in the previous script - i only added the reporting.

Quote
However when the playlist contains multiple artists or even multiple albums for the same artist it is not working for me, even when they display properly sorted.


how different albums are detected are defined by the title formatting on the very first line of the script. you can edit it if you like. multiple/various artists per album shouldn't matter so long as you have a consistent album artist across all tracks. if you don't then each track will probably get detected as a new album - which you'd see in the report at the end.
Title: WSH Panel Mod script discussion/help
Post by: Kougeru on 2015-01-26 20:25:49
I just started getting API issue today...came here and saw that you said to click "update script" Unfortunately it's not working for me.

" The script reports that the update file has not been found. It could be a temporary problem with dropbox but if this error persists then it is most likely due to support stopping for this version. Check the hydrogenaudio thread or the full zip for updates."

All my components are up-to-date if that's a potential issue. I had a lot of trouble getting this to work properly to begin (not good with scripts >.>) with so reinstalling the whole thing is not what I want to do if it's avoidable.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-26 21:32:04
if you don't want to upgrade scripts, you'll have to download this theme from deviantart to get a fixed file....

http://www.deviantart.com/art/yuck-foo-upd...-2015-466739797 (http://www.deviantart.com/art/yuck-foo-updated-19-01-2015-466739797)

with foobar closed, browse inside the zip\marc2003 folder and copy the file named common7.js. put this file inside your own marc2003 folder.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-26 22:32:16
Hi,

Here is JSPlaylist, my new jscript, available on my DA page here (http://fav.me/d8fiumu)

It's a playlist viewer and a little bit more ... i hope you'll enjoy it

(http://i.imgur.com/gkZfK1V.jpg)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-26 23:06:25
nice!!!!!!!!!! i left a few thoughts on your DA page. 
Title: WSH Panel Mod script discussion/help
Post by: trelain on 2015-01-26 23:43:08
Quote
However when the playlist contains multiple artists or even multiple albums for the same artist it is not working for me, even when they display properly sorted.


how different albums are detected are defined by the title formatting on the very first line of the script. you can edit it if you like. multiple/various artists per album shouldn't matter so long as you have a consistent album artist across all tracks. if you don't then each track will probably get detected as a new album - which you'd see in the report at the end.


Ok sorry, my problem was various %date% entries across a greatest hits album, when they should have just been just in the original release date and the one common release date of the greatest hits in all the %date% entries.    After that correction it works much better.    thank you.
Title: WSH Panel Mod script discussion/help
Post by: Kougeru on 2015-01-27 00:10:34
if you don't want to upgrade scripts, you'll have to download this theme from deviantart to get a fixed file....

http://www.deviantart.com/art/yuck-foo-upd...-2015-466739797 (http://www.deviantart.com/art/yuck-foo-updated-19-01-2015-466739797)

with foobar closed, browse inside the zip\marc2003 folder and copy the file named common7.js. put this file inside your own marc2003 folder.


It's not that I didn't WANT to upgrade the scripts, the "update scripts" button just isn't working. I'll try this solution though, thanks. I still love you. This project has been my hero since I found it a few years back.

edit: Still getting API suspended error. Maybe it's the real deal rather than just an error? How would I go about fixing this. THis is the only thing I use it for so I don't know why they would suspend it. Maybe I could delete it and make a new one?

edit:2.  Error gave me a link to dropbox but the link gave me a 403. dropbox's homepage is giving me 403 errors on 2 different computers and my phone (4g, not on router). Works sometimes though...guess they're having issues.
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-01-27 06:24:40
Hi,

Here is JSPlaylist, my new jscript, available on my DA page here (http://fav.me/d8fiumu)

It's a playlist viewer and a little bit more ... i hope you'll enjoy it


Liking the look of new script, Falstaff. Looking forward to tinkering with it.

Problem is, the script isn't loading for me. I get this error message in the console and I'm sure how to go about fixing it:

Code: [Select]
Error: WSH Panel Mod (JSPlaylist v1.0.0 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): JavaScript runtime error:
Unable to get property 'Name' of undefined or null reference
File: <main>
Ln: 2468, Col: 5
<source text only available at compile time>


The line in question is this:

Code: [Select]
var fname = g_font.Name;


My scripting knowledge is totally rudimentary but is this an error in a font lookup or something like that?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 08:37:13
yes, the component does have problems getting the name of some fonts. as it's no longer developed, script writers will have to handle the error themselves. this how i work around it in my own scripts.

Code: [Select]
try {
    var fname = g_font.Name;
} catch(e) {
    fb.trace("Unable to use your default font. Using Segoe UI instead.");
    var fname = "Segoe UI";
}
Title: WSH Panel Mod script discussion/help
Post by: kode54 on 2015-01-27 08:57:47
You may wish to take note of this question on StackOverflow regarding Wingdings/Webdings and other symbol fonts, and Unicode (http://stackoverflow.com/questions/7862569/wingdings-font-family-does-not-seem-to-work-on-firefox-and-opera).

Apparently, the "correct" way to access the characters in those fonts is to access the private use ranges, or instead hope you're mapping in a font with Unicode v7 symbols included, and just use the newly imported symbols directly.

A friend ran into this issue, because I gave him Apple's bundled copy of Wingdings 3, which only includes the symbols in the reserved range, and no legacy mapping in the ASCII range.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 09:42:21
^i don't know anything about wingdings/unicode but that error hucifer reported is specifically related to getting the default font from foobar itself. the component provides methods to get them. here's a bit more of the code....

Code: [Select]
    if (g_instancetype == 0) { //columns UI
        g_font = window.GetFontCUI(FontTypeCUI.items);
        g_font_headers = window.GetFontCUI(FontTypeCUI.labels);
    }; else if (g_instancetype == 1) { //default UI
        g_font = window.GetFontDUI(FontTypeDUI.playlists);
        g_font_headers = window.GetFontDUI(FontTypeDUI.tabs);
    };
    
    var fname = g_font.Name; //this throws an error if using a font like the one below


here's my original report in the component thread with an example font....

i'm not sure whether it's worth reporting bugs as T.P doesn't seem to be around these days. hope he's ok.

i've found a problem with getting the name from a font object.

Code: [Select]
var font = window.GetFontDUI(0);
var name = font.Name;


for the majority of people, the name is going Segoe UI if their font is left at the default. i imagine most standard fonts are fine as well. no problem there.

but today someone reported that the function fails with Small Fonts. you get this error in the console....

Unable to get value of the property 'Name': object is null or undefined

upon checking the font properties, i see this...

(https://dl.dropbox.com/u/22801321/2013/march/small%20fonts.png)

looks like the Title has multiple values stored internally but WSH panel mod can't handle it. for now i'm catching errors and defaulting to a standard font.

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-27 09:46:14
Thanks for all these informations, i wasn't aware of this font issue because i never encounter any problem.
I'll do some modifications to handle that issue and maybe replace windings font in next version.

Edit: done, v1.0.2 uploaded
Title: WSH Panel Mod script discussion/help
Post by: randomuser on 2015-01-27 12:02:57
i made 3 playback buttons (previous, play/pause, next) using SimpleThemedButton sample but cannot figure out how to add play/pause command with fb.play and fb.pause

and also i would like to decorate buttons with corresponding signs from guifx v2 font, so when track is playing it shows pause sign and when it is paused shows play sign. is it possible ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 12:34:59
the command is easy enough: fb.PlayOrPause();

displaying/updating the icon is possible but it's a lot more work. the whole sample really needs re-writing to account for different states.

if you don't mind using images, i have a pre-made script that already supports a play/pause button. there are notes in the panel on how to replace the images with your own if you don't like the default ones.

http://marc2003.x10host.com/playback-buttons (http://marc2003.x10host.com/playback-buttons)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 13:05:34
if you don't want to upgrade scripts, you'll have to download this theme from deviantart to get a fixed file....

http://www.deviantart.com/art/yuck-foo-upd...-2015-466739797 (http://www.deviantart.com/art/yuck-foo-updated-19-01-2015-466739797)

with foobar closed, browse inside the zip\marc2003 folder and copy the file named common7.js. put this file inside your own marc2003 folder.


It's not that I didn't WANT to upgrade the scripts, the "update scripts" button just isn't working. I'll try this solution though, thanks. I still love you. This project has been my hero since I found it a few years back.

edit: Still getting API suspended error. Maybe it's the real deal rather than just an error? How would I go about fixing this. THis is the only thing I use it for so I don't know why they would suspend it. Maybe I could delete it and make a new one?

edit:2.  Error gave me a link to dropbox but the link gave me a 403. dropbox's homepage is giving me 403 errors on 2 different computers and my phone (4g, not on router). Works sometimes though...guess they're having issues.


just noticed i hadn't replied to this... sorry.

and sorry for the confusion about upgrading. the scripts you're using are too old for the update script option to work in the panel. i'm no longer supporting them - the one exception is that i did put a fixed API key in the deviant art file i detailed above. i double checked and it's still working for me now. can you just double check your last.fm scripts are using common7.js? right click the panel>configure and you'll see this on line2: // @import "%fb2k_profile_path%marc2003\common7.js"

if you want my latest scripts that update from the menu then you'll need to download the full updated set: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)

or if you're using last.fm playcount sync, then you'll want this. https://dl.dropboxusercontent.com/u/2280132...ount%20sync.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/playcount%20sync.zip)

just extract the marc2003 folder into your foobar profile (overwrite files if prompted) and then replace the scripts in the panels with the ones included inside the zip.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-01-27 13:17:26
@Falstaff

It seems the font issue is not fully fixed. I get crashes on line 2476: g_fsize = g_font.Size;

This occurs when using one of the problematical fonts, e.g. MS Serif (tested at 120dpi), as the object doesn't exist.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-27 13:30:09
@WilB

i've just tested .Name, not .Size and .Style properties, my bad, i'll fix it immediatly.

Edit: fixed: v1.0.3 uploaded, should fixe definitivly the problem with Fon object
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-01-27 14:40:45
@WilB

i've just tested .Name, not .Size and .Style properties, my bad, i'll fix it immediatly.

Edit: fixed: v1.0.3 uploaded, should fixe definitivly the problem with Fon object


Success! The script loads fine now despite me using a non standard font.

Thanks
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-27 14:45:54
Good news
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 15:21:15
^i see you've updated the playlist manager so you can right click anywhere to create a new playlist. thanks for that.

i have a feature request and that's for the F2 key to be supported in the playlist manager so the highlighted playlist name becomes editable. pressing F2 to rename is pretty standard behaviour across all windows apps.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-27 15:29:09
^ why not  ... it's added to my todo list

EDIT: added in v1.0.4 (just uploaded because still bad uses of g_font.Style in WSHplaylistmanager.js file ... so it can't wait!)
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-01-27 16:03:38
Falstaff,
Thank you for the script !, Beauty)
have a few questions:
the first question:
how to make what mood he worked with .cue (if album .cue. Do not put heart mood) ?

the second question:
I can not deal with the artist art.
I have is the script of "marc2003", art download with a lastfm in
"C:\Program Files (x86)\foobar2000\wsh_data\artists\%artist%" - default 'folder ...
how to make what your script took art from this folder?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 16:14:34
you should configure the main foobar album art preferences for that. file>preferences>display>album art>artist tab. i use...

d:\foobar2000\wsh_data\artists\%artist%\*.*

you may need to use single quotes around the (x86) in yours because () are special characters in foobar title formatting.
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-01-27 16:19:59
you should configure the main foobar album art preferences for that. file>preferences>display>album art>artist tab. i use...

d:\foobar2000\wsh_data\artists\%artist%\*.*

you may need to use single quotes around the (x86) in yours because () are special characters in foobar title formatting.


C:\Program Files '('x86')'\foobar2000\wsh_data\artists\%artist%\*.* - work, thx
Title: WSH Panel Mod script discussion/help
Post by: Kougeru on 2015-01-27 16:46:55
Thanks, marc2003. I don't know why you do what you do but I'd go crazy doing this. the Common8 file and script seems to have resolved my issue. Much appreciated as always.

Oh, and just to confirm, I did get the fix from DA....but apparently I put it on the wrong harddrive. I had Foobar portable installed on my D drive a few years ago but last year I did Standard install on C and I guess yesterday I forgot about that and put the fix on the D drive instead of C. I imagine it probably would've worked and I feel like an idiot. Oh well, updated scripts ftw anyway. Thank you and sorry for your taking up your time.
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-01-27 17:42:45
So I've been playing around with the latest version for a hour or so now, Falstaff.

I really like the integrated settings panel - very cool! However I do kinda miss the old options dialog from your older playlist scripts which allowed for forcing certain font colours etc.. As a feature request, would it be possible to add more customisation options to the Appearance tab in the settings panel in future?

On a second point, I'm having some trouble trying to adjust certain font colours. What I want to do is basically swap the colours for the group header text (so the normal header is grey and the header containing the currently playing track is orange in the screenshot below):

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-27 18:35:06
I really like the integrated settings panel - very cool! However I do kinda miss the old options dialog from your older playlist scripts which allowed for forcing certain font colours etc..

custom colors for the panel are still present in window Properties, just hold Shift key right clicking on a toolbar to see Properties entry in the context menu !

As a feature request, would it be possible to add more customisation options to the Appearance tab in the settings panel in future?

more customization directly in the differents tabs of my settings is planned

On a second point, I'm having some trouble trying to adjust certain font colours. What I want to do is basically swap the colours for the group header text (so the normal header is grey and the header containing the currently playing track is orange in the screenshot below):
I've added the blues rectangles just to emphasize what i mean.
I've done some tweaking around in the WSHplaylist.js and jsplaylist main script.txt but haven't been able to get it working properly. Would you mind pointing me in the right direction?


Colors are to change in foobar2000 Preferences > Display > xxxxxUI > Colors & Font

what is you interface, DUI or CUI ?

in DUI, the color text for group header where the track is playing is the Highlight color and the non-playing other group header text color is the Selection color,
==> change these two colors to do what you want, it's that simple!

in CUI, because there is more colors in settings, there is nuances:
the color of the now playing group header is the"Custom active item frame" color (the last one at bottom of the Custom  color Mode)
and the other txt color for default group headers is "background" "selected Item" color.

HTH
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-27 18:44:48
how to make what mood he worked with .cue (if album .cue. Do not put heart mood) ?


i never use .cue, i have to get one to test and give you an answer if it's possible to do... bu as far as i remeber .cue is a description text of the tracks (start point, end point,  tags ? ...) because the whole album is only a single file, i am right ? ...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 18:53:26
^you cannot write custom values like mood to a cuesheet. it only supports basic metadata like artist, title etc.

on another subject, i just noticed this in my console...

Code: [Select]
--- WSH Statistics --- 
--- Queued for track: "D:\Music\Albums\path to track.mp3


i have stats switched off so there shouldn't be any message??
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-27 19:03:22
i have stats switched off so there shouldn't be any message??


yes and no ... stats info is queued even if stats are off, because if you decide to turn stats ON after the playing track has reached the 50% of playtime, stats for the playing track will be written on track's ending (clever no ? .. ok ====>[]  )
just retain that track is queue for stats but it's unqueued only if stats are ON
but to avoid confusion i agree that i should not display this when stats are OFF (just the display because as explained above, stats info is queued, just in case ...)

Edit: fix done for next release ...
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-01-27 19:04:06
custom colors for the panel are still present in window Properties, just hold Shift key right clicking on a toolbar to see Properties entry in the context menu !


Aha! That was the problem. My old custom colours from your 2013 WSHplaylist script were still in there and overriding the CUI colour settings. Fixed it now.

Thanks again
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-27 19:09:38
Edit: fix done for next release ...


thanks for the speedy reply and thanks for adding that F2 feature earlier.
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2015-01-28 01:02:41
Falstaff, thank you for great playlist script. It looks very cool and highly customizable. I will definitely use it with my DUI setup.

Some minor problems and feature requests:

How can I use custom background color? I want background image to blend with black color without changing main background colour in DUI settings. I tried to enter value "0,0,0" to "CUSTOM COLOR BACKGROUND NORMAL" field in window Properties. It didn't work: background image became clean without any alpha blending. What exactly should I enter in that field?

Crash after click on Title column in header toolbar to sort (10k+ tracks in playlist). (doesn't matter for me since I always turn header off).

Strange white line on top of playlist after turning off both Active Playlist Information and Toolbar Header.

feature request: Custom font colors for each column would be nice.
Or better something like support of $rgb(xxx,xxx,xxx) in title format field (like in esplaylist) to be able to have different font colors even in single column or in group header.

feature request: for those who have multiple artist images for each artist: option to randomly choose one of them every time, not the same one every time.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-01-28 07:00:06
Falstaff,

I found a little bug:
If I specify the default path  ".\wsh_br3tt\jsplaylist\images\default.jpg" wallpaper is not displayed.
When I specify an absolute path "c:\Users\name\AppData\Roaming\foobar2000\wsh_br3tt\jsplaylist\images\default.jpg"  - it's all right.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 07:51:21
How can I use custom background color? I want background image to blend with black color without changing main background colour in DUI settings. I tried to enter value "0,0,0" to "CUSTOM COLOR BACKGROUND NORMAL" field in window Properties. It didn't work: background image became clean without any alpha blending. What exactly should I enter in that field?

in Properties like you found it but you have to enter:  RGB(0,0,0);  if you wnt black

Crash after click on Title column in header toolbar to sort (10k+ tracks in playlist). (doesn't matter for me since I always turn header off).

please check the console on crash to gimme the error informations to help me to fix the bug ! i count on you, thanx

Strange white line on top of playlist after turning off both Active Playlist Information and Toolbar Header.

i need a screenshot to see what you mean because Yes, ther is a thin line when columns headerbar is hidden but it's not white normaly.

feature request: Custom font colors for each column would be nice.
Or better something like support of $rgb(xxx,xxx,xxx) in title format field (like in esplaylist) to be able to have different font colors even in single column or in group header.

already on my todo liste  will take place in settings, tab 'Columns' asap

feature request: for those who have multiple artist images for each artist: option to randomly choose one of them every time, not the same one every time.

i don't think i'll add this feature because artist images are set in foobar2000 preferences and if a random is to set, this should be there and not coded in a wsh script.

If I specify the default path  ".\wsh_br3tt\jsplaylist\images\default.jpg" wallpaper is not displayed.
When I specify an absolute path "c:\Users\name\AppData\Roaming\foobar2000\wsh_br3tt\jsplaylist\images\default.jpg"  - it's all right.


i will check that asap and fix it indeed, thanx for reporting bugs, with 11600 line of code, i may have some mistakes

Title: WSH Panel Mod script discussion/help
Post by: Reith on 2015-01-28 08:01:37
if you don't want to upgrade scripts, you'll have to download this theme from deviantart to get a fixed file....

http://www.deviantart.com/art/yuck-foo-upd...-2015-466739797 (http://www.deviantart.com/art/yuck-foo-updated-19-01-2015-466739797)

with foobar closed, browse inside the zip\marc2003 folder and copy the file named common7.js. put this file inside your own marc2003 folder.

Shouldn't the first line of the changelog on DA be 19/01/2015?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 09:18:18
Falstaff,

I found a little bug:
If I specify the default path  ".\wsh_br3tt\jsplaylist\images\default.jpg" wallpaper is not displayed.
When I specify an absolute path "c:\Users\name\AppData\Roaming\foobar2000\wsh_br3tt\jsplaylist\images\default.jpg"  - it's all right.


nope, both works, check your path again. Be careful of that wallpaper only display on track's playing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 10:26:43
Strange white line on top of playlist after turning off both Active Playlist Information and Toolbar Header.

i need a screenshot to see what you mean because Yes, ther is a thin line when columns headerbar is hidden but it's not white normaly.


i see the same issue....

https://drive.google.com/file/d/0B6f0H8likO...iew?usp=sharing (https://drive.google.com/file/d/0B6f0H8likO9_dWV1MGNYMkFxbGM/view?usp=sharing)

but i can hide it by using a negative y value with panel stack splitter.

Shouldn't the first line of the changelog on DA be 19/01/2015?


erm.... yes. thanks for spotting.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-01-28 10:48:58
Falstaff,

I found a little bug:
If I specify the default path  ".\wsh_br3tt\jsplaylist\images\default.jpg" wallpaper is not displayed.
When I specify an absolute path "c:\Users\name\AppData\Roaming\foobar2000\wsh_br3tt\jsplaylist\images\default.jpg"  - it's all right.


nope, both works, check your path again. Be careful of that wallpaper only display on track's playing.


When folder wsh_br3tt located only in "c:\Users\name\AppData\Roaming\foobar2000" default path  ".\wsh_br3tt\jsplaylist\images\default.jpg" not working.
Now I copy (not move) folder wsh_br3tt and all subfolders to "c:\Program Files (x86)\foobar2000\" -  it's all right.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 11:08:23
@pIv

sorry my bad, i am on a portable installation so relative path is fine for me, but on a standard install, the profile folder is not the same as the program folder, so .\wsh_br3tt\... doesn't exist there, it's normal and not a bug, the reference folder when you use relative path is the program folder.

use full path to fix it
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 11:11:12
i see the same issue....
https://drive.google.com/file/d/0B6f0H8likO...iew?usp=sharing (https://drive.google.com/file/d/0B6f0H8likO9_dWV1MGNYMkFxbGM/view?usp=sharing)
but i can hide it by using a negative y value with panel stack splitter.


thanks, i'll fix it in next version.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 11:17:43
@firewater, this is the script you can use for 10 rating stars - obviously it writes to file tags as it cannot use foo_playcount.

https://dl.dropboxusercontent.com/u/2280132...om%20rating.txt (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/custom%20rating.txt)

you may want to edit the image paths right at the end. also, can change the background colour on the first line of the on_paint function. in place of utils.GetSysColor(15), you can use any RGB() function you like - or if you enable psuedo-transparency, you can delete the line entirely.
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2015-01-28 12:21:35
How can I use custom background color? I want background image to blend with black color without changing main background colour in DUI settings. I tried to enter value "0,0,0" to "CUSTOM COLOR BACKGROUND NORMAL" field in window Properties. It didn't work: background image became clean without any alpha blending. What exactly should I enter in that field?

in Properties like you found it but you have to enter:  RGB(0,0,0);  if you wnt black

Thank you. It works now 

Crash after click on Title column in header toolbar to sort (10k+ tracks in playlist). (doesn't matter for me since I always turn header off).

please check the console on crash to gimme the error informations to help me to fix the bug ! i count on you, thanx


Error: WSH Panel Mod (JSPlaylist v1.0.5 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) JavaScript runtime error:
Unable to get property 'w' of undefined or null reference
File: C:\foobar2000\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 293, Col: 13
<source text only available at compile time>

Edit: crashes with same error after click on any sorting column, not just Title
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 13:01:00
@falstaff, i have another feature request and that's for the DELETE key to work on the active playlist when the playlist manager is open. currently, pressing that key removes the selected item from the playlist.

thanks for the updates so far. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 14:30:18
possible bug report...when changing the grouping settings in the preferences, the playlist doesn't refresh with the changes. i actually had to reload the panel for the change to take effect.

edit: if you want a quick example, add an album with multiple discs. now change the group pattern between %album% and %album%|%discnumber%. i think the changes should apply when you close the settings but they don't.
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2015-01-28 14:36:39
Edit: crashes with same error after click on any sorting column, not just Title


Edit: only happens with autoplaylists, no matter how much tracks
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 14:59:40
Edit: only happens with autoplaylists, no matter how much tracks


that's an important information ! but i've just uploaded v1.0.6 with some little mods that i expect it fixes your problem, but nothing revelant with autoplaylist  so, test v1.0.6 but problem should always be there, but tell me please

is this autoplaylist has 'force sorted' option ticked ?? because trying to sort an autoplaylist with a forced sort is non sense but i'm not sure i've tested something around that ...

*waits for feedback*
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 15:06:50
possible bug report...when changing the grouping settings in the preferences, the playlist doesn't refresh with the changes. i actually had to reload the panel for the change to take effect.

edit: if you want a quick example, add an album with multiple discs. now change the group pattern between %album% and %album%|%discnumber%. i think the changes should apply when you close the settings but they don't.


it's not a bug. It doesn't work like you think.
The Groups tab in settings allow just to define groups pattern and TF fields linked to, but it doesn't affect the pattern selected in the listbox. listbox is just present to navigate between the different patterns
To use a group by pattern, you have to go back to the playlist and use the context menu on the headerbar and select the pattern you want to.

that's how it's work for now.

NOW, maybe using the settings groups tab to select the active pattern (listbox index) is better ... i'have to think about it. If other people have an opinion, i hope they will give it
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 15:15:15
ok, thanks for the explanation. as i have column headers turned off, it's a bit clumsy to get there.

edit: i'll just look at your menu code and implement something myself. you can forget i mentioned it.

another edit: this is a feature suggestion for your grouping menu - currently you have to go down 2 sub menus to get to the group presets. i'd get rid of the group by menu and put them a level up with an off option.

before:

Code: [Select]
enabled
group by
            preset 1
            preset 2
--------------
show cover
etc


after

Code: [Select]
preset 1
preset 2
off
---------------
show cover
etc
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-01-28 15:24:44
marc2003: I use a couple of "last.fm similar artists" scripts that I modified a long time ago, they are actually still using common4.js.

I just migrated and use the new version of "now playing". It would be nice to have the json files also appear with the images in the wsh_data folder instead of in the wsh_lastfm with strange names.

I imagine it's not just to copy/paste something in order to get them named in the way?

I still want to use my old modified scripts as I like having a couple of extra links for every entry in the list.
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2015-01-28 15:28:21
Edit: only happens with autoplaylists, no matter how much tracks


that's an important information ! but i've just uploaded v1.0.6 with some little mods that i expect it fixes your problem, but nothing revelant with autoplaylist  so, test v1.0.6 but problem should always be there, but tell me please

is this autoplaylist has 'force sorted' option ticked ?? because trying to sort an autoplaylist with a forced sort is non sense but i'm not sure i've tested something around that ...

*waits for feedback*


yeah. You absolutely right. All my autoplaylists have force-sorted option enabled.  My bad for not thinking of it right away.
btw, in the new version it doesn't crash - nothing changes when I try to sort it 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 15:36:48
@sylla, if you post your mods, i can probably show you how to port them over to the new scripts. if you make the changes in your panel script, none of the changes i make to my common file will change things in future.

my current internet is heavily restricted but if you use google drive, i can look at it today. all other file hosts are blocked so you'd have to wait a day or 2 until i can access those.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-01-28 15:52:16
@sylla, if you post your mods, i can probably show you how to port them over to the new scripts. if you make the changes in your panel script, none of the changes i make to my common file will change things in future.

my current internet is heavily restricted but if you use google drive, i can look at it today. all other file hosts are blocked so you'd have to wait a day or 2 until i can access those.

I don't use google drive... But it's just ~300 lines, can't I just PM it in a codebox? I haven't changed anything in the old common4 as far as I remember.

It's probably done real ugly, and I don't remember exactly what I changed in the code. But I added an extra icon to the left and changed the links so that a click in the list entry makes an autoplaylist, and then I have two links, one to lastfm and one to a torrent site.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 15:56:24
ok, send a PM. i usually have them turned off but i'll make a temporary exception.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 16:20:49
another edit: this is a feature suggestion for your grouping menu - currently you have to go down 2 sub menus to get to the group presets. i'd get rid of the group by menu and put them a level up with an off option.

before:

Code: [Select]
enabled
group by
            preset 1
            preset 2
--------------
show cover
etc


after

Code: [Select]
preset 1
preset 2
off
---------------
show cover
etc


i prefer the default one
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2015-01-28 16:32:56
Falstaff, some more issues and suggestions:

Typing search only works for artists, it doesn't find tracks by title or albums (feature itself looks brilliant tho)

suggestion: middle mouse button for queuing maybe?

suggestion: hotkey for "Show Now Playing Track" feature?

suggestion: option to show default wallpaper even when nothing is playing

just question: TAB, ALT hotkeys and typing search only work after selecting any track inside playlist. Is it possible for them to always work? (DUI)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 16:48:08
i prefer the default one


oh well, it was worth a try.

any response to this earlier post?

@falstaff, i have another feature request and that's for the DELETE key to work on the active playlist when the playlist manager is open. currently, pressing that key removes the selected item from the playlist.


@sylla, import the new common8 version of the last.fm similar artists script into your panel.

add this as the first line of code....

Code: [Select]
var img = gdi.Image(fb.ProfilePath + "marc2003\\images\\auto.ico");


then replace the whole on_paint function with this...

Code: [Select]
function on_paint(gr) {
    p.draw_background(gr);
    p.left_text(gr, li.header_text(), p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
    gr.DrawLine(5, 29, p.w - 5, 29, 1, p.textcolour_hl & 0x45ffffff);
    li.text_x = li.lastfm_mode == 0 ? 20 : 0;
    for (var i = 0; i < Math.min(li.items, li.rows); i++) {
        if (li.lastfm_mode == 0) p.draw_image(gr, img, li.x, li.y + 16 + (i * li.row_height), 16, 16)
        p.left_text(gr, li.names[i + li.offset], p.list_font, p.textcolour, li.x + li.text_x, li.y + 15 + (i * li.row_height), li.text_width, li.row_height);
    }
}


lastly, replace the whole on_mouse_lbtn_up function with this..

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    if (li.in_range && x > li.x && x < li.x + 20) p.browser("https://www.google.co.uk/search?q=" + encodeURIComponent(li.names[li.index]));
    else li.lbtn_up(x, y);
}


you can replace the URL with your own naughty code. the button is clickable and you can change what happens when you click on the text by using the right click menu. the options are to open Last.fm or create an autoplaylist.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-01-28 17:23:42
Very helpful post
Thanks, I followed your instructions and it works. I will try to figure out some things myself and maybe post again if I can't work it out.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-01-28 20:38:05
Falstaff - Getting an overflow error. Hard to reproduce but here is what shows up in console.

Error: WSH Panel Mod (JSPlaylist v1.0.4 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error: Overflow

File: C:\Users\***\Desktop\foobar2000\wsh_br3tt\jsplaylist\js\WSHheaderbar.js

Ln: 162, Col: 13


This happens often enough to make me think it needs looking into.
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-01-28 21:16:02
prompt me how to add a menu option:
Save All Playlists?

just save one selected playlist is clear: fb.SavePlaylist ();

In the "Playlist switcher" there is an option "Save All as...".
as add to my "wsh script", menu option "Save All as..."?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-28 21:22:59
Code: [Select]
fb.RunMainMenuCommand("File/Save all playlists...");



Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-28 22:10:32
Falstaff - Getting an overflow error. Hard to reproduce but here is what shows up in console.

Error: WSH Panel Mod (JSPlaylist v1.0.4 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error: Overflow

File: C:\Users\***\Desktop\foobar2000\wsh_br3tt\jsplaylist\js\WSHheaderbar.js

Ln: 162, Col: 13

This happens often enough to make me think it needs looking into.


thanx for reporting, it should be fixed with the fresh v1.0.7 just uploaded, tell me more asap please
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-01-29 04:12:47
JSPlaylist v.107


Great work - very exciting!

One thing I'm having trouble with - my existing title formatting used to group Various Artists no longer works. (header 1 left)

such as:

$if($strstr(%album artist%,Various Artists),Various Artists,%artist%)
or
$if($strcmp($meta(album artist,0),Various Artists),Various Artists,%artist%)

instead every track is individually listed instead of grouped?
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-01-29 05:39:36
Falstaff

This solved problem of default wallpaper:

line 334
wallpaperpath: window.GetProperty("CUSTOM Default Wallpaper P",".\\wsh_br3tt\\jsplaylist\\images\\default.jpg"),

replace to


wallpaperpath: window.GetProperty("CUSTOM Default Wallpaper Path", fb.ProfilePath+"\\wsh_br3tt\\jsplaylist\\images\\default.jpg"),


I check this version on portable and user_profiles_enabled configurations.
No need in absolute path more!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-29 07:34:39
JSPlaylist v.107


Great work - very exciting!

One thing I'm having trouble with - my existing title formatting used to group Various Artists no longer works. (header 1 left)

such as:

$if($strstr(%album artist%,Various Artists),Various Artists,%artist%)
or
$if($strcmp($meta(album artist,0),Various Artists),Various Artists,%artist%)

instead every track is individually listed instead of grouped?


you are not clear for me ...
1) you tell me that the titleformat for the text header 1 left is not working ? i've tested it it works, but why testing if %album artist% = 'Various Artist' to display %album artist% else %artist% ??? the %album artist% TAG already to that alone ! just put %album artist% and if its is not set (like 'Various Artists or VA or ...) then it's %artist% that is used

2) then you say that every track of your VA album is not trouped ! That point has link at all with the TF header 1,2,3,or4, but with GroupBy Title format field and of course, by that fact that all your tracks of the VA album have something like 'Various Artists' in the TAG %album Artist%

(http://i.imgur.com/bUEzH1W.png)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-29 07:37:39
Falstaff

This solved problem of default wallpaper:

line 334
wallpaperpath: window.GetProperty("CUSTOM Default Wallpaper P",".\\wsh_br3tt\\jsplaylist\\images\\default.jpg"),

replace to


wallpaperpath: window.GetProperty("CUSTOM Default Wallpaper Path", fb.ProfilePath+"\\wsh_br3tt\\jsplaylist\\images\\default.jpg"),


I check this version on portable and user_profiles_enabled configurations.
No need in absolute path more!


sure this work, but i'd never said i want always use a relative path and this mod don't allow me or anyboby else to use an absolute path anymore. So i prefer keeping the actual way which allows both
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-01-29 12:32:15
why testing if %album artist% = 'Various Artist' to display %album artist% else %artist% ???


I use %album artist% a lot, not only for Various Artists, that is why I also need a conditional check - I only want them grouped when "Various Artists" exists.

so maybe $strstr or $strcmp don't work with your panel?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-29 12:46:53
^of course $functions work. perhaps you're not understanding the fact that the display settings are completely independent of the title formatting used to actually group the tracks. this is different if you're used to being forced to group by what you see in other playlist viewers.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-01-29 12:58:48
this is different if you're used to being forced to group by what you see in other playlist viewers.


thanks Marc,

If I'm understanding you correctly, the grouping logic of the conditional is not happening before the actual display, so individual tracks still get displayed?

any idea if there would be an alternate technique to achieve something similar to what I'm trying to do with either of these?

$if($strstr(%album artist%,Various Artists),Various Artists,%artist%)
or
$if($strcmp($meta(album artist,0),Various Artists),Various Artists,%artist%)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-29 13:33:11
your grouping code needs to go in the Title Format box, not in any of of the Header dialogs. also, be aware that changes made here are not applied instantly. you have to right click the column headers and re-select the current grouping pattern for the changes to take effect.

edit: btw, if you think making these changes and then have to exit the settings panel and right clicking the columns header to re-apply the group is too much like hard work(!), the please add your voice to mine and maybe falstaff will add something in the settings panel???

NOW, maybe using the settings groups tab to select the active pattern (listbox index) is better ... i'have to think about it. If other people have an opinion, i hope they will give it
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-29 13:33:58
... and it would be better to use $stricmp (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.24stricmp.28s1.2Cs2.29) (case -insensitive) than $strcmp
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-01-29 13:46:06
your grouping code needs to go in the Title Format box, not in any of of the Header dialogs. also, be aware that changes made here are not applied instantly. you have to right click the column headers and re-select the current grouping pattern for the changes to take effect.


[head-slap] gotcha - of course; that's what I get for playing with this stuff early before I go to work.

 

thank you both!

Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-01-29 17:09:50
marc2003: I'm trying to change a few things. It goes slowly, but now at least my paint function is as I want it. It looks like this, so I'm getting three icons for all but one lastfm_mode, which gets two :
Code: [Select]
function on_paint(gr) {
    p.draw_background(gr);
    p.left_text(gr, li.header_text(), p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 24);
    gr.DrawLine(5, 29, p.w - 5, 29, 1, p.textcolour_hl & 0x45ffffff);
    li.text_x = li.lastfm_mode == 1 ? 40 : 60;
     
  for(var i = 0; i < Math.min(li.items, li.rows); i++) {
        p.draw_image(gr, img, li.x, li.y + 16 + (i * li.row_height), 16, 16)
        p.draw_image(gr, img2, li.x, li.y + 16 + (i * li.row_height), 56, 16)
        if  (li.lastfm_mode == 1);
        else p.draw_image(gr, img3, li.x, li.y + 16 + (i * li.row_height), 96, 16);
        p.left_text(gr, li.names[i + li.offset], p.list_font, p.textcolour, li.x + li.text_x, li.y + 15 + (i * li.row_height), li.text_width, li.row_height);
    }
    }
If you'd like to help with some of these points it'd be appreciated.

1. How do I get a clean "+" in the adress bar instead of "%2B" when I try to replace spaces? I am trying to imitate a search, but it searches for pluses instead of spaces as it stands %2B instead of + in the adress bar. I'm trying with .replace(/ /g, '+')
2. I'd like to use the last.fm link function on a button instead. I figured out a way, but It'd be much cleaner if I could point to what you already use for clicking the text. As I expected, moving "else li.lbtn_up(x, y);" didn't work
3. Is it still possible to open spotify through this? I tried to look after the code in my old scripts, but I had deleted that as I didn't use it then 
4. You helped me three years ago to get the autoplaylists to go to the same playlist, called similar. But the names have changed since, and I get some error with the break; line http://www.hydrogenaud.io/forums/index.php...mp;#entry788010 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=1375&p=788010&#entry788010)
5. Just a small cosmetic thing. But now the mouse pointer turns to a hand when I hover the text, not the buttons. I don't need the tooltips or the hand actually, but it would be nice to have unity.
6. Also a small cosmetic thing, but I'd like it to read for instance just "similar artists" instead of "%artist%: similar artists", as I use four panels at the same timeand already have that info elsewhere. So how would I cut from the colon in "li.header_text()"?

Of course most of this I will probably find out eventually by JFGI, that's what I'm doing slowly, just thought I'd ask, if you have the time.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-01-29 21:56:02
Falstaff

Is there a way to make State display only the playing icon? I find the checks distracting, and to be honest, prefer the older playlists method. The highlighted items are enough to let me know I have something selected.

EDIT: I just realized this may cause problems with playback queue. :/
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-29 22:17:25
Falstaff

Is there a way to make State display only the playing icon? I find the checks distracting, and to be honest, prefer the older playlists method. The highlighted items are enough to let me know I have something selected.

EDIT: I just realized this may cause problems with playback queue. :/


overflow crash fixed ?
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-01-30 06:38:12
Falstaff

Is there a way to make State display only the playing icon? I find the checks distracting, and to be honest, prefer the older playlists method. The highlighted items are enough to let me know I have something selected.

EDIT: I just realized this may cause problems with playback queue. :/


overflow crash fixed ?


Hi Fakstaff,
the overflow crash is still there. I had it yesterday eve again, even with your new release. I will drop the console output in here later today when I am back home
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-01-30 06:49:32
overflow crash fixed ?


Hasn't done it since the update. So yes, for me it is.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-30 07:27:57
Falstaff

Is there a way to make State display only the playing icon? I find the checks distracting, and to be honest, prefer the older playlists method. The highlighted items are enough to let me know I have something selected.

EDIT: I just realized this may cause problems with playback queue. :/


overflow crash fixed ?


Hi Fakstaff,
the overflow crash is still there. I had it yesterday eve again, even with your new release. I will drop the console output in here later today when I am back home


surprising but maybe due to another place in the code, i'm aware of the console report, thanx in advance
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-30 11:36:53
@sylla, restore the mouse lbtn up function back to its default like this....

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    li.lbtn_up(x, y);
}


now add these 2 functions at the end of the script.

Code: [Select]
li.move = function(x, y) {
    this.index = Math.floor((y - this.y - 15) / this.row_height) + this.offset;
    this.in_range = this.index >= this.offset && this.index < this.offset + Math.min(this.rows, this.items);
}

li.lbtn_up = function(x, y) {
    switch(true) {
        case !this.trace(x, y):
        case this.up_btn.lbtn_up(x, y):
        case this.down_btn.lbtn_up(x, y):
        case !this.in_range:
        case x < this.x:
            break;
        case x < this.x + 20:
            //do something with first button
            break;
        case x < this.x + 40:
            //do something with second button.
            break;
        case this.lastfm_mode != 1 && x < this.x + 60:
            //do something with 3rd button
            break;
        case x > this.x + this.text_x && x < this.x + this.text_x + Math.min(this.names_widths[this.index], this.text_width):
            //text was clicked
            var i = 0;
            var playlist_name = "Similar";
            while(i < fb.PlaylistCount) {
                if (fb.GetPlaylistName(i) == playlist_name) fb.RemovePlaylist(i);
                else i++;
            }
            fb.CreateAutoPlaylist(fb.PlaylistCount, playlist_name, "artist HAS " + this.names[this.index]);
            fb.ActivePlaylist = fb.PlaylistCount - 1;
            break;
    }
}


untested but will hopefully work. you can this.urls[this.index] to get the last.fm url.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-30 11:49:35
Is there a way to make State display only the playing icon? I find the checks distracting, and to be honest, prefer the older playlists method. The highlighted items are enough to let me know I have something selected.


i've already fixed this for myself as i didn't like it either. you can download my modified file here

http://pastebin.com/muqLm6K5 (http://pastebin.com/muqLm6K5)

you need to save it as WSHplaylist.js in the wsh_br3tt\jsplaylist\js folder

@falstaff, i was wondering if you have anything on your to-do list or is everything done now? the resason i ask is because i was thinking about sharing a last.fm mod version like i did last time where people can use the mood column to directly love/unlove tracks on last.fm.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-30 12:35:18
yep, my todo list is not empty yet.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-30 12:45:52
ok, that's cool. i'll wait until you're done.

i have a feature suggestion and that's for the middle mouse button to toggle the playlist manager on/off. i've already implemented it for myself but i think it would be nice feature for everyone.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-30 13:57:40
ok, that's cool. i'll wait until you're done.

i have a feature suggestion and that's for the middle mouse button to toggle the playlist manager on/off. i've already implemented it for myself but i think it would be nice feature for everyone.


agreed

will be done in v1.0.9 ...
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-01-30 15:51:27
Falstaff

Is there a way to make State display only the playing icon? I find the checks distracting, and to be honest, prefer the older playlists method. The highlighted items are enough to let me know I have something selected.

EDIT: I just realized this may cause problems with playback queue. :/


overflow crash fixed ?


Hi Fakstaff,
the overflow crash is still there. I had it yesterday eve again, even with your new release. I will drop the console output in here later today when I am back home



Here is the console output:

rror: WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object doesn't support this property or method
File: D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 621, Col: 37
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-30 16:11:52
@falstaff, when you right click an autoplaylist in the playlist manager, you have a menu item named Edit query... - it should be named something like Autoplaylist properties because if you create an autoplaylist from an album list branch, there is no query to edit.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-30 16:28:46
Here is the console output:
rror: WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object doesn't support this property or method
File: D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 621, Col: 37
<source text only available at compile time>


thanks a lot, i'll check that asap !

@falstaff, when you right click an autoplaylist in the playlist manager, you have a menu item named Edit query... - it should be named something like Autoplaylist properties because if you create an autoplaylist from an album list branch, there is no query to edit.


well see, will be fixed,, thanks for reporting
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-01-30 16:34:56
marc2003: It worked! Now everything is even better than before - thanks.

I just realized you made a tutorial on your homepage. Don't know if I'd be able to do this better by reading that but I'll at least go through it before I ask anything again

Here's a link to a picture of the result: http://tinypic.com/view.php?pic=11rf7ra&s=8 (http://tinypic.com/view.php?pic=11rf7ra&s=8)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-30 17:23:31
i forgot to mention that you can replace the header text bit with this...

Code: [Select]
li.lastfm_modes[li.lastfm_mode].ucfirst()
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-01-30 17:32:31
Ah, now it's perfect. Was searching for some cut function but didn't find something good.

It was really time for me to update, I think my foobar2000 startup time is a couple seconds faster now 
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-30 17:52:51
Here is the console output:
rror: WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object doesn't support this property or method
File: D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 621, Col: 37
<source text only available at compile time>


hum, could you replace the WSHheaderbar.js file by the content of this one http://pastebin.com/03C5Y5iQ (http://pastebin.com/03C5Y5iQ)
and on crash, gimme the new console infos please, espcially from line --- error ---- to the end
thanks by advance
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-01-30 18:06:48
Here is the console output:
rror: WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object doesn't support this property or method
File: D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 621, Col: 37
<source text only available at compile time>


hum, could you replace the WSHheaderbar.js file by the content of this one http://pastebin.com/03C5Y5iQ (http://pastebin.com/03C5Y5iQ)
and on crash, gimme the new console infos please, espcially from line --- error ---- to the end
thanks by advance


Done and unfortune, same error:

debug: ActivePlaylist = 3
debug: columnDraggedId = 13
debug: sortOrder = $if2(%length%,' 0:00') | %album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%
debug: sortedColumnDirection = 1
Error: WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object doesn't support this property or method
File: D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 626, Col: 37
<source text only available at compile time>


FYI, when I click right mouse  button after crash, select configure and press ok, it is fine again.

Rerun the test again with selecting another artist, again the same but after right click mouse etc. it was fine again:

--- error ----
debug: ActivePlaylist = 1
debug: columnDraggedId = 13
debug: sortOrder = $if2(%length%,' 0:00') | %album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%
debug: sortedColumnDirection = 1
Error: WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object doesn't support this property or method
File: D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 626, Col: 37
<source text only available at compile time>
WSH Panel Mod: Warning: Could not load file D:\foobar2000-test-v102\components\jscript.api
WSH Panel Mod: Warning: Could not load file D:\foobar2000-test-v102\components\interface.api
WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Parsing file "D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHcommon.js"
WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Parsing file "D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHinputbox.js"
WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Parsing file "D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHtopbar.js"
WSH Panel Mod (JSPlaylist v1.0.8 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Parsing file "D:\foobar2000-test-v102\wsh_br3tt\jsplaylist\js\WSHscrollbar.js"
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-01-30 18:23:04
it looks like your panel doesn't support this function: plman.SortByFormatV2

one explanation would be not having the latest version of WSH panel mod. you can check by looking at file>preferences>components. it needs to be 1.5.6. btw, falstaff does mention this with a link to the component site on his DA page.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-30 19:37:45
marc2003 is right, it seems you are not running WSH Panel Mod v1.5.6 but an earlier version
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-01-30 20:24:17
marc2003 is right, it seems you are not running WSH Panel Mod v1.5.6 but an earlier version



Yep, you both right, was on older version. Have installed 1.5.6 and it worked perfect.
My excuses for this issue.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-01-30 22:35:42
no matter, i'm used to ;o)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-01-30 23:03:03
i've already fixed this for myself as i didn't like it either. you can download my modified file here


Thanks.
Title: WSH Panel Mod script discussion/help
Post by: rabwin on 2015-02-01 12:35:38
Hello there, new user here.

I'm starting to really get into scripting wsh panels and I've got a question about the drag functionality.
So far I have a playlist-tabs script working pretty well, and I can drag music files into each tab to have them added.

The only thing that annoys me, is this tooltip that comes up during on_drag_x events saying "Link" and I seem to be unable to alter the text to something else like "Add x files to y playlist".
I'm not sure if this has come up before, and I tried searching the forum but didn't find any posts of relevance.
I tried creating a new tooltip to see if that would get drawn over the other one or something, but it doesn't seem to work.

For reference, here is the script that I heavily modified from Br3tt's (thanks a lot for the easy start haha)
http://pastie.org/9878096 (http://pastie.org/9878096)
Differences are mainly:
- how the script operates
- flat panel design that grabs user colour theme
- tabs that auto-resize based on text length using gr.CalcTextWidth(string, gdi.font)
The only functionality I know I'm missing right now is:
- right-click context menus
- tab scrolling once you have more tabs than the width of the window
- draggable tabs to reorder them across the window
If anyone likes the script, I'll eventually repost with that stuff added in.
I tried to comment as much as possible to help anyone interested.

Thanks for your help!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-01 13:10:37
^ script unsable, many var declarations are missing, could you post the entire script please. Thank you.


var g_instancetype = window.InstanceType; just missing, fixed
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-02-01 17:14:58
@marc,
I want create buttons for switching between last.fm mods in your Last.fm Similar Artists script
I did like below but It doesn't work plz help

b.buttons.toptracks= new button(,,  function() {  this.lastfm_mode =4; window.Repaint();  },
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-01 17:33:38
to save yourself duplicating the same code, create a new function and then call that from the button. add this at the start of your panel... edit: it needs to go just after the line that begins var li = new list(...

Code: [Select]
li.lastfm_change_mode = function (m) 
    this.lastfm_mode = m;
    window.SetProperty("2k3.lastfm_mode", this.lastfm_mode); //store the value so it's remembered on panel reload/foobar restart
    this.artist = ""; //the panel won't update if the artist doesn't change so i just clear it
    p.item_focus_change(); //this calls the function that refreshes the panel - don't repaint because it's already done for you
}

then when you create your buttons...
Code: [Select]
//1st
b.buttons.similar = new button(x,y,w,h,image,function() { li.lastfm_change_mode(0); }, tooltip);
//2nd
b.buttons.tag = new button(x,y,w,h,image,function() { li.lastfm_change_mode(1); }, tooltip);
//etc
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-02-02 11:31:20
to save yourself duplicating the same code, create a new function and then call that from the button. add this at the start of your panel... edit: it needs to go just after the line that begins var li = new list(...
That did the trick! Thank you so much!!
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-02-02 14:43:57
tell me how to draw a triangle?
may be have a guide for drawing different objects.
Googled java script guide, he found nothing on the drawing objects....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-02 15:44:51
have a look at this...

http://www.hydrogenaud.io/forums/index.php...st&p=782006 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=70363&view=findpost&p=782006)
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-02-02 15:56:50
marc2003, thank you for your help 
Title: WSH Panel Mod script discussion/help
Post by: zsoft on 2015-02-03 14:18:53
Falstaff,
Question:
You can add to the playlist manager option sorting alphabetically?
(for some reason this option not present anywhere, only seen in the component: "Playlist Organizer", but this spoils the whole design)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-03 20:12:07
Falstaff,
Question:
You can add to the playlist manager option sorting alphabetically?
(for some reason this option not present anywhere, only seen in the component: "Playlist Organizer", but this spoils the whole design)


why not
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-04 21:07:37
JSPlaylist v1.1 released (link (http://fav.me/d8fiumu))

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-04 22:02:29
it's great to have proper 2 line support without me having to hack it. thanks for all the effort you've put in to this.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-04 22:06:37
Falstaff - Getting a crash when I click on the PL arrow button.

Error: WSH Panel Mod (JSPlaylist v1.0.4 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object expected
File: C:\Users\***\Desktop\foobar-new-dui\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 509, Col: 21


EDIT: Never mind. I updated the configuration script instead of just replacing the js files and it works now.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-04 22:12:25
Falstaff - Getting a crash when I click on the PL arrow button.

Error: WSH Panel Mod (JSPlaylist v1.0.4 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): (http://br3tt.deviantart.com):) Microsoft JScript runtime error:
Object expected
File: C:\Users\***\Desktop\foobar-new-dui\wsh_br3tt\jsplaylist\js\WSHheaderbar.js
Ln: 509, Col: 21


a v1.0.4 bug, no support for old version update your JSPlaylist to v1.1.0 please, and then if it still crash, i'll check it
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-04 22:15:49
it's great to have proper 2 line support without me having to hack it. thanks for all the effort you've put in to this.


You're welcome, that's a good feature, i'm used to it now
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-04 23:10:23
i just noticed a little bug... when you don't have enough tracks in the playlist to draw a scrollbar, the line drawn in the group header extends too far. it should stop in line with right edge of the last column.

(https://dl.dropboxusercontent.com/u/22801321/2015/february/line.png)
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-02-05 06:56:47
Nice work Falstaff!
Just one little remark, would it be able to add the version number  into the panel settings? Would be handy to have this visible.
Then we can check if we have the correct version number installed before, like I did, ask questions about something whereby we do not have installed the latest version / release.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-05 07:33:56
Nice work Falstaff!
Just one little remark, would it be able to add the version number  into the panel settings? Would be handy to have this visible.
Then we can check if we have the correct version number installed before, like I did, ask questions about something whereby we do not have installed the latest version / release.


will be done asap.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-05 19:56:12
JSPlaylist updated to v1.1.1

Changes:
Custom color sliders: focus handled with LEFT & RIGHT arrow keys to adjust RGB values with more accuracy
Columns titleformat: 3 special TF fields now supported: %list_index%, %list_total% & %isplaying%
Panel version is now displayed in Panel Settings
Bugs fixing... (in group header, color refresh in playlist manager after a custom color update, ... etc)

link (http://fav.me/d8fiumu)
Title: WSH Panel Mod script discussion/help
Post by: firewater on 2015-02-05 20:23:30
Hey marc your rating script has been very useful, but I'm lacking a feature that hopefully you could add on a future release or tell me what to look for to do it myself. I would like for a way to rate entire albums... more precisely that the script does the calculation of rating given to individual songs divided in total rated songs and make that the value of a tag called Album Rating or just display it somehow on ELPlaylist. I've been making the tag myself by adding it from properties, but obviously it doesn't update automatically so it's a mess...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-06 00:34:49
fat chance.  that's not even remotely related to the existing script and it would have to be something new written from scratch.
Title: WSH Panel Mod script discussion/help
Post by: firewater on 2015-02-06 01:22:52
Damn! Do you have any idea how it could be done with another script or component? Supposedly SimPlaylist can do it, but I'm not getting many results from Google...

And is there any way to rate songs with a keyboard shortcut? It would be super convenient because right now I'm opening foobar each 3 minutes to click the stars.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-06 03:12:31
regarding an old embedded album art issue....

Actually the situation is much simpler. foobar2000 does not define or implement any callback for changed album art, no matter whether it was updated by foobar2000 itself or another application.


^is there any chance it could be updated to trigger the same callback as when normal tags are updated? obviously this would only be for embedded art added/removed/modified by foobar itself. i think this makes more sense than adding anything new as all components could use it without modification.


I cannot speak for Peter but this feels like a hack for me.


i've only just noticed so i have no idea when it happened but this "hack" has been implemented in the core so this component updates without any modification. thanks Peter!!

@firewater, look at foo_quicktag.
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-02-06 06:33:17
JSPlaylist updated to v1.1.1

Changes:
Custom color sliders: focus handled with LEFT & RIGHT arrow keys to adjust RGB values with more accuracy
Columns titleformat: 3 special TF fields now supported: %list_index%, %list_total% & %isplaying%
Panel version is now displayed in Panel Settings
Bugs fixing... (in group header, color refresh in playlist manager after a custom color update, ... etc)

link (http://fav.me/d8fiumu)


Thanks!
Title: WSH Panel Mod script discussion/help
Post by: firewater on 2015-02-06 08:47:36
@firewater, look at foo_quicktag.

Exactly what I needed! Thanks!!!
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-02-06 09:04:08
JSPlaylist updated to v1.1.1

Changes:
Custom color sliders: focus handled with LEFT & RIGHT arrow keys to adjust RGB values with more accuracy
Columns titleformat: 3 special TF fields now supported: %list_index%, %list_total% & %isplaying%
Panel version is now displayed in Panel Settings
Bugs fixing... (in group header, color refresh in playlist manager after a custom color update, ... etc)

link (http://fav.me/d8fiumu)


@Falstaff

Thanks first of all for this script!!

When updating from ver 1.1.0 to 1.1.1 , I noticed that the Index column doesn't show anything, but the new %list_index% works fine.

Also when playing streams in versions up to 1.1.0 the station's name didn't get updated with dynamic titles which happens now with version 1.1.1.
I suggest that the first row to show the station's name and the second row the dynamic title changes.

Modified WSHplaylist.js to show you what I mean.
https://www.dropbox.com/s/kp4308tsmkpfhed/W...laylist.js?dl=0 (https://www.dropbox.com/s/kp4308tsmkpfhed/WSHplaylist.js?dl=0)

(http://i.imgur.com/bOSackj.png)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-06 10:35:22
just a little update for my artreader and CD jewel case scripts.... multi-line tooltips. 

(https://dl.dropboxusercontent.com/u/22801321/2015/february/tooltips.png)

existing users can right click>Update script.
full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)
instructions: http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-06 11:53:58
When updating from ver 1.1.0 to 1.1.1 , I noticed that the Index column doesn't show anything, but the new %list_index% works fine.

normal if you don't clear cached properties of the panel (to do on each new version install, installation notes updated to notice that)

Also when playing streams in versions up to 1.1.0 the station's name didn't get updated with dynamic titles which happens now with version 1.1.1.

so v1.1.1 is better


I suggest that the first row to show the station's name and the second row the dynamic title changes.
Modified WSHplaylist.js to show you what I mean.
https://www.dropbox.com/s/kp4308tsmkpfhed/W...laylist.js?dl=0 (https://www.dropbox.com/s/kp4308tsmkpfhed/WSHplaylist.js?dl=0)
(http://i.imgur.com/bOSackj.png)

i can't get image and files from now but normally you can set this by yourself by testing %isplaying% in your TF (if true, dynamic update, else static) ==> give it a try

Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-02-06 12:24:01
When updating from ver 1.1.0 to 1.1.1 , I noticed that the Index column doesn't show anything, but the new %list_index% works fine.

normal if you don't clear cached properties of the panel (to do on each new version install, installation notes updated to notice that)

Also when playing streams in versions up to 1.1.0 the station's name didn't get updated with dynamic titles which happens now with version 1.1.1.

so v1.1.1 is better


I suggest that the first row to show the station's name and the second row the dynamic title changes.
Modified WSHplaylist.js to show you what I mean.
https://www.dropbox.com/s/kp4308tsmkpfhed/W...laylist.js?dl=0 (https://www.dropbox.com/s/kp4308tsmkpfhed/WSHplaylist.js?dl=0)
(http://i.imgur.com/bOSackj.png)

i can't get image and files from now but normally you can set this by yourself by testing %isplaying% in your TF (if true, dynamic update, else static) ==> give it a try


BTW, question, is it possible to lock a playlist where, like this, have set several radio stations?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-06 12:43:47
last.fm mod of JSplaylist if anybody is interested...

http://www.hydrogenaud.io/forums/index.php...mp;#entry889486 (http://www.hydrogenaud.io/forums/index.php?showtopic=76772&pid=889486&st=1120&#entry889486)

you must of course already be using my full playcount sync script.

a large thanks to falstaff for all the work he put in to it making this possible.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-02-06 12:54:05
@ Falstaff

For the TF to work and show the original streams name it has to be  EvalWithMetadb(this.metadb) , otherwise %title% returns the current dynamic title.

I don't want a static name like "STREAM" but the stations name.


@jbercx

See
http://www.foobar2000.org/components/view/...list_attributes (http://www.foobar2000.org/components/view/foo_playlist_attributes)
to lock your playlists.
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-02-06 13:17:32
@ Falstaff

For the TF to work and show the original streams name it has to be  EvalWithMetadb(this.metadb) , otherwise %title% returns the current dynamic title.

I don't want a static name like "STREAM" but the stations name.


@jbercx

See
http://www.foobar2000.org/components/view/...list_attributes (http://www.foobar2000.org/components/view/foo_playlist_attributes)
to lock your playlists.


Cheers!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-06 13:28:10
@falstaff, would it possible for the panel settings to use the UI settings instead of system? it doesn't look good with a dark theme.

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-06 16:27:26
@falstaff, would it possible for the panel settings to use the UI settings instead of system? it doesn't look good with a dark theme.



you mean replacing system color by UI colors ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-06 16:43:57
@falstaff, would it possible for the panel settings to use the UI settings instead of system?

you mean replacing system color by UI colors ?


yep. anyway, it doesn't really matter as i've done it myself. i only had to update a few lines in your get_colors function. obviously i had to move it down until after the UI settings are created.

Code: [Select]
    g_syscolor_window_bg = g_color_normal_bg
    g_syscolor_highlight = g_color_highlight;
    g_syscolor_button_bg = g_color_normal_bg;
    g_syscolor_button_txt = g_color_normal_txt;


(https://dl.dropboxusercontent.com/u/22801321/2015/february/fixed.png)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-06 17:15:29
@falstaff, would it possible for the panel settings to use the UI settings instead of system?

you mean replacing system color by UI colors ?


yep. anyway, it doesn't really matter as i've done it myself. i only had to update a few lines in your get_colors function. obviously i had to move it down until after the UI settings are created.



sorry for the stupid question, i was at work and there images are not displayed
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-02-06 19:19:53
@ Falstaff

For the TF to work and show the original streams name it has to be  EvalWithMetadb(this.metadb) , otherwise %title% returns the current dynamic title.

I don't want a static name like "STREAM" but the stations name.

@ Falstaff
Just to let you know I found a way by creating a special TF field %titlemetadb% and created a column for it.

Code: [Select]
						// %titlemetadb%
if (fb.TitleFormat("%length%").EvalWithMetadb(this.metadb) == "?"){
titlemetadbname = fb.TitleFormat("%title%").EvalWithMetadb(this.metadb);
titlemetadbname = titlemetadbname.replace(/'/g, "''").replace(/,/g, "','").replace(/\//g, "'/'").replace(/\(/g, "'('").replace(/\)/g, "')'").replace(/\[/g, "'['").replace(/\]/g, "']'");
tf_prep = replaceAll(tf_prep, "%titlemetadb%", titlemetadbname);
};
else{
tf_prep = replaceAll(tf_prep, "%titlemetadb%","");
};

(http://i.imgur.com/vrlUUEY.png)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-06 21:51:34
@zeremy

why trying to code thing available with simple titleformat 


EDIT: my bad, forgot this bad example for the Stream 1st line

(http://i.imgur.com/rQz1M2r.png)

and TF for bitrate fixed is:
Code: [Select]
$if(%__bitrate_dynamic%, $if(%isplaying%,$select($add($mod(%_time_elapsed_seconds%,2),1),%__bitrate_dynamic%,%__bitrate_dynamic%)'K',$if($stricmp($left(%codec_profile%,3),'VBR'),%codec_profile%,%__bitrate%'K')),$if($stricmp($left(%codec_profile%,3),'VBR'),%codec_profile%,%__bitrate%'K'))
Title: WSH Panel Mod script discussion/help
Post by: Marcus Vinicus on 2015-02-07 07:59:30
First thanks to marc2003 for the WSH Panel Mod components I've been using for a while now. They add so much for a hard-core user of foobar like myself.

Second I've been experimenting with Falstaff's new playlist component. I have a digital collection that is 100% classical which poses it's own challenges in to regards my needs which is to make the best use of custom extensive metadata tags I use to catalogue my collection. For me just sorting recordings by album alone isn't a complete answer as there are multiple ways I need to filter metadata.

The screenshot below is what I've come up with initially after a lot of tinkering with Falstaff's excellent gadget. The wallpaper is an image of the composer. (http://i120.photobucket.com/albums/o174/LindsayCA/playlist1_zpsaa373f76.jpg)

So Falstaff, a big thanks to you as well.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-07 08:25:56
@Marcus Vinicus:

you're welcome, nice setup, and the fact you've manage to make it to fit your needs is great for me
Title: WSH Panel Mod script discussion/help
Post by: Marcus Vinicus on 2015-02-07 08:35:25
@Marcus Vinicus:

you're welcome, nice setup, and the fact you've manage to make it to fit your needs is great for me


Thanks,

I do wish there was three rows of groups instead of two, it would mean I could do things a bit differently re the performers! 
Title: WSH Panel Mod script discussion/help
Post by: rx32555 on 2015-02-07 15:09:45
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-07 15:33:36
^ the WSH team
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-07 15:53:22
just a little reminder for anyone who uses my now playing or thumbs scripts to download artist images from last.fm - you can configure the main foobar preferences with the full path to the folder it uses so other components/scripts can make use of them. look at file>preferences>display>album art>artist tab. enter something like

Code: [Select]
c:\users\marc\appdata\roaming\foobar2000\wsh_data\%artist%\*.*
d:\portable apps\foobar2000\wsh_data\%artist%\*.*


when done, you can enable artist wallpaper in falstaff's JSplaylist and it just works. also, it can be used by other components such as EsPlaylist or foo_facets when you browse your library by artist:

(https://dl.dropboxusercontent.com/u/22801321/2015/february/esp1.png)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-07 17:32:19
Did not know that marc2003, might be useful.

I am going to shamefully ask you one thing more even though I haven't done your tutorial yet 
Though this is more of a future request/idea than ask for help.

Maybe it would be good in your similar script to have the date of the albums in album mode show up in a paranthesis before or after the name? Like you did before with relevance for the tags... (I liked that as well)
But the date would be good for tagging, but also it would be helpful as albums released later naturally gets played more for a while.

Don't know if it's possible/how easy it would be to do.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-07 17:49:43
Like you did before with relevance for the tags... (I liked that as well)


eh? you must be using some mod because my script doesn't include that. also, you can't get the album date from last.fm. (edit: if i did the mod then i forgot )

you should check out my musicbrainz script for that kind of thing.

http://marc2003.x10host.com/musicbrainz (http://marc2003.x10host.com/musicbrainz)
Title: WSH Panel Mod script discussion/help
Post by: WhistleChips on 2015-02-07 18:47:37
just a little reminder for anyone who uses my now playing or thumbs scripts to download artist images from last.fm - you can configure the main foobar preferences with the full path to the folder it uses so other components/scripts can make use of them. look at file>preferences>display>album art>artist tab. enter something like

Code: [Select]
c:\users\marc\appdata\roaming\foobar2000\wsh_data\%artist%\*.*
d:\portable apps\foobar2000\wsh_data\%artist%\*.*


when done, you can enable artist wallpaper in falstaff's JSplaylist and it just works. also, it can be used by other components such as EsPlaylist or foo_facets when you browse your library by artist:


YOU ARE THE BEST!!!! 
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-07 19:28:27
eh? you must be using some mod because my script doesn't include that. also, you can't get the album date from last.fm. (edit: if i did the mod then i forgot )

you should check out my musicbrainz script for that kind of thing.

http://marc2003.x10host.com/musicbrainz (http://marc2003.x10host.com/musicbrainz)

Yeah it's possible someone else modded that into your script, didn't think about that. It probably used the first common.js, and it made a list with for example indie (99) pop (80) IIRC.

I'm aware of the musicbrainz script, it's nice, but I only have 1920x1080 and it's already a bit crammed... Thanks for the answer though
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-07 19:39:06
but I only have 1920x1080


aw. poor you. 

i have most of my scripts in a single layout. i just use tabs with default UI or when using columns, i use the panel stack splitter component to show/hide panels when you click buttons. obviously the 2nd option is a lot more effort.

as an example here's my PSS layout, my artist "tab" lets me switch between 4 panels. the album "tab" has 3 panels and 2 others to show track properties and charts. that's 9 panels in a pretty small space.

(https://dl.dropboxusercontent.com/u/22801321/2015/february/pss.png)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-07 20:20:50
aw. poor you. sad.gif tongue.gif

i have most of my scripts in a single layout. i just use tabs with default UI or when using columns, i use the panel stack splitter component to show/hide panels when you click buttons. obviously the 2nd option is a lot more effort. tongue.gif

as an example here's my PSS layout, my artist "tab" lets me switch between 4 panels. the album "tab" has 3 panels and 2 others to show track properties and charts. that's 9 panels in a pretty small space.

Hehe 

I used to have tabs but removed them as I wanted to see all the info I'm interested in immediately when I alt/tab up fb2k and to just need one click most the time. Just what I prefer at the moment, although your picture looked nice, and made me think about it.

Although, even if I had tabs, I wouldn't get the functionality I wanted - to have an idea of what albums are really the most listened to/most praised of an artist and at the same time get an overview of their discography with release dates.

Nothing to do... Just a small idea I came up with but if it's not even possible there's nothing to do.

Might be a good practice for me to try to get the musicbrainz script nicely into the now playing script...
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-02-07 22:13:27
just a little reminder for anyone who uses my now playing or thumbs scripts to download artist images from last.fm - you can configure the main foobar preferences with the full path to the folder it uses so other components/scripts can make use of them.


great tip Marc - is there a way to reference this using your old image path structure? (I'm still reluctant to run your script on my 8gb of artist images!)

On that update topic - I am trying to update some of my panels that use your old .js files. Did common8.js drop support for web buttons (youtube, google, etc buttons)?

Also, FYI - upgrading blog/news/reviews no longer seems to give results for news or reviews, but blogs still works.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-07 22:58:07
instead of wsh_data, the old image folder ends with \wsh_lastfm\$crc32(%artist%)\*.*

and you are right about web links being missing in the new samples. i was going to update them with some new images but i'll be honest - i forgot all about it.

news/reviews/blogs is still working for me.

(https://dl.dropboxusercontent.com/u/22801321/2015/february/news.png)
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-02-07 23:17:27
instead of wsh_data, the old image folder ends with \wsh_lastfm\$crc32(%artist%)\*.*


excellent - perfect; now to figure out something nice to do with that.

news/reviews/blogs is still working for me.


correct, sorry - it wasn't updating on my first few tracks, but then started.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-08 11:31:14
marc,

I ran into an error I hadn't seen previously with simple tag reader. I'm trying to replicate this info panel (https://i.imgur.com/jBQgZ4I.png). Or at least the general feel of it. That one was unceremoniously stolen from CaTRoX because I like the clean layout and information it provides. However, I'm trying to get away from a conglomeration config and thought it would be nice to use yours as a base.

What I found out is TF strings can only be so long. I'd also rather not use Properties WSH because it creates an autoplaylist if you click on anything (I know how to disable that) and it doesn't fit well in the confined space on the right where I'd like it to reside. This (https://i.imgur.com/SvoXhGk.png) is as far as I got before the TF error popped up. Is there an easy way to alter one of your configs (JS??) to more or less mimic the former? Basically - pick and choose what tidbits I want displayed.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-08 11:45:38
edit: if you saw the previous post, ignore that. i missed you mentioning simple tag reader.

the dialog box is limited to 255 characters because of windows script host limitations. really, it's only meant for display large chunks of text from a single field. i didn't really mean for it to be used for multiple lines of single tags. i think you'd better off using the bog standard item details panel as you're not doing anything that requires WSH panel mod.

if you really must, you can bypass the character limitation by holding shift and right click the panel>Properties. there you can directly edit the value 2k3.text_tag_tf
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-08 12:23:14
Heh. It's always the simple things. Thanks. Forgot all about the included bits lol.
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2015-02-10 23:14:59
Marc, thanks for your continued development of your WSH scripts.  I've been using them since you were on common3.js.  I had done some hack work on your scripts so I hadn't updated them since then, but I'd been getting more and more crashes so I thought it was time to check out your new ones.  You have done some nice work since then!

Anyhow, a couple of questions and requests:

1.  How do I get the panels to adhere to the DUI font standards?
2.  In your last.fm similar artists panel, is there a way for you to add a user configurable link in addition to the default last.fm artist page and autoplaylists?
3.  The one script I used that doesn't seem to have an equivalent is a web links one.  I know you have the small web links script that parses the musicbrainz artist page, but I added some specific ones to your old one that won't show up in MB.  Is there a way you can make your old one compatible?  I can send you a copy of it if you want to look at it.
4.  Is there a way to auto download last.fm artist art to a user defined folder?  I've been collecting artist art over years in an artist art folder and would like to keep using it.  For now I let your last.fm autodownloader download and then manually move to my folder.  It's not a big deal to have to continue to do that, but wanted to ask.

And one question for falstaff on your WSH playlist viewer.  First off, great work!  It pretty much does everything my ELPlaylist does, and allows me to move back to DUI.  I wanted to know if there is a way to configure row height for the script?  I'd like to make it shorter.  I tried poking around but wasn't able to easily identify it.  Also, I'd like to make some user defined custom fields narrower, but it looks like there is a limit to how narrow you can make them.  Is there a way you can change that?

Thanks in advance!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-10 23:24:11
in main script, search for this, and change default height for playlist row from 28 to ... what make you please, but take care, especially to the extra_line_h variable that might need to increase if you decrease the default_playlist_h & playlist_h value :

Code: [Select]
cRow = { // references of row height (zoom 100%)
    default_playlist_h: 28,
    playlist_h: 28,
    extra_line_h: 5,
    playlistManager_h: 28,
    headerBar_h: 26,
    settings_h: 30
};
Title: WSH Panel Mod script discussion/help
Post by: Sixth Street on 2015-02-10 23:32:45
This is the ultimate in stupid question, but how do I get back in to edit the main script?  I thought in WSH panels you can right click and select configure at the bottom of the menu to get to the main panel, but that option doesn't appear for the playlist panel. Thanks again!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-10 23:37:27
This is the ultimate in stupid question, but how do I get back in to edit the main script?  I thought in WSH panels you can right click and select configure at the bottom of the menu to get to the main panel, but that option doesn't appear for the playlist panel. Thanks again!


as described in my DA page for JSPlaylist, in TIPS section:
...
[Tips]
* Hold SHIFT key + right click on a toolbar to display Configure script ans panel Properties entries
...

but on a toolbar or a non-item place
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-11 10:44:16
@Sixth Street

1. it already does use the font name and colours from the default UI preferences.  there are choices for font size on the right click menu. note that the component does have a problem getting the name of some fonts so check the console and it will tell you on startup/font change if it fails and it will revert to using Segoe UI. nothing can be done about that unless someone takes over component development.

2. just tell me what it is and i'll add a button. i very recently posted some similar code for someone else so it should be easy to change it to what you need.

3. i keep meaning to add a new one but i haven't got around to it yet.

4. give me some idea how you store your images and i'll tell you what to change
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-02-12 14:29:09
Hey marc2003, I'm trying and failing to modify your Last Fm Similar Artists script.

Basically I want it to better utilise space in rectangular panels by forcing it to create a new columns if enough space along the X axis is unused

Sort of like this:

(http://i.imgur.com/OEQvrHA.jpg)

How easy would this be to implement?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-12 15:59:10
this sort of thing has been asked for before. displaying them like that is easy. the hard part is keeping everything clickable and i'm just too lazy.
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-02-12 16:48:58
this sort of thing has been asked for before. displaying them like that is easy. the hard part is keeping everything clickable and i'm just too lazy.


Fair enough
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-12 16:49:23
marc2003:I set it up like this now, realized I wanted the musicbrainz script as well
(http://i60.tinypic.com/302cthl.jpg)

I have tollbars for the buttons above every wsh-panel, and they of course do things to the selected item. Ideally, I'd want the buttons inside the panels just above the "gr.Drawline".

Though I don't know if I can get all the links to work in the panel? If not, it's maybe not worth it. It's mostly browser links, but also album art downloader (through foo_run), soft_playlist stuff, file operations, and replaygain scan.

I understand how to paint them in the right place and how to use if statements for the different panel modes to show different buttons, but not how to make them clickable... Also, I'd need to understand how to get the value of the marked item (whether it's artist, album or title) I now use li.header_text().replace(/: top tracks/g, '').replace(/ /g, '+') in some places but...

I've tried figuring this out by changing in some old scripts, I've also gone through your tutorial, and I tried inserting the playback buttons and changing stuff there, but didn't figure out what to keep and what to change...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-12 17:50:07
@sylla, i need to complete or rather start my tutorial about using buttons.
@hucifer, i might think about working around listing stuff side by side but no promises.

and now for something completely different. i've fixed a long standing annoying bug in WSH panel mod by recompiling it. if people use any of my artist bio or album review scripts (or other scripts that display large chunks of text), they may have noticed stray punctuation not getting wrapped properly. this fixes it...

https://dl.dropboxusercontent.com/u/2280132...h_panel_mod.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/foo_uie_wsh_panel_mod.zip)

it requires foobar v1.3 or above because it uses the latest SDK
utils.GetAlbumArt has been removed because the corresponding function has been removed from the foobar SDK.
tested on 7 and 8.1. it doesn't work on XP and i have no idea about vista.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-13 00:24:09
sorry mods, i posted by mistake. delete this.
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-02-13 04:41:57
@sylla, i need to complete or rather start my tutorial about using buttons.
@hucifer, i might think about working around listing stuff side by side but no promises.

and now for something completely different. i've fixed a long standing annoying bug in WSH panel mod by recompiling it. if people use any of my artist bio or album review scripts (or other scripts that display large chunks of text), they may have noticed stray punctuation not getting wrapped properly. this fixes it...

https://dl.dropboxusercontent.com/u/2280132...h_panel_mod.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/foo_uie_wsh_panel_mod.zip)

it requires foobar v1.3 or above because it uses the latest SDK
utils.GetAlbumArt has been removed because the corresponding function has been removed from the foobar SDK.
tested on 7 and 8.1. it doesn't work on XP and i have no idea about vista.


Awesome! That had been bugging me.

And thanks for additional scrips as well - I wanted to get a proper all-in-one menu button working
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-13 10:32:35
i'm kind of surprised no one has moaned about that bug before. i expect most people thought my script was at fault rather than the component.  for anyone who writes their own scripts, it the EstimateLineWrap function that i fixed.

also, here's a side by side similar artists script. just replace the code in your panel with this. there is no scrolling.

https://dl.dropboxusercontent.com/u/2280132...h%20columns.txt (https://dl.dropboxusercontent.com/u/22801321/2015/february/last.fm%20similar%20artists%20with%20columns.txt)

@sylla, i'll sort out some buttons later.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-13 13:08:20
Falstaff,
Question:
You can add to the playlist manager option sorting alphabetically?
(for some reason this option not present anywhere, only seen in the component: "Playlist Organizer", but this spoils the whole design)


FYI, feature added (sort Az and Za) for next release (v1.2.0), release planned this week-end
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-02-13 17:15:58
also, here's a side by side similar artists script. just replace the code in your panel with this. there is no scrolling.

https://dl.dropboxusercontent.com/u/2280132...h%20columns.txt (https://dl.dropboxusercontent.com/u/22801321/2015/february/last.fm%20similar%20artists%20with%20columns.txt)


Looking good! Much appreciated

(http://i.imgur.com/D35zsAF.jpg)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-13 18:10:52
JSPlaylist v1.2.0 just released

Changelog:
Playlist Filter added for group patterns
+ Custom Column Color feature added
+ added buttons to sort the playlists
+ fixed crash on expand all (bug brought with v1.1.0)
+ fixed bugs in settings (textboxes focus, mouse cursor...),
+ fixed a bug in custom colors sliders when moved with arrow keys
+ misc bugs fixing and some comestic changes

link (http://fav.me/d8fiumu)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-13 19:11:25
Outstanding, Falstaff. Thanks for implementing the filter. 
Title: WSH Panel Mod script discussion/help
Post by: Marcus Vinicus on 2015-02-13 20:06:17
Falstaff,

First, thanks for 1.2.0 of your playlist.

I hope there is an easy answer to this other than the only other long way out of my problem.

I can get 1.2.0 to work if I follow your instruction to clear the properties as you ask but the trouble is I lose my custom group setting (see screenshot in my post above) and the 3 new columns I created.

My question is: Can I reinstate all my custom settings some other way than the long way ie. lots of cutting and pasting?

Am I missing something really obvious?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-13 20:15:48
and now for something completely different. i've fixed a long standing annoying bug in WSH panel mod by recompiling it. if people use any of my artist bio or album review scripts (or other scripts that display large chunks of text), they may have noticed stray punctuation not getting wrapped properly. this fixes it...

https://dl.dropboxusercontent.com/u/2280132...h_panel_mod.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/foo_uie_wsh_panel_mod.zip)

it requires foobar v1.3 or above because it uses the latest SDK
utils.GetAlbumArt has been removed because the corresponding function has been removed from the foobar SDK.
tested on 7 and 8.1. it doesn't work on XP and i have no idea about vista.


this has now been updated and tested to work with windows XP so obviously all windows OS should now be supported.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-13 20:18:47
sorry, but properties in this version 1.2.0 are mostly not compatible with all previous version (that explain i jump version number from 1.1.2 directly to 1.2.0)
normally, properties don't change really, maybe an add or one removed and in this case, Clear is not mandatory, but in v1.2.0 it is.

shouldn't be necesseray in next versions > 1.2.0.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-13 20:31:54
Falstaff - Is it possible to remove the  , , ,  placeholders in the ratings column? Prefer to just see the stars. Speaking of which, wouldn't mind the option of changing them to simple dots, too.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-13 21:37:53
@falstaff, thanks for the update but would it be possible for the mood column to keep its colour for selected or playing items?

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-13 21:45:18
^ maybe it would be better, i will see that asap
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-13 22:31:26
i've made another little component update. if you get a script error, that is now reported in the popup window as well as the console.

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-14 08:41:53
@falstaff, thanks for the update but would it be possible for the mood column to keep its colour for selected or playing items?


ok, done and yes it's better to keep custom color for "graphical" columns regardless of the track state. Columns concerned are Mood, Rating and State.
I will release the update soon.

EDIT: done in v1.2.1 released to fix a big bug when creating a new column, see below...
Title: WSH Panel Mod script discussion/help
Post by: Marcus Vinicus on 2015-02-14 08:55:23
Falstaff,

First I got the playlist working again by cut and paste. Didn't take too long.

Have got 1.2.0 working fine apart from a crash.

I created a custom column and it initially seemed to work now it crashes when it is clicked on in Panel Settings.

Code: [Select]
Error: WSH Panel Mod (JSPlaylist v1.2.0 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
Overflow
File: C:\Users\Administrator\AppData\Roaming\foobar2000\wsh_br3tt\jsplaylist\js\WSHsettings.js
Ln: 1289, Col: 13
<source text only available at compile time>



I naturally cannot delete the column either.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-14 09:13:39
Falstaff,

First I got the playlist working again by cut and paste. Didn't take too long.

Have got 1.2.0 working fine apart from a crash.

I created a custom column and it initially seemed to work now it crashes when it is clicked on in Panel Settings.

Code: [Select]
Error: WSH Panel Mod (JSPlaylist v1.2.0 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
Overflow
File: C:\Users\Administrator\AppData\Roaming\foobar2000\wsh_br3tt\jsplaylist\js\WSHsettings.js
Ln: 1289, Col: 13
<source text only available at compile time>



I naturally cannot delete the column either.


ok, problem reproduced easily, my bad, i will post a fix asap, thanx for reporting

EDIT: fixed in v1.2.1 just released:

for those like Marcus that have encounter the crash after adding a new custom column and that don't want to use the 'Clear properties method' because of their customization just redone, then after having applied the new version, in panel window Properties, just update the property "SYTEM.HeaderBar.TotalColumns from 15 to 14, it will do a logical delete of the previously custom column and then you'll be able to create new ones after properly.
(http://i.imgur.com/7cYORSF.png)
HTH
Title: WSH Panel Mod script discussion/help
Post by: Marcus Vinicus on 2015-02-14 09:49:32
Thanks Falstaff,

I applied 1.2.1 made the change in properties a la the screenshot. But it still crashed.

So I deleted in properties two references to the custom column in

SYSTEM.Headerbar.label  AND
SYSTEM.Headerbar.percent

All works fine now! 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-14 10:53:26
ok, done and yes it's better to keep custom color for "graphical" columns regardless of the track state.


thanks.

edit: i've decided to share a component update i've made in the main WSH panel mod thread..

http://www.hydrogenaud.io/forums/index.php...st&p=890212 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=70363&view=findpost&p=890212)

Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-14 12:27:12
marc2003: This paints the icons where I want them:
Code: [Select]
 
p.draw_image(gr, img6, p.w - bs, bh, bs, bs)
    p.draw_image(gr, img3, p.w - 4 - bs * 2, bh, bs, bs)
    p.draw_image(gr, img4, p.w - 8 - bs * 3, bh, bs, bs)
    p.draw_image(gr, img4, p.w - 12 - bs * 4, bh, bs, bs)
    p.draw_image(gr, img, p.w - 16 - bs * 5, bh, bs, bs)
    p.draw_image(gr, img7, p.w - 20 - bs * 6, bh, bs, bs)
    gr.DrawLine(p.w - 25 - bs * 6, 13,p.w - 25 - bs * 6, 0, 1, p.textcolour_hl & 0x45ffffff);
    if (li.lastfm_mode == 0) //similar artists
    {
    p.draw_image(gr, img, p.w - 16 - bs * 8, bh, bs, bs)
    p.draw_image(gr, img, p.w - 20 - bs * 9, bh, bs, bs)
    //p.draw_image(gr, img5, p.w - (bstart + 5 + bs * 4), bh, bs, bs)
    }
    else if (li.lastfm_mode == 3) //top albums
    {
    p.draw_image(gr, img9, p.w - 16 - bs * 8, bh, bs, bs)
    p.draw_image(gr, img10, p.w - 20 - bs * 9, bh, bs, bs)
    p.draw_image(gr, img13, p.w - 24 - bs * 10, bh, bs, bs)
    }
   
    else if (li.lastfm_mode == 4) //top tracks
    {
    p.draw_image(gr, img11, p.w - 16 - bs * 8, bh, bs, bs)
    p.draw_image(gr, img12, p.w - 20 - bs * 9, bh, bs, bs)
    p.draw_image(gr, img13, p.w - 24 - bs * 10, bh, bs, bs)
    }
I want all the paneltype independent-buttons to perform browser searches similar to this:
p.browser("https://www.youtube.com/results?search_query=" + li.header_text().replace(/: top tracks/g, '').replace(/ /g, '+'));
(But I suspect there is a better way than to replace "top tracks" and so on...)

Then, I thought about extra buttons for:
File operations (move selected tracks)
Scan replaygain
Open foo_run? I want to open album art downloader and search for art for current album (the header in the "top album" version, but would need to get artist and directory as well... hmm)
Some "softplaylist" stuff like search for artists top tracks and so on, available in context menu

No idea if these last buttons can even be done here, or if they are better suited for a toolbar... Again, space is important 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-14 13:18:14
^i think that would be better suited in it's own script. i'll post something with enough comments in to get you going later.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-14 13:38:45
All right, thanks...
Do you mean the browser buttons as well? I think they would be nice there on the top of the panel actually, as I want three versions of all buttons, and the lists already have the right "headlines": album/artist/track. The other ones would just be a bonus to have there.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-02-14 17:20:02
marc2003:I set it up like this now, realized I wanted the musicbrainz script as well
(http://i60.tinypic.com/302cthl.jpg)


Can you please share this modified slimier artist script of yours??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-14 21:18:22
@sylla, hopefully this is enough to get you started...

https://dl.dropboxusercontent.com/u/2280132...ruary/sylla.txt (https://dl.dropboxusercontent.com/u/22801321/2015/february/sylla.txt)

btw, in case you didn't know, my artreader and CD jewel case scripts already have options for launching album art downloader using the right click menu. they use the current artist/album as the search terms.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-14 21:56:58
marc2003: wow, thanks. very nice. And the jewel case is in your now playing as well, no I didn't know that. Really good being able to open the folder as well from there by doubleclicking  And the tooltip showing image size. My player will be perfect

Do you think I should share the code to people like samithaj who asks?

samithaj: Right now the script is too messy. And I don't know what marc2003 thinks about me sharing. I of course understand too little to be able to answer if something I changed doesn't work for somebody else, or want different buttons than I and so on.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-14 22:22:36
that script should be ok to share - so long as you're not changing anything that affects how often the script downloads fresh info. if you're just adding buttons, it should be fine.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-14 23:05:58
Ok, then I will share when I have worked on it a bit. You gave me this before, but just cosmetic and not about downloads, right:
function on_metadb_changed() {
    li.metadb_changed();
    li.items = Math.min(50, li.items); //edit the 20 if you want

Immediately realized some mistakes I had made before when I tried to get some other button scripts into the similar panel.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-02-14 23:50:58
@Falstaff - unfortunately JSPlaylist is still not fully stable for me:

Code: [Select]
WSH Panel Mod (JSPlaylist v1.2.1 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
       'this.groups[...].collapsed' is null or not an object
       File: I:\foobar2000\wsh_br3tt\jsplaylist\js\WSHplaylist.js
       Line: 1796, Col: 9
       <source text only available at compile time>


It also does not like loading covers supplied by the foo_youtube (http://www.hydrogenaud.io/forums/index.php?showtopic=104379) plug-in: "clip thumbnails" - mostly they take ages to load and often don't load at all. For comparison es, el and sim-playlists and your coverflow view script are all fine - at least your coverflow loads rapidly without JSPlaylist installed. When JSPlaylist is loaded and spinning away trying to get the thumbnails and mostly failing it slows down loading by coverflow markedly. So it seems to be interfering with other wsh scripts.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-15 09:40:32
You gave me this before, but just cosmetic and not about downloads, right:


yep.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-15 11:37:54
@Falstaff - unfortunately JSPlaylist is still not fully stable for me:

Code: [Select]
WSH Panel Mod (JSPlaylist v1.2.1 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
       'this.groups[...].collapsed' is null or not an object
       File: I:\foobar2000\wsh_br3tt\jsplaylist\js\WSHplaylist.js
       Line: 1796, Col: 9
       <source text only available at compile time>


It also does not like loading covers supplied by the foo_youtube (http://www.hydrogenaud.io/forums/index.php?showtopic=104379) plug-in: "clip thumbnails" - mostly they take ages to load and often don't load at all. For comparison es, el and sim-playlists and your coverflow view script are all fine - at least your coverflow loads rapidly without JSPlaylist installed. When JSPlaylist is loaded and spinning away trying to get the thumbnails and mostly failing it slows down loading by coverflow markedly. So it seems to be interfering with other wsh scripts.


thanx for reporting, but could you explain me when this happen please ? are group inautocollapse mode or have you use the Collapse All action ? and what are you doinf when it happens, a double click on a collapsed group to expand it or whatelse ? thanks by advance to help to render it more stable about this collapse/expand feature.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-15 13:10:37
It also does not like loading covers supplied by the foo_youtube (http://www.hydrogenaud.io/forums/index.php?showtopic=104379) plug-in: "clip thumbnails" - mostly they take ages to load and often don't load at all. For comparison es, el and sim-playlists and your coverflow view script are all fine - at least your coverflow loads rapidly without JSPlaylist installed. When JSPlaylist is loaded and spinning away trying to get the thumbnails and mostly failing it slows down loading by coverflow markedly. So it seems to be interfering with other wsh scripts.


just tested on my DUI config that contains only a WSH Panel (JSPlaylist) and covers load perfectly with foo_youtube. What are the others WSH panels running in your config, 'cause what you discribe is a typical bad use of timer in WSH panels that may generate issues in others WSH panels.
*waits for feedback*
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-02-15 13:38:13
I haven't touched any of the JSPlaylist settings - so they are all at default; I haven't used Collapse All action.

Issue seems to occur when multiple tracks are added to a playlist via the command line with add location...

A quick test show that putting the following on line 1796 of WSHplaylist.js stopped the crash:

if (!this.groups[grp_id]) return;

But as you understand your code better than me you may know a better way...

HTH
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-15 13:42:02
I haven't touched any of the JSPlaylist settings - so they are all at default; I haven't used Collapse All action.

Issue seems to occur when multiple tracks are added to a playlist via the command line with add location...

A quick test show that putting the following on line 1796 of WSHplaylist.js stopped the crash:

if (!this.groups[grp_id]) return;

But as you understand your code better than me you may know a better way...

HTH


maybe fixed for next release (soon)

and what about my question about other WSH panel mod you are running and causing trouble in JSPlaylist cover loading ... ? just tested again JSP and WSH Coverflow panel and all is fine, a can't reproduce it but i'm sure it's due to another WSH panel mod, so i'm extremly curious to get your other WSH panel mod scripts you are running to find the guilty

capture (http://i.imgur.com/O0Qmqnw.png)
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-02-15 13:54:53
Ok I can reproduce it with a very simple DUI set-up. In this the only wsh panel is your JSPlaylist.

The picture shows side by side results with JSPlaylist and esplaylist. Tracks were added with the YouTube Source - Search (Integrated) panel. I have now been writing this post for a few minutes and still no YouTube thumbnails have appeared. Playing various tracks did not help...

(http://i.imgur.com/xIBWq2K.png)
   

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-15 14:49:04
@WilB

thank you, i will try to reproduce it by mimics this layout...

EDIT: done but i can't reproduce it, all works fine for me  could you zip your whole basic config to let me test is as it is for you, that may help me to reproduce it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-15 14:56:36
i created that exact layout and it works for me??

)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-15 15:02:12
^same as Marc here as EDITED in previous post.

@WilB: could you send me a zip file with your config to let me test it ?
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-02-15 16:27:39
The set up is quite vanilla. Further investigation, now that I have managed to get back on my main computer, shows that all is fine there - all images load pretty quickly. However if the self same portable set up is installed on the USB stick I was using earlier, then many of the youtube thumbnails still don't end up loading. So I guess its related to the slower speed of the USB 2 stick. Let me know if you still want the zip and where you want me to send it.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-02-15 17:59:14
A new version of the YouTube Track Manager script is available (v1.5). YouTube Track Manager is a database search companion to the foo_youtube plug-in. It features improved album management through addition of an interactive discography with similar and related artists. In addition to wsh_panel_mod (http://www.hydrogenaud.io/forums/index.php?showtopic=70363) 1.5.6+, the foo_youtube (http://www.hydrogenaud.io/forums/index.php?showtopic=104379) plug-in is required and then you can play the music in foobar2000 as well. Its free of adverts and you needn't watch the videos - since just audio-only can be streamed at up to 256 kbps AAC. Supports last.fm top albums, top tracks, top similar songs and MusicBrainz lists. Buttons to change type. Auto-generation of top 50 playlists. Auto-pick "radio" mode. Auto-track renaming. Optional integration with media library. Blacklist to avoid specific YouTube tracks. Download and full details here (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=105522&view=findpost&p=890289).

There have been a lot of changes, so please report if anything needs fixing.

(http://i.imgur.com/W4WO2R0.png)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-16 13:02:15
marc2003: I am trying to incorporate the buttons you gave me into the similar script. No problem with the buttons that paints the same for every lastfm_mode. (I made vars that change the function of them)

you told me to use "b.buttons.name.x =" in on_paint for panel size dependent buttons. Is it bad to just use b.update() there? You used that in your tutorial and it seems to work here as well?

Would you use if statements for the buttons that change depending on li.lastfm_mode? I am trying with that, but if I use your method in "on_size" I get messages that buttons don't exist if I am in another mode, and if I just use b.update() the buttons doesn't update when I change lastfm_mode...

Then I placed text here: I would want it to be clickable, and I also wonder how I could get the header...
Code: [Select]
function on_paint(gr) {
p.draw_background(gr);
p.right_text(gr,"("+header+")", gdi.Font("Segoe UI", 8,0), p.textcolour_hl, 80, -3, b.w, 24);

I tried with this:
Code: [Select]
if   (li.lastfm_mode == 0) {header = artist;}
else if   (li.lastfm_mode == 1) {header = album;}
else if   (li.lastfm_mode == 3) {header = "title";}

Both inside the b.update function and above it (of course defining artist and so on above it) but neither way gives correctly updated info to on_paint...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-16 14:46:45
you told me to use "b.buttons.name.x =" in on_paint for panel size dependent buttons. Is it bad to just use b.update() there? You used that in your tutorial and it seems to work here as well?


damn it, you just made me realise i fudged up some my customisation page. it's not too serious but there is a bit of bad practice there. i need to tidy it up.

as for your script, just bundle it up with all the images and i'll fix it. i'll add some comments like before because it's easier than trying to explain formally.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-16 15:16:35
Like this?
Saw you using dropbox but didn't use it myself before.

Sorry about the messy code, hope you understand what I am trying to do. I am trial and erroring mostly...

edit: https://www.dropbox.com/s/rmz7hcy6dd1akf0/t.zip?dl=0 (https://www.dropbox.com/s/rmz7hcy6dd1akf0/t.zip?dl=0)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-16 17:54:58
^i'll take a look at that later.

@falstaff, i've noticed your latest JSplaylist uses the UI colours for the settings panel now but i don't think you've tested it on columns UI?

(https://dl.dropboxusercontent.com/u/22801321/2015/february/settings.png)

with default UI, i notice even the dark colour schemes from the presets have white backgrounds for the text input box but this does not. also, there is no contrast colour on the column "list box".

here's .cfg file if you want to take a look: https://dl.dropboxusercontent.com/u/2280132...columns.dll.cfg (https://dl.dropboxusercontent.com/u/22801321/2015/february/foo_ui_columns.dll.cfg)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-16 21:15:03
^i'll take a look at that later.


Thanks. I'll upload a new version with the right buttons and so on soon so don't start before that

Ah, it's the same link. Now all buttons work the way they should and from what I've seen they get updated correctly all the time when I switch focus or lastfm_mode.
Only thing is the images don't get removed when I switch mode.
And then the other thing is the text, which I'd like to be clickable and updated the same way as the buttons. I get errors when I try to draw the text inside the b.update function...
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-16 23:03:51
@falstaff, i've noticed your latest JSplaylist uses the UI colours for the settings panel now but i don't think you've tested it on columns UI?


arf, that's it 

done to quickly, will try to fix that tomorrow, thanx for reporting.

EDIT: but, you are using v1.2.2 ??? i've posted a v1.2.3 after your post and normally it's fixed ... btw still not tested under CUI for now
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-17 01:52:02
1.2.3 is better but now i have a little problem using custom colours. i'd rather not use custom colours but i have to because your highlight text colour on a dark theme is black.

this screenshot is with custom colours off....

(https://dl.dropboxusercontent.com/u/22801321/2015/february/default%20js%20playlist.png)

if i enable custom colours to fix the playlist then it breaks the list box display in the settings panel.

(https://dl.dropboxusercontent.com/u/22801321/2015/february/custom%20js%20playlist.png)
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-02-17 07:11:26
falstaff

In marc2003 artreader script is very usefull option.  We can crop, stretch or center album art image.

It's possible apply this to album art (as wallpaper) in your very nice script.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-17 07:26:30
@marc2003

can you show me you custom colors settings please (the 5 ones) and you CUI colors settings ?

@piv

i don't want that, for me crop is the only way for the wallpaper (stretch: no comment, and center: empty bars on the sides of the image, nope)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-17 10:31:52
@marc2003

let fall, i've done a change (v1.2.4) to use specific colors pour listbox as done for textbox, that will fix all the color problems (normally)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-17 10:42:04
here are my custom colours

i've set that to white and turned off custom colours which fixes the playlist issue in my first screenshot above. now there is the minor issue of the listbox but i can live with it as it is...

(https://dl.dropboxusercontent.com/u/22801321/2015/february/listbox.png)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-17 11:57:09
here are my custom colours

i've set that to white and turned off custom colours which fixes the playlist issue in my first screenshot above. now there is the minor issue of the listbox but i can live with it as it is...

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-17 14:46:34
tres bien. merci beaucoup. 
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2015-02-17 21:59:45
Hi,

I can't seem to figure out how to get this to work:
With this code:
Code: [Select]
function getTags(tagName){
  var tagValuesCount = fb.TitleFormat('$meta_num('+tagName+')');
  return tagValuesCount
};
fb.trace(getTags(CustomTag));


I get this error:
'CustomTag' is undefined.

The problem lies in the quotes I think.
With the quotes I don't get an undefined error , but also no result.
Without the quotes it's the undefined error.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-17 22:14:42
you need to use either Eval() or EvalWithMetadb on your titleformat function. you need to use eval if you want dynamic values from the playing track like playback time, bitrate or artist/title from streams

Code: [Select]
var tagValuesCount = fb.TitleFormat('$meta_num('+tagName+')').Eval();


if you only want static data from the playing item or perhaps the selected track, you use this...

Code: [Select]
var metadb = fb.GetNowPlaying(); //or
var metadb = fb.GetFocusItem();
var tagValuesCount = fb.TitleFormat('$meta_num('+tagName+')').EvalWithMetadb(metadb);
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2015-02-18 08:29:52
you need to use either Eval() or EvalWithMetadb on your titleformat function. you need to use eval if you want dynamic values from the playing track like playback time, bitrate or artist/title from streams

Code: [Select]
var tagValuesCount = fb.TitleFormat('$meta_num('+tagName+')').Eval();


if you only want static data from the playing item or perhaps the selected track, you use this...

Code: [Select]
var metadb = fb.GetNowPlaying(); //or
var metadb = fb.GetFocusItem();
var tagValuesCount = fb.TitleFormat('$meta_num('+tagName+')').EvalWithMetadb(metadb);


I tried both codes, but it still give me an undefined error.

When You use $meta_num normally in fb2k , you don't have to use % in that.
So no $meta_num(%tag%) but $meta_num(tag).
Well, when I want to check if the artist tag has multiple values in WSH,
I have the problem that when I call the function getTags(artist), WSH sees artist as an undefined variable.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-18 08:40:27
these 4 lines of code in a fresh panel work fine.

Code: [Select]
var tagName = "artist";
var metadb = fb.GetFocusItem();
var tagValuesCount = fb.TitleFormat('$meta_num('+tagName+')').EvalWithMetadb(metadb);
fb.trace(tagValuesCount);


or

Code: [Select]
fb.trace(fb.TitleFormat("$meta_num(artist)").EvalWithMetadb(fb.GetFocusItem()));
Title: WSH Panel Mod script discussion/help
Post by: r3v0 on 2015-02-18 08:54:19
these 4 lines of code in a fresh panel work fine.

Code: [Select]
var tagName = "artist";
var metadb = fb.GetFocusItem();
var tagValuesCount = fb.TitleFormat('$meta_num('+tagName+')').EvalWithMetadb(metadb);
fb.trace(tagValuesCount);


or

Code: [Select]
fb.trace(fb.TitleFormat("$meta_num(artist)").EvalWithMetadb(fb.GetFocusItem()));


Thanks for the quick response.

You're right it does work.
Thanks
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-19 21:47:03
marc2003: The musicbrainz script crashes now and then for me. I set it to follow cursor instead of now playing, and it usually crashes when I click on many different artist in a short time. I didn't see any crashes when I tested setting it to follow now playing... The message is "common8.js Ln: 2348, Col: 5 <source text only available at compile time>" If I reload the panel it works again. I have updated the script and use your version of the component.

I also thought it would be nice to group releases... For me it would be best to group studio albums on top, and then still show other types below. Look for instance at Pearl Jam, just lots of live albums . But you might still want to show the type, especially for some other artists.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-20 00:37:29
i can't seem to reproduce that bug but i think it's a good idea to prevent lots of requests when switching artists quickly so i'll look at doing something about that.

i did take a look at pearl jam and that's a ridiculous amount of live albums.  grouping would be nice but i'm notoriously lazy. in the meantime you can just hide them temporarily using the right click menu.

(https://dl.dropboxusercontent.com/u/22801321/2015/february/pj.png)
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-02-20 05:33:35
2Falstaf

You recommend clear the WSH panel properties after upgrade your script.
All columns defined by me  are lost for me and I must re-create them.
It is possible add import/export columns definition?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-20 14:42:46
@sylla, i've still not been able to reproduce that musicbrainz bug but can you try this. you'll need to save it in your marc2003 folder manually.

https://dl.dropboxusercontent.com/u/2280132...temp/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common8.js)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-20 15:05:04
marc2003: I click like a maniac but can't reproduce it with that either... Although I found it a bit random when it crashed before... I'll let you know if it crashes again

And regarding the grouping idea. I know I can disable some groups, but then there are artists where for instance live albums are essential and so you'd want them shown. Of course a minor thing, but yeah I think it would be a nice feature.

Is the album art downloader link in the now playing script supposed to have any preference for download folder? At first I thought it did but had problem to update correctly, but it seems it wants to save to the same folder it saved to the time before?
Don't know if it's the standard, but I think it's nicer to save as folder.jpg in the same folder as the tracks, is it possible to get that through a wsh_panel? My foo_run script looks like this:
"C:\Program Files\AlbumArtDownloader\AlbumArt.exe" /ar "%artist%" /al "%album%" /p "$replace(%path%,%filename_ext%,)folder.jpg"
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-20 15:25:25
yeah, i probably should have done that before. i'll add a dialog where you can set your own custom parameters - i don't want to fix a path/filename that all people aren't going to happy with. for instance, i use cover.jpg because i don't trust those evil bastards* at microsoft not to overwrite my lovely images.


*i do like their products for the most part. it's just WMP that is the spawn of satan.
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-20 16:20:17
yeah, i probably should have done that before. i'll add a dialog where you can set your own custom parameters - i don't want to fix a path/filename that all people aren't going to happy with. for instance, i use cover.jpg because i don't trust those evil bastards* at microsoft not to overwrite my lovely images.


*i do like their products for the most part. it's just WMP that is the spawn of satan.


Ok, nice. Yeah I prefer foobar2000 and mpc-hc too.

The musicbrainz panel crashed again just now with the same message. Hm, the only thing I can say more is that I use facets to browse, and it's when I click thorugh the list in a certain tempo that it happens. Maybe it's some millisecond when it searches that it doesn't want to be disturbed?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-20 16:36:10
this crash happened with the test version? you did copy the file when foobar was closed or at least reloaded the panel?

edit: i've just thought of something else to try. re-download that same file and try it....

https://dl.dropboxusercontent.com/u/2280132...temp/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common8.js)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-20 16:42:10
Alright, yes I had restarted the program. I'll report back if it crashes again with this new version.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-20 22:48:17
@falstaff, i've found a bad example of code in your WSHplaylist.js file on line 324. it seems you're creating a new font object inside a function called from on_paint which is bad edit: not recommended according to the panel notes. what makes this worse is that this is inside a loop.

Code: [Select]
gr.GdiDrawText(tf2, gdi.Font(g_fname, g_fsize - 1, g_fstyle), blendColors(this.text_colour, RGB(0,0,0), 0.25), cx, tf2_y, cw, tf2_h, p.headerBar.columns[j].DT_align | DT_CALCRECT | DT_TOP | DT_END_ELLIPSIS | DT_NOPREFIX);

Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-21 13:20:01
Falstaff,

I'm getting an easily reproducible crash in CoverFlow with latest WSH mod from marc2003. Right clicking on the panel throws out error message below.

Code: [Select]
WSH Panel Mod (CoverFlow View v1.4.3 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Line: 3578, Col: 5
<source text only available at compile time>
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-21 13:39:58
if it only happens when right clicking then it will be related to this...

Quote
- CHG: AppendMenuItem no longer accepts MF_POPUP as a flag. You should be using AppendTo instead.


an example of how to update the code can be found in one of my posts from 2011.

http://www.hydrogenaud.io/forums/index.php...mp;#entry775186 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=1200&p=775186&#entry775186)



Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-21 14:16:31
Except that still causes the same crash.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-21 14:22:43
you obviously didn't replace the code properly or there is more than one instance of the old code which would report a different line number when it crashes.

if what i posted didn't work, all my own scripts would crash including this one which has 9 sub-menus.

(https://dl.dropboxusercontent.com/u/22801321/2015/february/right.png)

Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-21 14:32:58
you obviously didn't replace the code properly or there is more than one instance of the old code which would report a different line number when it crashes.

if what i posted didn't work, all my own scripts would crash including this one which has 9 sub-menus.


Obviously, one line of code pasting is beyond me. 

Still crashes. I'll just revert back to the WSH panel mod that worked I guess.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-21 14:38:51
you can't just overwrite what was there with what i posted. it was an example and you must use the variable names/strings from the original script. anyway, sounds like going back to the original component is the best plan.

for anyone else...

old:
Quote
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _child.ID, "Background");


new:
Quote
_child.AppendTo(_menu, MF_STRING, "Background");


the bits in red must be from the original script.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-21 14:48:00
Falstaff,

I'm getting an easily reproducible crash in CoverFlow with latest WSH mod from marc2003. Right clicking on the panel throws out error message below.

Code: [Select]
WSH Panel Mod (CoverFlow View v1.4.3 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Line: 3578, Col: 5
<source text only available at compile time>


i'll release an update soon
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-21 15:19:15
marc2003: It crashed again. Well if it only crashes for me it doesn't matter. Maybe it has something to do with musicbrainz, as none of your other scripts crashes. I use now playing, similar, and allmusic review.

But did you have time to check this out? https://www.dropbox.com/s/rmz7hcy6dd1akf0/t.zip (https://www.dropbox.com/s/rmz7hcy6dd1akf0/t.zip)
Just want the text to update to f.e %artist% and be clickable, and then for the buttons in if statements to update when panel mode changes.
Probably did something in the wrong way there, but it works.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-21 15:47:49
i'm not looking at that. you commented out some of the stuff i put in for very good reason in to the last script.

as for the musicbrainz thing, i can prevent it crashing. it will just update the console saying fetched data may be incomplete. i'll add that later along with a dialog for AAD parameters.

edit: fix for musicrbrainz applied. just right click>Update script.

full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)
docs: http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)
Title: WSH Panel Mod script discussion/help
Post by: sylla on 2015-02-21 17:26:59
Ok. Well I'm fully aware I don't know what I was doing. I was trying out many different ways to get the buttons to update correctly, and finally, that seemed to work. It didn't work with the other stuff in it, thought it had to do with the if-statement.
I hope it doesn't break anything? Then I will use that version and forget about the idea with clickable text which I thought would be a nice thing but it's fine with another button instead.
Thanks for the help anyways. You gave me enough before that I should probably be able to solve these things myself, it's just that it goes very slow and thought my questions would have easy answers (which I couldn't find with google).
Well if they don't, I understand you.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-02-21 17:29:50
I want to get now playing song's info from Wikipedia page like in your Wikipedia Bio script (ex:http://en.wikipedia.org/wiki/First_Time_(Lifehouse_song))
But i noticed that the title of Wikipedia page is not always the same (It's not %title% or %title% - %artist%)
But searching in Google  "%title% - %artist%" and getting first result from Wikipedia site always seems to work
Is this kind of thing possible ??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-21 20:19:26
the reason my wikipedia bio script gets the right page (for the most part) is because i use a 3rd party website (theechonest.com) which is built entirely around gathering information about music. that's also the reason why it's only available in english.

what you're thinking about should be possible. to actually do it, i suggest you google it.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-02-22 15:14:44
the reason my wikipedia bio script gets the right page (for the most part) is because i use a 3rd party website (theechonest.com) which is built entirely around gathering information about music. that's also the reason why it's only available in english.

what you're thinking about should be possible. to actually do it, i suggest you google it.

I was able to get the Wikipedia page URL editing  Mire777 Biography Photos script, so if it's not too much trouble for you
can you please tell me what functions to use/edit in your common8.js to parse this URL and getting it's text to a wsh panel.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-22 17:32:57
WSH CoverFlow updated!

[Change Log]
* 2015-02-22 : v1.5.0 >> updating repaint system + shading effect + now compliant with latest WSH Panel Mod version 1.5.7.1
[/Change Log]

link (http://fav.me/d4t4lh7)

(http://i.imgur.com/AbgdCnm.jpg) (http://imgur.com/AbgdCnm)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-22 18:50:35
WSH CoverFlow updated!


\o/

Thanks.
Title: WSH Panel Mod script discussion/help
Post by: maxim7191 on 2015-02-22 20:01:47
Falstaff
about this change in last version version of JSPlaylist: "type what your search now binded with group by pattern (not only artist by default)"

I can still only search for artist, not for album, even know %album% presents in default "group by" pattern. Maybe I'm doing something wrong - Im not sure

Maybe options to disable or enable typing search for "artist", "album", "title" individually would be better?
I want to search songs by typing its title, but dont want to group by title.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-22 21:39:27
@samithaj, i can't be bothered with the customising help any more. you're on your own if you want to hack away.

i'll still be supporting my scripts so if anyone wants me to squish bugs, they need to report them. and i'll still help people out with their own little code snippets so long as they ask precise questions about specific functions rather than vague concepts such as how do i make a script to.....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-24 22:35:16
samples updated. existing users can right click>Update script.

artreader and cd jewel case. you can now customise the command line arguments sent to Album Art Downloader when launching it from the right click menu.

full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)
overview/installation notes: http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-25 17:06:57
marc2003 -

In one one of your older YF configs (one previous to current iirc) you had the ability to trigger a playlist menu via r-click on menu icon. Could that same r-click action call up a WSH panel in the same location? Not sure if that's possible but have an idea I'd like to explore if it can be done.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-25 19:36:56
Could that same r-click action call up a WSH panel in the same location?


i have no idea what you mean by this?? 

but what you can do is run any code/function you like. as the code is in the panel itself, it should be easy to enough to find and pick apart to see how it works.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-25 20:04:19
i have no idea what you mean by this??

Essentially replace...

Code: [Select]
function on_mouse_rbtn_up(x, y) {
    _menu = window.CreatePopupMenu();
    _menu.AppendMenuItem(MF_GRAYED, 9, "Playlists");
    for (i = 0; i < plman.PlaylistCount; i++) {
        _menu.AppendMenuItem(MF_STRING, i + 10, (i == plman.ActivePlaylist ? ">" : "") + plman.GetPlaylistName(i) + " (" + plman.PlaylistItemCount(i) + ")");
    }
    
etc.


Popup menu with a WSH panel in its place.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-25 20:17:04
Popup menu with a WSH panel in its place.


this makes no more sense to me than your original post. can somebody translate? 

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-25 20:35:52
I personnaly understand he wants a WSH panel that mimics a popup menu when you right click to a location in the parent WSH panel...
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-25 20:53:59
I personnaly understand he wants a WSH panel that mimics a popup menu when you right click to a location in the parent WSH panel...


Precisely. Though thinking about it, it may be better served with a separate splitter/button combo instead. The idea was to maybe transplant your WSH playlist manager (from DUITunes) into a panel there to free up one of the spots on another switchable panel elsewhere.

Guess I'll look at some other configs to see how they implemented 'floating' panels instead.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-25 21:03:47
marc2003 -

In one one of your older YF configs (one previous to current iirc) you had the ability to trigger a playlist menu via r-click on menu icon. Could that same r-click action call up a WSH panel in the same location? Not sure if that's possible but have an idea I'd like to explore if it can be done.


can be done easily but with a great restriction compared to popup menus! popup menu can be display out of the window, on "wsh-popup panel" won't, so can be great for some specific usage but not always possible
for example, it's great to adjust volume, or a rating engine ...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-25 21:30:54
Guess I'll look at some other configs to see how they implemented 'floating' panels instead.


i'm pretty sure they use panel stack splitter to position panels over each other. i've never experimented with that myself. you can of course mimic any behaviour you like in a single panel if it's big enough. the problem with the example you posted previously was that it was a single button in a panel something like 24x24px in size.

also, samples updated. i fixed a silly bug that no one has noticed/encountered for 5 years...

any script that uses an input box would have it's existing value mangled if it contained double quotes and the user clicked cancel. i guess no one has done this? 

anyway, it can be fixed by right clicking>Update script. mangled values would have to be fixed manually though. holding shift, right clicking the panel>properties and deleting the offending value would reset the default.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-25 23:29:42
Guess I'll look at some other configs to see how they implemented 'floating' panels instead.


i'm pretty sure they use panel stack splitter to position panels over each other. i've never experimented with that myself. you can of course mimic any behaviour you like in a single panel if it's big enough. the problem with the example you posted previously was that it was a single button in a panel something like 24x24px in size. 


That's what's happening I think. MNLT (config) has a playlist manager triggered by a button and it's just placed strategically in the layout. It shouldn't be too hard to mimic that.

EDIT: I think I can hack that into my main config now that Ive poked around with it a little.

http://i.imgur.com/9YJlF7u.png (http://i.imgur.com/9YJlF7u.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-26 00:19:29
are you not using JSplaylist? that has a playlist manager built in. just click the middle mouse button to toggle it on/off.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-26 00:32:19
Not in my CUI config. Yet... It's getting there but I still find it hard to layout just the way I want it. I have several portable DUI configs I've been testing it in and I like it in that respect. Just not in my main CUI setup.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-26 18:36:01
JSPlaylist v1.3.0 released

>> now you can choose default groups status (collapsed/expanded) per group pattern + scroll touch control option added + many bugs fixed especially one that make crash panel on expanding groups in some case + now you can draw part of column text (TF) with different colors, $rgb(r,g,) function support added + misc changes and optimizations ...

(http://i.imgur.com/M6Zxs6A.png) (http://imgur.com/M6Zxs6A)

link (http://fav.me/d8fiumu)

Title: WSH Panel Mod script discussion/help
Post by: blonde on 2015-02-26 18:44:10
Awesome.  Thanks!! Can't wait to try it.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-27 00:14:09
Figured out the floating panel.

http://imgur.com/a/JECwM (http://imgur.com/a/JECwM)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-27 18:01:33
JSPlaylist v1.3.1 released

>> touch screen behaviour updated, now the track selection do not change while scrolling the list + font size increased in group headers

link (http://fav.me/d8fiumu)

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-27 21:38:16
^are you going to buy me a touch screen so i can test it? 
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-02-28 07:42:17
Falstaff
$rgb function is great!
Nevertheless, the following improvements are required - when the line of playlist is highlighted or selected, the effect $rgb() function lost. All text in this case colored in selected (highlighted) color.
Compare - in Esplaylist (foo_uie_esplaylist) colored part of text displayed in all line of playlist.

It is possible correct this thing?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-02-28 08:15:21
^nothing to correct as it's not a bug, it is as i want it because it's the best rendering way for me, but i can be wrong as you
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-28 21:09:57
marc2003-

Is there a way to specify a hover image for the menu script of your Oct. revision of yuckfoo? It's running common7.js in case that matters.

I'm looking at this in the script file but maybe I need to look somewhere else?

Code: [Select]
b.buttons.menu = new button(3, 3, 20, 20, {normal: "menu.png",}, function() { menu(); }, "Menu")


Not sure if I can just add a menu_h.png option in there somewhere.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-02-28 21:23:21
Code: [Select]
b.buttons.menu = new button(3, 3, 20, 20, {normal: "menu.png", hover: "menu_h.png"}, function() { menu(); }, "Menu")


Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-02-28 21:33:47
Heh. Always amazes me at how simple solutions are. I was trying to add hover in its own set of curly brackets. Thanks again.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-01 00:43:18
JSPlaylist v1.3.0 released



Previous versions automatically jumped to/highlighted the now playing track. How can I enable this again?

thanks!
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-03-01 09:52:35
Previous versions automatically jumped to/highlighted the now playing track. How can I enable this again?
thanks!


nothing has changed, tell me with more details when it has to follow now playing track and i may tell you what you are doing wrong

but it's certainly due to the default foobar2000 option in menu "Playback" > check you have ticked "Playback follows cursor" and "cursor follows Playback", without these, you got what you discribe
so it's no due to JSplaylist but to your own foobar2000 options
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-03-01 14:36:15
Could anyone please help me with a piece of Tedgo's Darkone V4 script? On the display panel, I need to move two "icons" 20 spaces to the left (same height). These are for the STOP A.C and PB. ORDER functions. When I change the values to move the icons, they don't render properly or at all. There are no other graphics in the path of these icons.

Original code:

g_alpha = g_fact == 0.09 ? 20 : 7;
s_alpha = fb.StopAfterCurrent ? 255 : g_alpha;
g_signs && gr.DrawImage(g_signs, ww - 18, 21, 18, 12, 648, d_col * 22, 18, 12, 0, s_alpha);

p_alpha = fb.IsPlaying ? 255 : g_alpha;
g_signs && gr.DrawImage(g_signs, ww - 18, 38, 18, 12, 668 + fb.PlaybackOrder * 20, d_col * 22, 18, 12, 0, p_alpha);

I need this:

g_alpha = g_fact == 0.09 ? 20 : 7;
s_alpha = fb.StopAfterCurrent ? 255 : g_alpha;
g_signs && gr.DrawImage(g_signs, ww - 38, 21, 18, 12, 648, d_col * 22, 18, 12, 0, s_alpha);

p_alpha = fb.IsPlaying ? 255 : g_alpha;
g_signs && gr.DrawImage(g_signs, ww - 38, 38, 18, 12, 668 + fb.PlaybackOrder * 20, d_col * 22, 18, 12, 0, p_alpha);
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-01 17:33:16
you're looking at the wrong bit of code entirely. try modifying the values of these on line 389...

Code: [Select]
    Buttons.sac.changePos(Math.max(0, ww / 2 - 226), 53, 58, 14);
    Buttons.pbo.changePos(Math.max(0, ww / 2 - 226), 90, 58, 14);

also, the text labels will need moving inside the on_paint function.
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-03-01 22:06:32
you're looking at the wrong bit of code entirely. try modifying the values of these on line 389...

Code: [Select]
    Buttons.sac.changePos(Math.max(0, ww / 2 - 226), 53, 58, 14);
    Buttons.pbo.changePos(Math.max(0, ww / 2 - 226), 90, 58, 14);

also, the text labels will need moving inside the on_paint function.


Thanks for the reply but I think you misunderstood. I'm talking about the little images inside the display panel. Not the buttons outside the display panel. The little images are on the right hand side and are blue. One lights up when you select Stop A.C. The other is for the shuffling (seven different images). These images can't be moved from their current positions. They can only reside in there specific spots.

Sorry if I wasn't more specific.

EDIT... Never mind, I figured it out.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-01 22:26:02
ah sorry about that.

having looked the correct part (i hope), then i'd have to disagree with this part of your original post.

Quote
There are no other graphics in the path of these icons.


(http://i.imgur.com/9Z8jbA9.png)

you need to move or remove the bitrate display and the very faint background dots.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-01 22:33:12
Another button hover question for you, marc.

Your simple playback buttons - unable pull that trick off from above in a test mule. Not available/included? Using common8.js version this time.

I'd like to ditch ExtremeHunters Cattrox script so it's available to anyone via your scripts.

EDIT: Here's an example with the stop button being hovered upon.

https://i.imgur.com/Rmwv96e.png (https://i.imgur.com/Rmwv96e.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-01 23:08:56
if you look inside the playback buttons.txt file that comes with my latest samples, there are instructions that show you need to create image objects rather than just use the filename when creating your buttons.

Quote
//if you want to change the images, uncomment these lines below and modify the paths accordingly
//do not use fb.FoobarPath here as fb.ProfilePath already points to the same location if using portable mode
//b.images.stop = gdi.Image(fb.ProfilePath + "my_theme\\images\\stop.png");
//b.images.play = gdi.Image(fb.ProfilePath + "my_theme\\images\\play.png");
//b.images.pause = gdi.Image(fb.ProfilePath + "my_theme\\images\\pause.png");
//b.images.previous = gdi.Image(fb.ProfilePath + "my_theme\\images\\previous.png");
//b.images.next = gdi.Image(fb.ProfilePath + "my_theme\\images\\next.png");


so you can just add your own hover image...

Code: [Select]
b.images.stop_h = gdi.Image(fb.ProfilePath + "path\\to\\stop_h.png");


you can use p.ip in place of fb.ProfilePath + "marc2003\\images8\\" if you need to.

then you can use it when creating your button...

Code: [Select]
new button(0, 0, bs, bs, {normal: this.images.stop, hover: this.images.stop_h}, function() { fb.Stop(); }, "Stop"),
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-01 23:13:51
I did use them...

As usual, I'm still trying to suss out the nuances of what can be done here but sometimes with no example it means I ask a lot of dumb questions.

Thanks, btw. This has been added to the long list of stuff to remember 'just in case'.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-01 23:40:25
well if you figured the first part out, i don't know how you got stuck. the actual normal/hover part of the button is exactly the same as before.

but yes, it could be documented better but there is nothing i despise more than trying to write up what i've done. to think some people write documentation for a living. urgh. 
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-02 00:25:19
One more thing to annoy you with! How the hell do you murder tips? Ugh...they gotta go.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-02 00:35:55
replace "Stop" with ""  etc
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-03-02 08:59:55
you're looking at the wrong bit of code entirely. try modifying the values of these on line 389...

Code: [Select]
    Buttons.sac.changePos(Math.max(0, ww / 2 - 226), 53, 58, 14);
    Buttons.pbo.changePos(Math.max(0, ww / 2 - 226), 90, 58, 14);

also, the text labels will need moving inside the on_paint function.


Thanks for the reply but I think you misunderstood. I'm talking about the little images inside the display panel. Not the buttons outside the display panel. The little images are on the right hand side and are blue. One lights up when you select Stop A.C. The other is for the shuffling (seven different images). These images can't be moved from their current positions. They can only reside in there specific spots.

Sorry if I wasn't more specific.

EDIT... Never mind, I figured it out.



Yeah, I have redesigned the display panel and in my version there was nothing else in the way. What I missed were another set of values in the WSH panel. Once I set them correctly, the images displayed correctly.

Thanks for taking the time to help.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-03 12:52:56
Is there is a function for play or enqueue  a specific song from my library when i give %artist% %title%??
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-03-03 13:13:38
Is there is a function for play or enqueue  a specific song from my library when i give %artist% %title%??


void AddItemToPlaybackQueue(IFbMetadbHandle);

check documentation Interfaces.txt
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-03 15:09:51
@falstaff, thanks for your latest updates.

as you may know, i've been posting a mod with last.fm support so people can use your mood column to love/unlove tracks on last.fm. i've just thought of a really easy way you could build it in to save me doing it on each update. simply detect to see if the mood column title formatting contains this string: %lastfm_loved_db% - this is something the user can set themselves through the panel settings.

this is your current code for writing mood tags (starts on line 1364 WSHplaylist.js 1.3.2b3)

Code: [Select]
// Mood
if (this.tracktype < 2) {
    // tag to file
    if (this.l_mood != this.mood) {
        if (this.metadb) {
            var bool = this.metadb.UpdateFileInfoSimple("MOOD", getTimestamp());
            this.mood = this.l_mood;
        };
    }; else {
        var bool = this.metadb.UpdateFileInfoSimple("MOOD", "");
        this.mood = 0;
    };
};


you could replace it with this meaning original behaviour is retained for people who leave the column title formatting alone.

Code: [Select]
if (SOME_VARIABLE_CONTAINING_MOOD_COLUMN_TF.toLowerCase().indexOf("%lastfm_loved_db%") > -1) {
    window.NotifyOthers("love", this.metadb);
} else {
    // Mood
    if (this.tracktype < 2) {
        // tag to file
        if (this.l_mood != this.mood) {
            if (this.metadb) {
                var bool = this.metadb.UpdateFileInfoSimple("MOOD", getTimestamp());
                this.mood = this.l_mood;
            };
        }; else {
            var bool = this.metadb.UpdateFileInfoSimple("MOOD", "");
            this.mood = 0;
        };
    };
}


edit: of course you might not want to and that's fine. i already make my own mods but i thought it would be easier for other users.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-03 15:51:54
Is there is a function for play or enqueue  a specific song from my library when i give %artist% %title%??


void AddItemToPlaybackQueue(IFbMetadbHandle);

check documentation Interfaces.txt

Oh it's in the component folder
I've been looking for documentation at the wrong place (https://code.google.com/p/foo-wsh-panel-mod/source/browse/extras/interface.api?r=08762f3fea9b42b99934185ab8de3278870d09f0) the whole time :/
Thank u soo much @Falstaff
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-03 16:00:25
edit: of course you might not want to and that's fine. i already make my own mods but i thought it would be easier for other users.

This would be much appreciated @Falstaff. It will make whole lot of easier by not having  to replace the code every time your playlist got an update.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-04 03:41:27
samples updated - bug fix for my simple volume script. it should have responded to mouse click events but it only worked when you clicked and dragged. this has now been fixed.

existing users, right click>Update script.
new users can check my script overview/installation instructions here: http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-06 12:26:41
samples updated

Marc, I've experienced an on-going issue with your thumbs script (probably since common3.js through common8.js)

Very often when I wake my PC from sleep, a panel using the thumbs script will be rapidly cycling thumb images until I reset the panel by right-clicking, and opening and closing the configure window. Once I do that, if I have another instance of the thumbs panel, it will start rapidly cycling images until I reset it.

The larger issue is that when it is doing this, Foobar is hogging processes and other WSH scripts are affected - Falstaff's playlist for example will not respond correctly (e.g. won't scroll).

Anyone else experience this? and any tips towards debugging this?

Code: [Select]
Core (2014-04-11 09:51:08 UTC)
    foobar2000 core 1.3.2
foo_albumlist.dll (2014-04-11 09:49:46 UTC)
    Album List 4.5
foo_audioscrobbler.dll (2011-08-18 21:01:03 UTC)
    Audioscrobbler 1.4.7
foo_bpm.dll (2015-03-01 03:39:58 UTC)
    BPM Analyser 0.2.4.6
foo_burninate.dll (2013-02-07 18:02:37 UTC)
    Audio CD Writer 3.0.3
foo_cdda.dll (2014-04-11 09:49:18 UTC)
    CD Audio Decoder 3.0
foo_chronflow.dll (2015-03-01 03:36:07 UTC)
    Chronial's Coverflow 0.4.1
foo_converter.dll (2014-04-11 09:49:20 UTC)
    Converter 1.5
foo_discogs.dll (2015-03-01 03:39:58 UTC)
    Discogs Tagger 1.52
foo_dsp_effect.dll (2015-03-01 03:39:59 UTC)
    Effect DSP 0.15
foo_dsp_eq.dll (2014-04-11 09:49:32 UTC)
    Equalizer 1.0
foo_dsp_std.dll (2014-04-11 09:49:24 UTC)
    Standard DSP Array 1.3
foo_echonest.dll (2015-03-01 03:35:02 UTC)
    Foobar - EchoNest 0.2.1 Alpha
foo_facets.dll (2011-08-27 18:05:16 UTC)
    Facets 1.0
foo_fileops.dll (2014-04-11 09:49:06 UTC)
    File Operations 2.2.1
foo_freedb2.dll (2014-04-11 09:49:24 UTC)
    Online Tagger 0.7
foo_input_std.dll (2014-04-11 09:51:10 UTC)
    Standard Input Array 1.0
foo_jesus.dll (2010-09-23 00:34:06 UTC)
    Autosave & Autobackup 10
foo_navigator.dll (2010-03-02 08:43:15 UTC)
    Navigator 0.64
foo_playcount.dll (2011-07-13 10:47:18 UTC)
    Playback Statistics 3.0.2
foo_queuecontents.dll (2012-09-27 17:34:40 UTC)
    Queue Contents Editor 0.5.1
foo_random_pools.dll (2015-03-01 03:39:59 UTC)
    Random Pools 0.1.4
foo_rgscan.dll (2014-04-11 09:49:26 UTC)
    ReplayGain Scanner 2.2.1
foo_run.dll (2012-07-05 15:59:41 UTC)
    Run services 0.3.7
foo_seek.dll (2012-11-08 15:48:53 UTC)
    Seek 1.1
foo_simplaylist.dll (2011-08-18 19:01:36 UTC)
    SimPlaylist 1.0
foo_textdisplay.dll (2011-08-18 21:01:03 UTC)
    Text Display UI Element 1.1 beta 1
foo_texttools.dll (2013-01-12 21:03:39 UTC)
    Text Tools 1.0.5
foo_ui_std.dll (2014-04-11 09:51:08 UTC)
    Default User Interface 0.9.5
foo_uie_albumart.dll (2007-12-15 22:22:24 UTC)
    Album Art Panel 0.2.7.1
foo_uie_biography.dll (2010-12-11 06:47:22 UTC)
    Biography View 0.4.2.4
foo_uie_esplaylist.dll (2011-05-28 22:06:46 UTC)
    EsPlaylist 0.1.3.9
foo_uie_library_tree.dll (2011-07-24 16:08:24 UTC)
    Library Tree 0.3.4.6.1
foo_uie_lyrics3.dll (2015-03-01 03:39:59 UTC)
    Lyric Show Panel 3 0.4.5
foo_uie_wsh_panel_mod.dll (2013-08-06 19:07:56 UTC)
    WSH Panel Mod 1.5.6
foo_verifier.dll (2015-03-01 03:39:59 UTC)
    File Integrity Verifier 1.1.2
foo_vis_vumeter.dll (2013-02-16 09:44:26 UTC)
    VU Meter 2013-02-16
foo_wave_seekbar.dll (2015-03-01 03:39:59 UTC)
    Waveform seekbar 0.2.45
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-06 18:23:47
the behaviour you're reporting is pretty horrific. no normal person would tolerate that so i do have to question your sanity....

now obviously i've never encountered anything like that before and i'm pretty sure no one else has. or if they did but couldn't be bothered to report it, they did the sensible thing and just removed it thinking what a load of crap that is...
Title: WSH Panel Mod script discussion/help
Post by: bulletproof2k on 2015-03-06 23:03:22
Hello!
marc2003 Where can I get the old version of the image buttons heart for the last.fm?
thank you
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-03-07 09:48:00
Code: [Select]
$imagebutton($get(btn.l),101,58,14,%do.images%\SmallNormal.png,%do.images%\SmallHover.png,SETGLOBAL:do.display.switch:$ifequal(%do.display.switch%,1,2,1);REFRESH)

Can anyone help me with this line in Tedgo's Darkone V4 skin? I need to move this button a few spaces to the right but there are no right and left options. Just up and down and image resize.

Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-03-07 13:17:30
I think I solved the above. I ended up moving a portion of the panel, which seems to work just as well.

I have another question about scrolling. For simple text, I can instruct how many characters to display. But with scrolling text, it seems to only want to go right across the screen, outside my border. Is there anyway I can prevent that?

Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-07 20:39:26
@bulletproof2k, sorry but i don't keep backups of my old stuff. but i do remember where i got the originals... the larger icons were from the tango icon set..

http://tango.freedesktop.org/Tango_Icon_Library#Download (http://tango.freedesktop.org/Tango_Icon_Library#Download)

the smaller icons were from a set named silk

http://www.famfamfam.com/lab/icons/silk/ (http://www.famfamfam.com/lab/icons/silk/)

@Fizbin, your panel stack splitter ($imagebutton) related questions should not be in this thread. if the scrolling text bit really is WSH panel mod then go and ask the original script author.
Title: WSH Panel Mod script discussion/help
Post by: Jenga on 2015-03-08 05:56:44
Hi,
Can someone help me, I'm trying to get all the songs on the currently playing album into a IFbMetadbHandleList and I've got no clue where to even start. Anyone got any ideas?
Title: WSH Panel Mod script discussion/help
Post by: bulletproof2k on 2015-03-08 09:16:45
marc2003 Thanx 
Title: WSH Panel Mod script discussion/help
Post by: ScribeOfTheMist on 2015-03-08 16:58:20
Falstaff thank you so much for JSPlaylist. I opened iTunes for the first time in years last week, and discovered the album art gradient colorized playlist and knew I must have it for foobar because it was so beautiful. I wasn't sure if I would be able to find someone that already coded a WSH Panel for it, but luckily you have!! Thanks!!!! 
Title: WSH Panel Mod script discussion/help
Post by: ScribeOfTheMist on 2015-03-08 17:28:40
If I may ask something though, would it be possible to have an option for the text color of the "normal text" to dynamically change to be the dominant color of the album art (or its opposite for readability purposes) like iTunes is now doing? I understand if that is too advanced for wsh panel mod, i don't know if it can read the actual image data, but I would very much like to have that feature so I don't feel like I'm missing out by not using iTunes, because this feature of iTunes is the coolest and prettiest thing I've seen in years for music players but I hate everything else about iTunes. So I will keep using foobar no matter what, as I have been doing for 8+ years, but I really want this

Below is an example of what I am talking about. The text dynamically becomes red when focused on this album because red is one of the dominant colors in the artwork image. Ideally I would like a WSH panel script in foobar that acts almost exactly the same as this (in regards to colors, in every other way Falstaff's playlist is vastly superior). But again, not sure if that is possible. I am a coder but I don't know much about WSH panel mod personally.

(http://i.imgur.com/UET8rNT.jpg)
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-08 18:21:55
they did the sensible thing and just removed it thinking what a load of crap that is...


lots of DEV experience, so i guess I have more patience...

I didn't sort that other issue, to be continued once I can consistently reproduce.

I do have a separate question related to an ongoing issue - also with thumbs script.

When I'm displaying artist images, the thumbs will only display if I have my external HD connected (running foobar from the HD).
If I run Foobar over NAS (same HD running from a local portable foobar with mirrored wsh_lastfm+wsh_data folders), for some reason it will not display artist images.

In both instances, esplaylist and Falstaff's playlist display artist images, using these paths in prefs>display settings.

..\foobar2000\wsh_lastfm\$crc32(%artist%)\*.jpg
..\foobar2000\wsh_data\artists\%artist%\*.jpg

(with .. replaced by correct root depending on drive mounting.)

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-03-08 20:16:35
@ScribeOfTheMist

you can get the color scheme of an image with the method GetColorScheme of IGdiBitmap interface, as it is discribe in the WSH PAnel Mod documentation, file Interfaces.txt (that comes in the zip archive of the component)

interface IGdiBitmap {
Properties:
    (readonly) int Width;
    (readonly) int Height;
   
Methods:
    IGdiBitmap Clone(x, y, w, h);
    void RotateFlip(mode);
    IGdiBitmap ApplyAlpha(alpha);
    // Changes will be saved in the current bitmap
    boolean ApplyMask(IGdiBitmap);
    // Create a DDB bitmap from IGdiBitmap, which is used in GdiDrawBitmap()
    IGdiRawBitmap CreateRawBitmap();
    // NOTE: Don't forget to use ReleaseGraphics() after operations on IGdiGraphics interface is done.
    IGdiGraphics GetGraphics();
    void ReleaseGraphics(IGdiGraphics);
    void BoxBlur(radius, iteration = 1);
    // See Flags.txt meanings of modes.
    IGdiBitmap Resize(w, h, interpolationMode = 0);
    VBArray GetColorScheme(max_count);
    void Dispose();
}

I use it to get the dominant color of the cover to fill the back color othe the playlist of the selected album in my WSH Panel Mod that mimics the iTunes 11 ones (album view), you can fin d it here (http://fav.me/d6tpm2l)

HTH
Title: WSH Panel Mod script discussion/help
Post by: ScribeOfTheMist on 2015-03-08 20:37:56
Okay, thanks!! So then I would need to mod JSPlaylist to use the text color that I got from the album color instead of the text color in the menu, right?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-03-08 20:50:38
sure
Title: WSH Panel Mod script discussion/help
Post by: ScribeOfTheMist on 2015-03-09 02:44:09
Okay...it would be nice if you could add this as an official option, so I could update the script without having to redo my custom changes every time, but I understand if that's not something you are interested in doing. It's a wonderful playlist panel either way!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-09 05:05:53
@mjm716, close foobar2000 and then save this in your marc2003 folder.

https://dl.dropboxusercontent.com/u/2280132...temp/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common8.js)

it's a console spamming version that notifies you with everything it does with regards to updating images in the thumbs panel. it displays things like the folder path and how many images have been found, playlist/playback events, artist changes, cycle timers, mouse clicks, mouse wheel scrolling. it should help you troubleshoot all the issues you've been having.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-09 18:26:03
samples updated:

toying around with other components today has made me realise the font function built into WSH panel mod takes pixels as input instead of points meaning the options i give don't match familiarity you may have from using other panels. i've now updated this but this will increase the font sizes on some existing scripts if updated. simply use the Font size option on the right click menu to select the next setting down.

existing users can right click>Update script.
full download: https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip (https://dl.dropboxusercontent.com/u/22801321/wsh/samples8.zip)
overview/installation notes: http://marc2003.x10host.com/intro (http://marc2003.x10host.com/intro)

edit: just for reference, i used this function from helpers.txt which is bundled in the docs folder of the component.

Code: [Select]
function Point2Pixel(pt, dpi) {
    return (pt * dpi / 72);
}


edit2: that update 30 minutes ago made a mess of the display in news-reviews-blogs. that has now been fixed
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-09 22:45:29
@mjm716, close foobar2000 and then save this in your marc2003 folder.

https://dl.dropboxusercontent.com/u/2280132...temp/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common8.js)


thanks Marc - your support always goes above and beyond and is much appreciated.

I made some progress by discovering a special char in path problem. Another issue remains:

It is registering missing images when they do not exist:
"Now Playing: ..\wsh_data\artists\Cat Power\ contains 0 images."

I have tried setting Automatic download to "library tracks" and "all tracks" but only manual download seems to be working?

after manual - "Now Playing: ..wsh_data\artists\Cat Power\ contains 5 images."
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 00:01:43
It is registering missing images when they do not exist:
"Now Playing: ..\wsh_data\artists\Cat Power\ contains 0 images."


you've lost me there. 

let's try it another way: post a screenshot that contains these 3 elements.

the console displaying the full path
windows explorer open at this folder location showing the full path in the address bar
the panel itself

example:

(https://dl.dropboxusercontent.com/u/22801321/2015/march/st.png)
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-10 01:05:48
sorry - only manual image download works - not automatic?

console doesn't provide any feedback regarding automatic download.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 01:13:27
so you're now avoiding the issue you initially reported. is that because you fucked up? i seriously feel like i'm wasting my time here.

console doesn't provide any feedback regarding automatic download.


that's because you didn't report anything wrong with it. 
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-10 02:41:06
so you're now avoiding the issue you initially reported. is that because you fucked up? i seriously feel like i'm wasting my time here.

console doesn't provide any feedback regarding automatic download.

that's because you didn't report anything wrong with it. 

easy killer.

my original issue was sorted - existing images are now displaying because I'm an idiot and had a special character in my path.

Separate (ongoing) issue: automatic download does not seem to be doing anything.

My Foobar is running from C:\Program Files (x86)\foobar NAS2

Images are located here and referenced via prefs>display>album art>artist:
C:\Program Files (x86)\foobar NAS2\wsh_lastfm\$crc32(%artist%)\*.jpg
C:\Program Files (x86)\foobar NAS2\wsh_data\artists\%artist%\*.jpg
Z:\usb1-disk1\'~'incoming\'~'apps\foobar2000\wsh_lastfm\$crc32(%artist%)\*.jpg
Z:\usb1-disk1\'~'incoming\'~'apps\foobar2000\wsh_data\artists\%artist%\*.jpg

Code: [Select]
Opening track for playback: "Z:\usb1-disk1\IJ\Jay Dee aka J Dilla (1976-2006)\2003 +Madlib]Champion Sound [R2K7]\207 The Mission (Stringed Out Remix) (2003).mp3"
Audioscrobbler: Submitting track...
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Jaylib" "Champion Sound" bio
Audioscrobbler: Submission succeeded.
Wave cache: finished analysis of "Z:\usb1-disk1\IJ\Jay Dee aka J Dilla (1976-2006)\2003 +Madlib]Champion Sound [R2K7]\207 The Mission (Stringed Out Remix) (2003).mp3"
Now Playing: Playlist selection/playback event triggered.
Now Playing: Artist has changed. Updating.
[color=#FF0000]Now Playing: C:\Program Files (x86)\foobar NAS2\wsh_data\artists\Jaylib\ contains 0 images. [/color]
Now Playing: Playlist selection/playback event triggered.
Now Playing: Artist has not changed. Doing nothing.
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Jaylib" "Champion Sound" review
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Jaylib" "Champion Sound" review
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Jaylib" "Champion Sound" bio
Now Playing: Playlist selection/playback event triggered.
Now Playing: Artist has not changed. Doing nothing.
Now Playing: Playlist selection/playback event triggered.
Now Playing: Artist has not changed. Doing nothing.
init groups delay = 1147 ms /handleList count=91896
Now Playing: Playlist selection/playback event triggered.
Now Playing: Artist has not changed. Doing nothing.

Jaylib doesn't have existing images, but none are downloaded automatically even though I have set automatic download to 'all tracks' in your script setting.
 
If I use the manual option from your script (Download artist art from last.fm) it will then download Jaylib images (and save them in the red path above).

My issue is getting automatic download to work. [and bonus points: would be very cool if the script could use prefs>display>album art>artist to check for existing artist images]
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-10 05:21:28
Separate (ongoing) issue: automatic download does not seem to be doing anything.


Notice this same problem on recent portable installs used for testing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 08:18:49
since automatic downloads still work exactly as intended for me, there is nothing i can do to help. i suggest you find alternate methods to download your images.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-10 08:47:45
since automatic downloads still work exactly as intended for me, there is nothing i can do to help. i suggest you find alternate methods to download your images.

Well something changed in between versions if I can swap in an older one and have it work as expected. I can send you the older version I have for comparison if necessary.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 09:02:55
yeah go on then.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-10 09:27:14
yeah go on then.


http://1drv.ms/1MnOdAM (http://1drv.ms/1MnOdAM)

That one is dated from late Dec. and seems to work in the test configs I've placed it in.


EDIT: Marc - would it be possible to have your update script do a rename of the older version (common8.js.bak/old) or some such instead of a straight up replace? In case there's a need to rollback. Just a thought.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 09:46:42
as i expected, the relevant part of code is identical.

for backups, take a look at foo_jesus. if serious bugs are introduced with a new version i can rollback using the previous versions feature on dropbox - it contains all revisions for a month.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-10 10:02:51
as i expected, the relevant part of code is identical.


Try latest and the one I linked in separate portable installs once. Something is amiss.

I can reproduce every single time I do that.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 10:35:36
as i expected, the relevant part of code is identical.


sorry if i wasn't clear before. this is the end of it as far as i am concerned. if you don't know what the words relevant and identical mean, i suggest you go and look them up.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-10 10:54:35
You can play the dick card all you want. Or you could perform a simple comparison in two installs and try to verify what two people have found to be true.

I'm reporting a bug, not calling you out for being some fucking lackey in your scripting abilities.

Yeah, I'm done now.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 11:27:10
fuck me sideways. i've already said i tested my own version and it works. you really think i'd have this attitude if it didn't? how is me testing the old script which i wrote and contains identical code to the new one going to help anyone?

for bug reports to be useful, you have to provide relevant information. you've provided none. the fact that one of my old files works is simply a coincidence given the relevant code is identical.

this is very similar to arguing that a flac generated from a wav is not bit perfect compared to the source because it is compressed. if you want to be on the wrong end of that conversation then there is no helping you.

edit: just to put a real end to this, right click your panel, configure. replace this function....

Code: [Select]
function on_playback_time(time) {
    th.playback_time(time);
}


with

Code: [Select]
function on_playback_time(time) {
    if (time != 1) return;
    p.console("This is the time to determine if images should be automatically downloaded.");
    if (th.source != 0) return p.console("Panel is in custom folder mode. Not downloading.");
    if (p.metadb.RawPath != fb.GetNowPlaying().RawPath) return p.console("Panel is not focused on the playing track. Not downloading.");
    if (th.files.length > 0) return p.console("Folder contains at least one image. Not downloading.");
    if (th.auto_download == 0) return p.console("Automatic downloads are switched off. Not downloading");
    if (th.auto_download == 1 && !fb.IsMetadbInMediaLibrary(p.metadb)) return p.console("Automatic downloads are enabled for library tracks only and this track is not in the library. Not downloading.");
    p.console("All conditions for downloading images have been met. Downloading now...");
    th.download();
}


and here is the original function which you'll find inside common8.js. it does exactly the same as the above without the console messages. it's the same in all versions of my common8 scripts even if some people don't believe me. luckily it's all in plain text so you can check it out yourselves.

Code: [Select]
this.playback_time = function(t) {
    if (this.source == 0 && t == 1 && this.files.length == 0 && p.metadb.RawPath == fb.GetNowPlaying().RawPath && ((this.auto_download == 1 && fb.IsMetadbInMediaLibrary(p.metadb)) || this.auto_download == 2)) this.download();
}
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-10 12:18:31
The author of this post requested its deletion. In order to preserve at least some of the causality of the discussion I deleted only the content. -- foosion
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 12:45:10
that has to be the most retarded edit i've ever seen. thanks to you i'm no longer providing my scripts or support for anyone.

i do not want to see anyone sharing my files on these forums.

there's little i can do stop you doing it elsewhere so you go away and have your fun.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 14:19:12
@mjm716, because it seems you have no idea of the consequences of your actions, try adding this at the end of your panel.

Code: [Select]
th.download = function() {
    p.browser("http://www.last.fm/music/" + encodeURIComponent(th.artist));
}


it's a more visual representation of what you're trying to do. 
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-10 18:11:05
it's a more visual representation of what you're trying to do. 


Well nice to see you've calmed down some.

Firstly, I did grasp the risk of looping requests (as seen in the console when I first took all conditionals away thank you), which is why I then left the time conditional in there (primarily for testing).

I'm certainly not the expert here, but that time == 1 setting adjusted (to 10 seems to work) on both my common7+8 has automatic downloads working for the first time in ages, so I'm still of the mind that at least on my system, the script never was given time to execute.

I'm open to your more seasoned directions, if you aren't going to just stomp away from the sandbox?

otherwise, I'll respect your wishes not to share what works for me here.

(Can an admin delete post 3963 above please as my edit rights are expired?)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-10 18:41:34
i kindly detailed the sanity checks i put in place to stop unnecessary automatic download attempts. did you report the exact console message that was preventing it working for you? no you didn't.

also, you made up some bullshit about how having loads of scripts active is affecting timers. what evidence have to provided to support this claim? again the answer is none.

instead you took it upon yourself to make a change that fires off 100 requests to the same web page for every track over 100 seconds long regardless of any settings/images already saved. it does one request per second until 100 seconds have passed. you're still failing to acknowledge how much of a stupid clueless cunt you are for doing this. please report my foul language/insults and hopefully my account will be banned.
Title: WSH Panel Mod script discussion/help
Post by: Case on 2015-03-10 19:17:17
Calm down. Not everyone can be expert from the beginning. Your reaction is surprising as your fans are only trying to learn.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-10 20:07:20
exact console message that was preventing it working for you? no you didn't.

post 3952 above is exactly your requested console message. If autodownload is supposed to be firing in the console, it clearly isn't for me.

Currently with the same verbose common8.js version the only reporting on track change I get (with timer=10) is:

Code: [Select]
init groups delay = 1158 ms /handleList count=91743 
Opening track for playback: "Z:\usb1-disk1\B\Bantam Rooster _3A\2000 Fuck all Y'all\11 It Girl (2000).mp3"
Audioscrobbler: Submitting track...
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Bantam Rooster" "Fuck all Y'all" bio
Audioscrobbler: Submission succeeded.
Wave cache: finished analysis of "Z:\usb1-disk1\B\Bantam Rooster _3A\2000 Fuck all Y'all\11 It Girl (2000).mp3"
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Bantam Rooster" "Fuck all Y'all" review
init groups delay = 1171 ms /handleList count=91742
Opening track for playback: "Z:\usb1-disk1\various\F-L\JAZZMAN++\Texas Funk-Black Gold 68-75 _57\12 Super Funk-Vern Blair Debate (2005).mp3"
Audioscrobbler: Submitting track...
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Vern Blair Debate" "Texas Funk" bio
Audioscrobbler: Submission succeeded.
Wave cache: finished analysis of "Z:\usb1-disk1\various\F-L\JAZZMAN++\Texas Funk-Black Gold 68-75 _57\12 Super Funk-Vern Blair Debate (2005).mp3"
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Vern Blair Debate" "Texas Funk" review
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Vern Blair Debate" "Texas Funk" review
Biography : execute command -> cscript //nologo scripts\allmusic0913.vbs "Vern Blair Debate" "Texas Funk" bio

also, you made up some bullshit about how having loads of scripts active is affecting timers. what evidence have to provided to support this claim? again the answer is none.

instead you took it upon yourself to make a change that fires off 100 requests to the same web page for every track over 100 seconds long regardless of any settings/images already saved

I already mentioned below I was aware of the looping issue, and I only did it (at 100) once as a test.

I've also already said simply increasing the time to 10 has common7+8 working on my setup (for the first time ever!) - and that the timing issue is a hypothesis. What proof would you like - before and after screenshots of no artist images (timer 1) / artist images (timer 10)?

Geezus dude, this is a hobby forum - does your attitude make you feel better? If I wanted that, I'd go back to work. Nobody is trying to steal your pony.

Two people have said things didn't work, no one is blaming you - it could be a million different things - I'm only trying to debug my setup. If my hypothesis is shit, fine, but why else would that change make a difference for me over two separate versions of your script?

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-11 02:21:31
post 3952 above is exactly your requested console message. If autodownload is supposed to be firing in the console, it clearly isn't for me.


i'm pretty sure you didn't invent time travel. i posted this code snippet some time AFTER #3952...

edit: just to put a real end to this, right click your panel, configure. replace this function....

Code: [Select]
function on_playback_time(time) {
    th.playback_time(time);
}


with

Code: [Select]
function on_playback_time(time) {
    if (time != 1) return;
    p.console("This is the time to determine if images should be automatically downloaded.");
    if (th.source != 0) return p.console("Panel is in custom folder mode. Not downloading.");
    if (p.metadb.RawPath != fb.GetNowPlaying().RawPath) return p.console("Panel is not focused on the playing track. Not downloading.");
    if (th.files.length > 0) return p.console("Folder contains at least one image. Not downloading.");
    if (th.auto_download == 0) return p.console("Automatic downloads are switched off. Not downloading");
    if (th.auto_download == 1 && !fb.IsMetadbInMediaLibrary(p.metadb)) return p.console("Automatic downloads are enabled for library tracks only and this track is not in the library. Not downloading.");
    p.console("All conditions for downloading images have been met. Downloading now...");
    th.download();
}


so again i ask...which one of these console messages prevented it working for you? or are you going to lie and say this never triggered once after one second of playback of every track? and it's not like you can say you missed this post because it's your brain dead edit of this code which caused all this in the first place.

edit: also, why did you omit the most important part of my previous post. you only quoted this...

Quote
exact console message that was preventing it working for you? no you didn't.


it makes much more sense when you quote it all.

Quote
i kindly detailed the sanity checks i put in place to stop unnecessary automatic download attempts. did you report the exact console message that was preventing it working for you? no you didn't.


anyway, i'm done now. i thought the mods would have banned me but it doesn't matter. i have enough willpower to stay away by myself.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-03-11 03:57:37
i have enough willpower to stay away by myself.


I doubt it.

But just to humour you.

Fresh thumbs script with your requested mod code. No images downloaded; nothing fires in console.

(http://www.upl.co/uploads/Untitled-68-111426044987.png)


Same thing with timing mod. Images download and still nothing fires in console.

(http://www.upl.co/uploads/192055twat1426045806.png)


Yet a third test, this time removing (time != 1) from your requested mod code. Images download and finally console messages fire.

(http://www.upl.co/uploads/stupidtwat1426046010.png)

You're welcome for your stupid script debugging.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-11 05:01:55
I doubt it.


well given you've finally posted some relevant information, i couldn't not reply. 

on_playback_time is built into the component and it's something i don't have any control over. there are 2 possible reasons for my code not triggering...

you're seeking or using foo_skip to bypass it hitting one second.
the component is broken in your usage scenario. if this is the case, you're more than welcome to download the source code and fix it: https://code.google.com/p/foo-wsh-panel-mod/source/browse/ (https://code.google.com/p/foo-wsh-panel-mod/source/browse/)

btw, i love your image names. hilarious.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-11 06:37:48
Thanks, Marc. For the five+ years this thread has been running it has helped hundreds, if not thousands, of users to make their foobar2000 bespoke for their use. A better user experience. With all due sincerity, your scripts and help over time has made my foobar2000 exactly what I want it to be.

That said...

The past several days are also a prime example of why this (or similar) functionality should be rolled into fb2k from the onset. Being an official option would remove the chance of someone having a bad day. With zero options for third parties to obliterate necessary files and snub the same hundreds, if not thousands, of users by pulling the plug on a truly useful project in what can be summed up as an infantile temper tantrum. Unless something changes in the interim, this thread will be a reminder of why third party components can be risky items to employ. Users are at the mercy of individuals that could, for no reason other than spite, ruin what has become a longstanding tradition of community interaction.

My issue with artist art has been resolved by finding a recent working version of the scripts in my considerable stash of configurations and systematically replacing the ones that were giving me troubles. I'm still at a loss as to why it started in the first place. Most likely something I did but I don't care to dig further now given how the tone in this thread soured over such a short time span. It works again. That's all that matters.

Hopefully this thread doesn't become a relic of 'what could have been'. It would be a genuine shame if that where to happen.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-11 09:43:41
What happen here?
Original script works perfectly for 99.9% users, and there is no need to continue this discussion because 0.01% users have a problem, and this is because something is wrong in their setup(windows,foobar), or they edit script by self, and they don't understood how exactly script works..
Marc scripts are esential for foobar, works perfectly , and i am very grateful for his support and time he spend even to help us with our own script..
Thanks Marc, and just calm down.
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-03-11 12:02:02
What happen here?
Original script works perfectly for 99.9% users, and there is no need to continue this discussion because 0.01% users have a problem, and this is because something is wrong in their setup(windows,foobar), or they edit script by self, and they don't understood how exactly script works..
Marc scripts are esential for foobar, works perfectly , and i am very grateful for his support and time he spend even to help us with our own script..
Thanks Marc, and just calm down.


Marc, thank you for your support, it was and still is, appreciated!.
I hope this will blow over and that you will return soon again. You will be missed.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-11 14:44:48
@mjm716
I just checked thumbs script with marc's modifications to on_playback_time function and everything is working fine with console massages as it should be (even without the edit everything is working fine)
Code: [Select]
[18:51:30] Thumbs: Artist has changed. Updating. 
[18:51:30] Thumbs: E:\Music\eng\George Michael\ contains 0 images.
[18:51:31] Thumbs: This is the time to determine if images should be automatically downloaded.
[18:51:31] Thumbs: All conditions for downloading images have been met. Downloading now...
[18:51:32] Thumbs: Playlist selection/playback event triggered.
[18:51:32] Thumbs: Artist has not changed. Doing nothing.
[18:51:40] Thumbs: E:\Music\eng\George Michael\ contains 1 images.
[18:51:43] Thumbs: E:\Music\eng\George Michael\ contains 4 images.
[18:51:44] Thumbs: Wed Mar 11 18:51:44 UTC+0530 2015 - Image change triggered by cycle setting of 5 seconds.


You should have known better before accusing marc that the problem is in your end obviously because he have been developing this script over the last 4 years so he surly will know if it didn't work.(and only only 2 people have reported)


and
@MachineHead
The past several days are also a prime example of why this (or similar) functionality should be rolled into fb2k from the onset. Being an official option would remove the chance of someone having a bad day. With zero options for third parties to obliterate necessary files and snub the same hundreds, if not thousands, of users by pulling the plug on a truly useful project in what can be summed up as an infantile temper tantrum. Unless something changes in the interim, this thread will be a reminder of why third party components can be risky items to employ. Users are at the mercy of individuals that could, for no reason other than spite, ruin what has become a longstanding tradition of community interaction.


This should have happened under total different circumstances. Even WSH Panel Mod is not on the foobar official components page. So this kind of functionality being a official option would only be dream!!.We can only hope for individual developers like marc,Falstaff,eXtremeHunter to implement these features for us.(I'm very grateful for them) Actually they are really reason foobar differentiate from other normal players . I really think foobar2000 developers should have created a better environment for this 3rd party plugins and their mods because there is so much features can missed out to new user just  because they are scattered around deviantart and this forum.
Hopefully someday we will have something like this

The page that contained marc's scripts and customisation guides (http://marc2003.x10host.com) is now gone
and his dropbox links are gone too 
Hope you two are happy
I can only hope for your comeback marc, don't let few peoples actions let you down,so many others will lose this super awesome script
(Which made my music listening experience 1000x better )

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-11 15:03:45
I really think foobar2000 developers should have created a better environment for this 3rd party plugins and their mods because there is so much features can missed out to new user just  because they are scattered around deviantart and this forum.


you could not be more wrong. it's only because of the foobar2000 SDK provided by Peter that great 3rd party components like facets, columns UI, wave seekbar, WSH panel mod, etc are possible. no one ever seems to give the main man any credit. also, it's up to individual developers if they want their components hosted on the official website. if people choose not to, then what is he supposed to do? make it compulsory?? 
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-11 15:16:52
Hope you two are happy


I am not happy in the least. The very thread title is about discussion and HELP. Sometimes we noobs don't know exactly why something breaks and try (often times without success) to figure out what caused the problem. If we can't get it, we ask. At a minimum, those in the know should be patient and remember we're not all gifted, and often times maddeningly frustrating trying to describe our problem. We don't mean to be, but it's equally frustrating when the help we seek comes from someone that is petty, surly, and downright rude at times.

This is not how a community is supposed to operate. It is, however, a surefire way to see it fracture. You just have to look at this and other concurrent threads for examples.

If you don't like that thought. Too bad. I'm not the one that went one a delete spree out of pure spite; even going so far as deleting his profile at another site just to eradicate any presence of the scripts/configs. This is a sign of someone with issues that go beyond being pissed off about a stupid script used for some audio player.

As is, the scripts still function and will probably continue to do so for quite some time. In some distant future version we can hope to get a like feature added. Preferably with a repository of always free to use scripts that aren't presided over by someone with an incendiary mentality willing to embark on a scorched earth policy if they aren't having the best of days.

Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-11 15:33:05
I really think foobar2000 developers should have created a better environment for this 3rd party plugins and their mods because there is so much features can missed out to new user just  because they are scattered around deviantart and this forum.


you could not be more wrong. it's only because of the foobar2000 SDK provided by Peter that great 3rd party components like facets, columns UI, wave seekbar, WSH panel mod, etc are possible. no one ever seems to give the main man any credit. also, it's up to individual developers if they want their components hosted on the official website. if people choose not to, then what is he supposed to do? make it compulsory?? 

What meant by better environment is a showcase/portfolio to show what really foobar can be with right components/scripts by hosting things like your scripts,br3tt's JSPlaylist, mire777's youtube radio etc.. These things cant be easily  found by new use who just  went to foobar2000.org  and download it (personally i had to spent lot time to find all of things and make my foobar as i want to)
ex:musicbee have things like:
http://musicbee.wikia.com/wiki/Skins (http://musicbee.wikia.com/wiki/Skins)
http://musicbee.wikia.com/wiki/Plugins (http://musicbee.wikia.com/wiki/Plugins)
Obviously without SDK provided by Peter nothing is possible,so all credit should go to him.

Actually what i'm saying is foobar is not a very user friendly player,but have so much potential than these other players.
So actually management/owners of foobar2000 are responsible, not developers of course

and can pleaseeee make your scripts and customisation guide available again these things are soo essential for foobar and I can only wish you continue to support them 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-11 16:20:36
At a minimum, those in the know should be patient and remember we're not all gifted, and often times maddeningly frustrating trying to describe our problem. We don't mean to be, but it's equally frustrating when the help we seek comes from someone that is petty, surly, and downright rude at times.


i've been more than patient. i've repeatedly asked for meaningful bug reports yet you've still failed to produce anything. even when i post the exact code that triggers automatic downloads in your working and non working scripts, you still haven't replied. at first i was reluctant to post the code because i knew it would be abused but i finally relented and you no longer had to take my word about the code being identical. this is something you could do yourself using a text editor but you still have not responded to this. i hate repeating myself but here is the post again.

edit: just to put a real end to this, right click your panel, configure. replace this function....

Code: [Select]
function on_playback_time(time) {
    th.playback_time(time);
}


with

Code: [Select]
function on_playback_time(time) {
    if (time != 1) return;
    p.console("This is the time to determine if images should be automatically downloaded.");
    if (th.source != 0) return p.console("Panel is in custom folder mode. Not downloading.");
    if (p.metadb.RawPath != fb.GetNowPlaying().RawPath) return p.console("Panel is not focused on the playing track. Not downloading.");
    if (th.files.length > 0) return p.console("Folder contains at least one image. Not downloading.");
    if (th.auto_download == 0) return p.console("Automatic downloads are switched off. Not downloading");
    if (th.auto_download == 1 && !fb.IsMetadbInMediaLibrary(p.metadb)) return p.console("Automatic downloads are enabled for library tracks only and this track is not in the library. Not downloading.");
    p.console("All conditions for downloading images have been met. Downloading now...");
    th.download();
}


and here is the original function which you'll find inside common8.js. it does exactly the same as the above without the console messages. it's the same in all versions of my common8 scripts even if some people don't believe me. luckily it's all in plain text so you can check it out yourselves.

Code: [Select]
this.playback_time = function(t) {
    if (this.source == 0 && t == 1 && this.files.length == 0 && p.metadb.RawPath == fb.GetNowPlaying().RawPath && ((this.auto_download == 1 && fb.IsMetadbInMediaLibrary(p.metadb)) || this.auto_download == 2)) this.download();
}


it was a direct response to one your posts so i cannot be held responsible for you ignoring it.

as for my "scorched earth" policy, it's because i actually care about people misusing my scripts to query remote websites hundreds of times every few minutes (this wasn't you ). i put sanity checks in place for a reason. if people gleefully post smiley face replies with idiotic code edits thanking me for helping them to bypass said sanity checks completely ignorant of what they are doing because they think it solves their problem then i want no part of it.

@samithaj, what's to stop you setting up a foobar2000 wikia site? just remember a good majority of foobar users couldn't care less about what it looks like. it's the core features underneath the surface that make it so great. even without any 3rd party components, it would still be my music player of choice.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-03-11 17:00:01
it was a direct response to one your posts so i cannot be held responsible for you ignoring it.


That's because the post of mine prior to the one you quoted above is where I closed the browser, stewed on it a bit, and took a different approach to my problem. In the giant pile of saved configs I 've accumulated was your latest yuckfoo. Knowing that the scripts inside that worked, I replaced the one giving me shit to see. It fixed it. I then replaced its common8.js with the last one you shared. Still worked. Fix for all was simple at that point - nuke the ones not working: replace with the one that was working. Why did it break? NFI. It was something I did for certain but I do not know why, or care, at this point. The offending configurations have been updated and the crap deleted. That's all that matters to me at this point.

Granted, that should have been one of the first approaches I took. Hindsight being 20/20 and all...whatever.

Then I come back and this is what I find. A thread in utter disarray. I don't get it. You decide to punish a lot of users for maybe mine and someone else's actions? Not cool. If you're bound and determined to stay this course then so be it. It's your decision to make. I don't agree with it at all but will respect it and offer no more comment on the matter from here on out.

You've helped more times than I can count and I do appreciate it all. Thank you for that.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-03-12 00:04:47
You should have known better before accusing marc that the problem is in your end obviously because he have been developing this script over the last 4 years so he surly will know if it didn't work.(and only only 2 people have reported)


I've actually had the same problem with the last few releases as well but never bothered to mention it because I don't really use thumbs.

It's a shame that things seemed to have escalated to this. I can understand marc's frustrations though as my work has inspired and flat out been reproduced by others who not only don't give any credit but seek monetary compensation. marc's scripts are a part of  my work as were some others but putting in that effort, helping people with any problems and such only to be taken for granted is annoying all the same.

oh well, nothing lasts forever, hope he comes back though. Reminds of the guy who created PanelsUI that got chased away by an ungrateful few in the community
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-14 11:49:29
After returning from being away for a few weeks it looks like my WSH panels are no longer working.  Upon startup I'm getting the following errors (one for each instance):

Scripting Engine Initialization Failed (Thumbs by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (News / Reviews / Blogs by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Last.fm Charts by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Musicbrainz by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Allmusic review by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Last.fm & Wikipedia Biography by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Art Reader by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Item Details by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Small Web Links by marc2003, CODE: 0x80040154): Class not registered 

I've been searching these forums for a fix to these messages, but don't see one.  Safe Mode is clicked off.  Any idea what's causing this?

Thanks in advance.
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-03-14 12:17:30
After returning from being away for a few weeks it looks like my WSH panels are no longer working.  Upon startup I'm getting the following errors (one for each instance):

Scripting Engine Initialization Failed (Thumbs by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (News / Reviews / Blogs by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Last.fm Charts by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Musicbrainz by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Allmusic review by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Last.fm & Wikipedia Biography by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Art Reader by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Item Details by marc2003, CODE: 0x80040154): Class not registered 
Scripting Engine Initialization Failed (Small Web Links by marc2003, CODE: 0x80040154): Class not registered 

I've been searching these forums for a fix to these messages, but don't see one.  Safe Mode is clicked off.  Any idea what's causing this?

Thanks in advance.


you need to change/adept your last.fm API key in the common8js script:

this.username_error = "Use the right click menu to set your Last.fm username.";
   this.password_error = "Use the right click menu to set your Last.fm password.";
   this.ini_file = p.settings_folder + "lastfm.ini";
   this.username = this.read_ini("username");
   this.sk = this.read_ini("sk");
   this.api_key = "xxxyour code";
   this.secret = "xxxyour codee";
   this.ua = "foobar2000_wsh_scripts";
   this.auto_correct = window.GetProperty("2k3.lastfm_auto_correct", true);
   this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-14 13:05:52
a suspended API key is not the cause of those errors. 

something much serious is wrong with hexenszene's computer. my guess is a bad windows update or corruption of files. or perhaps try and think of any other software/configuration changes you have made recently because that looks like the component is not going to work with any script, not just mine. try a new default panel and see what happens....
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-14 13:43:07
something much serious is wrong with hexenszene's computer. my guess is a bad windows update or corruption of files. or perhaps try and think of any other software/configuration changes you have made recently because that looks like the component is not going to work with any script, not just mine. try a new default panel and see what happens....


Thanks Marc.  I just installed a new video card along with drivers, but other than that I can't recall making any changes lately.  I'll dig a little deeper and report back...
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-03-14 14:23:40
something much serious is wrong with hexenszene's computer. my guess is a bad windows update or corruption of files. or perhaps try and think of any other software/configuration changes you have made recently because that looks like the component is not going to work with any script, not just mine. try a new default panel and see what happens....


Thanks Marc.  I just installed a new video card along with drivers, but other than that I can't recall making any changes lately.  I'll dig a little deeper and report back...



Hi Marc, thanks for filling in/correcting my reply. I had something simulair with the suspended API key. After adding my own code it worked fine.
Anyway, is good to see you here again!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-14 15:04:58
Thanks Marc.  I just installed a new video card along with drivers, but other than that I can't recall making any changes lately.  I'll dig a little deeper and report back...


a quick search of the forums has found others having the same issue some years ago (i just searched for the error code)

http://www.hydrogenaud.io/forums/index.php...mp;#entry755221 (http://www.hydrogenaud.io/forums/index.php?showtopic=70363&st=1160&p=755221&hl=0x80040154&#entry755221)
http://www.hydrogenaud.io/forums/index.php...mp;#entry769090 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=1050&p=769090&hl=0x80040154&#entry769090)

@jbercx, i'll post when something is quite clearly a component problem but that's about as far as it will go. an invalid last.fm api key is not going affect allmusic, musicbrainz, artreader, etc...
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-03-14 17:40:27
Thanks Marc.  I just installed a new video card along with drivers, but other than that I can't recall making any changes lately.  I'll dig a little deeper and report back...


a quick search of the forums has found others having the same issue some years ago (i just searched for the error code)

http://www.hydrogenaud.io/forums/index.php...mp;#entry755221 (http://www.hydrogenaud.io/forums/index.php?showtopic=70363&st=1160&p=755221&hl=0x80040154&#entry755221)
http://www.hydrogenaud.io/forums/index.php...mp;#entry769090 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=1050&p=769090&hl=0x80040154&#entry769090)

@jbercx, i'll post when something is quite clearly a component problem but that's about as far as it will go. an invalid last.fm api key is not going affect allmusic, musicbrainz, artreader, etc...

Thanks for the clarification, and again, all your work is appreciated.
Title: WSH Panel Mod script discussion/help
Post by: sksig on 2015-03-15 11:34:25
Few days ago last fm playcount sync and add to loved track functions stopped work. When i trying to add some track to loved console writes:
"Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Suspended API key - Access for your account has been suspended, please contact Last.fm"

When playcount sync trying to get info it shows almost same:
"Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: {"error":26,"message":"Suspended API key - Access for your account has been suspended, please contact Last.fm","links":[]}"

Maybe someone know how to fix it? Last fm account is fine - site working, scrobbling from foobar too.

ps sorry for my poor english.
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-03-15 11:45:51

"Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Suspended API key - Access for your account has been suspended, please contact Last.fm"


ps sorry for my poor english.
[/quote]


see 2 or 3 post above from me, copy your own API key in the script. Then It should work
Title: WSH Panel Mod script discussion/help
Post by: hiroki01 on 2015-03-15 11:50:59
i had the exact same problem as sksig, and so i created a new API account at http://www.lastfm.jp/api/accounts (http://www.lastfm.jp/api/accounts) and followed the instructions at http://www.hydrogenaud.io/forums/index.php...st&p=887377 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=76772&view=findpost&p=887377) and replaced this.api_key, this.secret, and this.ua in my common7.js accordingly.

after i did that playcount sync appears to work fine, but for some reason the add to loved track button still doesn't work. when i attempted to re-enter my last.fm username and password, i get a popup box titled "Last.fm Playcount Sync" with the message "Invalid method signature supplied".

i noticed that there's another method of adding to loved tracks in the skin i'm using (JAM v1.2) by right-clicking on the track in the playlist and selecting the appropriate option. apparently this method communicates via the foo_softplaylists component, which works. although i'm still trying to figure out how to repair the "love track" button which is a lot more convenient as it registers immediately without having to sync with last.fm like this latter method.

Title: WSH Panel Mod script discussion/help
Post by: sksig on 2015-03-15 12:18:49
copy your own API key in the script. Then It should work


Thank you for fast answer. Playcount sync fixed, but add to loved - still not. Now it writes:
"Last.fm Playcount Sync: Invalid session key - Please re-authenticate"

Maybe i done something wrong:
1. I made new API and secret keys here: http://www.lastfm.ru/api/account/create (http://www.lastfm.ru/api/account/create)
Application/Device Name - i wrote "foobar 2000"
Application Description - same "foobar 2000"
2. Opened common8.js with notepad, found lines with this keys and replaced old API and secret keys with new ones.
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-15 12:19:26
Thanks Marc.  I just installed a new video card along with drivers, but other than that I can't recall making any changes lately.  I'll dig a little deeper and report back...


a quick search of the forums has found others having the same issue some years ago (i just searched for the error code)

http://www.hydrogenaud.io/forums/index.php...mp;#entry755221 (http://www.hydrogenaud.io/forums/index.php?showtopic=70363&st=1160&p=755221&hl=0x80040154&#entry755221)
http://www.hydrogenaud.io/forums/index.php...mp;#entry769090 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=1050&p=769090&hl=0x80040154&#entry769090)



Hi Marc,

Still no luck resolving this.  I've updated all my drivers and the latest windows update, but am otherwise at a loss as to what to do.  Here's what the foobar console says after I start it up:

Quote
UI Hacks: DLL-hijacking failed
UI Hacks: hooks status 0x420000
Components loaded in: 0:02.868522
Configuration read in: 0:00.035059
Watching: E:\MUSIC_LIBRARY
User Interface initialized in: 0:00.126509
Conf2 already initialized.
foo_upnp: succesfully loaded file C:\Users\Michael\AppData\Roaming\foobar2000\foo_upnp.xml
foo_upnp: initialized in 0.093s
foo_logitech_lcd.dll [Error] (.\LCDWrapper.cpp, `anonymous-namespace'::APIInit, 721): LCD drivers not installed or incorrect version.
foo_logitech_lcd.dll [Error] (.\LCDWrapper.cpp, NLCD::CConnection::NewConnection, 655): Failed to initialise LCD API
foo_logitech_lcd.dll [Error] (.\LCDDisplay.cpp, CLCDDisplay::Initialise, 61): Failed to create LCD object. Plugin will be unavailable.
foo_logitech_lcd.dll [Error] (.\foobarDLL.cpp, CFoobarDLL::threadProc, 129): Could not initialise LCD. Plugin will be unavailable.
Startup time : 0:10.692310
foo_upnp: created 111279 path registry entries in 3.944s
foo_upnp: loaded Media Library tree in 19.460s
Seekbar: taking Direct2D1 path.
Seekbar: Frontend initialized.


Perhaps the errors listed here are related?
Title: WSH Panel Mod script discussion/help
Post by: sksig on 2015-03-15 12:24:15
i attempted to re-enter my last.fm username and password

Thank you. It helped. I just needed to re-enter login and password in "add to love" button right click menu. I did it and now all works fine again.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-15 16:51:24
Perhaps the errors listed here are related?


probably. as i mentioned before, it looks like something has corrupted some of your windows files. i couldn't possibly say what though. perhaps you'd have more luck on a dedicated windows troubleshooting forum. try looking at the windows event viewer for more errors as they might provide something else you can search for that isn't foobar related.

edit: system restore might be worth a punt if you have it enabled???
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-15 18:39:29
Perhaps the errors listed here are related?


probably. as i mentioned before, it looks like something has corrupted some of your windows files. i couldn't possibly say what though. perhaps you'd have more luck on a dedicated windows troubleshooting forum. try looking at the windows event viewer for more errors as they might provide something else you can search for that isn't foobar related.

edit: system restore might be worth a punt if you have it enabled???


Ok thanks.  Unfortunately System Restore isn't an available option.  After my first post yesterday I did a new Windows Update, so that's the only point I can go back to.  However Event Viewer does indeed have a bunch of errors in it, although I don't see any where Foobar is mentioned.  Are there any Windows forums that you might recommend?  This stuff is all way beyond my pay grade, so it's hard for me to even know how to formulate an appropriate question...
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-03-15 19:26:56
Perhaps the errors listed here are related?


probably. as i mentioned before, it looks like something has corrupted some of your windows files. i couldn't possibly say what though. perhaps you'd have more luck on a dedicated windows troubleshooting forum. try looking at the windows event viewer for more errors as they might provide something else you can search for that isn't foobar related.

edit: system restore might be worth a punt if you have it enabled???


Ok thanks.  Unfortunately System Restore isn't an available option.  After my first post yesterday I did a new Windows Update, so that's the only point I can go back to.  However Event Viewer does indeed have a bunch of errors in it, although I don't see any where Foobar is mentioned.  Are there any Windows forums that you might recommend?  This stuff is all way beyond my pay grade, so it's hard for me to even know how to formulate an appropriate question...


not sure if this will help but, I know that certain software, such as antiviruses, can cause problems because they try to protect your computer by blocking the running of scripts. Perhaps your update has installed some malicious removal or blocking tools that are blocking them. Or did your new vid card come with an antivirus packaged with the drivers? just a guess
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-15 19:35:06
not sure if this will help but, I know that certain software, such as antiviruses, can cause problems because they try to protect your computer by blocking the running of scripts. Perhaps your update has installed some malicious removal or blocking tools that are blocking them. Or did your new vid card come with an antivirus packaged with the drivers? just a guess


This is helpful.  I didn't install any new anti-virus recently, however now I'm wondering if WSH is somehow disabled on my PC.  Trying to find how to check this...
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-03-15 21:21:00
This is helpful.  I didn't install any new anti-virus recently, however now I'm wondering if WSH is somehow disabled on my PC.  Trying to find how to check this...


Just out of curiosity, here's a simple html clock that requires the running of a local js file Colour clock (https://www.dropbox.com/s/dwzhbv7ukm5im2b/Colour%20Clock.rar?dl=0)
Extract that and load the index file in your browser. If you see the current time and a background with colour that keeps changing, then the problem isn't system wide and just something within foobar, try updating it. However, if the clock doesn't load the time and just shows 00.00.00 and one background, then maybe you could try disabling your antivirus  then seeing if the clock and/or foobar loads properly. If not antivirus maybe some malware protection. I had Avast in the long ago and it gave me errors as well because it was blocking scripts, which is also likely the reason you are getting the UI hacks error too
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-15 23:06:25
Please, someone who knows?
I was read about Windows 10 , I plan to swich to it, when it comes.
Problem is that Internet Explorer doesn't exist anymore, they use Spartan browser and Cortana.
Does this will impact on scripts that use IE?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-15 23:39:59
a quick google found this...

http://blogs.msdn.com/b/ie/archive/2015/01...view-build.aspx (http://blogs.msdn.com/b/ie/archive/2015/01/22/project-spartan-and-the-windows-10-january-preview-build.aspx)

Quote
Spartan provides compatibility with the millions of existing enterprise web sites designed for Internet Explorer. To achieve this, Spartan loads the IE11 engine for legacy enterprise web sites when needed, while using the new rendering engine for modern web sites. This approach provides both a strong compatibility guarantee for legacy enterprise web sites and a forward looking interoperable web standards promise.

We recognize some enterprises have legacy web sites that use older technologies designed only for Internet Explorer, such as custom ActiveX controls and Browser Helper Objects. For these users, Internet Explorer will also be available on Windows 10. Internet Explorer will use the same dual rendering engines as Spartan, ensuring web developers can consistently target the latest web standards.


edit: looking again at how that is worded, it might only apply to enterprise versions of windows? i guess we'll see when it comes out.
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-16 11:03:31
This is helpful.  I didn't install any new anti-virus recently, however now I'm wondering if WSH is somehow disabled on my PC.  Trying to find how to check this...


Just out of curiosity, here's a simple html clock that requires the running of a local js file Colour clock (https://www.dropbox.com/s/dwzhbv7ukm5im2b/Colour%20Clock.rar?dl=0)
Extract that and load the index file in your browser. If you see the current time and a background with colour that keeps changing, then the problem isn't system wide and just something within foobar, try updating it. However, if the clock doesn't load the time and just shows 00.00.00 and one background, then maybe you could try disabling your antivirus  then seeing if the clock and/or foobar loads properly. If not antivirus maybe some malware protection. I had Avast in the long ago and it gave me errors as well because it was blocking scripts, which is also likely the reason you are getting the UI hacks error too


Thanks for this.  I tried the html clock and it seems to be working.  Nevertheless I uninstalled Avast just to see if it might help.  No luck.  Short of a new installation of Windows, I'm not sure what to try next.  I'll post my foobar console once more, just in case it provides any other clues.  ("'panel' is undefined" ??)

UI Hacks: DLL-hijacking failed
UI Hacks: hooks status 0x420000
Components loaded in: 0:00.861647
Configuration read in: 0:00.049205
Watching: E:\MUSIC_LIBRARY
Error: WSH Panel Mod (Small Web Links by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Small Web Links by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 13, Col: 1
<source text only available at compile time>
Error: WSH Panel Mod (Item Details by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Item Details by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>
Error: WSH Panel Mod (Art Reader by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Art Reader by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>
Error: WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 13, Col: 1
<source text only available at compile time>
Error: WSH Panel Mod (Allmusic review by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Allmusic review by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>
Error: WSH Panel Mod (Musicbrainz by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Musicbrainz by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>
WSH Panel Mod ({0E242E3D-F689-4B4D-A7C2-C6DE4A711184}): initialized in 6 ms
Error: WSH Panel Mod (Last.fm Charts by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Last.fm Charts by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 7, Col: 1
<source text only available at compile time>
Error: WSH Panel Mod (News / Reviews / Blogs by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (News / Reviews / Blogs by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>
WSH Panel Mod ({0663E3AE-57D4-4FEE-B36F-E8DE9FB96582}): initialized in 8 ms
Error: WSH Panel Mod (Thumbs by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Thumbs by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 11, Col: 1
<source text only available at compile time>
User Interface initialized in: 0:00.165584
foo_upnp: succesfully loaded file C:\Users\Michael\AppData\Roaming\foobar2000\foo_upnp.xml
foo_upnp: initialized in 0.107s
Conf2 already initialized.
foo_upnp: created 111279 path registry entries in 3.546s
foo_logitech_lcd.dll [Error] (.\LCDWrapper.cpp, `anonymous-namespace'::APIInit, 721): LCD drivers not installed or incorrect version.
foo_logitech_lcd.dll [Error] (.\LCDWrapper.cpp, NLCD::CConnection::NewConnection, 655): Failed to initialise LCD API
foo_logitech_lcd.dll [Error] (.\LCDDisplay.cpp, CLCDDisplay::Initialise, 61): Failed to create LCD object. Plugin will be unavailable.
foo_logitech_lcd.dll [Error] (.\foobarDLL.cpp, CFoobarDLL::threadProc, 129): Could not initialise LCD. Plugin will be unavailable.
Startup time : 0:07.716657
foo_upnp: loaded Media Library tree in 22.344s
Seekbar: taking Direct2D1 path.
Seekbar: Frontend initialized.
Autobackup: Backed up 118 items to autobackup.20150316-090029.zip
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-03-16 12:17:00
i'd like to see the console report with only the default WSH script please, and if possible in a new foobar2000 portable installation with ony the WSH Panel Mod component inastalled!
imho it's a better way to get new clue for your issue

EDIT: because i assume that 'panel' error is present because of common7.js can't be loaded, so 'panel' object' not declared.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-16 12:32:57
Quote
Error: WSH Panel Mod (Small Web Links by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load
Error: WSH Panel Mod (Small Web Links by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 13, Col: 1
<source text only available at compile time>


this is a very different and far less serious error to what you had before. this shows that script inside the panel is actually running. you're just missing files that are required by the script. check the file path indicated above.

it really does look like avast was blocking something because these previous errors you posted shows the component not even initialising to run any script. it wouldn't have mattered what script was inside the panel. it looks like a good call from blaxima to check your AV.

Quote
Scripting Engine Initialization Failed (Thumbs by marc2003, CODE: 0x80040154): Class not registered
Scripting Engine Initialization Failed (News / Reviews / Blogs by marc2003, CODE: 0x80040154): Class not registered
Scripting Engine Initialization Failed (Last.fm Charts by marc2003, CODE: 0x80040154): Class not registered


EDIT: because i assume that 'panel' error is present because of common7.js can't be loaded, so 'panel' object' not declared.


indeed. the first line of code in every single script of mine begins...

Code: [Select]
var p = new panel("something"....


it should be an easy fix now.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-03-16 17:23:10
Thanks for this.  I tried the html clock and it seems to be working.  Nevertheless I uninstalled Avast just to see if it might help.  No luck.  Short of a new installation of Windows, I'm not sure what to try next.  I'll post my foobar console once more, just in case it provides any other clues.  ("'panel' is undefined" ??)

UI Hacks: DLL-hijacking failed
UI Hacks: hooks status 0x420000
Components loaded in: 0:00.861647
Configuration read in: 0:00.049205
foo_logitech_lcd.dll [Error] (.\LCDWrapper.cpp, `anonymous-namespace'::APIInit, 721): LCD drivers not installed or incorrect version.
foo_logitech_lcd.dll [Error] (.\LCDWrapper.cpp, NLCD::CConnection::NewConnection, 655): Failed to initialise LCD API
foo_logitech_lcd.dll [Error] (.\LCDDisplay.cpp, CLCDDisplay::Initialise, 61): Failed to create LCD object. Plugin will be unavailable.
foo_logitech_lcd.dll [Error] (.\foobarDLL.cpp, CFoobarDLL::threadProc, 129): Could not initialise LCD. Plugin will be unavailable.



Did you reboot after uninstalling? Avast needs to be released from memory.

Marc's scripts are loading but the common7.js file is the problem because of one of two things, it's not being found or protective software(Avast, Windows Defender, User Account Control, etc.) blocking it from being loaded. Those dll errors still has me thinking it's the latter because it says that the configuration and components folder are being found (hopefully with the required components in there).
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-16 18:29:53
Quote
Error: WSH Panel Mod (Small Web Links by marc2003): Parsing file "C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\common7.js": Failed to load

this is a very different and far less serious error to what you had before. this shows that script inside the panel is actually running. you're just missing files that are required by the script. check the file path indicated above.



Well, I just checked the path, and the only file in C:\Users\Michael\AppData\Roaming\foobar2000\marc2003\ is "common8.js".

I have no idea how it got renamed.  I just tried changing the file name to common7.js and started foobar, and at least one of the WSH panels then works.  However most still don't.  I've switched it back to common8.js for the moment.  I wonder if I had tried to update something incorrectly?  What's best at this point?  Freshly installing the scripts?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-17 00:51:04
just make sure the marc2003 folder and the scripts that go inside each panel come from the same major version. common7 and 8 are both valid versions but they are not compatible with each other - that's why renaming did not work. they even run side by side but only when the required dependency files are in place.

if you use files from the same zip download, you won't have a problem.
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-03-17 07:28:32
The similar artist script is no longer working but it is creating an artist.getSimilar.json file with this inside of it

Code: [Select]
{"error":26,"message":"Suspended API key - Access for your account has been suspended, please contact Last.fm","links":[]}

Title: WSH Panel Mod script discussion/help
Post by: Der Internet on 2015-03-17 14:17:57
The similar artist script is no longer working but it is creating an artist.getSimilar.json file with this inside of it

Code: [Select]
{"error":26,"message":"Suspended API key - Access for your account has been suspended, please contact Last.fm","links":[]}


you have to create your own API key, see the last.fm sync thread for a manual
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-03-17 15:46:39
The similar artist script is no longer working but it is creating an artist.getSimilar.json file with this inside of it

Code: [Select]
{"error":26,"message":"Suspended API key - Access for your account has been suspended, please contact Last.fm","links":[]}


you have to create your own API key, see the last.fm sync thread for a manual


thanks
Title: WSH Panel Mod script discussion/help
Post by: Maeldun on 2015-03-17 20:53:14
To anyone else struggling with the CODE: 0x80020101 ERROR - first make sure you have unselected "safe mode" in the WSH panel preferences before you start posting here trying to get help.

That was the problem for me. (Facepalm)

Somehow this setting got lost in the Win10 upgrade I made recently (that, although I copied the Foobar AppData folder in its entirety).
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-03-18 09:21:20
just make sure the marc2003 folder and the scripts that go inside each panel come from the same major version. common7 and 8 are both valid versions but they are not compatible with each other - that's why renaming did not work. they even run side by side but only when the required dependency files are in place.

if you use files from the same zip download, you won't have a problem.



Just wanted to say thanks for all the help... Somehow I've got it working again.  I did a new portable installation with fresh scripts and everything, and it seems to be working fine now.
Title: WSH Panel Mod script discussion/help
Post by: strangeluck on 2015-03-19 02:44:38
Please, someone who knows?
I was read about Windows 10 , I plan to swich to it, when it comes.
Problem is that Internet Explorer doesn't exist anymore, they use Spartan browser and Cortana.
Does this will impact on scripts that use IE?


On the newest build released today (10041) I am having constant problems with wsh_panel_mod crashing. Nothing has changed in regards to my foobar installation, as it resides on a network share. When running foobar from other machines on the network with older versions of the windows operating system (including the the January 9926 build) there are no issues. So just from my own personal experience so far it does seem like there is definitely an issue. The crashes happen regardless of if i select jscript or jscript9 as the script engine. Usually I'm just getting the "Aw, Crashed " messaged in wsh_panel itself, and re-applying the script configuration will bring the panel content back. Though on a few occasions today wsh_panel_mod has crashed the entire foobar2000 program. Next time it brings the program crashing down i will try and post more details.

Edit: I should probably note that the crashes seem to be happening only with marc2003's scripts, as I have not yet seen an "Aw, crashed" message in the panel hosting jsplaylist. Which is not to say there's a problem with these excellent scripts, I'm pretty sure this is entirely related to the new windows build as I have never had an issue in years of running these scripts until today.
Title: WSH Panel Mod script discussion/help
Post by: jbercx on 2015-03-19 06:24:35
Please, someone who knows?
I was read about Windows 10 , I plan to swich to it, when it comes.
Problem is that Internet Explorer doesn't exist anymore, they use Spartan browser and Cortana.
Does this will impact on scripts that use IE?


On the newest build released today (10041) I am having constant problems with wsh_panel_mod crashing. Nothing has changed in regards to my foobar installation, as it resides on a network share. When running foobar from other machines on the network with older versions of the windows operating system (including the the January 9926 build) there are no issues. So just from my own personal experience so far it does seem like there is definitely an issue. The crashes happen regardless of if i select jscript or jscript9 as the script engine. Usually I'm just getting the "Aw, Crashed " messaged in wsh_panel itself, and re-applying the script configuration will bring the panel content back. Though on a few occasions today wsh_panel_mod has crashed the entire foobar2000 program. Next time it brings the program crashing down i will try and post more details.

Edit: I should probably note that the crashes seem to be happening only with marc2003's scripts, as I have not yet seen an "Aw, crashed" message in the panel hosting jsplaylist. Which is not to say there's a problem with these excellent scripts, I'm pretty sure this is entirely related to the new windows build as I have never had an issue in years of running these scripts until today.


What build do you mean? Windows 10?
Title: WSH Panel Mod script discussion/help
Post by: strangeluck on 2015-03-19 06:28:34
What build do you mean? Windows 10?


Do you know of another Windows build released today? Also, I included in my response the quote asking about issues related to Windows 10. So to answer your question... Yes, Windows 10. Sorry if that wasn't clear.

I believe this build (10041) is the first to implement the new rendering engine that will be featured in the forthcoming Spartan browser.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-19 08:17:42
well i am genuinely curious about this so try this in a fresh panel...

Code: [Select]
function on_mouse_lbtn_dblclk() {
    var arr = ["Microsoft.XMLHTTP", "htmlfile", "Shell.Application", "WScript.Shell", "Scripting.FileSystemObject", "ScriptControl", "dummy"];
    var objs = {};
    var text = "";
    for (i in arr) {
        try {
            objs[arr[i]] = new ActiveXObject(arr[i]);
            text += arr[i] + " seemed to load ok.\n";
        } catch(e) {
            text += arr[i] + " ain't working.\n";
        }
    }
    fb.ShowPopupMessage(text);
}


double click the panel and you should get a popup window displaying something like this...

Code: [Select]
Microsoft.XMLHTTP seemed to load ok.
htmlfile seemed to load ok.
Shell.Application seemed to load ok.
WScript.Shell seemed to load ok.
Scripting.FileSystemObject seemed to load ok.
ScriptControl seemed to load ok.
dummy ain't working.


i added dummy just to show how this script works when trying to load something that is invalid.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-19 09:44:23
a quick google found this...

http://blogs.msdn.com/b/ie/archive/2015/01...view-build.aspx (http://blogs.msdn.com/b/ie/archive/2015/01/22/project-spartan-and-the-windows-10-january-preview-build.aspx)

Quote
Spartan provides compatibility with the millions of existing enterprise web sites designed for Internet Explorer. To achieve this, Spartan loads the IE11 engine for legacy enterprise web sites when needed, while using the new rendering engine for modern web sites. This approach provides both a strong compatibility guarantee for legacy enterprise web sites and a forward looking interoperable web standards promise.

We recognize some enterprises have legacy web sites that use older technologies designed only for Internet Explorer, such as custom ActiveX controls and Browser Helper Objects. For these users, Internet Explorer will also be available on Windows 10. Internet Explorer will use the same dual rendering engines as Spartan, ensuring web developers can consistently target the latest web standards.


edit: looking again at how that is worded, it might only apply to enterprise versions of windows? i guess we'll see when it comes out.


Thanks, i tried windows 10 preview, there's problem with some scripts that use html.
Spatan browser still doesn't exist.
Beside this, windows 10 is awesome
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-19 10:02:21
did you try that code snippet in my post above yours. does htmlfile fail to load?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-20 10:09:56
did you try that code snippet in my post above yours. does htmlfile fail to load?

I was inastall windows 10 on second partition, but i want to install on second hard disk..
When i do this , i will post later ..
Maybe this is some err in my script..
YT radio works fine, biography photos works fine, err appears in ''bio text'', in ''href tag''..

Marc i have this script:

Code: [Select]
                fso = new ActiveXObject("Scripting.FileSystemObject");
                folder = fb.ProfilePath + "Temp";
                filename = folder + "\\"+ artist + " - " + title + ".m3u";

                              if (fso.FolderExists(folder))  .....

I can locate specific file in folder: (''filename = folder + "\\"+ artist + " - " + title + ".m3u";'')
But how do i list all files in that folder, with extension ''.m3u''?

I need this , to be able to play loved tracks, which is located in that folder.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-20 10:38:37
there's no point trying that script. it was only after i posted that i checked and saw that JSplaylist uses the htmlfile ActiveXObject. strangeluck already indicated JSplaylist works fine on that new windows 10 build.

also, i forgot you had your own internet scraping scripts so it's pointless testing for the stuff i use when you could be using something else different.

as for your m3u question, look at utils.glob in the docs.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-20 11:23:40
there's no point trying that script. it was only after i posted that i checked and saw that JSplaylist uses the htmlfile ActiveXObject. strangeluck already indicated JSplaylist works fine on that new windows 10 build.

also, i forgot you had your own internet scraping scripts so it's pointless testing for the stuff i use when you could be using something else different.

as for your m3u question, look at utils.glob in the docs.


Thanks, this works:
Code: [Select]
 var arr = utils.Glob(folder + "\\*.*").toArray();

Problem is that foobar wont read ''*.m3u'' file that i made
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-20 13:49:09
big assumption here but if you used the p.save function in my common file to create your m3u files, that would explain why it doesn't work.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-20 14:56:04
big assumption here but if you used the p.save function in my common file to create your m3u files, that would explain why it doesn't work.

This is what i'm use:

Code: [Select]
           case 50:
                p.path = p.eval("%path%");
                p.artist = p.eval("%artist%");
                p.title = p.eval("%title%");
               
                fso = new ActiveXObject("Scripting.FileSystemObject");
                folder = fb.ProfilePath + "YT";
                filename = folder + "\\"+ p.artist + " - " + p.title + ".m3u";
                if(!fso.FolderExists(folder)) fso.CreateFolder(folder);

                function save_file(x) {
                try {
                g_text = p.path;
                ts = fso.OpenTextFile(filename, 2, true, -1);
                ts.Write(g_text);
                ts.close();
                } catch(e) {
                fb.trace("Error saving text: " + e);
                }
                  }

                save_file(filename);
break;

(if i enter same text manualy in file, it works..)

EDIT:

Ok, i fix problem with this line:
(now works fine).

Code: [Select]
ts = fso.OpenTextFile(filename, 2, true, -2);
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-20 17:57:10
Code: [Select]
fso.OpenTextFile(filename, 2, true, -1);


you probably looked at that and didn't understand what the numbers were for.... so you googled it and found out. that had to be more satisfying than me telling you even if i did you give quite a large clue.

since strangeluck hasn't come back with any meaningful bug reports about scripts crashing in the latest build of windows 10, i've knocked up a little script which does some more in depth testing. first it tests the clipboard because i think that's all falstaff uses it for in JSplaylist. i then test some html stuff. since i'm on windows 7, this is what my popup window reports...

Code: [Select]
creating the htmlfile ActiveXObject works.
clipboardData.setData() works.
clipboardData.getData() works.
open() works.
createElement() works.
innerHTML and innerText works.
getElementsByTagName works.
className works.
close() works.
testing complete. everything seems ok.


it's just a blank white panel and you double click to run...

https://gist.github.com/marc2k3/b3d7b5da40af202738ad (https://gist.github.com/marc2k3/b3d7b5da40af202738ad)
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-20 20:32:30
it's just a blank white panel and you double click to run...
https://gist.github.com/marc2k3/b3d7b5da40af202738ad (https://gist.github.com/marc2k3/b3d7b5da40af202738ad)

I'm on 9926 build (Not the latest one 10041)

Code: [Select]
creating the htmlfile ActiveXObject works.
clipboardData.setData() works.
although clipboardData.getData() didn't crash the script, the text does not match what was written in the previous test.
open() works.
createElement() works.
innerHTML and innerText works.
getElementsByTagName works.
className works.
close() works.
testing complete. everything seems ok.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-20 21:45:21
Code: [Select]
although clipboardData.getData() didn't crash the script, the text does not match what was written in the previous test.


well that's weird. although i accounted for it, i didn't actually expect to see it happen in practice. if you use JSplaylist, can you test and see if copy/paste functionality works between input boxes? if it works, we can probably ignore that error....

as for anyone else, the above gist script is only going to be useful if you're running the latest 10041 build of windows 10 - something i can't do at the moment.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-20 21:53:07
Code: [Select]
fso.OpenTextFile(filename, 2, true, -1);


you probably looked at that and didn't understand what the numbers were for.... so you googled it and found out. that had to be more satisfying than me telling you even if i did you give quite a large clue.


Yes,  I didn't not exactly for what  the numbers are.  So i assumed that this is for file format.
Thanks, you give me a clue..

One more thing, because script use 'cmd' to open 'm3u' files, if i have spaces in folder path, then it won't open.
So, how to fix this? I was try to add double quotes.. Didn't work, or i put in wrong place.
My path: ''C:\user\mire\desktop\foobar xch4\file_name.m3u''

since strangeluck hasn't come back with any meaningful bug reports about scripts crashing in the latest build of windows 10, i've knocked up a little script which does some more in depth testing. first it tests the clipboard because i think that's all falstaff uses it for in JSplaylist. i then test some html stuff. since i'm on windows 7, this is what my popup window reports...

Code: [Select]
creating the htmlfile ActiveXObject works.
clipboardData.setData() works.
clipboardData.getData() works.
open() works.
createElement() works.
innerHTML and innerText works.
getElementsByTagName works.
className works.
close() works.
testing complete. everything seems ok.


it's just a blank white panel and you double click to run...

https://gist.github.com/marc2k3/b3d7b5da40af202738ad (https://gist.github.com/marc2k3/b3d7b5da40af202738ad)


I will test later...
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-21 05:47:14
Code: [Select]
although clipboardData.getData() didn't crash the script, the text does not match what was written in the previous test.


well that's weird. although i accounted for it, i didn't actually expect to see it happen in practice. if you use JSplaylist, can you test and see if copy/paste functionality works between input boxes? if it works, we can probably ignore that error....

as for anyone else, the above gist script is only going to be useful if you're running the latest 10041 build of windows 10 - something i can't do at the moment.


copy/paste works fine in JSplaylist 

Although i had encountered a very frustrating issue with your similar artist script
The script download the json file first time without any errors, but in couple of seconds,
Code: [Select]
Last.fm Similar Artists: JSON.parse error.

when i looked at the downloaded folder,seems like it replaces the json file with a empty file.
Any idea what caused this??
But i cant reproduce it every time, It only happens some times, very weird error :/.
Had anyone encountered this??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-21 06:59:16
@mire777, you need to escape the quotes in your path. here are 2 different ways of doing it.

Code: [Select]
"\"" + fb.ProfilePath + "playlist.m3u\""


or

Code: [Select]
'"' + fb.ProfilePath + 'playlist.m3u"'


@samithaj, thanks for confirming copy/paste works in JSplaylist on windows 10. i'll update my script with the erroneous clipboard reporting.

as for the JSON.parse error, **** happens. i guess invalid responses shouldn't blindly be written to disk. simply look for all instances of p.save in the common file and find the one that is used by the last.fm script. think about how you can validate the response before saving.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-21 13:17:52
@mire777, you need to escape the quotes in your path. here are 2 different ways of doing it.

Code: [Select]
"\"" + fb.ProfilePath + "playlist.m3u\""

or

Code: [Select]
'"' + fb.ProfilePath + 'playlist.m3u"'

Thanks Marc , it works
Here is script if someone wants to try on windows 10..                                         

-You can love, unlove or play loved tracks as radio .
Should work as last.fm ''loved''.
Playlist are saved in foobar folder: ''playlists-YT''.

(http://i.imgur.com/iSq51vr.png)

[code]
// ==PREPROCESSOR==
// @name "Youtube Radio"
// @author "Mire777"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

//Properties
YT_PL = window.GetProperty("YT  Playlist", "0");
YT_AUTO = window.GetProperty("YT  Auto", "0");
YT_TRACK = window.GetProperty("YT Track", "");
STATION = window.GetProperty("YT  Station", "");
SIM_ART = window.GetProperty("YT Similar", "");
YT_URL = window.GetProperty("YT URL", "");
art = window.GetProperty("YT  Artist Variety (1-20)", "20");
sng = window.GetProperty("YT  Song  Hotness (1-20)", "20");
tag = window.GetProperty("YT  Tag  Hotness (1-100)", "27");
pls = window.GetProperty("FB Playlist", "YT Radio");

//Folder
fso = new ActiveXObject("Scripting.FileSystemObject");
folder = fb.ProfilePath + "playlists-YT";

var MF_GRAYED = 0x00000001;
var MF_STRING = 0x00000000;
var IDC_ARROW = 32512;
var IDC_HAND = 32649;

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 on_colors_changed() {
p.colors_changed();
}

function on_selection_changed() {
p.item_focus_change();
}

function on_playlist_switch() {
set_focus0(); //Check Playlist
}

function on_playback_new_track() {
p.item_focus_change();
if (fb.ActivePlaylist == (GetPlaylistID(pls + " [Loved]"))) if (fb.PlaybackLength>=50) {LOVED();} else
p.item_focus_change();
LOAD_ART();
}

function on_playback_dynamic_info_track() {
p.item_focus_change();
}

function on_playback_stop() {
p.item_focus_change();
}

function on_item_focus_change() {
p.item_focus_change();
}

function on_mouse_leave() {
}

function on_mouse_rbtn_up(x, y) {
p.rbtn_up(x, y);
return true;
}

//Remove false string from file names   
this.clean_filename = function(filename) {
return filename.replace(/[\/\\|:]/g, '-').replace(/\*/g, 'x').replace(/"/g, "''").replace(/[?<>]/g, '_');
}

//Playlist
function GetPlaylistID(Playlist_Name)
{
for (var i = 0; i < fb.PlaylistCount; i++)
{
if (fb.GetPlaylistName(i) == Playlist_Name)
{
return i;
}
}

//Create playlist if it doesn't exist
fb.CreatePlaylist(fb.PlaylistCount, Playlist_Name);
return i;
}

//Playlist(Check)
function GetPlaylistID0(Playlist_Name)
{
for (var i = 0; i < fb.PlaylistCount; i++)
if (fb.GetPlaylistName(i) == Playlist_Name)
{
return i;
}
}

//Focus on playlist(Check)
function set_focus0()

if (pls>"")
{
var PL_NM = (GetPlaylistID0(pls + " ["+ STATION +"]"));
if (fb.ActivePlaylist == PL_NM) {YT_PL = 1; window.SetProperty("YT  Playlist", "1");}
else
{YT_PL = 0; window.SetProperty("YT  Playlist", "0");}
}
}

//Focus on playlist(YT Radio)
function set_focus()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " ["+ STATION +"]"));
}

//Focus on playlist(Same Video)
function set_focus2()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Same Video]"));
}

//Focus on playlist(Search Videos)
function set_focus3()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Search Videos]"));
}

//Focus on playlist(Popular Tracks)
function set_focus4()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Tracks: "+ p.artist +"]"));
}

//Focus on playlist(Similar Tracks)
function set_focus5()
{
if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Similar to: "+ p.artist + " - " + p.title +"]"));
}

//Focus on playlist(Loved)
function set_focus6()
{
if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Loved]"));
}

//Panel
    function panel(name, features) {
    this.item_focus_change = function() {
    if (!this.metadb_func) return;
    switch(this.selection_mode) {
    case 0:
    this.metadb = fb.GetSelection();
    break;
    case 1:
    this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    break;
    case 2:
    this.metadb = fb.GetFocusItem();
    break;
      }
      if (this.metadb) on_metadb_changed();
   }

//Metadb
this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

//Size   
    this.size = function() {
    this.w = window.Width;
    this.h = window.Height;
}

//Move   
    this.move = function(x, y) {
    this.mx = x;
    this.my = y;
}

//Menu   
    this.rbtn_up = function(x, y) {
    var _menu = window.CreatePopupMenu();
    var q = window.CreatePopupMenu();
    var MF_POPUP = 0x00000010;
    var idx;
    switch(true) {
            case typeof th == "object":
            case typeof im == "object":

on_item_focus_change()           
if (pls>"")
{               
if(YT_AUTO==1) _menu.AppendMenuItem(MF_STRING, 1902, "Youtube Radio");
if(YT_AUTO==0) _menu.AppendMenuItem(MF_STRING, 1903, "Youtube Radio");
_menu.CheckMenuItem(1902, YT_AUTO?1:0);

_menu.AppendMenuSeparator();

//POPUP BUTTON
{_menu.AppendMenuItem(MF_STRING | MF_POPUP, q.ID, "Open");}

//START *POPUP
p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Radio Station by [%artist%]");}
else
{q.AppendMenuItem(MF_STRING, 1915, "Radio Station by [" + p.artist.replace(/&/g,"&&") + "]");}

p.genre = p.eval("%genre%");
if (p.genre == "" || p.genre == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Radio Station by [%genre%]");}
else
{q.AppendMenuItem(MF_STRING, 1921, "Radio Station by [genre: " + p.genre.replace(/&/g,"&&") + " ]");}

p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Top Tracks by " + "[%artist%]");}
else
{q.AppendMenuItem(MF_STRING, 1916, "Top Tracks by [" + p.artist.replace(/&/g,"&&") + "]");}

p.artist = p.eval("%artist%");
p.title = p.eval("%title%");
if (p.artist == "" || p.artist == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Similar Tracks as [%artist% - %title%]");}
else
{q.AppendMenuItem(MF_STRING, 1920, "Similar Tracks as [" + p.artist.replace(/&/g,"&&") + " - " + p.title.replace(/&/g,"&&") + "]");}
//END *POPUP

_menu.AppendMenuSeparator();

{
if(YT_PL==1 && YT_AUTO==1 && STATION>"") {_menu.AppendMenuItem(MF_STRING, 22, "Get Next Video");}
else
{_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Get Next Video");}

_menu.AppendMenuSeparator();

_menu.AppendMenuItem(MF_STRING, 1914, "Start Radio Station");

_menu.AppendMenuSeparator();

//START LOVED
p.path = p.eval("%path%");
p.artist = p.eval("%artist%");
p.title = p.eval("%title%");
filename = folder + "\\"+ clean_filename(p.artist + " - " + p.title) + ".m3u";

if (p.path.indexOf("youtube.com")>0) {
if (fso.FileExists(filename)) {_menu.AppendMenuItem(MF_STRING, 500, "♥ Un-Love");}
else
{_menu.AppendMenuItem(MF_STRING, 501, "♥ Love Track");}
if (fb.ActivePlaylist == (GetPlaylistID(pls + " [Loved]"))) {_menu.AppendMenuItem(MF_STRING, 502, "♪ Next Loved..");}
else
{_menu.AppendMenuItem(MF_STRING, 502, "♪ Play Loved..");}
} else
{
_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "♥ Love Track");
{_menu.AppendMenuItem(MF_STRING, 502, "♪ Play Loved..");}
}
//END LOVED

_menu.AppendMenuSeparator();

p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Open Same Video..");}
else
{_menu.AppendMenuItem(MF_STRING, 403, "Open Same Video..");}

/* //Find in Browser
_menu.AppendMenuSeparator();
p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Find in Browser");}
else
{_menu.AppendMenuItem(MF_STRING, 404, "Find in Browser");}
_menu.AppendMenuSeparator();*/

_menu.AppendMenuItem(MF_STRING, 401, "Search For Videos...");

_menu.AppendMenuSeparator();

_menu.AppendMenuItem(MF_STRING, 9, "Properties...");
}            
}
}
if (pls=="") {_menu.AppendMenuItem(MF_STRING, 9, "Please Set: (FB Playlist)");}
if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
      
        idx = _menu.TrackPopupMenu(x, y);
        switch(idx) {
         
          case 9:
            window.ShowProperties();
            break;
               
          case 10:
            window.ShowConfigure();
            break;
               
          case 22:
                set_focus(); //Focus on playlist
            LOAD_ART();
            break;
               
          case 401:
                set_focus3(); //Focus on playlist
            fb.RunMainMenuCommand("View/Youtube Source");
            break;
               
          case 403:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                set_focus2(); //Focus on playlist
                LOAD_SAME();
            break;
         
          case 404:
                p.artist = p.eval("%artist% %title%");
                p.browser("https://www.youtube.com/results?search_query=" + encodeURIComponent(p.artist));
                break;
           
          case 500:
                filename = folder + "\\"+ clean_filename(p.artist + " - " + p.title) + ".m3u";
                //Delete file
                if (fso.FileExists(filename)) fso.DeleteFile(filename);
                break;
               
          case 501:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                p.path = p.eval("%path%");
                p.artist = p.eval("%artist%");
                p.title = p.eval("%title%");
               
                //Create file & folder
                filename = folder + "\\"+ clean_filename(p.artist + " - " + p.title) + ".m3u";
                if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
               
                //Save file
                function save_file(x) {
                try {
                g_text = p.path;
                ts = fso.OpenTextFile(filename, 2, true, -2);
                ts.Write(g_text);
                ts.close();
                } catch(e) {
                fb.trace("Error saving text: " + e);
                }}
                save_file(filename);
            break;

          case 502:
                LOVED();
            break;
               
          case 1902:
                YT_AUTO = 0;
                window.SetProperty("YT  Auto", "0");
                break;
     
          case 1903:
                YT_AUTO = 1;
                window.SetProperty("YT  Auto", "1");
                break;
         
          case 1914:
                var Start;
                Start = this.InputBox("Type Artist to Start Station\n\n( *genre - will play genre station)", "Youtube Radio", "");
                if (Start=="")
                {
                }
                else
                {
                YT_PL = 1;
                window.SetProperty("YT  Playlist", "1");
                YT_AUTO = "1"
                window.SetProperty("YT  Auto", "1");
                STATION = Start;
                window.SetProperty("YT  Station", Start);
                set_focus(); //Focus on playlist
                LOAD_ART();
                }
                break;
           
          case 1915:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                p.artist = p.eval("%artist%");
                if (p.artist == "" || p.artist == "?") return;
                STATION = p.artist;
                window.SetProperty("YT  Station", p.artist);
                YT_PL = 1;
                window.SetProperty("YT  Playlist", "1");
                YT_AUTO = "1"
                window.SetProperty("YT  Auto", "1");
                set_focus(); //Focus on playlist
                LOAD_ART();
                break;
       
          case 1916:
                set_focus4(); //focus on playlist
                POP_TRACKS();
                break;
           
          case 1920:
                //set_focus5(); //focus on playlist
                SIMILAR_TRACKS();
                break;
           
          case 1921:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                p.genre = p.eval("%genre%");
                if (p.genre == "" || p.genre == "?") return;
                STATION = "*" + p.genre;
                window.SetProperty("YT  Station", "*" + p.genre);
                YT_PL = 1;
                window.SetProperty("YT  Playlist", "1");
                YT_AUTO = "1"
                window.SetProperty("YT  Auto", "1");
                set_focus(); //Focus on playlist
                LOAD_GENRE();
                break;
              }
              _menu.Dispose();
           }

//Features init
    this.features_init = function() {
    for (i = 0; i < this.features.length; i++) {
    switch(this.features) {
    case "metadb":
    this.selection_mode = 1;
    break;
    case "remap":
    this.artist_tf = ("%artist%");
    break;
         }
      }
   }
   
    this.check_feature = function(f) {
    for (i = 0; i < this.features.length; i++) {
    if (this.features == f) return true;
    }
    return false;
    }

//Eval
   this.eval = function(tf) {
    if (!this.metadb || tf == "") return "";
    if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
    return fb.TitleFormat(tf).Eval();
    } else {
    return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
    }
   }
   
//Console Msg
    this.console = function(message) {
    this.name = "Youtube Radio"   
    fb.trace(this.name + ": " + message);
    }
   
//Trim
    String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, "");
    }   

//Input Box   
   this.InputBox = function(prompt, title, value) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    value = value.replace(/"/g, '" + Chr(34) + "');
    var temp_value = this.vb.eval('InputBox' + '("' + prompt + '", "' + title + '", "' + value + '")');
    if (typeof temp_value == "undefined") return value;
    if (temp_value.length == 254) this.MsgBox("Your entry was too long and will be truncated.\n\nSee the WSH panel mod script discussion thread on hydrogenaudio forums for help.", 0, "Youtube Radio");
    return temp_value.trim();
   }

//Msg Box   
   this.MsgBox = function(prompt, buttons, title) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
   }

//Browser   
   this.browser = function(command) {
    if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, "Youtube Radio");
   }

//Run Command   
   this.run = function(command) {
    try {
    this.WshShell.Run(command);
    return true;
    } catch(e) {
    return false;
    }
   }
   
//futures   
    this.metadb_func = typeof on_metadb_changed == "function";
   this.features = features;
   this.dui = window.InstanceType;
   this.metadb = fb.GetFocusItem();
   this.WshShell = new ActiveXObject("WScript.Shell");
   this.fso = new ActiveXObject("Scripting.FileSystemObject");
   this.vb = new ActiveXObject("ScriptControl");
   this.vb.Language = "VBScript";
   this.artist_tf = "%artist%";
   this.features_init();
    this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    if (fb.GetFocusItem())
    {this.artist = fb.TitleFormat(this.artist_tf).EvalWithMetadb(this.metadb);}

}

//YT NAMES-------------------------------------------------

//Clean Art Name
CLEAN_ART_NAME = function (t)
{  try
    {
    return t.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'");
    } catch (e) {}
}

//Clean Track Name
CLEAN_TRACK_NAME = function (t)
{  try
    {
    return t.replace(/about:\//,"").trim().split(" (")[0].replace(" (","").split(" [")[0].replace(" [","").split(" {")[0].replace(" {","").split(", ")[0].replace(", ","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace(" 01-","").replace(" 02-","").replace(" 03-","").replace(" 04-","").replace(" 05-","").replace(" 06-","").replace(" 07-","").replace(" 08-","").replace(" 09-","").replace("09  ","").replace("08  ","").replace("07  ","").replace("06  ","").replace("05  ","").replace("04  ","").replace("03  ","").replace("02  ","").replace("01  ","").replace("00  ","").replace("01 ","").replace("02 ","").replace("03 ","").replace("04 ","").replace("05 ","").replace("06 ","").replace("07 ","").replace("08 ","").replace("09 ","").replace("00 ","").replace(".mp","").replace(" - Remastered ","").replace(" - Remastered","").replace("- "," ").replace(decodeURIComponent(SIM_ART) + " -"," ").replace(decodeURIComponent(SIM_ART) + " - "," ").replace(" - Live ","").replace(" - Live","").replace(" Pt.1","").replace(" - Demo;2 Digital Remaster 66  ","").replace(" - Demo;2 Digital Remaster","").replace(" - Demo;","").replace(" - Demo","").replace("Digital Remaster","").replace("Original-  ","").replace("Original- ","").replace("Original-","").replace(" - Vocal Version","").replace(" Mega-Mix","").replace("Mega-Mix","").replace(" - Original Mix","").replace(" Pop Radio Edit","").replace(" Radio Edit","").replace(" - Single Version","").replace(" - Edited Version","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace(" - Extended Version","").replace(" -Remaster","").replace("`","'").replace(". "," ").replace(" Version","").replace(" edit","").replace(" - Edit","").replace("  Simple Mix","").replace("  Almighty Mix","").replace(" - Vocal","").replace(" Vocal","").replace("  Remix","").replace("  Extended Version","").replace(" - Explicit Version","").replace("- Explicit Version","").replace(" Explicit Version","").replace("Explicit Version","").replace(" Anthology", "").replace("The " + decodeURIComponent(SIM_ART), " ").replace(" - Survival Remix","").replace(" Radio Mix","").replace(" Survival Remix","").replace("Survival Remix","").replace(decodeURIComponent(SIM_ART) + "-"," ").replace(decodeURIComponent(SIM_ART)," ").replace(" Club Mix","").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("  wwwi.info","").replace(" Edit","").replace("live","").replace("Single","").replace("vk.com/xclusives zone ","").replace("  Acoustic","").replace("Remix","").replace("Part&","").replace("  +","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" Live;0 2","").replace("  Live;0 2","").replace("Live;0 2","").replace(' /"/"',"").replace(" -0","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("  Alternate Mix","").replace("Live","").replace(" Alternate Mix","").replace("Alternate Mix","").replace("-0","").replace("  remastered","").replace(" // СЛУШАЮТ:","").replace("www.KLAUSOM.lt","").replace("-;-Bit Digital Remaster","").replace(" :","").replace("-1  Remaster","").replace("  Genuine Album","").replace("  www.rsmp.com","").replace(" www.rsmp.com","").replace("www.rsmp.com","").replace("Instrumental","").replace(" Instrumental","").replace("www.SongsLover.pk","").replace(" Genuine Album","").replace("Album","").replace("Remaster","").replace("Lyrics","").replace("w/lyrics","").replace(" -","").replace("  Radio","").replace("0%","").replace("remaster","").replace(" Lyrics","").split(" | '' |")[0].replace(" | '' |","").split(" |")[0].replace(" |","").split("|")[0].replace("|","").split("| On:")[0].replace("| On:","").split(" feat")[0].replace(" feat","").split(" ft.")[0].replace(" ft.","").split(" Feat.")[0].replace(" Feat","").split("Greatest Hits Megamix")[0].replace("Greatest Hits Megamix","").split("Lyrics")[0].replace("Lyrics","").split("Lyric")[0].replace("Lyric","").split("www.")[0].replace("www.","").split(";Feat")[0].replace(";Feat","").trim();
    } catch (e) {}
}

//Clean Genre Name
CLEAN_GENRE_NAME = function (t)
{  try
    {
    return t.replace(/about:\//,"").replace("music/","").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").split("tag")[0].split("hype")[0].split("events")[0];
    } catch (e) {}
}

//*********************YT RADIO START**********************

//SIMILAR ARTIST--------------------------------------------
this.LOAD_ART = function()
{    if (YT_AUTO=="1")
      if (YT_PL=="1")
   
    { var randomnumber=Math.floor(Math.random()*art)
      var a=randomnumber;
        if (STATION == "" || STATION == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(STATION) + "/+similar"+ "?page=" + a, true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("div");
        div.innerHTML = text;
        var data = div.getElementsByTagName("a");
        var urls = [];

for (i = 0; i < data.length; i++) {
if (data.href.indexOf("about:/music/") == 0) urls.push(CLEAN_ART_NAME(data.href)); 
}

//select random URL
var randomnumber = Math.floor(Math.random()*(20-50)+50);
do{
randomnumber = Math.floor(Math.random()*(20-50)+50);
} while(randomnumber%2!=1);
i=randomnumber;

{
//Start with urls
if (urls > "")
{
//p.console("" + urls);
SIM_ART = window.SetProperty("YT Similar", urls);
SIM_ART = urls;
window.SetProperty("YT Similar", urls);
}
else
{
SIM_ART = window.SetProperty("YT Similar", "");
SIM_ART = "";
window.SetProperty("YT Similar", "");
}                 
}
           
        this.doc.close();
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
        else
        if (SIM_ART == "" || SIM_ART == "?") {LOAD_ART();}
        else
        LOAD_TRACK();
        } else {
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
        else
        if (this.xmlhttp.status == 404) {p.console("HTTP error: " + this.xmlhttp.status); LOAD_ART();}
                }
         }
      }
   }                           
}

//LOAD TRACK----------------------------------------------------
this.LOAD_TRACK = function()
{
   
    {var randomnumber=Math.floor(Math.random()*sng)
    var a=randomnumber;
        if (SIM_ART == "" || SIM_ART == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(SIM_ART) + "/+tracks" + "?page=" + a, true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("tr");
        div.innerHTML = text;
        var data = div.getElementsByTagName("td");
        var urls = [];

for (i = 0; i < data.length; i++) {
if (data.title) urls.push(CLEAN_TRACK_NAME(data.title));
}

//select random URL
var randomnumber = Math.floor(Math.random()*Math.max(urls.length));
i=randomnumber;

{

//Start with urls
if (urls > "")
{
p.console("" + SIM_ART + " - " + urls);

YT_TRACK = window.SetProperty("YT Track", urls);
YT_TRACK = urls;
window.SetProperty("YT Track", urls);
}
else
{
YT_TRACK = window.SetProperty("YT Track", "");
YT_TRACK = "";
window.SetProperty("YT Track", "");
}
}

        this.doc.close();
        if (YT_TRACK == "" || YT_TRACK == "?") {LOAD_ART();}
        else
        set_focus(); //focus on playlist
        do_youtube_search1(decodeURIComponent(SIM_ART), decodeURIComponent(YT_TRACK));
        } else {
        p.console("HTTP error: " + this.xmlhttp.status);
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
        else
        if (this.xmlhttp.status == 404) {LOAD_ART();}
                }
         }
      }
   }
}

//POPULAR TRACKS----------------------------------------------------
this.POP_TRACKS = function()
{      p.artist = p.eval("%artist%");

    {  if (p.artist == "" || p.artist == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+tracks" + "?page=1", true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("tr");
        div.innerHTML = text;
        var data = div.getElementsByTagName("td");
        var urls = [];
   
for (i = 0; i < data.length; i++) {
if (data.title) urls.push(CLEAN_TRACK_NAME(data.title));
}

//Select urls
for (i = 0; i < urls.length; i++)

{
//Start with urls
if (urls > "")
do_youtube_search1(decodeURIComponent(p.artist), urls);
}
        this.doc.close();
        } else {
        p.console("HTTP error: " + this.xmlhttp.status);
                }
         }
      }
   }
}

//SIMILAR TRACKS----------------------------------------------------
this.SIMILAR_TRACKS = function()
{ p.artist = p.eval("%artist%");
p.title = p.eval("%title%");

{ if (p.artist == "" || p.artist == "?") return;
if (p.title == "" || p.title == "?") return;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/_/" + encodeURIComponent(p.title) + "/+similar", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("td");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];

for (i = 0; i < data.length; i++) {

if (data.href.indexOf("/_/")>0)

urls.push((data.href));
}

//Select urls
for (i = 0; i < 100; i++)

{
//Start with urls
if (urls.indexOf("http:")==0) return;
if (urls.indexOf("/_/") >0)
title_split = urls.split("/_/")[1].replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ");
artist_split = urls.split("/_/")[0].replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("about:/music/","").replace("noredirect/","");
set_focus5();//set focus on playlist
do_youtube_search1(decodeURIComponent(artist_split),decodeURIComponent(title_split));

}
this.doc.close();
} else {
p.console("HTTP error: " + this.xmlhttp.status);
}
}
}
}
}

//GENRE----------------------------------------------------
this.LOAD_GENRE = function()
{    if (STATION.indexOf("*")== 0)
 
    { var randomnumber=Math.floor(Math.random()*tag)
      var a=randomnumber;
        if (STATION == "" || STATION == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/+tag/" + encodeURIComponent(STATION).replace("*","") + "?page=" + a, true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("li");
        div.innerHTML = text;
        var data = div.getElementsByTagName("a");
        var urls = [];
   
for (i = 0; i < data.length; i++) {
    if (data.className.indexOf("name") == 0)
    if (data.href.indexOf("about:/music/") == 0) urls.push(CLEAN_GENRE_NAME(data.href));
}

//select random URL
var randomnumber = Math.floor(Math.random()*(0-9)+9);
do{
randomnumber = Math.floor(Math.random()*(0-9)+9);
} while(randomnumber%2!=0);

i=randomnumber;

{

//Start with urls
if (urls > "")
{
//p.console("" + urls);
SIM_ART = window.SetProperty("YT Similar", urls);
SIM_ART = urls;
window.SetProperty("YT Similar", urls);
}
else
{
SIM_ART = window.SetProperty("YT Similar", "");
SIM_ART = "";
window.SetProperty("YT Similar", "");
}
}
        this.doc.close();
        if (SIM_ART == "" || SIM_ART == "?") {LOAD_GENRE();}
        else
        LOAD_TRACK();
        } else {
        p.console("HTTP error: " + this.xmlhttp.status);
        if (this.xmlhttp.status == 404) {LOAD_GENRE();}
                }
         }
      }
   }
}
//LOVED----------------------------------------------------
this.LOVED = function()
{
                //list files
                var arr = utils.Glob(folder + "\\*.*").toArray();
                var a = [];

                for (i = 0; i < arr.length; i++) {
                if (arr) a.push(arr); 
                    }
                //select random file
                var randomnumber = Math.floor(Math.random()*Math.max(arr.length));
                i=randomnumber;
               
                file_path = arr;
                var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
                var str = tmppath + "\\foobar2000.exe /add ";
                var go = str + '"' + file_path + '"';
               
                //load file
                set_focus6(); //Focus on playlist
                var tm = window.SetTimeout(function() {
                p.run(go);
                p.console(file_path);
                window.ClearTimeout™; tm = false;
                }, 50);   
}

//SAME VIDEO-----------------------------------------------
this.LOAD_SAME = function()
    {
      var artist0 = p.eval("%artist%");
      var title0 = p.eval("%title%");
      if(artist0 > "?" && title0 > "?") {set_focus2(); do_youtube_search1(decodeURIComponent(artist0), decodeURIComponent(title0));}
}

//LOAD YOUTUBE VIDEO---------------------------------------
strip_title = function (t1, t2)
{
    try
    {
        if (t1 == t2)
        return t1;
        if (t1.match(RegExp(t2 + "( and | & )", "i")))
        return t1;
        var a = "(by the |by: |by |of |the |feat. |ft. |)";
        var b = "( feat.| ft.|)";
        var t3 = "";
        if (!t2.match(/^the /i))
        {
        t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t2 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
        }
        else
        {
        var t4 = t2.replace(/^the /i, "")
        t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t4 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
        }
        return t3.match(/\S/) ? t3 : t1;
    }
    catch (e)
    {
    return t1;
    }
}

convert = function(min)
{
    var parts = min.split(':'),
    minutes = +parts[0],
    seconds = +parts[1];
    return minutes * 60 + seconds;
}

strip = function (t)
{
    try
    {
    t = t.replace(/[\.,\!\?\:;'"\-_]/g,"").toLowerCase();
    return t;
    } catch (e)
    {}
}

clean = function (t)
{
    try
    {
    return t.replace(/'/g, "’").toLowerCase();
    } catch (e) {}
}

youtube_search = function (state_change_callback, p_on_search_finished_callback)
{
        this.xmlhttp = null;
        this.http_callback_funct = null;
        this.ready_state_change_callback = state_change_callback;
        this.search_done = false;
        this.on_search_finished_callback = p_on_search_finished_callback;
        this.yt_link;
        this.search_artist;
        this.search_title;
        this.metadata;

    this.on_state_change = function ()
    {
    if (this.xmlhttp != null && this.xmlhttp.readyState == 4 && this.xmlhttp.status == 200 && this.http_callback_funct != null)
    this.http_callback_funct();
    }

    this.StartSearch = function (p_artist, p_title, p_extra_metadata)
    {
        this.search_artist = p_artist;
        this.search_title = p_title;
        this.metadata = p_extra_metadata;
        this.http_callback_funct = null;
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

        var URL = "https://www.youtube.com/results?search_query=" + encodeURIComponent(p_artist + " " + p_title);

        this.http_callback_funct = this.AnalyseSearch;
        this.xmlhttp.open("GET", URL);
        this.xmlhttp.onreadystatechange = this.ready_state_change_callback;
        this.xmlhttp.send();
    }

    this.AnalyseSearch = function ()
    {
        var text = this.xmlhttp.responsetext;
        var doc = new ActiveXObject("htmlfile");
        doc.open();
        var div = doc.createElement("div");
        div.innerHTML = text;
        var data = div.getElementsByTagName("a");
        var url = "";
        var first_match;

        re_test:

        for (var i = 0; i < data.length; i++)
        {
        if (data.href.indexOf("about:/watch?v=") == 0)
          {
                i++; //link

            //Find Title[OLD]
            /*{
            var st = text.indexOf( data.href.replace("about:/watch?", "") );
            var str = "a class=\"yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2 yt-uix-sessionlink spf-link\">";
            st = text.indexOf(str, st) + str.length;
            var et = text.indexOf("</a>", st);
            var youtube_title = text.substr(st, et - st);
            var Y_Title = youtube_title.replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&");
            //p.console("Title: " + Y_Title);
            }*/
           
            //Find Title[NEW]
            Y_Title = data.title;
            Remove_duration = Y_Title.substring(Y_Title.lastIndexOf(" - ")+1);
            Y_Title = data.title.replace(Remove_duration, "").trim();
            //p.console("Title: " + Y_Title);
               
            //Find minutes
            var s = text.indexOf( data.href.replace("about:/watch?", "") );
            var str = "<span class=
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-03-21 13:20:31
Hi,
Is there a bug ... similar-artists and Lastfm-chart give blank page ???
thanks for your help .
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-21 21:39:17
get your own last.fm api key here: http://www.last.fm/api/account/create (http://www.last.fm/api/account/create)
make up any old name and copy the api key to the clipboard.

now right click your last.fm panels, configure and look for the code where it says

Code: [Select]
var l = new lastfm();


enter this line directly after it

Code: [Select]
l.api_key = "abc123";


obviously your own api key needs to go inside the double quotes.

some people have directed others to add their secret from the api account as well. you don't need to do this for the similar artists/charts scripts. it's only required if you use playcount sync to love/unlove tracks. you simply add another line directly after the one above.

Code: [Select]
l.secret = "abc123";


if you do this, make sure you enter your password again so it's authorised with your new api key.
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-03-22 06:52:34
@ Marc2003
Thanks a lot , you are really the best !
Title: WSH Panel Mod script discussion/help
Post by: Celeste on 2015-03-22 08:55:39
Hey everyone,

(http://image.noelshack.com/fichiers/2015/12/1427014429-panel.jpg)

I'm working on a new design for foobar, inspired by turntables. I've already made this panel, using stack splitter. It works pretty well. But playback order can't be refreshed in real time. So when changing it from the menu, the panel doesn't refresh itself. I think I have no choice but switching to WSH, and rewrite everything. Moreover I would be able to add a volume knob and other features. However, it's not as simple as Panel Stack/CUI for me, since I never wrote anything into it. I read a lot of scripts that I found to understand how it works, sometimes I also edited them. But starting from zero... the mountain is just too high. So I was wandering, if anybody had links to a wiki, or anything to learn ? Or if someone would show me how to make, for example, a button ?

Thank you very much. This is my first post, I'm happy to get in touch with the foobar community.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-22 16:06:01
Ok I install windows 10 build 10041 .
This is report of running Marc script:

Code: [Select]
creating the htmlfile ActiveXObject works.
clipboardData.setData() works.
clipboardData.getData() works.
open() works.
createElement() works.
innerHTML and innerText works.
getElementsByTagName works.
className works.
close() works.
testing complete. everything seems ok.


I just put my old portable config with bio photography, bio text, new youtube radio.
Everything seems to work fine, I don't have any error.

Surprisingly for me, Windows 10 works incredibly fast, and you don't have to install any drivers 
I am satisfied with this version..
Just don't know should I use windows 10 as my main OS right now, because I don't know if tehnical preview will be updated to the full version later, or I must be on windows 8.1?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-22 17:15:23
Uh, seems that I found problem> ''HTTP error: 0 '' on bio script , mean that it loose internet connection.
After I restart foobar script works fine ,for a while then I again have this error.
Also this: ''Error: WSH Panel Mod (Biography Text by Mire777): Microsoft JScript runtime error:
'id' is null or not an object'' > I assume this is also because windows or foobar loose connection..
Anyway, can't be bothered with that. I will use windows 8 for now..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-22 18:34:06
@mire777, thanks for checking windows 10.

@Celeste, have you looked at the buttons/playback order examples bundled with the component? unfortunately, i don't know of any guides to help people start making stuff from scratch. it just takes time and (a lot of) patience to try and pick apart other people's work.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-22 21:25:13
@mire777, thanks for checking windows 10.


Unfortunately I have same problem in windows 8.1.
Maybe something block foobar scripts? Windows defender?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-22 21:34:33
http error code 0 can be caused by lots of things and is pretty hard to troubleshoot. here are just a few causes i've stumbled across by chance

website redirects. i only noticed this when dropbox changed the content hosting URL and it broke my script updates.
conflicting cookies. if you browse a website in IE and it leaves some cookies, it can affect scripts configured to use the same site. one such example is my thumbs script. when i first made it, it was configured to use www.last.fm - if the user had visited any regional last.fm site like lastfm.de then it broke my script giving status code 0.
and sometimes it just can be random.

maybe using wireshark to analyse the server responses would help. hopefully you'll get something more useful than just an error code.
Title: WSH Panel Mod script discussion/help
Post by: Celeste on 2015-03-23 08:35:26
Thank you marc2003, I found good informations in the WSH folder, and with patience I managed to draw a volume knob.

Does someone know how to draw rotated shapes ? I'd like to put a thin line on my knob (it's currently a dot), so I need to draw a rotated rectangle.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-23 11:18:02
http error code 0 can be caused by lots of things and is pretty hard to troubleshoot. here are just a few causes i've stumbled across by chance

website redirects. i only noticed this when dropbox changed the content hosting URL and it broke my script updates.
conflicting cookies. if you browse a website in IE and it leaves some cookies, it can affect scripts configured to use the same site. one such example is my thumbs script. when i first made it, it was configured to use www.last.fm - if the user had visited any regional last.fm site like lastfm.de then it broke my script giving status code 0.
and sometimes it just can be random.

maybe using wireshark to analyse the server responses would help. hopefully you'll get something more useful than just an error code.


I found what cause this error.
This is because 'foo_youtube.dll'.
If you have enabled 'playback video' , foo_youtube.dll  loads second track 10sec before previous ends, in that way foo_youtube tryin to fix ('no video error').
Probably this leaves some cookies or affect, not only to 'Foobar Radio', but all scritps that use IE.
Quick fix is to just turn off 'playback video' in preferences. You can listen sound.
How to fix this with script, or is it possible, don't know..
Title: WSH Panel Mod script discussion/help
Post by: clitorislove on 2015-03-23 11:39:30
@mjm716, close foobar2000 and then save this in your marc2003 folder.

https://dl.dropboxusercontent.com/u/2280132...temp/common8.js (https://dl.dropboxusercontent.com/u/22801321/wsh/temp/common8.js)


I just registered in order to get this script.

Marc2003 I admire your work and you use it frequently. The script has stopped working, I've read that you have stopped supporting your scripts, I understand and respect that. But is there any chance that you can re-upload latest common8.js? Or anyone who has this latest version can upload this script?

I use love button and playcount synch pretty actively and can't seem to find any working download link for the latest common8.js. Your re-upload will be appracieted and could help other people looking for it.
Title: WSH Panel Mod script discussion/help
Post by: derty2 on 2015-03-23 13:02:43
A copy of "common8.js" can be found pasted online here: http://pastebin.com/raw.php?i=Z9Ucp1hP (http://pastebin.com/raw.php?i=Z9Ucp1hP)

For your reference ..............

here is lines 1 to 22 from the pastebin text:
Code: [Select]
var VERSION = "8.2015-01-24.01";

/*
(c) 2010-2015 marc2003
Please do not distribute modified versions of this file with your own scripts or themes.
You should be able to customise pretty much anything you want by editing the script
in your panel, not in this file. Leaving this intact and in its correct location
means you/other people can get bug fixes by using the "Update script" option on the
right click menu. If you need any help with customising then just come and ask on
hydrogenaudio.

http://www.hydrogenaud.io/forums/index.php?showtopic=77883
*/

var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_END_ELLIPSIS = 0x00008000;

and here is lines 1438 to 1466 from the pastebin text:
Code: [Select]
    var i;
    this.name = name;
    this.features = features || [];
    this.is_dui = window.InstanceType;
    this.script_path = fb.ProfilePath + "marc2003\\";
    this.ip = this.script_path + "images8\\";
    this.common_js_url = "https://dl.dropboxusercontent.com/u/22801321/wsh/marc2003/common8.js";
    this.common_js_file = this.script_path + "common8.js";
    this.tooltip = window.CreateTooltip();
    this.w = 0;
    this.h = 0;
    this.mx = 0;
    this.my = 0;
    this.metadb = fb.GetFocusItem();
    this.data_folder = fb.ProfilePath + "wsh_data\\";
    this.artists_folder = this.data_folder + "artists\\"
    this.settings_folder = fb.ProfilePath + "wsh_settings\\";
    this.artist = "";
    this.artist_tf = "%artist%";
    this.normal_font_size = window.GetProperty("2k3.normal_font_size", 14);
    this.list_font_size = window.GetProperty("2k3.list_font_size", 11);
    this.up_img = gdi.Image(this.ip + "buttons\\up.png");
    this.down_img = gdi.Image(this.ip + "buttons\\down.png");
    this.selection_mode = 1;
    this.metadb_func = typeof on_metadb_changed == "function";
    this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    this.features_init();
    this.colours_changed();
    this.font_changed();
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-23 15:59:41
^that does nothing to solve the problem. even the last public version from this month doesn't work for playcount sync.

i've already posted how people can fix their own scripts. http://www.hydrogenaud.io/forums/index.php...st&p=893121 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=893121)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-03-23 18:37:00
Here is fix for ''http error 0'' on windows 8.1 and windows 10.
YouTube Radio:

[code]
// ==PREPROCESSOR==
// @name "Youtube Radio"
// @author "Mire777"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

//Properties
YT_PL = window.GetProperty("YT  Playlist", "0");
YT_AUTO = window.GetProperty("YT  Auto", "0");
YT_TRACK = window.GetProperty("YT Track", "");
STATION = window.GetProperty("YT  Station", "");
SIM_ART = window.GetProperty("YT Similar", "");
YT_URL = window.GetProperty("YT URL", "");
art = window.GetProperty("YT  Artist Variety (1-20)", "20");
sng = window.GetProperty("YT  Song  Hotness (1-20)", "20");
tag = window.GetProperty("YT  Tag  Hotness (1-100)", "27");
pls = window.GetProperty("FB Playlist", "YT Radio");

//Folder
fso = new ActiveXObject("Scripting.FileSystemObject");
folder = fb.ProfilePath + "playlists-YT";

var MF_GRAYED = 0x00000001;
var MF_STRING = 0x00000000;
var IDC_ARROW = 32512;
var IDC_HAND = 32649;

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 on_colors_changed() {
p.colors_changed();
}

function on_selection_changed() {
p.item_focus_change();
}

function on_playlist_switch() {
set_focus0(); //Check Playlist
}

function on_playback_new_track() {
p.item_focus_change();
if (fb.ActivePlaylist == (GetPlaylistID(pls + " [Loved]"))) if (fb.PlaybackLength>=10) {LOVED();} else
p.item_focus_change();
if (fb.PlaybackLength>=10) {LOAD_ART();}
}

function on_playback_dynamic_info_track() {
p.item_focus_change();
}

function on_playback_stop() {
p.item_focus_change();
}

function on_item_focus_change() {
p.item_focus_change();
}

function on_mouse_leave() {
}

function on_mouse_rbtn_up(x, y) {
p.rbtn_up(x, y);
return true;
}

//Remove false string from file names   
this.clean_filename = function(filename) {
return filename.replace(/[\/\\|:]/g, '-').replace(/\*/g, 'x').replace(/"/g, "''").replace(/[?<>]/g, '_');
}

//Playlist
function GetPlaylistID(Playlist_Name)
{
for (var i = 0; i < fb.PlaylistCount; i++)
{
if (fb.GetPlaylistName(i) == Playlist_Name)
{
return i;
}
}

//Create playlist if it doesn't exist
fb.CreatePlaylist(fb.PlaylistCount, Playlist_Name);
return i;
}

//Playlist(Check)
function GetPlaylistID0(Playlist_Name)
{
for (var i = 0; i < fb.PlaylistCount; i++)
if (fb.GetPlaylistName(i) == Playlist_Name)
{
return i;
}
}

//Focus on playlist(Check)
function set_focus0()

if (pls>"")
{
var PL_NM = (GetPlaylistID0(pls + " ["+ STATION +"]"));
if (fb.ActivePlaylist == PL_NM) {YT_PL = 1; window.SetProperty("YT  Playlist", "1");}
else
{YT_PL = 0; window.SetProperty("YT  Playlist", "0");}
}
}

//Focus on playlist(YT Radio)
function set_focus()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " ["+ STATION +"]"));
}

//Focus on playlist(Same Video)
function set_focus2()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Same Video]"));
}

//Focus on playlist(Search Videos)
function set_focus3()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Search Videos]"));
}

//Focus on playlist(Popular Tracks)
function set_focus4()

if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Tracks: "+ p.artist +"]"));
}

//Focus on playlist(Similar Tracks)
function set_focus5()
{
if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Similar to: "+ p.artist + " - " + p.title +"]"));
}

//Focus on playlist(Loved)
function set_focus6()
{
if (pls>"")
fb.ActivePlaylist = (GetPlaylistID(pls + " [Loved]"));
}

//Panel
    function panel(name, features) {
    this.item_focus_change = function() {
    if (!this.metadb_func) return;
    switch(this.selection_mode) {
    case 0:
    this.metadb = fb.GetSelection();
    break;
    case 1:
    this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    break;
    case 2:
    this.metadb = fb.GetFocusItem();
    break;
      }
      if (this.metadb) on_metadb_changed();
   }

//Metadb
this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

//Size   
    this.size = function() {
    this.w = window.Width;
    this.h = window.Height;
}

//Move   
    this.move = function(x, y) {
    this.mx = x;
    this.my = y;
}

//Menu   
    this.rbtn_up = function(x, y) {
    var _menu = window.CreatePopupMenu();
    var q = window.CreatePopupMenu();
    var MF_POPUP = 0x00000010;
    var idx;
    switch(true) {
            case typeof th == "object":
            case typeof im == "object":

on_item_focus_change()           
if (pls>"")
{               
if(YT_AUTO==1) _menu.AppendMenuItem(MF_STRING, 1902, "Youtube Radio");
if(YT_AUTO==0) _menu.AppendMenuItem(MF_STRING, 1903, "Youtube Radio");
_menu.CheckMenuItem(1902, YT_AUTO?1:0);

_menu.AppendMenuSeparator();

//POPUP BUTTON
{_menu.AppendMenuItem(MF_STRING | MF_POPUP, q.ID, "Open");}

//START *POPUP
p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Radio Station by [%artist%]");}
else
{q.AppendMenuItem(MF_STRING, 1915, "Radio Station by [" + p.artist.replace(/&/g,"&&") + "]");}

p.genre = p.eval("%genre%");
if (p.genre == "" || p.genre == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Radio Station by [%genre%]");}
else
{q.AppendMenuItem(MF_STRING, 1921, "Radio Station by [genre: " + p.genre.replace(/&/g,"&&") + " ]");}

p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Top Tracks by " + "[%artist%]");}
else
{q.AppendMenuItem(MF_STRING, 1916, "Top Tracks by [" + p.artist.replace(/&/g,"&&") + "]");}

p.artist = p.eval("%artist%");
p.title = p.eval("%title%");
if (p.artist == "" || p.artist == "?") {q.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Similar Tracks as [%artist% - %title%]");}
else
{q.AppendMenuItem(MF_STRING, 1920, "Similar Tracks as [" + p.artist.replace(/&/g,"&&") + " - " + p.title.replace(/&/g,"&&") + "]");}
//END *POPUP

_menu.AppendMenuSeparator();

{
if(YT_PL==1 && YT_AUTO==1 && STATION>"") {_menu.AppendMenuItem(MF_STRING, 22, "Get Next Video");}
else
{_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Get Next Video");}

_menu.AppendMenuSeparator();

_menu.AppendMenuItem(MF_STRING, 1914, "Start Radio Station");

_menu.AppendMenuSeparator();

//START LOVED
p.path = p.eval("%path%");
p.artist = p.eval("%artist%");
p.title = p.eval("%title%");
filename = folder + "\\"+ clean_filename(p.artist + " - " + p.title) + ".m3u";

if (p.path.indexOf("youtube.com")>0) {
if (fso.FileExists(filename)) {_menu.AppendMenuItem(MF_STRING, 500, "♥ Un-Love");}
else
{_menu.AppendMenuItem(MF_STRING, 501, "♥ Love Track");}
if (fb.ActivePlaylist == (GetPlaylistID(pls + " [Loved]"))) {_menu.AppendMenuItem(MF_STRING, 502, "♪ Next Loved..");}
else
{_menu.AppendMenuItem(MF_STRING, 502, "♪ Play Loved..");}
} else
{
_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "♥ Love Track");
{_menu.AppendMenuItem(MF_STRING, 502, "♪ Play Loved..");}
}
//END LOVED

_menu.AppendMenuSeparator();

p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Open Same Video..");}
else
{_menu.AppendMenuItem(MF_STRING, 403, "Open Same Video..");}

/* //Find in Browser
_menu.AppendMenuSeparator();
p.artist = p.eval("%artist%");
if (p.artist == "" || p.artist == "?") {_menu.AppendMenuItem(MF_STRING| MF_GRAYED, 2000, "Find in Browser");}
else
{_menu.AppendMenuItem(MF_STRING, 404, "Find in Browser");}
_menu.AppendMenuSeparator();*/

_menu.AppendMenuItem(MF_STRING, 401, "Search For Videos...");

_menu.AppendMenuSeparator();

_menu.AppendMenuItem(MF_STRING, 9, "Properties...");
}            
}
}
if (pls=="") {_menu.AppendMenuItem(MF_STRING, 9, "Please Set: (FB Playlist)");}
if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 10, "Configure...");
      
        idx = _menu.TrackPopupMenu(x, y);
        switch(idx) {
         
          case 9:
            window.ShowProperties();
            break;
               
          case 10:
            window.ShowConfigure();
            break;
               
          case 22:
                set_focus(); //Focus on playlist
            LOAD_ART();
            break;
               
          case 401:
                set_focus3(); //Focus on playlist
            fb.RunMainMenuCommand("View/Youtube Source");
            break;
               
          case 403:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                set_focus2(); //Focus on playlist
                LOAD_SAME();
            break;
         
          case 404:
                p.artist = p.eval("%artist% %title%");
                p.browser("https://www.youtube.com/results?search_query=" + encodeURIComponent(p.artist));
                break;
           
          case 500:
                filename = folder + "\\"+ clean_filename(p.artist + " - " + p.title) + ".m3u";
                //Delete file
                if (fso.FileExists(filename)) fso.DeleteFile(filename);
                break;
               
          case 501:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                p.path = p.eval("%path%");
                p.artist = p.eval("%artist%");
                p.title = p.eval("%title%");
               
                //Create file & folder
                filename = folder + "\\"+ clean_filename(p.artist + " - " + p.title) + ".m3u";
                if(!fso.FolderExists(folder)) fso.CreateFolder(folder);
               
                //Save file
                function save_file(x) {
                try {
                g_text = p.path;
                ts = fso.OpenTextFile(filename, 2, true, -2);
                ts.Write(g_text);
                ts.close();
                } catch(e) {
                fb.trace("Error saving text: " + e);
                }}
                save_file(filename);
            break;

          case 502:
                LOVED();
            break;
               
          case 1902:
                YT_AUTO = 0;
                window.SetProperty("YT  Auto", "0");
                break;
     
          case 1903:
                YT_AUTO = 1;
                window.SetProperty("YT  Auto", "1");
                break;
         
          case 1914:
                var Start;
                Start = this.InputBox("Type Artist to Start Station\n\n( *genre - will play genre station)", "Youtube Radio", "");
                if (Start=="")
                {
                }
                else
                {
                YT_PL = 1;
                window.SetProperty("YT  Playlist", "1");
                YT_AUTO = "1"
                window.SetProperty("YT  Auto", "1");
                STATION = Start;
                window.SetProperty("YT  Station", Start);
                set_focus(); //Focus on playlist
                LOAD_ART();
                }
                break;
           
          case 1915:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                p.artist = p.eval("%artist%");
                if (p.artist == "" || p.artist == "?") return;
                STATION = p.artist;
                window.SetProperty("YT  Station", p.artist);
                YT_PL = 1;
                window.SetProperty("YT  Playlist", "1");
                YT_AUTO = "1"
                window.SetProperty("YT  Auto", "1");
                set_focus(); //Focus on playlist
                LOAD_ART();
                break;
       
          case 1916:
                set_focus4(); //focus on playlist
                POP_TRACKS();
                break;
           
          case 1920:
                //set_focus5(); //focus on playlist
                SIMILAR_TRACKS();
                break;
           
          case 1921:
                this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
                p.genre = p.eval("%genre%");
                if (p.genre == "" || p.genre == "?") return;
                STATION = "*" + p.genre;
                window.SetProperty("YT  Station", "*" + p.genre);
                YT_PL = 1;
                window.SetProperty("YT  Playlist", "1");
                YT_AUTO = "1"
                window.SetProperty("YT  Auto", "1");
                set_focus(); //Focus on playlist
                LOAD_GENRE();
                break;
              }
              _menu.Dispose();
           }

//Features init
    this.features_init = function() {
    for (i = 0; i < this.features.length; i++) {
    switch(this.features) {
    case "metadb":
    this.selection_mode = 1;
    break;
    case "remap":
    this.artist_tf = ("%artist%");
    break;
         }
      }
   }
   
    this.check_feature = function(f) {
    for (i = 0; i < this.features.length; i++) {
    if (this.features == f) return true;
    }
    return false;
    }

//Eval
   this.eval = function(tf) {
    if (!this.metadb || tf == "") return "";
    if (fb.IsPlaying && this.metadb.RawPath.indexOf("file://") != 0) {
    return fb.TitleFormat(tf).Eval();
    } else {
    return fb.TitleFormat(tf).EvalWithMetadb(this.metadb);
    }
   }
   
//Console Msg
    this.console = function(message) {
    this.name = "Youtube Radio"   
    fb.trace(this.name + ": " + message);
    }
   
//Trim
    String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, "");
    }   

//Input Box   
   this.InputBox = function(prompt, title, value) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    value = value.replace(/"/g, '" + Chr(34) + "');
    var temp_value = this.vb.eval('InputBox' + '("' + prompt + '", "' + title + '", "' + value + '")');
    if (typeof temp_value == "undefined") return value;
    if (temp_value.length == 254) this.MsgBox("Your entry was too long and will be truncated.\n\nSee the WSH panel mod script discussion thread on hydrogenaudio forums for help.", 0, "Youtube Radio");
    return temp_value.trim();
   }

//Msg Box   
   this.MsgBox = function(prompt, buttons, title) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "').replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    return this.vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
   }

//Browser   
   this.browser = function(command) {
    if (!this.run(command)) this.MsgBox("Unable to launch your default browser.", 0, "Youtube Radio");
   }

//Run Command   
   this.run = function(command) {
    try {
    this.WshShell.Run(command);
    return true;
    } catch(e) {
    return false;
    }
   }
   
//futures   
    this.metadb_func = typeof on_metadb_changed == "function";
   this.features = features;
   this.dui = window.InstanceType;
   this.metadb = fb.GetFocusItem();
   this.WshShell = new ActiveXObject("WScript.Shell");
   this.fso = new ActiveXObject("Scripting.FileSystemObject");
   this.vb = new ActiveXObject("ScriptControl");
   this.vb.Language = "VBScript";
   this.artist_tf = "%artist%";
   this.features_init();
    this.metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    if (fb.GetFocusItem())
    {this.artist = fb.TitleFormat(this.artist_tf).EvalWithMetadb(this.metadb);}

}

//YT NAMES-------------------------------------------------

//Clean Art Name
CLEAN_ART_NAME = function (t)
{  try
    {
    return t.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'");
    } catch (e) {}
}

//Clean Track Name
CLEAN_TRACK_NAME = function (t)
{  try
    {
    return t.replace(/about:\//,"").trim().split(" (")[0].replace(" (","").split(" [")[0].replace(" [","").split(" {")[0].replace(" {","").split(", ")[0].replace(", ","").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace("%27","'").replace(" 01-","").replace(" 02-","").replace(" 03-","").replace(" 04-","").replace(" 05-","").replace(" 06-","").replace(" 07-","").replace(" 08-","").replace(" 09-","").replace("09  ","").replace("08  ","").replace("07  ","").replace("06  ","").replace("05  ","").replace("04  ","").replace("03  ","").replace("02  ","").replace("01  ","").replace("00  ","").replace("01 ","").replace("02 ","").replace("03 ","").replace("04 ","").replace("05 ","").replace("06 ","").replace("07 ","").replace("08 ","").replace("09 ","").replace("00 ","").replace(".mp","").replace(" - Remastered ","").replace(" - Remastered","").replace("- "," ").replace(decodeURIComponent(SIM_ART) + " -"," ").replace(decodeURIComponent(SIM_ART) + " - "," ").replace(" - Live ","").replace(" - Live","").replace(" Pt.1","").replace(" - Demo;2 Digital Remaster 66  ","").replace(" - Demo;2 Digital Remaster","").replace(" - Demo;","").replace(" - Demo","").replace("Digital Remaster","").replace("Original-  ","").replace("Original- ","").replace("Original-","").replace(" - Vocal Version","").replace(" Mega-Mix","").replace("Mega-Mix","").replace(" - Original Mix","").replace(" Pop Radio Edit","").replace(" Radio Edit","").replace(" - Single Version","").replace(" - Edited Version","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace("- ","").replace(" - Extended Version","").replace(" -Remaster","").replace("`","'").replace(". "," ").replace(" Version","").replace(" edit","").replace(" - Edit","").replace("  Simple Mix","").replace("  Almighty Mix","").replace(" - Vocal","").replace(" Vocal","").replace("  Remix","").replace("  Extended Version","").replace(" - Explicit Version","").replace("- Explicit Version","").replace(" Explicit Version","").replace("Explicit Version","").replace(" Anthology", "").replace("The " + decodeURIComponent(SIM_ART), " ").replace(" - Survival Remix","").replace(" Radio Mix","").replace(" Survival Remix","").replace("Survival Remix","").replace(decodeURIComponent(SIM_ART) + "-"," ").replace(decodeURIComponent(SIM_ART)," ").replace(" Club Mix","").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("_"," ").replace("  wwwi.info","").replace(" Edit","").replace("live","").replace("Single","").replace("vk.com/xclusives zone ","").replace("  Acoustic","").replace("Remix","").replace("Part&","").replace("  +","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" % ","").replace(" Live;0 2","").replace("  Live;0 2","").replace("Live;0 2","").replace(' /"/"',"").replace(" -0","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("%","").replace("  Alternate Mix","").replace("Live","").replace(" Alternate Mix","").replace("Alternate Mix","").replace("-0","").replace("  remastered","").replace(" // СЛУШАЮТ:","").replace("www.KLAUSOM.lt","").replace("-;-Bit Digital Remaster","").replace(" :","").replace("-1  Remaster","").replace("  Genuine Album","").replace("  www.rsmp.com","").replace(" www.rsmp.com","").replace("www.rsmp.com","").replace("Instrumental","").replace(" Instrumental","").replace("www.SongsLover.pk","").replace(" Genuine Album","").replace("Album","").replace("Remaster","").replace("Lyrics","").replace("w/lyrics","").replace(" -","").replace("  Radio","").replace("0%","").replace("remaster","").replace(" Lyrics","").split(" | '' |")[0].replace(" | '' |","").split(" |")[0].replace(" |","").split("|")[0].replace("|","").split("| On:")[0].replace("| On:","").split(" feat")[0].replace(" feat","").split(" ft.")[0].replace(" ft.","").split(" Feat.")[0].replace(" Feat","").split("Greatest Hits Megamix")[0].replace("Greatest Hits Megamix","").split("Lyrics")[0].replace("Lyrics","").split("Lyric")[0].replace("Lyric","").split("www.")[0].replace("www.","").split(";Feat")[0].replace(";Feat","").trim();
    } catch (e) {}
}

//Clean Genre Name
CLEAN_GENRE_NAME = function (t)
{  try
    {
    return t.replace(/about:\//,"").replace("music/","").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace(" wiki/edit","").replace("/ similar","").replace("?page=","'").replace("/ charts","'").replace("-","").replace("%2F%E3%82%A4%E3%83%95%E3%83%BB%E3%83%8E%E3%83%83%E3%83%88%E3%83%BB%E3%83%95%E3%82%A9%E3%83%BE3%83%BB%E3%83%A6%E3%83%BC","").replace("Ajoutez ce titre sur Deezer exclusivement sur www.hotmixradio.fr","").replace("www.Hituri.net","").replace("%E3%81%97%E3%82%83%E3%81%AB%E3%82%80%E3%81%AB%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF","").replace("%B81%E3%82%B7%E3%82%A7%E3%82%A4%E3%82%AF%EF%B81","").replace("%E4%BD%95%E3%82%88%E3%82%8A%E3%82%82%E5%83%95%E3%82%89%E3%81%97%E3%81%8F%E3%80%81%E4%BD%95%E3%82%88%E3%82%8A","").replace("%E3%82%82%E5%90%9B%E3%82%89%E3%81%97%E3%81%8F","").replace("%D0%91%D1%8D0%B5%D1%82 %D0%BF%D0%BE %D0%B3%D0%BB%D0%B0%D0%B7%D0%B0%D0%BC","").replace("%E3%83%9E%E3%82%A4%E3%83%BB%E3%83%9E3%83%87%E3%82%A3","").replace("%D0%9B%D0%B5%D1%82%D0%B5%D1%82%D1%8C","").replace("%2F%2F %D0%A1%D0%9B%D0%A3%D0%A8%D0%90%D0%AE%D0%A2","").replace("%D0%9F%D0%BE%D0%BF-%D0%A5%D0%B8%D1%82","").replace("/","").split("tag")[0].split("hype")[0].split("events")[0];
    } catch (e) {}
}

//*********************YT RADIO START**********************

//SIMILAR ARTIST--------------------------------------------
this.LOAD_ART = function()
{    if (YT_AUTO=="1")
      if (YT_PL=="1")
   
    { var randomnumber=Math.floor(Math.random()*art)
      var a=randomnumber;
        if (STATION == "" || STATION == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(STATION) + "/+similar"+ "?page=" + a, true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("div");
        div.innerHTML = text;
        var data = div.getElementsByTagName("a");
        var urls = [];

for (i = 0; i < data.length; i++) {
if (data.href.indexOf("about:/music/") == 0) urls.push(CLEAN_ART_NAME(data.href)); 
}

//select random URL
var randomnumber = Math.floor(Math.random()*(20-50)+50);
do{
randomnumber = Math.floor(Math.random()*(20-50)+50);
} while(randomnumber%2!=1);
i=randomnumber;

{
//Start with urls
if (urls > "")
{
//p.console("" + urls);
SIM_ART = window.SetProperty("YT Similar", urls);
SIM_ART = urls;
window.SetProperty("YT Similar", urls);
}
else
{
SIM_ART = window.SetProperty("YT Similar", "");
SIM_ART = "";
window.SetProperty("YT Similar", "");
}                 
}
           
        this.doc.close();
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
        else
        if (SIM_ART == "" || SIM_ART == "?") {LOAD_ART();}
        else
        LOAD_TRACK();
        } else {
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
        else
        if (this.xmlhttp.status == 404) {p.console("HTTP error: " + this.xmlhttp.status); LOAD_ART();}
                }
         }
      }
   }                           
}

//LOAD TRACK----------------------------------------------------
this.LOAD_TRACK = function()
{
   
    {var randomnumber=Math.floor(Math.random()*sng)
    var a=randomnumber;
        if (SIM_ART == "" || SIM_ART == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(SIM_ART) + "/+tracks" + "?page=" + a, true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("tr");
        div.innerHTML = text;
        var data = div.getElementsByTagName("td");
        var urls = [];

for (i = 0; i < data.length; i++) {
if (data.title) urls.push(CLEAN_TRACK_NAME(data.title));
}

//select random URL
var randomnumber = Math.floor(Math.random()*Math.max(urls.length));
i=randomnumber;

{

//Start with urls
if (urls > "")
{
p.console("" + SIM_ART + " - " + urls);

YT_TRACK = window.SetProperty("YT Track", urls);
YT_TRACK = urls;
window.SetProperty("YT Track", urls);
}
else
{
YT_TRACK = window.SetProperty("YT Track", "");
YT_TRACK = "";
window.SetProperty("YT Track", "");
}
}

        this.doc.close();
        if (YT_TRACK == "" || YT_TRACK == "?") {LOAD_ART();}
        else
        set_focus(); //focus on playlist
        do_youtube_search1(decodeURIComponent(SIM_ART), decodeURIComponent(YT_TRACK));
        } else {
        p.console("HTTP error: " + this.xmlhttp.status);
        if (STATION.indexOf("*")== 0) {LOAD_GENRE();}
        else
        if (this.xmlhttp.status == 404) {LOAD_ART();}
                }
         }
      }
   }
}

//POPULAR TRACKS----------------------------------------------------
this.POP_TRACKS = function()
{      p.artist = p.eval("%artist%");

    {  if (p.artist == "" || p.artist == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/+tracks" + "?page=1", true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("tr");
        div.innerHTML = text;
        var data = div.getElementsByTagName("td");
        var urls = [];
   
for (i = 0; i < data.length; i++) {
if (data.title) urls.push(CLEAN_TRACK_NAME(data.title));
}

//Select urls
for (i = 0; i < urls.length; i++)

{
//Start with urls
if (urls > "")
do_youtube_search1(decodeURIComponent(p.artist), urls);
}
        this.doc.close();
        } else {
        p.console("HTTP error: " + this.xmlhttp.status);
                }
         }
      }
   }
}

//SIMILAR TRACKS----------------------------------------------------
this.SIMILAR_TRACKS = function()
{ p.artist = p.eval("%artist%");
p.title = p.eval("%title%");

{ if (p.artist == "" || p.artist == "?") return;
if (p.title == "" || p.title == "?") return;
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + encodeURIComponent(p.artist) + "/_/" + encodeURIComponent(p.title) + "/+similar", true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
if (!this.doc) this.doc = new ActiveXObject("htmlfile");
this.doc.open();
var div = this.doc.createElement("td");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];

for (i = 0; i < data.length; i++) {

if (data.href.indexOf("/_/")>0)

urls.push((data.href));
}

//Select urls
for (i = 0; i < 100; i++)

{
//Start with urls
if (urls.indexOf("http:")==0) return;
if (urls.indexOf("/_/") >0)
title_split = urls.split("/_/")[1].replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ");
artist_split = urls.split("/_/")[0].replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("+"," ").replace("about:/music/","").replace("noredirect/","");
set_focus5();//set focus on playlist
do_youtube_search1(decodeURIComponent(artist_split),decodeURIComponent(title_split));

}
this.doc.close();
} else {
p.console("HTTP error: " + this.xmlhttp.status);
}
}
}
}
}

//GENRE----------------------------------------------------
this.LOAD_GENRE = function()
{    if (STATION.indexOf("*")== 0)
 
    { var randomnumber=Math.floor(Math.random()*tag)
      var a=randomnumber;
        if (STATION == "" || STATION == "?") return;
      if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.xmlhttp.open("GET", "http://www.last.fm/music/+tag/" + encodeURIComponent(STATION).replace("*","") + "?page=" + a, true);
      this.xmlhttp.send();
      this.xmlhttp.onreadystatechange = function() {
        if (this.xmlhttp.readyState == 4) {
        if (this.xmlhttp.status == 200) {
        var text = this.xmlhttp.responsetext;
        if (!this.doc) this.doc = new ActiveXObject("htmlfile");
        this.doc.open();
        var div = this.doc.createElement("li");
        div.innerHTML = text;
        var data = div.getElementsByTagName("a");
        var urls = [];
   
for (i = 0; i < data.length; i++) {
    if (data.className.indexOf("name") == 0)
    if (data.href.indexOf("about:/music/") == 0) urls.push(CLEAN_GENRE_NAME(data.href));
}

//select random URL
var randomnumber = Math.floor(Math.random()*(0-9)+9);
do{
randomnumber = Math.floor(Math.random()*(0-9)+9);
} while(randomnumber%2!=0);

i=randomnumber;

{

//Start with urls
if (urls > "")
{
//p.console("" + urls);
SIM_ART = window.SetProperty("YT Similar", urls);
SIM_ART = urls;
window.SetProperty("YT Similar", urls);
}
else
{
SIM_ART = window.SetProperty("YT Similar", "");
SIM_ART = "";
window.SetProperty("YT Similar", "");
}
}
        this.doc.close();
        if (SIM_ART == "" || SIM_ART == "?") {LOAD_GENRE();}
        else
        LOAD_TRACK();
        } else {
        p.console("HTTP error: " + this.xmlhttp.status);
        if (this.xmlhttp.status == 404) {LOAD_GENRE();}
                }
         }
      }
   }
}
//LOVED----------------------------------------------------
this.LOVED = function()
{
                //list files
                var arr = utils.Glob(folder + "\\*.*").toArray();
                var a = [];

                for (i = 0; i < arr.length; i++) {
                if (arr) a.push(arr); 
                    }
                //select random file
                var randomnumber = Math.floor(Math.random()*Math.max(arr.length));
                i=randomnumber;
               
                file_path = arr;
                var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
                var str = tmppath + "\\foobar2000.exe /add ";
                var go = str + '"' + file_path + '"';
               
                //load file
                set_focus6(); //Focus on playlist
                var tm = window.SetTimeout(function() {
                p.run(go);
                p.console(file_path);
                window.ClearTimeout™; tm = false;
                }, 50);   
}

//SAME VIDEO-----------------------------------------------
this.LOAD_SAME = function()
    {
      var artist0 = p.eval("%artist%");
      var title0 = p.eval("%title%");
      if(artist0 > "?" && title0 > "?") {set_focus2(); do_youtube_search1(decodeURIComponent(artist0), decodeURIComponent(title0));}
}

//LOAD YOUTUBE VIDEO---------------------------------------
strip_title = function (t1, t2)
{
    try
    {
        if (t1 == t2)
        return t1;
        if (t1.match(RegExp(t2 + "( and | & )", "i")))
        return t1;
        var a = "(by the |by: |by |of |the |feat. |ft. |)";
        var b = "( feat.| ft.|)";
        var t3 = "";
        if (!t2.match(/^the /i))
        {
        t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t2 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
        }
        else
        {
        var t4 = t2.replace(/^the /i, "")
        t3 = t1.replace(RegExp("[^a-z\\d_)\\]\"]*(" + a + t4 + b + ")[^a-z\\d_(\\[\"]*","gi")," - ").replace(/^[^a-z()\[\]\d\"]*|[^a-z()\[\]\d\"]*$/gi, "");
        }
        return t3.match(/\S/) ? t3 : t1;
    }
    catch (e)
    {
    return t1;
    }
}

convert = function(min)
{
    var parts = min.split(':'),
    minutes = +parts[0],
    seconds = +parts[1];
    return minutes * 60 + seconds;
}

strip = function (t)
{
    try
    {
    t = t.replace(/[\.,\!\?\:;'"\-_]/g,"").toLowerCase();
    return t;
    } catch (e)
    {}
}

clean = function (t)
{
    try
    {
    return t.replace(/'/g, "’").toLowerCase();
    } catch (e) {}
}

youtube_search = function (state_change_callback, p_on_search_finished_callback)
{
        this.xmlhttp = null;
        this.http_callback_funct = null;
        this.ready_state_change_callback = state_change_callback;
        this.search_done = false;
        this.on_search_finished_callback = p_on_search_finished_callback;
        this.yt_link;
        this.search_artist;
        this.search_title;
        this.metadata;

    this.on_state_change = function ()
    {
    if (this.xmlhttp != null && this.xmlhttp.readyState == 4 && this.xmlhttp.status == 200 && this.http_callback_funct != null)
    this.http_callback_funct();
    }

    this.StartSearch = function (p_artist, p_title, p_extra_metadata)
    {
        this.search_artist = p_artist;
        this.search_title = p_title;
        this.metadata = p_extra_metadata;
        this.http_callback_funct = null;
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

        var URL = "https://www.youtube.com/results?search_query=" + encodeURIComponent(p_artist + " " + p_title);

        this.http_callback_funct = this.AnalyseSearch;
        this.xmlhttp.open("GET", URL);
        this.xmlhttp.onreadystatechange = this.ready_state_change_callback;
        this.xmlhttp.send();
    }

    this.AnalyseSearch = function ()
    {
        var text = this.xmlhttp.responsetext;
        var doc = new ActiveXObject("htmlfile");
        doc.open();
        var div = doc.createElement("div");
        div.innerHTML = text;
        var data = div.getElementsByTagName("a");
        var url = "";
        var first_match;

        re_test:

        for (var i = 0; i < data.length; i++)
        {
        if (data.href.indexOf("about:/watch?v=") == 0)
          {
                i++; //link

            //Find Title[OLD]
            /*{
            var st = text.indexOf( data.href.replace("about:/watch?", "") );
            var str = "a class=\"yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2 yt-uix-sessionlink spf-link\">";
            st = text.indexOf(str, st) + str.length;
            var et = text.indexOf("</a>", st);
            var youtube_title = text.substr(st, et - st);
            var Y_Title = youtube_title.replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&").replace("'", "'").replace("&quot;", "''").replace("&amp;", "&");
            //p.console("Title: " + Y_Title);
            }*/
           
            //Find Title[NEW]
            Y_Title = data.title;
            Remove_duration = Y_Title.substring(Y_Title.lastIndexOf(" - ")+1);
            Y_Title = data.title.replace(Remove_duration, "").trim();
            //p.console("Title: " + Y_Title);
               
            //Find minutes
            var s = text.indexOf( data.href.replace("about:/watch?", "") );
            var str = "<span class=\"video-time\" aria-hidden=\"true\">";
            s = text.indexOf(str, s) + str.length;
            var e = text.indexOf("</span>", s);
            var length = text.substr(s, e - s);
            length = convert(length);
            length = length ? length : "";
            if (!first_match)

            {                 
            //Artist title stripped if same as search_artist
            var stripped_title = strip_title(Y_Title, this.search_artist);
            fir
Title: WSH Panel Mod script discussion/help
Post by: clitorislove on 2015-03-24 10:50:06
A copy of "common8.js" can be found pasted online here: http://pastebin.com/raw.php?i=Z9Ucp1hP (http://pastebin.com/raw.php?i=Z9Ucp1hP)


I've just updated my script, thanks for the share!

^that does nothing to solve the problem. even the last public version from this month doesn't work for playcount sync.

i've already posted how people can fix their own scripts. http://www.hydrogenaud.io/forums/index.php...st&p=893121 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=893121)


I don't know how I missed it. I got it working again, thank you marc2003. I felt like a man without balls without this script working in my foobar, now I'm a completed person.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-03-24 20:54:21
Submitting a panel that gets current album art from last.fm, which I use mainly for streams.

Extract rar to your profile folder.
In a new panel import lastfm_trackinfo_cover.txt
Right click panel and in properties add your last.fm api key.

http://goo.gl/r3kAOp (http://goo.gl/r3kAOp)



Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-29 12:21:57
i've made an update to br3tt's excellent JSplaylist.

https://github.com/marc2k3/jsplaylist-mod/r...es/tag/1.3.2mod (https://github.com/marc2k3/jsplaylist-mod/releases/tag/1.3.2mod)

Quote
This mod updates JSplaylist to use a new method in my custom component so undo/redo
commands work from the Edit menu and keyboard shortcuts after adding/removing/reordering files.

This requires WSH panel mod v1.5.10 or above:

https://github.com/marc2k3/foo_uie_wsh_panel_mod/releases (https://github.com/marc2k3/foo_uie_wsh_panel_mod/releases)

All credit to br3tt for his original script which can be found here:

http://br3tt.deviantart.com/art/JSPlaylist-509803158 (http://br3tt.deviantart.com/art/JSPlaylist-509803158)

Installation instructions are the same as the original and can be found inside the wsh_br3tt folder.


my main changes can be viewed in this commit if br3tt/anyone wants to abuse me.

https://github.com/marc2k3/jsplaylist-mod/c...7345dc67c09f906 (https://github.com/marc2k3/jsplaylist-mod/commit/e1ee661a49abe8492169ae6e47345dc67c09f906)

edit: although i forgot to mention it in the readme, this actually modifies 2 files in the wsh_br3tt folder and i've renamed them so you can extract them without touching the original files.

edit2: @falstaff, the reason i did this myself is because a) i'm impatient and b) i wasn't sure if you would be interested in implementing changes that required my unofficial component. if you want to use these changes or fix what you think i've broken then just let me know.
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2015-03-29 13:09:03
Nice !!! Is it possible to have the "View/Show now playing" menu entry working?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-29 13:12:51
View/Show now playing in playlist is what you want.
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2015-03-29 13:31:08
Yes but activated from the menu or double clicking the status bar
Also i'm not clear if i can disable the grouping based on playlist names patterns (e.g. *singles* --> do not show any header and only specific columns)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-29 14:01:39
Yes but activated from the menu or double clicking the status bar


you've lost me there. the previous posts were specifically about the view menu commands??

Quote
Also i'm not clear if i can disable the grouping based on playlist names patterns (e.g. *singles* --> do not show any header and only specific columns)


from what i can gather, you can specify multiple grouping patterns and then enable/disable them based on playlist names (panel settings>groups). presumably having one of the groups set with an expanded row height set to 0 will work??

there are no options for filtering columns based on playlist name. IIRC someone has already asked falstaff on his DA page and he has no interest in it. i guess it's back to NGplaylist if you need that.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-29 16:24:55
here's an updated JSplaylist-mod with a few things i missed earlier - the main thing being it didn't register dragging playlist items on to the built in playlist manager as a time to create an undo point for the target playlist.

https://github.com/marc2k3/jsplaylist-mod/releases (https://github.com/marc2k3/jsplaylist-mod/releases)

make sure the whole zip is extracted and the main playlist panel is updated.
Title: WSH Panel Mod script discussion/help
Post by: NEMO7538 on 2015-03-29 18:44:16
Yes but activated from the menu or double clicking the status bar


you've lost me there. the previous posts were specifically about the view menu commands??

What I meant is that it does not work from the menu (View/Show Now Playing). It should produce the same effect as the "Show Now playing track" option available through right click in your columns header (... and btw expand the group if it is collapsed).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-29 19:13:45
View/Show now playing in playlist is what you want.


as the bolded text wasn't clear enough, perhaps this will help? 

(http://i.imgur.com/s7CqMp5.png)

show now playing is not related to playlist viewers and is something to do with tooltips in the notification area.

in your columns header


it's not mine. i only added a few lines of code to the thousands written by falstaff (HA username, br3tt on deviantart), the original author. i thought i was quite clear giving credit.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-03-29 22:25:27
it's not mine. i only added a few lines of code to the thousands written by falstaff (HA username, br3tt on deviantart), the original author. i thought i was quite clear giving credit.


yes you were ;-)
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-03-30 16:21:06
I'm trying to pass RGB color value between WSH panels
I'm using following functions from br3tt  :
Code: [Select]
var ForReading = 1;
var ForWriting = 2;
var fso = new ActiveXObject("Scripting.FileSystemObject");

var sdir = fb.ProfilePath + "my_theme\\settings\\";

function read_option(opt, val) {
    var odir = sdir + opt + "\\";
    if (!fso.FolderExists(odir)) {
        fso.CreateFolder(odir)
    } else {
        var e = new Enumerator(fso.GetFolder(odir).Files);
        var s;
        for (; !e.atEnd(); e.moveNext()) {
            s = e.item();
            if (utils.PathWildcardMatch("*", s.Name)) {
                return s.Name
            }

        }

    }
    fso.CreateTextFile(odir + val, ForWriting);
    return val
}

function update_option(opt, val) {
    var odir = sdir + opt + "\\";
    if (!fso.FolderExists(odir)) {
        fso.CreateFolder(odir);
        fso.CreateTextFile(odir + val, ForWriting)
    } else {
        var e = new Enumerator(fso.GetFolder(odir).Files);
        var s;
        for (; !e.atEnd(); e.moveNext()) {
            s = e.item();
            if (utils.PathWildcardMatch("*", s.Name)) {
                fso.MoveFile(odir + s.Name, odir + val);
                break
            }

        }

    }
    return val
}


but when try to take that value as RGB color
Code: [Select]
p.textcolour = RGB(read_option("textcolour"));

It doesn't work
Does it because function output contain "" surounding them ??
Is there any other method to pass values between WSH panels??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-03-30 17:07:56
the RGB function expects 3 arguments separated by commas and each one should be a number between 0 and 255.

Code: [Select]
RGB(255, 0, 0)


and panels can communicate directly. look at window.NotifyOthers to send and on_notify_data to receive.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-04-01 08:04:57
the RGB function expects 3 arguments separated by commas and each one should be a number between 0 and 255.

Code: [Select]
RGB(255, 0, 0)

Just realized made a stupid mistake by passing arguments as a string :/
Quote
and panels can communicate directly. look at window.NotifyOthers to send and on_notify_data to receive.


This is really  nice , is there any reason callback function on_notify_data not get called?
I'm trying to change background color of YouTube Track Manager (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=105522&view=findpost&p=890289) but seems like  on_notify_data function not even get called
but for your scripts it worked.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-04-01 08:15:52
on_notify_data gets triggered in all panels EXCEPT the one where you use window.NotifyOthers (hence the name )
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-04-01 10:07:37
on_notify_data gets triggered in all panels EXCEPT the one where you use window.NotifyOthers (hence the name )

Of course ,
Sorry for the stupid questions.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-04-01 10:36:21
because i have column headers hidden in JSplaylist, i forgot that clicking them changed the sort order. i've now updated my jsplaylist-mod to account for this:

https://github.com/marc2k3/jsplaylist-mod/releases (https://github.com/marc2k3/jsplaylist-mod/releases)

make sure all files are extracted again and the script in the panel also gets updated.

now the previous order can be restored by using edit>undo or ctrl+z.

again all credit to falstaff/br3tt for the original script. 
Title: WSH Panel Mod script discussion/help
Post by: tonga on 2015-04-06 17:54:58
Hi,

Is there a way with WSH to open the tag editor window ("properties" in the context menu) for a track ? I found a way to display the context menu, which have the entry "properties", but i would like to access directly to this "properties" item.
Thanks!
Title: WSH Panel Mod script discussion/help
Post by: tonga on 2015-04-06 18:25:27
Hi,

Is there a way with WSH to open the tag editor window ("properties" in the context menu) for a track ? I found a way to display the context menu, which have the entry "properties", but i would like to access directly to this "properties" item.
Thanks!


Yes there is : fb.RunContextCommandWithMetadb("Properties", handle_or_handles, 0);
Title: WSH Panel Mod script discussion/help
Post by: Zoig on 2015-04-11 09:11:04
This is superb. Tnx.

But I'm wondering can this thing be modified so it can fetch single covers instead of album art?

Submitting a panel that gets current album art from last.fm, which I use mainly for streams.

Extract rar to your profile folder.
In a new panel import lastfm_trackinfo_cover.txt
Right click panel and in properties add your last.fm api key.

http://goo.gl/r3kAOp (http://goo.gl/r3kAOp)

Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-04-11 11:16:34
This is superb. Tnx.

But I'm wondering can this thing be modified so it can fetch single covers instead of album art?

Submitting a panel that gets current album art from last.fm, which I use mainly for streams.

Extract rar to your profile folder.
In a new panel import lastfm_trackinfo_cover.txt
Right click panel and in properties add your last.fm api key.

http://goo.gl/r3kAOp (http://goo.gl/r3kAOp)



Sorry but the last.fm api returns only album art.

http://www.last.fm/api/show/track.getInfo (http://www.last.fm/api/show/track.getInfo)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-04-12 12:52:47
This is superb. Tnx.

But I'm wondering can this thing be modified so it can fetch single covers instead of album art?


Sorry but the last.fm api returns only album art.


It would be good that we have all in one script.
Album (text + images), Artist (text + images)..
I wanted to do this, but i don't have time..

@Zoig you can fetch single covers if on last.fm web page you have that image...
Title: WSH Panel Mod script discussion/help
Post by: rohmanhida on 2015-04-13 09:35:33
hey, I'm a newbie here, and i wanna learn more about wsh panel mod
I create foobar skin and this is the result
(http://i.imgur.com/fZjD9xh.png)
simply i want to make it like this
(http://i.imgur.com/Wjj0OCQ.png)

what code i should add?
please help, i've googling anywhere but have no result
if you could help me to add the blue baron the playing item, that would be great!
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-04-21 23:09:21
YouTube Track Manager - new version

- Fixed YouTube searching due to changes at YouTube

- Added integrated artist search for album manager.

- Various other refinements.

- For information about YouTube Track Manager and a link to screenshot see here (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=890291). For download of latest version (1.6) and full changelog see here (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=105522&view=findpost&p=896520).
 

Title: WSH Panel Mod script discussion/help
Post by: randomuser on 2015-04-26 01:16:57
after some experiemeting with play buttons i finally almost found what i wanted. now the problem is that those freaking buttons wont get in to their desired place unless i right click > configure > apply in wsh box. they are just half way too left. this is a modification of T.P.Wang's SimpleThemedButton.txt with the special flavour of marc2003.
Code: [Select]
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "SimpleThemedButton"
// @author "T.P Wang"
// ==/PREPROCESSOR==

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));}

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 bcolora = RGBA(100,100,100,155)
var bcolorb = RGBA (0,0,0,155,155)
var bcolorc = RGBA(100,100,100,100)
var bcolorhover1 = RGBA(110,110,110,155)
var bcolorhover2 = RGBA(5,5,5,155)
var grad = 91
var ww = window.Width
var wh = window.Height
var x = ww/2
var y = wh/16
var w = 100
var h = w*0.2
var fsize = w/5.83
var g_font = gdi.Font("Guifx v2 Transports", fsize);

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:
            gr.FillGradRect(this.x, this.y, this.w, this.h, grad, bcolora, bcolorb );
gr.DrawRect(this.x, this.y, this.w-1, this.h-1, 1,bcolorc);
break;
       
case ButtonStates.hover:
            gr.FillGradRect(this.x, this.y, this.w, this.h, grad, bcolorhover1, bcolorhover2 );
gr.DrawRect(this.x, this.y, this.w-1, this.h-1, 1,bcolorc);
break;
       
case ButtonStates.down:
            gr.FillGradRect(this.x+1, this.y+1, this.w-2, this.h-2, grad, bcolora, bcolorb );
            gr.DrawRect(this.x, this.y+1, this.w-1, this.h-2, 1,bcolorc);
break;
       
case ButtonStates.hide:
            return;
        }
    gr.GdiDrawText(this.text, g_font, RGB(200,200,200), this.x, this.y, this.w, this.h, 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;
}

var cur_btn = null;
var g_down = false;

// --------------------------

refreshPlayButton = function() {
$buttons = {
Previous: new SimpleButton(x-w-w/2-1, y, w, h, "5", function() {fb.prev();}),
PlayPause: new SimpleButton(x-w/2, y, w, h, (fb.IsPlaying ? (fb.IsPaused ? 1 : 2) : 1), function() { fb.PlayOrPause(); }),
Next: new SimpleButton(x+w/2+1, y, w, h, "6", function() {fb.next();})
}
window.Repaint();
}

refreshPlayButton();

// --- APPLICATION START

function on_paint(gr) {
    gr.DrawRect(x-w-w/2-3, y-2, w*3+5, h+3, 1, RGB(60,60,63))
    gr.FillSolidRect(x-w-w/2-2, y-1, w*3+4, h+2, RGBA(0,0,0,255))
drawAllButtons(gr);
}

function on_playback_stop() {
refreshPlayButton();
}

function on_playback_pause() {
refreshPlayButton();
}

function on_playback_starting() {
refreshPlayButton();
}

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();
    }
}

// --- APPLICATION END
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-04-26 08:54:32
@randomuser

if your problem is the placement of those buttons on resize, for sure it will never place them in the middle of the panel until you edit script and click apply, why ? because placement is relative to x,y values that are only set outside of a function so only set when you launch the script and they never change after
solution below, add on_size() callback and set variable depending of the width and height of the panel in it

HTH


Code: [Select]
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "SimpleThemedButton"
// @author "T.P Wang"
// ==/PREPROCESSOR==

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));}

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 bcolora = RGBA(100,100,100,155)
var bcolorb = RGBA (0,0,0,155,155)
var bcolorc = RGBA(100,100,100,100)
var bcolorhover1 = RGBA(110,110,110,155)
var bcolorhover2 = RGBA(5,5,5,155)
var grad = 91
var ww, wh, x, y, w = 100, h, fsize = w / 5.83;
var g_font = gdi.Font("Guifx v2 Transports", fsize);

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:
            gr.FillGradRect(this.x, this.y, this.w, this.h, grad, bcolora, bcolorb );
gr.DrawRect(this.x, this.y, this.w-1, this.h-1, 1,bcolorc);
break;
       
case ButtonStates.hover:
            gr.FillGradRect(this.x, this.y, this.w, this.h, grad, bcolorhover1, bcolorhover2 );
gr.DrawRect(this.x, this.y, this.w-1, this.h-1, 1,bcolorc);
break;
       
case ButtonStates.down:
            gr.FillGradRect(this.x+1, this.y+1, this.w-2, this.h-2, grad, bcolora, bcolorb );
            gr.DrawRect(this.x, this.y+1, this.w-1, this.h-2, 1,bcolorc);
break;
       
case ButtonStates.hide:
            return;
        }
    gr.GdiDrawText(this.text, g_font, RGB(200,200,200), this.x, this.y, this.w, this.h, 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;
}

var cur_btn = null;
var g_down = false;

// --------------------------

refreshPlayButton = function() {
$buttons = {
Previous: new SimpleButton(x-w-w/2-1, y, w, h, "5", function() {fb.prev();}),
PlayPause: new SimpleButton(x-w/2, y, w, h, (fb.IsPlaying ? (fb.IsPaused ? 1 : 2) : 1), function() { fb.PlayOrPause(); }),
Next: new SimpleButton(x+w/2+1, y, w, h, "6", function() {fb.next();})
}
window.Repaint();
}

refreshPlayButton();

// --- APPLICATION START

function on_size() {
   
    ww = window.Width
    wh = window.Height
   
    if(!ww) return;
   
    x = ww/2
    y = wh/16
    h = w*0.2
    refreshPlayButton();
}

function on_paint(gr) {
    gr.DrawRect(x-w-w/2-3, y-2, w*3+5, h+3, 1, RGB(60,60,63))
    gr.FillSolidRect(x-w-w/2-2, y-1, w*3+4, h+2, RGBA(0,0,0,255))
drawAllButtons(gr);
}

function on_playback_stop() {
refreshPlayButton();
}

function on_playback_pause() {
refreshPlayButton();
}

function on_playback_starting() {
refreshPlayButton();
}

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();
    }
}

// --- APPLICATION END
Title: WSH Panel Mod script discussion/help
Post by: randomuser on 2015-04-26 11:53:49
thanks. now i have something to click on
Title: WSH Panel Mod script discussion/help
Post by: randomuser on 2015-05-16 12:17:06
is it possible to have vertical volume bar which grows from bottom to top?
Title: WSH Panel Mod script discussion/help
Post by: randomuser on 2015-05-16 14:05:30
is it possible to have vertical volume bar which grows from bottom to top?

nevermind, figured out this.

Code: [Select]
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "Volbar with GdiDrawText"
// @author "T.P Wang"
// ==/PREPROCESSOR==

// Flags, used with GdiDrawText
// For more information, see: http://msdn.microsoft.com/en-us/library/dd162498(VS.85).aspx
var DT_TOP = 0x00000000;
var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_BOTTOM = 0x00000008;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_EXPANDTABS = 0x00000040;
var DT_TABSTOP = 0x00000080;
var DT_NOCLIP = 0x00000100;
var DT_EXTERNALLEADING = 0x00000200;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_INTERNAL = 0x00001000;
var DT_EDITCONTROL = 0x00002000;
var DT_PATH_ELLIPSIS = 0x00004000;
var DT_END_ELLIPSIS = 0x00008000;
var DT_MODIFYSTRING = 0x00010000;
var DT_RTLREADING = 0x00020000;
var DT_WORD_ELLIPSIS = 0x00040000;
var DT_NOFULLWIDTHCHARBREAK = 0x00080000;
var DT_HIDEPREFIX = 0x00100000;
var DT_PREFIXONLY = 0x00200000;

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

var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;

function on_paint(gr) {
    var ww = window.Width;
    var wh = window.Height;
    var volume = fb.Volume;
    var pos = window.Height * ((100 + volume) / 100);
    var txt = (Math.ceil(volume)) + "dB";
    gr.FillGradRect(0, 0, ww, wh - pos, 0, RGB(240, 240, 240), RGB(190, 190, 190));
    gr.FillGradRect(0, wh - pos, ww, pos, 0, RGB(240, 240, 240), RGB(100, 230, 100));
    gr.GdiDrawText(txt, g_font, RGB(64, 64, 128), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
    gr.DrawRect(0, 0, ww - 1, wh - 1, 1.0, RGB(150, 150, 150));
}


function on_mouse_lbtn_down(x, y) {
    g_drag = 1;
}

function on_mouse_lbtn_up(x, y) {
    on_mouse_move(x, y);
    g_drag = 0;
}

function on_mouse_move(x, y) {
    if (g_drag) {
        var v = y / window.Height;
        v = (v < 0) ? 0 : (v < 1) ? v : 1;
        v = -100 * v;
        if (fb.Volume != v) fb.Volume = v;
    }
}

function on_mouse_wheel(delta) {
    if (delta > 0) fb.VolumeUp();
    else fb.VolumeDown();
}

function on_volume_change(val) {
    window.Repaint();
}

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-05-16 14:05:49
yes, it's easy. just look at how an existing script works with the width and mouse x co-ord when dragging and modify it to use height/mouse y instead. it will need minor changes because you're working from the bottom up but it should still be a doddle.

edit: too slow...
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-05-24 09:30:49
I'm using many of Marc2003's WSH scripts, with great success.  However for some reason Last.fm charts and Last.fm similar artists are appearing blank.  I've been looking for a fix to this, without much luck.  I already did the following:

- browse wsh_data\charts and delete all files.
- browse wsh_data and search for and delete all files named artist*.json (the star is a wildcard supported by windows explorer)

...however results are still blank.

What am I missing?  Any help is appreciated...

PS, Marc2003 your scripts absolutely rock-- thank you for all your contributions.
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2015-05-24 11:37:15
New api key (and secret probably) from Last.fm needed? You can easily edit those in common8 file. Get keys here: http://www.last.fm/api (http://www.last.fm/api)

I have a question about Web Links script. Any way to display second tag, if first one is missing? For example:

(http://i.imgur.com/G0PrxOA.png)

I tag some of my albums with %film% and %series%, now would like for one button to perform search for either of them, but not sure how. Tried in first var above OR and ; and , and | between tags, and nothing works. I tried also new var named series and putting something like + film + series below next to sites, but that doesn't work exactly either. %3F that is generated screws things up.

One unifying tag that encompasses both would work, but before doing that posting here, maybe someone knows. Cheers!
Title: WSH Panel Mod script discussion/help
Post by: hexenszene on 2015-05-24 16:00:39
Thanks, the new API Key did the trick.  Last.fm Panels fully functional now.

New Question: I've installed Marc2003's Spectrogram Seekbar, but when I load foobar it says that SoX is missing and ffmpeg is missing.  I tried to download those plugins, but something isn't working.  Does anyone know if there is a guide for this floating around somewhere?  Am I just missing a component or is there something else entirely?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-05-24 23:34:56
Tried in first var above OR and ; and , and | between tags, and nothing works.


you just need to use basic foobar2000 title formatting for that. look at the $if/$if2/$if3 functions here....

http://wiki.hydrogenaud.io/index.php?title...8cond.2Cthen.29 (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.24if.28cond.2Cthen.29)

@hexenszene, i don't have that old script anymore but IIRC, it has 2 variables at the start... ffmpeg_exe and sox_exe. i think they use something like fb.ProfilePath + "sox\\..." - that means the files should be placed inside a a folder named sox inside your foobar profile folder. if running portable mode then the sox folder should be inside the foobar folder itself.
Title: WSH Panel Mod script discussion/help
Post by: OoNebsoO on 2015-05-25 09:28:54
Thank you marc.
Title: WSH Panel Mod script discussion/help
Post by: gheysun on 2015-06-01 03:59:46
Component update: Checking for: foo_customdb / Custom Database / 0.1.0_beta1
Component update: Checking for: foo_masstag / Masstagger / 1.8.4
Component update: Found a match - 1.8.4 vs 1.8.4
Component update: Checking for: foo_playcount / Playback Statistics / 3.0.2
Component update: Found a match - 3.0.2 vs 3.0.2
Component update: Checking for: foo_queuecontents / Queue Contents Editor / 0.5.1
Component update: Found a match - 0.5.1 vs 0.5.1
Component update: Checking for: foo_uie_wsh_panel_mod / WSH Panel Mod / 1.5.6
WSH Panel Mod (Similar Artists by marc2003): Parsing file "C:\Users\Jayson\AppData\Roaming\foobar2000\marc2003\common4.js"
Error: WSH Panel Mod (Similar Artists by marc2003): Microsoft JScript compilation error:
Unterminated string constant
File: <main>
Ln: 109, Col: 3
<source text only available at compile time>

the similar artists panel crashes on startup (was working fine just yesterday) and this appears in console. what do?
Title: WSH Panel Mod script discussion/help
Post by: gheysun on 2015-06-01 04:11:03
It randomly started working but album art shows "no cover image available" for everything.
Title: WSH Panel Mod script discussion/help
Post by: gheysun on 2015-06-01 09:45:06
The problem randomly returned upon selecting a new artist to play. similar artists has crashed witht the same error. someone please halp me?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-01 19:12:31
I'm using many of Marc2003's WSH scripts, with great success.  However for some reason Last.fm charts and Last.fm similar artists are appearing blank..


Problem is in your settings somewhere..
Anyway last.fm re-building their site, question is - will bio script work after that?
I hope that Marc will change decision and update..

New last.fm> (http://beta.last.fm/about/whatsnew)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-02 07:48:00
Problem is in your settings somewhere..


you're a bit late. hexenszene already got the answer over a week ago and posted to say it works... any last.fm scripts that use the API now requires everyone to use their own API keys. this might apply to gheysun's problem as well but given the script is so old, i can't say for sure. in theory it should work with an updated key as last.fm haven't changed anything in years (apart from removing/restricting certain things)

as for scraping the bio from the last.fm beta site, i'm sure you're more than capable of doing that yourself.... but i wouldn't even bother attempting it until the old pages stop working. it'll be interesting to see how long the site is in beta for and what changes they make before it goes final. there sure is a lot of hate for it over on the last.fm forums.
Title: WSH Panel Mod script discussion/help
Post by: deafstar on 2015-06-03 07:42:52
Hi!

Has anyone written a script for a standalone on/off button that enters a default value / clears a custom tag field?

An example of this is on Br3tts JSPlaylist which have heart icons that 'datestamp' the %mood% field of the file when selected (and the icon changes to on), and then clear the tag on a second selection (and the icon changes to off).

The reason I'm looking for this is I would like a way of tagging custom tags that's easier than using quicktagger, and also I'm pretty sure that you could use it as the basis to make a music mood square (which I've seen in other players).

Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Daeron on 2015-06-03 09:53:13
^ As I recall the component TagBox (http://www.foobar2000.org/components/view/foo_tagbox) can offer existing tags from the database (or values you predefined) in a checkbox list, if that's what you are looking for.

Like:
✅ Metal
☑ Rock
✅ Electronic
✅ Pop
✅ Orchestral
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-03 11:18:02
as for scraping the bio from the last.fm beta site, i'm sure you're more than capable of doing that yourself.... but i wouldn't even bother attempting it until the old pages stop working. it'll be interesting to see how long the site is in beta for and what changes they make before it goes final. there sure is a lot of hate for it over on the last.fm forums.


I will change script when old pages stop working.
Just worry about all users that use your script, they don't know how to change code..
And since you don't provide your scripts anymore , this is a big loss..

Changes will affect on 'Youtube Radio' as well, WillB uses API(json) to get info, and my use  scraping.
I found that scraping provides better Artist Song variety than WillB API metod..
But i now consider to use json, because they don't change this so often..
Since i never try json or xml, can you give me some short example, if you have time?
I'm in lost trying to find where you use this in your script, over 1000 lines

I don't like last.fm beta at all
Title: WSH Panel Mod script discussion/help
Post by: deafstar on 2015-06-03 11:19:18
^ As I recall the component TagBox (http://www.foobar2000.org/components/view/foo_tagbox) can offer existing tags from the database (or values you predefined) in a checkbox list, if that's what you are looking for.

Like:
? Metal
? Rock
? Electronic
? Pop
? Orchestral


Hey there!

I do already use tag box for multi-tagging and such things and certainly like quicktagging it will do the job, but I was hoping that there might have been a WSH panel script too (because its a quicker, easier and better looking interface to use).

Also I'm only looking for something that makes a default entry or clears the tag rather than needing a choice of values, this would be great for assigning things like noting if the track is loved, banned, duplicated, damaged and so on.

Anyway, thanks for replying!




Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-03 11:38:09
I do already use tag box for multi-tagging and such things and certainly like quicktagging it will do the job, but I was hoping that there might have been a WSH panel script too (because its a quicker, easier and better looking interface to use).

Also I'm only looking for something that makes a default entry or clears the tag rather than needing a choice of values, this would be great for assigning things like noting if the track is loved, banned, duplicated, damaged and so on.

Anyway, thanks for replying!


This is easy to do with wsh, example:

Code: [Select]
var tag;
var g_metadb;
g_metadb = fb.GetFocusItem();
tag = g_metadb.UpdateFileInfoSimple("Genre","pop");


Probably something exist here..
You have similar in some skins..
Love, Unlove, Ban..

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..
Title: WSH Panel Mod script discussion/help
Post by: dabujo on 2015-06-05 17:01:25
Does anyone have a backup of marc2003s latest scripts?
I am still on common7.js and my artist art script stopped fetching images.
I was able to find a copy of common8.js but i cant find any matching scripts or other missing files/images.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-05 17:49:08
the last changes last.fm made were in october 2013 so if the script has been working recently there is no reason why it shouldn't work now.
Title: WSH Panel Mod script discussion/help
Post by: dabujo on 2015-06-05 18:56:01
the last changes last.fm made were in october 2013 so if the script has been working recently there is no reason why it shouldn't work now.

Could be anything then.
Been a while since I added a new artist so the problem might be from months back.
I was gonna try to find out whats wrong by myself since I don't want to bother you and the obvious first go would be to install the latest versions.
Title: WSH Panel Mod script discussion/help
Post by: davideleo on 2015-06-05 20:05:12
I was gonna try to find out whats wrong by myself since I don't want to bother you and the obvious first go would be to install the latest versions.


I had your same concerns and eventually I found it here (http://audiophilesoft.ru/articles/lastfm/playcount_sync.7z).
Title: WSH Panel Mod script discussion/help
Post by: davideleo on 2015-06-06 02:03:04
Does anyone have a backup of marc2003s latest scripts?
I am still on common7.js and my artist art script stopped fetching images.


Sorry, I misread your post. The link above is for the playcount sync
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-06-14 06:18:54
Hey guys. Would someone mind helping me edit Falstaff's JSPlaylist?

I'm trying to replace the playlist count in the expanded group header with codec information.

(http://i.imgur.com/d1owbKw.jpg)

In WSHPlaylist.js, I presume I have to make the edit here, under Draw Header Content:

Code: [Select]
#685 var lg3_right_field = (this.group_index+1)+" / "+p.list.groups.length;


I've tried this but just get crashes:

Code: [Select]
var lg3_right_field = fb.TitleFormat("%codec%");


I need an adult!

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-14 08:36:02
Code: [Select]
var lg3_right_field = fb.TitleFormat("%codec%").EvalWithMetadb(this.metadb);
Title: WSH Panel Mod script discussion/help
Post by: hucifer on 2015-06-14 12:41:15
Code: [Select]
var lg3_right_field = fb.TitleFormat("%codec%").EvalWithMetadb(this.metadb);


Ah, so that's what I was missing. Much obliged
Title: WSH Panel Mod script discussion/help
Post by: deafstar on 2015-06-15 22:08:45
I do already use tag box for multi-tagging and such things and certainly like quicktagging it will do the job, but I was hoping that there might have been a WSH panel script too (because its a quicker, easier and better looking interface to use).

Also I'm only looking for something that makes a default entry or clears the tag rather than needing a choice of values, this would be great for assigning things like noting if the track is loved, banned, duplicated, damaged and so on.

Anyway, thanks for replying!


This is easy to do with wsh, example:

Code: [Select]
var tag;
var g_metadb;
g_metadb = fb.GetFocusItem();
tag = g_metadb.UpdateFileInfoSimple("Genre","pop");


Probably something exist here..
You have similar in some skins..
Love, Unlove, Ban..

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..


Thanks for your suggestion but with my miniscule scripting knowledge I haven't been able to piece this together...and I don't think I can take the pinging screen of scripting death anymore 

however after some head scratching I realised that I have actually created some context menu paths for these custom tag actions with quicktagger, which means that if nothing else I can create some custom buttons on a toolbar (which is a good result!) 

but before I give up trying to do this on a panel I wonder if anyone can answer this- using marcs buttons script it's straightforward to use any main menu function as you can write down the menu path in his script i.e.

a: new button(14, 4, 19, 19, {normal: "show playing.png", hover: "show playing hi.png"}, function() { fb.RunMainMenuCommand("View/Show now playing"); }, "Show playing")

is it possible to somehow change this fb. instruction to a context menu path?

Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2015-06-15 23:29:29
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.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2015-06-16 16:02:07
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
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-16 17:08:09
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 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=900034)
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2015-06-16 17:48:14
Sorry doesnt help  I already tried another API Key and get the same result.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2015-06-17 17:23:12
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.
Title: WSH Panel Mod script discussion/help
Post by: kornkid5622 on 2015-06-18 23:44:41
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.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-19 04:24:24
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.
Title: WSH Panel Mod script discussion/help
Post by: kornkid5622 on 2015-06-19 05:07:18
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
Title: WSH Panel Mod script discussion/help
Post by: kornkid5622 on 2015-06-19 06:42:42
I can nolonger edit my last post but i got it working, thanks alot for the help marc2003!
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-06-22 17:32:28
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 (https://code.google.com/p/lastfmtagextractor/) 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://mir-research.blogspot.com/2008/06/lastfms-api-python-and-tagging_29.html)
http://michaelmarth.blogspot.com/2009/11/p...-in-itunes.html (http://michaelmarth.blogspot.com/2009/11/python-script-to-set-genre-in-itunes.html)
Title: WSH Panel Mod script discussion/help
Post by: michtar on 2015-06-23 11:47:36
I adjusted a seekbar script http://www.hydrogenaud.io/forums/index.php...st&p=676629 (http://www.hydrogenaud.io/forums/index.php?showtopic=67257&view=findpost&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
(http://i.imgur.com/KEm6Tir.png)

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
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-23 15:59:22
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;
Title: WSH Panel Mod script discussion/help
Post by: michtar on 2015-06-24 09:55:19
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.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-24 10:09:39
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.
Title: WSH Panel Mod script discussion/help
Post by: Emerelle on 2015-06-26 19:26:31
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);
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-26 22:32:44
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);
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-28 08:03:10
Hey i found this this tool (https://code.google.com/p/lastfmtagextractor/) 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://mir-research.blogspot.com/2008/06/lastfms-api-python-and-tagging_29.html)
http://michaelmarth.blogspot.com/2009/11/p...-in-itunes.html (http://michaelmarth.blogspot.com/2009/11/python-script-to-set-genre-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..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-28 11:07:50
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?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-28 12:25:17
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..
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-06-28 13:51:28
Hey i found this this tool (https://code.google.com/p/lastfmtagextractor/) 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://mir-research.blogspot.com/2008/06/lastfms-api-python-and-tagging_29.html)
http://michaelmarth.blogspot.com/2009/11/p...-in-itunes.html (http://michaelmarth.blogspot.com/2009/11/python-script-to-set-genre-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/ (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();
}
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-06-28 18:17:30
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/ (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 ??
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-06-28 18:33:46
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/ (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.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-28 20:45:39
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/ (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..
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-06-28 21:28:34
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 (http://www.last.fm/api/show/artist.getSimilar)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-06-28 23:17:15
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);


Title: WSH Panel Mod script discussion/help
Post by: fbuser on 2015-06-29 05:53:55
you might want to limit how many you attempt at once though.
Actually, this is a must.

When you for example update many items via the properties dialog the necessary update operations will be queued and only one thread for updating the files is spawned. With WSH Panel Mod a separate update process is spawned for each affected file. From my own experience this can lead to locking up your computer in case of too many threads with some corrupted files as a result. Therefore I limited the number of entries, which can be updated in one run to 500, which seems to be safe on my system.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-29 09:19:47
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 (http://www.last.fm/api/show/artist.getSimilar)


Thanks Zeremy
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-30 11:12:31
Zeremy or someone else..
I have this response:


{"similartracks":{"track":[{"name":"Strong Enough","playcount":"593863","mbid":"5456fafa-c9fd-4e3c-9170-6a61b858c49e","match":"1","url":"http:\/\/www.last.fm\/music\/Cher\/_\/Strong+Enough","streamable":{"#text":"0","fulltrack":"0"},"duration":"220000","artist":{"name":"Cher","mbid":"bfcc6d75-a6a5-4bc6-8282-47aec8531818","url":"http:\/\/www.last.fm\/music\/Cher"},"image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34s\/71997588.png","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64s\/71997588.png","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/71997588.png","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/300x300\/71997588.png","size":"extralarge"}]},{"name":"All or Nothing","playcount":"253721","mbid":"a88735e6-b35c-4379-8ef7-bbd2b793ccf4","match":"0.872756","url":"http:\/\/www.last.fm\/music\/Cher\/_\/All+or+Nothing","streamable":{"#text":"0","fulltrack":"0"},"duration":"238000","artist":{"name":"Cher","mbid":"bfcc6d75-a6a5-4bc6-8282-47aec8531818","url":"http:\/\/www.last.fm\/music\/Cher"}.......


I can get frist value, but how to get second ''artist.name''?
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-06-30 11:44:15
Zeremy or someone else..
I have this response:


{"similartracks":{"track":[{"name":"Strong Enough","playcount":"593863","mbid":"5456fafa-c9fd-4e3c-9170-6a61b858c49e","match":"1","url":"http:\/\/www.last.fm\/music\/Cher\/_\/Strong+Enough","streamable":{"#text":"0","fulltrack":"0"},"duration":"220000","artist":{"name":"Cher","mbid":"bfcc6d75-a6a5-4bc6-8282-47aec8531818","url":"http:\/\/www.last.fm\/music\/Cher"},"image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34s\/71997588.png","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64s\/71997588.png","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/71997588.png","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/300x300\/71997588.png","size":"extralarge"}]},{"name":"All or Nothing","playcount":"253721","mbid":"a88735e6-b35c-4379-8ef7-bbd2b793ccf4","match":"0.872756","url":"http:\/\/www.last.fm\/music\/Cher\/_\/All+or+Nothing","streamable":{"#text":"0","fulltrack":"0"},"duration":"238000","artist":{"name":"Cher","mbid":"bfcc6d75-a6a5-4bc6-8282-47aec8531818","url":"http:\/\/www.last.fm\/music\/Cher"}.......


I can get frist value, but how to get second ''artist.name''?


To analyze json I suggest using notepad++ with plugins JSTool and JSON Viewer.
You can see the data as a tree.

(http://i.imgur.com/JadBWAX.png)

so the answer is
similiartracks.track[1].artist.name

also read http://www.w3schools.com/js/js_json.asp (http://www.w3schools.com/js/js_json.asp)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-30 12:48:09
To analyze json I suggest using notepad++ with plugins JSTool and JSON Viewer.
You can see the data as a tree.



so the answer is
similiartracks.track[1].artist.name

also read http://www.w3schools.com/js/js_json.asp (http://www.w3schools.com/js/js_json.asp)


This is what i need, i looked this from browser, it's in totaly mess
Thank you..
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-06-30 13:03:16
For chrome browser extension.
https://chrome.google.com/webstore/detail/j...her-info-dialog (https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?utm_source=chrome-app-launcher-info-dialog)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-06-30 19:54:32
For chrome browser extension.
https://chrome.google.com/webstore/detail/j...her-info-dialog (https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?utm_source=chrome-app-launcher-info-dialog)


Thank you Zeremy
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-06-30 21:11:45
How to delay line from executing, like a sleep() function
Is it window.SetInterval(on_timer, 5000) ??
(I want to do a task after 5 seconds executing previous one )
Title: WSH Panel Mod script discussion/help
Post by: foosion on 2015-06-30 21:47:30
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 ??
Most JavaScript frameworks expect to run in a web browser and require certain programming interfaces. While WSH Panel Mod uses the same or at least very similar programming language it provides a different set of programming interfaces, for example access to the foobar2000 media library instead of access to the HTML DOM and Win32 based drawing functions instead of HTML5 canvas support. I don't think you'll find a lot of JavaScript frameworks which work in WSH Panel Mod.
Title: WSH Panel Mod script discussion/help
Post by: bas on 2015-07-01 07:34:03
How to delay line from executing, like a sleep() function
Is it window.SetInterval(on_timer, 5000) ??
(I want to do a task after 5 seconds executing previous one )

You can use window.SetTimeout():

Code: [Select]
window.SetTimeout(function() { 
    fb.trace("show after 5 seconds");
}, 5000);

See the interfaces documentation included with component.

Regards,
bas
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-01 10:23:27
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 ??
Most JavaScript frameworks expect to run in a web browser and require certain programming interfaces. While WSH Panel Mod uses the same or at least very similar programming language it provides a different set of programming interfaces, for example access to the foobar2000 media library instead of access to the HTML DOM and Win32 based drawing functions instead of HTML5 canvas support. I don't think you'll find a lot of JavaScript frameworks which work in WSH Panel Mod.


one thing i've stumbled across that does work is underscore.js

http://underscorejs.org/ (http://underscorejs.org/)
Title: WSH Panel Mod script discussion/help
Post by: foosion on 2015-07-01 12:02:01
Interesting. So Underscore is a notable exception because it does not assume any specific features besides the ones provided by the language. If you find any others like this they will probably work as well.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-07-01 15:51:09
I was try both last.fm JSON and XML format request while foobar is playing, and foobar always stop responding for 1-2sec while script executing.
How to prevent this?
I have problem on this simple script:
(this especially happens if i send one request after another ex. 1st func. call XML (artist.getsimilar) , 2nd func. call XML (gettoptracks)..)

Code: [Select]
this.TopTracks = function()
{

url = "http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&artist=" + ART + "&api_key=" + API;

xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

xmlhttp.open("GET",url,false);
xmlhttp.send("");

data = xmlhttp.ResponseText;
xmlhttp.Close;
fb.trace("data: " + data);

xmlhttp.Close;  
xmlhttp.Close;

}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-01 16:19:25
Code: [Select]
xmlhttp.open("GET",url,false);


the false there is telling the script to make a synchronous request which blocks the script until it's done. instead, you should be making Asynchronous requests. as well as changing the above to true, you need to add a bit more code like this...

Code: [Select]
var url = ...
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", url, true);
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            //do something with xmlhttp.responsetext
        } else {
            fb.trace(xmlhttp.responsetext || "HTTP error: " + xmlhttp.status);
        }
    }
}
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-07-01 16:44:21
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 ??
Most JavaScript frameworks expect to run in a web browser and require certain programming interfaces. While WSH Panel Mod uses the same or at least very similar programming language it provides a different set of programming interfaces, for example access to the foobar2000 media library instead of access to the HTML DOM and Win32 based drawing functions instead of HTML5 canvas support. I don't think you'll find a lot of JavaScript frameworks which work in WSH Panel Mod.


one thing i've stumbled across that does work is underscore.js

http://underscorejs.org/ (http://underscorejs.org/)

@marc2003

Have you tried lodash.js https://lodash.com/ (https://lodash.com/) or lazy.js http://danieltao.com/lazy.js/ (http://danieltao.com/lazy.js/) ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-01 17:18:36
i can't even begin to understand those lazy.js docs....    i think i'll stick to my simple arrays and loops.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-07-01 17:37:39
i can't even begin to understand those lazy.js docs....    i think i'll stick to my simple arrays and loops.


I guess your also too lazy as I am  . 

Just mentioned it for reference if anyone want to know of a possible library.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-07-01 19:42:31
Code: [Select]
xmlhttp.open("GET",url,false);


the false there is telling the script to make a synchronous request which blocks the script until it's done. instead, you should be making Asynchronous requests. as well as changing the above to true, you need to add a bit more code like this...

Code: [Select]
var url = ...
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", url, true);
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            //do something with xmlhttp.responsetext
        } else {
            fb.trace(xmlhttp.responsetext || "HTTP error: " + xmlhttp.status);
        }
    }
}

Thank you :-)
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-07-02 09:29:21
@mire777

*Apply on empty tag

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

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

This does not work.

Use
Code: [Select]
g_metadb = fb.GetFocusItem();
lastfmtoptags = fb.TitleFormat("%lastfmtoptags%").EvalWithMetadb(g_metadb);

if (lastfmtoptags == "?") {/////write code here////}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-03 18:36:29
Have you tried lodash.js https://lodash.com/ (https://lodash.com/)


i've done a little reading up on this and it's most definitely recommended over using underscore.js so forget i even mentioned that.

i've started using it and everything i've tried so far works perfectly.
Title: WSH Panel Mod script discussion/help
Post by: vanhoivanbinh on 2015-07-06 09:53:29
Dear friends, especially Marc2003

I am using your scripts for long time. Recently following your suggestion, I have modify it to add the Last.fm API and now all the panels function properly
There is only disturbing thing:

The last.fm panel for similar artists shows related artists but when I click the mouse in, it delays for several seconds (about 10s) then Foobar notice window shows up "Unable to launch your default browser". Before when I click to it, the related last.fm webpage will open in my browser.

I have followed your suggestion about typing  "Windows + R" and type a url, everything loads fine. Chrome is my default browser (has been set in Window 8 setting for default program, no firewall blocking etc)

Also I found that other embedded urls in my FOOBAR2000 also cannot be opened.

I am using 64 bit, windows 8 laptop with portable install of latest Foobar2000 version

IS THERE ANYTHING WRONG WITH MY SETTING UP OF FOOBAR2000?? Please give me some clues?
Thank you very much for your help!!!!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-06 10:37:03
given launching websites from the run dialog works, i'm not really sure what the problem is.

you can try opening marc2003\common8.js (or even common7.js) in a decent text editor. windows notepad won't open them properly so don't use that.

find this line of text...

Code: [Select]
this.browser = function(c) {


replace this function

Code: [Select]
    this.browser = function(c) {
        if (!this.run(c)) this.MsgBox("Unable to launch your default browser.", 0, this.name);
    }


with

Code: [Select]
this.browser = function(c) {
    var WshShell = new ActiveXObject("WScript.Shell");
    WshShell.Run(c);
}


if foobar is running, make sure you open/close the editor dialog for the script to pickup the changes.

the script should now crash but the important thing is you might get a more meaningful error message than what you had previously.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-07-06 12:38:02
Is it possible to alter the common7 rating sample (or similar) into a binary switch for mood for use with Falstaff's JSPlaylist mood column? So far that seems like it would do what I want the best if possible. EG: The rating can work when playing OR selected and not playing.

I know I could just tap the icon in the playlist but my most used playlist is an autoplaylist setup like so: %play_count% IS 0. When the song vanishes from the playlist after its count reaches 1 I can still rate it if it's playing. Very handy if I happen to miss rating before the minute is up. Thinking the same thing for mood would be nice.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-07 09:49:39
if no one provides you with a script, make another autoplaylist to show recently played tracks.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-07-07 11:02:34
Already have one. I'll just wing it.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-07-07 11:25:14
This does not work.

Use ...


I didn't even start yet, don't have internet, so i can't try anything
My modem is dead..
Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Spanky Monkey on 2015-07-08 15:20:32
Hi folks,
It looks like I am extremely late to the party, and as such am going to get a few rolled eyes directed at me.
I'll confess I (like many here) have no experience programming javascript and as such everything is a point of learning.

I am currently just trying to make Marc2003's buttons panel have toggle button for stop after current.  One I understand that, and how it works, I can implement other toggle buttons for various things.
The thing is, I had gotten the button to change graphic depending on the status of the stop after current function, however, I have to open the WSH script and hit apply to make the button graphic change.  It's not updating by its self, and this must be because I am not invoking redrawing the panel for this.

Post #3 (yep, 5 years ago) in this thread is where I've started.  dui_buttons.js and marc2003.js
http://www.hydrogenaud.io/forums/index.php...st&p=680459 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&view=findpost&p=680459)

After making some simple and easy personal additions (a couple of variables), I added a condition for the button graphic, based on the status of StopAfterCurrent - however, it doesn't refresh by itself.  This is obviously not the way to do it.

Code: [Select]
but7: new Button(((bw + w_spacer)*6) + left_margin,top_margin,bw,bh, {
        normal: fb.StopAfterCurrent ? image_path + "SAC_on_36.png" : image_path + "SAC_off_36.png", hover: image_path + "SAC_h_36.png", down: fb.StopAfterCurrent ? image_path + "SAC_off_36.png" : image_path + "SAC_on_36.png"
        }, function(){fb.RunMainMenuCommand('Playback/Stop after current');}, "Stop After Current")


I've editing Delphi's "Stop after current" panel down to just being an indicator.
http://www.hydrogenaud.io/forums/index.php...st&p=739640 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&view=findpost&p=739640)

Icedtea is requesting help on the same kind of thing, but with a play/pause toggle. 
http://www.hydrogenaud.io/forums/index.php...st&p=684728 (http://www.hydrogenaud.io/forums/index.php?showtopic=77883&view=findpost&p=684728)

It would seem that I require tooltip_buttons.js or even a modified version of this.  However Marc2003's samples.zip link doesn't work for me at all.
http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)

Without me having to tread through 130+ pages (I've got to about page 30), am I missing something, have these resources moved?
I really do appreciate all the effort the relevant parties have put in, it's a great tool and the results can be awesome.

I'll refrain from asking for direct help in actually writing the script, as well, I'm sure you folks have better things to do than go back over something trivial from a few years ago.  If I can get the tools I need, then I can learn in my own time how this all falls together.  (I have started commenting dui_buttons.js just to understand how each bit works).

Thanks muchly for any help.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-08 15:26:19
you just need to add the following callback to your code...

Code: [Select]
function on_playlist_stop_after_current_changed() {
    //call the function that updates your buttons here
}
Title: WSH Panel Mod script discussion/help
Post by: Spanky Monkey on 2015-07-08 15:55:25
you just need to add the following callback to your code...

Code: [Select]
function on_playlist_stop_after_current_changed() {
    //call the function that updates your buttons here
}


Thanks for replying so quickly Marc

That makes sense - even more sense, now because of what I just did.
I just put your WSH panel "Buttons = ( ... )" part, inside an "on_paint(gr){ <button stuff here> }" and it refreshed all of the buttons.

However, I can appreciate that it's inefficient, I guess it's redrawing the buttons constantly, even though there maybe no changes.

in dui_buttons.js the "on_paint(gr)" part includes the color for the window background, a solid fill of chosen color, "buttonsDraw(gr)"*, and the rectangle to give the window some 3D shape.

* function buttonsDraw(gr) is linked to "i" which I'm guessing is determined by the x/y mouse positions and therefore what button the mouse is over.

Hmm, now where would the button redrawing be called up, somewhere in dui_buttons.js ....
I'll try redirecting the result on status change to different places in dui_buttons.js, so far I haven't had any luck, but I'm sure I just haven't foun the right spot yet.

Thanks again for your help.
Title: WSH Panel Mod script discussion/help
Post by: Spanky Monkey on 2015-07-08 20:09:37
Sorry for not getting it, but I've tried to send the "function on_playlist_stop_after_current_change() { . . . }" to multiple places in dui_buttons.js and can't get it to refresh.  I've also tried "function on_playlist_stop_after_current_change(state) { . . . }", but it's not that this bit is wrong, it's just where I am trying to send it.

Plugging in Delphi's code, into Marc2003's dui_buttons.js, gets me a graphic that changes based on the status of [stop after current], which is right next to the button that controls it, but, the button behaves just as the others.  In that it's a simple momentary switch, and doesn't change graphic itself to the 'down' state when [stop after current] is engaged.

Code: [Select]
function on_init(bool) {
    imgname =bool  ?   "sac_on_36.png" : "SAC_off_36.png";
    SAC = gdi.image(fb.FoobarPath + "scripts\\buttons\\" + imgname);
    window.Repaint();
};

on_init(fb.StopAfterCurrent);

function on_paint(gr){
    switch(window.GetProperty("mode", 1)) {
        case 1:
            col = window.GetColorDUI(1);
            break;
        case 2:
            col = utils.GetSysColor(4);
            break;
        case 3:
            col = custom;
            break;
    }
    gr.FillSolidRect(0, 0, ww, wh, col);
    buttonsDraw(gr);
    gr.DrawImage(SAC, 258, 6, 36, 36, 0, 0, 36, 36);
    gr.DrawRect(0,0, ww, wh, 1.0, -6250336);
}

function on_playlist_stop_after_current_changed(state) {on_init(fb.StopAfterCurrent);}


I see that buttonsDraw(gr) is something that calls for the buttons to be redrawn by on_paint(gr), but this seems selective, based on mouse over or mouse click, and I can't work out how to inject the necessary bits to make it work for the SAC button.

I've looked into using a variable with two states for the button normal graphic, however, this still doesn't work because the buttons are not being refreshed.  It's the same point that I need to find.

I have a feeling that I am overly complicating the situation.

I guess that it's not all that hard to make two images, make the button larger, and just use two halves for the status.  Whilst not all that pretty it does work.
Title: WSH Panel Mod script discussion/help
Post by: MuhdNurHidayat on 2015-07-15 08:45:35
It has been so long I'm not here.

Can I know how to make the default "Simple Text Reader" by marc2003 to be responsive with foobar2000 state?

For example, I want the text being read to disappear when playback has not started or stopped, and instead it should display "No tracks played".

I did noticed this in his script
Code: [Select]
    if (!p.metadb) p.centre_text(gr, "[no selection]", p.normal_font, p.textcolour, 0, 0, t.w, t.h);
    else t.draw(gr);
but I never get that [no selection] text.

I'm using Windows Scripting Host Panel Modded v1.5.10 Modded by T.P. Wang
(or I installed the wrong version? It IS written as WSH Panel Mod in Installed Components list)
(http://puu.sh/iZQGR/179416db75.png)
(http://puu.sh/iZQMa/9592d11b58.png)

This is his full code
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common7.js"
// @name "Simple Text Reader"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
var p = new panel("Simple Text Reader", ["metadb", "simple_text"]);
var t = new text(7, 10, p.w - 12, p.h - 15);

on_item_focus_change();

function on_size() {
    p.size();
    t.w = p.w - 12;
    t.h = p.h - 15;
    t.size();
}

function on_paint(gr) {
    p.draw_background(gr);
    p.left_text(gr, p.eval(t.title), p.title_font, p.textcolour_hl, 6, 6, p.w - 12, 14);
    gr.DrawLine(6, 19, p.w - 6, 19, 1, p.textcolour_hl);
    if (!p.metadb) p.centre_text(gr, "[no selection]", p.normal_font, p.textcolour, 0, 0, t.w, t.h);
    else t.draw(gr);
}

function on_metadb_changed() {
    t.metadb_changed();
}

function on_mouse_wheel(step) {
    t.wheel(step);
}

function on_mouse_move(x, y) {
    p.move(x, y);
    t.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
    t.lbtn_up(x, y);
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-15 09:27:01
Code: [Select]
if (fb.IsPlaying)
    t.draw(gr)
else
    p.centre_text(gr, "No tracks played.", p.normal_font, p.textcolour, 0, 0, t.w, t.h);


also, you need to add this extra bit of code not inside any other functions.

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

function on_playback_stop() {
    window.Repaint();
}
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-07-15 20:50:19
I want calculate length of a string
so i used
Code: [Select]
// Used with GDI functions, such as GdiDrawText().
    uint CalcTextWidth(str, IGdiFont);

Like this
Code: [Select]
 fb.trace(CalcTextWidth("abcdef", gdi.Font("PCDE", 55, 3)));

And got this error :
WSH Panel Mod (Thumbs): Microsoft JScript runtime error:
Object expected
What am i doing wrong??
Title: WSH Panel Mod script discussion/help
Post by: MuhdNurHidayat on 2015-07-15 21:20:54
@marc2003
The code works like a charm, thank you very much! 

By using logic, I also used the code you gave as a sample to change the title too.
The title will default to some text when not playing and change into track title when playing.

So, it will be like this when not playing anything
(http://puu.sh/j0rJh/f50bf5ce38.png)

And this when it plays something
(eg. Rally Go Round)
(http://puu.sh/j0rUn/e4d39a24b1.png)

I will dig further into these scripts stuffs and make more edits,
I feel kinda happy when I can display what I want...

If anyone wondered why I use this external text method to display lyrics, it's because I only save the romanized lyrics in FLAC, so I use external text to display original lyrics together with trilingual translations, they were saved in different files.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-15 21:51:19
Object expected
What am i doing wrong??


you either have to do it inside on_paint with gr like this...

Code: [Select]
//i think it's best practice to create the font once
var my_font = gdi.Font("PCDE", 55, 3);

function on_paint(gr) {
    fb.trace(gr.CalcTextWidth("abc", my_font));
}


if you want to do it in other functions, you have to do something a bit more messy like this...

Code: [Select]
var temp_bmp = gdi.CreateImage(1, 1);
var temp_gr = temp_bmp.GetGraphics();
fb.trace(temp_gr.CalcTextWidth("abc", my_font));
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-07-17 16:34:22
Code: [Select]
var temp_bmp = gdi.CreateImage(1, 1);
var temp_gr = temp_bmp.GetGraphics();
fb.trace(temp_gr.CalcTextWidth("abc", my_font));
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;


That worked  thanks a lot marc!!
Title: WSH Panel Mod script discussion/help
Post by: Spanky Monkey on 2015-07-21 15:02:26
Hi Marc,
I'm really sorry to say this, but I cannot get a redraw of the button graphic.
I've worked out that in dui_buttons.js, it calls on the "Buttons" part in the WSH panel to get the info on what graphics to use, and where the positions are etc.  However, once this data has been acquired (on panel launch/manual refresh) the graphic is permanent.

I just can't figure out a way to get the "function Button" in dui_buttons.js to refresh the graphic data when a status, like Stop After Current, is changed.  Everything I have tried hasn't worked, or has made a crash.  I've double checked my brackets etc, it's not a silly error like that causing a crash. 

Do you have tooltip_buttons.js knocking around somewhere by chance?  This link:
http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip (http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/foobar/guide/samples.zip)
doesn't work for me at all, I've registered but the file isn't there it tells me.
I have a feeling there maybe something in the code in this script that will make it all click for me...

I'd like tooltips to change as well, which ties in with the current layout of things.  If I can get "Buttons" in the WSH panel to be recalled, then it'll change the tooltip also (all birds with one stone),  else I may just leave the tooltip as is, knowing that putting inside the on_paint function will surely cause it to flicker, as you've documented somewhere.


Reading some other topics related to WSH, I can see that folks have given you a hard time, intentionally or not, and done that whole "I'm sure it'll take only a few minutes of your time" thing.  I can understand completely if you don't have time to, or just don't wish to assist further on this particular topic that I'm having a particular challenge with.  You've done a great deal already, as have a few other contributors.

I was looking around for it, and it's not there in js, the "CALL" function as in MS-DOS.  I thought about just simply making the script jump back to the top when the state of something is changed.  However, no "call" exists, and the way to implement it breaks all the rest of the code, so no deal that way - which is the wrong way to do it, I know.

Thanks again
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-21 16:18:33
all my download links in this thread don't exist anymore. i'll post my latest buttons script later on/tomorrow.
Title: WSH Panel Mod script discussion/help
Post by: Maeldun on 2015-07-26 20:54:06
Hello marc2003 & everyone,

Last.fm Playcount Sync script recently started crashing on me (regularly) and I haven't found any info on this particular error text - from foobar console:
Code: [Select]
Error: WSH Panel Mod (Playcount Sync by marc2003): Microsoft JScript compilation error:
Syntax error
File: <main>
Ln: 178, Col: 2
<source text only available at compile time>

Not sure if this the correct thread in which I am supposed to post, apologies. Am I doing something stupid? Does anyone have any idea what's causing this error? Thank you. In case of usefulness, I'm posting my entire script code below:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common4.js"
// @import "%fb2k_profile_path%marc2003\tooltip_buttons.js"
// @name "Playcount Sync"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var top_margin = 0;
var left_margin = 0;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var script_name = "Playcount Sync";
var selection_mode = 1;
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);
var sql_file = data_folder + "test.sql";
var loved_working = null;
var playcount_working = null;
var page = 0;
var last_page = 0;
var auto_correct = window.GetProperty("auto_correct", true);
var auto_love = window.GetProperty("auto_love", false);
var auto_love_tf = window.GetProperty("auto_love_tf", "");
var bg = window.GetProperty("bg", 102);
var custom_background = window.GetProperty("custom_background", "");
var icon = window.GetProperty("icon", "tango");
var show_console = window.GetProperty("show_console", true);
var library = window.GetProperty("library", false);

var g_timer = window.SetInterval(function() {
var temp = page > 1 ? page - 1 : 1;
if (loved_working && page == last_page) {
xmlhttp.abort();
sync_library_loved(temp);
} else if (playcount_working && page == last_page) {
xmlhttp.abort();
sync_library_playcount(temp);
} else {
last_page = page;
}
}, 15000);

if (fb.IsPlaying) on_playback_new_track();
else if (g_metadb) on_item_focus_change();
else update_button();

function update_button() {
exclamation = icon == "tango" ? "exclamation.png" : "exclamation_small.png";
love = icon == "tango" ? "love.png" : "love_small.png";
love_h = icon == "tango" ? "love_h.png" : "love_h_small.png";
size = icon == "tango" ? 32 : 20;
switch(true) {
case !g_metadb:
n = exclamation;
h = exclamation;
tooltip = "No selection";
func = null;
break;
case !utils.CheckComponent("foo_customdb", true):
n = exclamation;
h = exclamation;
tooltip = "The foo_customdb component is not installed. Please refer to the readme.";
func = null;
break;
case username.length == 0:
case api_key.length != 32:
n = exclamation;
h = exclamation;
tooltip = "Please use the context menu to set your Last.fm username and API KEY.";
func = null;
break;
case !utils.CheckComponent("foo_softplaylists", true):
n = exclamation;
h = exclamation;
tooltip = "The foo_softplaylists component is required to love tracks.";
func = null;
break;
default:
n = old_userloved == 1 ? love_h : love;
h = old_userloved == 1 ? love : love_h;
tooltip = command;
func = function() { lfm_track(); }
break;
}
Buttons = { but: new Button(left_margin, top_margin, size, size, {normal: images_path + n, hover: images_path + h}, func, tooltip) };
window.Repaint();
}

function on_metadb_changed() {
if (!g_metadb) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
track = fb.TitleFormat("%title%").EvalWithMetadb(g_metadb);
old_userloved = fb.TitleFormat("%LASTFM_LOVED_DB%").EvalWithMetadb(g_metadb) == 1 ? 1 : 0;
old_userplaycount = fb.TitleFormat("%LASTFM_PLAYCOUNT_DB%").EvalWithMetadb(g_metadb);
command = "Last.fm " + (old_userloved == 1 ? "Unlove" : "Love") + " Track '" + track + "' by '" + artist + "'";
crc32 = fb.TitleFormat("$crc32($lower(%artist%%title%))").EvalWithMetadb(g_metadb);
update_button();
}

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

function on_paint(gr) {
buttons_background(gr);
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();
loved_working = null;
playcount_working = null;
}
}

function on_playback_new_track() {
time_elapsed = 0;
switch(true) {
case fb.PlaybackLength == 0:
target_time = 240;
break;
case fb.PlaybackLength >= 30:
target_time = Math.min(Math.floor(fb.PlaybackLength / 2), 240);
break;
default:
target_time = 5;
break;
}
on_item_focus_change();
}

function on_playback_time(time) {
time_elapsed++;
if (time_elapsed == 3 && auto_love && fb.TitleFormat(auto_love_tf).Eval() == 1 && old_userloved == 0) {
fb.trace(script_name + ": Automatically loving this track....");
lfm_track();
}
if (time_elapsed == target_time && (!library || fb.IsMetadbInMediaLibrary(g_metadb))) sync();
}

function lfm_track() {
fb.RunContextCommandWithMetadb(command, g_metadb, 8);
sync();
}

function sync() {
switch(true) {
case loved_working || playcount_working:
return;
case !utils.CheckComponent("foo_customdb", true):
fb.trace(script_name + ": Not contacting Last.fm. foo_customdb is missing.");
return;
default:
fb.trace(script_name + ": Contacting Last.fm....");
lastfm("&method=track.getinfo&artist=" + encodeURIComponent(artist) + "&track=" + encodeURIComponent(track) + "&autocorrect=" + (auto_correct ? 1 : 0), "foo_playcount_sync", function() { process(); });
}
}

function tf(value) {
value = value.replace(/'/g, "''");
value = value.replace(/,/g, "','");
value = value.replace(/\//g, "'/'");
value = value.replace(/\(/g, "'('");
value = value.replace(/\)/g, "')'");
value = value.replace(/\[/g, "'['");
return (value.replace(/\]/g, "']'"));
}

function process() {
parsed_data = JSON.parse(xmlhttp.responsetext);
if (parsed_data.error > 0) {
if (parsed_data.error == 6) fb.trace(script_name + ": artist / track not found.");
else fb.trace(script_name + ": " + xmlhttp.responsetext);
return;
}
fb.trace(script_name + ": Last.fm responded 'OK'");
userplaycount = parsed_data.track.userplaycount > 0 ? ++parsed_data.track.userplaycount : 1;
userloved = parsed_data.track.userloved == 1 ? 1 : 0;
if (fb.IsPlaying && time_elapsed >= target_time && fb.PlaybackLength > 29 && fb.PlaybackLength < 10800) {
switch(true) {
case userplaycount < old_userplaycount:
fb.trace(script_name + ": Playcount returned from Last.fm is lower than current value. Not updating.");
break;
case old_userplaycount == userplaycount:
fb.trace(script_name + ": No changes found. Not updating.");
break;
default:
fb.RunContextCommandWithMetadb("Customdb Delete Playcount", g_metadb, 8);
if (old_userloved == 1) fb.RunContextCommandWithMetadb("Customdb Love 0", g_metadb, 8);
var attempt = 0;
while(fb.TitleFormat("%LASTFM_PLAYCOUNT_DB%").EvalWithMetadb(g_metadb) != userplaycount && attempt <= 3) {
var query1 = '\"INSERT INTO quicktag(url,subsong,fieldname,value) VALUES(\\"' + crc32 + '\\",\\"-1\\",\\"LASTFM_PLAYCOUNT_DB\\",\\"' + userplaycount + '\\")\";';
WshShell.Run(fso.GetFile(script_path + "sqlite3.exe").ShortPath + " " + fso.GetFile(fb.ProfilePath + "customdb_sqlite.db").ShortPath + " " + query1, 0, true);
attempt++;
}
fb.RunContextCommandWithMetadb("Customdb Refresh", g_metadb, 8);
break;
}
}
if (old_userloved != userloved) fb.RunContextCommandWithMetadb("Customdb Love " + userloved, g_metadb, 8);
}

function sync_library_loved(p) {
if (loved_working == null) return(fb.trace(script_name + ": Import aborted."));
page = p;
lastfm("&method=user.getlovedtracks&limit=200&user=" + username + "&page=" + page, "foo_playcount_sync", function() { process_library_loved(); });
}

function process_library_loved() {
parsed_data = JSON.parse(xmlhttp.responsetext);
if (parsed_data.error > 0) {
loved_working = null;
fb.ShowPopupMessage("There is a problem with the Last.fm web services. Please try again later.\n\n" + xmlhttp.responsetext, script_name);
return;
}
if (page == 1) { try { pages = parsed_data.lovedtracks["@attr"].totalPages; } catch(e) {} }
if (pages > 0 && xmlhttp.responsetext.indexOf('{"lovedtracks":') == 0) {
for (i = 0; i < parsed_data.lovedtracks.track.length; i++) {
try {
var data = [];
data[0] = parsed_data.lovedtracks.track[i].artist.name;
data[1] = parsed_data.lovedtracks.track[i].name;
data[2] = 1;
if (data.length == 3) {
fb.trace(r + ": " + data[0] + " - " + data[1]);
url = fb.TitleFormat("$crc32($lower(" + tf(data[0]) + tf(data[1]) + "))").EvalWithMetadb(g_metadb);
sql += 'INSERT OR REPLACE INTO quicktag(url,subsong,fieldname,value) VALUES("' + url + '","-1","LASTFM_LOVED_DB","' + data[2] + '");' + "\n";
r++;
}
} catch(e) {
errors++;
}
}
fb.trace("Completed page " + page + " of " + pages + " (loved tracks)");
} else {
loved_page_errors++;
}
if (page < pages) {
page++;
sync_library_loved(page);
} else {
loved_working = null;
playcount_working = true;
pages = 0;
r = 1;
sync_library_playcount(1);
}
}

function sync_library_playcount(p) {
if (playcount_working == null) return(fb.trace(script_name + ": Import aborted."));
page = p;
lastfm("&method=library.gettracks&limit=100&user=" + username + "&page=" + page, "foo_playcount_sync", function() { process_library_playcount(); });
}

function process_library_playcount() {
parsed_data = JSON.parse(xmlhttp.responsetext);
if (parsed_data.error > 0) {
playcount_working = null;
fb.ShowPopupMessage("There is a problem with the Last.fm web services. Please try again later.\n\n" + xmlhttp.responsetext, script_name);
return;
}
if (page == 1) { try { pages = parsed_data.tracks["@attr"].totalPages; } catch(e) {} }
if (pages > 0 && xmlhttp.responsetext.indexOf('{"tracks":') == 0) {
for (i = 0; i < parsed_data.tracks.track.length; i++) {
try {
var data = [];
data[0] = parsed_data.tracks.track[i].artist.name;
data[1] = parsed_data.tracks.track[i].name;
data[2] = parsed_data.tracks.track[i].playcount;
if (data[2] == 0) {
page = pages;
break;
}
if (data.length == 3) {
fb.trace(r + ": " + data[0] + " - " + data[1] + " " + data[2]);
url = fb.TitleFormat("$crc32($lower(" + tf(data[0]) + tf(data[1]) + "))").EvalWithMetadb(g_metadb);
sql += 'INSERT OR REPLACE INTO quicktag(url,subsong,fieldname,value) VALUES("' + url + '","-1","LASTFM_PLAYCOUNT_DB","' + data[2] + '");' + "\n";
r++;
}
} catch(e) {
errors++;
}
}
fb.trace("Completed page " + page + " of " + pages + " (playcount)");
} else {
playcount_page_errors++;
}
if (page < pages) {
page++;
sync_library_playcount(page);
} else {
try {
sql += "COMMIT;"
ts = fso.OpenTextFile(sql_file, 2, true, 0);
ts.WriteLine(sql);
ts.close();
import_sql();
} catch(e) {
}
playcount_working = null;
fb.trace("Loved track page errors: " + loved_page_errors + " (200 records are lost for every page that fails.)");
fb.trace("Playcount page errors: " + playcount_page_errors + " (100 records are lost for every page that fails.)");
fb.trace("Individual errors: " + errors);
}
}

function import_sql() {
try {
cmd_file = fso.GetFile(script_path + "lastfm_sql.cmd").ShortPath;
db_file = fso.GetFile(fb.ProfilePath + "customdb_sqlite.db").ShortPath;
WshShell.Run(cmd_file + " " + fso.GetFile(script_path + "sqlite3.exe").ShortPath + " " + db_file + " " + fso.GetFile(sql_file).ShortPath);
} catch(e) {
}
}

function on_mouse_move(x, y) {
buttonsMove(x, y);
}

function on_mouse_lbtn_up(x, y) {
buttonsUp(x, y);
}

function on_mouse_leave() {
buttonsLeave();
}

function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var _li = window.CreatePopupMenu();
var _au = window.CreatePopupMenu();
var _child = window.CreatePopupMenu();
var _auto = window.CreatePopupMenu();
var _icon = window.CreatePopupMenu();
var idx;
_li.AppendMenuItem(utils.CheckComponent("foo_customdb", true) && !loved_working && !playcount_working && g_metadb && username.length > 0 && api_key.length == 32 ? MF_STRING : MF_GRAYED, 4, "Create and import SQL file");
_li.AppendMenuItem(utils.CheckComponent("foo_customdb", true) && fso.FileExists(sql_file) ? MF_STRING : MF_GRAYED, 5, "Import SQL file");
_li.AppendMenuSeparator();
_li.AppendMenuItem(MF_STRING, 7, "Show console");
_li.CheckMenuItem(7, show_console);
_li.AppendTo(_menu, MF_STRING, "Library import");
_au.AppendMenuItem(MF_STRING, 6, "Use Last.fm auto-correct");
_au.AppendMenuItem(MF_STRING, 8, "Only update tracks in library");
_au.CheckMenuItem(6, auto_correct);
_au.CheckMenuItem(8, library);
_au.AppendTo(_menu, MF_STRING, "Auto-updates");
_menu.AppendMenuSeparator();
_auto.AppendMenuItem(MF_STRING, 200, "Off");
_auto.AppendMenuItem(MF_STRING, 201, "On");
_auto.CheckMenuRadioItem(200, 201, auto_love ? 201 : 200);
_auto.AppendMenuSeparator();
_auto.AppendMenuItem(auto_love ? MF_STRING : MF_GRAYED, 202, "Condition");
_auto.AppendTo(_menu, MF_STRING, "Automatically love tracks");
_menu.AppendMenuSeparator();
if (!dui) _child.AppendMenuItem(MF_STRING, 101, "None");
_child.AppendMenuItem(MF_STRING, 102, (dui ? "Default UI " : "Columns UI ") + "default");
_child.AppendMenuItem(MF_STRING, 103, "Splitter");
_child.AppendMenuItem(MF_STRING, 104, "Custom ");
_child.AppendMenuSeparator();
_child.AppendMenuItem(bg == 104 ? MF_STRING : MF_GRAYED, 105, "Set custom colour...");
_child.CheckMenuRadioItem(101, 104, bg);
_child.AppendTo(_menu, MF_STRING, "Background");
_menu.AppendMenuSeparator();
_icon.AppendMenuItem(MF_STRING, 20, "tango");
_icon.AppendMenuItem(MF_STRING, 21, "silk");
_icon.CheckMenuRadioItem(20, 21, icon == "tango" ? 20 : 21);
_icon.AppendTo(_menu, MF_STRING, "Icon");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(username.length > 0 ? MF_STRING : MF_GRAYED, 1, "Visit your Last.fm user profile page");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(!loved_working && !playcount_working ? MF_STRING : MF_GRAYED, 2, "Set your Last.fm username...");
_menu.AppendMenuItem(!loved_working && !playcount_working ? MF_STRING : MF_GRAYED, 3, "Set your API KEY...");
_menu.AppendMenuSeparator();
if (utils.IsKeyPressed(0x10)) _menu.AppendMenuItem(MF_STRING, 9, "Properties");
_menu.AppendMenuItem(MF_STRING, 10, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
case 1:
try {
WshShell.run("http://www.last.fm/user/" + encodeURIComponent(username));
} catch(e) {
MsgBox("Unable to launch your default browser.", 0, script_name);
}
break;
case 2:
set_username();
update_button();
break;
case 3:
set_api_key();
update_button();
break;
case 4:
if (show_console) fb.ShowConsole();
loved_page_errors = 0;
playcount_page_errors = 0;
errors = 0;
pages = 0;
r = 1;
sql = "BEGIN TRANSACTION;\n";
loved_working = true;
sync_library_loved(1);
break;
case 5:
import_sql();
break;
case 6:
auto_correct = !auto_correct;
window.SetProperty("auto_correct", auto_correct);
break;
case 7:
show_console = !show_console;
window.SetProperty("show_console", show_console);
break;
case 8:
library = !library;
window.SetProperty("library", library);
break;
case 20:
case 21:
icon = idx == 20 ? "tango" : "silk";
window.SetProperty("icon", icon);
update_button();
break;
case 101:
case 102:
case 103:
case 104:
bg = idx;
window.SetProperty("bg", bg);
window.Repaint();
break;
case 105:
set_custom_background();
break;
case 200:
case 201:
auto_love = idx == 200 ? false : true;
window.SetProperty("auto_love", auto_love);
break;
case 202:
var new_auto_love_tf = InputBox("The result of the title formatting set here must equal 1 for a track to be automatically loved.\n\nExample:\n\n$ifequal(%rating%,5,1,0)", script_name, auto_love_tf);
auto_love_tf = new_auto_love_tf;
window.SetProperty("auto_love_tf", auto_love_tf);
break;
case 9:
window.ShowProperties();
break;
case 10:
window.ShowConfigure();
break;
}
_menu.Dispose();
_icon.Dispose();
_auto.Dispose();
_li.Dispose();
_au.Dispose();
_child.Dispose();
return true;
}
Title: WSH Panel Mod script discussion/help
Post by: Spanky Monkey on 2015-07-30 14:13:24
Hello marc2003 & everyone,

Last.fm Playcount Sync script recently started crashing on me (regularly) and I haven't found any info on this particular error text - from foobar console:
Code: [Select]
Error: WSH Panel Mod (Playcount Sync by marc2003): Microsoft JScript compilation error:
Syntax error
File: <main>
Ln: 178, Col: 2
<source text only available at compile time>


Not sure if this the correct thread in which I am supposed to post, apologies. Am I doing something stupid? Does anyone have any idea what's causing this error? Thank you. In case of usefulness, I'm posting my entire script code below:



This is the part at line 177:

Code: [Select]
177 function process() {
178    parsed_data = JSON.parse(xmlhttp.responsetext);
179    if (parsed_data.error > 0) {
180        if (parsed_data.error == 6) fb.trace(script_name + ": artist / track not found.");
181        else fb.trace(script_name + ": " + xmlhttp.responsetext);
182        return;
183    }


It looks to me like something has changed in the way JSON is handled, or even the response text.  I'll confess though, that I don't know this stuff well enough (as evident in my own postings) to really add any help.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-31 04:55:33
that's some ancient script right there... i had no clue. JSON.parse falls over when you feed it invalid JSON so you can add a function like this...

Code: [Select]
function json_parse(text) {
    try {
        return JSON.parse(text);
    } catch(e) {
        fb.trace("JSON.parse error: " + text);
        return false;
    }
}


now search the code for the 3 instances of this...

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


and replace it with

Code: [Select]
var parsed_data = json_parse(xmlhttp.responsetext);
if (!parsed_data)
    return; //no need to display any error because the json_parse function has already done that...


this won't make the script work again but it shouldn't crash on errors and least you might get a clue what the problem is by checking the console for the server response.

@Spanky Monkey, if you can provide the images for this button you want, i'll just make it. it'll be easier than explaining.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-07-31 05:24:34
from foo_quicksearch thread:

Works great. 2 questions, if you have time to help:
1. Is there a way to place this button not on tab, but near the menus anywhere? Like the Play, Pause... buttons.
2. How to modify the code, to allways reuse the created autoplaylist? Because, interesting, after every new search it creats a new one, with the same name ("Search").


1) using columns UI, WSH panel mod can be a toolbar. in DUI, it's just a standard panel. it can be style many ways but i'm not going into that.
2) it's not possible to re-use autoplaylists so as a workaround, you can loop through all playlists and delete any matching the same name before creating a new one...

Code: [Select]
var playlist_name = "Search...";

$buttons = {
    search: new SimpleButton(5, 5, 80, 26, "Search", function () {
        var sel = fb.GetFocusItem();
        if (!sel)
            return;
        var i = 0;
        while (i < fb.PlaylistCount) {
            if (fb.GetPlaylistName(i) == playlist_name)
                fb.RemovePlaylist(i);
            else
                i++;
        }
        fb.CreateAutoPlaylist(plman.PlaylistCount, playlist_name, "title HAS " + fb.TitleFormat("$left(%title%,15)").EvalWithMetadb(sel));
        plman.ActivePlaylist = plman.PlaylistCount - 1;
    })
}
Title: WSH Panel Mod script discussion/help
Post by: incifinci on 2015-07-31 21:49:11
Thank you, Marc! It works well.
With the DUI I solved it, with splitting and resizing containers.
Title: WSH Panel Mod script discussion/help
Post by: Saeolus on 2015-08-03 06:46:50
Hi there,
I'm trying to install twnsnd's foo_ncmpcpp skin on foobar2000 1.3.8.
Everything seems to be set up right and I have all of the components but WSH panel mod is giving me a bit of trouble (hence my post here)
Sorry if this sort of issue has been posted before, this was the best result that I found from googling my error.
The error I have is:
Code: [Select]
Components loaded in: 0:00.016024
Configuration read in: 0:00.001925
User Interface initialized in: 0:00.043214
Startup time : 0:00.067918
WSH Panel Mod ({4C938474-B7D5-41AA-BD68-647EDA24A1BE}): initialized in 4 ms
WSH Panel Mod ({1634002F-44F5-4550-AFE5-09796FEAB447}): initialized in 2 ms
Custom bitmap D:\Apps\Program Files\foobar2000\skins\masood_\butns\search-bri_dark.bmp could not be loaded
Error: WSH Panel Mod (Playcount Sync by marc2003): Parsing file "C:\Users\Bjorn\Desktop\foobar2000\scripts\masood_\common.js": Failed to load
Error: WSH Panel Mod (Playcount Sync by marc2003): Parsing file "C:\Users\Bjorn\Desktop\foobar2000\scripts\masood_\tooltip_buttons.js": Failed to load
Error: WSH Panel Mod (Playcount Sync by marc2003): Microsoft JScript runtime error:
'settings_path' is undefined
File: <main>
Ln: 17, Col: 1
<source text only available at compile time>
Thanks for reading, any ideas for helping would be great
PS if it helps I used the portable install of foobar and the directory is right on my desktop
Title: WSH Panel Mod script discussion/help
Post by: Spanky Monkey on 2015-08-03 09:58:48
@Spanky Monkey, if you can provide the images for this button you want, i'll just make it. it'll be easier than explaining.


Marc, I am very grateful for this offer but I really don't want to take up your time in making bespoke custom scripts.
However if you do find you have free time, and do wish to, here is the image set as a zip.
http://www.filedropper.com/buttonsgfx (http://www.filedropper.com/buttonsgfx)
A little readme is included with instructions on how the "stop after current" graphic should be used - but it's fairly obvious (I think) by the naming scheme.

Thanks again
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-03 16:10:29
that file host sucks. it took minutes to load in firefox and even then i couldn't see any link - possibly because i use an adblocker.

@Saeolus, the required files required do not exist.

Quote
Error: WSH Panel Mod (Playcount Sync by marc2003): Parsing file "C:\Users\Bjorn\Desktop\foobar2000\scripts\masood_\common.js": Failed to load


check the paths/instructions again. even if you do sort that out, i'm not even sure it would work being so old.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-03 19:18:06
that file host sucks. it took minutes to load in firefox and even then i couldn't see any link - possibly because i use an adblocker.


using different internet now and i was able to get it immediately. odd as i don't usually have problems with the other internet i was using earlier.

i'll post a script later.
Title: WSH Panel Mod script discussion/help
Post by: incifinci on 2015-08-03 20:40:17
Salut everybody!

I know about WSH, thanks to Marc, but newbie to its javascript, and forgot muuuch of usual javascript (last used it about 6 years ago). I'd like to do a simple (I think) task: to make a scrollable panel, showing the content of COMMENT tag. I started from sample script, and ended here:

Code: [Select]
// {{
// Used in window.GetColorDUI()
ColorTypeDUI = {
    text: 0,
    background: 1,
    highlight: 2,
    selection: 3
};

// Used in window.GetFontDUI()
FontTypeDUI = {
    defaults: 0,
    tabs: 1,
    lists: 2,
    playlists: 3,
    statusbar: 4,
    console: 5
};
//}}

var g_instancetype = window.InstanceType;
var g_font = null;
var g_text = "Create your script\nClick here to open the editor.";
var ww = 0, wh = 0;
var g_textcolor = 0, g_textcolor_hl = 0;
var g_backcolor = 0;
var g_hot = false;

function get_font() {
    if (g_instancetype == 0) { // CUI
        g_font = window.GetFontCUI(FontTypeCUI.items);
    } else if (g_instancetype == 1) { // DUI
        g_font = window.GetFontDUI(FontTypeDUI.defaults);
    } else {
        // None
    }
}
get_font();

function get_colors() {
    if (g_instancetype == 0) { // CUI
        g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
        g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
        g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
    } else if (g_instancetype == 1) { // DUI
        g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
        g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
        g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
    } else {
        // None
    }
}
get_colors();







// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "SimpleFollowCursor"
// @author "T.P Wang"
// ==/PREPROCESSOR==

// This is a helper function, for generating flags in DrawString()/MeasureString()
// args: h_align, v_align, trimming, flags
function StringFormat() {
    var h_align = 0,
        v_align = 0,
        trimming = 0,
        flags = 0;
    switch (arguments.length) {
        // fall-thru
    case 4:
        flags = arguments[3];
    case 3:
        trimming = arguments[2];
    case 2:
        v_align = arguments[1];
    case 1:
        h_align = arguments[0];
        break;
    default:
        return 0;
    }
    return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}

// h_align/v_align:
// http://msdn.microsoft.com/en-us/library/ms534177(VS.85).aspx
StringAlignment = {
    Near: 0,
    Center: 0,
    Far: 2
};

// trimming:
// http://msdn.microsoft.com/en-us/library/ms534403(VS.85).aspx
StringTrimming = {
    None: 0,
    Character: 1,
    Word: 2,
    EllipsisCharacter: 3,
    EllipsisWord: 4,
    EllipsisPath: 5
};

// flags, can be combined of:
// http://msdn.microsoft.com/en-us/library/ms534181(VS.85).aspx
StringFormatFlags = {
    DirectionRightToLeft: 0x00000001,
    DirectionVertical: 0x00000002,
    NoFitBlackBox: 0x00000004,
    DisplayFormatControl: 0x00000020,
    NoFontFallback: 0x00000400,
    MeasureTrailingSpaces: 0x00000800,
    NoWrap: 0x00001000,
    LineLimit: 0x00002000,
    NoClip: 0x00004000
};

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


// APPLICATION - START
g_focus_metadb = fb.GetFocusItem();
g_tfo = fb.TitleFormat("%comment%");
g_font = gdi.Font("Tahoma", 14, 0);
g_stringformat = StringFormat(StringAlignment.Justify, StringAlignment.Justify);

// Key point

function on_item_focus_change() {
    g_focus_metadb = fb.GetFocusItem();
    var info = g_focus_metadb.GetFileInfo();
    window.Repaint();
}

function on_paint(gr) {
    // Draw info
    if (g_focus_metadb) {
        gr.FillSolidRect(0, 0, window.Width, window.Height, g_backcolor);
        gr.SetSmoothingMode(4);
        gr.SetInterpolationMode(7);
        gr.DrawString(g_tfo.EvalWithMetadb(g_focus_metadb), g_font, RGB(0, 0, 0), 0, 0, window.Width, window.Height, g_stringformat);
    }
}
// APPLICATION - END


2 not resolved problems:
1. The panel is not scrollable.
2. After some event, script does an error, and I must restart it every time (configure > OK). Sorry, couldn't find a cause, console overwrote the error message since the last one, and now I can not reproduce it (as usual situation...) - despite, that it happens very often. I think, something like removing actual playlist, or song. But I think, for JS specialist it's easy to find out the error nature.

I would be grateful for any help.

off
By the way, why this forum engine has no closable boxes? I mean, on the click it scrolls up, to 1 line, on the next click it opens again to full length. It will be very usful for better viewing the page. Or, as variant, fixed heigth, scrollable box (overflow:auto).
Title: WSH Panel Mod script discussion/help
Post by: incifinci on 2015-08-04 00:05:05
I catched the error message. Here is my translation from hungarian, so it's not exactly the same, as the english variant.

Code: [Select]
Error: WSH Panel Mod (SimpleFollowCursor by T.P Wang): Microsoft JScript runtime error:
'g_focus_metadb' value is NULL, or is not an object.
File: <main>
Ln: 157, Col: 5


This happend after erasing (but not removing) a simple playlist.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-04 08:12:34
@marc
I recently updated to windows 10 and in your now playing script (which i added rating and similar artists and couple of buttons)
i'm getting this error but it worked without any errors in windows 8.1

WSH Panel Mod (Thumbs): Microsoft JScript runtime error:
Out of stack space
File: F:\Desktop\foobar2000\marc2003\common8.js
Line: 1166, Col: 3
<source text only available at compile time>

any idea what caused this ??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-04 18:49:53
@Spanky Monkey, my button scripts only support normal and hover states which is ok for your SAC button but you won't be able to add buttons with down states unless you hack it.

extract this zip into your foobar profile folder.

https://dl.dropboxusercontent.com/u/22801321/wsh2015.zip (https://dl.dropboxusercontent.com/u/22801321/wsh2015.zip) <<there are a few other basic scripts inside for album art, seekbar, volume, playback buttons and rating.

then place this script inside a panel. modify the folder path if you need to.

Code: [Select]
// ==PREPROCESSOR==
// @name "SAC Button"
// @author "marc2003"
// @import "%fb2k_profile_path%wsh_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\helpers.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\panel.js"
// ==/PREPROCESSOR==

folders.images = fb.ProfilePath + "buttons_gfx\\";

var panel = new _.panel("SAC Button", ["custom_background"]);
var buttons = new _.buttons();

buttons.update = function () {
if (fb.StopAfterCurrent)
//if the hover image is the same as the normal, you can just leave it out
this.buttons.sac = new _.button(0, 0, 36, 36, {normal : "SACon_n_36.png"}, function () { fb.StopAfterCurrent = !fb.StopAfterCurrent; }, "Disable Stop After Current");
else
this.buttons.sac = new _.button(0, 0, 36, 36, {normal : "SACoff_n_36.png", hover : "SACoff_h_36.png"}, function () { fb.StopAfterCurrent = !fb.StopAfterCurrent; }, "Enable Stop After Current");
window.RepaintRect(this.buttons.sac.x, this.buttons.sac.y, this.buttons.sac.w, this.buttons.sac.h);
}

function on_playlist_stop_after_current_changed() {
buttons.update();
}

function on_size() {
panel.size();
buttons.update();
}

function on_paint(gr) {
panel.paint(gr);
buttons.paint(gr);
}

function on_mouse_move(x, y) {
buttons.move(x, y);
}

function on_mouse_leave() {
buttons.leave();
}

function on_mouse_lbtn_up(x, y) {
buttons.lbtn_up(x, y);
}

function on_mouse_rbtn_up(x, y) {
return panel.rbtn_up(x, y);
}

@incifinci, use [codebox ] tags instead of [code ]

as for your script error, just delete this as it's not even used.

Code: [Select]
var info = g_focus_metadb.GetFileInfo();

and you might as well use foo_textdisplay (DUI) for displaying file tags or item details (CUI - it's built in)

@samithaj,

looking at the code on line 1166 might be a start. you should know better by now....

does my unmodified script also crash? if so, tough... i can't do anything to troubleshoot as i don't have my own computer. if it's your mods, then you fix it...

you can always put the code inside try/catch like this

Code: [Select]
try {
//some dodgy code
} catch(e) {
//something went wrong but at least the script didn't crash
}
Title: WSH Panel Mod script discussion/help
Post by: Spanky Monkey on 2015-08-04 22:00:53
@Spanky Monkey, my button scripts only support normal and hover states which is ok for your SAC button but you won't be able to add buttons with down states unless you hack it.

extract this zip into your foobar profile folder.

https://dl.dropboxusercontent.com/u/22801321/wsh2015.zip (https://dl.dropboxusercontent.com/u/22801321/wsh2015.zip) <<there are a few other basic scripts inside for album art, seekbar, volume, playback buttons and rating.

then place this script inside a panel. modify the folder path if you need to.


Thanks ever so much for looking into this.  I apologise for the dropbox link.  Dropbox used be more solid, but lately it's been temperamental, and the ad doesn't instil much confidence for the person clicking the link.  I used that hosting because it allows for 30 days until expiry, I should take a look for something better that doesn't require singing up.

That script works fine as it's own panel.  I initially had an error come up regarding line 36 in the helper.js (all the activeX stuff), which I just commented out to make it behave.
I can see that it would be nightmarish to try and integrate the two scripts together into just one panel (one can't just treat it like German nouns and ram them together to make a new word "Hand" + "Schuh" = "Handschuh" otherwise known as a glove to English speakers).

Actually, because of the inability to get the 'down' state to work, it's very similar, albeit a better way to do it, than when I mashed a little of Delphi's script in and just used the hover graphic for the button.  So the graphic for the on/off state is being made in window.repaint() - which is probably incorrect to do, whilst the hover outer border is being drawn by buttons.js script.  However, your script gives a nice tool tip as well, which couldn't be done the way I was ham-fistedly going at it.
This'll do just fine and I can modify the script to facilitate indicators of other things (playback mode etc).

Thanks again Marc, that's helpful stuff and I can take a good look at the other scripts knocking around in there too.
All the best.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-04 23:30:06
looking at the code on line 1166 might be a start. you should know better by now....


Actually i looked at 1166 line(I didn't make changes to common8.js file)
It's on
panel.rbtn_up

Code: [Select]
this.is_stream = function() {
        //support m-TAGS (foo_tags.dll)
        var path = tf("$if2(%__@%,%path%)", this.metadb);   // 1166 line
        switch(true) {
            case path.indexOf("http") == 0:
            case path.indexOf("mms") == 0:
                return true;
            default:
                return false;
        }
    }


I don't think p.rbtn_up even get called(In my knowledge, since this is part of a huge code i don't understand ). I got this error by just changing the tracks

But your unmodified script doesn't crash.

I guess i have have to clean up my own mess
I'll try with putting try catch blocks
thanks marc!

BTW

your new scripts are working well ,Thank you for this marc!!!
except for the ones in extras folder, i think couple of js files are missing
Nice work including lodash.min.js , I guess this improves efficiency

edit: putting try catch blocks  to all p.rbtn_up stopped the crashing
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-04 23:30:39
That script works fine as it's own panel.  I initially had an error come up regarding line 36 in the helper.js (all the activeX stuff), which I just commented out to make it behave.


i should have mentioned you need to disable safe mode (file>preferences>tools>wsh panel mod)

edit: readme inside zip file has now been updated.
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-08-05 03:34:20
Now, I'm using WSH Panel Mod to toggle one of my panels.
When the toggle is 'on', the panel width=349
and
when the toggle is 'off'', the panel width =1.

Code: [Select]
var COLOR_BTNFACE = 15;
var toggle = window.GetProperty("toggle", false);
var ww = 0, wh = 0;
var COLOR_BTNFACE = 15;
var g_syscolor = 0;

function get_colors() {
    g_syscolor = utils.GetSysColor(COLOR_BTNFACE);
}
get_colors();

// START
function on_size() {
    ww = window.Width;
    wh = window.Height;
    if(toggle) {
        window.MinWidth = 349;
        window.MaxWidth = 349;
    } else {
        window.MinWidth = 1;
        window.MaxWidth = 1;
    };
    window.MinHeight = 4;
    window.MaxHeight = 4;
}

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, g_syscolor);
}

function on_mouse_lbtn_up(x, y) {
    toggle = !toggle;
    window.SetProperty("toggle", toggle);
    if(toggle) {
        window.MinWidth = 349;
        window.MaxWidth = 349;
    } else {
        window.MinWidth = 1;
        window.MaxWidth = 1;
    };
}

function on_colors_changed() {
    get_colors();
    window.Repaint();
}

function on_notify_data(name, info) {
    switch(name) {
        case "center_pane":
            toggle = !toggle;
            window.SetProperty("toggle", toggle);
            if(toggle) {
                window.MinWidth = 349;
                window.MaxWidth = 349;
            } else {
                window.MinWidth = 1;
                window.MaxWidth = 1;
            };
            break;
    }
}

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


From this code, I can't reduce the panel size to "0".
It looks like that "window.MinWidth = 0" doesn't work.
Is there any method to make the panel disappear completely when the toggle is 'off"?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-05 07:40:18
Quote
It looks like that "window.MinWidth = 0" doesn't work.


yup, just tried that myself. there's nothing you can do about that. if using columns UI, you can show/hide panels with panel stack splitter.
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-09 02:46:52
Hello, marc2003. I've just tried to send you a private message, but it seems you disabled them.
So, I've started customizing my foobar2k and it seems that most of the WSH scripts were made by you. Unfortunately, all the links are already dead. I would appreciate it, if you could share your scripts. Especially Playcount Sync and Bio/Art viewer.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-10 09:33:53
sorry but i'm no longer sharing any scripts that access online services. there might be some old versions lurking around as part of people's themes on deviantart.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-12 17:08:17
i'm know i'm going to regret this (  ) but i've put most of my scripts back online here: https://github.com/19379/wsh_marc2003 (https://github.com/19379/wsh_marc2003)

pay special attention to the readme, especially this last part...

Quote
I'm not taking feature requests and I'm not restoring any scripts or features missing from previous packages. Genuine bugs can be reported here:

https://github.com/19379/wsh_marc2003/issues (https://github.com/19379/wsh_marc2003/issues)


most notably, playcount sync and thumbs are missing because they were the biggest headaches... and people who already have working scripts don't really need this. it's more for people who missed out before.

edit: i forgot to include a required font inside the zip so it has been updated.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-12 17:18:37
Quote
I'm not taking feature requests and I'm not restoring any scripts or features missing from previous packages.


Wisdom 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-12 17:27:08
^how is your JSbrowser coming along? i did see your preview on DA but it seems you've been on holiday or something?

Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-12 17:28:57
Yay! Thank you so much!

Also I've managed to get Playcount script from one of the fb2k themes. I've changed the API key and the secret and it works just fine. Autolove feature is great.
But if you don't mind could you help me with one little thing? Is it possible to unlove a track when I change its rating from 5 to 1-4? Pretty please. And I will never ask you about playcount sync again. :3
P.S. I have common8.js version.
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-13 01:42:27
Ok, I added additional IF statements in two places:

Code: [Select]
if (this.time_elapsed == 3 && this.auto_love && tfe(this.auto_love_tf) == 0 && this.old_userloved == 1) {
            p.console("Automatically unloving this track....");
            this.love_track();
}

and
Code: [Select]
if (this.auto_love && tfe(this.auto_love_tf) == 0 && this.old_userloved == 1 && this.auto_love_count == 1) {
            this.auto_love_count = 0;
            p.console("Automatically unloving this track....");
            this.love_track();
}

So, the tracks are loved/unloved based on rating and console doesn't show any errors. I've also recreated customdb_sqlite.db to check if the records are deleted when I unlove the tracks - everything is fine. Now I'm happy. :)
But please, let me know if there are any errors.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-13 02:25:47
i don't think the 2nd snippet will run because you're checking that this.auto_love_count == 1 but its value is 0 when a new track begins. i think i put it in to prevent multiple requests by people messing with their ratings but now you're using your own last.fm API KEY, you can just remove it.

Code: [Select]
if (this.auto_love && tfe(this.auto_love_tf) == 0 && this.old_userloved == 1) {
            p.console("Automatically unloving this track....");
            this.love_track();
}
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-13 03:13:57
Thank you! Yes, it seems without this.auto_love_count the code runs 2 times in a row. I mean with this.auto_love_count console shows this on love/unlove a song:
Code: [Select]
Last.fm Playcount Sync: Automatically loving this track.... 
Last.fm Playcount Sync: Attempting to love "Naval" by "Yann Tiersen"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Track loved successfully.
Last.fm Playcount Sync: Automatically unloving this track....
Last.fm Playcount Sync: Attempting to unlove "Naval" by "Yann Tiersen"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Track unloved successfully.
[/size]
But with your code (without this.auto_love_count) it shows this:
Code: [Select]
Last.fm Playcount Sync: Automatically loving this track.... 
Last.fm Playcount Sync: Attempting to love "Naval" by "Yann Tiersen"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Track loved successfully.
Last.fm Playcount Sync: Automatically loving this track....
Last.fm Playcount Sync: Attempting to love "Naval" by "Yann Tiersen"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Track loved successfully.
Last.fm Playcount Sync: Automatically unloving this track....
Last.fm Playcount Sync: Attempting to unlove "Naval" by "Yann Tiersen"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Track unloved successfully.
Last.fm Playcount Sync: Automatically unloving this track....
Last.fm Playcount Sync: Attempting to unlove "Naval" by "Yann Tiersen"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Track unloved successfully.
[/size]
Although I don't quite understand why we need it. ¯\_(ツ)_/¯
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-13 03:45:58
i guess that's the real reason i kept track of the number of attempts. it'll need restoring...

Code: [Select]
    this.playback_edited = function() {
        if (!this.auto_love || this.auto_love_count == 1)
            return;
        this.auto_love_count = 1;
        if (tfe(this.auto_love_tf) == 1 && this.old_userloved == 0) {
            p.console("Automatically loving this track....");
            this.love_track();
        } else if (tfe(this.auto_love_tf) == 0 && this.old_userloved == 1) {
            p.console("Automatically unloving this track....");
            this.love_track();
        }
    }


i didn't even test what i posted previously because i don't have this feature in my own scripts.
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-13 12:28:15
Auto unloving doesn't work with this code. I think you've also made other changes in common8.js. But whatever, I'll just stick with 2 snippets I've posted above, because everything works fine with them.

Thank you for your awesome scripts!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-13 13:07:19
it should have worked but... whatever. the whole point of that last change was to prevent it running more than once to prevent the double server requests. this also means you can't rate something to 5 (and have the love action trigger) and then unrate it immediately expecting the unlove action to work because it won't. that shouldn't be an issue under normal usage but might not be desirable when testing.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-13 15:12:03
i've noticed that last.fm are edging closer to making their beta site go live which will break my last.fm bio script. if they were to flip the switch right now and my script checked a file that was more than a day old, the good data would be wiped which isn't too clever. this version disables checking for updates when existing data already exists.

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

just extracting the wsh_marc2003 folder while foobar is closed should be good enough.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-13 15:15:18
i'm know i'm going to regret this (  ) but i've put most of my scripts back online here: https://github.com/19379/wsh_marc2003 (https://github.com/19379/wsh_marc2003)

So nice to you provide your scripts back again  really appreciate  the decision
and no issues for me so far
and artist recommendations script is really handy addition indeed 

Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-13 16:02:35
marc2003, so, playcount sync will stop working too? That's a shame. I haven't had enough time to enjoy it. ~_~

Btw, I've captured the video where I'm testing different code snippets: https://my.mixtape.moe/binfgr.webm (https://my.mixtape.moe/binfgr.webm)
Maybe someone modified common8.js before me and that's why your snippets don't work as expected. Or maybe I've placed them in a wrong part of the code, lol.
EDIT: Forgot to remove the second instance of this.auto_love_count in the first video. Here is a video of double loving/unloving: https://my.mixtape.moe/mtuowd.webm (https://my.mixtape.moe/mtuowd.webm)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-13 16:09:05
no, playcount sync will continue to work. it's just the bio script that will stop. i could probably make it work with the beta right now but i'm not doing anything until it goes final.

for people who have old copies of my thumbs script kicking around, that will also stop working when the new site goes live.
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-13 18:17:15
Ok, cool. Too bad that Thumbs will stop working. I use it in combination with Biography script. Actually, every other theme contains this script, because foo_uie_biography doesn't show more than 1 image, and the biography text is truncated to 300 characters.
Any chance you will bring it back? For example, without your own API key and via the super-secret password protected link. :]
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-15 03:06:39
just posting to say last.fm are currently in the process of breaking their API...hopefully just temporarily 

artist top tags / artist top tracks (api key is fine on other feeds)
Code: [Select]
{"error":{"code":10,"message":"Invalid API key - You must be granted a valid key by last.fm"}}


artist top albums
Code: [Select]
{"error":{"code":3,"message":"Invalid Method - No method with that name in this package"}}


i'm also seeing playcount discrepancies between library.gettracks (used by playcount sync import) and track.getinfo (used when updating playcounts during playback).
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-15 05:51:58
https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

Quote
Last.fm Bio: Should now handle the switch to the new Last.fm website when it goes live.
User Recommendations: Fix overlapping text on narrow panels.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-15 15:32:57
first preview of a new playlist script started yesterday, it will rock!

video here: youtu.be/xbFD2XpmYDA (http://youtu.be/xbFD2XpmYDA)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-15 15:35:57
it *might* rock if we could see it. it's currently private...
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-15 15:38:23
oops, fixed
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-15 15:47:07
no album art in the group headers... i guess that slows it down??
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-15 15:47:25
WOW!!! Smoother than a fresh jar of Skippy
BTW any release date on JSBrowser ??
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-15 15:50:26
no album art in the group headers... i guess that slows it down??


not added yet but it shouldn't, the main thing that was blocking me to use a such scroll engine is now fixed and is faster to populate and to evaluate than ever, all the rest to do is peanut compared to this point ...
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-16 15:05:15
WIP updated, covert art added

https://youtu.be/hVojcYyIpPI (https://youtu.be/hVojcYyIpPI)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-16 15:20:56
nice. 

will it include the new edit menu undo/redo function i included in WSH panel mod 1.5.10? you basically call plman.UndoBackup(playlistIndex) before adding/removing/re-ordering playlists with other plman methods. i can post more details if you need it. if you do this, you can create ctrl+z (undo) and ctrl+y (redo) keyboard shortcuts.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-16 15:22:22
nice. 

will it include the new edit menu undo/redo function i included in WSH panel mod 1.5.10? you basically call plman.UndoBackup(playlistIndex) before adding/removing/re-ordering playlists with other plman methods. i can post more details if you need it.


why not
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-16 15:50:16
you probably don't need it but i've put my changes up here.

https://github.com/19379/jsplaylist-mod/com...106320447a58a72 (https://github.com/19379/jsplaylist-mod/commit/b86b8e0fca294adfb1819a4cf106320447a58a72)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-16 16:33:31
may be helpful (sometime i'm lazy)

thanks
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-16 16:55:07
Is it possible to add shortcut to get back to last activated playlist (like a back button)
Title: WSH Panel Mod script discussion/help
Post by: ZarkBit on 2015-08-16 18:32:55
first preview of a new playlist script started yesterday, it will rock!

video here: youtu.be/xbFD2XpmYDA (http://youtu.be/xbFD2XpmYDA)


wow, checked that WSH script, pretty awesome, loving it so far!
Title: WSH Panel Mod script discussion/help
Post by: ZarkBit on 2015-08-16 19:42:44
since I couldn't edit my previously post, had to reply...

Anyone knows what might be causing this?
(http://s19.postimg.org/odqdrwisj/foobar2000.png)

Windows 7 x64
Foobar2000 v1.3.8
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-16 20:11:47
@ZarkBit

as discribed in its homepage : JSPlaylist @deviantart (http://br3tt.deviantart.com/art/JSPlaylist-509803158)

...
[Requirements]
* foobar2000 v1.1 or better >> www.foobar2000.org
* WSH panel Mod v1.5.6 or better >> code.google.com/p/foo-wsh-pane…
* Windows fonts : WingDings 1, 2 & 3
[/Requirements]

[Options]
* Font guifx v2 transports >> blog.guifx.com/2009/04/02/guif…
[/Options]
...

HTH
Title: WSH Panel Mod script discussion/help
Post by: ZarkBit on 2015-08-16 21:48:30
thx, didn't notice that. Solved.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-17 15:43:59
well the old last.fm website has gone. common7/8 script users will find last.fm bio and thumbs no longer work no longer update. of course they will continue to display all previously cached data.

other stuff like similar artists, charts, playcount sync all use the API so should continue to work as they did before.
Title: WSH Panel Mod script discussion/help
Post by: venyxal on 2015-08-17 21:36:42
Hi Marc,
A small question.
Is it possible that last.fm bio and thumbs script rewrite for theaudiodb.com?

best regards
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-17 22:07:37
Hi Marc,
A small question.
Is it possible that last.fm bio and thumbs script rewrite for theaudiodb.com?

best regards


If you have marc2003 common8.js this works for bio from theaudiodb.com.

http://www.hydrogenaud.io/forums/index.php...st&p=886367 (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=886367)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-18 01:00:18
but.... theaudiodb sucks. 
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-18 04:07:55
i've updated the user recommendations part of my last.fm script so it's more suitable for narrow panels. it also supports the new last.fm website format for artist bios.

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-18 12:45:49
i've updated the user recommendations part of my last.fm script so it's more suitable for narrow panels. it also supports the new last.fm website format for artist bios.

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)


Why you don't want to update Thumbs, just change one line:

Code: [Select]
for (i = 0; i < data.length; i++) {
                        if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/60x60/") == 0) urls.push(data[i].src.replace("60x60", size == "low" ? "252x252" : size == "medium" ? "500x500" : size == "high" ? "_" : "_"));
                    }
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-18 12:47:51
Local last.fm sites don't work in the new Biography script.


mire777, I'm gonna check it. ( ͡° ͜ʖ ͡°)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-18 12:59:16
i fixed the last.fm local sites issue some hours ago (https://github.com/19379/wsh_marc2003/commit/6177015f4c365c13587589dab01aea60166aed9b#diff-489c7053f5014af3644c75f614c67b78)... it just hasn't been put up as a full zip yet. 
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-18 13:21:53
marc2003, just changed those lines and it works fine. Thank you.

mire777, yep, the code works, but it downloads images "as is" - without file extensions.
(http://armarium.org/u/2015/08/18/73208c20fb3bbe8a884c3ba19865ab9e.png)

Or we can add ".jpg" and then all images will be .jpg files. :]
Code: [Select]
p.run_cmd(this.vbs + " " + url + " " + file + ".jpg", false);
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-18 15:44:19
marc2003, just changed those lines and it works fine. Thank you.

mire777, yep, the code works, but it downloads images "as is" - without file extensions.
(http://armarium.org/u/2015/08/18/73208c20fb3bbe8a884c3ba19865ab9e.png)

Or we can add ".jpg" and then all images will be .jpg files. :]
Code: [Select]
p.run_cmd(this.vbs + " " + url + " " + file + ".jpg", false);


Don't know how this is in Marc script because i changed this line, yes just add ''.jpg'' and should be fine..
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-18 16:37:04
but.... theaudiodb sucks. 

People get what they asked for...

BTW Nice to see you back with a new set of scripts.
(I see my lodash.js recommendation got to good use)

Why are issues posted here and not at github issue?
It would be better to monitor there.

As for releases you could point users to the latest master zip, since you dont have a development branch.
Cheers.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-18 16:52:54
I just noticed this awesome feature
Quote
Properties now splits multi-value tags so each one is clickable to create autoplaylists

I tried to do that some time ago then i relisted how hard is to make some text clickable in WSH panels and gave up

Can you please consider adding autoplaylists links feature in your Artist info panel 
It's too good feature to ditch
Title: WSH Panel Mod script discussion/help
Post by: seriousstas on 2015-08-19 02:21:20
Please help with :
Quote
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common8.js"
// @name "Now Playing"
// @author "marc2003"

Maybe is hoped update it?
Title: WSH Panel Mod script discussion/help
Post by: seriousstas on 2015-08-19 08:13:11
(http://rghost.ru/7ZplXcWwv/image.png) (http://rghost.ru/7ZplXcWwv.view)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-19 10:53:42
Can you please consider adding autoplaylists links feature in your Artist info panel 
It's too good feature to ditch


*cough*

Quote
I'm not taking feature requests and I'm not restoring any scripts or features missing from previous packages.




@seriousstas, i have no idea what would cause that error. besides, i'm not supporting older scripts.
Title: WSH Panel Mod script discussion/help
Post by: seriousstas on 2015-08-19 14:58:31
@seriousstas, i have no idea what would cause that error. besides, i'm not supporting older scripts.

Error - if choose Lastfm.ru BIO, but also stopped loading images from any server 
Can you recommend some alternative for loading pictures Artists?
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-20 09:27:16
Error - if choose Lastfm.ru BIO, but also stopped loading images from any server 
Can you recommend some alternative for loading pictures Artists?


For images, edit script like this:

Code: [Select]
for (i = 0; i < data.length; i++) {
                        if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/60x60/") == 0) urls.push(data[i].src.replace("60x60", size == "low" ? "252x252" : size == "medium" ? "500x500" : size == "high" ? "_" : "_"));
                    }
        for (i = 0; i < Math.min(urls.length, th.limit, 5); i++) {
            url = urls[i];
            file = "\"" + f + p.artist.validate() + "_" + url.substring(url.lastIndexOf("/") + 1) + "\"";
            p.run_cmd(this.vbs + " " + url + " " + file + ".jpg", false);
        }
        doc.close();
    }


''low'', ''medium'', high'' - can be different in Marc script , so leave this unchanged..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-20 09:34:43
''low'', ''medium'', high''


i presume you've picked these values out of your rectum?? they're not even remotely close to anything i've ever put in my scripts.
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-08-20 10:29:47
I'm using "JSPlaylist v1.3.2 for my foobar.

When I'm listening to the streaming radio, it shows "stream.png".
I'd like to change "stream.png" according to the radio stations.

For example,
when I'm listening to "Linn" radio stations, I'd like to use "linn.png".
(Linn Radio Address : http://89.16.185.174:8000/stream) (http://89.16.185.174:8000/stream))

Please, give me some hints.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-20 11:17:02
''low'', ''medium'', high''


i presume you've picked these values out of your rectum?? they're not even remotely close to anything i've ever put in my scripts.


Why these values must be the same in my scripts as in yours?
I don't even have old scripts, i lost all my scripts and foobar settings.
You don't support your old scripts? So i was thought that i should help, or you think that i don't?
Surely I have better things to do than to waste my time..
I will not try to help anyone anymore in this thread..
This is your thread, and i'm glad that you come back with new scripts...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-20 15:23:24
you posting snippets from modified scripts isn't going to work for anyone using my old scripts. surely you must realise that. :/
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-20 15:45:55
you posting snippets from modified scripts isn't going to work for anyone using my old scripts. surely you must realise that. :/


Ok
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-20 15:50:42
if you wanted to help, why not post the whole thing as a package? just use a different folder so it doesn't overwrite what people already have.

edit: ah bugger it, i've tried fixing up common8.js to get the new bio and images since the last.fm site change. because i don't keep old copies, i took this from a theme on deviantart and assume it wasn't modded. i haven't checked or tested any of my changes either...

https://gist.github.com/19379/4fd97632dd3defa366e0 (https://gist.github.com/19379/4fd97632dd3defa366e0)
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-20 17:56:03
if you wanted to help, why not post the whole thing as a package? just use a different folder so it doesn't overwrite what people already have.

edit: ah bugger it, i've tried fixing up common8.js to get the new bio and images since the last.fm site change. because i don't keep old copies, i took this from a theme on deviantart and assume it wasn't modded. i haven't checked or tested any of my changes either...

https://gist.github.com/19379/4fd97632dd3defa366e0 (https://gist.github.com/19379/4fd97632dd3defa366e0)


I lost all scripts, even those I've worked on..
I pulled this from mediafire backup, if someone wants, this is old common8.js with thumbs, it saves images in folder ''Artist_Info'', so it wont mess with marc2003 folder.

https://gist.github.com/mire777/5463968b477b753e6d96 (https://gist.github.com/mire777/5463968b477b753e6d96)

EDIT:  I forget , there should be this file in foobar folder also: https://gist.github.com/mire777/a1b391ff4426039d704b (https://gist.github.com/mire777/a1b391ff4426039d704b)

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-08-20 18:15:11
new video preview of my new script (wor in progress)

https://youtu.be/iiTpdzN-MDo (https://youtu.be/iiTpdzN-MDo)

scrollbar added in JSPlaylist "Smoothie"
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-08-21 00:07:32
i'm know i'm going to regret this ( crying.gif ) but i've put most of my scripts back online here: https://github.com/19379/wsh_marc2003 (https://github.com/19379/wsh_marc2003)


I know I won't regret it one bit. Thanks

Musicbrainz doesn't seem to be fetching anything though. The old script still does. Any ideas?
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-21 01:54:21
blaxima, "Musicbrainz now requires a musicbrainz artist id tag in your files. It no longer performs artist lookups if it's missing".


And I have a question about Small Web Links. Is it possible to show only necessary icons/links?
Title: WSH Panel Mod script discussion/help
Post by: blaxima on 2015-08-21 06:04:55
blaxima, "Musicbrainz now requires a musicbrainz artist id tag in your files. It no longer performs artist lookups if it's missing".


And I have a question about Small Web Links. Is it possible to show only necessary icons/links?


Careless of me, I only read the last.fm stuff thinking that was the only real change. Thank you for pointing that out.

Too bad though since foo_musicbrainz requires the entire album to work
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-21 11:44:36
edit: ah bugger it, i've tried fixing up common8.js to get the new bio and images since the last.fm site change. because i don't keep old copies, i took this from a theme on deviantart and assume it wasn't modded. i haven't checked or tested any of my changes either...

https://gist.github.com/19379/4fd97632dd3defa366e0 (https://gist.github.com/19379/4fd97632dd3defa366e0)


this link is dead now because i just tried testing it and it didn't work. i can't be bothered to figure out why.
Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2015-08-21 13:32:08
Can anyone help me fixing marc2003's Last.fm playcount sync script?

When trying to do a library import, only loved tracks are updated. Updating of play counts fails with the message

Code: [Select]
Last.fm Playcount Sync: {"error":3,"message":"Invalid Method - No method with that name in this package"}


Thanks!
Title: WSH Panel Mod script discussion/help
Post by: seriousstas on 2015-08-21 16:27:58
Error - if choose Lastfm.ru BIO, but also stopped loading images from any server 
Can you recommend some alternative for loading pictures Artists?


For images, edit script like this:

Code: [Select]
for (i = 0; i < data.length; i++) {
                        if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/60x60/") == 0) urls.push(data[i].src.replace("60x60", size == "low" ? "252x252" : size == "medium" ? "500x500" : size == "high" ? "_" : "_"));
                    }
        for (i = 0; i < Math.min(urls.length, th.limit, 5); i++) {
            url = urls[i];
            file = "\"" + f + p.artist.validate() + "_" + url.substring(url.lastIndexOf("/") + 1) + "\"";
            p.run_cmd(this.vbs + " " + url + " " + file + ".jpg", false);
        }
        doc.close();
    }


''low'', ''medium'', high'' - can be different in Marc script , so leave this unchanged..

Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-22 14:39:38
Can anyone help me fixing marc2003's Last.fm playcount sync script?


the last.fm API is amazingly broken at the moment so there is nothing i or anyone else can do about it.
Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2015-08-22 17:16:57
the last.fm API is amazingly broken at the moment so there is nothing i or anyone else can do about it.

Thanks for taking the time to reply!

So I take it there's hope the script will be working once against after the "temporary service disruptions" associated with the new site launch have passed.

EDIT: Moreover, it's great that you've decided to put your scripts back online for the time being
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-23 13:29:38
I'm using "JSPlaylist v1.3.2 for my foobar.

When I'm listening to the streaming radio, it shows "stream.png".
I'd like to change "stream.png" according to the radio stations.

For example,
when I'm listening to "Linn" radio stations, I'd like to use "linn.png".
(Linn Radio Address : http://89.16.185.174:8000/stream) (http://89.16.185.174:8000/stream))

Please, give me some hints.

To use stream logo's as artwork here is how I got it setup.

Create a folder stream-logo and rename the logo according to $crc32($lower(%path%))

e.g For http://89.16.185.174:8000/stream (http://89.16.185.174:8000/stream) the filename is 2315402056.png

(http://i.imgur.com/63dMy6h.jpg)

Setup Preferences > Display as below

(http://i.imgur.com/buaRnE5.jpg)


For jsPlaylist to show the logo as the cover modify the script lines 708-722 as below.
Code: [Select]
//      if(track_type!=3) {
            if(metadb) {
                img = FormatCover(image, pw, ph, cover.draw_glass_reflect, false);
                if(!img) {
                    //img = (cGroup.type == 1) ? images.noartist : images.nocover;
                    img = null;
                    cover.type = 0;
                }; else {
                    cover.type = 1;
                };
            };
//      }; else {
//          img = images.stream;
//            cover.type = 3;
//        };
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-08-23 19:14:47
zeremy, how do you get 2315402056 from http://89.16.185.174:8000/stream (http://89.16.185.174:8000/stream)?
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-23 19:56:54
zeremy, how do you get 2315402056 from http://89.16.185.174:8000/stream (http://89.16.185.174:8000/stream)?

You can use any online hash conveter e.g http://aruljohn.com/hash.php (http://aruljohn.com/hash.php)

or this script to display it in window/console on playback.

Code: [Select]
// ==PREPROCESSOR==
// @name "crc32 path"
// @author "zeremy"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

// Use with GdiDrawText()
// {{
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
// }}

// {{
// Used in window.GetColorCUI()
ColorTypeCUI = {
    text: 0,
    selection_text: 1,
    inactive_selection_text: 2,
    background: 3,
    selection_background: 4,
    inactive_selection_background: 5,
    active_item_frame: 6
};

// Used in window.GetFontCUI()
FontTypeCUI = {
    items: 0,
    labels: 1
};

// Used in window.GetColorDUI()
ColorTypeDUI = {
    text: 0,
    background: 1,
    highlight: 2,
    selection: 3
};

// Used in window.GetFontDUI()
FontTypeDUI = {
    defaults: 0,
    tabs: 1,
    lists: 2,
    playlists: 3,
    statusbar: 4,
    console: 5
};
//}}

//{{
// Used in window.SetCursor()
var IDC_HAND = 32649;
//}}

var g_instancetype = window.InstanceType;
var g_font = null;
stream_id = "";
var ww = 0, wh = 0;
var g_textcolor = 0, g_textcolor_hl = 0;
var g_backcolor = 0;
var g_hot = false;

function get_font() {
    if (g_instancetype == 0) { // CUI
        g_font = window.GetFontCUI(FontTypeCUI.items);
    } else if (g_instancetype == 1) { // DUI
        g_font = window.GetFontDUI(FontTypeDUI.defaults);
    } else {
        // None
    }
}
get_font();

function get_colors() {
    if (g_instancetype == 0) { // CUI
        g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
        g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
        g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
    } else if (g_instancetype == 1) { // DUI
        g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
        g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
        g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
    } else {
        // None
    }
}
get_colors();

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

function on_paint(gr) {
    var text_color = g_hot ? g_textcolor_hl : g_textcolor;
    gr.GdiDrawText(stream_id, g_font, text_color, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
}

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

function on_mouse_move() {
    if (!g_hot) {
        window.SetCursor(IDC_HAND);
        g_hot = true;
        window.Repaint();
    }
}

function on_mouse_leave() {
    if (g_hot) {
        g_hot = false;
        window.Repaint();
    }
}

function on_font_changed() {
    get_font();
    window.Repaint();
}

function on_colors_changed() {
    get_colors();
    window.Repaint();
}




function get_stream_id(){
        metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
        stream_id = fb.TitleFormat("$crc32($lower(%path%))").EvalWithMetadb(metadb);
        fb.trace(stream_id);
    }
   
function on_playback_new_track(){
    get_stream_id();
    window.Repaint();
}

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

Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-08-24 06:48:40
Thank you very much for your help.

I've changed my foobar setting according to your instruction.
And I found that the album art changes with differnet stations for the Marc2003's panel mod scripts in a separate panel.
But, the album art inside the JSPlaylist doesn't change. (It shows the default "nocover.png")
(http://i59.tinypic.com/zodcfm.jpg)
I've copy and paste the below scripts after deleting the original code.

I'm using "JSPlaylist v1.3.2 for my foobar.

When I'm listening to the streaming radio, it shows "stream.png".
I'd like to change "stream.png" according to the radio stations.

For example,
when I'm listening to "Linn" radio stations, I'd like to use "linn.png".
(Linn Radio Address : http://89.16.185.174:8000/stream) (http://89.16.185.174:8000/stream))

Please, give me some hints.

To use stream logo's as artwork here is how I got it setup.

Create a folder stream-logo and rename the logo according to $crc32($lower(%path%))

e.g For http://89.16.185.174:8000/stream (http://89.16.185.174:8000/stream) the filename is 2315402056.png

(http://i.imgur.com/63dMy6h.jpg)

Setup Preferences > Display as below

(http://i.imgur.com/buaRnE5.jpg)


For jsPlaylist to show the logo as the cover modify the script lines 708-722 as below.
Code: [Select]
//      if(track_type!=3) {
            if(metadb) {
                img = FormatCover(image, pw, ph, cover.draw_glass_reflect, false);
                if(!img) {
                    //img = (cGroup.type == 1) ? images.noartist : images.nocover;
                    img = null;
                    cover.type = 0;
                }; else {
                    cover.type = 1;
                };
            };
//      }; else {
//          img = images.stream;
//            cover.type = 3;
//        };
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-24 07:26:18
The image is the group header which shows nocover.png.

You have to change the.group settings  (right click column headers > edit groups )

or disable groups (right click column headers > Groups > disable Enable Groups).

Also in columns enable cover to be visible.

Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-08-24 08:06:07
The image is the group header which shows nocover.png.

You have to change the.group settings  (right click column headers > edit groups )

or disable groups (right click column headers > Groups > disable Enable Groups).

Also in columns enable cover to be visible.


Here I attached the the difference between the original and modified scripts.

Original
(http://i62.tinypic.com/66ixjt.jpg)

Modified
(http://i57.tinypic.com/103ilfr.jpg)

The group header image has been changed from "stream.png" to "nocover.png".
I want to the header image is changing to "radio station images."
I tried to find if there is any lines where I can change to show up the radio station miage in "group header", but I couldn't.

Please, let me know if there is anything I'm missing.

Thank you again for your help.
//
I've found that the group header image was fixed according to the first track list within the playlist.
So, after I move the second radio station to the first palce, the linn radio station image show up properly.
I guess that it would be so difficult to change the group header image with changing radio stations.

Anyway, thanks for your help and good scripts.
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-24 08:27:16
If you are using the default group pattern Album Artist | Album | Disc
change Title Format to
$if(%album artist%,%album artist%,%path%)album%%discnumber%

Disable cover in columns.

It should now show up as you like.

(http://i.imgur.com/O5IM2ea.jpg)
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-08-24 08:36:33
If you are using the default group pattern Album Artist | Album | Disc
change Title Format to
$if(%album artist%,%album artist%,%path%)album%%discnumber%

Disable cover in columns.

It should now show up as you like.


Wow!!!
Thank you very much.
It's exactly what I wanted.
Title: WSH Panel Mod script discussion/help
Post by: Norseman on 2015-08-24 22:47:57
First of I want to say thanks to Marc2003 for his scripts.

I have been trying to mod his Last.fm bio script, the key word is trying since I have not advanced in my quest. What I been wanting to achieve is to add a case to fetch the album info from last.fm instead of artist info. I thought this would be easy since only the difference in the url from artist is a "/album", however I have had no luck with it so I turn over here to see if I can get some help to do it.

What I have done so far is to see on the allmusic case (since it seem it take into account the album) and lastfm_bio case. I have only changed stuff under lastfm_bio case in the text.js file.

Here is what I have done so far (if it is not okay to post the code just say so and I will edit it away):

Code: [Select]
				
case "lastfm_bio_album":
var temp_artist = panel.tf(panel.artist_tf);
var temp_album = panel.tf(panel.album_tf); //added this line
if (this.artist == temp_artist && this.album == temp_album) // added the && this.album == temp_album part
return;
this.artist = temp_artist;
this.album = temp_album;  //added this line
this.content = "";
this.filename = panel.new_artist_folder(this.artist) + "bio_linje67." + this.bio_lastfm_sites[this.bio_lastfm_site] + ".json";  // seems like it is this line that determine the filename that is saved, but I cant figure out how to save it as the album (have tried the _.fbSanitise(this.album) from allmusic case but have not worked so far
if (_.isFile(this.filename)) {
var data = _.jsonParse(_.open(this.filename));
this.content = data[0];
if (_.fileExpired(this.filename, ONE_DAY))
this.get();
} else {
this.get();
}
break;

Have showed what I have changed. The other part that I have changed is this, which seems is what that types in the url

Code: [Select]
	case "lastfm_bio_album":
if (!_.tagged(this.artist))
return;
var url = "http://" + this.bio_lastfm_sites[this.bio_lastfm_site] + "/music/" + encodeURIComponent(this.artist) + "/" + encodeURIComponent(this.album) + "/+wiki";
break;

I have tried to add the  || !_.tagged(this.album) in the if statement, but then it seems it do not fetch anything. It still fetches the artist bio even though the url should get the album info, that is if I understand this correct.

If some could help that would be awesome
Title: WSH Panel Mod script discussion/help
Post by: Norseman on 2015-08-25 01:36:33
Can't find a edit so it will be a double post.

Woohoo, I managed to trick it together  The problem was that the this.album was not defined for the lastfm case. Here is my solution if anyone else want to use it.

Under this.metadb_changed = function () change the following things:

            case "lastfm_bio_album":
               var temp_artist = panel.tf(panel.artist_tf);
               var temp_album = panel.tf(this.allmusic_album_tf);
               if (this.artist == temp_artist && this.album == temp_album)
                  return;
               this.artist = temp_artist;
               this.album = temp_album;
               this.content = "";
               this.filename = panel.new_artist_folder(this.artist) + "album." + _.fbSanitise(this.album) +"." + this.bio_lastfm_sites[this.bio_lastfm_site] + ".json";
               if (_.isFile(this.filename)) {
                  var data = _.jsonParse(_.open(this.filename));
                  this.content = data[0];
                  if (_.fileExpired(this.filename, ONE_DAY))
                     this.get();
               } else {
                  this.get();
               }

Under this.get = function ()
         case "lastfm_bio_album":
            if (!_.tagged(this.artist) || !_.tagged(this.album))
               return;
            var url = "http://" + this.bio_lastfm_sites[this.bio_lastfm_site] + "/music/" + encodeURIComponent(this.artist) + "/" + encodeURIComponent(this.album) + "/+wiki";
            break;

Under this.success = function (f)
I just added a            this.album = "";

Under this.header_text = function ()
         case "lastfm_bio_album":
            return panel.tf("%album artist%[ - %album%]");
            break;

And finally under this.init = function () I added          this.allmusic_album_tf = window.GetProperty("2K3.TEXT.ALLMUSIC.ALBUM.TF", "%album%");


Probably a waste of time writing this to the pro people here but maybe another noob like me is after something like this and can find use in it. The way I did this was to copy all the instances of the case lastfm_bio and made a new case called lastfm_bio_album. The only code that is changed is listed above, the rest of the cases is just a copy. When the script is loaded to get the album info change line 13 from that says lastfm_bio into lastfm_bio_album. I also made a new copy of the text.js file and made the changes the new file which I called textmod.js and changed line 9 to read \textmod.js.

Title: WSH Panel Mod script discussion/help
Post by: Norseman on 2015-08-25 15:57:15
New day and a new question. Is it possible to add buttons inside WSH mod? Instead of right clicking to choose what to see I want buttons to click on, for example news/blogs/reviews you right click to choose which one to display, is it possible to make some textboxes and click on those to choose what to display.


(Hope this make sense, if not just say so and I will try to explain myself better)
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-25 16:30:23
New day and a new question. Is it possible to add buttons inside WSH mod? Instead of right clicking to choose what to see I want buttons to click on, for example news/blogs/reviews you right click to choose which one to display, is it possible to make some textboxes and click on those to choose what to display.


(Hope this make sense, if not just say so and I will try to explain myself better)

see this (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=888902) But it's for changing mode in last fm and it's for marc's previous script ( common8 )
as i haven't figured out the new scripts  i don't know the exact lines 
so lines like
li.lastfm_change_mode
this.lastfm_mode = m
have to be changed accordingly
hope you'll figure it out
Title: WSH Panel Mod script discussion/help
Post by: Norseman on 2015-08-25 19:15:15
Is that code added in the text file or the .js file?
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-25 20:09:16
Is that code added in the text file or the .js file?
In text file .You should probably make copy of it first
Code: [Select]
// ==PREPROCESSOR==
// @name "Last.fm Artist Info/User Charts/Recommendations"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// @import "%fb2k_profile_path%wsh_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\helpers.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\panel.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\lastfm.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\list.js"
// ==/PREPROCESSOR==

var panel = new _.panel("Last.fm Artist Info/User Charts/Recommendations", ["metadb", "custom_font"]);
var lastfm = new _.lastfm();
//lastfm.api_key = "abc123"; //uncomment these 2 lines
//lastfm.secret = "abc123"; //and edit accordingly
var list = new _.list("lastfm_info", 10, 30, 0, 0);
var bs = 32;
var buttons = new _.buttons();
list.lastfm_change_mode = function (m) {
    this.lastfm_artist_method = m;
    window.SetProperty("2k3.lastfm_mode", this.lastfm_mode); //store the value so it's remembered on panel reload/foobar restart
    this.artist = ""; //the panel won't update if the artist doesn't change so i just clear it
    panel.item_focus_change(); //this calls the function that refreshes the panel - don't repaint because it's already done for you
}



buttons.buttons.sartist = new _.button(0, 20, bs, bs, {normal : "buttons\\sartist.png"}, function () {list.lastfm_change_mode(1);} , "similer artist");
buttons.buttons.tags = new _.button(bs, 20, bs, bs, {normal : "buttons\\tags.png"}, function () { list.lastfm_change_mode(2); }, "top tags");
buttons.buttons.talbum = new _.button(bs * 2, 20, bs, bs, {normal : "buttons\\talbum.png"}, function () { list.lastfm_change_mode(3); }, "top albums");
buttons.buttons.top = new _.button(bs * 3, 20, bs, bs, {normal : "buttons\\top.png"}, function () { list.lastfm_change_mode(4);}, "top tracks");




panel.item_focus_change();

function on_notify_data(name, data) {
lastfm.notify_data(name, data);
}

function on_size() {
panel.size();
list.w = panel.w - 20;
list.h = panel.h - 24;
list.size();
}

function on_paint(gr) {
panel.paint(gr);
gr.FillSolidRect(0, 0, panel.w, 24, panel.colours.header);
gr.GdiDrawText(list.header_text(), panel.fonts.title, panel.colours.highlight, 10, 0, panel.w - 20, 24, LEFT);
list.paint(gr);
        buttons.paint(gr);
}

function on_metadb_changed() {
list.metadb_changed();
}

function on_mouse_wheel(s) {
list.wheel(s);
}

function on_mouse_move(x, y) {
list.move(x, y);
        buttons.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
list.lbtn_up(x, y);
        buttons.lbtn_up(x, y);
}

function on_key_down(k) {
list.key_down(k);
}

function on_mouse_rbtn_up(x, y) {
return panel.rbtn_up(x, y, list);
}
and you should edit 29-32 lines to relevent image names(buttons\\sartist.png) and put relevant png buttons in wsh_marc2003\images\buttons folder  named  accordingly
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-25 20:10:17
  Duplicate
Title: WSH Panel Mod script discussion/help
Post by: Norseman on 2015-08-25 21:57:01
Awesome  I should manage to get what I want from this. I know I'm asking a lot of questions here, but is it possible to make a text button similar to  Panel Stack Splitter buttons? That change color based on if I hover the mouse over it and whether it is active. The code that I use in PSS is as following:
$textbutton(271,0,80,23,Last.fm,Last.fm,SETGLOBAL:mainpanel:5;REFRESH,fontcolor:255-255-255 brushcolor:$get(LastButton),fontcolor:255-255-255 brushcolor:0-255-0)
$textbutton(x,y,w,h,text,mover_text,command,options1,options2)
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-08-25 22:30:09
You could refer to examples provided with the component
see foobar2000\user-components\foo_uie_wsh_panel_mod\samples\SimpleThemedButton
and refer what's in docs folder
Title: WSH Panel Mod script discussion/help
Post by: Norseman on 2015-08-25 23:06:24
Ok  Thanks for the help
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-27 15:13:43
a few fixes for my latest scripts...

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

i also have a known issues topic for misbehaving Last.fm stuff here...

https://github.com/19379/wsh_marc2003/issues/3 (https://github.com/19379/wsh_marc2003/issues/3)
Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2015-08-27 17:17:20
Quote
Playcount sync is not included.

 

But let's not get greedy. Thanks for making these available!
Title: WSH Panel Mod script discussion/help
Post by: arcos on 2015-08-28 12:31:59
Thanks marc2003, you know what append to your now.playing.txt ???
thanks 
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-29 13:42:29
I have problem with this script, script works fine after second attempt.
If i click apply-ok in properties, script wont work on first time, but works fine after that.
What's the problem?

Code: [Select]
GET_ART = function()
{
url = "https://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&artist=" + encodeURIComponent(Artist) + "&api_key=" + api + "&format=json&limit=" + art;

xmlhttp.open("GET",url,true);
xmlhttp.send();

xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            
data = xmlhttp.ResponseText;

try {
json_data = JSON.parse(data);

//Check length
ln = json_data.similarartists.artist;
ln = ln.length;
//fb.trace('similar(length): '+ln);

//Select random artist
randomnumber = Math.floor(Math.random()*(1-ln)+ln);
var i = randomnumber;

ar = json_data.similarartists.artist[i].name.replace(/&amp;/g, " \& ");
fb.trace(ar);

//Save
if (ar > "")
{
SIM_ART = window.SetProperty("Similar", ar);
SIM_ART = ar;
window.SetProperty("Similar", ar);
}
else
{
SIM_ART = window.SetProperty("Similar", "");
SIM_ART = "";
window.SetProperty("Similar", "");
}                  

xmlhttp.close;
        
} catch (err) {
            xmlhttp.close;
        }        
    
} else
        if (xmlhttp.status == 404) {p.console("HTTP error: " + xmlhttp.status);}
              
}}
}
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-29 15:20:57
I have problem with this script, script works fine after second attempt.
If i click apply-ok in properties, script wont work on first time, but works fine after that.
What's the problem?

Code: [Select]
GET_ART = function()
{
url = "https://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&artist=" + encodeURIComponent(Artist) + "&api_key=" + api + "&format=json&limit=" + art;

xmlhttp.open("GET",url,true);
xmlhttp.send();

xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            
data = xmlhttp.ResponseText;

try {
json_data = JSON.parse(data);

//Check length
ln = json_data.similarartists.artist;
ln = ln.length;
//fb.trace('similar(length): '+ln);

//Select random artist
randomnumber = Math.floor(Math.random()*(1-ln)+ln);
var i = randomnumber;

ar = json_data.similarartists.artist[i].name.replace(/&amp;/g, " \& ");
fb.trace(ar);

//Save
if (ar > "")
{
SIM_ART = window.SetProperty("Similar", ar);
SIM_ART = ar;
window.SetProperty("Similar", ar);
}
else
{
SIM_ART = window.SetProperty("Similar", "");
SIM_ART = "";
window.SetProperty("Similar", "");
}                  

xmlhttp.close;
        
} catch (err) {
            xmlhttp.close;
        }        
    
} else
        if (xmlhttp.status == 404) {p.console("HTTP error: " + xmlhttp.status);}
              
}}
}

I had the same problem.
Try sending the request xmlhttp.send(); after the xmlhttp.onreadystatechange = function()

Code: [Select]
GET_ART = function () {
url = "https://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&artist=" + encodeURIComponent(Artist) + "&api_key=" + api + "&format=json&limit=" + art;

xmlhttp.open("GET", url, true);


xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {

data = xmlhttp.ResponseText;

try {
json_data = JSON.parse(data);

//Check length
ln = json_data.similarartists.artist;
ln = ln.length;
//fb.trace('similar(length): '+ln);

//Select random artist
randomnumber = Math.floor(Math.random() * (1 - ln) + ln);
var i = randomnumber;

ar = json_data.similarartists.artist[i].name.replace(/&amp;/g, " \& ");
fb.trace(ar);

//Save
if (ar > "") {
SIM_ART = window.SetProperty("Similar", ar);
SIM_ART = ar;
window.SetProperty("Similar", ar);
} else {
SIM_ART = window.SetProperty("Similar", "");
SIM_ART = "";
window.SetProperty("Similar", "");
}

xmlhttp.close;

} catch (err) {
xmlhttp.close;
}

} else
if (xmlhttp.status == 404) {
p.console("HTTP error: " + xmlhttp.status);
}

}
}
xmlhttp.send();
}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-29 15:27:37
what the f...lip. my code has been like this since 2009 and it has always been 100% reliable...

Code: [Select]
xmlhttp.open("GET", url, true);
xmlhttp.setRequestHeader("User-Agent", user_agent);
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            //success
        } else {
            //fail
        }
    }
}
Title: WSH Panel Mod script discussion/help
Post by: zeremy on 2015-08-29 15:40:47
what the f...lip. my code has been like this since 2009 and it has always been 100% reliable...

Code: [Select]
xmlhttp.open("GET", url, true);
xmlhttp.setRequestHeader("User-Agent", user_agent);
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            //success
        } else {
            //fail
        }
    }
}


This is an observation that I made trying to make other scripts work.
I know your code works in your scripts, but this "hack" works for me..
I think it has to do with the fact that the function is not defined already when the send (null) request is triggered.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-29 15:57:47
I had the same problem.
Try sending the request xmlhttp.send(); after the xmlhttp.onreadystatechange = function()

Code: [Select]
GET_ART = function () {
url = "https://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&artist=" + encodeURIComponent(Artist) + "&api_key=" + api + "&format=json&limit=" + art;

xmlhttp.open("GET", url, true);


xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {

data = xmlhttp.ResponseText;

try {
json_data = JSON.parse(data);

//Check length
ln = json_data.similarartists.artist;
ln = ln.length;
//fb.trace('similar(length): '+ln);

//Select random artist
randomnumber = Math.floor(Math.random() * (1 - ln) + ln);
var i = randomnumber;

ar = json_data.similarartists.artist[i].name.replace(/&amp;/g, " \& ");
fb.trace(ar);

//Save
if (ar > "") {
SIM_ART = window.SetProperty("Similar", ar);
SIM_ART = ar;
window.SetProperty("Similar", ar);
} else {
SIM_ART = window.SetProperty("Similar", "");
SIM_ART = "";
window.SetProperty("Similar", "");
}

xmlhttp.close;

} catch (err) {
xmlhttp.close;
}

} else
if (xmlhttp.status == 404) {
p.console("HTTP error: " + xmlhttp.status);
}

}
}
xmlhttp.send();
}

This works O.o

I looked on response if i send  request ''xmlhttp.send();'' before the ''xmlhttp.onreadystatechange = function() '' i receive:

1
1
1
2
3
4

And when it reaches 4, it won't pass..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-08-29 15:58:32
@zeremy, i was merely "observing" that you guys always manage to take working code and break it.  but if it works...

@mire777, you could tidy that up a lot...

Code: [Select]
try {
    var json_data = JSON.parse(xmlhttp.ResponseText);
    var artists = json_data.similarartists.artist;
    if (artists.length == 0) {
        SIM_ART = "";
    } else {
        SIM_ART = artists[Math.floor(Math.random() * artists.length)].name;
    }
    window.SetProperty("Similar", SIM_ART);
} catch (e) {
}
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-08-29 16:20:41
@zeremy, i was merely "observing" that you guys always manage to take working code and break it.  but if it works...

@mire777, you could tidy that up a lot...

Code: [Select]
try {
    var json_data = JSON.parse(xmlhttp.ResponseText);
    var artists = json_data.similarartists.artist;
    if (artists.length == 0) {
        SIM_ART = "";
    } else {
        SIM_ART = artists[Math.floor(Math.random() * artists.length)].name;
    }
    window.SetProperty("Similar", SIM_ART);
} catch (e) {
}


Probably something is broken
Thank you
Title: WSH Panel Mod script discussion/help
Post by: asdfsgt on 2015-08-29 19:49:07
I was trying to create a shuffle button and I managed to do it somehow, but now I also wanted it to be able to change Replay Gain from album to track when shuffling but I couldn't find a command for this, so is there some command for it?

And secondly is there a way to find out what are the fb. commands for all the different actions that foobar does?
Title: WSH Panel Mod script discussion/help
Post by: michtar on 2015-08-29 20:01:57
I was trying to create a shuffle button and I managed to do it somehow, but now I also wanted it to be able to change Replay Gain from album to track when shuffling but I couldn't find a command for this, so is there some command for it?

Foobar does it itself: Preferences-Playback-Replaygain-by playback order
Title: WSH Panel Mod script discussion/help
Post by: asdfsgt on 2015-08-29 20:25:06
Thanks, that made my life a bit simpler.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-09-01 16:05:25
Updated ''Youtube Radio'' script, if someone still use this, previous script is stop working, i now use last.fm API.
You must enter your Api in properties. Link for download> (http://www.mediafire.com/download/67f820sreiuhybp/Foobar+Youtube+Radio.zip)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-01 16:11:33
it's worth mentioning that you cannot signup for a new API key at the moment. even if you already have one, the API section of the site will not let you log in. the only way to view API account details is if you signed in before the site switchover and you have some old cookies lurking about that are keeping you logged in.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-04 21:56:45
i've updated my last.fm artist info/charts/recommendations script with a recent tracks option.

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

but if you don't already have an API key, you won't be able to use it.

https://github.com/19379/wsh_marc2003/issues/3 (https://github.com/19379/wsh_marc2003/issues/3)
Title: WSH Panel Mod script discussion/help
Post by: seriousstas on 2015-09-05 22:06:22
Hi . Prompt how to solve the problem. As long as I found two ways to refresh (PSS to control through WSH) :
1. :
Code: [Select]
function RefreshPSS() {
 if (fb.IsPlaying || fb.IsPaused) {
 fb.RunMainMenuCommand("Playback/Play or Pause");
 fb.RunMainMenuCommand("Playback/Play or Pause");
 }
 else {
 fb.RunMainMenuCommand("Playback/Play");
 fb.RunMainMenuCommand("Playback/Stop");
 }
 }
2.
Code: [Select]
   if (fb.IsPlaying || fb.IsPaused) {   
        fb.RunMainMenuCommand("View/Show status bar");
        fb.RunMainMenuCommand("View/Show status bar");
    } else {
        fb.RunMainMenuCommand("View/Show status bar");
        fb.RunMainMenuCommand("View/Show status bar");
    }
First - creates sound skips when using Asio driver, second - jump up and blink panel. What still has a way to refresh? The entire script (Refresh changes through Properties):

Code: [Select]
//==============Button timer
//==============================================================
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
var font = gdi.Font("Arial",11,1);
var font2 = gdi.Font("Guifx v2 Transports",40,0);
var ww,wh;
var on_mouse = false;
var Refresh_sys = window.GetProperty("Refresh_sys",true)
var seconds = window.GetProperty("seconds",5000)

function StringFormat() {
var h_align = 0,
v_align = 0,
trimming = 0,
flags = 0;
switch (arguments.length) {
case 3:
trimming = arguments[2];
case 2:
v_align = arguments[1];
case 1:
h_align = arguments[0];
break;
default:
return 0;
};
return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
};

StringAlignment = {
Near: 0,
Centre: 1,
Far: 2
};
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);

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

var fso = new ActiveXObject("Scripting.FileSystemObject");
if(!fso.FolderExists( fb.ProfilePath + "settings")) {fso.CreateFolder( fb.ProfilePath + "settings" )};
var set_path = fb.ProfilePath + "\\settings\\";

var img_path = fb.ProfilePath + "\\themes\\";

var n_btn = gdi.Image(img_path + "n.png");
var h_btn = gdi.Image(img_path + "h.png");
//var on_btn  = gdi.Image(img_path + "toolbar_1.png");
//var off_btn = gdi.Image(img_path + "toolbar_0.png");
var on_btn  = "s";
var off_btn = "w";
var is_toolbar = 0;
if(fso.FileExists( set_path + "toolbar_1")) {
fso.deleteFile( set_path + "toolbar_" + "*" );
fso.CreateTextFile( set_path + "toolbar_0" )
RefreshPSS();
}
function on_paint(gr){
//gr.FillSolidRect (0, 0, ww, wh, RGB(47,48,53));
gr.SetTextRenderingHint(4);
//gr.DrawString(is_toolbar == 0 ? off_btn : on_btn,font2,RGB(220,20,60),0,0,ww,wh,cc_stringformat);
gr.SetTextRenderingHint(0);
gr.DrawImage( on_mouse? h_btn : n_btn, 0, 0, 80, 80, 0, 0, 80, 80, 0, 255);
//gr.DrawImage( is_toolbar == 0 ? off_btn : on_btn, 0, 0, 80, 80, 0, 0, 80, 80, 0, 255);
}

function on_mouse_lbtn_up (x, y){
is_toolbar = is_toolbar == 1 ? 0 : 1;
try { fso.deleteFile( set_path + "toolbar_" + "*" )
} catch(e) {};
fso.CreateTextFile( set_path + "toolbar_" + is_toolbar );

RefreshPSS();

if (is_toolbar == 0) { if (g_timer){window.ClearTimeout(g_timer)}; return};
ch_state_btb();
}

var g_timer;

function ch_state_btb(){
g_timer = window.SetTimeout(function() {
if(fso.FileExists( set_path + "toolbar_1")) {
fso.deleteFile( set_path + "toolbar_" + "*" );
fso.CreateTextFile( set_path + "toolbar_0" )
is_toolbar = 0;
window.Repaint();
RefreshPSS();
window.ClearTimeout(g_timer);

}, seconds);
}

function RefreshPSS() {
 if (Refresh_sys < true) {
if (fb.IsPlaying || fb.IsPaused) { 
fb.RunMainMenuCommand("View/Show status bar");
fb.RunMainMenuCommand("View/Show status bar");
} else {
fb.RunMainMenuCommand("View/Show status bar");
fb.RunMainMenuCommand("View/Show status bar");
}
} else {
if (fb.IsPlaying || fb.IsPaused) { 
fb.RunMainMenuCommand("Playback/Play or Pause");
fb.RunMainMenuCommand("Playback/Play or Pause");
} else {
fb.RunMainMenuCommand("Playback/Play");
fb.RunMainMenuCommand("Playback/Stop");
}
}

}

function on_mouse_move(x, y) {
on_mouse = true;
window.Repaint();


function on_mouse_leave() { 
on_mouse = false;
window.Repaint();
}


Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-06 02:26:55
First - creates sound skips when using Asio driver


use directsound... or don't use dirty hacks which cause these undesirable side effects. the choice is yours.
Title: WSH Panel Mod script discussion/help
Post by: jahtimes on 2015-09-06 15:04:31
Updated ''Youtube Radio'' script, if someone still use this, previous script is stop working, i now use last.fm API.
You must enter your Api in properties. Link for download> (http://www.mediafire.com/download/67f820sreiuhybp/Foobar+Youtube+Radio.zip)



Damn ! This is an amazing tool ! Thanks a lot for this ! =)
Title: WSH Panel Mod script discussion/help
Post by: magnumforce2006 on 2015-09-08 21:36:23
I've been using Marc2003's "Now Playing" panel for a number of years, but it appears to have stopped working due to the new last.fm.

Anyone know what changes might need to be made to the script to make it operational again?

Code for reference:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common7.js"
// @name "Now Playing"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

//the track info section displays 3 lines of title formatted text. you can customise that here/////////////////////////////////////////////
var line1 = {
text: "", //leave this blank
tf: "%artist%", //enter any title formatting
font: gdi.Font("Segoe UI", 30, 1), //font name, size, style. 1 means bold and 0 is normal.
colour: RGB(40,179,255), //colour
y: 0 //change this value to move text up or down.
}
var line2 = {
text: "",
tf: "[%discnumber%.]%tracknumber%'/'[%discnumber%.]%totaltracks% - %title%",
font: gdi.Font("Segoe UI", 23, 1),
colour: RGB(210, 210, 210),
y: 38
}
var line3 = {
text: "",
tf: "$ifequal([%LASTFM_LOVED_DB%],1,♥,)",
font: gdi.Font("Segoe UI", 23, 1),
colour: RGB(255,0,0),
y: 70
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var p = new panel("Now Playing", ["custom_background", "now_playing", "lastfm_wiki", "remap"]);
p.version = "7.2013-04-23.01";
p.filename = "now playing.txt";
var c = new cd(0, 0, 0, 0);
var r = new rating(0, 0, 24);
var t = new text(0, 0, 0, 0);
var im = new images(0, 0, 0, 0);
var th = new thumbs(0, 0 , 0, 0)
var b = new buttons();
p.check_version();

p.selection_mode = 1;

var np_cd = window.GetProperty("np_cd", true);
var np_cd_size = window.GetProperty("np_cd_size", 200);
var np_track = window.GetProperty("np_track", true);
var np_track_top = window.GetProperty("np_track_top", false);
var np_buttons = window.GetProperty("np_buttons", true);
var np_bio = window.GetProperty("np_bio", true);
var np_cd_size = window.GetProperty("np_cd_size", 200);
var np_rating = window.GetProperty("np_rating", true);

var bar1y = 0;
var bar1h = 0;
var bar2y = 0;
var bar2h = 0;

b.update = function() {
if (p.metadb) {
var artist = encodeURIComponent(p.eval("%artist%"));
var title = encodeURIComponent(p.eval("%title%"));
var google = "https://www.google.co.uk/search?q=" + artist;
var myspace = "http://www.myspace.com/search/music?q=" + artist;
var lastfm = "http://www.last.fm/music/" + artist + "/_/" + title;
var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
var discogs = "http://www.discogs.com/search?q=" + artist;
var allmusic = "http://www.allmusic.com/search/artists/" + artist;
b.buttons = {
google: new button(im.x + im.w - 192, bar2y - 1, 32, 32, {normal: "google.png", hover: "google_h.png"}, function() { p.browser(google); }, google),
myspace: new button(im.x + im.w - 160, bar2y - 1, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
lastfm: new button(im.x + im.w - 128, bar2y - 1, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
youtube: new button(im.x + im.w - 96, bar2y - 1, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
discogs: new button(im.x + im.w - 64, bar2y - 1, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
allmusic: new button(im.x + im.w - 32, bar2y - 1, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
}
}
window.RepaintRect(0, bar2y, im.w, bar2h);
}

on_item_focus_change();

function on_playback_time(time) {
im.playback_time(time);
}

function on_size() {
p.size();
th.calc();
switch(true) {
case np_track_top:
c.y = im.y - (np_cd_size * 0.05);
bar1y = im.y;
bar1h = np_track ? 100 : 0;
bar2y = im.y + bar1h;
bar2h = np_buttons || np_rating ? 30 : 0;
t.y = im.y + bar1h + bar2h;
break;
default:
c.y = im.y + im.h - np_cd_size + (np_cd_size * 0.05);
bar1y = im.y + (np_rating || np_buttons ? im.h - 130 : im.h - 100);
bar1h = np_track ? 100 : 0;
bar2y = im.y + im.h - 30;
bar2h = np_buttons || np_rating ? 30 : 0;
t.y = im.y;
break;
}
c.x = im.x;
c.w = np_cd_size;
c.h = np_cd_size;
r.y = bar2y + 3;
t.x = im.x + im.w - Math.round(im.w / 3);
t.w = im.x + im.w - t.x - 15;
t.h = im.h - bar1h - bar2h;
t.size();
b.update();
}

function on_paint(gr) {
p.draw_background(gr);
th.draw(gr);
tix = im.x + (np_cd ? np_cd_size : 10);
r.x = tix;
if (np_track) {
gr.FillSolidRect(im.x, bar1y, im.w, bar1h, RGBA(0, 0, 0, 196));
p.left_text(gr, line1.text, line1.font, line1.colour, tix, bar1y + line1.y, im.x + im.w - tix - 10, line1.font.Height);
p.left_text(gr, line2.text, line2.font, line2.colour, tix, bar1y + line2.y, im.x + im.w - tix - 10, line2.font.Height);
p.left_text(gr, line3.text, line3.font, line3.colour, tix, bar1y + line3.y, im.x + im.w - tix - 10, line3.font.Height);
}
if (np_rating || np_buttons) gr.FillSolidRect(im.x, bar2y, im.w, bar2h, RGBA(0, 0, 0, 136));
if (np_cd) c.draw(gr);
if (np_rating) r.draw(gr);
if (np_buttons) b.draw(gr);
if (np_bio) {
gr.FillSolidRect(t.x - 15, t.y, t.w + 30, t.h, RGBA(0, 0, 0, 156));
t.draw(gr, RGB(240, 240, 240));
}
}

function on_metadb_changed() {
b.update();
r.metadb_changed();
im.metadb_changed();
t.metadb_changed();
c.metadb_changed();
if (p.metadb) {
line1.text = p.eval(line1.tf);
line2.text = p.eval(line2.tf);
line3.text = p.eval(line3.tf);
}
window.Repaint();
}

function on_playback_stop() {
on_item_focus_change();
b.update();
}

function on_playback_pause() {
b.update();
}

function on_playback_starting() {
b.update();
}

function on_get_album_art_done(metadb, art_id, im, ip) {
c.get_album_art_done(ip);
}

function on_mouse_wheel(step) {
if (np_cd && c.trace(p.mx, p.my)) {
np_cd_size += step * 25;
if (np_cd_size < 200) np_cd_size = 200;
if (np_cd_size > 400) np_cd_size = 400;
window.SetProperty("np_cd_size", np_cd_size);
c.y = Math.round(np_track_top ? im.y - (np_cd_size * 0.05) : im.y + im.h - np_cd_size + (np_cd_size * 0.05));
c.w = np_cd_size;
c.h = np_cd_size;
window.RepaintRect(im.x, np_track_top ? im.y : im.y + im.h - 450, im.w, 450);
return;
}
if (th.wheel(step)) return;
if (np_bio && t.wheel(step)) return;
im.wheel(step);
}

function on_mouse_move(x, y) {
p.move(x, y);
if (np_rating && r.move(x, y)) return;
if (np_bio && t.move(x, y)) return;
if (np_buttons && b.move(x,y)) return;
if (np_cd && c.move(x, y)) return;
if (th.move(x, y)) return;
}

function on_mouse_lbtn_up(x, y) {
if (np_buttons && b.lbtn_up(x, y)) return;
if (np_rating && r.lbtn_up(x, y)) return;
if (np_bio && t.lbtn_up(x, y)) return;
if (th.lbtn_up(x, y)) return;
}

function on_mouse_lbtn_dblclk(x, y) {
if (np_cd && c.lbtn_dblclk(x, y)) return;
if (th.lbtn_dblclk(x, y)) return;
}
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-09 17:58:53
JSSmoothPlaylist beta available for testing purpose

http://fav.me/d98yydn (http://fav.me/d98yydn)

thanx by advance for your feedback
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-09-09 21:19:45
..
Title: WSH Panel Mod script discussion/help
Post by: sh1ggy on 2015-09-10 17:10:18
Total noob here, I'm trying to modify a script. I want to display an image depending on the name of an artist.

Code: [Select]
gdi.Image("cover/ARTIST.png")


I figured I could create a variable which looks something like this:

Code: [Select]
var tf_artist = fb.TitleFormat("%album artist%");


Now, how can I use that variable in my gdi.Image function?
Title: WSH Panel Mod script discussion/help
Post by: magnumforce2006 on 2015-09-12 01:01:13
Ok let me pose the following question: Anyone know of a good script or plugin for a "now playing" panel? (something like below)

(https://dl.dropboxusercontent.com/u/5936941/nowplaying.jpg)
Title: WSH Panel Mod script discussion/help
Post by: mystNZ on 2015-09-12 10:34:04
Hi, could someone please help out with a WSH panel mod script ... I am new to it and having trouble getting into it. I've also tried extracting code from other skins with no luck.

What I am trying to do:  a simple panel (basically like a status bar) that shows info for the current playlist you are in - "number of items  |  play time (hours/days/weeks/etc)  |  size on disk (MB/GB)".
Thats it. And have it be customizable ... background color, font color/style/size ...

Thanks
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-12 15:22:23
i've updated my scripts. it might have a feature some people have been missing...

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

@magnumforce2006, i'm not updating any now playing scripts.

@sh1ggy, you'd be better off using the artreader functions built into the component. then you can configure file>preferences>display>album art>artist.

then you can use

Code: [Select]
var metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (!metadb)
     return;
var img = utils.GetAlbumArtV2(metadb, 4); //4 is for artist, 0 is front cover, 1 back, 2 disc, 3 icon


@mystNZ, the link above contains an example status bar script which displays playlist totals. it should be easy enough to figure out how to customise it.
Title: WSH Panel Mod script discussion/help
Post by: mystNZ on 2015-09-12 16:19:24
@mystNZ, the link above contains an example status bar script which displays playlist totals. it should be easy enough to figure out how to customise it.

Thanks Marc, that worked great!
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-09-16 01:51:50
marc2003, thank you for updates. Also what about LastFM API? Is it still broken? I can 'love' tracks via Playcount sync (they actually get love status on LastFM), but it doesn't receive any response from LastFM. So, there're no database updates and it's impossible to unlove tracks via the script.
Code: [Select]
Last.fm Playcount Sync: Automatically loving this track.... 
Last.fm Playcount Sync: Attempting to love "My Favourite Faded Fantasy" by "Damien Rice"
Last.fm Playcount Sync: Contacting Last.fm....
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-16 11:05:28
the code to love/unlove tracks can be modified to workaround the current API problems. open your common8.js in a decent text editor like notepad++. use ctrl+f to open the search dialog and look for this.post there should only be one result. it should be easy to see what bit of code you need to overwrite with this...

Code: [Select]
            case "track.love":
            case "track.unlove":
                var func = function() {
                    if (l.xmlhttp.responsetext.indexOf("ok") > -1) {
                        p.console("Track " + (method == "track.love" ? "loved successfully." : "unloved successfully."));
                        fb.RunContextCommandWithMetadb("Customdb Love " + (method == "track.love" ? 1 : 0), metadb, 8);
                    } else {
                        p.console(l.xmlhttp.responsetext);
                    }
                }
                
                if (!ps.check_component || !metadb || this.username.length == 0 || this.sk.length != 32)
                    return;
                var artist = tf(p.artist_tf, metadb);
                var track = tf("%title%", metadb);
                if (artist == "" || artist == "?")
                    return;
                p.console("Attempting to " + (method == "track.love" ? "love \"" : "unlove \"") + track + "\" by \"" + artist + "\"");
                p.console("Contacting Last.fm....");
                this.api_sig = md5("api_key" + this.api_key + "artist" + artist + "method" + method + "sk" + this.sk + "track" + track + this.secret);
                this.data = "method=" + method + "&api_key=" + this.api_key + "&api_sig=" + this.api_sig + "&sk=" + this.sk + "&artist=" + encodeURIComponent(artist) + "&track=" + encodeURIComponent(track);
                break;


there is no workaround for the import playcount function being broken.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-09-16 12:10:48
I created a script thumbs + last.fm bio.txt, using ideas from the script album art + allmusic review.txt (wsh_marc2003-v8).
The script can be downloaded at https://cloud.mail.ru/public/BXYt/Nas2XyHBs (https://cloud.mail.ru/public/BXYt/Nas2XyHBs)

bio preview:
(http://i67.fastpic.ru/thumb/2015/0916/86/26fc3daa23b5ff408341b0d9275d1c86.jpeg) (http://fastpic.ru/view/67/2015/0916/26fc3daa23b5ff408341b0d9275d1c86.jpg.html)

thumbs preview:
(http://i69.fastpic.ru/thumb/2015/0916/30/6065ba0b86b3cbdd66f288ef9c06b630.jpeg) (http://fastpic.ru/view/69/2015/0916/6065ba0b86b3cbdd66f288ef9c06b630.jpg.html)
Title: WSH Panel Mod script discussion/help
Post by: Frame on 2015-09-16 13:57:26
marc2003, it works great! Thank you. Don't care about playcount anyway.
Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2015-09-16 18:45:24
Don't care about playcount anyway.

Waaat???

I curse last.fm every single day for messing up the API (and hence playcount sync) with the update!!!111oneeleven
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-16 18:58:28
the background updates as you listen still work. it's only the bulk import that is broken.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-18 13:51:22
i've updated my scripts. *snip*


Just took a quick peek and was curious about minor tweaks in last.fm bio. Is it strictly tied to colors in main options of fb2k? EG: say I want to just alter the artist color and not the main text body color. And can artist name be positioned with the 'center' argument?

Neither is that important but was wondering if possible and where to do it if so. I can live with the older version I use now if you have made this un-editable for customization.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-18 14:05:45
inside the on_paint function...

gr.GdiDrawText(list.header_text(), panel.fonts.title, _.RGB(255, 0, 0), 10, 0, panel.w - 20, 24, CENTRE);
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-18 14:12:38
Ah. The  _.  before the RBG() part of the new change? I tried without and got an instacrash. 


Thanks.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-09-20 13:16:06
to marc2003

In Post #4297  I public link to script thumbs + last.fm bio. Please help me add to this script album_art page.
I want change "x" button to menu button - thumbs, lastfm_bio, album_art.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-20 14:05:38
that's not happening as it would require a lot of editing and i'm lazy.

just put thumbs in custom folder mode and it will display all images in the currently playing track's folder. you can even modify the folder it uses and it supports whatever title formatting you like but it works at a folder level, not file.
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-09-21 03:05:43
I want to add a button for 'playback order context menu' inside my foobar main window similar to the 'Menu" button.

I found that the menu button can be added with the following script from "Marc2003's script."
Code: [Select]
buttons.buttons.menu = new _.button(10, 8, bs, bs, {normal : "buttons\\menu.png"}, function () { _.menu(0, 16); }, "Menu");

I don't know where I have to change for my purpose.
Please, give me some hint.
Thanks you very much for reading.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-21 11:33:18
use one of the samples included with the component itself...

https://code.google.com/p/foo-wsh-panel-mod...n%28Menu%29.txt (https://code.google.com/p/foo-wsh-panel-mod/source/browse/samples/PBOButton%28Menu%29.txt)

edit: i just remembered that version doesn't include the images. mine does...

https://github.com/19379/foo_uie_wsh_panel_mod/releases (https://github.com/19379/foo_uie_wsh_panel_mod/releases)

if you don't want to use my updated component, you can still extract the required files by opening the .fb2k-component file with 7-zip or other archive reader.
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-09-22 01:56:57
use one of the samples included with the component itself...

https://code.google.com/p/foo-wsh-panel-mod...n%28Menu%29.txt (https://code.google.com/p/foo-wsh-panel-mod/source/browse/samples/PBOButton%28Menu%29.txt)

edit: i just remembered that version doesn't include the images. mine does...

https://github.com/19379/foo_uie_wsh_panel_mod/releases (https://github.com/19379/foo_uie_wsh_panel_mod/releases)

if you don't want to use my updated component, you can still extract the required files by opening the .fb2k-component file with 7-zip or other archive reader.

Thank you very much for your help.
According to your instruction, it was very easy to make the PBO button in my foobar control window. 

Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2015-09-22 15:20:42
I curse last.fm every single day for messing up the API (and hence playcount sync) with the update



the background updates as you listen still work. it's only the bulk import that is broken.

Unfortunately, it appears the background updates are now broken, too. Play counts don't get updated anymore. I get the following error in the console:
Code: [Select]
Last.fm Playcount Sync: {"error":6,"message":"Track not found","links":[]}
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-22 15:41:46
it's working fine for me. are you seeing that message with every track or just some?
Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2015-09-22 15:47:13
are you seeing that message with every track or just some?
I'm seeing it with every track I've played back today. It was working fine last night. Now, it happens with some tracks.

This is a track which doesn't work:
Code: [Select]
Opening track for playback: "D:\Music\A Split - Second - Flesh (1991 Remix)\05 A Split - Second - Flesh (Slow).flac"
Audioscrobbler: Submitting track...
Audioscrobbler: Submission succeeded.
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: {"error":6,"message":"Track not found","links":[]}

This is a track which works:
Code: [Select]
Opening track for playback: "D:\Music\Aphex Twin - I Care Because You Do\09 Aphex Twin - Mookid.flac"
Last.fm Playcount Sync: Contacting Last.fm....
Last.fm Playcount Sync: Last.fm responded ok. Attempting to update playcount...
Last.fm Playcount Sync: Playcount updated successfully.
Audioscrobbler: Submitting track...
Audioscrobbler: Submission succeeded.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-22 16:01:51
well unfortunately i can't do anything about it. the API is working as expected - it's just not liking some tracks for whatever reason. if you can still view them under the library pages of your user account on the last.fm site, it might start working again sometime in the future.
Title: WSH Panel Mod script discussion/help
Post by: audiophool on 2015-09-22 16:35:45
well unfortunately i can't do anything about it.

Sure, I understand. Thanks for your thoughts on the issue.
Title: WSH Panel Mod script discussion/help
Post by: pIv on 2015-09-22 17:14:56
that's not happening as it would require a lot of editing and i'm lazy.

just put thumbs in custom folder mode and it will display all images in the currently playing track's folder. you can even modify the folder it uses and it supports whatever title formatting you like but it works at a folder level, not file.


I definitely like you!
Such a simple solution at the lowest cost.
Title: WSH Panel Mod script discussion/help
Post by: seriousstas on 2015-09-22 21:17:40
I created a script thumbs + last.fm bio.txt, using ideas from the script album art + allmusic review.txt (wsh_marc2003-v8).

Excellent work!
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-23 01:28:50
@marc2003

You kind of unwittingly provided a perfect solution for this question (https://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=902595) I had a while back. Your latest ratings script uses guifx v2 fonts instead of images which is exactly what I am using in my ELPlaylists. Also proved to be far easier to beat into shape than the previous renditions. Had to edit a couple of minor things in two of the provided scripts. Basically changed it so it only shows one icon instead of five and which icon is used. Side bonus is not writing to file since it uses the play count component and an extra playlist isn't required if I miss the one minute window.

Image (http://i.imgur.com/60mAg7z.gif)

Thanks again for sharing these.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-25 13:31:22
i have a new script for submitting plays from foobar2000 to the new listenbrainz service. it's provided by the same people who run musicbrainz. you can read about it here:

http://listenbrainz.org/ (http://listenbrainz.org/)

it's only at alpha stage and all you can do is view your submitted plays. things like stats, recommendations, etc are in their future plans but don't expect much for now. also, check their import page. that can import all your plays from last.fm to their site.

my script is available here: https://github.com/19379/wsh_listenbrainz (https://github.com/19379/wsh_listenbrainz)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-25 16:32:04
i've just updated the above script with a whole load of tag remapping that needs to be done to make it play nice with their whitelist of acceptable tags.
Title: WSH Panel Mod script discussion/help
Post by: bloodclot on 2015-09-26 03:21:04
i have a new script for submitting plays from foobar2000 to the new listenbrainz service. it's provided by the same people who run musicbrainz. you can read about it here:

http://listenbrainz.org/ (http://listenbrainz.org/)

it's only at alpha stage and all you can do is view your submitted plays. things like stats, recommendations, etc are in their future plans but don't expect much for now. also, check their import page. that can import all your plays from last.fm to their site.

my script is available here: https://github.com/19379/wsh_listenbrainz (https://github.com/19379/wsh_listenbrainz)

so fed up with last.fm. THERE IS HOPE!

Thank you!
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-09-27 15:38:14
Does someone know?
How many requests can be send from same IP to Last.fm server?
Currently i have 2 scripts with same API: YT Radio and Genre Tag which parse diferent url reponses.
This 2 scripts will send 2 request per sec, on track play..
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-27 15:58:12
5 requests per second. you'd know this if you read the "terms of service" when you applied for your API key.

Quote
You will not make more than 5 requests per originating IP address per second, averaged over a 5 minute period, without prior written consent.


the way that is worded, it looks like you can make many more requests per second so long as you don't go over 1500 in any 5 minute period.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-27 16:04:22
JS Smooth Browser 1st beta available for those interrested by:

(http://orig12.deviantart.net/726b/f/2015/270/2/0/js_smooth_browser_beta20150927_1630_by_br3tt-d9b2ujl.png)

link (http://fav.me/d9b2ujl)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-27 16:13:21
18MB? that's a lot of code!!

(i'm sure there is something else in there as well.. )

edit: trying to that run that script with portable foobar + music on a usb stick = fail. i'll try again when i have my own computer built in the week.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-09-27 16:19:37
5 requests per second. you'd know this if you read the "terms of service" when you applied for your API key.

Quote
You will not make more than 5 requests per originating IP address per second, averaged over a 5 minute period, without prior written consent.


the way that is worded, it looks like you can make many more requests per second so long as you don't go over 1500 in any 5 minute period.


Thanks. This is impossible in normal use. But what i want, is to be able to tag all my files from library playlist.
I was tag 17 000 files to test this, and more 2000 today, nothing bad happens 
Request is send every 2 sec..


Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-27 17:01:04
18MB? that's a lot of code!!

(i'm sure there is something else in there as well.. )

edit: trying to that run that script with portable foobar + music on a usb stick = fail. i'll try again when i have my own computer built in the week.


ahah, 18MB for the GENRE image pack included , script is only 24 kb ...

ok, tell me how it turns on your PC and what's this "fail". Thank you.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-27 17:14:27
foobar goes unresponsive making it unusable. it's because it's a thin client pc with a single core VIA cpu @ 1000MHz and my music is on microSDXC card inside a sansa clip+ mp3 player which has really slow read/write speeds. EsPlaylist in library mode works fine on the same setup but i guess that's because it can run at a lower priority. we have no such control with WSH panel and it will use all the resources it can.

Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-27 17:26:35
foobar goes unresponsive making it unusable. it's because it's a thin client pc with a single core VIA cpu @ 1000MHz and my music is on microSDXC card inside a sansa clip+ mp3 player which has really slow read/write speeds. EsPlaylist in library mode works fine on the same setup but i guess that's because it can run at a lower priority. we have no such control with WSH panel and it will use all the resources it can.


normal with this kind of config ...  try on a true PC with a HDD
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-27 18:09:56
Could it be made to use default stub image instead of the generated no art/image found it uses now?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-27 18:18:15
Could it be made to use default stub image instead of the generated no art/image found it uses now?


? it already does, it's native in foobar2000 preferences, there is a field to set the stub image path, see image below

(http://i.imgur.com/hKTuStF.png)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-27 18:31:11
Sorry... I have about ten different portable installs for testing right now and, of course, I opened the one that wasn't set.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-27 18:56:18
Sorry... I have about ten different portable installs for testing right now and, of course, I opened the one that wasn't set.


no problem, your need is filled, that's the most important
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-09-27 20:14:29
JS Smooth Browser 1st beta available for those interrested by:


always interested in your work!

the WSH panel v.156+ is difficult to find and probably a reason for other errors people have posted.


Fantastic response time - I'm using FB over network with 14K+ albums and it works great! I'm guessing prefs will improve later after beta? It would be nice to change label font size and fields displayed.

One issue - the cover display does not seem to take Foobar preferences?
Many of my covers are displaying wrong (back or other images instead of cover.*)

Also not sure if WSH limitation - but if I select an album, it would be nice if other components (like your jsplaylist) follow selection? (and also vice versa - smooth browser can follow selection)
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-27 20:19:35
JS Smooth Browser 1st beta available for those interrested by:


always interested in your work!

the WSH panel v.156+ is difficult to find and probably a reason for other errors people have posted.


Fantastic response time - I'm using FB over network with 14K+ albums and it works great! I'm guessing prefs will improve later after beta? It would be nice to change label font size and fields displayed.

One issue - the cover display does not seem to take Foobar preferences?
Many of my covers are displaying wrong (back or other images instead of cover.*)

Also not sure if WSH limitation - but if I select an album, it would be nice if other components (like your jsplaylist) follow selection?


covers are those set in foobar200 preferences, so it should work as all other foobar2000 panels that uses cover art. Check your settings and if you are sure there is a problem, report it here please, i'll check it
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-09-27 20:32:39
report it here please, i'll check it


yes, I'm sure - notice SB versus your correct jsplaylist display:

(http://i.imgur.com/7vuVtf9.jpg)

also - different issue - any idea why that green "83" appears in your jsplaylist at the upper right corner?
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-27 21:08:56
@mjm716

ok, i think i know why front cover is bad in some case. it's due to the cache engine and because you have multiple images in the album folder (right ?), and the script look for front.* or cover.* pattern name only ...
if not found, it take the first image found in the folder (*.*)

if your front cover is named differently than front.* or cover.*, seek for this line in the script:

var cover_img = "*front*.*-*cover*.*-*.*".split("-");

and change the pattern according to yours, for example, if your front covers are named "folder.jpg", remplace the line with:

var cover_img = "*folder*.*-*cover*.*-*.*".split("-");

HTH
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-27 22:00:58
@Falstaff

Is the follow playlist option working as intended? It's doing some really weird things like not selecting items in the playlist and a double click on anything seems to trigger the first item it encounters. No matter what. I placed it in a tab and Facets in another. Facets, in Playlist mode, does pretty much what I'd expect it to. Not sure if this is what you intended or not. Some clarification please.
Title: WSH Panel Mod script discussion/help
Post by: mjm716 on 2015-09-27 22:11:54
ok, i think i know why front cover is bad in some case



thanks - all my front covers are cover.*

I changed it to: var cover_img = "cover.*"

and deleted the cache.

Looking forward to future versions - great work!


PS: also updated by jsplaylist script to 1.32 and the green "83" disappeared.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-28 07:24:14
@Falstaff

Is the follow playlist option working as intended? It's doing some really weird things like not selecting items in the playlist and a double click on anything seems to trigger the first item it encounters. No matter what. I placed it in a tab and Facets in another. Facets, in Playlist mode, does pretty much what I'd expect it to. Not sure if this is what you intended or not. Some clarification please.


if you're talking about JSSBrowser, this panel do not follow anything. a double click on an item send its content to Library selection playlist and play the 1st track of this item. a single click just send the content to the playlist (not that CTRL key allow you to Add the item contents (tracks) to the Library selection playlist, without clearing it.

i hope that explain you things. if you encounter another behaviour, please, tell me, it's maybe a bug. Thanx
Title: WSH Panel Mod script discussion/help
Post by: nikolai4ik on 2015-09-28 10:39:29
Updating from 1.5.6 to 1.5.10 - every panel says 'crashed' and this popup appears:

WSH Panel Mod (Damask Art Panel): Microsoft JScript runtime error:
Object doesn't support this property or method
File: <main>
Line: 2006, Col: 14
<source text only available at compile time>

Is there a fix?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-28 11:27:58
assuming you downloaded the component from the uploads forum here on HA, you really should read the text that accompanies the download link...

https://www.hydrogenaud.io/forums/index.php?showtopic=108811 (https://www.hydrogenaud.io/forums/index.php?showtopic=108811)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-28 15:26:50
@Falstaff, since i saw someone on your DA page not having the right component version, here's a way you can detect if it has the required features...

Code: [Select]
if (!("GetLibraryItems" in fb))
    fb.ShowPopupMessage("This script requires WSH panel mod v1.5.9 or higher.\n\nhttps://www.hydrogenaud.io/forums/index.php?showtopic=108811");
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-28 17:23:41
@marc2003
why not will be done soon

have you tested ?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-28 17:51:35
if you mean that code snippet then yes.

if you mean have i tested your script on a proper pc? no. i won't have my own pc running until wednesday.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-28 17:54:35
option #2 ... ok
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-28 19:36:51
if you're talking about JSSBrowser, this panel do not follow anything. [...]


So...are there plans for it to follow whatever playlist is active? I'm curious why it would be an option otherwise.
Title: WSH Panel Mod script discussion/help
Post by: Falstaff on 2015-09-28 20:18:57
if you're talking about JSSBrowser, this panel do not follow anything. [...]


So...are there plans for it to follow whatever playlist is active? I'm curious why it would be an option otherwise.


as said, this is an earlier beta, all features aren't implemented yet, so, it could be added later, i can't tell yet. for now it is a library browser, simple, nothing more
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-09-29 14:20:28
I have this in Tag ''Similar'' in mp3:

''Howard Hewett,Keith Washington,Jeffrey Osborne,Miki Howard,Freddie Jackson,Gerald Levert,Lalah Hathaway,Phil Perry,Chanté Moore,Anita Baker,Eric Benét,Atlantic Starr,Mint Condition,Johnny Gill,Regina Belle,Stephanie Mills,Kem,Karyn White,Angela Winbush,L.T.D.,LeVert,Kindred The Family Soul,Frank Mccomb,Rachelle Ferrell,Najee,Boney James,The Whispers,Peabo Bryson,After 7,Carl Thomas,Gerald Albright,Patti LaBelle,Troop,Al B. Sure!,Kenny Lattimore,Patti Austin,George Howard,Tevin Campbell,Rahsaan Patterson,Norman Brown,Jaheim,Jonathan Butler,Dave Hollister,Kirk Whalum,Teena Marie,Pieces Of A Dream,Silk,Hil St. Soul,Walter Beasley,Ledisi ''

How can i add all files from ''Similar'' in Autoplaylist:

I try this:

fb.CreateAutoPlaylist(fb.PlaylistCount, "Tag", "%artist% HAS " + similar.split('/'));

But this adds only one random artist, i need to add all artists from Tag.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-29 16:07:11
since listenbrainz updated their site to https, my previous script no longer works. an updated version is available here

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

it's now part of my main package of scripts and has a button/menu instead of settings inside the script.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-29 16:22:29
@mire777, try something like...

Code: [Select]
var similar = "Howard Hewett,Keith Washington,Jeffrey Osborne,Miki Howard,Freddie Jackson,Gerald Levert,Lalah Hathaway,Phil Perry,Chanté Moore,Anita Baker,Eric Benét,Atlantic Starr,Mint Condition,Johnny Gill,Regina Belle,Stephanie Mills,Kem,Karyn White,Angela Winbush,L.T.D.,LeVert,Kindred The Family Soul,Frank Mccomb,Rachelle Ferrell,Najee,Boney James,The Whispers,Peabo Bryson,After 7,Carl Thomas,Gerald Albright,Patti LaBelle,Troop,Al B. Sure!,Kenny Lattimore,Patti Austin,George Howard,Tevin Campbell,Rahsaan Patterson,Norman Brown,Jaheim,Jonathan Butler,Dave Hollister,Kirk Whalum,Teena Marie,Pieces Of A Dream,Silk,Hil St. Soul,Walter Beasley,Ledisi";
var arr = similar.split(",");
var query = "";
for (var i = 0; i < arr.length; i++) {
    query += "artist HAS " + arr[i];
    if (i < arr.length - 1)
        query += " OR ";
}


i've not tested fb.CreateAutoPlaylist to see how long the query strings can be.
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-09-29 17:20:33
@mire777, try something like...

i've not tested fb.CreateAutoPlaylist to see how long the query strings can be.



Thanks, it works

Code: [Select]
var arr = similar.split("/");
var query = "";
for (var i = 0; i < arr.length; i++) {
    query += "artist HAS " + arr[i];
    if (i < arr.length - 1)
        query += " OR ";
}

function del()
{
fb.ActivePlaylist = (GetPlaylistID("Genre"));    
var PL_NM = (GetPlaylistID("Genre"));
if (fb.ActivePlaylist == PL_NM) { fb.RemovePlaylist(PL_NM)}
}

del();

fb.CreateAutoPlaylist(fb.PlaylistCount, "Genre", query);
                set_focus();
                fb.Play();
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-09-29 19:51:01
@marc2003

There a trick to use custom backgrounds for newest menu button sample?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-09-29 20:48:48
i've updated it...

https://github.com/19379/wsh_marc2003/blob/...nu%20button.txt (https://github.com/19379/wsh_marc2003/blob/decd3575603081f44440675400f749b3e0ed36c6/samples/menu%20button.txt)
Title: WSH Panel Mod script discussion/help
Post by: kornkid5622 on 2015-09-30 18:07:42
would it be possible to make it so you can change the artist field mapping with the thumbs script? i keep featured artists in the artist tag so using %album artist% for this would be great.

thanks alot for the scripts either way
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-01 11:54:23
the script should have that feature but i've missed it out. right click the panel>configure. replace

Code: [Select]
var panel = new _.panel("Thumbs", ["metadb", "custom_background"]);


with

Code: [Select]
var panel = new _.panel("Thumbs", ["metadb", "custom_background", "remap"]);
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-10-01 18:36:45
Now I'm using Br3tt's foo_Razor Skin after some modification.
There is a toggle script which changes the panel size according "Toggle" state.
I figured out that the panel color can be changed by 'var COLOR_BTNFACE'.
I want to make the color of this panel change between two colors according to the panel size.
For example, for the width=390 : Black, for the width=1 : White.
I'd like to know if this is possible and where I have to change.
Thank you for reading and helping.

Code: [Select]
var COLOR_BTNFACE = 15;
var toggle = window.GetProperty("toggle", false);
var ww = 0, wh = 0;
//var COLOR_BTNFACE = 15;
var g_syscolor = 0;

function get_colors() {
g_syscolor = utils.GetSysColor(COLOR_BTNFACE);
}
get_colors();

// START
function on_size() {
ww = window.Width;
wh = window.Height;
if(toggle) {
window.MinWidth = 390;
window.MaxWidth = 390;
} else {
window.MinWidth = 1;
window.MaxWidth = 1;
};
window.MinHeight = 4;
window.MaxHeight = 4;
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_syscolor);
}

function on_mouse_lbtn_up(x, y) {
toggle = !toggle;
window.SetProperty("toggle", toggle);
if(toggle) {
window.MinWidth = 390;
window.MaxWidth = 390;
} else {
window.MinWidth = 1;
window.MaxWidth = 1;
};
}

function on_colors_changed() {
get_colors();
window.Repaint();
}

function on_notify_data(name, info) {
switch(name) {
case "left_pane":
toggle = !toggle;
window.SetProperty("toggle", toggle);
if(toggle) {
window.MinWidth = 390;
window.MaxWidth = 390;
} else {
window.MinWidth = 1;
window.MaxWidth = 1;
};
break;
}
}

function on_mouse_rbtn_up(x, y) {
return true;
}
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-10-02 04:20:54
I'm modifying a display panel and I was wondering if anyone can help me find the proper tags to display encoding (lossless), bitspersampe (IE 16 /24).

I'm using commands like:

}

Info.prototype.setBitrate = function() {
   this.Bitrate = fb.TitleFormat("%bitrate%").Eval();
}

Tags like "bitrate", "samplerate" and "codec" display fine.  But "encoding" and "bitspersample" do not. Are there other official terms for these tags?

Thanks
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-02 05:02:58
http://wiki.hydrogenaud.io/index.php?title...l_information_2 (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Technical_information_2)

Should be what you are looking for.
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-10-02 06:55:43
Thanks. But to answer my own question, I figured it out:

}

Info.prototype.setBitrate = function() {
this.Bitrate = fb.TitleFormat("$info(bitspersample)").Eval();
}

You'd think it would be "%bitspersample%", but no...it couldn't be THAT easy.  Same thing applies to encoding. (Although oddly, encoding displays as lower case only)
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-10-02 07:11:26
Is there a way to force a font to display uppercase only? IE: Getting "lossless" to display as "LOSSLESS".
Title: WSH Panel Mod script discussion/help
Post by: Majestyk on 2015-10-02 08:21:29
Is there a way to force a font to display uppercase only? IE: Getting "lossless" to display as "LOSSLESS".


Never mind.  To get upper, you would go: $upper($info(encoding))
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-06 15:03:15
@marc2003

How painful would it be to parse embedded images with the thumbs script? Noticed Falstaff's CoverFlow displays them and was wondering if this could as well.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-06 17:20:24
i've not tested it because i can't be bothered to embed any art but this should work. open thumbs.js in a decent text editor and find this...

Code: [Select]
this.images = _.map(this.files, _.img);


insert this directly after it...

Code: [Select]
var tmp = utils.GetAlbumArtEmbedded(panel.metadb.RawPath, 4); //4 assumes you want the artist image
if (tmp) {
    this.files.unshift(panel.metadb.Path);
    this.images.unshift(tmp);
}


unshift puts the embedded image first. if you want it last, use push instead.
Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2015-10-06 18:46:32
Hi, i'm getting this error when trying to import library with lastfm playcount sync

Quote
Last.fm Playcount Sync: {"error":26,"message":"API Key Suspended - This application is not allowed to make requests to the web services"}


any help?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-06 23:22:35
where to begin....

that api key is no longer valid.
last.fm are not allowing anyone to register for a new api key.
even if you did have an api key, the import doesn't even work any more
Title: WSH Panel Mod script discussion/help
Post by: MaCs on 2015-10-06 23:56:21
Hi marc2003, how do I set the background colour in the rating panel? I can't figure it out. Thanks!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-07 00:06:06
i did add "custom_background" as an option but i forgot to include this function which is needed for it to work.

Code: [Select]
function on_mouse_rbtn_up(x, y) {
    return panel.rbtn_up(x, y);
}


just paste it at the end inside the panel.

Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-07 04:49:37
Do you have a legend for this?

Code: [Select]
 var tmp = utils.GetAlbumArtEmbedded(panel.metadb.RawPath, 4); //4 assumes you want the artist image


EG: cycle through all types embedded if that is enabled.

Mainly interested in cover & artist but not sure what the key for each is.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-07 04:57:15
check flags.txt inside the docs folder. but if you just want the front, it's 0.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-07 05:39:27
Can it be variable? If (any) present = display.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-07 07:40:32
do you really think the answer to that question could be no?
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-07 07:58:11
Sorry, man. Just asking. Not sure where to look for an example that allows it go both ways.

EG: two panels > one displays embedded (say cover) > one uses embedded artist image without conflicting

edit: clarified example
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-07 08:04:53
just use an artwork panel?? check file>preferences>advanced>display>album art>embedded vs external.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-07 08:16:46
Yeah, I could do that. I like how your script centers the image is all. Mostly it was just curiosity if it could done as a fallback method if encountered.

Thanks.

edit: Just because.

(http://i.imgur.com/jKILiam.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-07 08:27:31
you can modify the album art script so it has borders around the edge. replace

Code: [Select]
function on_size() {
    panel.size();
    albumart.w = panel.w;
    albumart.h = panel.h;
}


with

Code: [Select]
function on_size() {
    panel.size();
    albumart.x = albumart.y = 20;
    albumart.w = panel.w - 40;
    albumart.h = panel.h - 40;
}

Title: WSH Panel Mod script discussion/help
Post by: nickdc on 2015-10-07 08:27:44
where to begin....

that api key is no longer valid.
last.fm are not allowing anyone to register for a new api key.
even if you did have an api key, the import doesn't even work any more
I see. Anyway any chance to get this script working again?

Code: [Select]
//show if a track is loved
$ifequal(%LASTFM_LOVED_DB%,1,♥,)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-07 08:33:42
Oh ffs...I completely forgot that script. 

And that border trick is lovely. Thanks.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-07 14:44:46
I see.


really? IF you already have an API key then you should be able to play tracks and get playcounts updated as you listen. the function to import playcount is completely broken at last.fm's end and there are no workarounds. loving tracks and authenticating passwords is also broken in the old script. it's possible to workaround those last 2 issues but it hardly seems worth it any more.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-09 20:45:46
i've added a simple track info + seekbar + buttons script to my samples...

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

it looks like this...

http://i.imgur.com/wGPtT9B.png (http://i.imgur.com/wGPtT9B.png)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-10 01:48:42
That's nice. Would a 'Show now playing in playlist' option be possible if one were to click on the info over there?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-10 05:11:06
i've updated the script on github but i can't bothered to do a new release just yet. you can grab the single file here...

https://raw.githubusercontent.com/19379/wsh...B%20buttons.txt (https://raw.githubusercontent.com/19379/wsh_marc2003/895bcaaf84748013bb93c9fbe83f294354d85a37/samples/track%20info%20%2B%20seekbar%20%2B%20buttons.txt)
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-10 12:42:16
That's even better than what I'd imagined. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-10 16:45:01
here's another update.

https://raw.githubusercontent.com/19379/wsh...B%20buttons.txt (https://raw.githubusercontent.com/19379/wsh_marc2003/b6f29c54aeb9f4b8b5bd9b74c17cd0e1808dba31/samples/track%20info%20%2B%20seekbar%20%2B%20buttons.txt)

this adds a bit more space between the track info and time when they're too long.

edit: another update fixes a weird issue with the header text disappearing with my text reader script...

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)
Title: WSH Panel Mod script discussion/help
Post by: Jokeezy on 2015-10-11 07:12:06
here's another update.

https://raw.githubusercontent.com/19379/wsh...B%20buttons.txt (https://raw.githubusercontent.com/19379/wsh_marc2003/b6f29c54aeb9f4b8b5bd9b74c17cd0e1808dba31/samples/track%20info%20%2B%20seekbar%20%2B%20buttons.txt)

this adds a bit more space between the track info and time when they're too long.

edit: another update fixes a weird issue with the header text disappearing with my text reader script...

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)


Hello, can you help me for update the script please ? Because he doesn't download pictures & bio
(It's a script who you made just for me)

http://pastebin.com/NKh0U5g4 (http://pastebin.com/NKh0U5g4)

Thank's
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-11 13:22:51
Can wsh panels be used to trigger stacked panels? I was messing around with this (http://i.imgur.com/ld94Ty2.gif) and it got me thinking. That left panel only swaps what is displayed in a single panel on the right. Problem is those two are tightly tied to each other. But if stacked panels could be swapped then you could use more current scripts in a modular way.

Crazy maybe?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-12 07:44:33
a basic now playing script has been added to my samples. it only displays track info, images and a bio which work with the last.fm changes.

https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

That left panel only swaps what is displayed in a single panel on the right.


"only"?? it's doing whatever you tell it. i need a translator for the rest of your post.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-12 08:19:41
Heh, yeah. Made the post after too many hours of staring at it and getting a touch loopy in the process.

I think I'd asked this previously and the answer is no. Though at the time I was curious about it manipulating panels other than WSH types. Which got me thinking on how to do this differently (again). Short version would be to toggle various scripts in the display wsh panel on the right like a set of PSS buttons. Only instead of being strictly proprietary scripts as shown, a person could use scripts such as yours or Falstaff's based on their needs.

I have a feeling that's probably much more complicated than what I have rolling around in the dust bin upstairs. I could do a crappy mockup I suppose if that would help.

EDIT: There are two wsh panels in use there. The "control" and the "display" so to speak. From what I can tell it uses notifyOthers somehow to get the job done. Only other config I've noticed that used on was Falstaff's fooRazor. There may be others but that one is certain.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-12 10:15:34
you want to reuse a single panel and have it switch scripts inside based on receiving messages from another panel? it's certainly possible but i really wouldn't waste time on it because the implementation would be so much more difficult than using panel stack splitter.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-12 10:54:00
That's understandable. Though it should work in DUI or CUI which would make it somewhat more useful for DUI users.

Hmm, would a single wsh panel implementation be more realistic?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-12 11:37:42
this why i was thinking of a single panel...

Quote
Only instead of being strictly proprietary scripts as shown, a person could use scripts such as yours or Falstaff's based on their needs.


IIRC foo razor resizes panels but the minimum size you can go in default UI is 4 pixels so each panel needs to be coded to display a blank background when resized that small. also, some panels might even crash or produce other undesirable behaviour. you can hardly blame script writers for not testing such things because it's not a normal thing for people to be doing.

Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-12 14:52:33
here's a very crude example of a single panel that will load any script you tell it to:

Code: [Select]
//this is just a default. any script sent later will be saved and remembered on next startup
var script = window.GetProperty("script", "wsh_marc2003\\samples\\album art.txt");
var pre = "";
var text = utils.ReadTextFile(fb.ProfilePath + script);
var lines = text.split("\n");
if (lines[0].indexOf("// ==PREPROCESSOR==") == 0) {
    for (var i = 0; i < lines.length; i++) {
        if (lines[i].indexOf("// @import") == 0) {
            var file = lines[i].substr(lines[i].indexOf("\"") + 1, lines[i].lastIndexOf("\"") - 12);
            pre += utils.ReadTextFile(file.replace("%fb2k_profile_path%", fb.ProfilePath)) + "\n";
        }
        if (lines[i].indexOf("// ==/PREPROCESSOR==") == 0)
            break;
    }
}
text += "function on_notify_data(name, info) { if (name == \"load_script\" && utils.FileTest(fb.ProfilePath + info, \"e\")) { window.SetProperty(\"script\", info); window.Reload(); }}";
eval(pre + text);


3 points:
it requires my modded WSH panel (v1.5.7.1 or later, v1.5.7 won't work)
it will break any other on_notify_data function contained in the loaded script because i'm overwriting it with my own function at the end
all scripts must be inside your profile folder. you just supply the folder it lives in...

Code: [Select]
window.NotifyOthers("load_script", "wsh_br3tt\\jsplaylist\\jsplaylist main script.txt");


edited: left a few typos in there.
Title: WSH Panel Mod script discussion/help
Post by: Mr. Mustard on 2015-10-12 15:45:36
I think I've arrived at a decent setup but I want a seekbar/buttons/volume that is more ascetically pleasing. Something like

http://i.imgur.com/ynpGU3u.png (http://i.imgur.com/ynpGU3u.png)

where the time is on the sides and also a bar that displays the current paying track like

https://foobar2000.files.wordpress.com/2009...omplexideas.jpg (https://foobar2000.files.wordpress.com/2009/01/00_complexideas.jpg).

I have no idea what i'm doing scripting-wise but I do have WSH panel mod.
Title: WSH Panel Mod script discussion/help
Post by: foosion on 2015-10-12 16:00:40
it will break any other on_notify_data function contained in the loaded script because i'm overwriting it with my own function at the end
You could avoid this if you install the callback using the following code. For readability this version is indented and not quoted.
Code: [Select]
(function(global){
    var original_callback = global.on_notify_data;
    global.on_notify_data = function(name, info) {
        if (name == "load_script") {
            if (utils.FileTest(fb.ProfilePath + info, "e")) {
                window.SetProperty("script", info);
                window.Reload();
            }
        } else if (original_callback) {
            original_callback(name, info);
        }
    }
})(this);
Of course it still breaks if the loaded script installs the on_notify_data callback later on.
Title: WSH Panel Mod script discussion/help
Post by: elia_is_me on 2015-10-12 16:20:21
this why i was thinking of a single panel...

Quote
Only instead of being strictly proprietary scripts as shown, a person could use scripts such as yours or Falstaff's based on their needs.


IIRC foo razor resizes panels but the minimum size you can go in default UI is 4 pixels so each panel needs to be coded to display a blank background when resized that small. also, some panels might even crash or produce other undesirable behaviour. you can hardly blame script writers for not testing such things because it's not a normal thing for people to be doing.




just agree
but utill now, DUI splitter's color could not be changed, so if two dark color panel separated by it, the hole UI will looks discordantly
that's why someone (like me) still want to have a one single (wsh) panel UI,
....
but... who knows... maybe one day, maybe just months later, someone maybe called ohyear or something else will develop a new splitter that can change its color or more...
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-12 17:10:48
that's why someone (like me) still want to have a one single (wsh) panel UI,



There already is one (http://nadirp.deviantart.com/art/Fusion-v2-4-1-1-Discontinued-Project-464482526). It is no long being developed but still works.
Title: WSH Panel Mod script discussion/help
Post by: evil roy on 2015-10-12 20:58:42
I am using WSH w/marc's latest (v1.4) thumbs script for last.fm artist images.  Apologies in advance if this was answered elsewhere but I'll be damned if I could find an answer.  The questions is, Is there a way to automatically download the images when a track is played?  As it stands I have to right click on the panel and select "Download Artist art from Last.fm" for every single missing artist photo--not a dealbreaker but definitely something I'd prefer to have handled w/out user intervention.

And FYI I have literally 0 programming experience, so feel free to dumb it down all the way for me.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-12 21:56:42
Of course it still breaks if the loaded script installs the on_notify_data callback later on.


that can't happen. from the changelog...

Code: [Select]
v1.5.0 Beta 4
- CHG: [Breaking Change] Callback functions now must be defined in global scope on script initialization (This change should not affect most scripts).


what you posted works fine in conjunction with on_notify_data functions already present in a few of my scripts so thanks for that.
Title: WSH Panel Mod script discussion/help
Post by: foosion on 2015-10-13 06:18:31
Bummer. In some regards WSH panel mod feels quite restricted compared to modern web technologies.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-13 06:24:18
I ran into a weird focus problem after messing around with your track info + seekbar + buttons script, marc. See here. (http://i.imgur.com/qYhGnkJ.gif)

Was testing to see if I could place things like volume and ratings in there instead of seekbar. Volume went smoothly and works as expected. Ratings not so much. Is there something I missed here? It's messy right now because I haven't finalized what I wanted to accomplish.

Code: [Select]
// ==PREPROCESSOR==
// @name "panel"
// @author "marc2003"
// @import "%fb2k_profile_path%wsh_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\helpers.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\panel.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\rating.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\volume.js"
// ==/PREPROCESSOR==

var panel = new _.panel("track info + buttons + seekbar", "Volume", "Rating", ["metadb", "custom_background"]);
var volume = new _.volume(0, 0, 0, 11);
volume.c1 = _.RGB(50, 50, 50);
volume.c2 = _.RGBA(128, 164, 164, 250);
var rating = new _.rating(0, 0, 16, _.RGBA(10, 10, 10, 220), _.RGBA(200, 200, 64, 250));
var buttons = new _.buttons();
var img = null;
panel.item_focus_change();
on_playback_new_track();



buttons.update = function () {
this.buttons.stop = new _.button((panel.w /2) - 90, (panel.h - 30) / 2, 30, 30, {normal : "ui_images\\1h.png"}, function () { fb.Stop(); }, "");
        this.buttons.previous = new _.button((panel.w / 2) - 54, (panel.h - 30) / 2, 30, 30, {normal : "ui_images\\2h.png"}, function () { fb.Prev(); }, "");
this.buttons.play = new _.button((panel.w / 2) - 18, (panel.h - 36) / 2, 36, 36, {normal : !fb.IsPlaying || fb.IsPaused ? "ui_images\\3h.png" :
 "ui_images\\4h.png"}, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? "" : "");
this.buttons.next = new _.button((panel.w / 2) + 24, (panel.h - 30) / 2, 30, 30, {normal : "ui_images\\5h.png"}, function () { fb.Next(); }, "");
//this.buttons.preferences = new _.button(panel.w - 50, (panel.h - 36) / 2, 36, 36, {normal : "mono\\appbar.settings.png"}, function () { fb.ShowPreferences(); }, "");
}

function on_size() {
panel.size();
buttons.update();
    volume.x = (panel.w + 210)/2;
volume.w = 80;
volume.y = (panel.h - 11)/2;
        rating.x = (panel.w - 380)/2;
        rating.w = 80;
        rating.y = (panel.h - 16)/2;
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, panel.w, panel.h, _.RGB(128, 164, 164));
        var pos = volume.pos();
        gr.FillSolidRect(volume.x, volume.y, volume.w, volume.h, _.RGB(100, 100, 100))
gr.FillSolidRect(volume.x+1, volume.y+1, volume.w-2, volume.h-2, volume.c1);
gr.FillSolidRect(volume.x+1, volume.y+1, volume.pos(), volume.h-2, volume.c2);
        rating.paint(gr);
        buttons.paint(gr);
   
if (fb.IsPlaying) {
img && _.drawImage(gr, img, 2, 2, panel.h-4, panel.h-4, image.centre);
gr.GdiDrawText(_.tfe("%title%"), panel.fonts.title, _.RGB(255, 255, 255), panel.h + 10, 0, 270, panel.h * 0.6, LEFT);
gr.GdiDrawText(_.tfe("%artist%"), panel.fonts.normal, _.RGB(255, 255, 255), panel.h + 10, panel.h * 0.3, 270, panel.h * 0.7, LEFT);
        gr.SetSmoothingMode(4);
//if (fb.PlaybackLength > 0) {
//var pos = seekbar.pos();
            //gr.FillSolidRect(seekbar.x, seekbar.y + 7, seekbar.w + 16, 6, _.RGB(160, 165, 165))
//gr.FillRoundRect(seekbar.x + pos, seekbar.y + 2, 16, 16, 8, 8, _.RGB(255, 255,255));
//gr.FillRoundRect(seekbar.x + pos + 3, seekbar.y + 5, 10, 10, 5, 5, _.RGB(196, 30, 35));
//gr.FillSolidRect(seekbar.x, seekbar.y + 7, pos, 6, _.RGB(255, 255, 255));
//gr.GdiDrawText(_.tfe("%playback_time%  "), panel.fonts.normal, _.RGB(255, 255, 255), seekbar.x - 60, 0, 60, panel.h, RIGHT);
//gr.GdiDrawText(_.tfe("  %length%"), panel.fonts.normal, _.RGB(255, 255, 255), seekbar.x + seekbar.w + 16, 0, 60, panel.h, LEFT);
//}
}
}

function on_metadb_changed() {
rating.metadb_changed();
}

function on_playback_new_track() {
var metadb = fb.GetNowPlaying();
if (!metadb)
return;
img && img.Dispose();
img = utils.GetAlbumArtV2(metadb, 0);
window.Repaint();
}

function on_volume_change() {
volume.volume_change();
}

function on_playback_stop() {
buttons.update();
window.Repaint();
}

function on_playback_pause() {
buttons.update();
}

function on_playback_starting() {
buttons.update();
}

function on_mouse_wheel(s) {
    volume.wheel(s);
}

function on_mouse_move(x, y) {
rating.move(x, y);
        volume.move(x, y);
        if (buttons.move(x, y))
return;
}

function on_mouse_leave() {
rating.leave();
        buttons.leave();
}

function on_mouse_lbtn_down(x, y) {
    volume.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
    volume.lbtn_up(x, y);
    rating.lbtn_up(x, y);
    if (buttons.lbtn_up(x, y))
return;
fb.RunMainMenuCommand("View/Show now playing in playlist");
}

function on_mouse_rbtn_up(x, y) {
return panel.rbtn_up(x, y);
}

EDIT: I altered playback buttons (used enter) to keep codebox here in the forums from running wide.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-13 07:59:33
inside the mouse move and lbtn_up functions, you should return if anything is true...

Code: [Select]
function on_mouse_move(x, y) {
    if (rating.move(x, y))
        return;
    if (volume.move(x, y))
        return;
    if (buttons.move(x, y)) //you don't really need to return after the last one!
        return;
}

function on_mouse_lbtn_up(x, y) {
    if (rating.lbtn_up(x, y))
        return;
    if (volume.lbtn_up(x, y))
        return;
    if (buttons.lbtn_up(x, y))
        return;
    fb.RunMainMenuCommand("View/Show now playing in playlist");
}


and for the rating, you should have this in your preprocessor section....

Code: [Select]
// @feature "v1.4"
// @feature "watch-metadb"


the latest WSH component (1.6.0 Beta 1) lets you omit these but it's a good idea to leave them present because they are absolutely required by earlier versions.

Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-13 08:12:39
That did the trick. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2015-10-13 13:39:30
Marc,

I am using your "track info + seekbar + buttons"
I didn't use Foobar for about a year.
Really want to now how to change the font in this script.
Can you help me?

Maybe obvious but can't find it in the forums.

Thx
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-13 15:04:25
define your fonts at the start of the script.

Code: [Select]
var font = _.gdiFont("name", size);


if you want bold then add 1 like this...

Code: [Select]
var font = _.gdiFont("name", size, 1);


then inside the on_paint function you'll find 2 uses of panel.fonts.normal/panel.fonts.title. replace those with the new font(s) you've created.
Title: WSH Panel Mod script discussion/help
Post by: Rhand on 2015-10-13 15:33:19
define your fonts at the start of the script.

Code: [Select]
var font = _.gdiFont("name", size);


if you want bold then add 1 like this...

Code: [Select]
var font = _.gdiFont("name", size, 1);


then inside the on_paint function you'll find 2 uses of panel.fonts.normal/panel.fonts.title. replace those with the new font(s) you've created.



Thx,
Works great.

Title: WSH Panel Mod script discussion/help
Post by: Jokeezy on 2015-10-15 01:18:45
Hello, thank you for the basic now playing script, it's perfect !

I use some old scripts like this :

(http://zupimages.net/up/15/42/dyu9.png)

Sample :

Code: [Select]
// LFM Panel for StrigUI
// reworked version of LastFM panel (so_kindly) with included LFM Love button from s8e skin by Maxim Terpilovsky

// ==PREPROCESSOR==
// @name "WSH Last.fm panel"
// @import "%fb2k_profile_path%\marc2003\scripts\Flags.js"
// @import "%fb2k_profile_path%\marc2003\scripts\Helpers.js"
// @import "%fb2k_profile_path%\marc2003\images\WSH LastFM\md5.js"
// @import "%fb2k_profile_path%\marc2003\scripts\WSH_LastFM.js"
// ==/PREPROCESSOR==

// Register here: http://www.last.fm/api/account


How can i add your new scripts like now playing new script, and save old scripts ?

And how can i put auto download of pictures on your new basic now playing scripts ?

Thank's
Title: WSH Panel Mod script discussion/help
Post by: JohnFlower on 2015-10-15 04:49:22
Hi,
Stupid question: how do I add an image to, for example, the 'last.fm bio' script? The WSH documentation is kinda lacking... Or maybe I'm looking in the wrong place. My changes:
Code: [Select]
//var lastfm_logo = gdi.CreateImage(1, 1);
var lastfm_logo = gdi.Image("%fb2k_profile_path%\themes\flower\images\misc\lastfm_logo.png");

function on_paint(gr) {
    panel.paint(gr);
    //gr.FillSolidRect(0, 0, panel.w, 24, panel.colours.header);
    gr.GdiDrawText(text.header_text(), panel.fonts.title, panel.colours.highlight, 5, 0, panel.w - 15, 30, LEFT);
    //DrawImage(IGdiBitmap, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, angle = 0, alpha = 255);
    gr.DrawImage(lastfm_logo, 5, 5, 139, 44, 0, 0, 139, 44);
    gr.DrawLine(panel.w - 5, 28, 5, 28, 1, panel.colours.highlight);
    text.paint(gr);
}

Replacing the rectangle with a line was simple enough, but the image is causing problems:
Code: [Select]
WSH Panel Mod (Last.fm Bio by marc2003): JavaScript runtime error:
Type mismatch
File: <main>
Line: 31, Col: 2
<source text only available at compile time>

I guess that the lastfm_logo isn't being loaded correctly... Why? I've tried using absolute paths and fb.FoobarPath. No dice.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-15 06:07:05
How can i add your new scripts like now playing new script, and save old scripts ?


just add more panels to your layout. if you're using any kind of scripts, you must already know how to do this!

and i'm not providing any method to automatically download images. if you don't like the current functionality then don't use it.

@JohnFlower

Code: [Select]
var lastfm_logo = gdi.Image(fb.ProfilePath + "themes\\flower\\images\\misc\\lastfm_logo.png");
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-15 08:00:16
@marc2003

I'm looking at tweaking properties and was wondering if title formatting can be used for two tags values (mood & rating) and if certain multi-value fields can be comma separated instead of $crlf()-esque like they are now. I have disabled autoplaylist creation and cursor change on hover because I prefer very specific APs to the click and create generated by this script.

Image (http://i.imgur.com/pEeglby.png).

Multi-value fields like genre and styles: Just a comma separated line of values straight out from field name. Doable?

Mood - Can something like code below be used? Pretty much a time stamp fetch.

Rating - Show dots/stars/some kind of font icon in place of numerical value?

Mood code from CUI Item Details panel below.

Code: [Select]
[LOVED  :  $if(%mood%,$select($day_of_month(%last_modified%),1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31) $select($month(%last_modified%),JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC) $year(%last_modified%))$crlf()]
Title: WSH Panel Mod script discussion/help
Post by: Jokeezy on 2015-10-15 08:12:46
How can i add your new scripts like now playing new script, and save old scripts ?


just add more panels to your layout. if you're using any kind of scripts, you must already know how to do this!

and i'm not providing any method to automatically download images. if you don't like the current functionality then don't use it.

@JohnFlower

Code: [Select]
var lastfm_logo = gdi.Image(fb.ProfilePath + "themes\\flower\\images\\misc\\lastfm_logo.png");



Why you say this ? In your olders scripts, the images on last fm are downloaded automatically...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-15 08:13:17
Quote
if you don't like the current functionality then don't use it.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-15 08:34:04
Hmm. Mood idea can get tanked. Sorry. I have some files that used a component Zao made that just sets a 1 or none Mood value. Falstaff's JS playlist versions sets the actual time stamp for a value.

Guess I'll have to pick one or the other.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-15 08:45:04
Quote
$select($day_of_month(%last_modified%),1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31)


there's a solution to a problem that doesn't exist.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-15 09:59:36
Heh. That was copied pretty much verbatim from a text display config I saw somewhere. It worked perfectly. Never thought twice about it after that.
Title: WSH Panel Mod script discussion/help
Post by: JohnFlower on 2015-10-15 23:29:11
@JohnFlower

Code: [Select]
var lastfm_logo = gdi.Image(fb.ProfilePath + "themes\\flower\\images\\misc\\lastfm_logo.png");
Awesome. Thanks~
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-17 12:34:38
Is there a way to make this stunt work?

Code: [Select]
{normal : !fb.IsPlaying || fb.IsPaused ? "mono\\3a.png", hover: "mono\\3h.png" : "mono\\4a.png", hover: "mono\\4h.png"}, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? "Play" : "Pause");
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-17 13:49:41
speak english.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-17 14:52:25
Add hover images.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-17 19:16:30
Quote
{normal : !fb.IsPlaying || fb.IsPaused ? "mono\\3a.png", hover: "mono\\3h.png" : "mono\\4a.png", hover: "mono\\4h.png"}


well you can't use hover more than once and if you want to use operators with ? and : then make sure they're formed like this.

Code: [Select]
condition ? "use this.png" : "else use this.png"
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-17 22:13:57
a couple of minor issues fixed here: https://github.com/19379/wsh_marc2003/releases (https://github.com/19379/wsh_marc2003/releases)

also, users of my autoplaylists/properties scripts need to make sure they have v11 or later if using the latest WSH component v1.6.0.
Title: WSH Panel Mod script discussion/help
Post by: WilB on 2015-10-18 17:41:13
A new version of YouTube Track Manager (v1.8) has been released.

  - *IMPROVED* radio modes, including:

  - *NEW* Library radio: offers similar artists, two genre modes (one uses music file genre tags; other is independent) & single artist. It uses last.fm similar artists and genre artists lists and your own track popularity data to bias towards playing your favourite music. Avoids YouTube tracks.

  - Album manager. *NEW* options for better integration with media library and automatically generating m-TAGS files using album track lists from MusicBrainz and last.fm. Albums can be built from exclusively media library tracks, exclusively YouTube links or a mixture of both where media library tracks are preferred.

  - Nowplaying panel. *NEW* image only mode (mouse middle click or menu): acts as an album artwork panel for covers and artist images. Dual functionality is useful if you no longer wish to look at album and track lists.

Download and full CHANGELOG here (https://www.hydrogenaud.io/forums/index.php?s=&showtopic=105522&view=findpost&p=909160).
Title: WSH Panel Mod script discussion/help
Post by: michtar on 2015-10-19 09:13:48
Add hover images.

I'm not sure what  you're trying to accomplish but since it's the only thing I managed to do (probably copied  ) while modifying .js buttons, three states play-pause with hover:
Code: [Select]
new button(0, 0, 28, 21, {normal: (fb.IsPlaying?(fb.IsPaused?"npause.png":"nplay.png"):"nPlayPause.png"), hover: (fb.IsPlaying?(fb.IsPaused?"cpause.png":"cplay.png"):"cPlayPause.png")}, function() { fb.PlayOrPause(); }),

Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-19 12:13:19
Exactly what I was after. Thanks.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-19 15:27:21
here's a quick and dirty example of using 2 WSH panels to mimic PSS panel switching...

(http://i.imgur.com/jwwkdTf.png)

the panel in the middle "listens" for notifications from the panel on the left and loads the appropriate script whenever text is clicked. it should be easy to figure out how to edit it.

these scripts require my current samples...

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003"
// @name "Panel Chooser"
// @import "%fb2k_profile_path%wsh_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\helpers.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\panel.js"
// ==/PREPROCESSOR==

var panel = new _.panel("Panel Chooser");
var row_height;
var index = -1;
var scripts = {
"Album art" : "wsh_marc2003\\samples\\album art.txt",
"Allmusic" : "wsh_marc2003\\samples\\allmusic review.txt",
"Last.fm Bio" : "wsh_marc2003\\samples\\last.fm bio.txt",
"Last.fm Info" : "wsh_marc2003\\samples\\last.fm artist info - user charts - recommendations - recent tracks.txt",
"Musicbrainz" : "wsh_marc2003\\samples\\musicbrainz.txt",
"News / Reviews / Blogs" : "wsh_marc2003\\samples\\echonest news - reviews - blogs.txt",
"Properties" : "wsh_marc2003\\samples\\properties.txt",
"Thumbs" : "wsh_marc2003\\samples\\thumbs.txt"
}

function on_size() {
panel.size();
}

function on_paint(gr) {
panel.paint(gr);
row_height = panel.fonts.title.Height + 10;
if (index < _.size(scripts))
gr.FillSolidRect(0, index * row_height, panel.w, row_height, panel.colours.header);
_.forEach(_.keys(scripts), function (item, i) {
gr.GdiDrawText(item, panel.fonts.title, panel.colours.text, 5, i * row_height, panel.w - 10, row_height, LEFT);
});
}

function on_mouse_move(x, y) {
var new_index = _.floor(y / row_height);
if (index != new_index) {
index = new_index
window.SetCursor(index < _.size(scripts) ? IDC_HAND : IDC_ARROW);
window.Repaint();
}
}

function on_mouse_lbtn_up(x, y) {
if (index < _.size(scripts))
window.NotifyOthers("load_script", _.values(scripts)[index]);
}

function on_mouse_leave() {
index = -1;
window.Repaint();
}

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003"
// @name "Panel Receiver"
// ==/PREPROCESSOR==

var script = window.GetProperty("2K3.SCRIPT", "wsh_marc2003\\samples\\album art.txt");
var pre = "";
var text = utils.ReadTextFile(fb.ProfilePath + script);
var lines = text.split("\n");
if (lines[0].indexOf("// ==PREPROCESSOR==") == 0) {
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf("// @import") == 0) {
var fq = lines[i].indexOf("\"") + 1;
var lq = lines[i].lastIndexOf("\"") - fq;
var file = lines[i].substr(fq, lq).replace("%fb2k_profile_path%", fb.ProfilePath);
pre += utils.ReadTextFile(file) + "\n";
} else if (lines[i].indexOf("// ==/PREPROCESSOR==") == 0) {
break;
}
}
}
eval(pre + text);
(function(global) {
var original_callback = global.on_notify_data;
global.on_notify_data = function(name, info) {
if (name == "load_script") {
if (utils.FileTest(fb.ProfilePath + info, "e")) {
window.SetProperty("2K3.SCRIPT", info);
window.Reload();
}
} else if (original_callback) {
original_callback(name, info);
}
}
})(this);
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-19 16:45:41
here's a quick and dirty example of using 2 WSH panels to mimic PSS panel switching...


Thanks a lot...now I have to start on a whole new batch of configs. 



aka: that's frickin' awesome. thanks!
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-20 15:08:30
@marc2003

Can you give any quick examples of how to replace the 'text buttons' with images? Using your last CUI config screenshot in the appearance thread as an example - left panel switcher icons. Though that is probably PSS, it's the look I'm trying to convey here. Mostly curious if a generic button image can be used and located automatically based on the number of scripts used. As it does it now with the text buttons. Just to make myself even clearer.

Currently your examples are like:

"Art" : "wsh_marc2003\\samples\\album art.txt",

Asking if:

"some generic button image" : "wsh_marc2003\\samples\\album art.txt",

Can be substituted.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-20 21:39:20
i'd forget about trying to mod that text based script and just use a button script. here's an example of 2 buttons to start off...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%wsh_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\helpers.js"
// ==/PREPROCESSOR==

var buttons = new _.buttons();

buttons.buttons.albumart = new _.button(0, 0, 36, 36, {normal : "mono\\appbar.cd.png"}, function () {
    window.NotifyOthers("load_script", "wsh_marc2003\\samples\\album art.txt");
}, "Album art");

buttons.buttons.properties = new _.button(0, 36, 36, 36, {normal : "mono\\appbar.information.circle.png"}, function () {
    window.NotifyOthers("load_script", "wsh_marc2003\\samples\\properties.txt");
}, "Properties");

function on_paint(gr) {
    //using dark background because those example images are white
    gr.FillSolidRect(0, 0, window.Width, window.Height, _.RGB(30, 30, 30));
    buttons.paint(gr);
}

function on_mouse_move(x, y) {
    buttons.move(x, y);
}

function on_mouse_leave() {
    buttons.leave();
}

function on_mouse_lbtn_up(x, y) {
    buttons.lbtn_up(x, y);
}


note that images don't have to be relative to my images folder like the examples above. you can specify the full path to an image and that would work as well. eg

Code: [Select]
fb.ProfilePath + "themes\\machinehead\\image1.png"
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-21 18:34:02
The button suggestion was ideal for placing buttons in your control script. Going for an all-in-one solution just got that much easier. Still unsure of exactly what I want to do, but I'm getting there. One thing I noticed with the receiver panel when properties.txt is used is it doesn't update like a stand alone panel would on metadata changes. EG: Rating or setting mood in stand alone will refresh and update in the panel. In the receiver version you need to click off/on track in the playlist to reflect the change. Not a big deal and maybe unavoidable.

Brace yourself - incoming crazy. How feasible is using the same script twice? In particular, Falstaff's JSSBrowser. Reason I'm asking is it can be configured in a number of ways. I have found in my PSS config that "source: playlist + column: album" in one panel and "source: library + column: artist" in another is really a great way to move around the library. However, your switcher is limited to whatever is in the text it's fed. My gut says this is a no go unless each script was unique and setup specifically for each. I have a Plan B but wondered if you could weigh in on it.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-21 18:48:09
1) the preprocessor section was incomplete. this should work...

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003"
// @name "Panel Receiver"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==


2) possible but you'd have to hack the receiver so it sets some panel properties specific for each script. you really need to be familiar with window.GetProperty and window.SetProperty to do it because i'm not doing it for you.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-10-24 19:18:04
@marc2003
Is it possible to change change type of text displays on your "Allmusic review"/"Last.fm Bio" scripts by changing something like
Code: [Select]
text.mode="allmusic";
text.mode="lastfm_bio";

I want to change it by a button, is it possible??

And can you put artist field remapping on Musicbrainz panel too
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-25 08:56:27
if you use my modded component version 1.5.7.1 or later...

Code: [Select]
var mode = window.GetProperty("mode", "allmusic");

var panel = new _.panel("Text Panel", ["metadb", "remap"]);
var text = new _.text(mode, 10, 24, 0, 0);


then one of your button functions could contain this...

Code: [Select]
window.SetProperty("mode", "lastfm_bio");
window.Reload();


as for the musicbrainz script, it only uses IDs and doesn't do any artist searches. although it uses the artist for the folder name, each filename contains the ID so you could have multiple artists with the same name sharing the same folder but each one would display its own releases correctly.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-10-26 15:09:59
if you use my modded component version 1.5.7.1 or later...

Code: [Select]
var mode = window.GetProperty("mode", "allmusic");

var panel = new _.panel("Text Panel", ["metadb", "remap"]);
var text = new _.text(mode, 10, 24, 0, 0);


then one of your button functions could contain this...

Code: [Select]
window.SetProperty("mode", "lastfm_bio");
window.Reload();

Thanks marc!! actually this opens up lot possibilities

Quote
as for the musicbrainz script, it only uses IDs and doesn't do any artist searches. although it uses the artist for the folder name, each filename contains the ID so you could have multiple artists with the same name sharing the same folder but each one would display its own releases correctly.

I see, I used the text file saved from your old script to tag musicbrainz ID's .And i must have forgotten to set formatting there :/
Anyway what do you use to tag musicbrainz ID's to  single tracks ( component only tag full albums ) ??
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-26 15:33:41
there is no software i know of for tagging single tracks with MBIDs. most of my single tracks are by artists already in my library so i just copied them over.

my current musicbrainz panel contains a right click menu item that searches launches a browser to search the MB website for the current artist when there is no MBID present. when you select the correct artist from the search results, you're taken to a page like this..

musicbrainz.org/artist/11c6b106-1c1f-429d-8407-b1ee155d7f72

the part in bold is what you want to save in the MBID artist tag.
Title: WSH Panel Mod script discussion/help
Post by: スラッシュ on 2015-10-26 23:57:59
I don't suppose we can get the playcount info from listenbrainz into our tags in some way yet, with the API stuff they released? The Playcount Sync script for last.fm is giving errors pretty often (on any song that hasn't been scrobbled before it gives errors for a while--it's weird). Since they messed everything up so badly, I'm itching to leave last.fm behind for greener pastures.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-27 10:58:59
if you want playback stats, use foo_playcount. that really is the only realistic solution at the moment.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-27 16:05:18
I think I should have asked this differently: post #4424 (https://www.hydrogenaud.io/forums/index.php?s=&showtopic=77883&view=findpost&p=909284). Could a single referenced font symbol be forced to replace the names without breaking the script if they are all the same? eg: If you rename the first two items in your chooser script to "Art" it will only use one instance regardless of what the following attached scripts are.

Images are fine in a monochrome background but if a gradient is applied you have to be very selective on color choices so they don't get washed out. Example (http://i.imgur.com/xw55v7T.gif). Ratings uses guifx '4' font and transitions nicely with alpha blending no matter what the background color is.

I didn't realize at the time that that would happen because I was testing in a monochrome setting. Kind of stumped trying to find an alternative here that does what I want.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-28 11:19:38
Quote
If you rename the first two items in your chooser script to "Art" it will only use one instance regardless of what the following attached scripts are.


yet again i have no idea what you are dribbling on about. if you can't look at the code in front of you and figure out how to change the font then you should just stop.
Title: WSH Panel Mod script discussion/help
Post by: MachineHead on 2015-10-28 14:25:06
Example spelled out explicitly.

Code: [Select]
var scripts = {
    "Art" : "wsh_marc2003\\samples\\album art.txt",
    "Art" : "wsh_marc2003\\samples\\allmusic review.txt",
    "Bio" : "wsh_marc2003\\samples\\last.fm bio.txt",
    "Bio" : "wsh_marc2003\\samples\\last.fm artist info - user charts - recommendations - recent tracks.txt",
    "Cat" : "wsh_marc2003\\samples\\musicbrainz.txt",
    "Cat" : "wsh_marc2003\\samples\\echonest news - reviews - blogs.txt",
    "Dog" : "wsh_marc2003\\samples\\properties.txt",
    "Dog" : "wsh_marc2003\\samples\\thumbs.txt"
}



Changing the font is not the issue. Reusing the same Name (symbol) more than once is.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-29 15:40:14
edit this instead...

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003"
// @name "Panel Chooser"
// @import "%fb2k_profile_path%wsh_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\helpers.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\panel.js"
// ==/PREPROCESSOR==

var panel = new _.panel("Panel Chooser");
var row_height;
var index = -1;
var scripts = [
    ["Album art", "wsh_marc2003\\samples\\album art.txt"],
    ["Allmusic", "wsh_marc2003\\samples\\allmusic review.txt"],
    ["Last.fm Bio", "wsh_marc2003\\samples\\last.fm bio.txt"],
    ["Last.fm Info", "wsh_marc2003\\samples\\last.fm artist info - user charts - recommendations - recent tracks.txt"],
    ["Musicbrainz", "wsh_marc2003\\samples\\musicbrainz.txt"],
    ["News / Reviews / Blogs", "wsh_marc2003\\samples\\echonest news - reviews - blogs.txt"],
    ["Properties", "wsh_marc2003\\samples\\properties.txt"],
    ["Thumbs", "wsh_marc2003\\samples\\thumbs.txt"]
];

function on_size() {
    panel.size();
}

function on_paint(gr) {
    panel.paint(gr);
    row_height = panel.fonts.title.Height + 10;
    if (index >=0 && index < scripts.length)
        gr.FillSolidRect(0, index * row_height, panel.w, row_height, panel.colours.header);
    _.forEach(scripts, function (item, i) {
        gr.GdiDrawText(item[0], panel.fonts.title, panel.colours.text, 5, i * row_height, panel.w - 10, row_height, LEFT);
    });
}

function on_mouse_move(x, y) {
    var new_index = _.floor(y / row_height);
    if (index != new_index) {
        index = new_index
        window.SetCursor(index < scripts.length ? IDC_HAND : IDC_ARROW);
        window.Repaint();
    }
}

function on_mouse_lbtn_up(x, y) {
    if (index < scripts.length)
        window.NotifyOthers("load_script", scripts[index][1]);
}

function on_mouse_leave() {
    index = -1;
    window.Repaint();
}

Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-10-30 07:07:19
there is no software i know of for tagging single tracks with MBIDs. most of my single tracks are by artists already in my library so i just copied them over.

my current musicbrainz panel contains a right click menu item that searches launches a browser to search the MB website for the current artist when there is no MBID present. when you select the correct artist from the search results, you're taken to a page like this..

musicbrainz.org/artist/11c6b106-1c1f-429d-8407-b1ee155d7f72

the part in bold is what you want to save in the MBID artist tag.

I did't saw that ,This is real handy


And for the panel chooser script if you add  a edit option that will open the relevant txt file in your text editor  (with  WshShell.Run("notepad.exe file\\path");  ) will be really usefull
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-10-30 12:40:02
if anybody who uses my scripts wants to use custom tooltip fonts i added in the latest version of WSH panel mod (https://github.com/19379/foo_uie_wsh_panel_mod/releases), you can save this file inside wsh_marc2003\js

https://raw.githubusercontent.com/19379/wsh...r/js/helpers.js (https://raw.githubusercontent.com/19379/wsh_marc2003/master/js/helpers.js)

restart foobar if running and then hold down shift and right click any panel that uses tooltips>Properties.

(http://i.imgur.com/ue3tlub.png)
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-11-03 22:33:16
for anyone using my track info + seekbar + buttons script, i've modified it so it easier to edit the colours. just mess with the RGB functions at the top of the script.

https://raw.githubusercontent.com/19379/wsh...B%20buttons.txt (https://raw.githubusercontent.com/19379/wsh_marc2003/master/samples/track%20info%20%2B%20seekbar%20%2B%20buttons.txt)
Title: WSH Panel Mod script discussion/help
Post by: SergioLeone on 2015-11-04 17:50:04
Hey guys,

I've tried to find the answer to my question via web-search but did not find anything that would help me. Is "loving" tracks still working for last.fm? My track playcount is woking like it used to, but loving a track does not work as it should - if I press "love track" button, the console gives the message "Last.fm Playcount Sync: Contacting Last.fm...." and nothing happens until the playcount updates, only then the heart appears next to updated playcount number. Any way to fix this? Cause loving tracks was a nice way to sort them in the library via filter.
I guess it has something to do with their new API policies, and probably this should not work and I'm lucky that it's working at all. But maybe there's a new workaround to make these functions work?
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-11-04 18:39:38
loving/unloving tracks works but it's the server response that is broken which means the script has no idea what's going on. you can update the script to workaround it here...

https://www.hydrogenaud.io/forums/index.php...mp;#entry907201 (https://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=4280&p=907201&#entry907201)



Title: WSH Panel Mod script discussion/help
Post by: SergioLeone on 2015-11-05 07:51:28
loving/unloving tracks works but it's the server response that is broken which means the script has no idea what's going on. you can update the script to workaround it here...

https://www.hydrogenaud.io/forums/index.php...mp;#entry907201 (https://www.hydrogenaud.io/forums/index.php?showtopic=77883&st=4280&p=907201&#entry907201)

Thank you! Works like a charm now.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-11-08 11:17:17
just letting you guys know that any further script updates by myself will require my updated component which means no more support for windows XP. i'm going to be using new functions that i've added and i'm not maintaining 2 versions of my scripts.
Title: WSH Panel Mod script discussion/help
Post by: AD 1209 on 2015-11-10 20:43:35
Hi,

I am new here. What I would like to know is: is it possible to add a popup modifying the CoverFlow script?

I have WSH CoverFlow 1.4 and it works very well. Is it possible to add a few lines, so it would show content of custom defined tags (as %artist% %album% etc) on mouse hover while in CoverFlow Mode?

I think that should be possible, but I know nothing about programming.

Thank you very much.


Title: WSH Panel Mod script discussion/help
Post by: Matt248 on 2015-11-17 22:32:51
Hello, I'm getting errors when trying to import on every sample
Code: [Select]
Component update: Checking for: foo_uie_wsh_panel_mod / WSH Panel Mod / 1.5.2
Error: WSH Panel Mod (Seekbar by marc2003): Parsing file "C:\Documents and Settings\Mat\Escritorio\Foobar2000 Portable\Foobar2000 Portable\js_marc2003\js\lodash.min.js": Failed to load
Error: WSH Panel Mod (Seekbar by marc2003): Parsing file "C:\Documents and Settings\Mat\Escritorio\Foobar2000 Portable\Foobar2000 Portable\js_marc2003\js\helpers.js": Failed to load
Error: WSH Panel Mod (Seekbar by marc2003): Parsing file "C:\Documents and Settings\Mat\Escritorio\Foobar2000 Portable\Foobar2000 Portable\js_marc2003\js\seekbar.js": Failed to load
Error: WSH Panel Mod (Seekbar by marc2003): Microsoft JScript runtime error:
'_' is undefined
File: <main>
Ln: 9, Col: 1

Maybe is because I'm using Windows XP?

Edit: Jscript component is "not loaded". I should have posted in the JScript topic...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-11-18 06:48:22
You have a whole heap of issues going on there....

First of all, you didn't extract the files as instructed. That's why it's reporting failure to load files.
Having said that, it doesn't matter because JScript Panel scripts won't work with WSH panel mod.
Also, you can't switch to JScript Panel because it won't even run on Windows XP. It requires Vista or later.

What you can do is grab the last version of my WSH panel mod scripts from this forum post: https://www.hydrogenaud.io/forums/index.php...st&p=910608 (https://www.hydrogenaud.io/forums/index.php?s=&showtopic=108811&view=findpost&p=910608)

Also, I'd update your WSH Panel Mod to version 1.5.6 - https://code.google.com/p/foo-wsh-panel-mod/downloads/list (https://code.google.com/p/foo-wsh-panel-mod/downloads/list)

Ignore that updated version of WSH panel mod in the forum post as it won't run on XP either!
Title: WSH Panel Mod script discussion/help
Post by: Matt248 on 2015-11-18 18:36:12
Thank you Marc2003, I had it named as the extracted folder...removed that "-v13" now the scripts are loading; some work like Last.fm bio and some others like similar artist don't (the wsh panel loads but not the info). I will run it in a Windows 7 machine... in the end I may have to use virtualization...
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-11-18 18:58:55
Someone didn't check the readme...

Quote
Extract the zip contents in to a folder named "wsh_marc2003" inside your foobar2000 profile, usually located at %appdata%\foobar2000. If using portable mode then it should go inside the main foobar2000 folder.


and

Quote
////////////////Last.fm Known Issues///////////////////////

From reading the new Last.fm forum, it appears that API account creation is disabled. This means if you don't already have an API key, you won't be able to use the "Last.fm Artist Info / User Charts / Recent Tracks script".





Title: WSH Panel Mod script discussion/help
Post by: Matt248 on 2015-11-18 22:03:14
too fast reading... guilty 
"Virtue engenders vice"
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-11-21 16:07:09
I have this in Tag ''Similar'' in mp3:

''Howard Hewett,Keith Washington,Jeffrey Osborne,Miki Howard,Freddie Jackson,Gerald Levert,Lalah Hathaway,Phil Perry,Chanté Moore,Anita Baker,Eric Benét,Atlantic Starr,Mint Condition,Johnny Gill,Regina Belle,Stephanie Mills,Kem,Karyn White,Angela Winbush,L.T.D.,LeVert,Kindred The Family Soul,Frank Mccomb,Rachelle Ferrell,Najee,Boney James,The Whispers,Peabo Bryson,After 7,Carl Thomas,Gerald Albright,Patti LaBelle,Troop,Al B. Sure!,Kenny Lattimore,Patti Austin,George Howard,Tevin Campbell,Rahsaan Patterson,Norman Brown,Jaheim,Jonathan Butler,Dave Hollister,Kirk Whalum,Teena Marie,Pieces Of A Dream,Silk,Hil St. Soul,Walter Beasley,Ledisi ''

@mire777
I'm wondering if you have a script for tagging Similar Artist into tags??
Biography View component provides this only for now playing track
is their way to write them into tags??
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-11-21 22:33:43
@mire777
I'm wondering if you have a script for tagging Similar Artist into tags??
Biography View component provides this only for now playing track
is their way to write them into tags??


Yes, i was made script that write similar artist into tags on track play. And also script was with library radio based on this, but this didnt work as i expected. So i delete script.
This scrpt was also with a lot of other futures: rating, playcount, genre taging, love-unlove, library search..
I was start to make WSH Tagging tool.
But since i donbt use all this futures, i decide to keep only auto genre tags, and that's it..

Dont know exactly, for what you use "similar artist"?
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-11-22 13:13:45
Yes, i was made script that write similar artist into tags on track play. And also script was with library radio based on this, but this didnt work as i expected. So i delete script.
This scrpt was also with a lot of other futures: rating, playcount, genre taging, love-unlove, library search..

seems like a very useful script
any chance you still have it??

Quote
Dont know exactly, for what you use "similar artist"?

same reason as yours back then
to make a Autoplaylist from all Similar artists
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-11-22 13:35:43
Writing all that in to a file tag seems crazy to me. It certainly wouldn't make creating an autoplaylist any easier than modifying my last.fm similar artists script to do the same thing. You could add this function to create an autoplaylist when you double click the panel...

Code: [Select]
function on_mouse_lbtn_dblclk() {
    if (list.lastfm_mode == 0 && list.lastfm_artist_method == 0 && list.data.length > 0) {
        var query = "";
        _.forEach(_.map(list.data, "name"), function (item, i) {
            if (i > 0)
                query += " OR ";
            query += "artist IS " + item;
        });
        fb.CreateAutoPlaylist(plman.PlaylistCount, list.artist + ": similar artists", query);
        plman.ActivePlaylist = plman.PlaylistCount - 1;
    }
}


For this snippet to work with JScript Panel, replace fb.CreateAutoPlaylist with plman.CreateAutoPlaylist.
Title: WSH Panel Mod script discussion/help
Post by: samithaj on 2015-11-22 16:32:55
I don't really need to tag the files, so this is perfect for me  thanks for this marc!!!
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-11-22 16:50:49
I just realised I made that more complicated than it needs to be. You can replace the forEach bit with this...

Code: [Select]
        _.forEach(list.data, function (item, i) {
            if (i > 0)
                query += " OR ";
            query += "artist IS " + item.name;
        });
Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-11-23 00:37:29
seems like a very useful script
any chance you still have it??

same reason as yours back then
to make a Autoplaylist from all Similar artists


I wanted radio based on similar artist, and this didn't work well (if you don't have all artist in library, or you don't have them at all) you can't have continuous play..
If you want autoplaylist only, this is possible.
I can write same script again.

Title: WSH Panel Mod script discussion/help
Post by: mire777 on 2015-11-23 02:48:39
For now this is 'genre tag' script.
If someone need this..
Script will tag files on ''track play''.
You can: turn on 'Auto Tag' or tag files manualy.

Script first search tags by song, if song not exist(or don't have tags), then artist global tags will be used.

(http://i.imgur.com/hHNiOzK.png)

By default 'Tag All Files' is disabled.
You can enable this on line (11-12; 261 - 264)..
Be careful!
If you use 'Tag All Files' from menu, be sure to turn off all other scripts that use last.fm before you proceed.
Last.fm allows you only 5 requests per second. (This script will send 1 request per 1-2 second.)
I'm not responsible for what you do with your API, or if your account be baned..
I was add this option only for me..


Link for download> (http://www.mediafire.com/download/x7s0sg6xxglznq5/Auto+Tag.zip)
Title: WSH Panel Mod script discussion/help
Post by: awx on 2015-11-26 08:43:47
Need help! Does anyone knows how to write a script for a button from a font (I suppose it must be done with gr.GdiDrawText) and with color change on mouse hover? I'm stuck on that "hover" part
Title: WSH Panel Mod script discussion/help
Post by: Scrummble on 2015-11-26 16:28:30
Need help! Does anyone knows how to write a script for a button from a font (I suppose it must be done with gr.GdiDrawText) and with color change on mouse hover? I'm stuck on that "hover" part


Code: [Select]
function on_mouse_move(x, y, mask) {
    button.hover = (x >= button.x && x < button.x + button.w && y >= button.y && y < button.y + button.h) ? true : false;
    window.Repaint();
}


function on_mouse_leave() {
    button.hover = false;
    window.Repaint();
}


function on_paint(gr) {
    button.color = (button.hover) ? 0xffffffff : 0xffaaaaaa;
    gr.GdiDrawText(button.text, button.font, button.color, button.x, button.y, button.w, button.h, 0x8c05);
}

button = {
    text: "\uF04B",
    font: gdi.Font("FontAwesome", 14, 0),
    x: 10,
    y: 10,
    w: 30,
    h: 30
};


TBH I don't think it's so difficult to think up.
I sincerely advise you to have a read through others' scripts.
Title: WSH Panel Mod script discussion/help
Post by: awx on 2015-11-26 17:40:58
Quote
TBH I don't think it's so difficult to think up.
I sincerely advise you to have a read through others' scripts.


Scrummble, thank you so much! Those first two functions and if...else statement were my headache - I didn't think up were to put them. And I see that is so simple, it's working now. Thanks for advice, I'll check what can I adapt from others' scripts.

Title: WSH Panel Mod script discussion/help
Post by: vadim9482 on 2015-12-03 15:37:22
Can anyone help me fixing marc2003's Last.fm playcount sync script?

When trying to do a library import, only loved tracks are updated. Updating of play counts fails with the message

Code: [Select]
Last.fm Playcount Sync: {"error":3,"message":"Invalid Method - No method with that name in this package"}


Thanks!


Hello everybody!!! As somebody knows status of above mentioned problem? Could you please inform. I really need it ))). Thanks and best regards.
Title: WSH Panel Mod script discussion/help
Post by: marc2003 on 2015-12-03 15:53:35
Nothing has changed since my original reply to that post.

the last.fm API is amazingly broken at the moment so there is nothing i or anyone else can do about it.
Title: WSH Panel Mod script discussion/help
Post by: vadim9482 on 2015-12-04 08:18:39
Nothing has changed since my original reply to that post.

the last.fm API is amazingly broken at the moment so there is nothing i or anyone else can do about it.


Thanks Marc twice, for answer and for your programming results. 
Title: WSH Panel Mod script discussion/help
Post by: widerock on 2015-12-31 08:25:26
Code: [Select]
fb.RunMainMenuCommand("View/Hide");


Code: [Select]
    buttons.buttons.hide = new _.button(ww-50, 5, 15, 15, {normal : "buttons\\hide.png"}, function () { fb.RunMainMenuCommand("View/Hide"); }, "Hide");
    buttons.buttons.exit = new _.button(ww-25, 5, 15, 15, {normal : "buttons\\exit.png"}, function () { fb.Exit(); }, "Exit");

I've made two buttons for 'View/Hide' & 'Exit' like the above.
The exit button works very well with a single click. But, "Hide" button works with a double click.
What should I do to make 'Hide' button work with a single left mouse button click?
(FYI, I'm now using js script panel ver. 1.0.7 )
Title: Re: WSH Panel Mod script discussion/help
Post by: phts on 2016-01-27 19:02:20
Can anyone help me fixing marc2003's Last.fm playcount sync script?

When trying to do a library import, only loved tracks are updated. Updating of play counts fails with the message

Code: [Select]
Last.fm Playcount Sync: {"error":3,"message":"Invalid Method - No method with that name in this package"}

Thanks!

Here is a fixed playcount script for WSH panel mod: https://gist.github.com/phts/6b41ddcc5566605fbf8b

It contains conformed fixes made in my fork of JPanel scripts (https://github.com/phts/js-marc2003). The main of them: user.getTopTracks is used instead of library.getTracks from a new Last.fm API.
Title: Re: WSH Panel Mod script discussion/help
Post by: etdeum on 2016-02-11 08:24:08
Hello everyone!

I'm completely new to WSH Panel Mod and I don't know how to script yet. I found <Mire777's biography script> that I enjoy but I'm looking for a similar script that can display %biography% text stored on tags. Can you help me with a script that can do that?

Thank you!
Title: Re: WSH Panel Mod script discussion/help
Post by: xiaNaix on 2016-03-10 06:23:34
Hi Marc,

I'm using your "track info + seekbar + buttons" script.  Is it possible to add a function so that when you hover on the cover image it will show a larger size?

Cheers!
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-03-10 08:56:05
That's not possible.
Title: Re: WSH Panel Mod script discussion/help
Post by: xiaNaix on 2016-03-10 19:30:37
That's not possible.

Oh well. 

If anyone is looking to get last.fm biography support again there is a working script being developed on a Russian forum.  You can find the latest version in this thread.

http://foobar2000.ru/forum/viewtopic.php?t=1878&start=840
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-03-10 20:09:17
Not sure what you mean by "again". Even my old WSH scripts still fetch text and they support Russian bio text even though the menu options are all in English. I know recent changes at last.fm will have broken the WSH thumbs script but I have updated versions for my JScript Panel component (forked from WSH panel mod)

Component: https://github.com/19379/foo-jscript-panel

Complete scripts: https://github.com/19379/foo-jscript-panel/wiki/Scripts

Title: Re: WSH Panel Mod script discussion/help
Post by: Mans on 2016-04-03 10:04:52
I use a script from marc2003 for last.fm, to display photos and biographies, I do not like that, if there is no picture on the website that it downloads a star
(http://s14.radikal.ru/i187/1604/1b/4a3bda78e256.png)
how to do that did not download star
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-04-03 13:38:52
If you're using WSH panel mod scripts with my name on that are downloading art from last.fm, they must have been modified by someone else. I stated a few posts up that my originals should have stopped working when last.fm made some changes to their website.

As for showing that image, my script has only ever downloaded what is visible on the images page for a given artist on their website.

edit: Looking at my changes, if someone copied my code between Jan 28th and Feb 7th then you would get that image. My own script hasn't had that issue since then.
Title: Re: WSH Panel Mod script discussion/help
Post by: Mans on 2016-04-04 11:23:03
Yes i`m using wsh panel mod with your modified script, i want to use yours, but where is i can download your script who work with wsh panel mod
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-04-04 11:43:06
Obviously my suggestion would be to use JScript Panel because I update my scripts regularly.

If you're running windows XP then you can't use it. If that is the case, browse inside the wsh_marc2003\js folder and open thumbs.js in a text editor.

Replace this...

Code: [Select]
.filter(function (item) {
return item.src.indexOf("http://img2-ak.lst.fm/i/u/avatar170s") == 0;
})

with

Code: [Select]
.filter({"className" : "image-list-image"})
Title: Re: WSH Panel Mod script discussion/help
Post by: Mans on 2016-04-04 15:02:03
Ok i install Java Panel and your script, how can i merge Tumb script and Bio script in one panel
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-04-04 15:47:26
Use now playing (basic) from the samples folder.
Title: Re: WSH Panel Mod script discussion/help
Post by: Mans on 2016-04-04 16:19:55
O-o-o that is work thank you!
Title: Re: WSH Panel Mod script discussion/help
Post by: Mans on 2016-04-04 18:57:55
one more question sorry :), i want to move wsh_data to another place  i found in helpers.js line
folders.data = fb.ProfilePath + "wsh_data\\"; and i want to modified on
folders.data = "D:\\Music\\artists\\" + "wsh_data\\" but i get crushed.


Title: Re: WSH Panel Mod script discussion/help
Post by: Mans on 2016-04-05 07:19:37
i found mistake
folders.data = "D:\\Music\\" + "wsh_data\\";
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-04-05 11:56:09
If you customise folder paths, you always have to make sure the parent folder already exists.
Title: Re: WSH Panel Mod script discussion/help
Post by: Zoig on 2016-04-16 19:50:06
Hi marc2003. I like your scripts. But is there a possibility for the thumbs script to have both last.fm and google pictures download option. So I can change to automatically download %artist% - %title% from google picture search.
Title: Re: WSH Panel Mod script discussion/help
Post by: cliffflip on 2016-05-23 03:56:41
Hi marc, Last.fm & Wikipedia Biography & Thumbs from common7.js are no longer works. it didn't download images and biography anymore. can you help me?

I've also tried to install this https://github.com/19379/js-marc2003 but when I copy from samples folder, it always returns error with this code :

Quote
Ln: 45, Col: 1
<source text only available at compile time>

Title: Re: WSH Panel Mod script discussion/help
Post by: Daeron on 2016-05-23 07:19:08
You are trying to install it in the wrong component. You need jscript panel not wsh panel. Read the installation guide marc2003 provided for you.
https://github.com/19379/js-marc2003/wiki/Installation
Title: Re: WSH Panel Mod script discussion/help
Post by: kaller on 2016-05-31 23:15:47
I'm not sure this is the right right thread, but maybe can give me a hint.

I have installed customDB and I want to update tags from WSH panel. The tags should not be written to the file but to the customDB instead. I have set up the custom fields in the customDB config. However when I write the tag using curMetadb.UpdateFileInfoSimple() the file gets updated. Is this because the method bypasses the whole customDB mechanism?

Do you have any hint on how I can write to the database instead of the file using WSH?
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-06-01 20:05:53
If you have a few preset values to write, you can create actions in the customdb preferences and then trigger them with fb.RunContextCommandWithMetadb.

If you want to write any random value, it's possible via the command line but it's a really ugly hack and doesn't always work.
Title: Re: WSH Panel Mod script discussion/help
Post by: billybag on 2016-07-27 22:17:00
i am having a hell of a time trying to get the Cover mod to show all the images i want it to. It shows the album cover in the album's folder, but i am trying to also get it to cycle through a picture of the band in the band's root folder and the band's logo. The problem i am having is that once it displays one picture, it won;t display the next in line. For example, in Display Preferences i have the following under "Artist"
Code: [Select]
..\Artist.*
..\Folder.*
..\Logo.*

Now if it finds an image called Artist.png, then it won't do the remaining two. Or if there is no Artist.png, it will go to Folder.jpg and not display the logo.

Is there a better/easier way to do this? It would be nice if i could just have the mod display whatever images are in the album's folder and band's folder without having to specify. Is there a way to do that? I tried searching the forums for a script or something but couldn't find one.
Title: Re: WSH Panel Mod script discussion/help
Post by: crouch on 2016-08-31 01:43:38
Your Github is down :(
Title: Re: WSH Panel Mod script discussion/help
Post by: wcs13 on 2016-10-16 01:47:05
Still down. And my WSH Bio & Art panels don't seem to work anymore. Here's the console output :

Code: [Select]
Last.fm & Wikipedia Biography: <html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>
Title: Re: WSH Panel Mod script discussion/help
Post by: wcs13 on 2016-10-31 23:51:33
Bump Bump Bump. Could somebody answer this, please ?...
Title: Re: WSH Panel Mod script discussion/help
Post by: Lee James on 2016-12-16 22:47:47
Could anyone please tell me where I could get hold of the Simple Text Reader script? I've been looking for it for ages. Each of my albums contain a text file of notes I've written about that album - I would love to be able to display those notes in Foobar (would also be great if I could edit the text file inside foobar2k but I don't think that's possible is it?)

Also another question while I'm here: I've seen things mentioned here about scripts/plugins which access Discogs and other music sites. Are any of these scripts/plugins able to tag songs with chart information? That's something I've wanted to do for a while - I was planning to use the mp3tag program to do it since I already have all the chart information I need in text files (UK top 40 charts since 1952).
Title: Re: WSH Panel Mod script discussion/help
Post by: Jailhouse on 2016-12-17 02:57:18
Could anyone please tell me where I could get hold of the Simple Text Reader script?
It's a sample included with the JScript Panel component. You can download JScript Panel here (https://github.com/19379/foo-jscript-panel/releases).
Title: Re: WSH Panel Mod script discussion/help
Post by: Lee James on 2016-12-17 17:32:42
It's a sample included with the JScript Panel component.
Thank you! I was already using JScript Panel but it must have been an old version without Text Reader. I've downloaded the latest version and there it is! :)

Text Reader is great, and does what I'm trying to achieve, though it would be perfect if I were able to edit the text somehow. That is a humble request.
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-12-17 17:56:29
Not possible. What you can do..

1) right click the panel>Open containing folder
2) double click the selected file in Explorer to open it in notepad (or other editor if you've already set a different default)
3) after saving changes, make sure you right click the panel again>Refresh.

edit: just realised Open containing folder is greyed out if using in folder mode rather than specifying an exact file path. I'll fix this in the next update.
Title: Re: WSH Panel Mod script discussion/help
Post by: Lee James on 2016-12-18 17:41:25
OK, thank you Marc. All the stuff you have made is really good and really appreciated. :)

A few more quick questions…

1. I'm getting a little confused about the difference between "WSH Panel Mod script" and "JScript Panel". I seem to have them both installed. What's the difference between these two, and what does WSH stand for?

2. I'm using a tab stack in Columns UI. Does anyone know an easy way to change either the tab names, or the color of the tabs? (My theme is black background but the tabs are windows default colors.)

3. Request: I really like both the "Album art" and "thumbs" scripts, and I like the "crop" option, but I wish there was an option which cropped images that are ALMOST SQUARE (ie CD covers) while not cropping images that are a different shape. For example, if you are looking through artist photos, many of those photos will be tall and thin, and you don't want them to crop at all.

4. I really like the "Properties" script, though is there any way to make the left column narrower to give more room for the actual values in the right column?
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-12-24 03:54:06
I'm only answering number 4 because it's easy. Right click the panel>Configure, insert this as the first line of code inside the on_paint function.

Code: [Select]
list.text_x = 150;

Adjust the value to fit your needs.
Title: Re: WSH Panel Mod script discussion/help
Post by: CuckooClock on 2016-12-24 19:16:20
Been a long time since I tweaked my player and thought I'd start updating it. Is there a new way to get playcount from last.fm?
Title: Re: WSH Panel Mod script discussion/help
Post by: Lee James on 2016-12-26 13:31:50
Thank you Marc! :) My first two questions are for anyone to answer!
Title: Re: WSH Panel Mod script discussion/help
Post by: TheQwertiest on 2016-12-26 13:48:06
I'm getting a little confused about the difference between "WSH Panel Mod script" and "JScript Panel". I seem to have them both installed.
JScript is a component based on WSH Panel Mod.
WSH Panel Mod was no longer supported by it's author, so @marc2003 took upon himself to continue the development of the component under the name of JScript.

The differences between two components:
1. WSH Panel Mod is unsupported.
2. New features added in JScript.
3. Some features removed in JScript.
4. Some bugs fixed in JScript.
5. Some bugs introduced in JScript.

On a serious note: the only way to list all the differences is by viewing commit history on JScript's repository (https://github.com/19379/foo-jscript-panel).




Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2016-12-26 14:55:07
Changelog: https://github.com/19379/foo-jscript-panel/blob/master/CHANGELOG.md#v100-compared-to-wsh-panel-mod-156

Some of it will make sense to the average user but most of it won't.
Title: Re: WSH Panel Mod script discussion/help
Post by: Jailhouse on 2016-12-26 20:07:29
Quote
[W]hat does WSH stand for?
Windows Script Host.
Title: Re: WSH Panel Mod script discussion/help
Post by: Lee James on 2016-12-27 00:31:29
Thank you to everyone for the really helpful answers :) I also figured out how to change tab names (it was the "Use custom title" setting… duh!) So all my questions are answered now, thank you. :)
Title: Re: WSH Panel Mod script discussion/help
Post by: ustas on 2017-01-30 04:41:21
Please help me with great animated buttons coded by user "maklaud from http://foobar2000.ru",
Code: [Select]
// ==PREPROCESSOR==
// @name "Pulsar Buttons"
// ==/PREPROCESSOR==

var BackColor = 0xff202020;
var FP = fb.FoobarPath + "themes\\Pulsar Buttons\\";
var P = {
    STOP:gdi.Image(FP+"stop.png"),
    PREV:gdi.Image(FP+"prev.png"),
    NEXT:gdi.Image(FP+"next.png"),
    PLAY:gdi.Image(FP+"play.png"),
    PAUS:gdi.Image(FP+"pause.png")};
var BT = 6;             //всего позиций кнопок // number of buttons
var FT = 9;             //всего кадров в пикче // frames in picture
var IW = 60;            //ширина пикчи // weight of picture
var IH = 540;           //высота пикчи // height of picture
var FPS = 30;           //скорость анимации (кадров/сек) // animation FPS
var FH = IH/FT;         //высота кадра в пикче // height of frame
var TimBefSeek = 400;   //пройдёт перед перемоткой, мс. // Time before FW ms
var IntSeek = 200;      //время интервала перемотки, мс. // Time interval FW
var TimSeek = 5;        //перемотать на, сек. // time FW
var N = {STOP:2, PREV:3, PLAY:4, PAUS:4, NEXT:5}; //порядок кнопок (№ п/п) // buttons order
var f = {STOP:1, PREV:1, PLAY:1, PAUS:1, NEXT:1}; //стартовый кадр // Starting frame
var m = {};
var b = {};
var FrameIntrvl = window.setInterval(Frame, 1000/FPS), BackAheaInt, PrevNextTmt;
var repaint = 0;

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, BackColor);
    gr.DrawImage(P.STOP, NTP(N.STOP), 0, wh, wh, 0, FTP(f.STOP), IW, FH);
    gr.DrawImage(P.PREV, NTP(N.PREV), 0, wh, wh, 0, FTP(f.PREV), IW, FH);
    gr.DrawImage(P.NEXT, NTP(N.NEXT), 0, wh, wh, 0, FTP(f.NEXT), IW, FH);
    if (fb.IsPaused || !fb.IsPlaying) {
        gr.DrawImage(P.PLAY, NTP(N.PLAY), 0, wh, wh, 0, FTP(f.PLAY), IW, FH);
    } else {
        gr.DrawImage(P.PAUS, NTP(N.PAUS), 0, wh, wh, 0, FTP(f.PAUS), IW, FH);
    }
}

function on_mouse_move(x,y) {
    onY= y<wh&&y>0 ? 1 : 0;
    m.STOP = x > NTP(N.STOP) && x < NTP(N.STOP)+wh && onY ? 1 : 0;
    m.PREV = x > NTP(N.PREV) && x < NTP(N.PREV)+wh && onY ? 1 : 0;
    m.NEXT = x > NTP(N.NEXT) && x < NTP(N.NEXT)+wh && onY ? 1 : 0;
    if (fb.IsPaused || !fb.IsPlaying) {
        m.PLAY = x > NTP(N.PLAY) && x < NTP(N.PLAY)+wh && onY ? 1 : 0;
        m.PAUS = 0;
    } else {
        m.PAUS = x > NTP(N.PAUS) && x < NTP(N.PAUS)+wh && onY ? 1 : 0;
        m.PLAY = 0;
    }
}

function on_mouse_leave() {m = {STOP:0, PREV:0, PLAY:0, PAUS:0, NEXT:0};}

function on_mouse_lbtn_down(x,y) {
    b = {STOP:m.STOP, PREV:m.PREV, PLAY:m.PLAY, PAUS:m.PAUS, NEXT:m.NEXT};
    if (b.PREV||b.NEXT) {PrevNextTmt = window.SetTimeout(PrevNextAbort, TimBefSeek)}
}

function PrevNextAbort() {
    b = {PREV:0, NEXT:0};
    BackAheaInt = window.SetInterval(function Back() {
        if (m.PREV) {fb.PlaybackTime -= TimSeek};
        if (m.NEXT) {fb.PlaybackTime += TimSeek};
    }, IntSeek);
}

function on_mouse_lbtn_up() {
    window.ClearInterval(BackAheaInt);
    window.ClearTimeout(PrevNextTmt);
    if (b.STOP && m.STOP) {fb.Stop()};
    if (b.PREV && m.PREV) {fb.Prev()};
    if (b.NEXT && m.NEXT) {fb.Next()};
    if (b.PLAY && m.PLAY || b.PAUS && m.PAUS) {fb.PlayOrPause()};
    b = {STOP:0, PREV:0, PLAY:0, PAUS:0, NEXT:0};
}

function Frame() {
    f.STOP = CalcFrame(m.STOP, b.STOP, f.STOP);
    f.PREV = CalcFrame(m.PREV, b.PREV, f.PREV);
    f.NEXT = CalcFrame(m.NEXT, b.NEXT, f.NEXT);
    f.PLAY = CalcFrame(m.PLAY, b.PLAY, f.PLAY);
    f.PAUS = CalcFrame(m.PAUS, b.PAUS, f.PAUS);
    if (repaint){window.Repaint();}
    repaint= f.STOP!=1||f.PREV!=1||f.NEXT!=1||f.PLAY!=1||f.PAUS!=1 ? 1 : 0;
}

function CalcFrame(m,b,f) {return m?b?FT:f<FT-1?f+1:FT-1:f<=1?1:f<FT&&f>7?f-3:f-1;}

function NTP(n) {return n*(ww/(BT+1))-wh/2;}

function FTP(f) {return (f-1)*FH;}

function on_colors_changed() {window.Repaint();}

function on_size() {
    ww = window.Width;
    wh = window.Height;
}
I want to make 4 SWITCHING buttons for 4 DSP presets. It would be wonderful if the script saves the state at the open / close of the foobar2000.
Script in attachment:
Title: Re: WSH Panel Mod script discussion/help
Post by: michtar on 2017-01-31 12:22:28
Please help me with great animated buttons coded by user "maklaud from http://foobar2000.ru",

I want to make 4 SWITCHING buttons for 4 DSP presets. It would be wonderful if the script saves the state at the open / close of the foobar2000.
I think you'd have to start with:
- creating/replacing button images (custom made), unless you don't mind changing DSP presets with the 'next' or 'play' button :-)
- replacing current button commands - fb.Stop or fb.PlayOrPause etc. with DSP presets commands, something like: fb.RunMainMenuCommand("Playback/DSP settings/preset1")?
- removing some conditions related to play/pause/stop
Title: Re: WSH Panel Mod script discussion/help
Post by: ustas on 2017-02-01 02:55:05
Please help me with great animated buttons coded by user "maklaud from http://foobar2000.ru",

I want to make 4 SWITCHING buttons for 4 DSP presets. It would be wonderful if the script saves the state at the open / close of the foobar2000.
I think you'd have to start with:
- creating/replacing button images (custom made), unless you don't mind changing DSP presets with the 'next' or 'play' button :-)
- replacing current button commands - fb.Stop or fb.PlayOrPause etc. with DSP presets commands, something like: fb.RunMainMenuCommand("Playback/DSP settings/preset1")?
- removing some conditions related to play/pause/stop
Sure, I made IMG's,, and know how to change commands, but I want SWITCHING buttons and I'm not a programmer.
Switching means one buttons is ON state other buttons goes OFF like buttons on old radio. Also script need to can read state of current preset for Foobar close/open.
Title: Re: WSH Panel Mod script discussion/help
Post by: michtar on 2017-02-03 23:25:02
Sure, I made IMG's,, and know how to change commands, but I want SWITCHING buttons and I'm not a programmer.
Switching means one buttons is ON state other buttons goes OFF like buttons on old radio. Also script need to can read state of current preset for Foobar close/open.
I'm sorry I didn't know what you knew ;-).

If I were you I'd look for a script that achieves effect you're seeking and try to copy it. Searching for "wsh panel mod fb.RunMainMenuCommand("Playback/DSP settings" brings this site http://foobar2000.ru/forum/viewtopic.php?t=1878&start=260 which consists a DSP settings switch script with highlighting (the one with DSP commands) Maybe it can be of some use.
Title: Re: WSH Panel Mod script discussion/help
Post by: mgpai on 2017-04-02 17:08:54
Hi,

Can anybody please share a script which can be used to update tags based on playback time?
Title: Re: WSH Panel Mod script discussion/help
Post by: jazzthieve on 2017-04-02 21:20:53
I very much doubt you'll get a decent answer with a vague question like that on a thread of an obsolete component.
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2017-04-03 02:54:16
Something very simple that assumes it can tag any file it plays and has no error checking. You'd want to add code so that it skips streams etc.

Code: [Select]
var target_time = 0;
var elapsed_time = 0;

function on_playback_new_track() {
    elapsed_time = 0;
    target_time = Math.floor(fb.PlaybackLength / 2); //do something after half the track has played. of course this can be modified to any value you like, in seconds
}

function on_playback_time() {
    elapsed_time++;
    if (elapsed_time == target_time) {
        var m = fb.GetNowPlaying();
        m.UpdateFileInfoSimple("TAG_NAME", "TAG_VALUE"); //don't use %% around TAG_NAME
    }
}
Title: Re: WSH Panel Mod script discussion/help
Post by: mgpai on 2017-04-03 07:38:27
@marc2003,

Thank you very much. It works perfectly. Sorry to bother you with one more question. I want to use it to track the skip count. How to set the current value of a tag as variable? I wanted to use something like this.

Code: [Select]
var current_skip_count = ?  // How to set current value of tag "SKIP_COUNT" as variable?
m.UpdateFileInfoSimple("SKIP_COUNT", current_skip_count +1);

Thanks again.
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2017-04-03 08:07:25
Code: [Select]
var current_skip_count = parseInt(fb.TitleFormat("$if2(%SKIP_COUNT%,0)").Eval());
Title: Re: WSH Panel Mod script discussion/help
Post by: mgpai on 2017-04-03 08:33:37
@marc2003 ,

Perfect!!!. Thank you very much. :)
Title: Re: WSH Panel Mod script discussion/help
Post by: Dobro5000 on 2017-07-11 16:05:40
Sorry if this is the wrong place to post this, but I am new to the site and have not mastered the navigation.

I am looking for a script for WSH Panel mod or Jscript Panel that will display only the playtime remaining time for the audio file that is playing. If you have one you're willing to share or can point me in the right direction, I'd be grateful.

Thanks for your help -
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2003 on 2017-07-13 08:03:07
Using WSH panel mod for this seems a bit overkill but you can try this... (will work in JScript Panel as well)

Code: [Select]
var font = gdi.Font("Segoe UI", 18, 1);

var colours = {
    background : RGB(255, 255, 255),
    text : RGB(0, 0, 0)
};
var tfo = fb.TitleFormat("-%playback_time_remaining%");
//////////////////////////////////////////////////////////////////////////////////////
var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_END_ELLIPSIS = 0x00008000;

var LEFT = DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX;
var RIGHT = DT_VCENTER | DT_RIGHT | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX;
var CENTRE = DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX;

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, window.Width, window.Height, colours.background);
    if (fb.IsPlaying)
        gr.GdiDrawText(tfo.Eval(), font, colours.text, 0, 0, window.Width, window.Height, CENTRE);
}

function on_playback_time() {
    window.Repaint();
}
Title: Re: WSH Panel Mod script discussion/help
Post by: Dobro5000 on 2017-07-14 21:14:34
Thank you very much!! Perfect!!!
Title: Re: WSH Panel Mod script discussion/help
Post by: Kanapka on 2017-07-18 08:10:20
I'm looking for marc2003's Spectrogram Seekbar (https://web.archive.org/web/20150222095828/http://marc2003.x10host.com:80/spectrogram-seekbar), is there any place where I can download it? Thanks for help.
Title: Re: WSH Panel Mod script discussion/help
Post by: kgena_ua on 2017-09-10 09:49:49
Properties & properties file (ml)
Title: Re: WSH Panel Mod script discussion/help
Post by: kgena_ua on 2017-09-20 11:33:55
Properties & properties file (ml)



Title: Re: WSH Panel Mod script discussion/help
Post by: MuhdNurHidayat on 2018-02-28 21:24:26
If anyone else came for this old function:
Code: [Select]
if (fb.IsPlaying)
    t.draw(gr)
else
    p.centre_text(gr, "No tracks played.", p.normal_font, p.textcolour, 0, 0, t.w, t.h);

also, you need to add this extra bit of code not inside any other functions.

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

function on_playback_stop() {
    window.Repaint();
}

Consider update to this component instead : https://github.com/marc2k3/foo_jscript_panel/wiki
(You need to update to foobar2000 v1.4 beta to use it)
after installing the new component, add the Utility>jScript Panel in any place you want in the Default User Interface
then copy paste the code from that plugin's samples/complete/text reader.txt into new jScript Panel
then edit the on_paint function as below
Code: [Select]
function on_paint(gr) {
    panel.paint(gr);
gr.DrawLine(text.x, text.y + 1, text.x + text.w, text.y + 1, 1, panel.colours.highlight);
    if (fb.IsPlaying) {
        gr.GdiDrawText(text.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT);
        text.paint(gr);
    }else{
        gr.GdiDrawText("No tracks played.", panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT);
    }
}
then add this extra bit of code not inside any other functions.
Code: [Select]
function on_playback_starting() {
    window.Repaint();
}

function on_playback_stop() {
    window.Repaint();
}
and now you get a newer panel with same old behaviour (from 3 years ago) preserved...
Title: Re: WSH Panel Mod script discussion/help
Post by: Rhand on 2018-03-05 20:12:40
Hello,

I want to hover a PBO button but no luck so far. Maybe someone will help me with this?

Code: [Select]
b.buttons.pbo = new button(0, 0, 35, 35, {normal : fb.FoobarPath+"Images\\PBO\\" + PBOArray[plman.PlaybackOrder] + ".png"}, function () {
pbo_menu();
}, "Playback Order");
window.RepaintRect(b.buttons.pbo.x, b.buttons.pbo.y, b.buttons.pbo.w, b.buttons.pbo.h);
}


It's working now.....

[code)b.buttons.pbo = new button(0, 0, 35, 35, {normal : fb.FoobarPath+"Images\\PBO\\" + PBOArray[plman.PlaybackOrder] + ".png", hover : fb.FoobarPath+"Images\\PBO\\1\\" + PBOArray[plman.PlaybackOrder] + ".png"}, function () {
      pbo_menu();
   }, "Playback Order");
   window.RepaintRect(b.buttons.pbo.x, b.buttons.pbo.y, b.buttons.pbo.w, b.buttons.pbo.h);
)[/code]
Title: Re: WSH Panel Mod script discussion/help
Post by: gism on 2018-10-19 20:41:32
Hi guys,
All of a sudden the foo_uie_wsh_panel_mod component keeps crashing (using the DarkOne v3.1 skin by tedgo).
What can be wrong?
Title: Re: WSH Panel Mod script discussion/help
Post by: gism on 2018-10-20 00:16:47
Hi guys,
All of a sudden the foo_uie_wsh_panel_mod component keeps crashing (using the DarkOne v3.1 skin by tedgo).
What can be wrong?


Nevermind, I fixed the problem.
Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-12 23:24:34
i'm trying to improve my copy of foobar (+ wsh panel mod) (JScript)
this is very important for me. several days were spent on this, some partial success was achieved
but this is the point where i ask you for the help

is it possible to get the following?:

1) selected tracks' total length (preferably with milliseconds) (preferably with minutes instead of hours+minutes)
examples: 3:50.760 or 11:39.413 or 72:03.695 or 0:00.000

2) total length of all tracks in the active playlist (preferably with milliseconds) (preferably with minutes instead of hours+minutes)
examples: 7:41.480 or 50:45.264 or 72:03.695 or 112:53.001 or 0:00.000

3) total quantity of tracks in the active playlist
examples: 1 or 15 or 3625 or 0
%_playlist_total% doesn't work

i don't have enough knowledge to create the 3 necessary separate scripts
there are some less important questions but i decided to focus on the main things at the moment
thank you for reading this. i will be grateful for the help
Title: Re: WSH Panel Mod script discussion/help
Post by: mjm716 on 2018-12-13 03:49:14
i'm trying to improve my copy of foobar (+ wsh panel mod) (JScript)

Depending on which **panel component you are using, you should find a sample script "status bar + volume.txt" which has the foundation of what you are looking for. It will be much easier to modify than starting over.

%profile%\user-components\  **foo_jscript_panel  \samples\complete
Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-13 11:47:19
i use: foobar (0.9.6.4), columns ui (0.3.6.4), wsh panel (uie) (0.7.2), wsh panel mod (1.2.1)

i couldn't find a sample script "status bar + volume.txt"

when mentioning "JScript", i was just trying to say that i add the code here:
right click -> configure -> WSH panel mod configuration -> script engine: JScript

samples from this page (https://code.google.com/archive/p/foo-wsh-panel-mod/downloads?page=2) gave no help (as well as this topic (https://hydrogenaud.io/index.php/topic,105784.0.html))
the %_length% command is also not the solution
Title: Re: WSH Panel Mod script discussion/help
Post by: mjm716 on 2018-12-13 14:25:28
Sorry, it's unlikely anyone can help you with those versions - wshpanel is abandonned, but you could at least try to upgrade yours:
https://code.google.com/archive/p/foo-wsh-panel-mod/downloads

An old user Marc2003 created wshpanel scripts, and the one you want to find was called "status bar.txt" however I think he's wiped his online archive/presence.

All of the WSH work has been updated to JSPanel (also currently discontinued)
https://github.com/marc2k3/foo_jscript_panel/releases

and currently spider monkey panel (active):
https://hydrogenaud.io/index.php/topic,116669.0.html
Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-13 14:42:36
i cannot upgrade my wshpanel (1.2.1) because the following version (1.3.0) requires different version of foobar
there are no plans to change my version of foobar
it's in use since 2009, and i's too complicated to create everything from scratch
i also don't need anything from the new foobar versions, i only try to make my setup more convenient, tidy and good-looking

even if i upgraded the wshpanel, then what are the commands/code/scripts that could help? (to obtain the 3 desired possibilities):
- selected tracks' total length
- total length of all tracks
- total quantity of tracks

does anyone still remember some aspects/commands/fuctions/scripts that could be useful in case of these 3 small and obvious wishes?
Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-14 02:36:53
i found the "status bar + volume" txt:
Code: [Select]
// ==PREPROCESSOR==
// @name "Status Bar + Volume"
// @author "marc2003"
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// @import "%fb2k_component_path%samples\complete\js\helpers.js"
// @import "%fb2k_component_path%samples\complete\js\volume.js"
// ==/PREPROCESSOR==

var tfo = fb.TitleFormat('%__bitrate% kbps %codec% [%codec_profile% ][%__tool% ][%__tagtype% ]');

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

var properties = {
name : new _.p('2K3.STATUS.SHOW.NAME', true),
count : new _.p('2K3.STATUS.SHOW.COUNT', true),
duration : new _.p('2K3.STATUS.SHOW.DURATION', true),
size : new _.p('2K3.STATUS.SHOW.SIZE', true),
background : new _.p('2K3.STATUS.BACKGROUND', _.RGB(240, 240, 240)),
text : new _.p('2K3.STATUS.TEXT', _.RGB(0, 0, 0))
};
var font = _.gdiFont('Segoe UI', 11);
var ww = 0;
var wh = 0;
var right_text = '';
var right_text_width = 0;

var volume = new _.volume(0, 3, 100, font.Height - 9);

refresh();

function on_size() {
ww = window.Width;
wh = window.Height;
volume.x = ww - 190;
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, properties.background.value);
if (fb.IsPlaying) {
gr.GdiDrawText(tfo.Eval(), font, properties.text.value, 5, -1, ww - right_text_width - 300, font.Height, LEFT);
}
if (plman.ActivePlaylist > -1 && plman.ActivePlaylist < plman.PlaylistCount) {
gr.GdiDrawText(right_text, font, properties.text.value, 0, -1, ww - 250, font.Height, RIGHT);
}
gr.DrawRect(volume.x, volume.y, volume.w, volume.h, 1, properties.text.value);
gr.FillSolidRect(volume.x, volume.y, volume.pos(), volume.h, properties.text.value);
gr.GdiDrawText(fb.Volume.toFixed(2) + ' dB', font, properties.text.value, 0, -1, ww - 5, font.Height, RIGHT);
}

function on_playback_time() {
window.Repaint();
}

function on_playback_stop() {
window.Repaint();
}

function on_volume_change() {
window.Repaint();
}

function on_mouse_wheel(s) {
volume.wheel(s);
}

function on_mouse_move(x, y) {
volume.move(x, y);
}

function on_mouse_lbtn_down(x, y) {
volume.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
volume.lbtn_up(x, y);
}

function on_mouse_lbtn_dblclk() {
fb.RunMainMenuCommand('View/Show now playing in playlist');
}

function on_mouse_rbtn_up(x, y) {
var m = window.CreatePopupMenu();
var s = window.CreatePopupMenu();
var c = fb.CreateContextMenuManager();
var col = window.CreatePopupMenu();
if (fb.IsPlaying) {
c.InitNowPlaying();
c.BuildMenu(s, 1);
s.AppendTo(m, MF_STRING, 'Now playing');
m.AppendMenuSeparator();
}
m.AppendMenuItem(MF_STRING, 10000, 'Show playlist name');
m.CheckMenuItem(10000, properties.name.enabled);
m.AppendMenuItem(MF_STRING, 10001, 'Show playlist item count');
m.CheckMenuItem(10001, properties.count.enabled);
m.AppendMenuItem(MF_STRING, 10002, 'Show playlist duration');
m.CheckMenuItem(10002, properties.duration.enabled);
m.AppendMenuItem(MF_STRING, 10003, 'Show playlist size');
m.CheckMenuItem(10003, properties.size.enabled);
m.AppendMenuSeparator();
col.AppendMenuItem(MF_STRING, 10004, 'Background...');
col.AppendMenuItem(MF_STRING, 10005, 'Text...');
col.AppendTo(m, MF_STRING, 'Colours');
m.AppendMenuSeparator();
m.AppendMenuItem(MF_STRING, 10010, 'Configure...');
var idx = m.TrackPopupMenu(x, y);
switch (idx) {
case 0:
break;
case 10000:
properties.name.toggle();
refresh();
break;
case 10001:
properties.count.toggle();
refresh();
break;
case 10002:
properties.duration.toggle();
refresh();
break;
case 10003:
properties.size.toggle();
refresh();
break;
case 10004:
properties.background.set(utils.ColourPicker(window.ID, properties.background.value));
window.Repaint();
break;
case 10005:
properties.text.set(utils.ColourPicker(window.ID, properties.text.value));
window.Repaint();
break;
case 10010:
window.ShowConfigure();
break;
default:
c.ExecuteByID(idx - 1);
break;
}
_.dispose(m, s, c, col);
return true;
}

function on_playlist_items_added(p) {
if (p == plman.ActivePlaylist) {
refresh();
}
}

function on_playlist_items_removed(p) {
if (p == plman.ActivePlaylist) {
refresh();
}
}

function on_playlists_changed() {
if (properties.name.enabled) {
refresh();
}
}

function on_playlist_switch() {
refresh();
}

function refresh() {
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
var count = items.Count;
var tmp = [];
if (properties.name.enabled) {
tmp.push(plman.GetPlaylistName(plman.ActivePlaylist));
}
if (properties.count.enabled) {
tmp.push(count + (count == 1 ? ' track' : ' tracks'));
}
if (properties.duration.enabled) {
tmp.push(utils.FormatDuration(items.CalcTotalDuration()));
}
if (properties.size.enabled) {
tmp.push(utils.FormatFileSize(items.CalcTotalSize()));
}
right_text = tmp.join(' :: ');
right_text_width = _.textWidth(right_text, font);
window.Repaint();
_.dispose(items);
}
it contains potentially interesting words like:
- plman.PlaylistCount
- plman.ActivePlaylist
- items.CalcTotalDuration
- Show playlist item count
- Show playlist duration
but i don't know how it should be modified

and i haven't noticed anything related to the "selected tracks' total length"
for example, something like "Show playlist selected items duration"

when simply trying this code as it is, foobar indicates the following error: Scripting Engine Initialization Failed
Title: Re: WSH Panel Mod script discussion/help
Post by: mjm716 on 2018-12-14 02:51:26
We've already been down that path - that sample is for JSPanel/spider monkey panel.

Your time is better spent posting your setup and getting assistance to update; it's unlikely to be as difficult as you think.
There are more people here suited to help with that, than there are to troubleshoot expired components and scripts.
Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-14 12:57:34
Quote
you should find a sample script "status bar + volume.txt"
so the necessary original wsh-version of this script doesn't exist anymore. and seemingly nobody has any copies. is it correct?

Quote
which has the foundation of what you are looking for
is this foundation totally absent in the posted JSPanel-version of the script? and nobody has absolutely nothing to advice/suggest/help. i hope it's not true
(thank you for the answers, i appreciate that. but words about switching/migrating/upgrading are not the help in my case)

Quote
It will be much easier to modify than starting over
this is really the appropriate way for me - "to modify". can you please help me with it?
"starting over" is not an option (there are reasons for it. for example, i'm using the windows-OS which is not 10/8/7)

there are just 3 small and very simple and understandable things that are missing in my setup:

1. show total quantity of tracks of the active playlist
(i have it now as i need via the "playlist switcher"-panel but there is huge trouble with it)

2. show total length of all tracks of the active playlist
(i also have it now as i need via the "playlist switcher"-panel but there is the same huge trouble with it
the trouble is quite hard to describe properly:
it is a graphical issue and the main problem is that the vertical scrollbar of the playlist switcher is visible
are there any ways to just hide it? unfortunately, i don't think it's possible)

3. show selected tracks' total length
(this is the most important thing among these 3 items)
(status bar should stay hidden so there is no way for me to get this option/functionality at the moment)


are there some different ways to get/achieve/script/implement these 3 items?
for example, there is the "duration" line in the "properties (propertis tab)"
the line can display the total length of the selected tracks
are there any ways to grab the necessary info from this line and display this info via wsh-panel or some other panel?

another example: there is the "foo_uie_playlists_dropdown.dll" component. i never used it but tried it yesterday
after a short and easy process of customizing, this component allowed me to have the first 2 items implemented (of the above-mentioned 3 items)
unfortunately, there were several graphical aspects/issues that didn't allow me to keep and to use this component
Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-17 00:10:34
after many days of different attempts to re-customize foobar, i managed to get some success (various forced compromises and inconveniences are still present)

(speaking about the 3 tasks that were previously mentioned in this topic)
here is the only task that's left to be done:
a code which allows foobar to show selected tracks' total length (status bar is always hidden)

i cannot write this code. and i'm not absolutely sure that such code could be created
but in case it could:
i found a list which contains some kind of related commands. could they really be useful as parts of the code?:

window.GetProperty(name[, defaultval])
fb.ActivePlaylist
fb.TitleFormat(expression)
fb.GetSelection()
fb.GetSelectionType()
fb.GetSelections([flags])
fb.AcquireUiSelectionHolder()
fb.PlaylistItemCount(idx)
plman.ActivePlaylist
plman.PlaylistItemCount
plman.InsertPlaylistItems(playlistIndex, base, handles[, select])
plman.InsertPlaylistItemsFilter(playlistIndex, base, handles[, select])
plman.MovePlaylistSelection(playlistIndex, delta)
plman.GetPlaylistSelectedItems(playlistIndex)
plman.IsPlaylistItemSelected(playlistIndex, itemIndex)
on_playlist_items_selection_change()
Title: Re: WSH Panel Mod script discussion/help
Post by: michtar on 2018-12-17 09:28:47
Quote
you should find a sample script "status bar + volume.txt"
so the necessary original wsh-version of this script doesn't exist anymore. and seemingly nobody has any copies. is it correct?
- I have some old 'status bar' WSH samples, newest dated 12.10.2015. I didn't test it (compatibility, installation)
- I can send it to you in a private message just in case it's against the wishes of the author to distribute it publicly.
- There may be some incompatibilites (paths, versions etc.)
- I think it shows playlist's not selection's total time 


Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-17 10:29:56
michtar
i'm starting to lose any hope to solve this problem so yes, please send me these samples
although i'm almost sure that i won't get something really useful in them
at the moment i tend to think that if the solution exists, it is somewhere in those related commands which are used in a new code
Title: Re: WSH Panel Mod script discussion/help
Post by: aphelion on 2018-12-18 21:32:20
michtar, thank you for trying to help
sadly but i haven't found anything useful in that older 'status bar.txt':

- %playback_time%, %length%, %__bitrate%, %codec%, %codec_profile%, %__tool%, %__tagtype%
- the 'colors' stuff, the 'volume' stuff
- function on_paint, functions on_mouse...

does anyone know the way to get the possibility to see the total length of the selected tracks immediately?
(without a necessity to open the 'properties (properties tab)' sub-window every time)
(and without constant contemplating of almost empty and useless and ugly status bar)
Title: Re: WSH Panel Mod script discussion/help
Post by: michtar on 2018-12-19 15:19:59
michtar, thank you for trying to help
sadly but i haven't found anything useful in that older 'status bar.txt':

- %playback_time%, %length%, %__bitrate%, %codec%, %codec_profile%, %__tool%, %__tagtype%
- the 'colors' stuff, the 'volume' stuff
- function on_paint, functions on_mouse...

thout constant contemplating of almost empty and useless and ugly status bar)
I tested it and the old WSH sample works almost the same way as foo_jscript_panel one. It shows total length of the tracks in the playlist.
(https://i.imgur.com/olmLYyp.png)
You can check it for yourself:
- install newer foobar version
- install wsh_panel_mod
- copy content of the .zip from the link I posted into wsh_marc2003 directory in foobar's config directory
- if I were to guess  :) which part is responsible for the feature you seek it would be somewhere here:
Code: [Select]
function refresh() {
var items = plman.GetPlaylistItems(plman.ActivePlaylist);
count = items.Count;
var size = 0;
var length = 0;
for (var i = 0; i < count; i++) {
size += _.parseInt(_.tf("$if2(%filesize%,0)", items.item(i)));
length += Math.max(items.item(i).Length, 0);
}
right_text = count + (count == 1 ? " track :: " : " tracks :: ") +

Title: Re: WSH Panel Mod script discussion/help
Post by: cooldude on 2020-12-12 20:38:41
There's an upload of the "WSH_Artwork_Viewer.7z" here:
https://www.4shared.com/archive/jTKjPJaS/WSH_Artwork_Viewer.html
The 4shared website isn't working for me, and it's also generally more suspicious and unreliable compared to other file sharing services.

Can someone either:
1. Upload the file elsewhere (whether by downloading it again or by finding a copy of it, if they have one saved)
2. Paste the contents of the file in this thread

Thanks

Edit: Disregard that, I suck cocks. Apparently the newest iteration of this plugin has included a script that's even better:
https://hydrogenaud.io/index.php?topic=116669.msg991455#msg991455
Although I have different issues with that particular script, so I would still appreciate someone reuploading the WSH_Artwork_Viewer.
Title: Re: WSH Panel Mod script discussion/help
Post by: pakpak on 2021-02-24 14:36:45
I haven't been here a long time ..

now I like to ask the following:
is a function available to start playing of a track?
the information of the playlistlist and the desired item of it is available by another function.
I just dont't have a command or function of wsh to start playing the track.....

any ideas?
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2k3 on 2021-02-24 15:05:45
plman.ExecutePlaylistDefaultAction(playlistIndex, playlistItemIndex)
Title: Re: WSH Panel Mod script discussion/help
Post by: pakpak on 2021-02-25 07:02:34
thanks

.. I tried it, but it doesn't play the track (nor another one)
what might be a reason for a lock as indicated in interfaces.txt?
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2k3 on 2021-02-25 10:09:57
A lock would prevent you from double clicking items in a normal playlist to start playback so it's unlikely to be that.

Make sure you have the latest version of fb2k because older versions had a bug preventing this from working properly if the specified playlistIndex wasn't already active. See the changelog for v1.6.3 http://foobar2000.org/changelog
Title: Re: WSH Panel Mod script discussion/help
Post by: pakpak on 2021-02-25 15:02:08
the new version does not 'help' with this

even if i place
plman.ExecutePlaylistDefaultAction(fb.PlaylistItemCount(fb.ActivePlaylist), 2);

at the begiining of the script it does not play,
on the other hand
plman.SetPlaylistFocusItem(fb.ActivePlaylist, 2);
sets the focus to the 3rd item properly

hmmm...
Title: Re: WSH Panel Mod script discussion/help
Post by: marc2k3 on 2021-02-25 15:42:43
edit: nvm
Title: Re: WSH Panel Mod script discussion/help
Post by: pakpak on 2021-03-08 14:52:20
a question to GetPlaylistSelectedItems
I understand how to use it to find out how many are selected with
plman.GetPlaylistSelectedItems(fb.ActivePlaylist).count;
this works

but i do not know how to get all the itemindices which are selected ...
Title: Re: WSH Panel Mod script discussion/help
Post by: pakpak on 2021-04-08 09:19:27
I made the two forementioned work ...

another question:
is a write line to a text file possible in WSH panel?
I found the ReadTextFile function, but nothing to write a line
Title: Re: WSH Panel Mod script discussion/help
Post by: kgena_ua on 2021-04-08 10:49:45
is a write line to a text file possible in WSH panel?
I found the ReadTextFile function, but nothing to write a line
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/opentextfile-method (https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/opentextfile-method)
example
Code: [Select]
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file_path = "C:\\text.txt"
if (!fso.FileExists(file_path)) fso.CreateTextFile(file_path);

file = fso.OpenTextFile(file_path, 8);
file.WriteLine("Hello, pakpak");
file.Close();
Title: Re: WSH Panel Mod script discussion/help
Post by: pakpak on 2021-04-08 14:44:30

ok, thanks.

but i am using the WSH with javascript along with other WSH code..
and with this somehow i cannot make a write working  like this:

var fs = require('fs');
fs.writeFile('helloworld.txt', 'Hello World!');
Title: Re: WSH Panel Mod script discussion/help
Post by: p90036 on 2021-08-18 19:42:49
oh great discontinued.  well maybe someone can help i spent 1 hour finguring this out lol,
i'm trying to get a big text to show the current hour:minute
got that part done,
but how do i make it refresh? i cant figure it out (im no programmer) (edit: spidermonkey script seems to be different than wsh not been able to show time yet)
thanks !

 code:
basically i changed the initial WSH code only at the
var g_font = gdi.Font("Impact", 300, 0);
and
var g_text = g_date.getHours()+":"+g_date.getMinutes();
everything else basically stock
Title: Re: WSH Panel Mod script discussion/help
Post by: kgena_ua on 2021-08-19 06:39:24
p90036
Code: [Select]
var g_text;
var clock_timer = window.SetInterval(on_timer, 1000);

function on_timer(id) {
    g_date = new Date();
    g_text = g_date.getHours() + ":" + g_date.getMinutes();
    window.Repaint();
}
Title: Re: WSH Panel Mod script discussion/help
Post by: p90036 on 2021-08-19 14:10:28
awesome thank you !!
Title: Re: WSH Panel Mod script discussion/help
Post by: millzeyweb on 2021-08-23 02:57:15

ok, thanks.

but i am using the WSH with javascript along with other WSH code..
and with this somehow i cannot make a write working  like this:

var fs = require('fs');
fs.writeFile('helloworld.txt', 'Hello World!');


Here is a function I use to write to a file when playing each track with JScript Panel.

Code: [Select]
function on_playback_new_track(){
    var objFSO = new ActiveXObject("Scripting.FileSystemObject");
    var trktxt = (fb.ProfilePath + "\\played\\p.t");
    if (objFSO.Fileexists(trktxt)){
    }
    else {
            objFile = objFSO.CreateTextFile(trktxt, false);
            //objFile.Close();
    }
// add to played playlist
var timestamp = getTimestamp();
    timestamp = timestamp.replace(/^[0-9]{2}/g,"");
    timestamp = timestamp.replace(/:[0-9]{2}$/g,"");
//fb.trace(timestamp);
// add to played.txt
var checkpath1 = new RegExp("M:", "i");
var checkpath2 = new RegExp("E:\Music", "i");
if(fb.TitleFormat("%_path_raw%").Eval(true).match(checkpath1)){
return;
}
if(fb.TitleFormat("%_path_raw%").Eval(true).match(checkpath2)){
//return;
}

var metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
    var ctrack;
    var ctrack2;
    var cpath;
    cpath = fb.TitleFormat("$directory_path(%path%)").Eval();
    cpath = cpath.replace(/^.{2}/g,"");
ctrack = fb.TitleFormat("%artist% - %title%, %filename_ext%, "+cpath+", ").Eval();
    ctrack2 = ctrack.replace(/((?![a-zA-Z0-9\s\)\(\-\_\&\!\'\<\>\.\,\+\:\;\?\\\{\}\=\*\^\%\$\#\@\~\`]).)+/g, "");
    ctrack2 = ctrack2.replace(/\.mp3/g, "");
    //ctrack2 = ctrack2.replace(/(I|D|E|H):\\\\/g, "");
//stream = (fb.TitleFormat("%_path_raw%").Eval()) + " - " + (fb.TitleFormat("%title%").EvalWithMetadb(metadb));
//fb.trace(ctrack + "(" + ctrack2 + ")");
    try {
        file_err = 0;
        objFile = objFSO.OpenTextFile(trktxt, 8, -1);
        if(objFile) {
        objFile.WriteLine(ctrack2 + timestamp);
        objFile.Close();
        }
    }
    catch(Err)
    {
            file_err = 1;
            fb.trace("objFile: " + Err);
    };
}