Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <reference path="D:\Development\foo_spider_monkey_panel-master\component\docs\js\foo_spider_monkey_panel.js">
- window.DefinePanel("GetNextArts", { author: "ZedZagg" });
- include(`${fb.ComponentPath}docs\\Flags.js`);
- include(`${fb.ComponentPath}docs\\Helpers.js`);
- // Nothing will show until you start playing a new track
- let g_img = null;
- let g_img2 = null;
- let g_img3 = null;
- let g_img4 = null;
- let ww = 0, wh = 0, spacing = 2, dimension = 100;
- let imgCount = 0;
- let handles = null;
- let index = 0;
- function on_paint(gr) {
- gr.FillSolidRect(0, 0, ww, wh, RGB(255, 255, 255));
- drawArt(0,g_img,gr);
- if(imgCount == 1)
- return;
- drawArt(dimension + spacing,g_img2,gr);
- if(imgCount == 2)
- return;
- drawArt(2*dimension + 2*spacing,g_img3,gr);
- if(imgCount == 3)
- return;
- drawArt(3*dimension + 3*spacing,g_img4,gr);
- }
- function drawArt(xPos,img,gr){
- if(!img){
- gr.FillSolidRect(xPos, 0, dimension, dimension, RGB(16, 16, 16));
- gr.DrawLine(xPos, dimension, xPos + dimension, 0, 3, RGB(255, 255, 255))
- }
- else{
- gr.DrawImage(img, xPos, 0, dimension, dimension, 0, 0, img.Width, img.Height);
- }
- }
- function on_size() {
- ww = window.Width;
- wh = window.Height;
- let len = (ww - 3 * spacing)/4;
- if(len<wh)
- dimension = len;
- else
- dimension = wh;
- }
- function on_playback_new_track(metadb) {
- getArt();
- }
- function getArt(){
- handles = plman.GetPlaylistItems(plman.PlayingPlaylist);
- let playing_item_location = plman.GetPlayingItemLocation();
- index = playing_item_location.PlaylistItemIndex;
- imgCount = handles.Count - index;
- if (imgCount == 0){
- return;
- }
- g_img = utils.GetAlbumArtV2(handles[index], AlbumArtId.front);
- if (imgCount > 1){
- g_img2 = utils.GetAlbumArtV2(handles[index+1], AlbumArtId.front);
- }
- if (imgCount > 2){
- g_img3 = utils.GetAlbumArtV2(handles[index+2], AlbumArtId.front);
- }
- if (imgCount > 3){
- g_img4 = utils.GetAlbumArtV2(handles[index+3], AlbumArtId.front);
- }
- window.Repaint();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement