IPB

Welcome Guest ( Log In | Register )

HTPC Fullscreen panels II, for foo_uie_wsh_panel_mod
ojdo
post Dec 31 2009, 18:18
Post #1





Group: Members
Posts: 894
Joined: 18-June 06
From: Germany
Member No.: 31980



Introduction
This thread is the continuation of HTPC Fullscreen panels where I posted my configurations for foo_uie_trackinfo_mod which is now a problematic component. So I had the desire to resettle to a stable component with the same (or better) features. I found it in the component WSH Panel Mod by T.P Wang (official thread with download). For now there is just one configuration, but I have the strong feeling that I will continue to change my current design...

Requirements and usage
My panel configurations depend on Columns UI and WSH Panel Mod. In order to use them, I recommend to set up a layout in Preferences > Display > Columns UI, Tab Layout like this:
CODE
Vertical splitter
+- WSH Panel Mod
\- NG Playlist [hidden]

The hidden playlist is just there to make keyboard shortcuts run properly. I use them to switch back and forth between different layouts (browsing and the fullscreen panels you find here).

Then just copy and paste the text file's contents into the configuration dialog you can find in the WSH panel context menu.


WSHtpc01
My first real try to make a proper layout with WSH panel. It still feels less "natural" than with foo_uie_trackinfo_mod, but performance-wise (=less CPU load) the WSH panel is much better.


Attached File  WSHtpc01_0.1.txt ( 6.54K ) Number of downloads: 1251


This post has been edited by ojdo: Dec 31 2009, 18:25


--------------------
http://freemusi.cc/
Go to the top of the page
+Quote Post
 
Start new topic
Replies
marc2003
post Nov 18 2011, 12:43
Post #2





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



i guess Chipicui means cycle through all images in a folder at an interval of so many seconds. i have a similar feature in my own scripts.

mine works like this.

-read all images into an array using utils.glob on a folder path/file mask
-create a new array of image objects from these file paths
-display the first image
-after a set interval, increment the value of the current image by one.
-remeber to handle reaching the end of the array by going back to 0.
Go to the top of the page
+Quote Post
ojdo
post Nov 26 2011, 03:32
Post #3





Group: Members
Posts: 894
Joined: 18-June 06
From: Germany
Member No.: 31980



New version 0.2.0. Changes from 0.1.3:
  • new option: display "globbed" images on rotation OR (old behaviour) front cover from album art reader.
  • mouse interaction: click on album for play/pause, click on right/left border for next/prev song; click on progress bar for seeking
Download
Attached File  WSHtpc04_0.2.0.zip ( 95.23K ) Number of downloads: 165



--------------------
http://freemusi.cc/
Go to the top of the page
+Quote Post
Oery
post Nov 26 2011, 07:59
Post #4





Group: Members
Posts: 11
Joined: 24-September 11
Member No.: 93936



QUOTE (ojdo @ Nov 26 2011, 09:32) *
New version 0.2.0. Changes from 0.1.3:
  • new option: display "globbed" images on rotation OR (old behaviour) front cover from album art reader.
  • mouse interaction: click on album for play/pause, click on right/left border for next/prev song; click on progress bar for seeking
Download
Attached File  WSHtpc04_0.2.0.zip ( 95.23K ) Number of downloads: 165

Thank you, working perfectly smile.gif
I'm just missing CD Jewel Case..... pls consider to attach it again
Go to the top of the page
+Quote Post
ojdo
post Nov 26 2011, 14:27
Post #5





Group: Members
Posts: 894
Joined: 18-June 06
From: Germany
Member No.: 31980



QUOTE (Oery @ Nov 26 2011, 07:59) *
I'm just missing CD Jewel Case..... pls consider to attach it again
Sorry, I won't do that - I'm done with jewel cases, as a growing part of my music collection never got released on physical medium. Anyway, it's just adding two or three lines of code to the panel's on_paint function. You might want to try adding the code yourself:

1. Search or prepare a set of jewel case images. Usually two: one for the case border and a transparent reflection image.
2. Search for the two sections beginning with if (albumart) in the on_paint function. Locate the line that draws the image itself: gr.DrawImage(albumart, [...]). Just before that line, add an identical line that paints the jewel case. (Search for bg_image to see how to create an image object that can be drawn by DrawImage.) After the albumart line, add a copy that draws the reflection imge.
3. Play around with the positional function arguments (the ones using albumart_size[x] or aa_size[x]) until you get the placement right. A bit of pen-and-paper arithmetic and measuring out the exact image dimensions in a graphics application might help.
4. Enjoy your own, custom made now playing panel!


--------------------
http://freemusi.cc/
Go to the top of the page
+Quote Post
starterz
post Nov 27 2011, 11:52
Post #6





Group: Members
Posts: 40
Joined: 22-August 02
From: Macedonia
Member No.: 3150



Thank you for this. I am really going to try customizing, and come back with results. All best.

This post has been edited by db1989: Dec 1 2011, 13:06
Reason for edit: removing unnecessary full quote of above post


--------------------
In the province of the mind, there are no limits.
Go to the top of the page
+Quote Post
starterz
post Nov 27 2011, 17:00
Post #7





Group: Members
Posts: 40
Joined: 22-August 02
From: Macedonia
Member No.: 3150



Not as easy as I thought :-) I have two great images for the jewel case and the gloss, which I have used for a long time with your HTPC07.

I would like to use only the "extended" version of the panel, with the tag information on the left and the cover art in a jewel case on the right.

As I understand up untill now:

Here:

CODE
// BACKGROUND IMAGE
pref["bg_image"] = fb.ProfilePath+"images/WSHtpc04/diagonal-stripes.png";

I have to create two more entries for the jewel case and gloss images.

CODE
pref["bg_image"] = fb.ProfilePath+"images/WSHtpc04/case.png";
pref["bg_image"] = fb.ProfilePath+"images/WSHtpc04/gloss.png";

Here:

CODE
// INIT
// ALBUM ART
var albumart      = null;                        // albumart image
var albumart_size = new Array(0,0,0,0);          // position (big image)
var aa_size       = new Array(0,0,0,0);          // position (small image)
var image_bg      = gdi.Image(pref["bg_image"]); // background image

I have to create two more entries for the jewel case and gloss, but can I name them bg_jewel and bg_gloss?

CODE
var jewel_bg      = gdi.Image(pref["bg_jewel"]); // cd case
var gloss_bg      = gdi.Image(pref["bg_gloss"]); // cd gloss

Afterwards:

CODE
       // Small albumart on the right
        if (albumart) {
            shadow_image && gr.DrawImage(shadow_image, aa_size[0]-geo["aa_shadow"],aa_size[1]-geo["aa_shadow"],aa_size[2]+2*geo["aa_shadow"],aa_size[3]+2*geo["aa_shadow"],0,0,shadow_image.Width,shadow_image.Height);
gr.DrawImage(jewel_bg, aa_size[0], aa_size[1], aa_size[2], aa_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawImage(albumart, aa_size[0], aa_size[1], aa_size[2], aa_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawImage(gloss_bg, aa_size[0], aa_size[1], aa_size[2], aa_size[3], 0, 0, albumart.Width, albumart.Height);

            gr.DrawRect(aa_size[0]-1,aa_size[1]-1,aa_size[2]+1,aa_size[3]+1,1,col["aa_border"]);
            if (fb.IsPaused) { gr.FillSolidRect(aa_size[0],aa_size[1],aa_size[2],aa_size[3],RGBA(0,0,0,150)); }
        }

This should be also done in the // BIG ALBUMART part, I suppose.

Just tell me if I am on the right path :-) How do I disable the //BIG ALBUMART version of the panel? Is the size of the jewel/gloss images important, or the script will resize them too like the album art image?

Thanks and all best.

This post has been edited by db1989: Dec 1 2011, 13:09
Reason for edit: placing code in [code] tags for readability


--------------------
In the province of the mind, there are no limits.
Go to the top of the page
+Quote Post
starterz
post Nov 27 2011, 21:47
Post #8





Group: Members
Posts: 40
Joined: 22-August 02
From: Macedonia
Member No.: 3150



OK, I got this far, I can see the gloss on the album art, but not the jewel case. Please help :-)

CODE
//
// WSHtpc04
//
// Description a fullscreen now-playing script for foo_uie_wsh_panel
// Author ojdo
// Version 0.2.0
// Last change 2011-11-26
// --------------------------------------------------------------------------------------

// CONFIGURATION //////////////////////////////////////

// faux "associative arrays" for settings
var tf = new Object(); // titleformating strings
var ft = new Object(); // fonts
var col = new Object(); // colours
var geo = new Object(); // sizes
var pref = new Object(); // preferences

// TEXTS
tf["title"] = "%title%";
tf["artist"] = "[%artist%]";
tf["grid"] = Array( // simply add, change or remove entries to change grid layout
Array("Album", "[%album%]"),
Array("Track", "$if(%tracknumber%,$num(%tracknumber%,1)$if(%totaltracks%,/$replace($num(%totaltracks%,1),0,₀,1,₁,2,₂,3,₃,4,₄,5,₅,6,₆,7,₇,8,₈,9,₉)))$ifgreater(%totaldiscs%,1, CD %discnumber%/$replace($num(%totaldiscs%,1),0,₀,1,₁,2,₂,3,₃,4,₄,5,₅,6,₆,7,₇,8,₈,9,₉),)"),
Array("Genre", "[%genre%]"),
Array("Style", "[%style%]"),
Array("Publisher", "[%publisher%]"),
Array("Release", "[%release%]"),
Array("Play count", "$puts(X,10)$repeat($repeat(I,$get(X)) ,$div(%play_count%,$get(X)))$repeat(I,$mod(%play_count%,$get(X)))"),
Array("URL", "$if(%source webpage url%,$left($put(url,$replace(%source webpage url%,'http://',,www.,)),$sub($strchr($get(url),/),1)))"),
Array("Rating", "$repeat(IIIII ,%rating%)"),
Array("Mood", "$repeat(IIIII ,%mood%)")
);

// TIMING
pref["t_start"] = 30; // seconds to display tag grid after track change
pref["t_tag"] = 5; // seconds to display tag grid on tag change

// GLOB PICTURES
pref["aa_glob"] = true; // true: use glob, false: use albumart reader (front only)
pref["aa_glob_shuffle"] = false; // true: random order, false: ordered like found by glob_paths
pref["t_aa_glob"] = 20; // seconds per image
tf["glob_paths"] = Array( // simply add, change or re-order entries
"$replace(%path%,%filename_ext%,)folder*",
"$replace(%path%,%filename_ext%,)*.jpg",
"$replace(%path%,%filename_ext%,)*.png",
"$replace(%path%,%directoryname%\\%filename_ext%,)folder.jpg"
);

// FONTS
ft["title"] = gdi.Font("Calibri",40,0);
ft["artist"] = gdi.Font("Calibri",24,0);
ft["grd_key"] = gdi.Font("Calibri",14,0);
ft["grd_val"] = gdi.Font("Calibri",16,0);
ft["lower_bar"] = gdi.Font("Calibri",18,0);

// COLOURS
col["title"] = RGB(255,255,255);
col["artist"] = RGB(192,192,192);
col["grd_key"] = RGB(090,090,090);
col["grd_val"] = RGB(192,192,192);
col["btm_key"] = RGB(090,090,090);
col["btm_val"] = RGB(192,192,192);
col["bg"] = RGB(000,000,000);
col["rating"] = RGB(255,128,000);
col["mood"] = RGB(000,128,255);
col["prgrss_fill"] = RGBA(255,255,255,050);
col["prgrss_line"] = RGBA(255,255,255,050);

// ALBUM ART DISPLAY PROPERTIES
col["aa_border"] = RGBA(060,060,060,128);
col["aa_shadow"] = RGBA(000,000,000,255);
geo["aa_shadow"] = 22; // size of albumart shadow

// BACKGROUND IMAGE
pref["bg_image"] = fb.ProfilePath+"images/WSHtpc04/diagonal-stripes.png";
pref["bg_case"] = fb.ProfilePath+"images/WSHtpc04/case.png";
pref["bg_gloss"] = fb.ProfilePath+"images/WSHtpc04/gloss.png";

// END OF CONFIGURATION /////////////////////////////////

// INIT
// ALBUM ART
var albumart = null; // albumart image
var albumart_size = new Array(0,0,0,0); // position (big image)
var aa_size = new Array(0,0,0,0); // position (small image)
var image_bg = gdi.Image(pref["bg_image"]); // background image
var case_bg = gdi.Image(pref["bg_case"]); // cd case
var gloss_bg = gdi.Image(pref["bg_gloss"]); // cd gloss

var textrender = gdi.CreateStyleTextRender(); // anti-aliased text
var str = new Object();
var img = new Object();
var pbtext = new Array("Default", "Repeat (Playlist)", "Repeat (Track)", "Random", "Shuffle (tracks)", "Shuffle (albums)", "Shuffle (folders)");

var metadb_handle = null; // watch db for tag changes
var timer; // 40ms repaint of progress bar

// TIMER & STATUS
var ww = 0, wh = 0; // size of panel
var start_timer = 0; // timer for panel layout after track change
var glob_timer = 0; // timer for glob albumart cycle
var tag_timer = 0; // timer for panel layout after tag change
var pb_timer = 0; // timer for playback_order text
var last_pb; // saves last playback order
var g_drag = 0; // status variable for clickable progress bar

var aa_list = new Array();
var aa_k = 0;

// Function: Remove duplicates from array
Array.prototype.myUnique = function(){
var r = new Array();
o:for(var i = 0; i < this.length; i++) {
for(var x = 0; x < r.length; x++) {
if(r[x]==this[i]) {
continue o;
}
}
r[r.length] = this[i];
}
return r;
};


// Call initialization function
on_init();

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function on_paint(gr) {
gr.SetTextRenderingHint(5);
gr.SetSmoothingMode(4);
//gr.SetInterpolationMode(7);

// Background
gr.FillSolidRect(-1,-1,ww+2,wh+2,col["bg"]);
gr.DrawImage(image_bg, 0,0,ww,wh-geo["lower_bar_h"]-1, 0,0,image_bg.Width,image_bg.Height-geo["lower_bar_h"]-1);

if (ww > 600 && ((tag_timer < pref["t_tag"]*25) || (start_timer < pref["t_start"]*25))) {

// TAG GRID & ALBUMART

// Small albumart on the right
if (albumart) {
shadow_image && gr.DrawImage(shadow_image, aa_size[0]-geo["aa_shadow"],aa_size[1]-geo["aa_shadow"],aa_size[2]+2*geo["aa_shadow"],aa_size[3]+2*geo["aa_shadow"],0,0,shadow_image.Width,shadow_image.Height);
gr.DrawImage(case_bg, aa_size[0], aa_size[1], aa_size[2], aa_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawImage(albumart, aa_size[0], aa_size[1], aa_size[2], aa_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawImage(gloss_bg, aa_size[0], aa_size[1], aa_size[2], aa_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawRect(aa_size[0]-1,aa_size[1]-1,aa_size[2]+1,aa_size[3]+1,1,col["aa_border"]);
if (fb.IsPaused) { gr.FillSolidRect(aa_size[0],aa_size[1],aa_size[2],aa_size[3],RGBA(0,0,0,150)); }
}

// Artist & title
textrender.EnableShadow(true);
textrender.ResetShadow();
textrender.GlowText(col["title"], col["bg"], 6);
if(str["title"]) { textrender.RenderStringRect(gr, str["title"], ft["title"], 0.025*ww, 0.175*wh, 0.5*ww, 40, StringFormat(0,0,4)); }
textrender.GlowText(col["artist"], col["bg"], 6);
if(str["artist"]) { textrender.RenderStringRect(gr, str["artist"], ft["artist"], 0.025*ww, 0.175*wh+50, 0.5*ww, 20, StringFormat(0,0,4)); }

// Tag grid
for (k=0; k<str["grid"].length; k++) {
key = str["grid"][k][0];
value = str["grid"][k][1];
if(value) {
if(k%2 == 0 || ww > 780) {
cell_width = (ww <= 780) ? 0.5*ww-80 : 0.25*ww-80;
textrender.GlowText(col["grd_key"], col["bg"], 3);
textrender.RenderStringRect(gr, key, ft["grd_key"], 0.025*ww + (k%2)*0.25*ww, 0.45*wh+Math.floor(k/2)*30+3, cell_width, 20, StringFormat(0,0,4));
switch (key) {
case "Rating": textrender.GlowText(col["rating"], col["bg"], 3); break;
case "Mood": textrender.GlowText(col["mood"], col["bg"], 3); break;
default: textrender.GlowText(col["grd_val"], col["bg"], 3);

}
textrender.RenderStringRect(gr, value, ft["grd_val"], 0.025*ww+80 + (k%2)*0.25*ww, 0.45*wh+Math.floor(k/2)*30, cell_width, 20, StringFormat(0,0,4));
}
}
}
} else {

// BIG ALBUMART
if (albumart) {
shadow_image && gr.DrawImage(shadow_image, albumart_size[0]-geo["aa_shadow"],albumart_size[1]-geo["aa_shadow"],albumart_size[2]+2*geo["aa_shadow"],albumart_size[3]+2*geo["aa_shadow"],0,0,shadow_image.Width,shadow_image.Height);
gr.DrawImage(case_bg, albumart_size[0], albumart_size[1], albumart_size[2], albumart_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawImage(albumart, albumart_size[0], albumart_size[1], albumart_size[2], albumart_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawImage(gloss_bg, albumart_size[0], albumart_size[1], albumart_size[2], albumart_size[3], 0, 0, albumart.Width, albumart.Height);
gr.DrawRect(albumart_size[0]-1,albumart_size[1]-1,albumart_size[2]+1,albumart_size[3]+1,1,col["aa_border"]);
if (fb.IsPaused) { gr.FillSolidRect(albumart_size[0],albumart_size[1],albumart_size[2],albumart_size[3],RGBA(0,0,0,150)
); }
}

}


// LOWER BAR

// Title & artist
gr.DrawString(str["lower_bar1"]+" "+str["lower_bar2"],ft["lower_bar"],col["btm_key"],0.025*ww,wh-geo["lower_bar_h"],0.95*ww,0.5*geo["lower_bar_h"]);
gr.DrawString(str["lower_bar1"], ft["lower_bar"],col["btm_val"],0.025*ww,wh-geo["lower_bar_h"],0.95*ww,0.5*geo["lower_bar_h"]);

// Playback order
if(pb_timer < 5*25 && ww > 600) {
gr.DrawString(pbtext[fb.PlaybackOrder]+" "+str["time"]+" "+str["length"],ft["lower_bar"],col["btm_key"],0.575*ww,wh-geo["lower_bar_h"],0.4*ww,0.5*geo["lower_bar_h"],StringFormat(2,0));
}
// Progress bar
gr.DrawRect( 0.025*ww,wh-0.5*geo["lower_bar_h"],0.95*ww,4,1,col["prgrss_line"]);
if(fb.PlaybackLength > 0) {
if (ww > 600) {
gr.DrawString(str["time"]+" "+str["length"],ft["lower_bar"],col["btm_key"],0.725*ww,wh-geo["lower_bar_h"],0.25*ww,0.5*geo["lower_bar_h"],StringFormat(2,0));
gr.DrawString( str["length"],ft["lower_bar"],col["btm_val"],0.725*ww,wh-geo["lower_bar_h"],0.25*ww,0.5*geo["lower_bar_h"],StringFormat(2,0));
}
gr.FillSolidRect(0.025*ww,wh-0.5*geo["lower_bar_h"],0.95*ww*(fb.PlaybackTime / fb.PlaybackLength),4,col["prgrss_fill"]);
}

}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////















// -----------------------------------------------------------------------
// CALLBACKS
// -----------------------------------------------------------------------

// custom initialisation function, called once after variable declarations
function on_init() {
on_size();

geo["lower_bar_h"] = 60;


str["title"] = "";
str["artist"] = "";
str["lower_bar1"] = "foobar2000";
str["lower_bar2"] = "plays music";
str["grid"] = new Array();

last_pb = fb.PlaybackOrder;

var bg_scale = Math.max(1,(wh-geo["lower_bar_h"]-1) / image_bg.Height);
image_bg = image_bg.Resize(image_bg.Width*bg_scale,image_bg.Height*bg_scale);

on_playback_new_track(fb.GetNowPlaying());
}

// window size changed
function on_size() {
ww = window.Width;
wh = window.Height;

if(albumart) {
// Size for big albumart
var album_scale = Math.min(0.95*ww / albumart.Width, 0.9*(wh-geo["lower_bar_h"]) / albumart.Height);
albumart_size[2] = albumart.Width * album_scale;
albumart_size[3] = albumart.Height * album_scale;
albumart_size[0] = 0.5*ww-0.5*albumart_size[2];
albumart_size[1] = 0.5*(wh-geo["lower_bar_h"])-0.5*albumart_size[3];

// Size for small
var aa_scale = Math.min(0.45*ww / albumart.Width, 0.7*(wh-geo["lower_bar_h"]) / albumart.Height);
aa_size[2] = albumart.Width * aa_scale;
aa_size[3] = albumart.Height * aa_scale;
aa_size[0] = 0.75*ww-0.5*aa_size[2];
aa_size[1] = 0.5*wh-0.5*aa_size[3];
} else {
albumart_size = Array(0,0,0,0);
}
}

// new track
function on_playback_new_track(metadb) {
start_timer = 0;
pb_timer = 0;
glob_timer = 0;
timer = window.CreateTimerInterval(40);

// Fetch new albumart
aa_list = [];
for(k = 0;k<tf["glob_paths"].length; k++) {
aa_list = aa_list.concat(utils.Glob(fb.TitleFormat(tf["glob_paths"][k]).Eval()).toArray());
}
if (!pref["aa_glob"]) {
if (metadb) {
utils.GetAlbumArtAsync(window.ID, metadb, 0);
}
} else {
if(aa_list.length > 0) {
aa_list = eliminateDuplicates(aa_list); // remove duplicates
pref["aa_glob_shuffle"] && fisherYates(aa_list); // shuffle list
aa_k = 0;
glob_image(aa_k); // display first image
}
}

// enable "watch for tag changes" on new track
if (metadb_handle) {window.UnwatchMetadb();}
metadb_handle = fb.GetNowPlaying();
if (metadb_handle) {
on_metadb_changed(); // refresh panel
window.WatchMetadb(metadb_handle);
}
on_playback_time();
}


// tag content changed
function on_metadb_changed() {
title = fb.TitleFormat(tf["title"]).Eval();
artist = fb.TitleFormat(tf["artist"]).Eval();

str["title"] = title;
str["artist"] = artist;
str["lower_bar1"] = title;
str["lower_bar2"] = artist;

h = Math.floor(fb.PlaybackLength/3600);
m = Math.floor(fb.PlaybackLength%3600/60);
s = Math.floor(fb.PlaybackLength%60);
str["length"] = (h > 0 ? h+":"+(m < 10 ? "0":"")+m : m) + ":" + (s < 10 ? "0":"") + s;

for (k=0; k<tf["grid"].length; k++) {
str["grid"][k] = Array(
tf["grid"][k][0],
fb.TitleFormat(tf["grid"][k][1]).Eval()
);
}

tag_timer = 0;
window.Repaint();
}


// User activity
function on_mouse_lbtn_dblclk() {
// re-initialise the panel
on_playback_new_track(fb.GetNowPlaying());
}
function on_playback_order_changed(this_pb) {
// Repaint playback order
if (this_pb != last_pb) {
pb_timer = 0;
window.RepaintRect(0.5*ww,wh-geo["lower_bar_h"],0.5*ww,geo["lower_bar_h"]);
}
last_pb = this_pb;

}
function on_playback_seek() {
on_playback_time();
}

function on_mouse_lbtn_down(x, y) {
if(y > wh-geo["lower_bar_h"]) {
g_drag = 1;
}
}

function on_mouse_lbtn_up(x, y) {
on_mouse_move(x, y);
g_drag = 0;

// Play or pause on album cover
if (ww > 600 && ((tag_timer < pref["t_tag"]*25) || (start_timer < pref["t_start"]*25))) {
// small album art
if ( aa_size[0] <= x && aa_size[1] <= y && aa_size[0]+aa_size[2] >= x && aa_size[1]+aa_size[3] >= y) {
fb.PlayOrPause();
}
} else {
// big album art
if ( albumart_size[0] <= x && albumart_size[1] <= y && albumart_size[0]+aa_size[2] >= x && albumart_size[1]+aa_size[3] >= y) {
fb.PlayOrPause();
}
}

if (x < 0.01*ww) { fb.Prev(); }
if (x > 0.99*ww) { fb.Next(); }
}

function on_mouse_lbtn_dblclk() {
tag_timer = -1;
on_timer();
}

function on_mouse_move(x, y) {
if (g_drag) {
var v = (x-0.025*ww) / (0.95*ww);
v = (v < 0) ? 0 : (v < 1) ? v : 1;
if (fb.PlaybackTime != v*fb.PlaybackLength) fb.PlaybackTime = v*fb.PlaybackLength;
}
}


// Timed events

function on_playback_time(){
// Repaint seekbar and playback times
this_time = fb.PlaybackTime;
pb_length = fb.PlaybackLength;

h = Math.floor(this_time/3600);
m = Math.floor(this_time%3600/60);
s = Math.floor(this_time%60);
str["time"] = (h > 0 ? h+":"+(m < 10 ? "0":"")+m : m) + ":" + (s < 10 ? "0":"")+ s;

}
function on_timer(id){
start_timer = start_timer + 1;
tag_timer = tag_timer + 1;
pb_timer = pb_timer + 1;
glob_timer = glob_timer + 1;
if (glob_timer == pref["t_aa_glob"]*25) {
aa_k = (aa_k + 1) % aa_list.length;
glob_image(aa_k);
glob_timer = 0;
}
if ((tag_timer == pref["t_tag"]*25) || (tag_timer <= 0) || (start_timer == pref["t_start"]*25) || (glob_timer == 0)) {
window.Repaint();
} else {
window.RepaintRect(0,wh-geo["lower_bar_h"],ww,geo["lower_bar_h"]);
}
}
function on_playback_pause() {
// Draws grey shadow on album art
window.RepaintRect(albumart_size[0],albumart_size[1],albumart_size[2],albumart_size[3]);
window.RepaintRect(aa_size[0],aa_size[1],aa_size[2],aa_size[3]);
}

function on_playback_stop(reason) {
if(reason != 2) { // starting_another
// clear all variables and repaint
albumart = null; artistart = null;

str["title"] = "";
str["artist"] = "";
str["lower_bar1"] = "foobar2000";
str["lower_bar2"] = "plays music";
str["grid"] = Array();
window.Repaint();
}
timer && window.KillTimer(timer);
}

// album art retrieved
function on_get_album_art_done(metadb, art_id, image) {
// only use album art reader if globbing is disabled
if (!pref["aa_glob"]) {
switch(art_id) {
case 0: // front
if(image) { albumart = image; }
else { albumart = null; }
break;
}
on_size(); // recalculate image positions
createDropShadow(); // recreate shadow image
window.Repaint(); // calls on_paint()
}
}


// HELPER FUNCTIONS
function StringFormat() {
var h_align = 0, v_align = 0, trimming = 0, flags = 0;
switch (arguments.length)
{
// fall-through
case 4: flags = arguments[3];
case 3: trimming = arguments[2];
case 2: v_align = arguments[1];
case 1: h_align = arguments[0]; break;
default: return 0;
}
return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}
function RGB(r, g, b) { return (0xff000000 | (r << 16) | (g << 8) | (b)); }
function RGBA(r, g, b, a) { return ((a << 24) | (r << 16) | (g << 8) | (b)); }

function drawStar(gr, x, y) {
// gr = Drawing Object handle
// x,y = position of center
// color = array of colors for filling and border
// size = radius
// n = number of peaks
// phi = rotation
var size=16, n=5, phi=Math.PI/2, color=Array(RGB(210,170,0),RGB(255,255,0)), innerSize=.5;
switch(arguments.length) {
// fall-through
case 8: innerSize = arguments[7];
case 7: phi = arguments[6];
case 6: n = arguments[5];
case 5: size = arguments[4];
case 4: color = arguments[3];
}
var points = new Array(4*n);
for(var k=0;k<n;k++) {
// outer edge
points[4*k] = x+size*Math.cos(2*Math.PI*k/n-phi);
points[4*k+1] = y+size*Math.sin(2*Math.PI*k/n-phi);
// inner edge
points[4*k+2] = x+innerSize*size*Math.cos(2*Math.PI*(k+.5)/n-phi);
points[4*k+3] = y+innerSize*size*Math.sin(2*Math.PI*(k+.5)/n-phi);
}
gr.FillPolygon(color[0],1,points);
gr.DrawPolygon(color[1],1.2,points);
}

function createDropShadow() {
shadow_image = gdi.CreateImage(albumart_size[2]+2*geo["aa_shadow"], albumart_size[3]+2*geo["aa_shadow"]);
if (shadow_image) {
shimg = shadow_image.GetGraphics();
shimg.FillEllipse(1.5*geo["aa_shadow"],1.0*geo["aa_shadow"],albumart_size[2]-geo["aa_shadow"],2*geo["aa_shadow"],col["aa_shadow"]);
shimg.FillEllipse(1.0*geo["aa_shadow"],1.5*geo["aa_shadow"],2*geo["aa_shadow"],albumart_size[3]-geo["aa_shadow"],col["aa_shadow"]);
shimg.FillEllipse(1.5*geo["aa_shadow"],albumart_size[3]-geo["aa_shadow"],albumart_size[2]-geo["aa_shadow"],2*geo["aa_shadow"],col["aa_shadow"]);
shimg.FillEllipse(albumart_size[2]-geo["aa_shadow"],1.5*geo["aa_shadow"],2*geo["aa_shadow"],albumart_size[3]-geo["aa_shadow"],col["aa_shadow"]);
shadow_image.ReleaseGraphics(shimg);
shadow_image.BoxBlur(geo["aa_shadow"],1);
}
}

function glob_image(k) {
albumart = gdi.Image(aa_list[k]);
on_size(); // recalculate image positions
createDropShadow(); // recreate shadow image
}

function fisherYates ( myArray ) {
//
var i = myArray.length;
if ( i == 0 ) return false;
while ( --i ) {
var j = Math.floor( Math.random() * ( i + 1 ) );
var tempi = myArray[i];
var tempj = myArray[j];
myArray[i] = tempj;
myArray[j] = tempi;
}
}


function eliminateDuplicates(arr) {
var i,
len=arr.length,
out=[],
obj={};

for (i=0;i<len;i++) {
obj[arr[i]]=0;
}
for (i in obj) {
out.push(i);
}
return out;
}



// EOF


This post has been edited by shakey_snake: Nov 28 2011, 16:55
Reason for edit: codebox'd


--------------------
In the province of the mind, there are no limits.
Go to the top of the page
+Quote Post
ojdo
post Dec 4 2011, 23:54
Post #9





Group: Members
Posts: 894
Joined: 18-June 06
From: Germany
Member No.: 31980



QUOTE (starterz @ Nov 27 2011, 21:47) *
OK, I got this far, I can see the gloss on the album art, but not the jewel case. Please help :-)

Great: The gloss probably has the right size. The case is drawn behind the cover image and at the moment has the same size. Obviously, it cannot be seen that way. What's left to do is to
- increase the size for the jewel case
- adjust its position accordingly.
This is done by playing around with the four arguments involving the albumart_size (or aa_size). Let me give you an example:
The jewel case image might be 800x700 pixels (width x height) big, with an area of 600x600 pixels designated to show the cover image, vertically centered 50 pixels from the right image border. So in order to have the right size for an albumart image of a given height aa_size[3], the jewel case must be displayed with a height of aa_size[3]/600*700. The width consequently must be aa_size[2]/600*800. You have to measure the exact numbers with your own image. I hope you can figure out the x- and y-positions yourself. If not, tell me the exact measurements as in the example above.


--------------------
http://freemusi.cc/
Go to the top of the page
+Quote Post

Posts in this topic
- ojdo   HTPC Fullscreen panels II   Dec 31 2009, 18:18
- - ojdo   Update: WSHtpc01 v0.2 Changes from v0.1 Panel is ...   Jan 11 2010, 22:44
- - ojdo   Sh*t, what pitty. Wrong file encoding crippled the...   Jan 12 2010, 22:39
- - High Five   Thank you for your work! it's really mini...   Feb 5 2010, 01:38
- - TheShaman   Hey ojdo, Good work! Is it possible to int...   Feb 17 2010, 10:08
|- - ojdo   QUOTE (TheShaman @ Feb 17 2010, 10:08) Is...   Feb 17 2010, 10:43
- - ojdo   New configuration: WSHtpc02 (v0.2) Features Fulls...   Feb 18 2010, 20:22
- - marc2003   can you provide the required images please?   Feb 18 2010, 20:30
|- - ojdo   QUOTE (marc2003 @ Feb 18 2010, 20:30) can...   Feb 18 2010, 20:32
- - marc2003   ?? CODEvar imgpath2 = fb.FoobarPath+'images...   Feb 18 2010, 20:34
|- - ojdo   QUOTE (marc2003 @ Feb 18 2010, 20:34) ?? ...   Feb 18 2010, 20:39
- - marc2003   now it works. thanks.   Feb 18 2010, 20:46
- - Gapkiller   Thank you for your work ojdo!! I like it v...   Mar 3 2010, 23:05
|- - ojdo   QUOTE (Gapkiller @ Mar 3 2010, 23:05) I...   Mar 3 2010, 23:33
- - Gapkiller   ojdo, thx for the fast reply. Unfortunately it d...   Mar 4 2010, 00:23
- - ojdo   Yes, you're right. As the function name says, ...   Mar 4 2010, 09:55
- - Gapkiller   Works. Thx again!   Mar 4 2010, 10:45
- - bimbel   ojdo care to explain the playback statistics (line...   Mar 7 2010, 17:28
- - ojdo   Here you are: The line length is partitioned ac...   Mar 8 2010, 10:30
- - tommygun   .......is it possible to set a fixed maximum size ...   Mar 18 2010, 17:42
|- - ojdo   QUOTE (tommygun @ Mar 18 2010, 17:42) ......   Mar 22 2010, 10:51
- - tommygun   Hi ojdo. 1st of all, thanks for your reply and yo...   Mar 22 2010, 16:07
|- - ojdo   Replace these two lines CODEvar scale_w = 0.45*ww ...   Mar 22 2010, 23:42
|- - tommygun   QUOTE (ojdo @ Mar 23 2010, 05:42) Replace...   Mar 31 2010, 13:46
|- - ojdo   QUOTE (tommygun @ Mar 31 2010, 13:46) Is ...   Apr 2 2010, 08:54
|- - tommygun   .......attached the code and thanks again for look...   Apr 3 2010, 05:01
- - ojdo   Your upload was broken (double-pasting + encoding ...   Apr 3 2010, 11:42
|- - tommygun   Hi ojdo. Now it displays the desired maximum size...   Apr 4 2010, 05:05
- - tommygun   ....... please give me a hand here to finally get ...   Apr 15 2010, 10:39
- - ojdo   That question doesn't belong in this thread as...   Apr 15 2010, 11:03
|- - tommygun   ....... ok thanks, I got it now. I just deleted t...   Apr 15 2010, 11:47
- - halocline_   Hi, I have a question. My artist images are typica...   Apr 15 2010, 23:03
- - tommygun   ....... can someone of you guys or maybe ojdo help...   May 10 2010, 17:15
|- - marc2003   QUOTE (tommygun @ May 10 2010, 17:15) The...   May 10 2010, 17:26
- - tommygun   QUOTE (marc2003 @ May 10 2010, 23:26) QUO...   May 10 2010, 18:17
- - marc2003   in all the screenshots, you can clearly see the wi...   May 10 2010, 19:06
- - tommygun   ....... sorry, my mistake. I saw the title on top...   May 11 2010, 06:07
- - RedAlert   Im using WSHtpc02 and it's almost perfect. How...   May 14 2010, 19:18
- - ojdo   QUOTE (tommygun @ May 11 2010, 07:07) Ful...   May 15 2010, 17:57
- - RedAlert   Where should I change it? Ive done it in Columns ...   May 16 2010, 20:23
- - RedAlert   I appreciate your help....   May 25 2010, 14:48
- - ojdo   Sorry, I seem to have missed a notification. I had...   May 25 2010, 15:19
- - Mr.Duck   Just trying put v0.2 now. Unless I am missing some...   Jun 5 2010, 00:15
|- - ojdo   QUOTE (Mr.Duck @ Jun 5 2010, 01:15) Just ...   Jun 5 2010, 13:44
- - Mr.Duck   Oh ok. I'm surprised no one has made an altern...   Jun 5 2010, 17:31
|- - redmodel   QUOTE (Mr.Duck @ Jun 5 2010, 09:31) Didn...   Aug 26 2010, 02:46
- - L_and_P21   i was wondering would it be possible to add a lyri...   Jun 15 2010, 07:41
- - phool   I've currently got my TV hooked up to my PC as...   Jul 3 2010, 12:46
- - ojdo   New configuration: WSHtpc03 v0.1 Features Displ...   Sep 12 2010, 12:18
- - Squeller   My layout is simple, I do the remote controlling w...   Sep 27 2010, 13:57
- - pcstockton   GREAT component!!! Just fabulous. I...   Oct 1 2010, 00:24
- - pcstockton   QUOTE (Squeller @ Sep 27 2010, 05:57) I a...   Oct 1 2010, 00:27
- - ojdo   Update: WSHtpc03 v0.5 Changes to WSHtpc03 v0.1:...   Oct 1 2010, 19:35
|- - Gapkiller   QUOTE (ojdo @ Oct 1 2010, 13:35) Update: ...   Oct 3 2010, 21:17
|- - starterz   QUOTE (ojdo @ Oct 1 2010, 20:35) Update: ...   Aug 20 2011, 02:45
- - ojdo   Small update: WSHtpc03 v0.5.1 Changes to previous...   Oct 6 2010, 21:16
- - pcstockton   QUOTE (ojdo @ Dec 31 2009, 10:18) The hid...   Oct 22 2010, 18:13
|- - ojdo   QUOTE (pcstockton @ Oct 22 2010, 19:13) A...   Oct 24 2010, 15:17
- - pcstockton   Thanks for the help! I am using v0.2 (with th...   Oct 25 2010, 00:16
|- - ojdo   Fixed update of WSHtpc02 v0.3, aka the configurat...   Oct 28 2010, 20:25
- - pcstockton   thanks a lot Ojdo. I really appreciate the help a...   Oct 29 2010, 22:05
- - pcstockton   ....except now it doesn't work at all.... any...   Oct 29 2010, 22:13
- - ojdo   The error message you uploaded occurred in the lin...   Oct 30 2010, 00:06
- - pcstockton   Previously the error occurred when changing to the...   Oct 31 2010, 06:03
- - ojdo   This sounds like that the code in your WSH panel h...   Oct 31 2010, 10:25
- - pcstockton   Thanks for continuing to help me! I attached ...   Oct 31 2010, 20:31
- - ojdo   The error message tells you the solution right awa...   Nov 1 2010, 22:25
- - pcstockton   AHA!!!!!!!!!...   Nov 2 2010, 01:35
- - pcstockton   Still no dice.... I created the images folder in ...   Nov 3 2010, 02:23
- - ojdo   Nothing new in this log. It's the old error me...   Nov 4 2010, 19:16
- - pcstockton   1. How does the configuration for your album art r...   Nov 4 2010, 20:43
- - ojdo   Concerning #1: I wanted to know if you had any spe...   Nov 4 2010, 21:47
- - pcstockton   Cool. Thanks for helping me as far as you could O...   Nov 5 2010, 01:54
- - claW2k5   Is there any possibility to extend this script wit...   Mar 9 2011, 00:34
- - ojdo   You cannot include other panels, but the WSH panel...   Mar 9 2011, 23:03
- - kaller   This looks really great. But I have quite a noob q...   Apr 23 2011, 11:09
- - SatFloyd   Hello odjo I'm a happy user of WSHtpc02. It...   Jul 9 2011, 11:31
- - Craig6844   I spent a little time modding WSHtpc02 and i thoug...   Jul 21 2011, 06:28
- - marc2003   here you go. http://dl.dropbox.com/u/22801321/wsh_...   Aug 20 2011, 14:30
|- - starterz   QUOTE (marc2003 @ Aug 20 2011, 15:30) her...   Aug 21 2011, 09:41
- - Chipicui   I wanted to say a big THANKS to you odjo for this ...   Nov 17 2011, 03:38
- - Chipicui   Just a suggestion: Another enhancement I'd lov...   Nov 17 2011, 23:33
- - ojdo   What do you mean by "auto-rotate"? Conc...   Nov 18 2011, 10:44
- - marc2003   i guess Chipicui means cycle through all images in...   Nov 18 2011, 12:43
|- - ojdo   New version 0.2.0. Changes from 0.1.3: new option:...   Nov 26 2011, 03:32
|- - Oery   QUOTE (ojdo @ Nov 26 2011, 09:32) New ver...   Nov 26 2011, 07:59
|- - ojdo   QUOTE (Oery @ Nov 26 2011, 07:59) I'm...   Nov 26 2011, 14:27
|- - starterz   Thank you for this. I am really going to try custo...   Nov 27 2011, 11:52
|- - starterz   Not as easy as I thought :-) I have two great imag...   Nov 27 2011, 17:00
|- - starterz   OK, I got this far, I can see the gloss on the alb...   Nov 27 2011, 21:47
|- - ojdo   QUOTE (starterz @ Nov 27 2011, 21:47) OK,...   Dec 4 2011, 23:54
- - Chipicui   Thanks marc2003 for your explanation! ... that...   Nov 22 2011, 22:46
- - ojdo   New release: WSHtpc04 v0.1Configurable tag gridDyn...   Nov 22 2011, 23:16
- - ojdo   Bugfix update: WSHtpc04 v0.1.1 I should have waite...   Nov 23 2011, 19:31
- - marc2003   a few issues with this.... -it's spamming the...   Nov 23 2011, 20:03
|- - ojdo   QUOTE Crash in createDropShadow() Strange, this is...   Nov 23 2011, 20:56
- - marc2003   sorry i forgot about this. tested and working fine...   Nov 25 2011, 14:04
- - Chipicui   Hi!... thanks a lot ojdo! However, I can...   Nov 28 2011, 04:54
|- - Chipicui   Sorry ojdo!!!... sorry for being so st...   Nov 28 2011, 17:09
- - tommygun   ....... can someone please tell me how I stop WSHt...   Feb 1 2012, 12:51
2 Pages V   1 2 >


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: 30th July 2014 - 09:34