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

WSH Panel Mod script discussion/help

Reply #4375
Oh ffs...I completely forgot that script. 

And that border trick is lovely. Thanks.


WSH Panel Mod script discussion/help

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


WSH Panel Mod script discussion/help

Reply #4378
That's nice. Would a 'Show now playing in playlist' option be possible if one were to click on the info over there?


WSH Panel Mod script discussion/help

Reply #4380
That's even better than what I'd imagined. Thanks.


WSH Panel Mod script discussion/help

Reply #4382
here's another update.

https://raw.githubusercontent.com/19379/wsh...B%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


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

Thank's

WSH Panel Mod script discussion/help

Reply #4383
Can wsh panels be used to trigger stacked panels? I was messing around with this 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?

WSH Panel Mod script discussion/help

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

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.

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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


WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

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.

I have no idea what i'm doing scripting-wise but I do have WSH panel mod.

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #4392
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...
A rose will bloom, it then will fade.


WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

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

WSH Panel Mod script discussion/help

Reply #4396
Bummer. In some regards WSH panel mod feels quite restricted compared to modern web technologies.

WSH Panel Mod script discussion/help

Reply #4397
I ran into a weird focus problem after messing around with your track info + seekbar + buttons script, marc. See here.

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.

WSH Panel Mod script discussion/help

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


WSH Panel Mod script discussion/help

Reply #4399
That did the trick. Thanks.