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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #2876
well that just shows how much i (don't) know.

i thought the while loop would continue below 0.

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #2880
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). 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?

WSH Panel Mod script discussion/help

Reply #2881
sorry but i have no idea how upnp works and i have no way to reproduce the scenario you are faced with.

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #2883
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  !

WSH Panel Mod script discussion/help

Reply #2884
@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
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

WSH Panel Mod script discussion/help

Reply #2885
@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
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt


Thanks for the quick reply, as usual... Perfect !

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #2890
@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.

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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


WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #2895
obviously you could do it with visual studio. i have no idea if it's possible with anything else.


WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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