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

WSH Panel Mod script discussion/help

Reply #4400
Marc,

I am using your "track info + seekbar + buttons"
I didn't use Foobar for about a year.
Really want to now how to change the font in this script.
Can you help me?

Maybe obvious but can't find it in the forums.

Thx

WSH Panel Mod script discussion/help

Reply #4401
define your fonts at the start of the script.

Code: [Select]
var font = _.gdiFont("name", size);


if you want bold then add 1 like this...

Code: [Select]
var font = _.gdiFont("name", size, 1);


then inside the on_paint function you'll find 2 uses of panel.fonts.normal/panel.fonts.title. replace those with the new font(s) you've created.

WSH Panel Mod script discussion/help

Reply #4402
define your fonts at the start of the script.

Code: [Select]
var font = _.gdiFont("name", size);


if you want bold then add 1 like this...

Code: [Select]
var font = _.gdiFont("name", size, 1);


then inside the on_paint function you'll find 2 uses of panel.fonts.normal/panel.fonts.title. replace those with the new font(s) you've created.



Thx,
Works great.


WSH Panel Mod script discussion/help

Reply #4403
Hello, thank you for the basic now playing script, it's perfect !

I use some old scripts like this :



Sample :

Code: [Select]
// LFM Panel for StrigUI
// reworked version of LastFM panel (so_kindly) with included LFM Love button from s8e skin by Maxim Terpilovsky

// ==PREPROCESSOR==
// @name "WSH Last.fm panel"
// @import "%fb2k_profile_path%\marc2003\scripts\Flags.js"
// @import "%fb2k_profile_path%\marc2003\scripts\Helpers.js"
// @import "%fb2k_profile_path%\marc2003\images\WSH LastFM\md5.js"
// @import "%fb2k_profile_path%\marc2003\scripts\WSH_LastFM.js"
// ==/PREPROCESSOR==

// Register here: http://www.last.fm/api/account


How can i add your new scripts like now playing new script, and save old scripts ?

And how can i put auto download of pictures on your new basic now playing scripts ?

Thank's

WSH Panel Mod script discussion/help

Reply #4404
Hi,
Stupid question: how do I add an image to, for example, the 'last.fm bio' script? The WSH documentation is kinda lacking... Or maybe I'm looking in the wrong place. My changes:
Code: [Select]
//var lastfm_logo = gdi.CreateImage(1, 1);
var lastfm_logo = gdi.Image("%fb2k_profile_path%\themes\flower\images\misc\lastfm_logo.png");

function on_paint(gr) {
    panel.paint(gr);
    //gr.FillSolidRect(0, 0, panel.w, 24, panel.colours.header);
    gr.GdiDrawText(text.header_text(), panel.fonts.title, panel.colours.highlight, 5, 0, panel.w - 15, 30, LEFT);
    //DrawImage(IGdiBitmap, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, angle = 0, alpha = 255);
    gr.DrawImage(lastfm_logo, 5, 5, 139, 44, 0, 0, 139, 44);
    gr.DrawLine(panel.w - 5, 28, 5, 28, 1, panel.colours.highlight);
    text.paint(gr);
}

Replacing the rectangle with a line was simple enough, but the image is causing problems:
Code: [Select]
WSH Panel Mod (Last.fm Bio by marc2003): JavaScript runtime error:
Type mismatch
File: <main>
Line: 31, Col: 2
<source text only available at compile time>

I guess that the lastfm_logo isn't being loaded correctly... Why? I've tried using absolute paths and fb.FoobarPath. No dice.

WSH Panel Mod script discussion/help

Reply #4405
How can i add your new scripts like now playing new script, and save old scripts ?


just add more panels to your layout. if you're using any kind of scripts, you must already know how to do this!

and i'm not providing any method to automatically download images. if you don't like the current functionality then don't use it.

@JohnFlower

Code: [Select]
var lastfm_logo = gdi.Image(fb.ProfilePath + "themes\\flower\\images\\misc\\lastfm_logo.png");

WSH Panel Mod script discussion/help

Reply #4406
@marc2003

I'm looking at tweaking properties and was wondering if title formatting can be used for two tags values (mood & rating) and if certain multi-value fields can be comma separated instead of $crlf()-esque like they are now. I have disabled autoplaylist creation and cursor change on hover because I prefer very specific APs to the click and create generated by this script.

Image.

Multi-value fields like genre and styles: Just a comma separated line of values straight out from field name. Doable?

Mood - Can something like code below be used? Pretty much a time stamp fetch.

Rating - Show dots/stars/some kind of font icon in place of numerical value?

Mood code from CUI Item Details panel below.

