Skip to main content

Topic: WSH Panel Mod script discussion/help (Read 844571 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Bratman
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2925
that missing file doesn't affect functionality - all it does is provide auto-complete when typing in the editor dialog. but here is how to install components properly so you won't see that error: http://wiki.hydrogenaudio.org/index.php?ti...all_a_component

as for the now playing script not downloading, check the console for errors? check the right click menu options because automatic downloads are off on fresh installs. i've done this because it's so slow now. also, browse the last.fm site to make sure there are images for that artist.

Ah good to know but there is still a problem with the now playing not displaying images, did everything you said. Here is the console.

Code: [Select]
Components loaded in: 0:00.080539
Configuration read in: 0:00.006299
Watching: D:\Music
Filter Panel - Album Artist: initialised in 0.021 s
Filter Panel - Album: initialised in 0.024 s
Filter Panel - Album Artist: initialised in 0.020 s
Filter Panel - Genre: initialised in 0.026 s
WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Last.fm & Wikipedia Biography by marc2003): initialized in 27 ms
WSH Panel Mod (Musicbrainz by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Musicbrainz by marc2003): initialized in 10 ms
Custom bitmap C:\Users\Nate\AppData\Roaming\foobar2000\themes\Slides\qsearch.bmp could not be loaded
WSH Panel Mod (Art Reader by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Art Reader by marc2003): initialized in 8 ms
WSH Panel Mod (Now Playing by marc2003): Parsing file "C:\Users\Penfold\AppData\Roaming\foobar2000\marc2003\common7.js"
WSH Panel Mod (Now Playing by marc2003): initialized in 30 ms
WSH Panel Mod ({5AB6CF2C-C671-4F1A-BF08-A96BD9F962C2}): initialized in 0 ms
Error: Image draw failed (h_iml)
Error: Image draw failed (h_iml)
Seekbar: taking Direct3D9 path.
Seekbar: Frontend initialized.
User Interface initialized in: 0:01.248419
Startup time : 0:01.472080
Opening track for playback: "D:\Music\A Day To Remember\2013 - Common Courtesy\01 - City Of Ocala.mp3"
Error: Image draw failed (h_iml)
  • Last Edit: 15 February, 2014, 05:41:38 PM by Bratman

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2926
make sure you have the latest version (right click>Update script). also, make sure it actually displays images ok by putting an image in a folder manually. right click the panel>open containing folder and put any test image in. the script will detect it after a second or 2.

if that all works but it's still failing to download then try saving this in the marc2003 folder and restart foobar.

https://dl.dropboxusercontent.com/u/2280132...temp/common7.js

it should show a bit more console output like this.

Code: [Select]
Now Playing: Looking up http://www.last.fm/music/HAIM/+images 
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/93366011.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/90639285.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/92179611.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/86235493.png
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/85776687.png

  • Last Edit: 15 February, 2014, 06:37:13 PM by marc2003

  • Bratman
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2927
Still not working  Any other ideas? The console is displaying like you pasted but there is no image being displayed? If I drop an image inside it will display it though?
  • Last Edit: 15 February, 2014, 08:26:43 PM by Bratman

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2928
i can't help when you post such a vague reply. let's try again.... 

does it display an image when you add it to a folder manually? read the previous post for how to do this. a simple yes or no answer would be sufficient.
does the console display anything at all when trying to download images? even with no internet it would still display the URL it's trying to lookup. if you can't even confirm that, what else do you expect me to do?

  • Bratman
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2929
i can't help when you post such a vague reply. let's try again.... 

does it display an image when you add it to a folder manually? read the previous post for how to do this. a simple yes or no answer would be sufficient.
does the console display anything at all when trying to download images? even with no internet it would still display the URL it's trying to lookup. if you can't even confirm that, what else do you expect me to do?


Shit sorry man! Yeah it displays an image. The console says basically what you pasted. If I search the images they are not going into the right folder. They are in C:\Users\Penfold\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\R8XAR7JC

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2930
all content fetched my scripts will end up in the IE cache so that should be irrelevant. you can open internet explorer and clear it to see if that helps.

i've also updated the script to display in the console where it's trying to save to... https://dl.dropboxusercontent.com/u/2280132...temp/common7.js

if you could post a full example like this so i can see the URLS and file paths.

Code: [Select]
Thumbs: Looking up http://www.last.fm/music/Electric%20Youth/+images 
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/75817356.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_75817356.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/52334493.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_52334493.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/37913895.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_37913895.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/37913835.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_37913835.png"
Thumbs: Downloading http://userserve-ak.last.fm/serve/_/52909963.png
Thumbs: Saving to "D:\Applications\foobar2000\wsh_lastfm\2798189436\Electric Youth_52909963.png"

WSH Panel Mod script discussion/help
Reply #2931
all content fetched my scripts will end up in the IE cache so that should be irrelevant. you can open internet explorer and clear it to see if that helps.

i've also updated the script to display in the console where it's trying to save to... https://dl.dropboxusercontent.com/u/2280132...temp/common7.js


hello, I am the one with the issue...

the link doesnt work so I am unable to download that file. could you re-upload?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2932
try again now.

WSH Panel Mod script discussion/help
Reply #2933
Code: [Select]
Opening track for playback: "D:\Music\Falling In Reverse\Fashionably Late\02 - Bad Girls Club.flac"
Now Playing: Looking up http://www.last.fm/music/Falling%20In%20Reverse/+images
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/89238007.png
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_89238007.png"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/71750766.png
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_71750766.png"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/70467528.png
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_70467528.png"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/68549426.jpg
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_68549426.jpg"
Now Playing: Downloading http://userserve-ak.last.fm/serve/_/67632608.jpg
Now Playing: Saving to "C:\Users\Penfold\AppData\Roaming\foobar2000\wsh_lastfm\1159193221\Falling In Reverse_67632608.jpg"
Autobackup: Backed up 34 items to autobackup.20140216-232135.zip

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2934
browse the marc2003 folder and check the contents of the file named download.vbs match this: https://dl.dropboxusercontent.com/u/2280132...03/download.vbs


WSH Panel Mod script discussion/help
Reply #2935
browse the marc2003 folder and check the contents of the file named download.vbs match this: https://dl.dropboxusercontent.com/u/2280132...03/download.vbs

yep, its identical to this.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2936
save this in your marc2003 folder and double click to run it...

https://dl.dropboxusercontent.com/u/2280132...h/temp/test.vbs

it should save an image in the same folder and if not, display an error.

WSH Panel Mod script discussion/help
Reply #2937
save this in your marc2003 folder and double click to run it...

https://dl.dropboxusercontent.com/u/2280132...h/temp/test.vbs

it should save an image in the same folder and if not, display an error.


issue was due to me not being able to run vbscript files... i think installing notepad++ caused some error along the way.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2938
^that would only affect the test.vbs file i posted. the original is called from the command line with cscript.exe so file associations shouldn't have come into it.
  • Last Edit: 16 February, 2014, 09:22:46 PM by marc2003

  • room302
  • [*]
WSH Panel Mod script discussion/help
Reply #2939
hi everyone i have a little problem,
i wanna to change this script background black (default white), is it possible ?

[code]// Maxim Terpilovsky's script
// Track Info Panel
// Updated 31-12-2013

// ==PREPROCESSOR==
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==


var string_height, string_number, min_width, column_number, max_elements, rating_view, btns_ready, updated;
var Buttons = [];
var btn;
var hover_button = null;


MF_STRING = 0x00000000;
DT_TOP = 0x00000000;
DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_BOTTOM = 0x00000008;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
DT_EDITCONTROL = 0x00002000;
DT_END_ELLIPSIS = 0x00008000;


try { var folder = gdi.Image(fb.FoobarPath + "s7e_files\\images\\big_folder.png"); }
catch(e) {var folder = false;  }

try { var empty_selection = gdi.Image(fb.FoobarPath + "s7e_files\\images\\empty_selection.png"); }
catch(e) {var empty_selection = false;  }

try { var checked_star = gdi.Image(fb.FoobarPath + "s7e_files\\images\\star.png"); }
catch(e) { var checked_star = false;}

try { var empty_star = gdi.Image(fb.FoobarPath + "s7e_files\\images\\star_grey.png"); }
catch(e) { var empty_star = false;}


if ( utils.CheckFont( "Segoe UI" ) ) {
    var font            = gdi.Font("Segoe UI", 12, 0);
    var font_p1         = gdi.Font("Segoe UI", 13, 0);
    var font_p1_under   = gdi.Font("Segoe UI", 13, 4);
    var font_big        = gdi.Font("Segoe UI", 80, 1);
    var font_bold       = gdi.Font("Segoe UI", 12, 1);
    var font_under      = gdi.Font("Segoe UI", 12, 4);
} else {
    var font            = gdi.Font("Tahoma", 11, 0);
    var font_p1         = gdi.Font("Tahoma", 12, 0);
    var font_p1_under   = gdi.Font("Tahoma", 11, 4);
    var font_big        = gdi.Font("Segoe UI", 80, 1);
    var font_bold       = gdi.Font("Tahoma", 11, 1);
    var font_under      = gdi.Font("Tahoma", 11, 4);
}


fso = new ActiveXObject("Scripting.FileSystemObject");

ini_tag_write       = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'write-rating-to-tag', 0) );
mode                = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'track-info-mode', 1) );
rects               = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'rectangular-backs', 0) );
valign              = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'vertical-align', 0) );
show_cover_instead  = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'show-cover-instead', 0) );


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

function TimeFmt(t){
    var zpad = function(n){
        var str = n.toString();
        return (str.length<2) ? "0"+str : str;
    }
    var h = Math.floor(t/3600); t-=h*3600;
    var m = Math.floor(t/60); t-=m*60;
    var s = Math.floor(t);
    if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
    return m.toString()+":"+zpad(s);
}

function isArray(input){
    return typeof(input)=='object'&&(input instanceof Array);
}

unique = function(arr) {
    var o = {}, i, l = arr.length, r = [];
    for(i=0; i<l;i+=1) o[arr[i]] = arr[i];
    for(i in o) r.push(o[i]);
    return r;
};

max = function(arr) {
  return Math.max.apply(null, arr)
}

min = function(arr) {
  return Math.min.apply(null, arr)
}

indexOf = function(value, arr, start) {
    var i;
    if (!start) {
        start = 0;
    }
    for(i=start; i<arr.length; i++) {
        if(arr[i] == value) {
        return i;
        }
    }
    return -1;
}
function trim(string)
{
return string.replace(/(^\s+)|(\s+$)/g, "");
}


function calculate_dims() {

    string_height = font.Height + 5;
    string_number = Math.floor( window.Height / string_height );

    min_width = 200;
    column_number = Math.floor( ( window.Width - window.Height - 6 ) / min_width );
    max_elements = column_number * string_number;
    //fb.trace('max_elements ' + max_elements);
}

function dump(arr,level) {
    var dumped_text = "";
    if(!level) level = 0;
    
    //The padding given at the beginning of the line.
    var level_padding = "";
    for(var j=0;j<level+1;j++) level_padding += "    ";
    
    if(typeof(arr) == 'object') { //Array/Hashes/Objects
        for(var item in arr) {
            var value = arr[item];
            
            if(typeof(value) == 'object') { //If it is an array,
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += dump(value,level+1);
            } else {
                dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
            }
        }
    } else { //Stings/Chars/Numbers etc.
        dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
    }
    return dumped_text;
}







function Button(x, y, w, h, label_size, update, name, hover, func) {
    this.name = name;
    this.func = func;
    this.hover = hover;
    this.update = update;

    this.traceMouse = function(x, y) {
        var b = (this.left <= x) && (x <= this.right) && (this.top <= y) && (y <= this.bottom);
        return b;

    };

    this.onHover = function( x, y) {
        this.hover && this.hover(  x, y, this.left, this.label_size );
    };
    

    this.onClick = function( x, y ) {
        this.func && this.func( x, y, this.left, this.label_size );
    };
}

function ClearButtonCoords() {
    for ( var n=Buttons.length; n--; ) {
        Buttons[n].x = 0;
        Buttons[n].y = 0;
        Buttons[n].w = 0;
        Buttons[n].h = 0;

        Buttons[n].left = 0;
        Buttons[n].top = 0;
        Buttons[n].right = 0;
        Buttons[n].bottom = 0;
        Buttons[n].label_size = 0;
    }
}

function OnFilename() { window.SetCursor(32649); }
function Filename() {

    try { fb.RunMainMenuCommand('View/Columns playlist/Activate now playing' ); }
    catch(e) { }

}


function OnTitle() { window.SetCursor(32649); }
function Title() {

    try { fb.RunContextCommandWithMetadb('Tagging/Discogs/Write Tags...', ItemInfo.CachedMetadb ); }
    catch(e) { }

}


function OnTags() { window.SetCursor(32649); }
function Tags() {

    try { fb.RunContextCommandWithMetadb('Tagging/MP3 tag types...', ItemInfo.CachedMetadb ); }
    catch(e) { }

}


function OnCue() { window.SetCursor(32649); }
function Cue() {

    try { fb.RunContextCommandWithMetadb('Utilities/Edit cuesheet', ItemInfo.CachedMetadb ); }
    catch(e) { }

}


function OnArtist() { window.SetCursor(32649); }
function Artist() {

    try { fb.RunContextCommandWithMetadb('Quicksearch for same/Artist', ItemInfo.OutputMetadb(true) ); }
    catch(e) { }

}


function OnAlbum() { window.SetCursor(32649); }
function Album() {

    try { fb.RunContextCommandWithMetadb('Quicksearch for same/Album', ItemInfo.OutputMetadb(true) ); }
    catch(e) { }

}


function OnPath() { window.SetCursor(32649); }
function Path() {

    try { fb.RunContextCommandWithMetadb('Open containing folder', ItemInfo.OutputMetadb(true) ); }
    catch(e) { }

}



function ViewRating(x, y, left, label_size) {

    var meta = ItemInfo.OutputMetadb();
    if ( meta ) {

        x -= left + label_size;

        if ( x < 90 && x > 0 ) {
            rating_view = Math.min(5,Math.floor( x / (90/5) ) + 1);
            //window.SetCursor(32649);
        }
        else {
            rating_view = 0;
            //window.SetCursor( 32512 );
        }

    }

}

GetRating = function() {

    var meta = ItemInfo.OutputMetadb();
    if ( meta ) {

        if ( meta.Count != null ) {

            rating = 0;
            for ( i = 0; i < meta.Count; i++ ) {
                var item = meta.Item( i );
                rating += parseInt( fb.TitleFormat("$if3(%rating%,%rating_sql%,0)").EvalWithMetadb( item ) );
            }
            rating = rating / meta.Count;

        }
        else if ( meta ) {

            //fb.trace( meta.Path );
            rating = fb.TitleFormat("$if3(%rating%,%rating_sql%,0)").EvalWithMetadb( meta );
            if ( isNaN ( rating ) ) rating = 0;

        }

        return rating;
    }

}

function SetRating(x, y, left, label_size) {

    x -= left + label_size;
    //fb.trace(x+ y+ left+ label_size);

    if ( x < 90 && x > 0 ) {


        var rating_current = GetRating();
        rating_view = Math.min(5, Math.floor( x / (90/5) ) + 1);
        if ( rating_current == rating_view ) rating_view = 0;
        meta = ItemInfo.OutputMetadb();

        if ( meta ) {

            if ( utils.CheckComponent("foo_customdb", true) ) {

                fb.RunContextCommandWithMetadb("Legacy Commands (unsorted)/Set Rating " + rating_view, meta);
                ItemInfo.Update();

            }
            else if ( utils.CheckComponent("foo_playcount", true) ) {

                fb.RunContextCommandWithMetadb("Playback Statistics/Rating/" + (rating_view == 0 ? '<not set>' : rating_view), meta);
                ItemInfo.Update();

            }
            else {

                if ( ini_tag_write == 1 ) {

                    if ( meta.Count != null ) {
                        for ( i = 0; i < meta.Count; i++ ) {
                            var item = meta.Item( i );
                            item.UpdateFileInfoSimple('Rating', rating_view);
                        }
                    }
                    else {
                        meta.UpdateFileInfoSimple('Rating', rating_view);
                    }
                    ItemInfo.Update();

                }

            }

        }
        rating_view = 0;
    }

    
}




buttons = {

    filename:       new Button(0,0,0,0,0,0, "Filename", OnFilename, Filename ),
    codec:          new Button(0,0,0,0,0,0, "Codec", false, false ),
    artist:         new Button(0,0,0,0,0,0, "Artist", OnArtist, Artist ),
    album:          new Button(0,0,0,0,0,0, "Album", OnAlbum, Album ),
    title:          new Button(0,0,0,0,0,0, "Title", OnTitle, Title ),
    date:           new Button(0,0,0,0,0,0, "Date", false, false ),
    rating:         new Button(0,0,0,0,0,1, "Rating", ViewRating, SetRating ),
    played:         new Button(0,0,0,0,0,0, "Played", false, false ),
    genre:          new Button(0,0,0,0,0,0, "Genre", false, false ),
    filesize:       new Button(0,0,0,0,0,0, "File size", false, false ),
    duration:       new Button(0,0,0,0,0,0, "Duration", false, false ),
    firstplayed:    new Button(0,0,0,0,0,0, "First played", false, false ),
    lastplayed:     new Button(0,0,0,0,0,0, "Last played", false, false ),
    path:           new Button(0,0,0,0,0,0, "Path", OnPath, Path ),
    lastmodified:   new Button(0,0,0,0,0,0, "Last Modified", false, false ),
    cuesheet:       new Button(0,0,0,0,0,0, "Cuesheet", OnCue, Cue ),
    tagtype:        new Button(0,0,0,0,0,0, "Tag Type", OnTags, Tags )

}



for (var i in buttons ) {
    Buttons.push(buttons[i]);
}


function ClearButtonsVars() {
    
    rating_view = 0;
    window.SetCursor(32512);
    
}

// fb.trace( dump(Buttons) );

function inArray(arr, val) {
    var i = arr.length;
    while (i--) {
        if (a[i] === val) return true;
    }
    return false;
}








function ItemInfo() {

    this.Selection = 0;
    this.ButtonsReady   = 0;
    this.Info   = false;
    this.Labels = false;
    this.CachedMetadb = undefined;
    this.Extension = '';

    this.Eval = function( meta, field ) {

        path = meta ? meta.Path : '';
        return path.indexOf('://') > 0 ?  fb.TitleFormat( field ).Eval( true ) : fb.TitleFormat( field ).EvalWithMetadb( meta );

    }

    this.OutputMetadb = function( force ) {
        force = force ? force : false;

        if ( force ) {
            if ( mode == 2 ) return fb.GetFocusItem(true);
            else return ( fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem() );
        }
        else {
            //if ( mode == 2 ) return (( fb.GetSelections().Count > 1 && fb.GetSelectionType() ) ? fb.GetSelections() : fb.GetFocusItem(true) );
            //else return ( fb.IsPlaying ? ( ( fb.GetSelections().Count > 1 && fb.GetSelectionType() ) ? fb.GetSelections() : fb.GetNowPlaying() ) : ( fb.GetFocusItem() && fb.GetSelectionType() && fb.GetSelections().Count > 1 ? fb.GetSelections() : (fb.GetFocusItem() ? fb.GetFocusItem() : false) ));
            if ( mode == 2 ) return (( fb.GetSelections().Count > 1 ) ? fb.GetSelections() : fb.GetFocusItem(true) );
            else return ( fb.IsPlaying ? ( ( fb.GetSelections().Count > 1 ) ? fb.GetSelections() : fb.GetNowPlaying() ) : ( fb.GetSelections().Count > 1 ? fb.GetSelections() : (fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false) ));

        }
    }

    this.GetInfo = function( metadb ) {

        //fb.trace('GetInfo called');
        if ( metadb ) {

            labels = [];
            general = [];

            if ( metadb.Count != null && metadb.Count > 0 ) {

                

                //d = new Date();
                //t = d.getTime();

                // Constant values
                //var first_played  = '(multiple values)';
                //var last_played   = '(multiple values)';
                //var last_modified = '(multiple values)';

                this.Extension  = [];
                var count = metadb.Count;

                if ( count > 100 ) {
                    var rating    = false;
                    var playcount = false;
                }
                else {
                    var rating    = 0;
                    var playcount = new Number();
                }

                var duration = 0;
                var filesize = 0;
                var bitrate = 0;

                var date_max    = 0;
                var date_min    = 10000;
                var filename    = '';
                var path        = false;

                var artist  = [];
                var album   = [];
                var codec   = [];
                var genre   = [];
                var style   = [];

                var cue_embedded = [];
                var tagtype      = [];
                var extensions   = [];

                //this.Extension  = new Array('fpl', 'fpl');
                var title        = count + ' titles';

                    
                function iterate( item ) {

                        var info = item.GetFileInfo();

                        var artist_current = info.MetaValue( info.MetaFind('artist'), 0);
                        if ( artist_current ) artist.push( artist_current );

                        var album_current = info.MetaValue( info.MetaFind('album'), 0);
                        if ( album_current ) album.push( album_current );


                        var codec_current = info.InfoValue( info.InfoFind('codec') );
                        if ( codec_current ) codec.push( codec_current );

                        var style_current = fb.Titleformat("[%style%]").EvalWithMetadb(item);
                        if ( style_current ) style.push( style_current );

                        var genre_current = fb.Titleformat("[%genre%]").EvalWithMetadb(item);
                        if ( genre_current ) genre.push( genre_current );

                        var date_current = parseInt( info.MetaValue( info.MetaFind('date'), 0) );
                        if ( date_current && date_current > date_max ) date_max = date_current;
                        if ( date_current && date_current < date_min ) date_min = date_current;


                        var tagtype_current = fb.Titleformat("[%__tagtype%]").EvalWithMetadb(item);
                        tagtype_current = tagtype_current.toUpperCase();
                        tagtype_current = tagtype_current.replace(/\|/g,',');
                        if ( tagtype_current )  tagtype.push( tagtype_current );

                        var cue_current = info.InfoValue( info.InfoFind('cue_embedded') );
                        if ( cue_current )  cue_embedded.push( cue_current );

                        var bit_cur  = info.InfoValue( info.InfoFind('bitrate' ) );
                        bitrate     += bit_cur ? parseInt( bit_cur ) : 0;

                        if ( rating !== false  ) rating  += parseInt( fb.TitleFormat("$if3(%rating%,%rating_sql%,0)").EvalWithMetadb( item ) );
                        
                        if ( playcount  ) playcount      += parseInt( fb.TitleFormat("$if3($meta(play_count),%play_count%,%play_count_sql%,0)").EvalWithMetadb( item ) );

                        var dur_cur  = item.Length;
                        duration    += parseInt( dur_cur );
                        filesize    += bit_cur / 8 * 1024 * dur_cur;

                        extensions.push( item.RawPath.replace(/.*\.(\w+)$/,"$1") );

                    }


                    function duff(iterations) {
                      var i = iterations % 8;
                      var n = 0;
                      if( i>0 ) {
                        do {
                           var item = metadb.Item( n++ );
                           iterate(item);
                        }
                        while(--i);
                      }
                      i = parseInt( iterations / 8 );
                      if( i>0 ) {
                        do {

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                           var item = metadb.Item( n++ );
                           iterate(item);

                        }
                        while(--i);
                      }
                    }


                    duff( metadb.Count );

                    if ( duration > 86400 ) {
                        x = duration;
                        seconds = parseInt( x % 60 );
                        x /= 60;
                        minutes = parseInt( x % 60 );
                        x /= 60;
                        hours = parseInt( x % 24 );
                        x /= 24;
                        days = parseInt( x );


                        seconds += seconds > 1 ? ' seconds ' : ' second ';
                        minutes += minutes > 1 ? ' minutes ' : ' minute ';
                        hours   += hours   > 1 ? ' hours '   : ' hour ';
                        days    += days    > 1 ? ' days '    : ' day ';
                        duration = days + hours + minutes + seconds;
                    }
                    else {
                        duration = TimeFmt(duration);
                    }
                    //fb.trace(rating);
                    if ( rating )    rating      = rating / metadb.Count;
                    if ( playcount ) playcount   = Math.round(playcount / metadb.Count);
                    bitrate     = Math.round(bitrate / metadb.Count);

                    //fb.trace( 'playcount==' + playcount );
                    if ( filesize >= 1073741824 ) filesize = Math.round(filesize / 1073741824 * 100)/100 + "GB";
                    else if ( filesize >= 1048576 ) filesize = Math.round(filesize / 1048576 * 100)/100 + "MB";
                    else if ( filesize >= 1024 ) filesize = Math.round(filesize / 1024 * 100)/100 + "KB";
                    else filesize += 'B';

                    artist = unique(artist);
                    if ( artist.length > 2 ) artist = artist.length + ' artists';
                    else {
                        artist = artist.join(", ");
                    }

                    album = unique(album);
                    if ( album.length > 2 ) album = album.length + ' albums';
                    else {
                        album = album.join(", ");
                    }

                    codec = unique(codec);
                    if ( codec.length > 2 )  codec  = codec.length +  ' codecs';
                    else {
                        codec  = codec.join(", ");
                    }
                    codec = '? ' + bitrate + ' kbps, ' + codec;

                    if ( genre.length > 1 ) {
                        genre      = genre.join(',');
                        genre      = genre.replace(/\&\//g,',');
                        genre      = genre.split(',');
                        genre      = unique(genre);
                    }

                    if ( style.length > 1) {
                        style      = style.join(',');
                        style      = style.split(',');
                        style      = unique(style);
                    }

                    if ( style.length > 2 )  style  = style.length + ' styles';
                    else {
                        style.sort();
                        style  = style.join(", ");
                    }

                    if ( genre.length > 2 )  genre  = genre.length + ' genres';
                    else {
                        genre.sort();
                        genre  = genre.join(", ");
                    }
                    if ( style && genre ) genre += ' / ' + style;

                    var date         = date_min != date_max ? (date_min != 10000 ? (date_min + '…') : '') + (date_max ? date_max : '') : date_max;


                    tagtype      = tagtype.join(',');
                    tagtype      = tagtype.split(',');
                    tagtype      = unique(tagtype);
                    tagtype.sort();
                    tagtype      = tagtype.join(', ');

                    cue_embedded    = unique(cue_embedded);
                    cue_embedded    = cue_embedded.length > 1 ? 'Yes, partly' : cue_embedded[0];

                    filename = 'Selection (' + metadb.Count + ' items)';

                    this.Extension = unique(extensions);



                if ( filename ) { general.push(filename); labels.push("Filename");}

                if ( codec )    { general.push(codec); labels.push("Codec");}

                if ( artist )   { general.push(artist); labels.push("Artist");}

                if ( album )    { general.push(album); labels.push("Album");}

                if ( title )    { general.push(title); labels.push("Title");}

                if ( date )     { general.push(date); labels.push("Date");}

                if ( genre )            { general.push(genre); labels.push("Genre");}

                
                if ( typeof rating == 'number' ) { general.push(rating); labels.push("Rating"); }

                if ( playcount ) {
                    playcount = ( playcount > 1 ? '? ' + playcount + ' times played each' : playcount > 0 ? 'Each once played' : 'Never played');
                    general.push(playcount);
                    labels.push("Played");
                }

                if ( filesize )         { general.push(filesize ); labels.push("File size");}

                if ( duration )         { general.push(duration); labels.push("Duration");}

                if ( cue_embedded )     { general.push(cue_embedded ); labels.push("Cuesheet");}

                if ( tagtype )          { general.push(tagtype); labels.push("Tag Type");}

                this.Info = general.join("|||");
                this.Labels = labels.join("\n");

                //fb.trace(rating);
                //d = new Date();
            &nbs

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2940
Marc, where in your thumbs script to edit ''library mode'' , when i listen radio stream, i want in that mode, that script continue to download image, but in different folder inside ''wsh_lastfm'' in ''@temp'' folder.  Example: ''wsh_lastfm\\@temp''.

Because, when i listen radio, i don't have images in that mode at all(is empty), i want to have images displayed when listen radio, but also to be able to delete that ''@temp'' folder easily when not listen radio.
Thanks..

WSH Panel Mod script discussion/help
Reply #2941
Hi!
is there a way to build a button that change the setting of the Selection viewers status?


i need it because of this:
http://www.hydrogenaudio.org/forums/index....mp;#entry859479


thank u



  • SilentQ
  • [*]
WSH Panel Mod script discussion/help
Reply #2942
Install WSH Panel Mod.
Grab a copy of marc2003's sample scripts.

(You can find both of these from various links in this thread.)

Set up a tabbed control with two tabs.
Install a WSH panel mod control with marc2003's "item details.txt" in both of them.
In one of the tabs: Right click > Selection Mode> Prefer Now Playing
In the other tab: Right click > Selection Mode > Follow Selected Track
  • Last Edit: 28 February, 2014, 01:00:59 PM by SilentQ

WSH Panel Mod script discussion/help
Reply #2943
Great! Thank U

  • lillibot
  • [*]
WSH Panel Mod script discussion/help
Reply #2944
I've been at work on a script and I've gathered that click events seem to be throttled.

Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }

var n = 0;
font = gdi.Font("Calibri", 10, 0);

function on_paint(gr) {
    gr.DrawString(n, font, RGB(255, 0, 0), 0, 0, 16, 16);
}

function on_mouse_lbtn_down(x, y) {
    n += 1;
    window.Repaint();
}


Basically, n doesn't increment as fast as I click. Others' scripts I use don't have the same limitation. What have I done?

WSH Panel Mod script discussion/help
Reply #2945
add

Code: [Select]
function on_mouse_lbtn_dblclk(x, y){
   on_mouse_lbtn_down(x, y);
}

  • lillibot
  • [*]
WSH Panel Mod script discussion/help
Reply #2946
^ Dang. Thanks!

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2947
I'm tryin to make simply script that open another youtube(recommended) video in foobar playlist after first is finished, but i have problem.
In url i recieve: ''about:/watch?v=26PAgklYYvo ''


How to delete that ''about:/'' and leave only: ''watch?v=26PAgklYYvo'' ?

This is script:

Code: [Select]
    if (!this.xmlhttp) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        this.xmlhttp.open("GET", "http://www.youtube.com/watch?v=I7HahVwYpwo" + encodeURIComponent(p.artist) + "/+images", 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 = 33; i < data.length; i++)
                    {
                        if (data[i].href.indexOf("/watch?v=") == 0) urls.push(data[i].href.replace("", ""));
                    }
                    
                    for (i = 33; i < Math.min(urls.length, 50, 50); i++)
                    {
                    }
//check path                    
p.console("HTTP: " + data[i]);

//open YT clip in playlist
var tmppath = p.fso.GetFolder(fb.FoobarPath).ShortPath;
p.run(tmppath+"\\foobar2000.exe /immediate /add "+"\""+"http://www.youtube.com"+ data[i] + "\"");
  • Last Edit: 12 March, 2014, 08:51:25 AM by mire777

  • WilB
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2948
You can do it with regex, for example:
Code: [Select]
var url = "about:/watch?v=26PAgklYYvo"
url = url.replace(/about:\//,"")
fb.trace(url)
  • Last Edit: 12 March, 2014, 09:19:01 AM by WilB

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2949
Quote
this.xmlhttp.open("GET", "http://www.youtube.com/watch?v=I7HahVwYpwo" + encodeURIComponent(p.artist) + "/+images", true);


that part in bold is left behind from the last.fm script and should be removed.