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:
// ==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):
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?