I've been modifying an old marc2003 code I had in order for it to fit my setup, and my problem is the elapsed playback time (%playback_time% /") only updates when I refresh the panel (so for example play/pause the song). It drives me nuts, if anyone has any idea on how to fix it, please:
// ==PREPROCESSOR==
// @name "track info + seekbar + buttons"
// @author "marc2003"
// @import "%fb2k_profile_path%js_marc2003\js\lodash.min.js"
// @import "%fb2k_profile_path%js_marc2003\js\helpers.js"
// @import "%fb2k_profile_path%js_marc2003\js\panel.js"
// @import "%fb2k_profile_path%js_marc2003\js\seekbar.js"
// ==/PREPROCESSOR==
//note the buttons are white and you'd have to edit the images to change them...
var colours = {
background : _.RGB(255, 255, 255),
title : _.RGB(60, 60, 60),
artist : _.RGB(80, 80, 80),
time : _.RGB(80, 80, 80),
};
//////////////////////////////////////////////////////////////
var panel = new _.panel("track info + seekbar + buttons");
var seekbar = new _.seekbar(60, 5, 0, 20);
var buttons = new _.buttons();
var img = null;
on_playback_new_track();
buttons.update = function () {
var y = _.round((panel.h - 36) / 2);
}
function on_size() {
panel.size();
seekbar.x = panel.h + 310
seekbar.w = panel.w - panel.h - 710;
seekbar.y = (panel.h - 20) / 2;
buttons.update();
}
function on_paint(gr) {
if (fb.IsPlaying) {
img && _.drawImage(gr, img, 0, 0, panel.h, panel.h, image.centre);
gr.GdiDrawText(_.tfe("%title%"), gdi.Font("Helvetica Bold", 16), colours.title, 82, -1, 500, 40, LEFT);
gr.GdiDrawText(_.tfe("%artist%"), gdi.Font("Helvetica Light", 16), colours.artist, 82, 20, 500, 30, LEFT);
gr.GdiDrawText(_.tfe("%playback_time% /"), gdi.Font("Helvetica Light", 16), colours.time, 82, 43, 110, LEFT);
gr.GdiDrawText(_.tfe("%length%"), gdi.Font("Helvetica Light", 16), colours.time, 125, 0, 60, 107, LEFT);
;
}
}
function on_playback_new_track() {
var metadb = fb.GetNowPlaying();
if (!metadb)
return;
_.dispose(img);
img = utils.GetAlbumArtV2(metadb, 0);
window.Repaint();
}
function on_playback_edited() {
window.Repaint();
}
function on_playback_seek() {
seekbar.playback_seek();
}
function on_playback_stop() {
buttons.update();
window.Repaint();
}
function on_playback_pause() {
buttons.update();
window.Repaint();
}
function on_playback_starting() {
buttons.update();
window.Repaint();
}
function on_mouse_wheel(s) {
buttons.leave();
}
function on_mouse_move(x, y) {
if (buttons.move(x, y))
return;
seekbar.move(x, y);
}
function on_mouse_leave() {
buttons.leave();
}
function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
}
function on_mouse_lbtn_up(x, y) {
if (buttons.lbtn_up(x, y))
return;
if (seekbar.lbtn_up(x, y))
return;
fb.RunMainMenuCommand("View/Show now playing in playlist");
}
function on_mouse_rbtn_up(x, y) {
return panel.rbtn_up(x, y);
}