IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Setting global colours in CUI (elplaylist, Item details, WSH mod), based on current playing
arctic_hobo
post Jun 29 2013, 21:07
Post #1





Group: Members
Posts: 16
Joined: 19-October 10
From: London
Member No.: 84710



I'm trying to set a global theme colour from tags in CUI. Basically I'm trying to make the whole of foobar change to match an RGB tag in the currently playing track.
Trouble is, I'm at a loss. ELPlaylist doesn't seem to support scripting the background colour (only manually selecting), "Item Details" doesn't seem to support changing the background at all, and WSH... well WSH I'm still trying to get my head around.
So my questions 1 2 and 3 are, if anyone can help...

1. What's the most reliable way of setting a global variable, and where would I do it? It just need to read the tag of the currently-playing track.

2. Does anyone know how to script the background colour of ELPlaylist, or Item Details?

3. WSH - I've copied someone's code for album art display, and I *think* this is the bit I need to change: "window.GetColorCUI(3)" - but what should it show, and how can I access file tags in WSH?

Any and all help much appreciated! Thanks!
Go to the top of the page
+Quote Post
arctic_hobo
post Jul 7 2013, 19:51
Post #2





Group: Members
Posts: 16
Joined: 19-October 10
From: London
Member No.: 84710



Anyone?
Go to the top of the page
+Quote Post
WilB
post Jul 7 2013, 22:27
Post #3





Group: Members
Posts: 302
Joined: 20-July 06
Member No.: 33113



You could use panel stack splitter as a base (parent) splitter. Use $drawrect in the panel stack splitter script to draw a background rectangle of full width and height according to your tag colour. Script code runs on track change. Set el_playlist and wsh panel mod to use a pseudo transparent background. Position panels in panel stack splitter with forced layout and $movepanel for best background refresh. This method is restricted to panels that can be made transparent (e.g. you can also use channel spectrum, lyrics3 etc, but not item details [code the equivalent in panel stack splitter or better still wsh panel mod instead] and not most library viewers although es_playlist may work for you graphically or you may be able to find a wsh panel mod library viewer script with searching).

To answer your specific questions.

1. Your tag is a global variable that can be read by most panels. Problem is that you cannot script the background of many panels.
2. You can script the background in el_playlist with $drawrect but it will only show where there are displayed tracks.
3. You would need to go through the wsh panel mod documentation.

Simplest solution is as described in the first paragraph.

This post has been edited by WilB: Jul 7 2013, 22:38
Go to the top of the page
+Quote Post
arctic_hobo
post Jul 13 2013, 21:06
Post #4





Group: Members
Posts: 16
Joined: 19-October 10
From: London
Member No.: 84710



Thanks, that's really helpful. I'm really struggling with WSH and PSS, but I guess I'll have to learn the scripts! Beyond what you download with WSH, is there any documentation? The examples are a little tricky to understand, and I can't see any using standard track metadata. Has anyone coded a WSH "Item Details" panel?

Thanks,
Go to the top of the page
+Quote Post
marc2003
post Jul 13 2013, 21:30
Post #5





Group: Members
Posts: 4450
Joined: 27-January 05
From: England
Member No.: 19379



elplaylist and PSS expect RGB colours separated with dashes like this...

CODE
255-0-0


so if your tags contained values like that, simply using %tag% in the colour part of the various $drawtextex or $drawrect functions should work.

with WSH panel mod, there is an RGB function you can use...

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


so now you have 2 things to consider here: getting the tag and then splitting it into 3 values which you can pass into this function. there is a function named fb.TitleFormat which you can use like this

CODE
var temp_colour = fb.TitleFormat("%tag%").Eval()


note the above Eval() part only works on the playing track. if you want it to work on the selected track regardless of whether foobar is playing or not, you can do this...

CODE
var metadb = fb.GetFocusItem();
var temp_colour = fb.TitleFormat("%tag%").EvalWithMetadb(metadb);


now we have the value, we can use the javascript split function which creates a new array with the 3 RGB values.

CODE
var colour_array = temp_colour.split("-");
//finally pass the 3 values of this array to the RGB function.
var colour = RGB(colour_array[0], colour_array[1], colour_array[2]);


you can try picking apart this theme as it has WSH item details panel. http://extremehunter1972.deviantart.com/ar...013-4-368146015

This post has been edited by marc2003: Jul 13 2013, 21:31
Go to the top of the page
+Quote Post
arctic_hobo
post Jul 28 2013, 16:56
Post #6





Group: Members
Posts: 16
Joined: 19-October 10
From: London
Member No.: 84710



Thanks a lot, that's really helpful.
I just have 2 problems left now - firstly, is it possible to share variables between ELPlaylist sections? That is, 'group header', 'per second' and 'tracklist'? I can get the font to display in the colour of the album it belongs to, but not the now playing album.
And secondly, WSH works with the transparency great apart from one thing, which is that it doesn't refresh the transparent part properly. That's to say, on album changes (ie new PSS background) the transparent bit of WSH displays the last album. It disappears (ie updates) if I resize the window however. I've tried using window.Repaint() but with no joy. Is this a PSS or a WSH code issue?
Go to the top of the page
+Quote Post
marc2003
post Jul 29 2013, 20:38
Post #7





Group: Members
Posts: 4450
Joined: 27-January 05
From: England
Member No.: 19379



with ELplaylist, there is a field definitions tab where you can set variables to be shared without having to duplicate them.

as for the PSS/WSH transparency, try using $movepanel_c in your PSS code to force it to redraw the WSH panel. this might work but i don't use columns anymore so i can't test

$movepanel_c(my wsh panel,0,0,%ps_width%,%ps_height%)

the name in bold is whatever it's called on the Panellist tab and you might want to tweak the x,y,w and h values. you'll need to make sure forced layout is enabled for the panel as well.

This post has been edited by marc2003: Jul 29 2013, 20:41
Go to the top of the page
+Quote Post
arctic_hobo
post Jul 29 2013, 21:00
Post #8





Group: Members
Posts: 16
Joined: 19-October 10
From: London
Member No.: 84710



Thanks, the movepanel worked like a charm!
As for the ELPlaylist field definitions, I can't see how to set them using script? I've tried entering the tag as the value but it still reads it differently each time. I want to set it in 'group header' then call it in 'track list', but even if I use $put(a) in 'Group header', then the field definition of %b% as $get(a), calling %b% in 'track list' doesn't work.

Is there a way to do $put(%b%,a) ? If I try that, it doesn't work - is there a different store command in the script?

Thanks again for all your help.
Go to the top of the page
+Quote Post
marc2003
post Jul 29 2013, 22:22
Post #9





Group: Members
Posts: 4450
Joined: 27-January 05
From: England
Member No.: 19379



whatever name you give a variable on the field definitions tab, you can access it in all the other tabs using %% around it like this

%myvariable%
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd August 2014 - 11:46