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 (Read 803732 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #1475
I'd like to get panel stack splitter global variable through wsh panel mod but it's not possible or is it?

WSH Panel Mod

Reply #1476
not possible.


WSH Panel Mod

Reply #1478
that's setting something through WSH panel mod to be read by PSS - completely the opposite of what was asked.

WSH Panel Mod

Reply #1479
ah, sorry, I misunderstood. 

WSH Panel Mod

Reply #1480
Hey, I hope this is an appropriate place to post this but I am looking for some help as to anchoring a WSH volume slider script to a Panel Stack Splitter. It currently moves out when resizing the window and I'd like it to stay at a consistent distance away from the edge of the window when resizing. Here's what I have so far;

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%\resources\Common.h"
// @import "%fb2k_path%\resources\UI.h"
// ==/PREPROCESSOR==


// Based on human hearing curve
// 0 <= p <= 1
// return a value value: -100 <= vol <= 0
function pos2vol(p) {
return (50 * Math.log(0.99 * p + 0.01) / Math.log(10));
}

function vol2pos(v){
var p=((Math.pow(10,v/50)-0.01)/0.99);
return(p);
}

//-----------------------------------

var muted = false;
var volume = fb.Volume;

var path = fb.FoobarPath + "resources\\";
var volume_img = gdi.Image(path + "volume.png");
var mute_button_img = gdi.Image(path + "bt_volume.png");
var mute_button_img_h = gdi.Image(path + "bt_volume.png");
var knob_img = gdi.Image(path + "knob.png");
var bar_left_img = gdi.Image(path + "bar_left.png");
var bar_mid_img = gdi.Image(path + "bar_mid.png");
var bar_right_img = gdi.Image(path + "bar_right.png");

var VolumeBar = new Dragbar();
var MuteButton = new Button(5,-1,26,21,mute_button_img,mute_button_img_h,mute_button_img,"Mute");

function on_size() {
ww = window.Width;
wh = window.Height;
VolumeBar.SetSize(30,5,165,10);
}

function on_paint(gr){
//gr.FillSolidRect(0,0,ww,wh,RGBA(25,25,25,255));
var p = parseInt(vol2pos(fb.Volume) * VolumeBar.W);
VolumeBar.Pos = p>0 ? p : 0;

gr.FillSolidRect(VolumeBar.X,VolumeBar.Y + 0,VolumeBar.Pos,9,RGBA(179,179,179,255))

MuteButton.Draw(gr);

var i = 0;
var vol = fb.Volume;

if(vol == -100){
if(muted)i = 0;
else i = 1;
}
if(vol>-100 && vol<-20)i = 2;
if(vol>=-20 && vol<-8)i = 3;
if(vol>=-8)i = 4;

gr.Drawimage(volume_img,19,3,10,14,i*10,0,10,14,0);

gr.Drawimage(bar_left_img,VolumeBar.X,VolumeBar.Y+0,0,5,0,0,2,5,0);
gr.Drawimage(bar_mid_img,VolumeBar.X,VolumeBar.Y+0,VolumeBar.W,9,0,0,10,5,0);
gr.Drawimage(bar_right_img,VolumeBar.X+VolumeBar.W,VolumeBar.Y+0,0,5,0,0,2,5,0);

var knob_x = (VolumeBar.Pos<5 ? 5: VolumeBar.Pos) + VolumeBar.X - 5;
knob_x = VolumeBar.Pos+5>VolumeBar.W ? VolumeBar.W+VolumeBar.X-10 : knob_x;
gr.Drawimage(knob_img,knob_x,VolumeBar.Y,10,10,0,0,10,10,0);
}

function on_mouse_move(x,y){
if(VolumeBar.Drag(x,y)){
var p = VolumeBar.Pos/VolumeBar.W;
fb.Volume = pos2vol(p);
}
MuteButton.Activate(x,y);
}

function on_mouse_lbtn_down(x,y){
if(VolumeBar.Click(x,y)){
var p = VolumeBar.Pos/VolumeBar.W;
fb.Volume = pos2vol(p);
}
MuteButton.Down();
}

function on_mouse_lbtn_up(x,y){
VolumeBar.Reset();

if(MuteButton.Click()){
if(muted){
fb.Volume = volume;
}
else{
if(fb.Volume > -100){
volume = fb.Volume;
muted = true;
fb.RunMainMenuCommand("Playback/Volume/Mute");
}
}
}

MuteButton.Reset();
}

function on_mouse_wheel(step){
if(step>0)
fb.VolumeUp();
else
fb.VolumeDown();
}

function on_volume_change(vol){
if (vol > -100 && muted)muted = false;
if(!muted)volume = fb.Volume;
window.Repaint();
}


Any help would be greatly appreciated.

WSH Panel Mod

Reply #1481
@vothanhdat

you can't retreive it with WSH panel mod. the best way is to work with an autoplaylist that contains the whole library (e.g %path% PRESENT) and to browse it with plman.

HTH


i see that helped, your panels are very good, except the populating function that can be optimized a lot, i'll post here the optimized version asap.

for those interrested by the scripts of vothanhdat, check his DA page: http://thanhdat1710.deviantart.com/

WSH Panel Mod

Reply #1482
just want to say thank you for this great plugin, and thanks to all the ppl, who share their scripts!!

WSH Panel Mod

Reply #1483
In my theme, I've got a playlist manager I ripped from ExtremeHunter (thanks!) and I noticed that I was getting a LOT of on_playlist_items_reordered events being fired when no items were actually being reordered. After a little testing I realized that it only happened in auto-playlists, and specifically my autoplaylist which checks if a song has been played in the last 70 minutes. Watching the clock I realized that the playlist was updating itself every minute to check for that clause. Items still weren't being reordered though. I also verified that if a song had eclipsed the 70 minute threshold and was removed from the list, that the on_playlist_items_removed() was fired, and on_playlist_items_added() was fired at the appropriate time as well, but that dang on_playlist_items_reordered was also fired. I added a check to only refresh the playlist in on_playlist_items_reordered if:
Code: [Select]
playlist == activeList && !fb.IsAutoPlaylist(playlist)

which is wrong if the sort order changes, but that's a rare occurrence in my situation.

As far as I can tell, you can't manually reorder auto playlists. It seems that the only time the reorder event should fire is if the sort order for the auto playlist actually changes. Am I missing something else, or is this a bug?

WSH Panel Mod

Reply #1484
As far as I can tell, you can't manually reorder auto playlists.


this would depend on whether you have SORT BY in your query or it's force sorted through its properties. if not, you can manually re-order tracks. but if they are sorted, i think it's perfectly normal for the playlist added to get triggered when a track meets the criteria to get on the playlist. presumably it gets added to the end of the playlist (like using file>add files) and then the reorder callback kicks in to put in the right place.

also, i'm guessing these callbacks are all triggered by the foobar core itself so it's unlikely to be a bug.

WSH Panel Mod

Reply #1485
As far as I can tell, you can't manually reorder auto playlists.


this would depend on whether you have SORT BY in your query or it's force sorted through its properties. if not, you can manually re-order tracks. but if they are sorted, i think it's perfectly normal for the playlist added to get triggered when a track meets the criteria to get on the playlist. presumably it gets added to the end of the playlist (like using file>add files) and then the reorder callback kicks in to put in the right place.

also, i'm guessing these callbacks are all triggered by the foobar core itself so it's unlikely to be a bug.
Thanks for the info. I do have force sorted selected on all my auto-playlists. I'm guessing there's no way to tell if a playlist has that setting though.

It does make sense when a song gets added or removed (although it's redundant in my case), but if nothing is changing in the playlist, and the auto-playlist is just checking to see if something should be added or removed, then I don't understand why it's getting triggered.

WSH Panel Mod

Reply #1486
I'm guessing there's no way to tell if a playlist has that setting though.


correct. as you already know, you can tell if a playlist is an autoplaylist but that's it.

Quote
but if nothing is changing in the playlist, and the auto-playlist is just checking to see if something should be added or removed, then I don't understand why it's getting triggered.


i've managed to re-create what you're seeing and it is odd. i'm assuming you're using foo_playcount? i created my own autoplaylist using %LAST_PLAYED% DURING LAST 60 MINUTES SORT DESCENDING BY %LAST_PLAYED%

like yourself, i'm seeing the reordered event getting triggered even when nothing else is getting removed/added. it's about every minute or so.

is this a real issue that affects your script or is it something that just bugs you?

WSH Panel Mod

Reply #1487
i've managed to re-create what you're seeing and it is odd. i'm assuming you're using foo_playcount? i created my own autoplaylist using %LAST_PLAYED% DURING LAST 60 MINUTES SORT DESCENDING BY %LAST_PLAYED%

like yourself, i'm seeing the reordered event getting triggered even when nothing else is getting removed/added. it's about every minute or so.

is this a real issue that affects your script or is it something that just bugs you?


It's a real issue that will probably only really effect me. The issue is that when I get an on_playlist_items_reordered I have to throw away the playlist data I have and rebuild it from scratch. That's pretty fast, but the artwork (typically 3-4 images are visible at any time) has to be retrieved again. Even on the same machine this causes flashing from the images disappearing and then reappearing (which is probably more from the script than actually the images) but over wifi it gets pretty bad since the images I save are usually big and it can take 2-3 seconds to retrieve the 3-4 MB of artwork needed.

I've implemented local image caching to cut down on network transfer times, but just checking image sizes of the remote images to determine if we have a valid cache hit still takes about half a second. If this only happened when a song was added or removed from the playlist it wouldn't be a big deal, but once a minute seeing it flash is awfully distracting.

WSH Panel Mod

Reply #1488
Quote
I've implemented local image caching to cut down on network transfer times, but just checking image sizes of the remote images to determine if we have a valid cache hit still takes about half a second.


surely this is complete overkill? i'd only check once only per foobar restart.

edit: have you tried falstaff's WSH playlist viewer to see how that performs? http://www.deviantart.com/art/WSH-Playlist...0-0-8-368997689

i'll freely admit, it's all beyond me.

WSH Panel Mod

Reply #1489
surely this is complete overkill? i'd only check once only per foobar restart.
Probably it is. It works great for just album art because you never notice the delay between switching tracks, but when the playlist art work blanks, and then takes any amount of time to load, you see the delay. Originally I was going to do once per day, but then I changed some artwork and got annoyed that it wasn't reflected immediately (and I don't have a flush cache button). Maybe for the tiny playlist images it doesn't matter.

Quote
edit: have you tried falstaff's WSH playlist viewer to see how that performs? http://www.deviantart.com/art/WSH-Playlist...0-0-8-368997689

i'll freely admit, it's all beyond me.

I did a while ago, but long before I started writing my own stuff. The problem is that a lot of this stuff is interdependent. My theme is now about 9k lines long, split between four files, and I can't just switch in and out playlist viewers to see how they'd work with the rest of my system. I'll probably give it a go, just to see if it has the same issue though. I could have never written the playlist stuff on my own, but starting from Extreme Hunter's base I've been able to hack together something that works well.

Edit: falstaff does his own internal caching where he keeps the resized artwork for the playlist which is pretty smart. I'm caching full files which is great for slow network connections and all the artwork I display, but is overkill for the 80x80 playlist images. I think my solution is going to be to do both. Keep an associative array of resized artwork for the playlist, and attempt to hit the local cache whenever we need full size artwork, or playlist artwork that we haven't stored in the internal playlist image cache.

WSH Panel Mod

Reply #1490
Is it possible to create an art reader script so that when you select an artist, it displays an image of that artist, but then when you select an album or a song, it displays album art? Sorry if I explained that poorly, I've coded in MATLAB but that's about it, so my jscript skills are next to nothing.

WSH Panel Mod

Reply #1491
select an artist


Quote
select an album or a song


no. these terms are meaningless as far as WSH panel mod is concerned. it cannot interact with other library viewers/panels so it has no concept of the "type" of selection.

you could try foo_facets or EsPlaylist as these allow you to browse your library with artist/album panels configured to show the appropriate artwork.

WSH Panel Mod

Reply #1492
HI,

Is there a way to drag & drop tracks between two panels ? I've try with notifyOthers() and on_notify_data(), but it seems that the callbacks functions on_mouse_xxx() don't work when you enter the panel while the mouse button is already pressed (which is the case when you try to drag an item from outside).

(I'm expecting a negative answer, so i've try to look at the source of wsh panel to edit it but finally hmmm... i'm not ready to hurt my brain that much yet)

WSH Panel Mod

Reply #1493
Hi.

Would it be possible to make an empty element with this, set a background image for it, and disable the frames / borders for it?

WSH Panel Mod

Reply #1494
Hello,

Is it possible to change the text of the "Link" tooltip that appears during on_drag events?

WSH Panel Mod

Reply #1495
i've made a few little modifications for my own personal use and i thought i'd share.

Code: [Select]
-v1.5.7
- CHG: Compiled with new SDK. Requires foobar2000 v1.3 or above.
- ADD: Script errors are now displayed in a popup window in addition to the Console like it was previously.
- ADD: Default right click menu now has a "Reload" script option. This saves opening/closing the dialog when working on external files.
- CHG: Remove functions marked as obsolete 2+ years ago. There are newer alternatives for all of them.
    window.WatchMetadb
    window.UnWatchMetadb
    window.CreateTimerTimeout
    window.CreateTimerInterval
    window.KillTimer
    UpdateFileInfo
- CHG: AppendMenuItem no longer accepts MF_POPUP as a flag. You should be using AppendTo instead.
- CHG: utils.GetAlbumArt removed as corresponding function has been removed from SDK.
- CHG: Safe mode disabled by default. If you're reading this, you're probably going to be using scripts that require this!
- FIX: EstimateLineWrap no longer leaves stray punctuation when wrapping text at end of line.


https://dl.dropboxusercontent.com/u/2280132...h_panel_mod.zip

WSH Panel Mod

Reply #1496
Waoooooooooooooooooooooooooooooooooooooooooo! it's valentine's day not xmas

going to test that immediatly, thanx a lot Marc !

EDIT: works flawlessly with my JSPlaylist script, that's more than a validation imho

WSH Panel Mod

Reply #1497
^of course. the changes i made are very minor. i've just modified what was already there.

i will try and figure out a way to get a diff of the changes i've made incase people don't trust me.

WSH Panel Mod

Reply #1498
Yep, but thanx anway the fresh compilation

is Reload can be called with a adhoc method as window.Reload(); or example or is it still a bit hard to do for you ?


WSH Panel Mod

Reply #1499
i'll give it a go. if i look at how other window.XXX functions are created, i should be able to copy and create my own.