since i got fed up with the trackdetail panel from columnsUI i tried to write my own on top of marcs scripts.
i guess it's written in a horrible way but it works for me thx for all the stuff to play with!
ah and i have one feature request for the 'now playing' script! it would be awesome if it could remember
which artist picture it was set too and not always return to the first one in the folder. writing a new config
file in the wsh_lastfm folder would be the way to go i think?
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common6.js"
// @name "Trackdetails"
// @author "ehrgeiz dabbling on top of marc2003 scripts"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
//first argument is any arbitrary text to name the panel. it will use in the console and popup boxes.
//seconds argument is an array of features. it's mostly for handling right click menus.
var p = new panel("Track Details", ["remap"]);
//force the panel to always prefer the playing track regardless of selection
p.selection_mode = 1;
// adding some modified textfunction from common6.js since id dont like DT_VCENTER
p.right_text_ml = function(gr, text, font, colour, x, y, w, h) {
gr.GdiDrawText(text, font, colour, x, y, w, h, DT_RIGHT | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
}
//setup all metadata fields you want to display. if you change the font sizes, adjustments may need
//to be made to the positions in the on_paint function
var genre = {text: "", tf: "$if(%genre%,$lower(%genre%),[no genre set]$crlf())", font: gdi.Font("Segoe UI", 18, 1), colour: RGB(180, 180, 180)}
var style = {text: "", tf: "$if(%style%,$lower(%style%),)", font: gdi.Font("Segoe UI", 14, 2), colour: RGB(180, 180, 180)}
var comp_b = {text: "", tf: "$if(%composer%,composer,)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var comp_c = {text: "", tf: "$if(%composer%,$meta_num(composer),)"}
var compo = {text: "", tf: "$if(%composer%,$meta_sep(composer,$crlf()),)", font: gdi.Font("Segoe UI", 10, 1), colour: RGB(180, 180, 180)}
var lyri_b = {text: "", tf: "$if(%lyricist%,lyricist,)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var lyri_c = {text: "", tf: "$if(%lyricist%,$meta_num(lyricist),)"}
var lyric = {text: "", tf: "$if(%lyricist%,$meta_sep(lyricist,$crlf()),)", font: gdi.Font("Segoe UI", 10, 1), colour: RGB(180, 180, 180)}
var cond_b = {text: "", tf: "$if(%conductor%,conducter,)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var cond_c = {text: "", tf: "$if(%conductor%,$meta_num(conductor),)"}
var condu = {text: "", tf: "$if(%conductor%,$meta_sep(conductor,$crlf()),)", font: gdi.Font("Segoe UI", 10, 1), colour: RGB(180, 180, 180)}
var perf_b = {text: "", tf: "$if(%performer%,performer,)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var perf_c = {text: "", tf: "$if(%performer%,$meta_num(performer),)"}
var perfo = {text: "", tf: "$if(%performer%,$meta_sep(performer,$crlf()),)", font: gdi.Font("Segoe UI", 10, 1), colour: RGB(180, 180, 180)}
var engi_b = {text: "", tf: "$if(%engineer%,engineer,)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var engi_c = {text: "", tf: "$if(%engineer%,$meta_num(engineer),)"}
var engin = {text: "", tf: "$if(%engineer%,$meta_sep(engineer,$crlf()),)", font: gdi.Font("Segoe UI", 10, 1), colour: RGB(180, 180, 180)}
var staf_b = {text: "", tf: "$if(%involvedpeople%,staff,)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var staf_c = {text: "", tf: "$if(%involvedpeople%,$meta_num(involvedpeople),)"}
var staff = {text: "", tf: "$if(%involvedpeople%,$meta_sep(involvedpeople,$crlf()),)", font: gdi.Font("Segoe UI", 10, 1), colour: RGB(180, 180, 180)}
var publ_b = {text: "", tf: "$if(%publisher%,released by,)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var publi = {text: "", tf: "$if(%publisher%,%publisher%,)$crlf()$if(%ORIGINAL RELEASE DATE%, $if($strcmp(%date%,%ORIGINAL RELEASE DATE%), ©$char(8471) %date%, © %date% $char(8471) %ORIGINAL RELEASE DATE% ), © %date%)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var playc = {text: "", tf: "$if(%LASTFM_PLAYCOUNT_DB%,Track played$ifequal(%LASTFM_PLAYCOUNT_DB%,1, only once,$ifequal(%LASTFM_PLAYCOUNT_DB%,2, twice, %LASTFM_PLAYCOUNT_DB% times)),no plays)", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(180, 180, 180)}
var dbtxt = {text: "", tf: "", font: gdi.Font("Segoe UI", 10, 0), colour: RGB(0, 0, 0)}
//startup
on_item_focus_change();
function on_size() {
//always call p.size to update the values of p.w and p.h
p.size();
}
function on_paint(gr) {
//setup a variable for y-offset
var cr = 40;
//setup a variable for lineheight
var lh = 12;
//var debugvar = cond_c.text;
//p.draw_background(gr);
//background for trackdetails
gr.FillSolidRect(0, 0, p.w, p.h - 15, RGBA(0, 0, 0, 156));
//draw trackdetails
//genre+style
p.right_text(gr, genre.text, genre.font, genre.colour, 5, 4, p.w - 10, 18);
p.right_text_ml(gr, style.text, style.font, style.colour, 5, 16, p.w - 10, 20);
//composer
if (comp_b.text.length != 0) {
p.left_text(gr, comp_b.text, comp_b.font, comp_b.colour, 5, cr, p.w - 10, 12);
p.right_text_ml(gr, compo.text, compo.font, compo.colour, 5, cr += 10, p.w - 10, p.h - cr - 45);
cr = cr + lh * comp_c.text;
}
//lyricist
if (lyri_b.text.length != 0) {
p.left_text(gr, lyri_b.text, lyri_b.font, lyri_b.colour, 5, cr, p.w - 10, 12);
p.right_text_ml(gr, lyric.text, lyric.font, lyric.colour, 5, cr += 10, p.w - 10, p.h - cr - 45);
cr = cr + lh * lyri_c.text;
}
//conductor
if (cond_b.text.length != 0) {
p.left_text(gr, cond_b.text, cond_b.font, cond_b.colour, 5, cr, p.w - 10, 12);
p.right_text_ml(gr, condu.text, condu.font, condu.colour, 5, cr += 10, p.w - 10, p.h - cr - 45);
cr = cr + lh * cond_c.text;
}
//performer
if (perf_b.text.length != 0) {
p.left_text(gr, perf_b.text, perf_b.font, perf_b.colour, 5, cr, p.w - 10, 12);
p.right_text_ml(gr, perfo.text, perfo.font, perfo.colour, 5, cr += 10, p.w - 10, p.h - cr - 45);
cr = cr + lh * perf_c.text;
}
//engineer
if (engi_b.text.length != 0) {
p.left_text(gr, engi_b.text, engi_b.font, engi_b.colour, 5, cr, p.w - 10, 12);
p.right_text_ml(gr, engin.text, engin.font, engin.colour, 5, cr += 10, p.w - 10, p.h - cr - 45);
cr = cr + lh * engi_c.text;
}
//involved people
if (staf_b.text.length != 0) {
p.left_text(gr, staf_b.text, staf_b.font, staf_b.colour, 5, cr, p.w - 10, 12);
p.right_text_ml(gr, staff.text, staff.font, staff.colour, 5, cr += 10, p.w - 10, p.h - cr - 45);
cr = cr + lh * staf_c.text;
}
//publisher/label
//p.left_text(gr, publ_b.text, publ_b.font, publ_b.colour, 5, cr, p.w - 10, 12);
p.right_text(gr, publi.text, publi.font, publi.colour, 5, p.h - 35, p.w - 10, 12);
//lastfm.playcount
//first draw background
gr.FillSolidRect(0, p.h - 15, p.w, 15, RGBA(0, 0, 0, 116));
p.centre_text(gr, playc.text, playc.font, playc.colour, 5, p.h - 14, p.w, 12);
//debug
//gr.FillSolidRect(0, 0, 60, lh * perf_c.text, RGBA(255, 0, 0, 236));
//p.left_text(gr, debugvar, dbtxt.font, dbtxt.colour, 0, 0, 60, 12);
}
function on_metadb_changed() {
//call these functions when selection changes/tag updates are made
if (p.metadb) {
genre.text = p.eval(genre.tf);
style.text = p.eval(style.tf);
comp_b.text = p.eval(comp_b.tf);
comp_c.text = p.eval(comp_c.tf);
compo.text = p.eval(compo.tf);
lyri_b.text = p.eval(lyri_b.tf);
lyri_c.text = p.eval(lyri_c.tf);
lyric.text = p.eval(lyric.tf);
cond_b.text = p.eval(cond_b.tf);
cond_c.text = p.eval(cond_c.tf);
condu.text = p.eval(condu.tf);
perf_b.text = p.eval(perf_b.tf);
perf_c.text = p.eval(perf_c.tf);
perfo.text = p.eval(perfo.tf);
engi_b.text = p.eval(engi_b.tf);
engi_c.text = p.eval(engi_c.tf);
engin.text = p.eval(engin.tf);
staf_b.text = p.eval(staf_b.tf);
staf_c.text = p.eval(staf_c.tf);
staff.text = p.eval(staff.tf);
publ_b.text = p.eval(publ_b.tf);
//publ_c.text = p.eval(publ_c.tf);
publi.text = p.eval(publi.tf);
playc.text = p.eval(playc.tf);
}
window.Repaint();
}
function on_playback_stop() {
on_item_focus_change();
// b.update();
}
function on_mouse_wheel(step) {
//scroll text
//if (t.wheel(step)) return;
//this scrolls through multiple images
//im.wheel(step);
}
function on_mouse_move(x, y) {
//we only need to call p.move if there elements in our panel which require scrollling as i need to track where the mouse is. do not return after it.
p.move(x, y);
}
function on_mouse_rbtn_up(x, y) {
//handles right click menu.
p.rbtn_up(x, y);
return true;
}