IPB

Welcome Guest ( Log In | Register )

125 Pages V  « < 116 117 118 119 120 > »   
Reply to this topicStart new topic
WSH Panel Mod script discussion/help.
Bratman
post Feb 15 2014, 23:41
Post #2926





Group: Members
Posts: 94
Joined: 30-June 12
From: England
Member No.: 101088



QUOTE (marc2003 @ Feb 14 2014, 05:58) *
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
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)


This post has been edited by Bratman: Feb 15 2014, 23:41
Go to the top of the page
+Quote Post
marc2003
post Feb 16 2014, 00:25
Post #2927





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



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
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



This post has been edited by marc2003: Feb 16 2014, 00:37
Go to the top of the page
+Quote Post
Bratman
post Feb 16 2014, 02:01
Post #2928





Group: Members
Posts: 94
Joined: 30-June 12
From: England
Member No.: 101088



Still not working sad.gif 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?

This post has been edited by Bratman: Feb 16 2014, 02:26
Go to the top of the page
+Quote Post
marc2003
post Feb 16 2014, 02:18
Post #2929





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



i can't help when you post such a vague reply. let's try again.... rolleyes.gif

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?
Go to the top of the page
+Quote Post
Bratman
post Feb 16 2014, 02:30
Post #2930





Group: Members
Posts: 94
Joined: 30-June 12
From: England
Member No.: 101088



QUOTE (marc2003 @ Feb 16 2014, 02:18) *
i can't help when you post such a vague reply. let's try again.... rolleyes.gif

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
Go to the top of the page
+Quote Post
marc2003
post Feb 16 2014, 02:51
Post #2931





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



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
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"
Go to the top of the page
+Quote Post
penfold1992
post Feb 16 2014, 22:45
Post #2932





Group: Members
Posts: 33
Joined: 19-May 13
Member No.: 108203



QUOTE (marc2003 @ Feb 16 2014, 01:51) *
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?
Go to the top of the page
+Quote Post
marc2003
post Feb 17 2014, 00:02
Post #2933





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



try again now.
Go to the top of the page
+Quote Post
penfold1992
post Feb 17 2014, 00:22
Post #2934





Group: Members
Posts: 33
Joined: 19-May 13
Member No.: 108203



CODE
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
Go to the top of the page
+Quote Post
marc2003
post Feb 17 2014, 00:41
Post #2935





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



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

Go to the top of the page
+Quote Post
penfold1992
post Feb 17 2014, 01:24
Post #2936





Group: Members
Posts: 33
Joined: 19-May 13
Member No.: 108203



QUOTE (marc2003 @ Feb 16 2014, 23:41) *
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.
Go to the top of the page
+Quote Post
marc2003
post Feb 17 2014, 01:41
Post #2937





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



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.
Go to the top of the page
+Quote Post
penfold1992
post Feb 17 2014, 02:45
Post #2938





Group: Members
Posts: 33
Joined: 19-May 13
Member No.: 108203



QUOTE (marc2003 @ Feb 17 2014, 00:41) *
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.
Go to the top of the page
+Quote Post
marc2003
post Feb 17 2014, 03:22
Post #2939





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



^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.

This post has been edited by marc2003: Feb 17 2014, 03:22
Go to the top of the page
+Quote Post
room302
post Feb 25 2014, 10:00
Post #2940





Group: Members
Posts: 11
Joined: 25-October 12
Member No.: 104075



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();
                //t2 = d.getTime();
                //fb.trace( (t2 - t) + ' ms');

            }
            else {
                //d = new Date();
                //t = d.getTime();
                //fb.trace('this.GetInfo else called');
                this.Extension  = '';

                this.Extension  = fb.Titleformat("$ext(%filename_ext%)").EvalWithMetadb(metadb);
                var filename    = fb.Titleformat("$if3(%url%,%filename_ext%,)").EvalWithMetadb(metadb);
                var artist      = this.Eval(metadb, '[%album artist%][ / %track artist%]');
                var codec       = fb.Titleformat("[$codec()][', '%codec_profile%][', '$info(bitrate) kbps][', '%samplerate% Hz][ '('$info(tool2)')']").EvalWithMetadb(metadb);

                var album       = fb.Titleformat("[%album%]").EvalWithMetadb(metadb);
                var title       = this.Eval(metadb, '$meta(title)');
                var date        = fb.Titleformat("[%date%]").EvalWithMetadb(metadb);
                if (fb.PlaybackLength != -1) {
                    var rating      = fb.Titleformat("$if3(%rating%,%rating_sql%,0)").EvalWithMetadb(metadb);
                    var play_count  = fb.Titleformat("$if3(%play_count%,%play_count_sql%,)").EvalWithMetadb(metadb);
                    var last_modified   = fb.Titleformat("[%last_modified%]").EvalWithMetadb(metadb);
                    var last_played     = fb.Titleformat("$if3(%last_played%,%last_played_sql%,)").EvalWithMetadb(metadb);
                    var path            = fb.Titleformat("$replace(%path%,%filename_ext%,)").EvalWithMetadb(metadb);
                    var cue_embedded    = fb.Titleformat("$if2($caps(%__cue_embedded%),No)").EvalWithMetadb(metadb);
                }
                var genre       = fb.Titleformat("[%genre%]").EvalWithMetadb(metadb);
                var style       = fb.Titleformat("[%style%]").EvalWithMetadb(metadb);
                if ( genre && style ) genre += ' / ' + style;

                var filesize        = fb.Titleformat("$if($strcmp($info(cue_embedded),yes),$div($mul($div($info(bitrate),8),%length_seconds%),1024) MB / )[%filesize_natural%]").EvalWithMetadb(metadb);
                //var duration        = fb.Titleformat("[%length%]").EvalWithMetadb(metadb);

                var first_played    = fb.Titleformat("$if3(%first_played%,%first_played_sql%,)").EvalWithMetadb(metadb);
                var tagtype         = fb.Titleformat("[$replace($upper(%__tagtype%),V,v,|,', ')]").EvalWithMetadb(metadb);



                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 (fb.PlaybackLength != -1) { general.push(rating); labels.push("Rating"); }
                
                if (fb.PlaybackLength == -1) { general.push(fb.Titleformat("%title%").EvalWithMetadb(metadb)); labels.push("Radio"); }

                if ( play_count ) {
                    play_count = ( play_count > 1 ? play_count + ' times played' : play_count > 0 ? 'Once played' : 'Never played');
                    general.push(play_count);
                    labels.push("Played");
                }

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

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

                if ( last_played )      { general.push(last_played); labels.push("Last played");}

                if ( first_played != first_played )
                                        { general.push(first_played); labels.push("First played");}

                if ( last_modified )    { general.push(last_modified); labels.push("Last Modified");}

                if ( path )             { general.push(path); labels.push("Path");}

                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");
                //d = new Date();
                //t2 = d.getTime();
                //fb.trace( (t2 - t) + ' ms');
            }

            window.Repaint();

        }
        else { this.Info = false; this.Labels = false; window.Repaint(); }

    }

    this.Update = function( metadb ) {

        metadb = metadb ? metadb : this.OutputMetadb();

        if ( metadb ) {

            try {       var a = this.CachedMetadb.Path ? this.CachedMetadb.Path : ' '; }
            catch(e) {  var a = ' '; }

            try {       var b = metadb.Path ? metadb.Path : ' '; }
            catch(e) {  var b = ' '; }

            try {       if ( metadb.Count ) var c = true; }
            catch(e) {  var c = false; }

            //fb.trace( typeof a + typeof b + typeof c);
            //fb.trace(  a + '/' + b + '/' + c);

            if ( a.replace(/(.*)\\(.*)\.(.*)$/,'$1') != b.replace(/(.*)\\(.*)\.(.*)$/,'$1') && !c ) {
                utils.GetAlbumArtAsync(window.ID, metadb, 0, false);
                this.Cover      = false;
            }
            else if ( c ) this.Cover = false;

            this.CachedMetadb   = metadb;
            this.Info           = false;
            this.Labels         = false;

            this.SelectionString = fb.GetSelectionType() + ' ' + fb.GetSelections().Count;
            this.Selection       = fb.GetSelections().Count;

            //fb.trace('Update = ' + this.Selection);

            this.ButtonsReady   = 0;
            ClearButtonCoords();

            this.GetInfo( metadb );
        }
        else {
            this.Info           = false;
            this.Labels         = false;
            this.CachedMetadb   = false;
            window.Repaint();
        }
    }

    this.Update();
}


ItemInfo = new ItemInfo();


function on_paint(gr) {

    //var start = new Date().getMilliseconds();
    //fb.trace( 'on_paint()' );

    var ww = window.Width;
    var wh = window.Height;

    gr.SetTextRenderingHint(7);
    gr.SetSmoothingMode(4);
    gr.SetInterpolationMode(7);

    //gr.FillSolidRect(0,0, ww, wh,RGB(240,245,250));
    //gr.FillGradRect(0,-2, ww, 5, 90, RGB(240,245,250), RGB(205,220,235), 0.1);
    gr.DrawRect( 0, 0, ww, 1, 1, RGB(218,219,220) );

    if ( ItemInfo.Info ) {

        var Infos = ItemInfo.Info.split("|||");
        var Labels = ItemInfo.Labels.split("\n");

        // PLAYED TRICK
        var idx = indexOf('Played', Labels);
        if(idx!=-1) {
            var played = Infos[idx];
            Labels.splice(idx, 1);
            Infos.splice(idx, 1);
        }
        else var played = false;


        var c = 1;
        var s = 1;
        var max_label = 0;
        var current_label = 0;
        var label_widths = [];

        if ( valign == 1 ) string_height = wh / string_number;

        Labels.splice(max_elements,Labels.length-max_elements)
        column_number = Math.ceil( Labels.length / string_number );
        var column_width = ( ww - wh ) / column_number;

        var a = 0, b = Labels.length;
        //for ( a = 0; a < Labels.length; a++ ) {
        while ( a<b ) {

            var t = a % string_number;

            if ( !t ) {
                label_widths.push( max_label + 2 );
                max_label = 0;
            }

            current_label = Math.round( gr.MeasureString(Labels[a] + ':', font, 0, 0, ww, 0).Width );
            max_label = current_label > max_label ? current_label : max_label;

            if ( a + 1 == Labels.length ) {
                label_widths.push( max_label + 2 );
                max_label = 0;
            }

            a++;
            //fb.trace( Labels[a] + ' / current_label = ' + current_label + ' / max_label = ' + max_label + ' / column_number = ' + column_number );
        }

        label_widths.splice(0, 1);

        c = 1;
        s = 1;

        try {
            if ( ItemInfo.CachedMetadb.Count > 1 ) gr.GdiDrawText( ItemInfo.CachedMetadb.Count, font_big, RGB( 205,220,235), 0, -5, ww-10,wh, DT_RIGHT | DT_VCENTER | DT_CALCRECT);
        } catch(e) {}

        //label_widths.reverse();

        //var a = Labels.length;
        for ( a = 0; a < Labels.length; a++ ) {
        //while ( a-- ) {

            if ( s > string_number && (s % string_number == 1 ) ) { c++; s = 1; }

            // LABEL
            var current_label_width = (Labels[a] == 'Filename' || Labels[a] == 'Codec' ) ? 0 : label_widths[c-1];

            if ( ItemInfo.ButtonsReady == 0 ) {

                var n = Buttons.length;
                while ( n-- ) {

                    if (  Buttons[n].name == Labels[a] ) {
                        Buttons[n].x = (wh ) + ( (c - 1) * column_width);
                        Buttons[n].y = (wh - string_number * string_height)/2 + (s - 1) * string_height;
                        Buttons[n].w = column_width;
                        Buttons[n].h = string_height;

                        Buttons[n].left = Buttons[n].x;
                        Buttons[n].top = Buttons[n].y;
                        Buttons[n].right = Buttons[n].x + column_width;
                        Buttons[n].bottom = Buttons[n].y + string_height;
                        Buttons[n].label_size = current_label_width;
                    } else continue;
                }                
            }
            
            // RECT
            if ( rects ) gr.FillRoundRect( wh + ( (c - 1) * column_width), 1 + (wh - string_number * string_height)/2 + (s - 1) * string_height, column_width - 2, string_height - 2, 4, 4, (s % 2 == 0) ? RGBA(225,235,245,100) : RGBA(200,225,235,100));

            // LABELS
            gr.GdiDrawText( (Labels[a] == 'Filename' || Labels[a] == 'Codec' ) ? '' : Labels[a] + ':', font, RGB( 120,120,120), wh + ( (c - 1) * column_width), ( wh - string_number * string_height)/2 + (s - 1) * string_height, current_label_width, string_height, DT_RIGHT | DT_VCENTER | DT_CALCRECT);

            // RATING
            if ( Labels[a] == 'Rating' ) {

                var rating_rounded = Math.ceil( Infos[a] );
                var rating_rest = 1;

                try {
                    var star_w = checked_star.Width;
                    var star_h = checked_star.Height > string_height ? string_height : checked_star.Width;
                }
                catch (e) { }

                var rating_rest = Number(Infos[a]).toPrecision(3);

                rating_rest = "0." + parseInt( rating_rest.replace(/(\d+)\.(\d+)/i,"$2") );
                var star_wr = 0;

                if ( !rating_view ) limit = rating_rounded;
                else limit = rating_view;

                //fb.trace( 'rating_rest = ' + rating_rest );
                //limit = rating_view > rating_rounded ? rating_view : rating_rounded;

                var nc = limit - 1 > -1 ? (rating_view ? limit : limit - 1) : 0;

                for ( n = nc; n < 5; n++ ) {
                    if ( empty_star ) gr.DrawImage(  n == nc && !rating_view && rating_rest != 0 ? checked_star : empty_star, wh + 5 + current_label_width + ( (c - 1) * column_width) + n*star_w, (wh - string_number * string_height)/2 + (s - 1) * string_height + (string_height - star_h)/2, star_w, star_h, 0, 0, star_w, star_h, 0, n == nc && !rating_view && rating_rest != 0 ? 100 : 255); // i > rating_view
                }

                //fb.trace('limit = ' + limit);
                for ( i = 0; i < limit; i++ ) {

                    if ( !rating_view && i == Math.floor(Infos[a]) ) star_wr = rating_rest * star_w;
                    else star_wr = false;

                    if ( checked_star ) gr.DrawImage(checked_star, wh + 5 + current_label_width + ( (c - 1) * column_width) + i*star_w, (wh - string_number * string_height)/2 + (s - 1) * string_height + (string_height - star_h)/2, star_wr ? star_wr : star_w, star_h, 0, 0, star_wr ? star_wr : star_w, star_h, 0, 255);

                }
                if ( played ) {
                    gr.GdiDrawText( played, font, RGB( 90, 103, 121), wh + 5 + current_label_width + ((c - 1) * column_width) + star_w  * 5 + 10, (wh - string_number * string_height)/2 + (s - 1) * string_height, column_width - ( current_label_width + star_w*5 + 15 ), string_height, DT_LEFT | DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT);
                }

            }
            else {

                if ( btn != null ) {
                    if ( btn.name == Labels[a] && btn.func ) var font_this = (Labels[a] == 'Filename') ? font_p1_under : font_under;
                    else var font_this = (Labels[a] == 'Filename') ? font_p1 : font;
                }
                else { var font_this = (Labels[a] == 'Filename') ? font_p1 : font; }

                var color = (Labels[a] == 'Codec') ? RGB( 120,120,120) : (Labels[a] == 'Filename') ? RGB( 0, 0, 0) : RGB( 60, 60, 60);
                gr.GdiDrawText( Infos[a], font_this, color, wh + 5 + ( Labels[a] ? current_label_width : 0 ) + ((c - 1) * column_width), (wh - string_number * string_height)/2 + (s - 1) * string_height, ( ww - wh  ) / column_number - ( Labels[a] ? current_label_width + 5 : 5 ), string_height, DT_NOPREFIX | DT_LEFT | DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT);

            }

            s++;
            if ( a == max_elements - 1 ) break;

        }

        // BUTTONS FORMED
        ItemInfo.ButtonsReady = 1;


        // COVER
        if ( ItemInfo.Cover && show_cover_instead ) {

            var img = ItemInfo.Cover;
            var iw  = ItemInfo.Cover.Width;
            var ih  = ItemInfo.Cover.Height;

            var x = (iw < ih) ? ((iw < wh - 10) ? ((wh - iw)/2) : 5 ) : ((iw >= wh - 10) ? 5 : ((wh - iw)/2));
            var y = (iw > ih) ? ((ih < wh - 10) ? ((wh - ih)/2) : 5 ) : ((ih >= wh - 10) ? 5 : ((wh - ih)/2));

            gr.DrawImage(img, x, y + 1, iw, ih, 0, 0, img.Width, img.Height, 0, 255);
            gr.DrawRect( x, y + 1, iw, ih, 1, RGB(200,200,200));

        }
        else if ( ItemInfo.Extension != undefined ) {

            if ( isArray( ItemInfo.Extension ) ) {

                ItemInfo.Extension.sort();
                var arr = ItemInfo.Extension;
                var idx = indexOf('cue', arr);
                if(idx!=-1) {
                    arr.splice(idx, 1);
                    arr.unshift('cue');
                }
                ItemInfo.Extension = arr;

                if ( ItemInfo.Extension.length == 1 ) {
                    var max = Math.min(fb.GetSelections().Count,10);
                    while ( max-- ) {
                        ItemInfo.Extension.push(ItemInfo.Extension[0]);
                    }
                }

                f = ItemInfo.Extension.length;
                while ( f-- ) {

                var ext = ItemInfo.Extension[f];
                    ext = ext.toLowerCase();

                        try {
                            var icon = ( fso.FileExists( fb.FoobarPath + '\\s7e_files\\formats\\' + ext + '.png' ) ) ? gdi.Image( fb.FoobarPath + '\\s7e_files\\formats\\' + ext + '.png' ) : gdi.Image( fb.FoobarPath + '\\s7e_files\\formats\\generic.png' );
                            var ih = icon.Height > wh ? ( wh - 3 - ItemInfo.Extension.length/2 ) : icon.Height;
                            var iw = icon.Width / ( icon.Height / ( wh - 3 - ItemInfo.Extension.length/2 ) );
                            icon = icon.Resize(iw,ih);
                        } catch(e) { var icon = false; }
                        

                        if ( icon ) gr.DrawImage(icon, 3 + ItemInfo.Extension.length/2 - f, (wh - ih ) / 2 + ItemInfo.Extension.length/2 - f, iw, ih, 0, 0, iw, ih, 0, 255);

                }

            }
            else {

            var ext = ItemInfo.Extension;
                ext = ext.toLowerCase();

                    try {
                        var icon = ( fso.FileExists( fb.FoobarPath + '\\s7e_files\\formats\\' + ext + '.png' ) ) ? gdi.Image( fb.FoobarPath + '\\s7e_files\\formats\\' + ext + '.png' ) : gdi.Image( fb.FoobarPath + '\\s7e_files\\formats\\generic.png' );
                        var ih = icon.Height > wh ? wh - 4 : icon.Height;
                        var iw = icon.Width / ( icon.Width / (wh - 4) );
                        var icon_r = icon.Resize(iw,ih);
                    } catch(e) { var icon = false; }
    
                    if ( icon ) gr.DrawImage(icon_r, 3, 2, iw, ih, 0, 0, iw, ih, 0, 255);

            }
            

        }
        else {

            if ( folder ) gr.DrawImage(folder, 3, 2, folder.Width / ( folder.Height / (wh - 6) ), wh - 6, 0, 0, folder.Width, folder.Height, 0, 255);

        }


    }
    else {

        if ( fb.PlaylistItemCount(fb.ActivePlaylist) == 0 ) {
    
            if ( folder ) gr.DrawImage(folder, 3, 2, folder.Width / ( folder.Height / (wh - 4) ), wh - 4, 0, 0, folder.Width, folder.Height, 0, 255);
            gr.GdiDrawText( 'Empty playlist', font_p1, RGB( 30, 57, 91), folder ? ((wh ) + 5) : 5, 5, ww - (wh ) - 5, wh, DT_LEFT | DT_TOP | DT_CALCRECT);

        }
        //else { ItemInfo.Update(); }

    }

    //var end = new Date().getMilliseconds();
    //fb.trace('onpaint = ' + ( end - start ) + ' ms' );

}

    function on_get_album_art_done( metadb, art_id, image, image_path) {

        var wh = window.Height;
        var ww = window.Width;

        if ( image ) {
            var img = image.Clone(0,0,image.Width,image.Height);

            if ( img.Width > wh - 10 || img.Height > wh - 10 ) {

                if ( img.Width / img.Height > (wh - 10) / (wh - 10) ) {

                    var iw = wh - 10;
                    var ih = img.Height / ( img.Width / (wh - 10) );
                    var img = img.Resize( iw, ih);
                }
                else {

                    var ih = wh - 10;
                    var iw = img.Width / ( img.Height / (wh - 10) );
                    var img = img.Resize( iw, ih);
                }
            }


            ItemInfo.Cover = img;
            window.Repaint();
        }

    }





function trackbuttons(x,y){

    var i = Buttons.length;
    while ( i-- ) {

        if ( Buttons[i].traceMouse(x, y) ) {

            var temp = Buttons[i];
            break;
        }
        else {
            var temp = false;
        }

    }

    if ( temp && ( btn != temp || temp.update == 1 ) ) {

        ClearButtonsVars();

        btn     = temp;
        btn.onHover(x,y);

        window.Repaint();

    }
    else if (!temp) {

        btn = false;
        ClearButtonsVars();
        window.Repaint();

    }
    return btn;
}



function on_mouse_move(x, y) {

    g_move = 1;
    hover_button = trackbuttons(x, y);

}

function on_mouse_lbtn_down(x,y){

    g_button_down = null;
    if (hover_button) {
        
        hover_button.onClick(x, y);
    }
    window.Repaint();

}

function on_metadb_changed(metadb) {

    ItemInfo.Update();
}

function on_size() {

    calculate_dims();
    
}

function on_playback_new_track(metadb) {

    var selection_metadb = metadb;
    var selection_temp = selection_metadb.RawPath != undefined ? selection_metadb.RawPath + '' + selection_metadb.SubSong : 'undefinedundefined';
    var cached_temp = ItemInfo.CachedMetadb ? (ItemInfo.CachedMetadb.RawPath + '' + ItemInfo.CachedMetadb.SubSong) : 'undefinedundefined';

    if ( selection_temp != cached_temp ) ItemInfo.Update( metadb );

}

function on_playback_dynamic_info_track() {

    ItemInfo.Update();

}

function on_playback_stop( Reason ) {

    if ( Reason == 0 ) on_item_focus_change();

}

function on_item_focus_change() {

    //fb.trace( 'on_item_focus: seltype = ' + fb.GetSelectionType() + ' count = ' + fb.GetSelections().Count + ' ??? = ' + ((!fb.IsPlaying || mode == 2)) );

    if ( (!fb.IsPlaying || mode == 2) && fb.GetSelections().Count < 2  ) {

        //fb.trace( 'on_item_focus_change()' );
        ItemInfo.Update();

    }

}


function on_selection_changed(metadb) {

    var selection_metadb = ItemInfo.OutputMetadb();
    var selection_temp = selection_metadb ? selection_metadb.RawPath + '' + selection_metadb.SubSong : 'undefinedundefined';

    var cached_temp = ItemInfo.CachedMetadb ? (ItemInfo.CachedMetadb.RawPath + '' + ItemInfo.CachedMetadb.SubSong) : 'undefinedundefined';

    var selection_string_temp = fb.GetSelectionType() + ' ' + fb.GetSelections().Count;
    var sel = fb.GetSelectionType();

    //fb.trace( '\nnull: selection_string_temp = ' + selection_string_temp + '   /   ItemInfo.SelectionString = ' + ItemInfo.SelectionString );
    //fb.trace( 'null: selection_temp = ' + selection_temp + '   /   cached_temp = ' + cached_temp );
    //fb.trace( ItemInfo.SelectionString != selection_string_temp );
    //fb.trace( selection_temp != cached_temp );
    //fb.trace( ( (sel == 0 && fb.GetSelections().Count >= 2 ) || ( ( sel == 1 || sel == 4 ) && fb.GetSelections().Count >= 1 ) ) );
    //fb.trace( '1  ' + ( ( sel == 0 && fb.GetSelections().Count >= 2 ) || ( sel == 0 && ItemInfo.Selection > 1 ) ) );
    //fb.trace( '2  ' + ( ( sel == 1 || sel == 4 ) && fb.GetSelections().Count >= 1 ) );

    //fb.trace( 'on_selection_changed: seltype = ' + fb.GetSelectionType() + ' count = ' + fb.GetSelections().Count );

    //if ( ( ( ( sel == 0 && fb.GetSelections().Count >= 2 ) || ( sel == 0 && ItemInfo.Selection > 1 ) ) || ( ( sel == 1 || sel == 4 ) && fb.GetSelections().Count >= 1 ) ) && ( ItemInfo.SelectionString != selection_string_temp || selection_temp != cached_temp ) ) {
    if ( ( ( ( sel == 0 && fb.GetSelections().Count >= 2 ) || ( sel == 0 && ItemInfo.Selection > 1 ) ) || ( ( sel == 1 ) && fb.GetSelections().Count >= 1 ) ) && ( ItemInfo.SelectionString != selection_string_temp || selection_temp ^ cached_temp ) ) {

        //fb.trace( 'if: seltype = ' + fb.GetSelectionType() + ' / count = ' + fb.GetSelections().Count + '   / ItemInfo.Selection = ' + ItemInfo.Selection );
        ItemInfo.Update();

    }
    //else if ( fb.GetSelectionType() == 0 ) ItemInfo.Selection = 0;

}

//function on_playback_edited() { ItemInfo.Update(); }

function on_playlist_switch() {

    if ( !fb.IsPlaying || mode == 2 ) {
        ItemInfo.Update();
    }

}



function on_playlist_items_added(playlist) {

    if ( (!fb.IsPlaying || mode == 2) && ItemInfo.Selection != fb.GetSelections().Count ) {
        ItemInfo.Update();
    }

}


function on_playlist_items_removed(playlist, new_count) {

    if ( (!fb.IsPlaying || mode == 2) ||  ItemInfo.Selection != fb.GetSelections().Count ) {
        ItemInfo.Update();
    }

}



function on_mouse_leave() {
    g_hover = false;
    ClearButtonsVars();
    btn = null;
    window.SetCursor( 32512 );
    window.Repaint();
}


function on_mouse_rbtn_up(x,y) {

    var _menu = window.CreatePopupMenu();
    var _firstgroup = window.CreatePopupMenu();
    var _secondgroup = window.CreatePopupMenu();
    var _thirdgroup = window.CreatePopupMenu();

    var i = 1;
    var ret;

    _menu.AppendMenuItem(MF_STRING, i++, "Settings");
    _menu.AppendMenuSeparator();


    _firstgroup.AppendMenuItem(MF_STRING, i++, "Playing item");
    _firstgroup.AppendMenuItem(MF_STRING, i++, "Current selection");

    _firstgroup.EnableMenuItem( mode+1, 1 );
    _firstgroup.CheckMenuRadioItem( 2, i - 1, mode+1 );

    _secondgroup.AppendMenuItem(MF_STRING, i++, "Enable rectangular backgrounds");
    _secondgroup.CheckMenuItem( i-1, rects, bypos = false);

    _secondgroup.AppendMenuItem(MF_STRING, i++, "Enable vertical text alignment");
    _secondgroup.CheckMenuItem( i-1, valign, bypos = false);

    _secondgroup.AppendMenuItem(MF_STRING, i++, "Show cover instead of icon");
    _secondgroup.CheckMenuItem( i-1, show_cover_instead, bypos = false);

    _thirdgroup.AppendMenuItem(MF_STRING, i++, "Write rating into tags, if no playcount component is present");
    _thirdgroup.CheckMenuItem( i-1, ini_tag_write, bypos = false);

    _firstgroup.AppendTo(  _menu, MF_STRING, "Focus settings");
    _secondgroup.AppendTo( _menu, MF_STRING, "Visual settings");
    _thirdgroup.AppendTo(  _menu, MF_STRING, "Rating settings");


    ret = _menu.TrackPopupMenu(x, y);

    if (ret == 1 ) {
        window.ShowConfigure();
    }
    else if (ret >= 2 && ret <= 3) {
        utils.WriteINI( fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'track-info-mode', mode = ret - 1);
        ItemInfo.Update();
    }
    else if (ret == 4 ) {
        utils.WriteINI( fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'rectangular-backs', rects = rects == 1 ? 0 : 1);
        window.Repaint();

    }
    else if (ret == 5 ) {
        utils.WriteINI( fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'vertical-align', valign = valign == 1 ? 0 : 1);
        calculate_dims();
        ItemInfo.ButtonsReady   = 0;
        ClearButtonCoords();
        window.Repaint();
    }
    else if (ret == 6 ) {
        utils.WriteINI( fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'show-cover-instead', show_cover_instead = show_cover_instead == 1 ? 0 : 1);
    }
    else if (ret == 7 ) {
        utils.WriteINI( fb.FoobarPath + 's7e.ini', 'info-panel-settings', 'write-rating-to-tag', ini_tag_write = ini_tag_write == 1 ? 0 : 1);
    }

    return true;

}
Go to the top of the page
+Quote Post
mire777
post Feb 25 2014, 17:37
Post #2941





Group: Members
Posts: 327
Joined: 9-June 12
Member No.: 100550



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..
Go to the top of the page
+Quote Post
Kai_cologne
post Feb 28 2014, 11:28
Post #2942





Group: Members
Posts: 5
Joined: 27-February 14
Member No.: 114715



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


Go to the top of the page
+Quote Post
SilentQ
post Feb 28 2014, 19:00
Post #2943





Group: Members
Posts: 4
Joined: 22-November 13
Member No.: 112445



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

This post has been edited by SilentQ: Feb 28 2014, 19:00
Go to the top of the page
+Quote Post
Kai_cologne
post Feb 28 2014, 22:03
Post #2944





Group: Members
Posts: 5
Joined: 27-February 14
Member No.: 114715



Great! Thank U
Go to the top of the page
+Quote Post
lillibot
post Mar 8 2014, 22:37
Post #2945





Group: Members
Posts: 9
Joined: 28-February 14
Member No.: 114727



I've been at work on a script and I've gathered that click events seem to be throttled.

CODE
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? huh.gif
Go to the top of the page
+Quote Post
ExtremeHunter
post Mar 8 2014, 22:56
Post #2946





Group: Members
Posts: 133
Joined: 5-October 08
From: Estonia
Member No.: 59398



add

CODE
function on_mouse_lbtn_dblclk(x, y){
on_mouse_lbtn_down(x, y);
}
Go to the top of the page
+Quote Post
lillibot
post Mar 8 2014, 23:01
Post #2947





Group: Members
Posts: 9
Joined: 28-February 14
Member No.: 114727



^ Dang. Thanks!
Go to the top of the page
+Quote Post
mire777
post Mar 12 2014, 13:40
Post #2948





Group: Members
Posts: 327
Joined: 9-June 12
Member No.: 100550



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
    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] + "\"");


This post has been edited by mire777: Mar 12 2014, 13:51
Go to the top of the page
+Quote Post
WilB
post Mar 12 2014, 14:10
Post #2949





Group: Members
Posts: 296
Joined: 20-July 06
Member No.: 33113



You can do it with regex, for example:
CODE
var url = "about:/watch?v=26PAgklYYvo"
url = url.replace(/about:\//,"")
fb.trace(url)


This post has been edited by WilB: Mar 12 2014, 14:19
Go to the top of the page
+Quote Post
marc2003
post Mar 12 2014, 14:16
Post #2950





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



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. dry.gif
Go to the top of the page
+Quote Post

125 Pages V  « < 116 117 118 119 120 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 30th July 2014 - 10:34