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 1375746 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

WSH Panel Mod script discussion/help

Reply #2975
It's alright.

I do not have any way of now knowing what the API acutally returns. I was just referring to the sample response given on the last.fm website for 'artist.getTopAlbums'. It contains "listeners" field.

Code: [Select]
<topalbums artist="Cher">
  <album rank="1">
    <name>Believe</name>
    <mbid>61bf0388-b8a9-48f4-81d1-7eb02706dfb0</mbid>
    <listeners>24486</listeners>
    <url>http://www.last.fm/music/Cher/Believe</url>
    <image size="small">...</image>
    <image size=" medium">...</image>
    <image size="large">...</image>
  </album>
  ...
</topalbums>

Thank your for your time. Appreciate everything you have done.

WSH Panel Mod script discussion/help

Reply #2976
The "playcount" code you gave works on albums too. In most cases (although there is some difference) it returns the correct data.

I also wanted to ask, for some artists (e.g The xx) "top albums" returns "[nothing found]". What can I do to get to it work in such cases?

WSH Panel Mod script discussion/help

Reply #2977
Question: how can I create an empty instance of IFbMetadbHandleList?  I can only figure to clone and remove the contents of an existing playlist but that just seems hacky.

WSH Panel Mod script discussion/help

Reply #2978
I was just referring to the sample response given on the last.fm website for 'artist.getTopAlbums'. It contains "listeners" field.


well it's wrong. if you register for own api key, you will get links to live results on the docs page and you'll see it's missing. last.fm rarely if ever respond to bug reports so i wouldn't waste my time even trying.

I also wanted to ask, for some artists (e.g The xx) "top albums" returns "[nothing found]". What can I do to get to it work in such cases?


there's good news and bad news.

the good: you've found a "bug" in my script where it won't display anything if there is one result. i blame last.fm for their inconsistent response and me having to implement hacks to fix it. having said that, it is now done. right click>Update script
the bad: there should be 24 results for The xx on last.fm and it even gives that total in the response. but for whatever reason, it is only returning 1 actual result. this is something else that would need to fixed at last.fm's end. i wouldn't hold my breath waiting for it.

WSH Panel Mod script discussion/help

Reply #2979
Marc2003 First I would like to thank you for the scripts ,great work !!!

If I may request an update to the now playing & thumbs scripts to include :

im.download();

in

function on_metadb_changed()

so that artist artwork gets downloaded when dynamic metadata changes ( Internet Radio Streams ).


The script only downloads on play start / track change , as you mention in the recent changes.

WSH Panel Mod script discussion/help

Reply #2980
I updated the script.

I am finding the "listeners" & "Plays" code for album panel very useful. Would it be possible to ad the same stats in your bio panel for "artist"?

Thanks marc.

WSH Panel Mod script discussion/help

Reply #2981
I modified marc2003 themed toolbar buttons script , to create an internet radio playlist importer.
All playlists are created through lab.rolisoft.net  , credits to them.

External Shoutcast Explorer https://sourceforge.net/projects/shoutcastexplor/



https://www.dropbox.com/s/etqdndajkl3au3b/screenshot.jpg
Download : https://www.dropbox.com/s/1bepm2sw58c5gww/i...net%20radio.rar



WSH Panel Mod script discussion/help

Reply #2982
@zeremy, i'm not changing the default behaviour because i have no way to test it at the moment.

@mgpai, although my bio text originates from last.fm, i actually fetch it from a completely different webservice (theechonest.com) and that does not provide playcount/listener info.

WSH Panel Mod script discussion/help

Reply #2983
@mgpai, although my bio text originates from last.fm, i actually fetch it from a completely different webservice (theechonest.com) and that does not provide playcount/listener info.


OK. Thank you marc.

WSH Panel Mod script discussion/help

Reply #2984
Marc i need your help, i'm tryin to make last.fm radio. To include this in foobar 'youtube radio'.
It's really amazing how great it works, in same way as the web last.fm radio.
For now everything is ok.

But i must to make these 3 function, that every function start after previously is finished.
I want to use 'im.working=false;' to start next function.
But how to do that?

I think to make all this as one function, and then use: 'im.working=false;' to start next part?
Is this possible?

(till now i used timer for this).



Code: [Select]
//Open Similar Artist

this.Similar_Art = function()
  
    {
     //Select Random Page
      var randomnumber=Math.floor(Math.random()*18)
      var a=randomnumber;

        this.working=true;
        
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://www.last.fm/music/" + START_ARTIST + "/+similar"+ "?page=" + a, true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("div");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("a");
                    var urls = [];
    
            

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/music/") == 0) urls.push("http://www.last.fm/music/" + data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0","").replace("6","").replace("4","").replace("3","").replace("2","").replace("5","").replace("9","") + "/+tracks");    
}

//Select Random Artist(num)

var randomnumber = Math.floor(Math.random()*(17-46)+46);
i=randomnumber;


{

p.console("Random Artist: " + urls[i]);

server = window.SetProperty("Download  source", urls[i]);
server = urls[i];
window.SetProperty("Download  source", urls[i]);
                  
}
                                             im.doc.close();
                                    im.working=false;

                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
}
}
}    
}                    








//Find Track(For Selected Artist)

this.Track = function()
  
           {

      //Select Random Page

      var randomnumber=Math.floor(Math.random()*18)
      var a=randomnumber;

   this.working=true;
        
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", server + "?page=" + a, true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("td");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("a");
                    var urls = [];
    
            

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("?page=1","").replace("/+videos/","").replace("?page=2","").replace("+Video","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0/","/").replace("6/","/").replace("4/","/").replace("3/","/").replace("2/","/").replace("5/","").replace("9/","/"));        
}


// Select Random Track

var randomnumber = Math.floor(Math.random()*(18-117)+117);
i=randomnumber;


{

//Track Name

p.console("Random Track: " + urls[i]);

ooo2 = window.SetProperty("ART2", urls[i]);
ooo2 = urls[i];
window.SetProperty("ART2", urls[i]);

}
      
          im.doc.close();
                    im.working=false;

                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
                im.download();
                
}
}
}
}






        
//Open Youtube-Track in Foobar
    
this.Open_Youtube_Track = function()
  
    {
     this.working=true;
      
        if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://www.youtube.com/results?search_query=" + ooo2, true);
        this.xmlhttp.send();
        this.xmlhttp.onreadystatechange = function() {
            if (im.xmlhttp.readyState == 4) {
                if (im.xmlhttp.status == 200) {
                    var text = im.xmlhttp.responsetext;
                    if (!im.doc) im.doc = new ActiveXObject("htmlfile");
                    im.doc.open();
                    var div = im.doc.createElement("li");
                    div.innerHTML = text;
                    var data = div.getElementsByTagName("a");
                    var urls = [];
    
            

for (i = 0; i < data.length; i++) {
    if (data[i].href.indexOf("about:/watch?v=") == 0) urls.push("http://www.youtube.com/" + data[i].href.replace(/about:\//,""));
}

//Open first youtube video(found)

i = 1;

{

p.console("YT Video" + urls[i]);

var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
p.run(tmppath+"\\foobar2000.exe /add "+"\ " + urls[i] + "\"");                  
                    

}
        
            

         im.doc.close();
                 im.working=false;
                
                } else {
                    p.console("HTTP error: " + im.xmlhttp.status);
                }
            }
        }
    }

WSH Panel Mod script discussion/help

Reply #2985
I have a question about the rating panel in foobox that maybe someone here can answer. When I rate something from the panel on the right it writes to file tags instead of the database. Is there a relatively painless method to change that to playback stats database instead?  I believe the code snippet below is what needs to be altered but am not familiar enough with scripting to be certain.

Code: [Select]
ButtonUI.prototype.MouseUp = function(i){
    if(i== mouse_on_flag){
        if (derating_flag){
            g_metadb.UpdateFileInfoSimple("RATING","");
        } else g_metadb.UpdateFileInfoSimple("RATING",i);
        return true;
    }else return false;
}

WSH Panel Mod script discussion/help

Reply #2986
i think this should do it...

Code: [Select]
ButtonUI.prototype.MouseUp = function(i){
    if (i== mouse_on_flag){
        fb.RunContextCommandWithMetadb("Rating/" + (derating_flag ? "<not set>" : i), g_metadb, 8);
        return true;
    } else {
        return false;
    }
}



WSH Panel Mod script discussion/help

Reply #2988
Code: [Select]
//Open Similar Artist

this.Similar_Art = function()
 
{
//Select Random Page
  var randomnumber=Math.floor(Math.random()*18)
  var a=randomnumber;

this.working=true;

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.last.fm/music/" + START_ARTIST + "/+similar"+ "?page=" + a, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("div");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];



for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("about:/music/") == 0) urls.push("http://www.last.fm/music/" + data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("/+videos/","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0","").replace("6","").replace("4","").replace("3","").replace("2","").replace("5","").replace("9","") + "/+tracks");
}

//Select Random Artist(num)

var randomnumber = Math.floor(Math.random()*(17-46)+46);
i=randomnumber;


{

p.console("Random Artist: " + urls[i]);

server = window.SetProperty("Download  source", urls[i]);
server = urls[i];
window.SetProperty("Download  source", urls[i]);
 
}
im.doc.close();
im.working=false;

} else {
p.console("HTTP error: " + im.xmlhttp.status);
}
}
}
}








//Find Track(For Selected Artist)

this.Track = function()
 
  {

  //Select Random Page

  var randomnumber=Math.floor(Math.random()*18)
  var a=randomnumber;

  this.working=true;

if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", server + "?page=" + a, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("td");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];



for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("about:/music/") == 0) urls.push(data[i].href.replace(/about:\//,"").replace("music/","").replace("/_/"," - ").replace("+"," ").replace("free-music-downloads","").replace("/+similar?page=2","").replace("/+events","").replace("/+wiki","").replace("-+","").replace("+","").replace("+","").replace("/+albums","").replace("/+tags","").replace("/+images","").replace("/journal","").replace("/charts","").replace("/images","").replace("/listeners","").replace("/similar?page=17","").replace("/news","").replace("/groups","").replace("/albums","").replace("/videos","").replace("/tracks","").replace("/similar","").replace("/tags","").replace("noredirect/","").replace("listeners/+tracks","").replace("videos/+tracks","").replace("?page=1","").replace("/+videos/","").replace("?page=2","").replace("+Video","").replace("?page=1","").replace("?page=8","").replace("?page=5","").replace("?page=7","").replace("?page=9","").replace("?page=8","").replace("0/","/").replace("6/","/").replace("4/","/").replace("3/","/").replace("2/","/").replace("5/","").replace("9/","/"));
}


// Select Random Track

var randomnumber = Math.floor(Math.random()*(18-117)+117);
i=randomnumber;


{

//Track Name

p.console("Random Track: " + urls[i]);

ooo2 = window.SetProperty("ART2", urls[i]);
ooo2 = urls[i];
window.SetProperty("ART2", urls[i]);

}
 
  im.doc.close();
im.working=false;

} else {
p.console("HTTP error: " + im.xmlhttp.status);
im.download();

}
}
}
}







//Open Youtube-Track in Foobar

this.Open_Youtube_Track = function()
 
{
this.working=true;
 
if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
this.xmlhttp.open("GET", "http://www.youtube.com/results?search_query=" + ooo2, true);
this.xmlhttp.send();
this.xmlhttp.onreadystatechange = function() {
if (im.xmlhttp.readyState == 4) {
if (im.xmlhttp.status == 200) {
var text = im.xmlhttp.responsetext;
if (!im.doc) im.doc = new ActiveXObject("htmlfile");
im.doc.open();
var div = im.doc.createElement("li");
div.innerHTML = text;
var data = div.getElementsByTagName("a");
var urls = [];



for (i = 0; i < data.length; i++) {
if (data[i].href.indexOf("about:/watch?v=") == 0) urls.push("http://www.youtube.com/" + data[i].href.replace(/about:\//,""));
}

//Open first youtube video(found)

i = 1;

{

p.console("YT Video" + urls[i]);

var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
p.run(tmppath+"\\foobar2000.exe /add "+"\ " + urls[i] + "\"");  


}



im.doc.close();
im.working=false;

} else {
p.console("HTTP error: " + im.xmlhttp.status);
}
}
}
}
Yikes, use codebox instead of code for large posts, please.

WSH Panel Mod script discussion/help

Reply #2989
Well, the spectrogram script seems to ''work'', but the window stays white.

Using Windows 8 - 64 bits


WSH Panel Mod script discussion/help

Reply #2990
it looks like sox and/or ffmpeg haven't been put in the right place. here are the notes contained in the script itself.

Quote
/*
SETUP

Download and extract sox.exe to a folder named sox in your foobar2000 profile folder

http://sourceforge.net/projects/sox/files/sox/

Download and extract ffmpeg.exe into the sox folder

http://ffmpeg.zeranoe.com/builds/

If you already have these programs installed you can modify the paths below. note the double backslashes.
*/

var sox_exe = fb.ProfilePath + "sox\\sox.exe";
var ffmpeg_exe = fb.ProfilePath + "sox\\ffmpeg.exe";


i guess i could display a more helpful prompt rather than just leaving a blank panel.


WSH Panel Mod script discussion/help

Reply #2991
I'm stupid, I copied SoX's shortcut instead of the exe by mistake.

Thanks ! 


WSH Panel Mod script discussion/help

Reply #2993
Is there any way to remove these 2 options from the art reader?



I figured out how to remove them from the list there but if I use the scroll wheel on the mouse it's as if they're still there. I'd like to be able to scroll through just front, back and disc.

What does the icon option do btw? I have no idea.




WSH Panel Mod script discussion/help

Reply #2994
open the editor dialog and add this right at the end...

Code: [Select]
a.wheel = function(step) {
    if (!this.trace(p.mx, p.my)) return false;
    this.id -= step;
    if (this.id < 0) this.id = 2;
    if (this.id > 2) this.id = 0;
    window.SetProperty("artreader_id", this.id);
    this.metadb_changed();
    return true;
}

WSH Panel Mod script discussion/help

Reply #2995
open the editor dialog and add this right at the end...

Code: [Select]
a.wheel = function(step) {
    if (!this.trace(p.mx, p.my)) return false;
    this.id -= step;
    if (this.id < 0) this.id = 2;
    if (this.id > 2) this.id = 0;
    window.SetProperty("artreader_id", this.id);
    this.metadb_changed();
    return true;
}



Great! Thanks.

WSH Panel Mod script discussion/help

Reply #2996
Need some help again. I have been altering fooRazor bit by bit to something that suits me better but have ran into a snag of sorts. The control bar. I like the functionality and general feel of the config but the rounded corners of the control bar seem out of place. My lack of script knowledge isn't helping and I can't seem to pinpoint how to change them to just a squared corner. I've tried commenting parts out of the control bar config to see what did what but still no luck. Any tips appreciated.

Image pointing out my question.

WSH Panel Mod script discussion/help

Reply #2997
@marc2003 -

Couple of questions about some of your sample scripts. I have been messing around with your themed toolbar script and was wondering if there was a way to state location relative to the window. EG: Place button images in center of window without the need for stating offsets. Currently it's close, but was curious if there was a simpler (or more precise) way to make this happen. My problem is not having an example to look at to try and work this out myself.

Next, was wondering if it is possible to use the cover art in that same screenshot as a means to trigger the now playing call back to the playlist? Sort of like the status bar double click. Figured it would be useful if one were to use ui_hacks to hide the status bar.

Also, my question above regarding the rounded corners of fooRazor have been sorted thanks to bb10.

WSH Panel Mod script discussion/help

Reply #2998
you can center the buttons if you replace your on_size function with this.

Code: [Select]
function on_size() {
    p.size();
    var bx = Math.round((p.w - (bw * 6)) / 2);
    b.buttons = {
        b1: new button(bx, 5, bw, bh, {normal: "stop.png"}, function() { fb.Stop(); }, "Stop", true),
        b2: new button(bx + bw, 5, bw, bh, {normal: "pause.png"}, function() { fb.Pause(); }, "Pause", true),
        b3: new button(bx + (bw * 2), 5, bw, bh, {normal: "play.png"}, function() { fb.Play(); }, "Play", true),
        b4: new button(bx + (bw * 3), 5, bw, bh, {normal: "previous.png"}, function() { fb.Prev(); }, "Previous", true),
        b5: new button(bx + (bw * 4), 5, bw, bh, {normal: "next.png"}, function() { fb.Next(); }, "Next", true),
        b6: new button(bx + (bw * 5), 5, bw, bh, {normal: "preferences.png"}, function() { fb.ShowPreferences(); }, "Preferences", true)
    }
}


you can't mimic the double clicking of the status bar in default UI as there is no menu command to do it. it's only possible with columns. that also allows you to hide the status bar without using banned components.

WSH Panel Mod script discussion/help

Reply #2999
Thanks again.

And one more if you don't mind... Your Autoplaylist script has save slots. Can those slots be represented by buttons which are accessible in that panel? Sorry to pester, but I'm curious about what can be done with this scritpting stuff.