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

WSH Panel Mod script discussion/help

Reply #676
I have had ago at combining the Now Playing template with the Aero Seekbar template, though I have a problem and cannot get the album art to display correctly. Here is the code I am using:

Code: [Select]
// ==PREPROCESSOR==
// @name "Aero Seekbar"
// @author "marc2003"
// ==/PREPROCESSOR==

DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_END_ELLIPSIS = 0x00008000

var stopped_text = "foobar2000";
var title_tf =  fb.TitleFormat("%title%");
var album_tf = fb.TitleFormat("[%album%]");
var artist_tf = fb.TitleFormat("%artist%");
var title_font = gdi.Font("Segoe UI", 30, 1);
var album_font = gdi.Font("Segoe UI", 22, 0);
var artist_font = gdi.Font("Segoe UI", 22, 0);
var title_colour = RGB(0, 255, 128);
var album_colour = RGB(0, 255, 128);
var artist_colour = RGB(0, 255, 128);
var blacklist_file = '';

var album_img = null;
var album_img_size = window.GetProperty("album_img_size", 510) - 400;

var g_font = gdi.Font("Segoe UI", 20, 1);

var g_drag = 0;
var g_drag_seek = 0;
var g_timer, txt;


function RGB(r,g,b) {
    return (0xff000000|(r<<16)|(g<<8)|(b));
}


if(fb.isplaying) on_playback_new_track();

function on_playback_stop(reason) {
    album_img && album_img.Dispose();
    g_metadb = album_img = null;
    if(reason != 2) window.Repaint();
    if(g_timer) window.KillTimer(g_timer);
    window.Repaint();
    CollectGarbage();
}

function on_playback_new_track() {
    g_metadb = fb.GetNowPlaying();
    artist = artist_tf.EvalWithMetadb(g_metadb);
    title = title_tf.EvalWithMetadb(g_metadb);
    album = album_tf.EvalWithMetadb(g_metadb);
    length = fb.TitleFormat("%length%").Eval();
    g_timer = window.CreateTimerInterval(100);
    album_img && album_img.Dispose();
    album_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
    if(!album_img) utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
}

function on_get_album_art_done(metadb, art_id, im, ip) {
    album_img = im;
    window.Repaint();
}

function on_playback_seek(time){
    window.Repaint();
}

function on_timer(id){
    window.Repaint();
}

function on_mouse_wheel(delta) {
    fb.PlaybackTime = fb.PlaybackTime + delta;
}

function on_size() {
    ww = window.Width;
    wh = window.Height;
}

function on_paint(gr) {
    gr.FillSolidRect( 0, 0,ww, wh, RGB(0,0,0));
    if(album_img) {
        text_x = album_img_size + 10;
//        scale(gr, album_img, 0, wh-20-album_img_size, album_img_size, album_img_size);
    } else {
        text_x = 10;
    }
    if(fb.IsPlaying) {
        if(fb.PlaybackLength > 0) {
            if(g_drag){
                t = fb.PlaybackLength * g_drag_seek;
                h = Math.floor(t/3600)
                m = Math.floor((t-=h*3600)/60);
                s = Math.floor(t-=m*60);
                pos = ww * g_drag_seek;
                txt = (h > 0 ? h + ":" + (m <10 ? "0" + m : m) : m) + ":" + (s < 10 ? "0" + s : s) + " / " + length;
            } else {
                pos = ww * (fb.PlaybackTime / fb.PlaybackLength);
                txt = fb.IsPaused ? "Paused" : fb.titleformat("%playback_time%").Eval() + " / " + length;
            }
            gr.FillGradRect( 0, 0, pos, wh-1, 90, RGB(128,128,128), RGB(0,0,0));
        } else if(fb.PlaybackTime > 0.1) {
            txt = fb.IsPaused ? "Paused" : fb.titleformat("%playback_time%").Eval() + " / LIVE";
        }
        gr.GdiDrawtext(txt, g_font, RGB(0, 255, 128), 0, 0, ww-10, wh, DT_VCENTER | DT_RIGHT | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(title, title_font, title_colour, text_x, wh -127, ww-text_x-10, wh, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(album, album_font, album_colour, text_x, wh - 80, ww-text_x-10, wh, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
        gr.GdiDrawText(artist, artist_font, artist_colour, text_x, wh - 55, ww-text_x-10, wh, DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
    }
    gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(137,140,149));
        

}

function on_mouse_lbtn_down(x,y){
    if(fb.IsPlaying && fb.PlaybackLength > 0) g_drag = 1;
}

function on_mouse_lbtn_up(x,y){
    if(g_drag) {
        g_drag = 0;
        g_drag_seek = x < 0 ? 0 : x > window.Width ? 1 : x / window.Width;
        fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
    }
}

function on_mouse_move(x,y){
    if(y > wh) g_drag = 0;
    if(g_drag) {
        g_drag_seek = x < 0 ? 0 : x > window.Width ? 1 : x / window.Width;
        window.Repaint();
    }
}


Line 88 is causing the problem (which is currently commented out):
Quote
scale(gr, album_img, 0, wh-20-album_img_size, album_img_size, album_img_size);


the console reports Object Expected error.

Could anyone help me out?

WSH Panel Mod script discussion/help

Reply #677
@djphatic:
Because you didn't have scale() function defined.

WSH Panel Mod script discussion/help

Reply #678
@djphatic:
Because you didn't have scale() function defined.

Thanks, appeared I was missing this line at the top:
// @import "%fb2k_path%scripts\marc2003\v2\common.js"

Now to figure out how to keep the album art on top of the seekbar instead of painting over it. - DONE!

WSH Panel Mod script discussion/help

Reply #679
Using the thumbs2 script from the templates marc2003 posted, I keep getting a crashed message every so often when it is switching images:

[18:20:14] Error: WSH Panel Mod (Thumbs2 by marc2003): Microsoft JScript runtime error:
Object required
Ln: 326, Col: 3

Line 326:    return true;

Anyone else having this issue?

WSH Panel Mod script discussion/help

Reply #680
This doesnt appear to work for me. I have spelling correction turned off and whilst the biography details are of those it has redirected to, it doesnt display the "redirected from" text. Has this been removed from the latest samples script?

Example: Swedish House Mafia feat. Pharrell - One (Your Name)

The biography panel displays the info from the Swedish House Mafia page which when viewing in my browser states I have been redirected from Swedish House Mafia feat. Pharrell page. The artist name in bold in the heading remains as Swedish House Mafia feat. Pharrell. As the thumbnails 2 panel displays the images from the Swedish House Mafia feat. Pharrell page.


i somehow fudged that. fixed version uploaded....

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip

as for your error in the post above, i have no idea....


WSH Panel Mod script discussion/help

Reply #682
I have saved a PLS-File of an internet radio station and play this file in foobar. Now I want to get the path and the name of this playlist. How can I get this information?

WSH Panel Mod script discussion/help

Reply #683
Hi!

I would like to add a "save as..." command in the right-click menu in a Last.fm image viewer/downloader panel (such as marc2003's thumbs.txt or MatthijsB's foo_silk-artistart)

Can somebody help me? I can add another line in the Menu but I don't what to do after (in the additional "case")

Thanks in advance,
Decalicatan_Decalicatan
Decalicatan Decalicatan

WSH Panel Mod script discussion/help

Reply #684
@Decalicatan_Decalicatan

Hi! (la compagnie créole  te salue également )

You want to save a displayed image from a WSH to disk ? i don't think there is a such method to do this in the actual version of WSH panel Mod ... afaik

bye.



WSH Panel Mod script discussion/help

Reply #685
with my scripts you can click the image and this will open it in a default viewer for that particular file extension. you can then "save as...". additionally, you'll find a "open containing folder" option on the context menu which will open explorer.

if you really want, you could use the CopyFile method in jscript. in my scripts the path to the current image is typically stored in this variable..

Code: [Select]
arr[index]

WSH Panel Mod script discussion/help

Reply #686
ok, thank you both for your quick answer. I will try with CopyFile or else I will use the open-file-then-save-as... method
Decalicatan Decalicatan

WSH Panel Mod script discussion/help

Reply #687
Sorry posted this in wrong thread will post there please ignore this

WSH Panel Mod script discussion/help

Reply #688
Hi,

I have an issue with marc2003's Now Playing script: If I quit foobar without stopping playback (for example after using Stop after current), the next time foobar starts the now playing panel crashes:

According to the console, it seems the problem is with the on_playback_new_track() which is called by: if(fb.IsPlaying) on_playback_new_track();

Code: [Select]
Error: WSH Panel Mod ({D58A2114-2A1E-492D-A9E3-8BB5AAD5F967}): Erreur d'exécution Microsoft JScript:
'title' est indéfini.
Ln: 110, Col: 3

Thanks in advance,

Decalicatan Decalicatan
Decalicatan Decalicatan


WSH Panel Mod script discussion/help

Reply #690
Is there a way to select multiple tracks and use a button to start for example
a contextmenu  action, like Tagging/Discogs... ?

I created a button for it but when I select a couple of tracks and push the button,
nothing happens.

This is a little snippet:
Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommand('Tagging/Get Tags From MusicBrainz (by TOC)');
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommand('Tagging/Discogs/Write Tags...');
    })
}


