Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==PREPROCESSOR==
- // @import "%fb2k_profile_path%marc2003\common8.js"
- // @name "Last.fm Playcount Sync"
- // @author "marc2003"
- // @feature "v1.4"
- // @feature "watch-metadb"
- // ==/PREPROCESSOR==
- var p = new panel("Last.fm Playcount Sync", ["remap", "custom_background"]);
- var b = new buttons();
- var l = new lastfm();
- //function takes 3 values: x, y, size. see on_size function if you want to update these relative to panel width/height
- var ps = new playcount_sync(3, 0, 16);
- //if you want to change the images, uncomment these lines below and modify the paths accordingly
- ps.unloved_img = gdi.Image(fb.ProfilePath + "theme\\unloved.png");
- //do not use fb.FoobarPath here as fb.ProfilePath already points to the same location if using portable mode
- ps.cross_img = gdi.Image(fb.ProfilePath + "my_theme\\images\\cross.png");
- function on_playback_time() {
- ps.elapsed_time++;
- if (ps.elapsed_time == ps.target_time)
- fb.RunContextCommandWithMetadb("Customdb Add 1", p.metadb, 8);
- }
- function on_size() {
- p.size();
- //example to lock button in bottom right of panel
- //ps.x = p.w - ps.size;
- //ps.y = p.h - ps.size;
- //ps.update_button();
- }
- function on_paint(gr) {
- p.draw_background(gr);
- b.draw(gr);
- }
- function on_metadb_changed() {
- ps.metadb_changed();
- }
- function on_playback_new_track() {
- ps.elapsed_time = 0;
- ps.target_time = Math.min(Math.floor(fb.PlaybackLength / 2), 240);
- }
- function on_playback_edited() {
- ps.playback_edited();
- }
- function on_mouse_move(x, y) {
- b.move(x, y);
- }
- function on_mouse_lbtn_up(x, y) {
- b.lbtn_up(x, y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement