Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
122
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 "Last.fm Playcount Sync"
  4. // @author "marc2003"
  5. // @feature "v1.4"
  6. // @feature "watch-metadb"
  7. // ==/PREPROCESSOR==
  8.  
  9. var p = new panel("Last.fm Playcount Sync", ["remap", "custom_background"]);
  10. var b = new buttons();
  11. var l = new lastfm();
  12. //function takes 3 values: x, y, size. see on_size function if you want to update these relative to panel width/height
  13. var ps = new playcount_sync(3, 0, 16);
  14. //if you want to change the images, uncomment these lines below and modify the paths accordingly
  15. ps.unloved_img = gdi.Image(fb.ProfilePath + "theme\\unloved.png");
  16. //do not use fb.FoobarPath here as fb.ProfilePath already points to the same location if using portable mode
  17. ps.cross_img = gdi.Image(fb.ProfilePath + "my_theme\\images\\cross.png");
  18.  
  19. function on_playback_time() {
  20.     ps.elapsed_time++;
  21.     if (ps.elapsed_time == ps.target_time)
  22.         fb.RunContextCommandWithMetadb("Customdb Add 1", p.metadb, 8);
  23. }
  24.  
  25. function on_size() {
  26.     p.size();
  27.     //example to lock button in bottom right of panel
  28.     //ps.x = p.w - ps.size;
  29.     //ps.y = p.h - ps.size;
  30.     //ps.update_button();
  31. }
  32.  
  33. function on_paint(gr) {
  34.     p.draw_background(gr);
  35.     b.draw(gr);
  36. }
  37.  
  38. function on_metadb_changed() {
  39.     ps.metadb_changed();
  40. }
  41.  
  42. function on_playback_new_track() {
  43.     ps.elapsed_time = 0;
  44.     ps.target_time = Math.min(Math.floor(fb.PlaybackLength / 2), 240);
  45. }
  46. function on_playback_edited() {
  47.     ps.playback_edited();
  48. }
  49.  
  50. function on_mouse_move(x, y) {
  51.     b.move(x, y);
  52. }
  53.  
  54. function on_mouse_lbtn_up(x, y) {
  55.     b.lbtn_up(x, y);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement