123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- /*---------------------------------------------------
- -----------------------------------------------------
- Filename: albumart.m
- Version: 1.1
- Type: maki
- Date: 20. Sep. 2007 - 16:54
- Author: Martin Poehlmann aka Deimos
- E-Mail: [email protected]
- Internet: www.skinconsortium.com
- www.martin.deimos.de.vu
- -----------------------------------------------------
- ---------------------------------------------------*/
- #include <lib/std.mi>
- #include <lib/com/songinfo.m>
- #define WEBCOVER_SHOUTCAST "winamp.cover.shoutcast"
- Function loadFileInfo();
- //Function loadPlaylistArtWork();
- Global Int plArtRetries = 0;
- Global Group scriptGroup;
- Global AlbumArtLayer l_albumart;
- Global String notfoundImage = "winamp.cover.notfound.xxl";
- System.onScriptLoaded ()
- {
- scriptGroup = getScriptGroup();
- l_albumart = scriptGroup.findObject(getToken(getParam(), ",", 0));
- notfoundImage = getToken(getParam(), ",", 1);
- loadFileInfo();
- }
- l_albumart.onRightButtonDown (int x, int y)
- {
- popupmenu p = new popupmenu;
- p.addCommand("Refresh Album Art", 1, 0, 0);
- String path = getPath(getPlayItemMetaDataString("filename"));
- if(path != "")
- {
- p.addCommand("Open Folder", 2, 0, 0);
- }
- int result = p.popatmouse();
- delete p;
- if (result == 1)
- {
- l_albumart.refresh();
- }
- else if (result == 2)
- {
- if(path != "")
- {
- System.navigateUrl(path);
- }
- else
- {
- String url = getPlayItemMetaDataString("streamurl");
- if(url != "")
- {
- System.navigateUrl(url);
- }
- }
- }
- }
- l_albumart.onLeftButtonDblClk (int x, int y)
- {
- String path = getPath(getPlayItemMetaDataString("filename"));
- if(path != "")
- {
- System.navigateUrl(path);
- }
- else
- {
- String url = getPlayItemMetaDataString("streamurl");
- if(url != "")
- {
- System.navigateUrl(url);
- }
- }
- }
- loadFileInfo ()
- {
- songinfo_reload(); // refresh vars
- plArtRetries = 0;
- l_albumart.setXMLParam("notfoundImage", notfoundImage);
- //debugInt(songinfo_isStream);
- if (songinfo_isStream)
- {
- // setCover either from a supplied url or from in-stream artwork or default to a generic image
- if (songinfo_streamAlbumArt != "")
- {
- l_albumart.setXMLParam("image", songinfo_streamAlbumArt);
- l_albumart.setXMLParam("notfoundImage", notfoundImage);
- }
- if(songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST || songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST2)
- {
- if(songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST2)
- {
- if(l_albumart.isInvalid() && plArtRetries < 5)
- {
- if(!plArtRetries)
- {
- l_albumart.setXMLParam("notfoundImage", WEBCOVER_SHOUTCAST);
- }
- plArtRetries += 1;
- l_albumart.refresh();
- }
- }
- else
- {
- l_albumart.setXMLParam("notfoundImage", WEBCOVER_SHOUTCAST);
- }
- }
- }
- }
- // Hide branding of we start playback
- System.onPlay ()
- {
- loadFileInfo();
- }
- System.onTitleChange (String newtitle)
- {
- loadFileInfo();
- }
|