Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: WSH Panel Mod script discussion/help (Read 1398691 times) previous topic - next topic
0 Members and 4 Guests are viewing this topic.

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #3402
Oh great thank's for reply  i try it

And how i can import this portable installation in my normal installation ?



WSH Panel Mod script discussion/help

Reply #3404
Yes yes yes yes yes but it's another install dude

And for now playing y have this


WSH Panel Mod script discussion/help

Reply #3405
the instructions for that install are no different. also, you seem to have a stray floating rectangle in your script???


WSH Panel Mod script discussion/help

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

Thanks!

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #3409
finally, i've uploaded a full customisation page. it's bound to be full of typos and errors.

http://marc2003.x10host.com/customisation

it doesn't cover topics like fetching stuff off the internet yet. i'll get round to it oneday. 

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #3412
finally, i've uploaded a full customisation page. it's bound to be full of typos and errors.

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.

WSH Panel Mod script discussion/help

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

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

WSH Panel Mod script discussion/help

Reply #3414
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 (he calls himself falstaff 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.

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #3420
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:

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:


This is the metadata opened via "Properties" in foobar2000


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.

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!

WSH Panel Mod script discussion/help

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


WSH Panel Mod script discussion/help

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


WSH Panel Mod script discussion/help

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