Skip to main content
Topic: WSH Panel Mod script discussion/help (Read 921834 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

WSH Panel Mod script discussion/help

Reply #200
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();

WSH Panel Mod script discussion/help

Reply #201
@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;

WSH Panel Mod script discussion/help

Reply #202
[quote author=q-stankovic link=msg=687501 date=1266084373]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?[/quote]

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


things change. T.P has released a new version which supports this.

WSH Panel Mod script discussion/help

Reply #203
Thanks marc, that was a really easy fix.

WSH Panel Mod script discussion/help

Reply #204
I updated my FormsAndButtons script: FormsAndButtons v1.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

WSH Panel Mod script discussion/help

Reply #205
I don't find any of these in the archive.
Quote
// @import "%fb2k_path%scripts\Flags.txt"
// @import "%fb2k_path%scripts\Helpers.txt"

WSH Panel Mod script discussion/help

Reply #206
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

 

WSH Panel Mod script discussion/help

Reply #207
i've updated my samples - http://cid-649d3bfeaf541fbb.skydrive.live....ide/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

(credit really must go ojdo for the idea. his original panel can be found here .)

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.

WSH Panel Mod script discussion/help

Reply #208
i've updated my samples - http://cid-649d3bfeaf541fbb.skydrive.live....ide/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 ?

WSH Panel Mod script discussion/help

Reply #209
new version uploaded.

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


WSH Panel Mod script discussion/help

Reply #210
For me it's all i need

thanx

WSH Panel Mod script discussion/help

Reply #211
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.. :-)

WSH Panel Mod script discussion/help

Reply #212
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();
    }
}

WSH Panel Mod script discussion/help

Reply #213
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.

WSH Panel Mod script discussion/help

Reply #214
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.

WSH Panel Mod script discussion/help

Reply #215
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.

WSH Panel Mod script discussion/help

Reply #216
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?

WSH Panel Mod script discussion/help

Reply #217
new version uploaded.

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 ?

WSH Panel Mod script discussion/help

Reply #218
[quote author=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.[/quote]

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.

WSH Panel Mod script discussion/help

Reply #219
@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);

WSH Panel Mod script discussion/help

Reply #220
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?

WSH Panel Mod script discussion/help

Reply #221
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

WSH Panel Mod script discussion/help

Reply #222
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.


WSH Panel Mod script discussion/help

Reply #224
marc2003 do you remember the url from which you got the web links button?

 
SimplePortal 1.0.0 RC1 © 2008-2019