<3 f00

 

WSH Panel Mod script discussion/help

Reply #691
Is there a way to select multiple tracks and use a button to start for example
a contextmenu  action, like Tagging/Discogs... ?

I created a button for it but when I select a couple of tracks and push the button,
nothing happens.

This is a little snippet:
Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommand('Tagging/Get Tags From MusicBrainz (by TOC)');
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommand('Tagging/Discogs/Write Tags...');
    })
}


Bump..
<3 f00

WSH Panel Mod script discussion/help

Reply #692
Bump..


Try this:

Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommandWithMetadb('Tagging/Get Tags From MusicBrainz (by TOC)', fb.GetSelections());
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommandWithMetadb('Tagging/Discogs/Write Tags...', fb.GetSelections());
    })
}


WSH Panel Mod script discussion/help

Reply #694
Bump..


Try this:

Code: [Select]
$buttons = {
    MB1: new SimpleButton(5, 5, 200, 16, "MusicBrainz (by TOC)", function () {
        fb.RunContextCommandWithMetadb('Tagging/Get Tags From MusicBrainz (by TOC)', fb.GetSelections());
    }),
          Configure: new SimpleButton(5, 65, 80, 16, "Configure", function () {
        fb.RunContextCommandWithMetadb('Tagging/Discogs/Write Tags...', fb.GetSelections());
    })
}



Thanks a million Hitchhiker427.
Couldn't figure this out.
It works!
<3 f00

WSH Panel Mod script discussion/help

Reply #695
I'm a total noob on this. Just wanted to update my old foobar config and changed from WSH Panel to WSH Panel Mod but my scripts aren't running properly. My seekbar won't compile and the console says it's getting stuck at the following line:

Code: [Select]
gr.DrawImage(g_btn_img1,pos-3,7,8,8,0,0,8,8);

Think this is an easy one for you out there!

Thank you in advance!

EDIT:

Got it working!

Variable g_btn_img1 wasn't properly set, because of old components-folder!

WSH Panel Mod script discussion/help

Reply #696
there is an item "remove played tracks" in my main menu - playback. it is quite tedious to go there all the time just to have a look whether a tick is on or off right now. moreover, my main menu is hidden, so here i have some additional difficulties. checking the state of this item from context menu is more acceptable, but still it is not so convenient as it could be

is it possible to make a script that would allow me to create a button (with 2 different images for 2 states) for toggling the setting "remove played tracks"?
(i have such a script for "stop after current" and it is convenient and graphic as hell)

(i use: foo-bar 0.9.6.4; columns ui 0.3.6.4; remove played files 1.4.0; wsh panel (uie) 0.7.2; wsh panel mod 1.2.1)

WSH Panel Mod script discussion/help

Reply #697
there is an item "remove played tracks" in my main menu - playback. it is quite tedious to go there all the time just to have a look whether a tick is on or off right now. moreover, my main menu is hidden, so here i have some additional difficulties. checking the state of this item from context menu is more acceptable, but still it is not so convenient as it could be

is it possible to make a script that would allow me to create a button (with 2 different images for 2 states) for toggling the setting "remove played tracks"?
(i have such a script for "stop after current" and it is convenient and graphic as hell)

(i use: foo-bar 0.9.6.4; columns ui 0.3.6.4; remove played files 1.4.0; wsh panel (uie) 0.7.2; wsh panel mod 1.2.1)


This would be awesome.... You could make buttons for other functions like this as well like "Stop after current," "Playback follows cursor" etc.

WSH Panel Mod script discussion/help

Reply #698
You could make buttons for other functions like this as well like "Stop after current," "Playback follows cursor" etc.

yea, i know that it is possible to create these 3 buttons (stop after current, playback follows cursor, cursor follows playback). the point is that i never needed them at all (except for "stop after current"). i wanted to say that it would be nice to have a button for "remove played tracks" as well. unfortunately, i cannot make a script, so i would be grateful to a person who decides to write it

WSH Panel Mod script discussion/help

Reply #699
You could make buttons for other functions like this as well like "Stop after current," "Playback follows cursor" etc.

yea, i know that it is possible to create these 3 buttons (s


Wait, has a script already been written for these?