Sie sind auf Seite 1von 4

// ==PREPROCESSOR==

// @import "%fb2k_profile_path%marc2003\common7.js"
// @name "Now Playing"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
//due to recent changes at Last.fm, you may find image downloads taking much tha
n they used to.
//the track info section displays 3 lines of title formatted text. you can custo
mise that here/////////////////////////////////////////////
var line1 = {
text: "", //leave this blank
tf: "%artist%", //enter any title formatting
font: gdi.Font("Segoe UI", 36, 1), //font name, size, style. 1 means bol
d and 0 is normal.
colour: RGB(240, 240, 240), //colour
y: 0 //change this value to move text up or down.
}
var line2 = {
text: "",
tf: "%title%",
font: gdi.Font("Segoe UI", 28, 1),
colour: RGB(210, 210, 210),
y: 38
}
var line3 = {
text: "",
tf: "[%album%] ['('%date%')']",
font: gdi.Font("Segoe UI", 20, 1),
colour: RGB(180, 180, 180),
y: 70
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
var p = new panel("Now Playing", ["custom_background", "now_playing", "lastfm_wi
ki", "remap"]);
var c = new cd(0, 0, 0, 0);
var r = new rating(0, 0, 24);
var t = new text(0, 0, 0, 0);
var im = new images(0, 0, 0, 0);
var th = new thumbs(0, 0 , 0, 0);
var b = new buttons();
p.selection_mode = 1;
var
var
var
var
var
var
var
var

np_cd = window.GetProperty("np_cd", true);


np_cd_size = window.GetProperty("np_cd_size", 200);
np_track = window.GetProperty("np_track", true);
np_track_top = window.GetProperty("np_track_top", false);
np_buttons = window.GetProperty("np_buttons", true);
np_bio = window.GetProperty("np_bio", true);
np_cd_size = window.GetProperty("np_cd_size", 200);
np_rating = window.GetProperty("np_rating", true);

var bar1y = 0;
var bar1h = 0;

var bar2y = 0;
var bar2h = 0;
b.update = function() {
if (p.metadb) {
var artist = encodeURIComponent(p.eval("%artist%"));
var title = encodeURIComponent(p.eval("%title%"));
var google = "https://www.google.co.uk/search?q=" + artist;
var myspace = "http://www.myspace.com/search/music?q=" + artist;
var lastfm = "http://www.last.fm/music/" + artist + "/_/" + titl
e;
var youtube = "http://www.youtube.com/results?search_query=" + a
rtist + "+" + title;
var discogs = "http://www.discogs.com/search?q=" + artist;
var allmusic = "http://www.allmusic.com/search/artists/" + artis
t;
this.buttons = {
google: new button(im.x + im.w - 192, bar2y - 1, 32, 32,
{normal: "google.png", hover: "google_h.png"}, function() { p.browser(google);
}, google),
myspace: new button(im.x + im.w - 160, bar2y - 1, 32, 32
, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspac
e); }, myspace),
lastfm: new button(im.x + im.w - 128, bar2y - 1, 32, 32,
{normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm);
}, lastfm),
youtube: new button(im.x + im.w - 96, bar2y - 1, 32, 32,
{normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube
); }, youtube),
discogs: new button(im.x + im.w - 64, bar2y - 1, 32, 32,
{normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs
); }, discogs),
allmusic: new button(im.x + im.w - 32, bar2y - 1, 32, 32
, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allm
usic); }, allmusic)
}
}
window.RepaintRect(0, bar2y, im.w, bar2h);
}
on_item_focus_change();
function on_playback_time(time) {
im.playback_time(time);
}
function on_size() {
p.size();
th.calc();
switch(true) {
case np_track_top:
c.y = im.y - (np_cd_size * 0.05);
bar1y = im.y;
bar1h = np_track ? 100 : 0;
bar2y = im.y + bar1h;
bar2h = np_buttons || np_rating ? 30 : 0;
t.y = im.y + bar1h + bar2h;
break;
default:
c.y = im.y + im.h - np_cd_size + (np_cd_size * 0.05);

bar1y = im.y + (np_rating || np_buttons ? im.h - 130 : i


m.h - 100);
bar1h = np_track ? 100 : 0;
bar2y = im.y + im.h - 30;
bar2h = np_buttons || np_rating ? 30 : 0;
t.y = im.y;
break;
}
c.x = im.x;
c.w = np_cd_size;
c.h = np_cd_size;
r.y = bar2y + 3;
t.x = im.x + im.w - Math.round(im.w / 3);
t.w = im.x + im.w - t.x - 15;
t.h = im.h - bar1h - bar2h;
t.size();
b.update();
}
function on_paint(gr) {
p.draw_background(gr);
th.draw(gr);
tix = im.x + (np_cd ? np_cd_size : 10);
r.x = tix;
if (np_track) {
gr.FillSolidRect(im.x, bar1y, im.w, bar1h, RGBA(0, 0, 0, 196));
p.left_text(gr, line1.text, line1.font, line1.colour, tix, bar1y
+ line1.y, im.x + im.w - tix - 10, line1.font.Height);
p.left_text(gr, line2.text, line2.font, line2.colour, tix, bar1y
+ line2.y, im.x + im.w - tix - 10, line2.font.Height);
p.left_text(gr, line3.text, line3.font, line3.colour, tix, bar1y
+ line3.y, im.x + im.w - tix - 10, line3.font.Height);
}
if (np_rating || np_buttons) gr.FillSolidRect(im.x, bar2y, im.w, bar2h,
RGBA(0, 0, 0, 136));
if (np_cd) c.draw(gr);
if (np_rating) r.draw(gr);
if (np_buttons) b.draw(gr);
if (np_bio) {
gr.FillSolidRect(t.x - 15, t.y, t.w + 30, t.h, RGBA(0, 0, 0, 156
));
t.draw(gr, RGB(240, 240, 240));
}
}
function on_metadb_changed()
b.update();
r.metadb_changed();
im.metadb_changed();
t.metadb_changed();
c.metadb_changed();
if (p.metadb) {
line1.text =
line2.text =
line3.text =
}
window.Repaint();
}

p.eval(line1.tf);
p.eval(line2.tf);
p.eval(line3.tf);

function on_playback_stop() {

on_item_focus_change();
b.update();
}
function on_playback_pause() {
b.update();
}
function on_playback_starting() {
b.update();
}
function on_get_album_art_done(metadb, art_id, im, ip) {
c.get_album_art_done(ip);
}
function on_mouse_wheel(step) {
if (np_cd && c.trace(p.mx, p.my)) {
np_cd_size += step * 25;
if (np_cd_size < 200) np_cd_size = 200;
if (np_cd_size > 400) np_cd_size = 400;
window.SetProperty("np_cd_size", np_cd_size);
c.y = Math.round(np_track_top ? im.y - (np_cd_size * 0.05) : im.
y + im.h - np_cd_size + (np_cd_size * 0.05));
c.w = np_cd_size;
c.h = np_cd_size;
window.RepaintRect(im.x, np_track_top ? im.y : im.y + im.h - 450
, im.w, 450);
return;
}
if (th.wheel(step)) return;
if (np_bio && t.wheel(step)) return;
im.wheel(step);
}
function on_mouse_move(x, y) {
p.move(x, y);
if (np_rating && r.move(x, y)) return;
if (np_bio && t.move(x, y)) return;
if (np_buttons && b.move(x,y)) return;
if (np_cd && c.move(x, y)) return;
if (th.move(x, y)) return;
}
function on_mouse_lbtn_up(x, y) {
if (np_buttons && b.lbtn_up(x, y)) return;
if (np_rating && r.lbtn_up(x, y)) return;
if (np_bio && t.lbtn_up(x, y)) return;
if (th.lbtn_up(x, y)) return;
}
function on_mouse_lbtn_dblclk(x, y) {
if (np_cd && c.lbtn_dblclk(x, y)) return;
if (th.lbtn_dblclk(x, y)) return;
}

Das könnte Ihnen auch gefallen