Code: [Select]
[LOVED  :  $if(%mood%,$select($day_of_month(%last_modified%),1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31) $select($month(%last_modified%),JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC) $year(%last_modified%))$crlf()]

WSH Panel Mod script discussion/help

Reply #4407
How can i add your new scripts like now playing new script, and save old scripts ?


just add more panels to your layout. if you're using any kind of scripts, you must already know how to do this!

and i'm not providing any method to automatically download images. if you don't like the current functionality then don't use it.

@JohnFlower

Code: [Select]
var lastfm_logo = gdi.Image(fb.ProfilePath + "themes\\flower\\images\\misc\\lastfm_logo.png");



Why you say this ? In your olders scripts, the images on last fm are downloaded automatically...

WSH Panel Mod script discussion/help

Reply #4408
Quote
if you don't like the current functionality then don't use it.

WSH Panel Mod script discussion/help

Reply #4409
Hmm. Mood idea can get tanked. Sorry. I have some files that used a component Zao made that just sets a 1 or none Mood value. Falstaff's JS playlist versions sets the actual time stamp for a value.

Guess I'll have to pick one or the other.

WSH Panel Mod script discussion/help

Reply #4410
Quote
$select($day_of_month(%last_modified%),1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31)


there's a solution to a problem that doesn't exist.

WSH Panel Mod script discussion/help

Reply #4411
Heh. That was copied pretty much verbatim from a text display config I saw somewhere. It worked perfectly. Never thought twice about it after that.


WSH Panel Mod script discussion/help

Reply #4413
Is there a way to make this stunt work?

Code: [Select]
{normal : !fb.IsPlaying || fb.IsPaused ? "mono\\3a.png", hover: "mono\\3h.png" : "mono\\4a.png", hover: "mono\\4h.png"}, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? "Play" : "Pause");

WSH Panel Mod script discussion/help

Reply #4414
speak english.

WSH Panel Mod script discussion/help

Reply #4415
Add hover images.

WSH Panel Mod script discussion/help

Reply #4416
Quote
{normal : !fb.IsPlaying || fb.IsPaused ? "mono\\3a.png", hover: "mono\\3h.png" : "mono\\4a.png", hover: "mono\\4h.png"}


well you can't use hover more than once and if you want to use operators with ? and : then make sure they're formed like this.

Code: [Select]
condition ? "use this.png" : "else use this.png"

WSH Panel Mod script discussion/help

Reply #4417
a couple of minor issues fixed here: https://github.com/19379/wsh_marc2003/releases

also, users of my autoplaylists/properties scripts need to make sure they have v11 or later if using the latest WSH component v1.6.0.

WSH Panel Mod script discussion/help

Reply #4418
A new version of YouTube Track Manager (v1.8) has been released.

  - *IMPROVED* radio modes, including:

  - *NEW* Library radio: offers similar artists, two genre modes (one uses music file genre tags; other is independent) & single artist. It uses last.fm similar artists and genre artists lists and your own track popularity data to bias towards playing your favourite music. Avoids YouTube tracks.

  - Album manager. *NEW* options for better integration with media library and automatically generating m-TAGS files using album track lists from MusicBrainz and last.fm. Albums can be built from exclusively media library tracks, exclusively YouTube links or a mixture of both where media library tracks are preferred.

  - Nowplaying panel. *NEW* image only mode (mouse middle click or menu): acts as an album artwork panel for covers and artist images. Dual functionality is useful if you no longer wish to look at album and track lists.

Download and full CHANGELOG here.

WSH Panel Mod script discussion/help

Reply #4419
Add hover images.

I'm not sure what  you're trying to accomplish but since it's the only thing I managed to do (probably copied  ) while modifying .js buttons, three states play-pause with hover:
Code: [Select]
new button(0, 0, 28, 21, {normal: (fb.IsPlaying?(fb.IsPaused?"npause.png":"nplay.png"):"nPlayPause.png"), hover: (fb.IsPlaying?(fb.IsPaused?"cpause.png":"cplay.png"):"cPlayPause.png")}, function() { fb.PlayOrPause(); }),


WSH Panel Mod script discussion/help

Reply #4420
Exactly what I was after. Thanks.

WSH Panel Mod script discussion/help

Reply #4421
here's a quick and dirty example of using 2 WSH panels to mimic PSS panel switching...



the panel in the middle "listens" for notifications from the panel on the left and loads the appropriate script whenever text is clicked. it should be easy to figure out how to edit it.

these scripts require my current samples...

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003"
// @name "Panel Chooser"
// @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"
// ==/PREPROCESSOR==

var panel = new _.panel("Panel Chooser");
var row_height;
var index = -1;
var scripts = {
"Album art" : "wsh_marc2003\\samples\\album art.txt",
"Allmusic" : "wsh_marc2003\\samples\\allmusic review.txt",
"Last.fm Bio" : "wsh_marc2003\\samples\\last.fm bio.txt",
"Last.fm Info" : "wsh_marc2003\\samples\\last.fm artist info - user charts - recommendations - recent tracks.txt",
"Musicbrainz" : "wsh_marc2003\\samples\\musicbrainz.txt",
"News / Reviews / Blogs" : "wsh_marc2003\\samples\\echonest news - reviews - blogs.txt",
"Properties" : "wsh_marc2003\\samples\\properties.txt",
"Thumbs" : "wsh_marc2003\\samples\\thumbs.txt"
}

function on_size() {
panel.size();
}

function on_paint(gr) {
panel.paint(gr);
row_height = panel.fonts.title.Height + 10;
if (index < _.size(scripts))
gr.FillSolidRect(0, index * row_height, panel.w, row_height, panel.colours.header);
_.forEach(_.keys(scripts), function (item, i) {
gr.GdiDrawText(item, panel.fonts.title, panel.colours.text, 5, i * row_height, panel.w - 10, row_height, LEFT);
});
}

function on_mouse_move(x, y) {
var new_index = _.floor(y / row_height);
if (index != new_index) {
index = new_index
window.SetCursor(index < _.size(scripts) ? IDC_HAND : IDC_ARROW);
window.Repaint();
}
}

function on_mouse_lbtn_up(x, y) {
if (index < _.size(scripts))
window.NotifyOthers("load_script", _.values(scripts)[index]);
}

function on_mouse_leave() {
index = -1;
window.Repaint();
}

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003"
// @name "Panel Receiver"
// ==/PREPROCESSOR==

var script = window.GetProperty("2K3.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 fq = lines[i].indexOf("\"") + 1;
var lq = lines[i].lastIndexOf("\"") - fq;
var file = lines[i].substr(fq, lq).replace("%fb2k_profile_path%", fb.ProfilePath);
pre += utils.ReadTextFile(file) + "\n";
} else if (lines[i].indexOf("// ==/PREPROCESSOR==") == 0) {
break;
}
}
}
eval(pre + text);
(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("2K3.SCRIPT", info);
window.Reload();
}
} else if (original_callback) {
original_callback(name, info);
}
}
})(this);

WSH Panel Mod script discussion/help

Reply #4422
here's a quick and dirty example of using 2 WSH panels to mimic PSS panel switching...


Thanks a lot...now I have to start on a whole new batch of configs. 



aka: that's frickin' awesome. thanks!

WSH Panel Mod script discussion/help

Reply #4423
@marc2003

Can you give any quick examples of how to replace the 'text buttons' with images? Using your last CUI config screenshot in the appearance thread as an example - left panel switcher icons. Though that is probably PSS, it's the look I'm trying to convey here. Mostly curious if a generic button image can be used and located automatically based on the number of scripts used. As it does it now with the text buttons. Just to make myself even clearer.

Currently your examples are like:

"Art" : "wsh_marc2003\\samples\\album art.txt",

Asking if:

"some generic button image" : "wsh_marc2003\\samples\\album art.txt",

Can be substituted.

WSH Panel Mod script discussion/help

Reply #4424
i'd forget about trying to mod that text based script and just use a button script. here's an example of 2 buttons to start off...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%wsh_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%wsh_marc2003\js\helpers.js"
// ==/PREPROCESSOR==

var buttons = new _.buttons();

buttons.buttons.albumart = new _.button(0, 0, 36, 36, {normal : "mono\\appbar.cd.png"}, function () {
    window.NotifyOthers("load_script", "wsh_marc2003\\samples\\album art.txt");
}, "Album art");

buttons.buttons.properties = new _.button(0, 36, 36, 36, {normal : "mono\\appbar.information.circle.png"}, function () {
    window.NotifyOthers("load_script", "wsh_marc2003\\samples\\properties.txt");
}, "Properties");

function on_paint(gr) {
    //using dark background because those example images are white
    gr.FillSolidRect(0, 0, window.Width, window.Height, _.RGB(30, 30, 30));
    buttons.paint(gr);
}

function on_mouse_move(x, y) {
    buttons.move(x, y);
}

function on_mouse_leave() {
    buttons.leave();
}

function on_mouse_lbtn_up(x, y) {
    buttons.lbtn_up(x, y);
}


note that images don't have to be relative to my images folder like the examples above. you can specify the full path to an image and that would work as well. eg

Code: [Select]
fb.ProfilePath + "themes\\machinehead\\image1.png"