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

WSH Panel Mod script discussion/help

Reply #2475
Thank You!!! It's working

WSH Panel Mod script discussion/help

Reply #2476
I played a litle bit with the SetInterval function.
I want on playback new track that the text pop up in my pannel.
But only once and not untill eternity...
here Is my modified code from page 80

Code: [Select]
// -------------------------------------------------------------------------- //
// @name "TXT FX Alpha"
// -------------------------------------------------------------------------- //

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

DT_LEFT=0x00000000;
DT_CALCRECT = 0x00000400;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_NOPREFIX = 0x00000800;

var special_font = "Calibri";
var font_h = 1;
var font_h1 = 12;

function on_paint(gr) {
gr.GdiDrawText("XXXXXXXXXXXXXXX", gdi.Font(special_font, font_h, 1), RGB(0, 255, 0), 1,10, 404, 16, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
}

var TXT_Interval = 150;
var TXT_Timer;
var TXT_TimerStarted = false;

function onTXT_Timer() {
   
if (!TXT_TimerStarted) {

TXT_Timer = window.SetInterval(function () {
if (font_h >= font_h1) font_h = 0;
font_h += 1;
window.Repaint();
}, TXT_Interval);

TXT_TimerStarted = true;

}}

function stopTXT_Timer() {
window.ClearInterval(TXT_Timer);
TXT_TimerStarted = false;
}

function on_playback_stop(reason) {
if (reason != 2) {
stopTXT_Timer();
}}

function on_playback_pause(state) {
if (state) stopTXT_Timer();
else onTXT_Timer();
}

function on_playback_new_track() {
onTXT_Timer();
}

I hope somebody can help me.
Thank You

WSH Panel Mod script discussion/help

Reply #2477
Try this.

Code: [Select]
function onTXT_Timer() {

if (!TXT_TimerStarted) {
font_h = 0;
TXT_Timer = window.SetInterval(function () {

font_h += 1;   
if (font_h >= font_h1) {
stopTXT_Timer();
}
window.Repaint();
}, TXT_Interval);

TXT_TimerStarted = true;

}}

WSH Panel Mod script discussion/help

Reply #2478
Thank You Hunter!
Now it works.
Here is the Code...

Code: [Select]
// -------------------------------------------------------------------------- //
// @name "TXT FX Working"
// -------------------------------------------------------------------------- //

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

DT_CENTER = 0x00000001;
DT_CALCRECT = 0x00000400;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_NOPREFIX = 0x00000800;

var special_font = "Calibri";

var size_a0 = 12;
var size_a1 = 12;
var size_b0 = 11;
var size_b1 = 11;

function on_paint(gr) {

gr.GdiDrawText("FOOBAR", gdi.Font(special_font, size_a0, 1), RGB(0, 255, 0), 0,10, window.Width, 16, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
gr.GdiDrawText("2000", gdi.Font(special_font, size_b0, 0), RGB(0, 255, 0), 0,30, window.Width, 16, DT_CENTER | DT_CALCRECT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);

}

var TXT_Interval = 75;
var TXT_Timer;
var TXT_TimerStarted = false;

function onTXT_Timer() {

if (!TXT_TimerStarted) {
size_a0 = 1;
size_b0 = 1;
TXT_Timer = window.SetInterval(function () {

size_a0 += 1;
size_b0 += 1;

if (size_b0 >= size_b1) size_b0 = size_b1;
if (size_a0 >= size_a1) {
stopTXT_Timer();
}
window.Repaint();
}, TXT_Interval);

TXT_TimerStarted = true;

}}



function stopTXT_Timer() {
window.ClearInterval(TXT_Timer);
TXT_TimerStarted = false;
}



function on_playback_new_track() {
onTXT_Timer();
}

WSH Panel Mod script discussion/help

Reply #2479
Hi @marc2033, thanks for all your work.
I'm using Now Playing v1.4, and it's great. I've been trying to make a change, I want the thumbs to move forward one step on every image cycle.
I thought im.images was an array, so I've tried to do a .shift, and I've tried to change this.offset on every step, but I can't get it to work.
Is there some variable with the current image index? maybe I could use it to call this.wheel(index).
Let me know if it's feasible (and please consider a script update if you think it's worthy).

Thanks!

WSH Panel Mod script discussion/help

Reply #2480
How do I get library RelativePath in wshpanel mod.
I`m coding "WSH libray search and viewer" but I don`t know how to get library RelativePath;
WSH panel mod

WSH Panel Mod script discussion/help

Reply #2481
@patanpatan, i might think about making that change but it won't be for a good few days.

@vothanhdat, there are no library features at all in WSH panel mod.

WSH Panel Mod script discussion/help

Reply #2482
samples updated.

Code: [Select]
7.2013-06-09.01

"Thumbs" / "Now playing". Fix stupid bug where image cycle
mode would only work when the mouse pointer is over the
panel.


existing users: right click>Update script
full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

files changed:
Code: [Select]
marc2003\common7.js

WSH Panel Mod script discussion/help

Reply #2483
antheo

Here's very simple script for rotating image on playback time.

Code: [Select]
var image = gdi.Image(fb.FoobarPath + "images\\vinyl.jpg");
var angle = 0;

function on_paint(gr) {
   
    gr.DrawImage(image, 0, 0, 500, 500, 0, 0, image.width, image.height, angle);

}
function on_playback_time(time){
   
    if(angle >= 360) angle = 0;
    angle += 60;
    window.Repaint();   
   
}

I tested it with this Vinyl image

Being a complete coding noob, how would I be able to get this to work with a folder not in the foobar media library stored with png files that have been saved as "%album artist% - %album%.png".

The other catch is that the filenames of the images are all lower case, while in the foobar media library they are effectively title case (I'm not sure if that makes a difference for wsh panel).

WSH Panel Mod script discussion/help

Reply #2484
Hi,

First off I'm a totally new to Jscript or WSH Panel Mod but I'm trying to create a skin for foobar so I need it.
What I'm looking for is a script for a seek bar which is a half circle which slowly progresses as the song progresses.
And a similar one for the volume control. Where full volume would be and complete half circle and muted no circle.
I was wondering if this is at all possible. And if so, if somebody can help me with it.

Greetings,
Pure

WSH Panel Mod script discussion/help

Reply #2485
Example (PopupMenu): change and restore playlists.
foo_playcount is required to view the history and new.

Code: [Select]
// Use with MenuManager()
// {{
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;
// }}

function on_mouse_lbtn_up(x, y, mask) {
switch_playlist_menu(x, y);
return true;
}

function isQueuePlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "Queue Content") {
return i;
}
}
return -1;
}

function isLibraryPlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "Library") {
return i;
}
}
return -1;
}

function isHistoryPlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "History") {
return i;
}
}
return -1;
}

function isNewPlaylistPresent() {
for (var i = 0; i < plman.PlaylistCount; i++) {
if (plman.GetPlaylistName(i) == "New") {
return i;
}
}
return -1;
}

function ShowPlaylistQueue(focus_id) {
var total_pl = plman.PlaylistCount;
var queue_pl_idx = isQueuePlaylistPresent();
if (queue_pl_idx < 0) {
plman.CreatePlaylist(total_pl, "Queue Content");
queue_pl_idx = total_pl;
plman.ActivePlaylist = queue_pl_idx;
} else {
plman.ActivePlaylist = queue_pl_idx;
fb.ClearPlaylist();
};
var queue_total = plman.GetPlaybackQueueCount();
var vbarr = plman.GetPlaybackQueueContents();
var arr = vbarr.toArray();
var q_handlelist = plman.GetPlaylistSelectedItems(queue_pl_idx);
q_handlelist.RemoveAll();
for (var i = 0; i < queue_total; i++) {
q_handlelist.Add(arr[i].Handle);
};
plman.InsertPlaylistItems(queue_pl_idx, i, q_handlelist, false);
plman.SetPlaylistFocusItem(queue_pl_idx, focus_id);
}

function RenamePL(idx) {
fb.ActivePlaylist = idx;
fb.RunMainMenuCommand("File/Rename Playlist");
}

function switch_playlist_menu(x, y) {

var p = window.CreatePopupMenu();
var pr = window.CreatePopupMenu();

var act = plman.ActivePlaylist;
var ply_act = plman.PlayingPlaylist;
var prm = plman.PlaylistRecyclerManager;
var pl_count = plman.PlaylistCount;

p.AppendMenuItem(MF_STRING, 2000, "New playlist");
p.AppendMenuItem(MF_STRING, 895, "Autoplaylist...");
p.AppendMenuItem(MF_STRING, 2001, "Load playlist...");

if (pl_count >= 2) {
p.AppendMenuItem(MF_SEPARATOR, 0, 0);
for (var i = 0; i < pl_count; i++) {
if (plman.GetPlaylistName(i) != "New" && plman.GetPlaylistName(i) != "History" && plman.GetPlaylistName(i) != "Queue Content" && plman.GetPlaylistName(i) != "Library") {
var np = i == plman.PlayingPlaylist ? " (playing)" : "";
//var ap = fb.IsAutoPlaylist(i) ? "*" : "";
p.AppendMenuItem(MF_STRING, 2003 + i, plman.GetPlaylistName(i) + np);
try {
p.CheckMenuRadioItem(2003, 2003 + i, act + 2003);
} catch (e) {}
}
}
}

p.AppendMenuItem(MF_SEPARATOR, 0, 0);
p.AppendMenuItem(MF_STRING, 983, "Show Library" + (plman.GetPlaylistName(ply_act) == "Library" ? " (playing)" : ""));
p.AppendMenuItem(MF_STRING, 981, "Show New" + (plman.GetPlaylistName(ply_act) == "New" ? " (playing)" : ""));
p.AppendMenuItem(MF_STRING, 980, "Show History" + (plman.GetPlaylistName(ply_act) == "History" ? " (playing)" : ""));
var q_count = plman.PlaylistItemCount(isQueuePlaylistPresent());
var count_plq = (q_count > 0 ? " - " + q_count + (q_count > 1 ? " songs" : " song") : "");
p.AppendMenuItem(plman.IsPlaybackQueueActive() ? MF_STRING : MF_GRAYED | MF_DISABLED, 982, "Show Queue" + count_plq);
var pl_prd = plman.GetPlaylistName(act) == "New" ? 981 : plman.GetPlaylistName(act) == "History" ? 980 : plman.GetPlaylistName(act) == "Queue Content" ? 982 : plman.GetPlaylistName(act) == "Library" ? 983 : false;
p.CheckMenuRadioItem(980, 983, pl_prd);

p.AppendMenuItem(MF_SEPARATOR, 0, 0);
pr.AppendTo(p, prm.Count >= 1 ? MF_STRING : MF_GRAYED | MF_DISABLED, "Restore");
if (prm.Count >= 1) {
for (var irm = 0; irm < prm.Count; irm++) {
pr.AppendMenuItem(MF_STRING, 3001 + irm, prm.Name(irm));
}
}

var ret = p.TrackPopupMenu(x, y);
if (ret < 1000) {
switch (ret) {
case 980:
var total_pl = plman.PlaylistCount;
var history_pl_idx = isHistoryPlaylistPresent();
if (history_pl_idx < 0) {
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "History", "%last_played% DURING LAST 1 DAY SORT DESCENDING BY %last_played%", "", true);
history_pl_idx = total_pl;
plman.ActivePlaylist = history_pl_idx;
} else {
plman.ActivePlaylist = history_pl_idx;
fb.ClearPlaylist();
}
break;
case 981:
var total_pl = plman.PlaylistCount;
var new_pl_idx = isNewPlaylistPresent();
if (new_pl_idx < 0) {
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "New", "%added% DURING LAST 1 WEEK SORT DESCENDING BY %added%", "", true);
new_pl_idx = total_pl;
plman.ActivePlaylist = new_pl_idx;
} else {
plman.ActivePlaylist = new_pl_idx;
fb.ClearPlaylist();
}
break;
case 982:
ShowPlaylistQueue(0);
break;
case 983:
var total_pl = plman.PlaylistCount;
var library_pl_idx = isLibraryPlaylistPresent();
if (library_pl_idx < 0) {
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "Library", "%path% PRESENT");
library_pl_idx = total_pl;
plman.ActivePlaylist = library_pl_idx;
} else {
plman.ActivePlaylist = library_pl_idx;
fb.ClearPlaylist();
}
break;
case 895:
fb.ActivePlaylist = fb.CreateAutoPlaylist(fb.PlaylistCount, "", "");
RenamePL(fb.ActivePlaylist);
fb.ShowAutoPlaylistUI(fb.ActivePlaylist);
break;
}
} else {
switch (ret) {
case 2000:
fb.RunMainMenuCommand("File/New playlist");
break;
case 2001:
fb.RunMainMenuCommand("File/Load playlist...");
break;
default:
plman.ActivePlaylist = (ret - 2003);
}
}

if (ret > 3000) {
switch (ret) {
default:
(prm.Count >= 1) && prm.Restore(ret - 3001);
}
}

p.Dispose();
pr.Dispose();
return true;
}

WSH Panel Mod script discussion/help

Reply #2486
I'm finding Marc's weblinks (preferrably small weblinks version) quite useful, but I dont like the idea of it needing to generate web traffic to gather the artist links from the json data everytime a song is played. Would it be feasable and efficient enough to store successful retrieval of such data in a textfile or some other database type using WSH, and having an update button to manually update? If so, is there a script around already which works with a text/db file that does the same thing so I might could try to build something like this on my own, rather than begging Marc to do it?

Thanks

WSH Panel Mod script discussion/help

Reply #2487
it already caches data for each artist. it is stored for one week before it checks again for updates.

WSH Panel Mod script discussion/help

Reply #2488
Hey marc, thanks again for the scripts, I've been using them for a while now.

Just out of curiosity, is it possible to hide the buttons (Myspace/Discogs/Allmusic/etc) in the Now Playing script by commenting some of it out? Could you maybe point me to the lines I would need for that? Lines 69-73 seem to work, but I just want to double check.

Edit: I want to keep the Youtube button, so I tried swapping that one with the one that appears in the last line and commenting the rest out. It works okay at first, but then whenever I re-launch foobar all the buttons are back until I open the panel config and hit apply again. It doesn't help that I actually have no idea what I'm doing.

WSH Panel Mod script discussion/help

Reply #2489
on line 60, replace the whole b.update function with this..

Code: [Select]
b.update = function() {
    if (p.metadb) {
        var artist = encodeURIComponent(p.eval("%artist%"));
        var title = encodeURIComponent(p.eval("%title%"));
        var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
        b.buttons.youtube = new button(im.x + im.w - 32, bar2y - 1, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube);
    }
    window.RepaintRect(0, bar2y, im.w, bar2h);
}



 

WSH Panel Mod script discussion/help

Reply #2490
Works perfect, thank you!

WSH Panel Mod script discussion/help

Reply #2491
Hi marc,
Is it possible to add blur effect for cover artwork?
pretty much like the background on Poweramp Music Player for Android : https://play.google.com/store/apps/details?...layer&hl=en

one more thing, the last.fm charts codes from your sample, Is there any way to make the background transparent,
or at least change its color?

thank you very much!

WSH Panel Mod script discussion/help

Reply #2492
you can draw any image you like behind the artwork display. are you looking to edit the CD jewel case or artreader panel?

as for the transparent background, edit line 9...

Code: [Select]
var p = new panel("Last.fm Charts", ["lastfm_charts"]);


so it becomes

Code: [Select]
var p = new panel("Last.fm Charts", ["lastfm_charts", "custom_background"]);


now you can right click the panel>Background>None (None only appears when using columns UI - it's obviously not available when using default UI)



WSH Panel Mod script discussion/help

Reply #2493
thanks marc,

the artreader panel, so the bigger & blurred artwork for the background, and draw the smaller one on top of it (with shadow effect if it's possible).

WSH Panel Mod script discussion/help

Reply #2494
i'll be honest and say i don't really know what you mean. i can't make anything out from the screenshots in that link as they're all very small on a 1080p screen - i guess the page is more optimised for mobile devices.

also, i should say i'm useless at making things look pretty so i doubt i'd be able to implement it anyway.


WSH Panel Mod script discussion/help

Reply #2496
if that background image is dynamically generated from the colours in the artwork, i can't do that. it would be possible to use your own "wallpaper" image as a background. the shadow effect should be possible but i don't know how. i'll have to dig around and see if i can find someone else's code that does it.

hopefully someone with more artistic flair will read this and have a suggestion.


WSH Panel Mod script discussion/help

Reply #2498
here's a couple of quick bodge jobs i've made. it requires the marc2003 folder from my samples package and also  this image saved inside your foobar profile marc2003\images folder.

https://dl.dropboxusercontent.com/u/2280132.../july/splat.jpg

if you want to use your own background, you can edit the filename on line 14.

first one is just a plain front cover on the background...

screenshot - https://dl.dropboxusercontent.com/u/2280132...3/july/art1.png
download - https://dl.dropboxusercontent.com/u/2280132...3/july/art1.txt

the second one has a seekbar and track details.

screenshot -  https://dl.dropboxusercontent.com/u/2280132...3/july/art2.png
download -  https://dl.dropboxusercontent.com/u/2280132...3/july/art2.txt

(note the right click options to change centre/crop/stretch do not work. i'm not going to edit my common file just for this)

WSH Panel Mod script discussion/help

Reply #2499
Is there a way to send a command that jumps to the currently playing playlist, and highlights the playing track?

Basically I'd want a button that does the exact same thing as double clicking the status bar.

I know how to make the button I just don't know what the command would be, or if it is possible!

thanks!

edit: this is in DUI if that is relevant.