Advertisement
Guest User

Untitled

a guest
Nov 14th, 2014
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==PREPROCESSOR==
  2. // @import "%fb2k_profile_path%marc2003\common8.js"
  3. // @name "Thumbs"
  4. // @feature "v1.4"
  5. // @feature "watch-metadb"
  6. // ==/PREPROCESSOR==
  7.  
  8. //the track info section displays 3 lines of title formatted text. you can customise that here/////////////////////////////////////////////
  9. var line1 = {
  10.     text: "", //leave this blank
  11.     tf: "%artist%", //enter any title formatting
  12.     font: gdi.Font("Segoe UI", 36, 1), //font name, size, style. 1 means bold and 0 is normal.
  13.     colour: RGB(240, 240, 240), //colour
  14.     y: 0 //change this value to move text up or down.
  15. }
  16. var line2 = {
  17.     text: "",
  18.     tf: "%title%",
  19.     font: gdi.Font("Segoe UI", 28, 1),
  20.     colour: RGB(210, 210, 210),
  21.     y: 38
  22. }
  23. var line3 = {
  24.     text: "",
  25.     tf: "[%album%]",
  26.     font: gdi.Font("Segoe UI", 20, 1),
  27.     colour: RGB(180, 180, 180),
  28.     y: 70
  29. }
  30. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  31. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  32.  
  33.  
  34. var p = new panel("Thumbs", ["remap", "custom_background"]);
  35. window.SetProperty("2k3.musicbrainz_releases", false);
  36. var li = new list("musicbrainz", 0, 0, 0, 0);
  37. var th = new thumbs();
  38. th.mode = th.modes.off;
  39. var r = new rating(0, 4, 24);
  40. var b = new buttons("playback");
  41. var bs = 32; //button size
  42. var c = new cd(0, 0, p.w, p.h);
  43. var l = new lastfm();
  44. //function takes 3 values: x, y, size. see on_size function if you want to update these relative to panel width/height
  45. var ps = new playcount_sync(3, 0, 32);
  46.  
  47. b.update = function() {
  48.     b.buttons.stop = new button((p.w - bs*6) , p.h-bs*3, bs, bs, {normal: this.images.stop}, function() { fb.Stop(); }, "Stop");
  49.     b.buttons.play = new button((p.w - bs*6)+bs, p.h-bs*3, bs, bs, {normal: !fb.IsPlaying || fb.IsPaused ? this.images.play : this.images.pause}, function() { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? "Play" : "Pause");
  50.     b.buttons.previous = new button((p.w - bs*6)+bs * 2, p.h-bs*3, bs, bs, {normal: this.images.previous}, function() { fb.Prev(); }, "Previous");
  51.     b.buttons.next = new button((p.w - bs*6)+bs * 3, p.h-bs*3, bs, bs, {normal: this.images.next}, function() { fb.Next(); }, "Next");
  52.     window.Repaint();
  53. }
  54.  
  55. b.update();
  56.  
  57. function on_playback_time(time) {
  58.     ps.playback_time(time);
  59.     th.playback_time(time);
  60. }
  61.  
  62. function on_size() {
  63.     p.size();
  64.     pos_x = 0;
  65.     pos_y = p.h-15;
  66.     th.size();
  67.     r.x = p.w - 125;
  68.     r.y = p.h - 25;
  69.     c.w = 200;
  70.     c.h = 200;
  71.     c.x=0;
  72.     c.y=p.h-200;
  73.     ps.x = p.w - 220;
  74.     ps.y = p.h - 95;
  75.     b.update();
  76.     ps.update_button();
  77. }
  78.  
  79. function on_paint(gr) {
  80.     th.mode = th.modes.off;
  81.     p.draw_background(gr);
  82.     th.draw(gr);
  83.     r.draw(gr);
  84.     for (var i = 0; i < li.items; i++) {
  85.         p.draw_image(gr, li.musicbrainz_images[li.images[i]], pos_x + (i * 20), pos_y, 16, 16);
  86.     }
  87.     gr.FillSolidRect(0, p.h-150, p.w, 110, RGBA(0, 0, 0, 196));
  88.     p.left_text(gr, line1.text, line1.font, line1.colour, 210, p.h-150, 500, line1.font.Height);
  89.     p.left_text(gr, line2.text, line2.font, line2.colour, 210, p.h-150+ line2.y, 500, line2.font.Height);
  90.     p.left_text(gr, line3.text, line3.font, line3.colour, 210, p.h-150 + line3.y, 500, line3.font.Height);
  91.     c.draw(gr);
  92.     b.draw(gr);
  93. }
  94.  
  95.  
  96. function on_playback_stop() {
  97.     b.update();
  98. }
  99.  
  100. function on_playback_pause() {
  101.     b.update();
  102. }
  103.  
  104. function on_playback_starting() {
  105.     b.update();
  106. }
  107.  
  108. function on_metadb_changed() {
  109.     th.metadb_changed();
  110.     r.metadb_changed();
  111.     li.metadb_changed();
  112.     c.metadb_changed();
  113.     line1.text = p.eval(line1.tf);
  114.     line2.text = p.eval(line2.tf);
  115.     line3.text = p.eval(line3.tf);
  116.     ps.metadb_changed();
  117. }
  118.  
  119. function on_playback_new_track() {
  120.     ps.playback_new_track();
  121. }
  122.  
  123. function on_playback_edited() {
  124.     ps.playback_edited();
  125. }
  126.  
  127. function on_get_album_art_done(metadb, art_id, im, ip) {
  128.     c.get_album_art_done(ip);
  129. }
  130.  
  131. function on_mouse_wheel(step) {
  132.     th.wheel(step);
  133. }
  134.  
  135. function on_mouse_move(x, y) {
  136.     p.move(x, y);
  137.     if (x > pos_x && x < pos_x + (li.items * 20) && y > pos_y && y < pos_y + 20) return p.tt(li.urls[Math.floor((x - pos_x) / 20)]);
  138.     if (b.move(x, y)) return;
  139.     if (r.move(x,y)) return;
  140.     if (c.move(x, y)) return;
  141.     if (b.move(x, y)) return;
  142. }
  143.  
  144. function on_mouse_lbtn_up(x, y) {
  145.     if (x > pos_x && x < pos_x + (li.items * 20) && y > pos_y && y < pos_y + 20) return p.browser(li.urls[Math.floor((x - pos_x) / 20)]);
  146.     if (b.lbtn_up(x, y)) return;
  147.     if (r.lbtn_up(x,y)) return;
  148.     th.lbtn_up(x, y);
  149. }
  150.  
  151.  
  152. function on_mouse_lbtn_dblclk(x, y) {
  153.     if (c.lbtn_dblclk(x, y)) return;
  154.     th.lbtn_dblclk(x, y);
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement