Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: WSH Panel Mod script discussion/help (Read 1401829 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod script discussion/help

Reply #300
Sadly I can't use Lyrics Show Panel 2 anymore, it became too unstable...

Is there any script out there that can download lyrics without having to store them somewhere before?

I'll write my own Lyrics panel but I have no idea how to download the lyrics from a site such as LyricWiki.

Any help is appreciated!
<insert signature here>

WSH Panel Mod script discussion/help

Reply #301
To xbullethammer.
1. I have problems with english.
2. I have problems with jscript.
I do not know how, but I wrote this script and it works for me  .

http://rghost.ru/1260945

These scripts are not completed, but things that may help you are in a folder "scripts".

WSH Panel Mod script discussion/help

Reply #302
Hey thanks for this, it works great!

I'll start to work on this once I finish my homework 
<insert signature here>

WSH Panel Mod script discussion/help

Reply #303
@marc2003

I have a few suggestions for your awesome now playing panel:

1.) Save artist images to foobarpath\lastfm\artist 1...artist 2...artist 3...
like biography panel does. This way, we will be able to find the images later on
and also download images by ourselves and put it in the appropriate folder
to display them in the panel.

2.) Option for downloading artist images automatically.

3.) Display something like "foobar2000" on panel startup/no track playing.

You would do me (and maybe others too) a huge favour.

Thanks.


WSH Panel Mod script discussion/help

Reply #304
i have no intention of changing the file path for saved images. the reason i use foobar title formatting $crc32(%artist%) to generate the folder name is so i don't have to worry about windows filename validation. regardless of language/alphabet/special characters/punctuation, it just works. and it also means you can put this in the foobar artreader options so other components can use the same images.

you can right click the panel and use "Open containing folder" if you want to remove/edit/insert your own images in there for rotation (playback would have to be restarted for the script to detect the new files).

WSH Panel Mod script discussion/help

Reply #305
Ok, will do so for rotating images.
What about automatic downloading?

WSH Panel Mod script discussion/help

Reply #306
I've tried to do automatic downloading, but there is one problem with art.exe. I wrote about it .here
 When creating request for nonexistent artist's name in database last.fm. art.exe not self-closing, and remains in Task Manager.

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%scripts\marc2003\v2\common.js"
// ==/PREPROCESSOR==


var title = fb.TitleFormat("[%title%]").Eval();
var album_tf = fb.TitleFormat("$if2(%album%,)");
var artist_tf = fb.TitleFormat("%artist%").Eval();
var g_font_title = gdi.Font("Calibri", 16, 0);
var g_font_album = gdi.Font("Calibri", 18, 0);
var g_font_artist = gdi.Font("Calibri", 18, 0);

var artist = old_artist = null;
var album_img = null;
var artist_img = null;
var g_timer = null;
var offset = 0;

var cycle = window.GetProperty("cycle", 200) - 200;
var limit = window.GetProperty("limit", 325) - 300;
var transition = window.GetProperty("transition", 801) - 800;
var album_img_size = window.GetProperty("album_img_size", 490) - 400;

ww = window.width;
wh = window.height;

var arr = new Array();

if(fb.IsPlaying) on_playback_new_track();



function on_playback_stop(reason) {
if(album_img) album_img.Dispose();
if(artist_img) artist_img.Dispose();
g_metadb = album_img = artist_img = null;
if(reason != 2) window.Repaint();
}

function on_timer(id) {
offset--;
if(offset == 0) {
window.KillTimer(g_timer);
CollectGarbage();
}
window.Repaint();
}

function  on_playback_new_track() {

 
if(transition == 1) {
g_timer = window.CreateTimerInterval(1);
offset = 30;
}
g_metadb = fb.GetNowPlaying();
if(artist) old_artist = artist;
artist_out = fb.TitleFormat("[%artist%]").EvalWithMetadb(g_metadb);
artist = fb.TitleFormat("$replace($lower(%artist%),.,)").EvalWithMetadb(g_metadb);

album = album_tf.EvalWithMetadb(g_metadb);
if(album_img) album_img.Dispose();
album_img = utils.GetAlbumArtEmbedded(g_metadb.rawpath, 0);
if(!album_img) utils.GetAlbumArtAsync(window.ID, g_metadb, 0);
if(artist != old_artist) {
folder = data_folder + fb.TitleFormat("$replace($lower(%artist%),.,)").EvalWithMetadb(g_metadb);
WshShell.Run("\"" + script_path + "art.exe\" \""  + artist + "\" \"" + folder + "\" " + limit, 0, true);
var jpg = utils.Glob(folder + "\\*.jpg").toArray();
var png = utils.Glob(folder + "\\*.png").toArray();
var gif = utils.Glob(folder + "\\*.gif").toArray();
arr = jpg.concat(png, gif);
}
index = Math.floor(Math.random()*arr.length);
load_image();
}

function on_playback_time(time) {
if(cycle > 0 && arr.length > 1 && (time % cycle == 0)) on_mouse_wheel(1);
}

function on_mouse_wheel(delta) {
if(arr.length < 2) return;
index += delta;
if(index < 0) index = arr.length-1;
if(index == arr.length) index = 0;
load_image();
}

function load_image() {
if(artist_img) artist_img.Dispose();
artist_image_path = arr[index];
artist_img = gdi.Image(artist_image_path);
window.Repaint();
}

function on_mouse_lbtn_dblclk() {
try {WshShell.Run("\"" + artist_image_path + "\""); } catch(e) {}
}

function on_get_album_art_done(metadb, art_id, im, ip) {
album_img = im;
window.Repaint();
}

function on_size() {
ww = window.width;
wh = window.height;
}

function scale(gr, img, pos_x, pos_y, width, height, mth) {
var s = mth == "max" ? Math.max(width / img.width, height / img.height) : Math.min(width / img.width, height / img.height);
var nw = img.width * s;
var nh = img.height * s;
pos_x += ((width - nw) / 2);
pos_y += ((height - nh) / 2);
gr.DrawImage(img, pos_x, pos_y, nw, nh, 0, 0, img.width, img.height);
}

function on_paint(gr) {
if(artist_img) {
  gr.FillSolidRect(0,0,ww,wh,RGBA(17,19,49,255)); //background
scale(gr, artist_img, 0, 0, ww, wh, "min");

} else {
gr.FillGradRect(0, 0, ww, wh, 90,g_backcolor, g_textcolor_hl);
}
gr.FillSolidRect(20,wh-130,ww - 40,110,RGBA(0,0,0,156));
  if(album_img) {
text_x = album_img_size + 40;
scale(gr, album_img, (-offset * 20) + 30, wh-30-album_img_size, album_img_size, album_img_size, "min");
} else {
text_x = 30;
}
if(fb.IsPlaying) {
gr.GdiDrawText(title, g_font_title, RGB(255,255,255), text_x, (offset * 15) + wh - 100, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(album, g_font_album, RGB(255,255,255), text_x, (offset * 20) + wh - 55, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
gr.GdiDrawText(artist_out, g_font_artist, RGB(255,255,255), text_x, (offset * 10) + wh - 130, ww-text_x-40, wh,DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
}
}


function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var _cycle = window.CreatePopupMenu();
var _limit = window.CreatePopupMenu();
var _album = window.CreatePopupMenu();
var _transition = window.CreatePopupMenu();
var idx;
_cycle.AppendMenuItem(MF_STRING, 200, "Off");
_cycle.AppendMenuItem(MF_STRING, 205, "5 seconds");
_cycle.AppendMenuItem(MF_STRING, 210, "10 seconds");
_cycle.AppendMenuItem(MF_STRING, 220, "20 seconds");
_cycle.CheckMenuRadioItem(200, 220, window.GetProperty("cycle"));
_limit.AppendMenuItem(MF_STRING, 301, "1");
_limit.AppendMenuItem(MF_STRING, 305, "5");
_limit.AppendMenuItem(MF_STRING, 310, "10");
_limit.AppendMenuItem(MF_STRING, 325, "25");
_limit.CheckMenuRadioItem(301, 325, window.GetProperty("limit"));
_album.AppendMenuItem(MF_STRING, 490, "Small");
_album.AppendMenuItem(MF_STRING, 600, "Large");
_album.CheckMenuRadioItem(490, 600, window.GetProperty("album_img_size"));
_transition.AppendMenuItem(MF_STRING, 800, "Off");
_transition.AppendMenuItem(MF_STRING, 801, "On");
_transition.CheckMenuRadioItem(800, 801, window.GetProperty("transition"));
_menu.AppendMenuItem(g_metadb ? MF_STRING : MF_GRAYED, 11, "Download artist art from Last.fm");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _limit.ID, "Limit");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(artist_img? MF_STRING : MF_GRAYED, 12, "Open containing folder");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _cycle.ID, "Cycle");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _album.ID, "Cover image size");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _transition.ID, "Transition effects");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
//_menu.AppendMenuItem(MF_STRING, 99, "Properties");
_menu.AppendMenuItem(MF_STRING, 100, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
case 200:
case 205:
case 210:
case 220:
window.SetProperty("cycle", idx);
cycle = idx - 200;
break;
case 301:
case 305:
case 310:
case 325:
window.SetProperty("limit", idx);
limit = idx - 300;
break;
case 490:
case 600:
window.SetProperty("album_img_size", idx);
album_img_size = idx - 400;
window.Repaint();
break;
case 800:
case 801:
window.SetProperty("transition", idx);
transition = idx - 800;
break;
case 11:
WshShell.Run("\"" + script_path + "art.exe\" \""  + artist + "\" \"" + folder + "\" " + limit, 0, true);
on_playback_new_track();
break;
case 12:
WshShell.Run("explorer /select," + artist_image_path);
break;
case 99:
window.ShowProperties();
break;
case 100:
window.ShowConfigure();
break;
}
_menu.Dispose();
_cycle.Dispose();
_limit.Dispose();
_transition.Dispose();
_album.Dispose();
return true;
}

function RGBA(r, g, b, a) { return ((a << 24) | (r << 16) | (g << 8) | (b)); }

WSH Panel Mod script discussion/help

Reply #307
I rewrote Marc2003's lastfm and art scripts. They do not need art.exe anymore.

Here is the include file, to see how it works:

Code: [Select]
function BioInfo() {
this.ArtistList = [];
this.Elements = [];
this.AlbumArtist = "";
this.Album = "";
this.Selected = 0;

this.Bio = function() {
if (this.Elements.length > 0) return this.Elements[this.Selected].Bio;
else return "";
}

this.Similar = function() {
var tarr = [];
for (var i in this.Elements) {
for (var j in this.Elements[i].Similar) {
var d = false;
for (var k in tarr) {
if (this.Elements[i].Similar[j] == tarr[k]) d = true;
}
for (var k in this.ArtistList) {
if (this.Elements[i].Similar[j] == this.ArtistList[k]) d = true;
}
if (!d) tarr.push(this.Elements[i].Similar[j]);
}
}
return tarr;
}

this.Tags = function() {
var tarr = [];
for (var i in this.Elements) {
for (var j in this.Elements[i].Tags) {
var d = false;
for (var k in tarr) {
if (this.Elements[i].Tags[j] == tarr[k]) d = true;
}
if (!d) tarr.push(this.Elements[i].Tags[j]);
}
}
return tarr;
}

this.Url = function() {
if (this.Elements.length > 0) return this.Elements[this.Selected].Url;
else return "";
}

this.Get = function(artistlist, albumartist, album, force) {
if (artistlist.toString() != this.ArtistList.toString() || force) {
if (artistlist.toString() != this.ArtistList.toString()) {
this.ArtistList = artistlist;
this.Selected = 0;
}
GetLastFMArtistPics(artistlist[0]);
this.Elements = [];
for (var i in artistlist) {
this.Elements[i] = new BioElement();
this.Elements[i].Get(artistlist[i]);
}
}
if (albumartist != this.AlbumArtist || album != this.Album) {
this.AlbumArtist = albumartist;
this.Album = album;
GetLastFMAlbumPics(albumartist, album);
}
}

this.Force = function() {
this.Elements[this.Selected].Get(this.ArtistList[this.Selected], true);
}

this.Select = function(artist) {
var tmp = 0
for (var i in this.ArtistList) {
if (artist == this.ArtistList[i]) tmp = i;
}
if (tmp != this.Selected) {
this.Selected = tmp;
GetLastFMArtistPics(this.ArtistList[this.Selected]);
} else {
this.Force();
}
}

//artalb: 0 for artist, 1 for album, 2 for both
this.GetImages = function(artalb) {
if (artalb == 0 || artalb == 2) GetLastFMArtistPics(this.ArtistList[0]);
if (artalb == 1 || artalb == 2) GetLastFMAlbumPics(this.AlbumArtist, this.Album);
}
}

function BioElement() {
this.Artist = "";
this.Bio = "";
this.Similar = [];
this.Tags = [];
this.Url = "";

this.Get = function(artist, force) {
if (artist != this.Artist || force) {
this.Artist = artist;
this.Bio = "";
this.Similar = [];
this.Tags = [];
this.Url = "";
var filename = datafolder + crc32(artist).toString(16) + ".xml";
try {
if(fso.fileExists(filename)) {
var file = fso.Getfile(filename);
if(Date.parse(Date()) - Date.parse(file.DateLastModified) < 86400000) {
var text = "";
try {
ts = fso.OpenTextFile(filename,1, false, -1);
text = ts.ReadAll();
ts.close();
} catch(e) {}
if(text.length > 0) {
var xmldom = new ActiveXObject("Microsoft.XMLDOM");
xmldom.async = "false";
xmldom.loadXML(text);
try {this.Bio = decodeXML(xmldom.getElementsByTagName("content")[0].childNodes[0].nodeValue)} catch(e) {}
try {
var similar = xmldom.getElementsByTagName("similar");
for (var i = 0; i < similar[0].getElementsByTagName("name").length; i++) {
this.Similar.push(decodeXML(similar.item(0).getElementsByTagName("name")[i].childNodes[0].nodeValue));
}
} catch(e) {}
try {
var tags = xmldom.getElementsByTagName("tags");
for (var i = 0; i < tags[0].getElementsByTagName("name").length; i++) {
this.Tags.push(decodeXML(tags.item(0).getElementsByTagName("name")[i].childNodes[0].nodeValue));
}
} catch(e) {}
try {this.Url = decodeXML(xmldom.getElementsByTagName("url")[0].childNodes[0].nodeValue)} catch(e) {}
}
} else {
GetLastFMArtist(artist);
}
} else {
GetLastFMArtist(artist);
}
} catch(e) {
fb.trace("ERROR BioElement.Get");
}
}
}
}

//--------------------

var LastFMAPI = ""; // put your lastfm api here
var LastFMUserName = ""; put your lastfm username here
var fso = new ActiveXObject("Scripting.FileSystemObject");
var datafolder = "D:\\Music\\LastFMBio\\"
if(!fso.FolderExists(datafolder)) fso.CreateFolder(datafolder);

//--------------------

function GetLastFMArtist(artist) {
try {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://ws.audioscrobbler.com/2.0?&api_key=" + LastFMAPI +  "&username=" + LastFMUserName + "&method=artist.getinfo&artist=" + encodeURIComponent(artist) + "&s=" + Math.random(), true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
savetextfile(datafolder + crc32(artist).toString(16) + ".xml", xmlhttp.responsetext);
} else {
fb.trace(xmlhttp.responsetext);
}
}
datareload = true;
window.Repaint();
}
} catch(e) {
fb.trace("ERROR GetLastFMArtist");
}
}

function savetextfile(filename, content) {
try {
ts = fso.OpenTextFile(filename, 2, true, -1);
ts.WriteLine(content);
ts.close();
} catch(e) {
fb.trace("ERROR savetextfile");
}
}

function GetLastFMArtistPics(artist) {
window.NotifyOthers("artist", artist);
try {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://ws.audioscrobbler.com/2.0?&api_key=" + LastFMAPI + "&method=artist.getImages&artist=" + encodeURIComponent(artist) + "&limit=5&s=" + Math.random(), true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var xmldom = new ActiveXObject("Microsoft.XMLDOM");
xmldom.async = "false";
xmldom.loadXML(xmlhttp.responsetext);
var urls = [];
try {
var images = xmldom.getElementsByTagName("image");
for (var i = 0; i < images.length; i++) {
var sizes = images[i].getElementsByTagName("size");
for (var j = 0; j < sizes.length; j++) {
if (sizes[j].attributes.getNamedItem("name").value == "original") urls.push(decodeXML(sizes[j].childNodes[0].nodeValue));
}
}
} catch(e) {}
for (var i in urls) {
GetWebPicture(urls[i], artist, "artist", i == (urls.length - 1));
}
} else {
fb.trace(xmlhttp.responsetext);
}
}
}
} catch(e) {
fb.trace("ERROR GetLastFMArtistPics");
}
}

function GetLastFMAlbumPics(artist, album) {
window.NotifyOthers("album", artist + album);
try {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://ws.audioscrobbler.com/2.0?&api_key=" + LastFMAPI + "&method=album.getInfo&artist=" + encodeURIComponent(artist) + "&album=" + encodeURIComponent(album) + "&s=" + Math.random(), true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var xmldom = new ActiveXObject("Microsoft.XMLDOM");
xmldom.async = "false";
xmldom.loadXML(xmlhttp.responsetext);
var url = null;
try {
var images = xmldom.getElementsByTagName("image");
for (var i = 0; i < images.length; i++) {
if (images[i].attributes.getNamedItem("size").value == "extralarge") url = decodeXML(images[i].childNodes[0].nodeValue);
}
} catch(e) {}
if (url) GetWebPicture(url, artist + album, "album", true);
} else {
fb.trace(xmlhttp.responsetext);
}
}
}
} catch(e) {
fb.trace("ERROR GetLastFMAlbumPics");
}
}

function GetWebPicture(url, str, type, last) {
try {
var filename = datafolder + crc32(str).toString(16) + "\\" + crc32(url).toString(16) + url.slice(url.lastIndexOf("."));
if (!utils.FileTest(filename, "e")) {
if(!fso.FolderExists(datafolder + crc32(str).toString(16))) fso.CreateFolder(datafolder + crc32(str).toString(16));
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", url, true);
xmlhttp.setRequestHeader('User-Agent', "foo_wsh_lastfm_bio");
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
savebinaryfile(filename, xmlhttp.responseBody);
if (last) window.NotifyOthers(type, str);
} else {
fb.trace(xmlhttp.responsetext);
}
}
}
}
} catch(e) {
fb.trace("ERROR GetWebPicture");
}
}

function savebinaryfile(filename, content) {
try { 
var ostream = new ActiveXObject("adodb.stream");
ostream.Type = 1 //binary
ostream.Open();
ostream.Write(content);
ostream.SaveToFile(filename,  2);
} catch(e) {
fb.trace("ERROR savebinaryfile");
}
}

function decodeXML(value) {
try {
value = value.replace(/<\/?[^>]+(>|$)/g, "");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = value.replace(/\n/g, "<br>");
value = div.innerHTML;
value = value.replace(/<BR>/g,"\n");
value = value.replace(/&gt;/g,">");
value = value.replace(/&lt;/g,"<");
value = value.replace(/&nbsp;/g," ");
return value.replace(/&amp;/g,"&");
} catch(e) {
fb.trace("ERROR decodeXML");
}
}

function crc32(str) {
var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
var crc = 0;
var x = 0;
var y = 0;
crc = crc ^ (-1);
for (var i = 0, iTop = str.length; i < iTop; i++) {
y = (crc ^ str.charCodeAt (i)) & 0xFF;
x = "0x" + table.substr (y * 9, 8);
crc = (crc >>> 8) ^ x;
}
  return crc ^ (-1);
};

Maybe I'll write an example of how to use it soon, together with an example for my by now largely upgraded input FormsAndButtons script.

WSH Panel Mod script discussion/help

Reply #308
I've tried to do automatic downloading, but there is one problem with art.exe. I wrote about it .here
When creating request for nonexistent artist's name in database last.fm. art.exe not self-closing, and remains in Task Manager.

Thank you for posting this. It stays in the task manager but it works just fine.

I rewrote Marc2003's lastfm and art scripts. They do not need art.exe anymore.

Here is the include file, to see how it works:

Maybe I'll write an example of how to use it soon, together with an example for my by now largely upgraded input FormsAndButtons script.

That would be awesome. Thank you!

Edit: Deleted some misunderstood things...

WSH Panel Mod script discussion/help

Reply #309
I'm using the excellent lyrics viewer by alex1nax. I've made some changes to the code fit it to my taste; however, there's a problem I can't solve.
To make things (I believe) faster, the panel draws the lyrics in a IGdiBitmap which is then drawn into the panel. The problem is that it appears that GdiDrawText() draws the text blended on a black background rather than on a transparent one. I tried switching rendering methods but it appears that DrawString() has the same problem. Is there any way to draw text correctly on a non-black image?
<insert signature here>

WSH Panel Mod script discussion/help

Reply #310
edit: samples NOT updated

something caused it to crash so script removed.


WSH Panel Mod script discussion/help

Reply #311
2nd attempt: samples updated.

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip

changes to "now playing" panel only

-transitions removed. behaviour too random.
-automatically download artist art from lastfm if no artist images exist (you can turn this on/off via the context menu)
-shows text when playback is stopped. you can set this yourself at the top of the script.
-modded "art.exe" that doesn't hang in task manager when artist doesn't exist on last.fm
-minor appearance tweak

WSH Panel Mod script discussion/help

Reply #312
Excellent update marc!
Works flawlessly...

Thank you!

WSH Panel Mod script discussion/help

Reply #313
-automatically download artist art from lastfm if no artist images exist


This looks awesome. Could you please tell how to use this exactly ?

WSH Panel Mod script discussion/help

Reply #314
follow the instructions inside the zip. at the end, the file you need to import is named "now playing.txt". you can control most of the script options via the context menu.

a couple of things which aren't documented:

you can double click the panel to open the current image in your default viewer
use your mouse wheel to cycle through the images

WSH Panel Mod script discussion/help

Reply #315
Hi. Could you please help me pointing me the right direction or some tips to achieve my will.

I would like to reproduce a Simple Volume Knob, inspired by AbeltonLive.
I made an exemple with photoshop in 4 states : 0% 30% 60% and 100% of the volume.



I've read the script of some knobs config (Kameleon and Xchange, by Falstaff) and tried to simplify the code to my purpose.
But i have to say that JScript is for me, much more difficult to understand and learn than TitleFormat Script.

So maybe someone can point me the way to find a very simple code, to start learning JScript, and achieve my knob project.
I put the example image specially to have your comment about how much images/overlays i will need.

Any help would be very appreciated. WSH scares me a bit very much!

WSH Panel Mod script discussion/help

Reply #316
I uploaded a new version of my FormsAndButtons script for buttons and keyboard text input. I also included, a modified version of Marc2003's last.fm script, which doesn't need art.exe anymore (it is possible to download binary files in jscript!).

To show how it works I included an example layout.

[a href='index.php?showtopic=80035']See this topic for screenshots and to download[/a]

WSH Panel Mod script discussion/help

Reply #317
Kabuki: Here is something to start you off. I don't know how to get the two colour effect, I think it would be quite hard. You really need to be able to draw curves I guess. Or figure out how to put a polygon on top that masks the right part- you need to define a set of points that depend on the angle so that it ends up looking how you want. Not easy...

Code: [Select]
function pos2vol(pos) {
    return (50 * Math.log(0.99 * p + 0.01) / Math.LN10);
}

function vol2pos(v){
    return (Math.pow(10, v / 50) - 0.01) / 0.99;
}

var vcol = window.InstanceType?window.GetColorDUI(0):window.GetColorCUI(0);
var bg = window.InstanceType?window.GetColorDUI(1):window.GetColorCUI(3);

var radius = 16;
var line = 3;
var offset = 3;

var voldrag = false;

var p = vol2pos(fb.Volume);
var ang = (3/4)*Math.PI + (3/2)*Math.PI*p;

function on_paint(gr)
{
    gr.FillSolidRect( 0, 0, ww, wh, bg);
    gr.SetSmoothingMode(4);
    gr.DrawEllipse(offset, offset, 2*radius, 2*radius, line, vcol);
    gr.DrawLine(radius*(1+Math.cos(ang))+offset, (radius)*(1+Math.sin(ang))+offset, radius+offset, radius+offset, line, vcol);
}

function on_size()
{
    ww = window.Width;
    wh = window.Height;
}

function on_mouse_lbtn_down(x,y)
{
voldrag = true;
p = vol2pos(fb.Volume);
y_old = y;
}

function on_mouse_lbtn_up(x,y)
{
voldrag = false;
}

function on_mouse_move(x,y)
{
if(voldrag)
{
p = p - (y-y_old)/80;
        p = (p>1)?1:(p<0)?0:p;
fb.Volume = pos2vol(p);
y_old = y;
}
}

function on_mouse_wheel(delta)
{
    p = p + delta/10;
    p = (p>1)?1:(p<0)?0:p;
    fb.Volume = pos2vol(p);
}

function on_volume_change(val)
{
    p = vol2pos(val);
ang = (3/4)*Math.PI + (3/2)*Math.PI*p;
window.Repaint();
}

WSH Panel Mod script discussion/help

Reply #318
the reason i use foobar title formatting $crc32(%artist%) to generate the folder name ... you can put this in the foobar artreader


Ive never thought of that... man its brilliant THANKS!

WSH Panel Mod script discussion/help

Reply #319
Kabuki: Here is something to start you off.
Thank you TomBarlow for having taken time to specially code this. Yes i will step by step learn JScript, since i suppose that more and more components will use this instead of TF.
Now, thanks to you i have a simple code to start.
Cheers

WSH Panel Mod script discussion/help

Reply #320
@ marc2003, do u know how to add item details (title, album, artist) in your aero seekbar script? I think it would be nice...

 

WSH Panel Mod script discussion/help

Reply #321
samples updated with glass playback buttons.

http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip

this has additonal requirements compared to the other scripts:

1) requires columns UI and a specially modified version of WSH panel mod -
http://sites.google.com/site/jk7800/foobar...?attredirects=0
2) the panel must be placed at the bottom of a vertical splitter with both the status bar and status pane turned off

and it looks like this....

WSH Panel Mod script discussion/help

Reply #322
I like that .

WSH Panel Mod script discussion/help

Reply #323
Quote from:  link=msg=698174 date=0
I'm using the excellent lyrics viewer by alex1nax. I've made some changes to the code fit it to my taste; however, there's a problem I can't solve.
To make things (I believe) faster, the panel draws the lyrics in a IGdiBitmap which is then drawn into the panel. The problem is that it appears that GdiDrawText() draws the text blended on a black background rather than on a transparent one. I tried switching rendering methods but it appears that DrawString() has the same problem. Is there any way to draw text correctly on a non-black image?


Any ideas about this?
<insert signature here>

WSH Panel Mod script discussion/help

Reply #324
^No, since AA/ClearType text doesn't like alpha channel, so you need to have a solid background in that case.