Страница 3 из 4 ПерваяПервая ... 234 ПоследняяПоследняя
Показано с 21 по 30 из 40

Тема: Скрипты для WSH Panel Mod и JScript Panel

  1. #21
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    1 466

    Скрипт WSH Biography Text Last.fm Rus (kgena_ua)

    Кодировка должна быть UTF-8.

    Панель для отображения биографии исполнителя с Last.fm (без фото):
    • Возможность выбора языка для выводимой информации (английский / русский).
    • Не сохраняет получаемую информацию в папке foobar2000.



    Код:
    /// ==PREPROCESSOR==
    // @name "Biography Text. www.last.fm"
    // @feature "v1.4"
    // @feature "watch-metadb"
    // ==/PREPROCESSOR==
    
    function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
    
    var a_font = gdi.Font("Arial",14,1);
    var b_font = gdi.Font("Arial",12,0);
    var ww,wh;
    
    DT_LEFT = 0x00000000;
    DT_RIGHT = 0x00000002;
    DT_CENTER = 0x00000001;
    DT_VCENTER = 0x00000004;
    DT_SINGLELINE = 0x00000020;
    DT_WORD_ELLIPSIS = 0x00040000;
    DT_WORDBREAK = 0x00000010;
    DT_CALCRECT = 0x00000400;
    DT_NOPREFIX = 0x00000800;
    
    var bgcolor = RGB(19,30,38);
    var a_color = RGB(128,192,250);
    var b_color = RGB(255,255,230);
    
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    var doc = new ActiveXObject("htmlfile");   
    
    var abc = "ru/";
    
    var artist, old_artis;
    var text = "", response = "";
    var data = ""; b_text = "";
    
    var col = 0;   
    var r_margin = 10;   
    var row = 35;   
    var b_text_row_height0;   
    var b_text_rows = 0;   
    var b_text_height = 0;   
    
    var s = 0;   
    var strings_array = [];   
    var b_text_array = [];   
    
    var metadb;   
    on_item_focus_change();   
    
    function on_paint(gr){   
       !window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
           
        gr.GdiDrawText(artist, a_font, a_color, col, 10, ww - 0, wh, DT_CENTER | DT_WORD_ELLIPSIS );   
    
        for (var i = 0; i < b_text_height; i++) {   
            gr.GdiDrawText(b_text_array[i + s], b_font, b_color, col, row + b_text_row_height * i, ww - 0, wh, DT_CENTER );   
        }      
    }   
    
    function on_mouse_wheel(delta) {   
        if (b_text_rows > b_text_height){   
            if (delta < 0) {s = b_text_rows - s <= b_text_height ? b_text_rows - b_text_height : s += 1}   
            if (delta > 0) {s = s <= 0 ? 0 : s -= 1}   
            window.Repaint();   
        }   
    }   
    
    function on_mouse_move(x, y) {
        on_mouse = true;
        window.SetCursor(32649);
        window.Repaint();
    }
    
    function on_mouse_leave() {
        on_mouse = false;
        window.SetCursor(32512);
        window.Repaint();
    }
    
    function on_size(){
        ww = window.Width;   
        wh = window.Height;
        get_b_text_array();   
    }   
    
    function on_item_focus_change() {   
        text = "";   
       metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
        if (metadb) on_metadb_changed();   
    }   
    
    function on_playlist_switch() {   
        on_item_focus_change();   
    }   
    
    function on_playback_new_track() {   
        on_item_focus_change();   
    }   
    
    function on_playback_dynamic_info_track() {
        on_item_focus_change();
    }
    
    function on_playback_stop() {
        on_item_focus_change();
    }
    
    function on_selection_changed(metadb) {
       on_item_focus_change(); 
    }
    
    function Eval(field) {
        if (metadb) {
            path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
            return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval(true) : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
        }
    }
    
    function on_metadb_changed() {
        artist = Eval("$replace(%artist%,à,а,á,б,â,в,ã,г,ä,д,å,е,¸,ё,æ,ж,ç,з,è,и,é,й,ê,к,ë,л,'ì',м,í,н,'î',о,ï,п,ð,р,ñ,с,ò,т,ó,у,ô,ф,õ,х,ö,ц,÷,ч,ø,ш,ù,щ,û,ы,ý,э,þ,ю,ü,ь,ÿ,я,À,А,Á,Б,Â,В,Ã,Г,Ä,Д,Å,Е,¸,Ё,Æ,Ж,Ç,З,È,И,É,Й,Ê,К,Ë,Л,Ì,М,Í,Н,Î,О,Ï,П,Ð,Р,Ñ,С,Ò,Т,Ó,У,Ô,Ф,Õ,Х,Ö,Ц,×,Ч,Ø,Ш,Ù,Щ,Ý,Э,Þ,Ю,ß,Я,Ü,Ь,Û,Ы,Ÿ,Я)");
        if (artist != old_artis){
            response = "";
            get();
            old_artis = artist;
        }
        window.Repaint();
    }
    
    function get(){
        if (artist == "" || artist == "?") {get_b_text_array(); return};
    
        var url2 = ("http://www.last.fm/" + abc + "music/" + encodeURIComponent(artist) + "/+wiki");
        xmlhttp.open("GET", url2, true);
        xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
        xmlhttp.send();
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {
                    text = xmlhttp.responsetext;
    
                    doc.open();      
                    var div = doc.createElement("div");      
                    div.innerHTML = this.xmlhttp.responsetext;      
                    var data = div.getElementsByTagName("div");      
                    for (i = 0; i < data.length; i++) {      
                        if (data[i].className == "wiki-content") {   
                            text = strip_tags(data[i].innerHTML);
                            break;
                        } else {
                            text = "";
                        }   
                    }      
                    doc.close();
    
                    get_b_text_array();
                    window.Repaint();
                }
            }
        }
    }
    
    function strip_tags(t) {            
        doc.open();         
        var div = doc.createElement("div");         
        div.innerHTML = t.replace(/<[Pp][^>]*>/g, "").replace(/<\/[Pp]>/g, "<br>").replace(/\n/g, "<br>");         
        var text = div.innerText;         
        doc.close();         
        return text;         
    }            
    
    function get_b_text_array() {
        s = 0;
        strings_array = [];
        b_text_array = [];
    
        ww = window.Width; 
       
        temp_bmp = gdi.CreateImage(1, 1);
        temp_gr = temp_bmp.GetGraphics();
    
        b_text_row_height = temp_gr.CalcTextHeight("text", b_font)
    
        if(text) string_width = ww - col - r_margin < 0 ? 0 : ww - col - r_margin;
        if(text) strings_array = temp_gr.EstimateLineWrap(text, b_font, string_width).toArray();
    
        for (var i = 0; i < strings_array.length; i += 2) {
            b_text_array.push(strings_array[i]);
        }
                   
        b_text_rows = b_text_array.length;
        b_text_height = Math.ceil((wh - row - 20) / b_text_row_height);
       
        temp_bmp.ReleaseGraphics(temp_gr);
        temp_bmp.Dispose();
        temp_gr = null;
        temp_bmp = null;
    }
    
    function on_mouse_rbtn_up (x, y){     
        var _menu = window.CreatePopupMenu();
        var i = 1;
    
        MF_ENABLED = 0x00000000;
        MF_GRAYED = 0x00000001;
       
        _menu.AppendMenuItem(MF_ENABLED, i++, "Английский язык");
        _menu.AppendMenuItem(MF_ENABLED, i++, "Русский язык");
       
        ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
       
    //    if (ShiftDown) {
    //      _menu.AppendMenuItem(0x00000800, 0, 0);
    //      _menu.AppendMenuItem(0x00000000, 10, "Перезагрузить");
            _menu.AppendMenuItem(0x00000800, 0, 0);
            _menu.AppendMenuItem(0x00000000, 20, "Свойства WSH");
            _menu.AppendMenuItem(0x00000000, 30, "Настройки WSH...");
    //    }
    
        ret = _menu.TrackPopupMenu(x,y);
    
        switch (ret) {
        case 1:   
            if (metadb)
                abc = "";{get();
                window.Repaint();
            }
            break;
        case 2:
            if (metadb) {get();
                abc = "ru/";
                get();
            }
            window.Repaint();
            break;
        case 10:
            window.Reload();
            break;
        case 20:
            window.ShowProperties();
            break;   
        case 30:
            window.ShowConfigure();      
            break;
       }
        _menu.Dispose();
        return true;
    }


    Обновление скрипта (16.12.2015):
    • Исправлены ошибки приводящие к "зависанию" проигрывателя
    • Корректное отображение / вывод кириллицы, бывает полезно для некоторых радиостанций
    Последний раз редактировалось MC Web; 22.12.2015 в 17:49.

  2. #22
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    1 466

    Скрипт WSH AcoustID

    Панель с кнопкой AcoustID для поиска информации трека (Исполнитель / Название) по его аудио отпечатку на AcoustID.



    Установка:
    • Требуется WSH Panel Mod или JScript Panel
    • Распаковать архив в папку профиля foobar2000 (папка acoustid)
    • Загрузить acoustid_rus.txt в пустую WSH панель

    Примечание:
    • Не определяет треки Интернет радиостанций
    • Для вывода в консоль, в Свойства WSH (ПКМ на панели) меняем значение "logging" на true

    Скачать WSH AcoustID Rus с Яндекс.Диск (957 КБ)

  3. #23
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    1 466

    Скрипт JS-marc2003

    Русифицированный набор скриптов (21 шт. в папке js_marc2003/samples) для панели JScript от marc2003:
    • обложки альбома
    • клавиши управления foobar2000 (разные варианты)
    • фото и биография с Last.fm
    • и т. п.

    Пример на основе Стандартного интерфейса и скриптов JS-marc2003:



    УСТАНОВКА:
    • распаковываем содержимое архива в папку foobar2000
    • устанавливаем в систему шрифт из папки fonts или если у Вас установлен компонент UI Hacks, он его автоматичаски подключет
    • устанавливаем компонент JScript Panel (Панель JScript), если не установлен
    • Импорт скриптов производим из папки js_marc2003/samples

    ПРИМЕЧАНИЕ:
    при работе скрипта создается папка wsh_data/artists/ в которой создаются папки с именами прослушанных исполнителей в которых сохраняются текстовые файлы с биографией, а по запросу на Last.fm - Скачать обложку исполнителя с Last.fm и фотографии в количестве выбранного лимита.

    Скачать JS_marc2003_Rus 2.2 с Яндекс.Диск (596 КБ)
    Последний раз редактировалось MC Web; 05.01.2016 в 12:09.

  4. #24
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    1 466

    Скрипт WSH Biography Text & Picture Last.fm Rus (kgena_ua)

    Кодировка должна быть UTF-8.

    Панель для отображения биографии исполнителя с возможностью выбора фото исполнителя или обложек альбома с Last.fm (страничка оригинального скрипта от kgena_ua находится здесь.).



    ВОЗМОЖНОСТИ:
    • Выбор языка для выводимой информации (английский / русский);
    • Не сохраняет получаемую информацию в папке foobar2000;
    • Перемещение поля с текстом - мышь при нажатой ЛКМ на тексте;
    • Прокрутка текста - колесо мыши на тексте;
    • Прокрутка изображений - колесо мыши на изображении;
    • Установка времени смены изображения ( от 0 до 60 секунд с шагом 5) - SHIFT + колесо мыши на изображении. Время отображается в левом верхнем углу;
    • Изменение размера шрифта (10 - 16) - SHIFT + колесо мыши на тексте;
    • Пункт меню Страничка исполнителя на Last.fm - переходит на страницу Last.fm в зависимости от выбранного языка;
    • Включение / отключение nocover через меню Свойства WSH. При отключенном nocover логотип last fm;
    • Включение / отключение scrollbar через меню Свойства WSH;
    • Максимально выведены в меню Свойства WSH необходимые для пользователя настройки;
    • Размер шрифта для исполнителя привязан к размеру шрифта биографии через переменную font size: artist (delta) в меню Свойства WSH.

    Код:
    // ==PREPROCESSOR==
    // @name "Biography Text && Picture. www.last.fm"
    // @author "kgena_ua"
    // @version "27022016"
    // @feature "v1.4"
    // @feature "watch-metadb"
    // ==/PREPROCESSOR==
    
    function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
    function RGBA(r,g,b,a) { return ((a << 24) | (r << 16) | (g << 8) | (b)); }
    function getRed(color) {return ((color >> 16) & 0xff);};
    function getGreen(color) {return ((color >> 8) & 0xff);};
    function getBlue(color) {return (color & 0xff);};
    
    DT_LEFT = 0x00000000;
    DT_RIGHT = 0x00000002;
    DT_CENTER = 0x00000001;
    DT_VCENTER = 0x00000004;
    DT_SINGLELINE = 0x00000020;
    DT_WORD_ELLIPSIS = 0x00040000;
    DT_WORDBREAK = 0x00000010;
    DT_CALCRECT = 0x00000400;
    DT_NOPREFIX = 0x00000800;
    
    var ww,wh;
    
    var font_name_a = window.GetProperty("font name: artist", "Arial");
    var font_name_b = window.GetProperty("font name: biography", "Arial");
    var font_size_a_d = window.GetProperty("font size: artist (delta)", 0);
    var font_size_b = window.GetProperty("font size: biography", 12);
    var a_font_style = window.GetProperty("font style: artist", 1);
    var b_font_style = window.GetProperty("font style: biography", 0);
    var min_font_size = 10;
    var max_font_size = 16;
    
    var a_font, b_font;
    get_font();
    
    function get_font(){
        a_font = gdi.Font(font_name_a, font_size_b + font_size_a_d, a_font_style);
        b_font = gdi.Font(font_name_b, font_size_b, b_font_style);
    }   
    
    ColorTypeCUI = {
        text: 0,
        selection_text: 1,
        inactive_selection_text: 2,
        background: 3,
        selection_background: 4,
        inactive_selection_background: 5,
        active_item_frame: 6
    };
    /*
    function get_color(){   
        bgcolor = window.GetColorCUI(ColorTypeCUI.background);
        a_color = window.GetColorCUI(ColorTypeCUI.text);
        b_color = window.GetColorCUI(ColorTypeCUI.inactive_selection_text);
    }
    
    get_color();
    */
    
    var bgcolor = RGB(19,30,38);    // RGB(30,30,30);
    var a_color = RGB(128,192,255); // RGB(220,220,220);
    var b_color = RGB(255,255,230); // RGB(255,255,230);
    
    var transparent = 200;
    
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    var doc = new ActiveXObject("htmlfile");
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var WshShell = new ActiveXObject("WScript.Shell");
    var script_path = fb.ProfilePath + "\\tmp_Biography\\download\\";
    var vbs = "cscript //nologo \"" + script_path + "download.vbs\"";
    
    var tmp_b_path = fb.ProfilePath + "\\tmp_Biography\\";
    if(!fso.FolderExists(tmp_b_path)) {fso.CreateFolder(tmp_b_path)};
    if(!fso.FolderExists(tmp_b_path + "\\download\\")) {fso.CreateFolder(tmp_b_path + "\\download\\")};
    if(!fso.FileExists(tmp_b_path + "\\download\\" + "download.vbs")) {create_download_file()};
    var nocover_path = window.GetProperty("nocover path",".\\nocover\\nocover.png");
    var nocover = window.GetProperty("nocover image", false);
    
    var last_fm_logo;
    load_last_fm_logo();
    
    var artist, old_artis;
    
    var g_img = null;
    var p_margin = window.GetProperty("margin: picture", 10);
    var files = [], selected = 0;
    var limit = window.GetProperty("download limit",5);
    var cycle = window.GetProperty("auto cycle (sec)", 0);
    var pic_scroll = false;
    
    var scrollbar = window.GetProperty("scrollbar", false);
    var sb_down = false;
    var sb_scroll = false;
    var scrollbar_k;
    var posy = 0;
    
    var t_margin = window.GetProperty("margin: text", 10);
    var txt_x = window.GetProperty("txt_x", window.Width / 2);
    var txt_y = window.GetProperty("txt_y", window.Height / 2);
    var delta_x, delta_y;
    var artist_x, artist_y;
    var b_x = 0, b_y = 0;
    var text = "";
    var s_text = 0;
    var string_width;
    var strings_array = [];
    var b_text_rows = 0;
    var b_text_row_height = 0;
    var b_text_visable_rows = 0;
    var b_text_visable_height = 0;
    var b_text_array = [];
    var k_down = false;
    var text_scroll = false;
    
    var abc_lang = new Array("", "ru/");
    var abc = window.GetProperty("abc", 0);
    var if_not_found = new Array("\n\nНичего не найдено", "\n\nНичего не найдено");
    var select_p_a = window.GetProperty("pictures/albums", 0);
    var select_p_a_old;
    var p_a = new Array("images", "albums");
    
    var selection_mode = window.GetProperty("selection mode", 0);
    var metadb;
    on_item_focus_change();
    
    function on_paint(gr){   
       !window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
    
        paint(gr);   
    
        if(set_cycle){   
            gr.FillSolidRect(0, 0, ww, wh, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),transparent));   
            var txt_cycle = cycle == 0 ? "Отключено" : cycle + " сек.";   
            set_cycle && gr.GdiDrawText("Зацикливание изображений \n" + txt_cycle, b_font, b_color, 15, 15, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS );   
        } else{   
            gr.FillSolidRect(txt_x, txt_y, ww - txt_x, wh - txt_y, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),transparent));   
        }   
    
        gr.GdiDrawText(artist, a_font, RGB(0,0,0), artist_x + 1, artist_y + 2, ww - artist_x - t_margin, wh, DT_LEFT | DT_WORD_ELLIPSIS );   
        gr.GdiDrawText(artist, a_font, a_color, artist_x, artist_y, ww - artist_x - t_margin, wh, DT_LEFT | DT_WORD_ELLIPSIS );   
    
        for (var i = 0; i < b_text_visable_rows; i++) { 
            gr.GdiDrawText(b_text_array[i + s_text], b_font, RGB(0,0,0), b_x + 1, b_y + b_text_row_height * i + 2, ww, wh, DT_LEFT );
            gr.GdiDrawText(b_text_array[i + s_text], b_font, b_color, b_x, b_y + b_text_row_height * i, ww, wh, DT_LEFT );
        } 
    
        scrollbar && draw_scrollbar(gr);
    
        gr.GdiDrawText("", b_font, b_color, 15, 0, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS );
    }
    
    function paint(gr){
        g_img = gdi.Image(files[selected]); 
        if (!g_img && nocover){
            try {
                g_img = gdi.Image(nocover_path); 
            } catch(e) {};
        }
       
        if (g_img){
            var scale_w = (ww - p_margin * 2) / g_img.Width;
            var scale_h = (wh - p_margin * 2) / g_img.Height;
            var scale = Math.min(scale_w, scale_h);
           
            if (files.length > 0){
                g_img = g_img.CreateRawBitmap();
                gr.GdiDrawBitmap(g_img, p_margin, p_margin, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
            } else {
                gr.DrawImage(g_img, p_margin, p_margin, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height, 0, 100); 
            }
        }
       
        logo_img = gdi.Image(tmp_b_path + "\\download\\" + "last_fm_logo.jpg");
        if (logo_img && files.length == 0 && !nocover){
            gr.DrawImage(logo_img, p_margin, p_margin, logo_img.Width * 0.8, logo_img.Height * 0.8, 0, 0, logo_img.Width, logo_img.Height, 0, 255);   
        }
    }
    
    function draw_scrollbar(gr){
        scrollbar_h = b_text_rows > b_text_visable_rows ? b_text_visable_height * (b_text_visable_rows / b_text_rows) : 0;
        scrollbar_y = s_text > 0 ? s_text * scrollbar_k : 0;
    
        gr.FillSolidRect(ww - 4, b_y + scrollbar_y, 2, scrollbar_h, a_color);
    }
    
    
    function on_playlist_switch() {
        on_item_focus_change();
    }
    
    function on_playback_new_track() {
        on_item_focus_change();
    }
    
    function on_playback_dynamic_info_track() {
        on_item_focus_change();
    }
    
    function on_playback_stop() {
        on_item_focus_change();
    }
    
    function on_selection_changed(metadb) {
       on_item_focus_change(); 
    }
    
    function on_item_focus_change() {
        switch (selection_mode) {
        case 0:
            metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();   
            break;   
        case 1:   
           metadb = fb.GetFocusItem();
            break;    
        }   
        if (metadb) on_metadb_changed();   
    }   
    
    function Eval(field) {   
        if (!metadb) return;   
        path = fb.Titleformat("%path%").EvalWithMetadb(metadb);   
        //return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval() : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);   
        return fb.Titleformat("[" + field + "]").EvalWithMetadb(metadb) ? fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb) : fb.TitleFormat("[" + field + "]").Eval(true);   
    }   
    
    function on_metadb_changed() {
        if (!metadb) return;   
        artist = Eval("%artist%");
        if (artist != old_artis || select_p_a != select_p_a_old){
            CollectGarbage();
            g_img = null;
            files = [];
            del_files_from_dir();
            selected = 0;
            s_text = 0;
            text = "";
            get_b_text_array()       
            get_pic();
            old_artis = artist;
            select_p_a_old = select_p_a;
        }
    }      
    
    function get_pic(){      
        var url1 = ("http://www.last.fm/music/" + encodeURIComponent(artist) + "/+" + p_a[select_p_a]);      
        xmlhttp.open("GET", url1, true);      
        xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");      
        xmlhttp.send();      
        xmlhttp.onreadystatechange = function () {      
            if (xmlhttp.readyState == 4) {      
                if (xmlhttp.status == 200) {      
                    doc.open();      
                  var div = doc.createElement("div");
                  div.innerHTML = xmlhttp.responsetext;
                  var data = div.getElementsByTagName("img");
                  var urls = [];
                    for (i = 0; i < data.length; i++) {      
                        if (data[i].className == "image-list-image"){        
                            if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/avatar170s") == 0) urls.push(data[i].src.replace("avatar170s", ""));       
                        }       
                        if (data[i].className == "album-grid-album-art"){        
                            if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/300") == 0 && data[i].src.indexOf("c6f59c1e5e7240a4c0d427abd71f3dbb") < 0) urls.push(data[i].src.replace("300", ""));       
                        }        
                    }      
                    for (i = 0; i < Math.min(urls.length, limit); i++) {      
                        file = "\"" + tmp_b_path + artist + "_"  + i + "_" +p_a[select_p_a] + ".jpg" + "\"";      
                        WshShell.Run(vbs + " " + urls[i] + " " + file, false);       
                    }      
                  doc.close();
                }       
                get_b_text();      
            }      
        }      
    }
    
    function get_files_from_dir() {
        files = [];
        var e = new Enumerator( fso.GetFolder(tmp_b_path).Files );
        while ( !e.atEnd() ) {
            var name = e.item().Name;
            if (name.indexOf(artist) == 0){
                files.push(tmp_b_path + name);
            }
            e.moveNext();
        }
    }
    
    /*function get_files_from_dir() {
        files = [];
        files = utils.Glob(tmp_b_path + artist + "*.*").toArray();
    }
    */
    function get_b_text(){
        var url2 = ("http://www.last.fm/" + abc_lang[abc] + "music/" + encodeURIComponent(artist) + "/+wiki");
        xmlhttp.open("GET", url2, true);
        xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
        xmlhttp.send();
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {
                    doc.open();
                    var div = doc.createElement("div");
                    div.innerHTML = xmlhttp.responsetext;
                    var data = div.getElementsByTagName("div");
                    for (i = 0; i < data.length; i++) {
                        if (data[i].className == "wiki-content") {
                            text = strip_tags(data[i].innerHTML);
                            break;
                        }
                    }
                    doc.close();
                }
                if (text == "") text = if_not_found[abc];
                get_b_text_array();
            }
        }
    }
    
    function strip_tags(t) {
        doc.open();
        var div = doc.createElement("div");
        div.innerHTML = t.replace(/<[Pp][^>]*>/g, "").replace(/<\/[Pp]>/g, "<br>").replace(/\n/g, "<br>");
        var text = div.innerText;
        doc.close();
        return text;
    }
    
    function get_b_text_array() {
        artist_x = txt_x + t_margin;
        artist_y = txt_y + t_margin;
        strings_array = [];
        b_text_array = [];
       
        temp_bmp = gdi.CreateImage(1, 1);
        temp_gr = temp_bmp.GetGraphics();
    
        b_x = txt_x + t_margin;
        b_y = txt_y + temp_gr.CalcTextHeight("text", a_font) + t_margin * 2;
    
        b_text_row_height = temp_gr.CalcTextHeight("text", b_font)
        string_width = Math.max(ww - b_x - 10, 0);
    
        if (text) strings_array = temp_gr.EstimateLineWrap(text, b_font, string_width).toArray();
    
        for (var i = 0; i < strings_array.length; i += 2) {
            b_text_array.push(strings_array[i].replace(/^\s+|\s+$/g, ""));
        }
    
        b_text_rows = b_text_array.length;
        b_text_visable_rows = Math.round((wh - b_y - 10) / b_text_row_height);
        b_text_visable_height = Math.round(wh - b_y - 10);
    
        temp_bmp.ReleaseGraphics(temp_gr);
        temp_bmp.Dispose();
        temp_gr = null;
        temp_bmp = null;
    
        if (b_text_visable_rows + s_text > b_text_rows && s_text > 0) {
            s_text = b_text_rows - b_text_visable_rows;
        };
       
        scrollbar_k = b_text_visable_height / b_text_rows;
        window.Repaint();
    }
    
    function on_mouse_rbtn_up (x, y){     
        var _menu = window.CreatePopupMenu();
        var i = 1;
    
        MF_ENABLED = 0x00000000;   
        MF_GRAYED = 0x00000001;   
        MF_SEPARATOR = 0x00000800;   
          
        _menu.AppendMenuItem(MF_ENABLED, i++, "Английский язык");   
        _menu.AppendMenuItem(MF_ENABLED, i++, "Русский язык");   
        _menu.CheckMenuRadioItem(1, i, abc + 1);         
        _menu.EnableMenuItem(abc + 1, 1);     
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
           
        _menu.AppendMenuItem(MF_ENABLED, i++, "Предпочитать воспроизводимый");   
        _menu.AppendMenuItem(MF_ENABLED, i++, "Следовать за выбранным треком");   
        _menu.CheckMenuRadioItem(i - 2, i , selection_mode + 3);   
       _menu.EnableMenuItem(selection_mode + 3, 1);
           
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
        _menu.AppendMenuItem(MF_ENABLED, i++, "Фото исполнителя");   
        _menu.AppendMenuItem(MF_ENABLED, i++, "Обложка альбома");   
        _menu.CheckMenuRadioItem(i - 2, i , select_p_a + 5);   
       _menu.EnableMenuItem(select_p_a + 5, 1); 
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
        var is_artist = artist ? MF_ENABLED : MF_GRAYED;   
        _menu.AppendMenuItem(is_artist, i++, "Страничка исполнителя на Last.fm");   
          
    //    if (ShiftDown) {   
    //       _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
    //       _menu.AppendMenuItem(MF_ENABLED, 10, "Перезагрузить");   
            _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
            _menu.AppendMenuItem(MF_ENABLED, 20, "Свойства WSH");   
            _menu.AppendMenuItem(MF_ENABLED, 30, "Настройки WSH...");
    //    }
    
        ret = _menu.TrackPopupMenu(x,y);
    
        switch (ret) {
        case 1:
            abc = 0;
            window.SetProperty("abc", abc);
            s_text = 0;
            text = "";
            get_b_text();
            break;
        case 2:
            abc = 1;
            window.SetProperty("abc", abc);
            s_text = 0;
            text = "";
            get_b_text();
            break;
        case 3:
            selection_mode = 0;
            window.SetProperty("selection_mode", selection_mode);
            on_item_focus_change();
            break;
        case 4:
            selection_mode = 1;
            window.SetProperty("selection_mode", selection_mode);
            on_item_focus_change();
            break;
        case 5:
            select_p_a = 0;
            window.SetProperty("pictures/albums", select_p_a);
            on_metadb_changed();
            break;
        case 6:
            select_p_a = 1;
            window.SetProperty("pictures/albums", select_p_a);
            on_metadb_changed();
            break;
        case 7:
            WshShell.run("http://www.last.fm/" + abc_lang[abc] + "music/" + encodeURIComponent(artist));
            break;
    //    case 10:
    //        window.Reload();
    //        break;
        case 20:
            window.ShowProperties();
            break;   
        case 30:
            window.ShowConfigure();   
            break;   
       }
        _menu.Dispose();   
        return true;   
    }   
    
    var timer = window.SetInterval(on_timer, 1000);
    var step = 0;
    var set_cycle = false;
    var dis_timer, dis = 0;
    
    function on_timer(id) {
        step =  set_cycle || cycle == 0 ? 0 : step + 1;
        if (files.length == 0) {get_files_from_dir(); window.Repaint();};
       
        if (cycle > 0 && step >= cycle){
            selected = selected >= files.length - 1 ? 0 : selected = selected + 1;
            window.Repaint();
            step = 0;
        }
    }
    
    function on_key_down(vkey) {
        if (vkey == 16){
            set_cycle = true;
            dis_set();
            window.Repaint();
        }
    }
    
    function dis_set(){
        dis = 0;
        dis_timer && window.ClearInterval(dis_timer);
        dis_timer = window.SetInterval(function() {
            if (set_cycle) {
                dis++;
                if(dis == 1) {
                    set_cycle = false;
                    window.ClearInterval(dis_timer);               
                    window.Repaint();
                };
            }
        }, 1000 );
    }
    
    var delay = false;
    
    function fdelay(){
        var delay_timer = window.SetTimeout(function() {
            delay = false;
            window.ClearTimeout(delay_timer);
        }, 200);
    }
    
    function del_files_from_dir() {
        var del_files = [];
        var e = new Enumerator( fso.GetFolder(tmp_b_path).Files );
        while ( !e.atEnd() ) {
            var name = e.item().Name;
            try {
                fso.deleteFile(tmp_b_path + name );
            } catch(e) {};
            e.moveNext();
        }
    }
    
    /*
    function del_files_from_dir() {
        del_files = [];
        del_files = utils.Glob(tmp_b_path + "*.*").toArray();
       
        for (i in del_files) {
            try {
                fso.deleteFile(del_files[i]);
            } catch(e) {};
        }
    }
    */
    
    function load_last_fm_logo(){
        if(!fso.FileExists(tmp_b_path + "\\download\\" + "last_fm_logo.jpg")) {
            var url = "http://www.last.fm/static/images/logo_beta.png?eb6d3ca20e73"
            var file = "\"" + tmp_b_path + "\\download\\" + "last_fm_logo.jpg" + "\"";
            WshShell.Run(vbs + " " + url + " " + file, false);
            var url = "http://static-web.last.fm/static/images/favicon.702b239b6194.ico"
            var file = "\"" + tmp_b_path + "\\download\\" + "last_fm_ico.ico" + "\"";
            WshShell.Run(vbs + " " + url + " " + file, false);
        }
    }
    
    function create_download_file() {
        try {
            file = fso.CreateTextFile(tmp_b_path + "\\download\\" + "download.vbs" )
           
            var text =    
                "If (WScript.Arguments.Count <> 2) Then" + "\n\r" +   
                "   WScript.Quit" + "\n\r" +
                "End If" + "\n\r" + "\n\r" +   
    
                "url = WScript.Arguments(0)" + "\n\r" +   
                "file = WScript.Arguments(1)" + "\n\r"  + "\n\r" +   
    
                "Set objFSO = Createobject(" + '"Scripting.FileSystemObject"' + ")" + "\n\r" +   
                "If objFSO.Fileexists(file) Then" + "\n\r" +   
                "   Set objFSO = Nothing" + "\n\r" +
                "   WScript.Quit" + "\n\r" +
                "End If" + "\n\r" + "\n\r" +   
    
                "Set objXMLHTTP = CreateObject(" + '"MSXML2.XMLHTTP"' + ")" + "\n\r" +   
                "objXMLHTTP.open " + '"GET"' + ", url,false" + "\n\r" +   
                "objXMLHTTP.send()" + "\n\r" + "\n\r" +   
    
                "If objXMLHTTP.Status = 200 Then" + "\n\r" +   
                "   Set objADOStream = CreateObject(" + '"ADODB.Stream"' + ")" + "\n\r" +
                "   objADOStream.Open" + "\n\r" +
                "   objADOStream.Type = 1" + "\n\r" +
                "   objADOStream.Write objXMLHTTP.ResponseBody" + "\n\r" +
                "   objADOStream.Position = 0" + "\n\r" +
                "   objADOStream.SaveToFile file" + "\n\r" +
                "   objADOStream.Close" + "\n\r" +
                "   Set objADOStream = Nothing" + "\n\r" +
                "End If" + "\n\r" + "\n\r" +   
    
                "Set objFSO = Nothing" + "\n\r" +   
                "Set objXMLHTTP = Nothing"   
            ;
    
            file.WriteLine(text);
            file.Close();
        } catch(e) {};
    }
    
    function on_mouse_move(x, y) {
        window.SetCursor(32649);
       
        text_scroll = x >= txt_x && x < ww - 20 && y  >= txt_y ? true : false;
        sb_scroll =  x > ww - 20 && y  >= txt_y ? true : false;
        pic_scroll = !text_scroll && !sb_scroll ? true : false;
       
        if (k_down){
            txt_x = x - delta_x ;
            txt_y = y - delta_y;
    
            txt_x = txt_x <= 0 ? 0 : txt_x >= ww - 50 ? ww - 50: txt_x;
            txt_y = txt_y <= 0 ? 0 : txt_y >= wh - 50 ? wh - 50: txt_y;
            get_b_text_array();
        }
    
        if (sb_down && scrollbar){
            posy = y + delta_y;
            s_text = y + delta_y >= 0 ? y + delta_y <= (b_text_rows - b_text_visable_rows) * scrollbar_k ? Math.round(posy / scrollbar_k) : b_text_rows - b_text_visable_rows : 0;
            window.Repaint();
        }
    }
    
    function on_mouse_wheel(delta) {
        ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
       
        if (!delay && pic_scroll && !ShiftDown){
            delay = true;
            fdelay();
            get_files_from_dir(); 
            if (delta < 0) {selected = selected <= 0 ? files.length - 1 : selected = selected - 1};
            if (delta > 0) {selected = selected >= files.length - 1 ? 0 : selected = selected + 1};
    
        }
       
        if (text_scroll && !ShiftDown){
            if (b_text_rows > b_text_visable_rows){
                if (delta < 0) {s_text = b_text_rows - s_text <= b_text_visable_rows ? b_text_rows - b_text_visable_rows : s_text += 1}
                if (delta > 0) {s_text = s_text <= 0 ? 0 : s_text -= 1}
            }
        }
       
        if (!delay && text_scroll && ShiftDown){
            delay = true;
            fdelay();
            if (delta < 0) {font_size_b = font_size_b <= min_font_size ? min_font_size : font_size_b - 2;};
            if (delta > 0) {font_size_b = font_size_b >= max_font_size ? max_font_size : font_size_b + 2;};
            window.SetProperty("font size: biography", font_size_b);
            get_font();
            get_b_text_array();
        }
       
        if (set_cycle && pic_scroll) {
            if (delta < 0) {cycle = cycle <= 0 ? 0 : cycle - 5;};
            if (delta > 0) {cycle = cycle >= 60 ? 60 : cycle + 5;};
            window.SetProperty("auto cycle (sec)", cycle);
        }
        window.Repaint();
    }
    
    function on_mouse_lbtn_down(x,y){
        if (text_scroll){
            k_down = true;
            delta_x = x - txt_x;
            delta_y = y - txt_y;
        }
        if (sb_scroll){
            sb_down = true;
            posy = s_text * scrollbar_k;
            delta_y = posy - y;
        }
    }
    
    function on_mouse_lbtn_up(x,y){
        window.SetProperty("txt_x", txt_x);
        window.SetProperty("txt_y", txt_y);
        k_down = false;
        sb_down = false;
    }
    
    function on_mouse_lbtn_dblclk (x,y){
        if (text_scroll){
            abc = abc == 1 ? 0 : 1;
            window.SetProperty("abc", abc);
            s_text = 0;
            b_text_array = [];
            text = "";
            get_b_text();
        }
        if (files[selected] && pic_scroll) WshShell.run( '"' + files[selected] + '"' );
    }
    
    function on_mouse_leave() {
        window.SetCursor(32512);
        window.Repaint();
    }
    
    function on_size(){
        ww = window.Width;   
        wh = window.Height;
       
        txt_x = window.GetProperty("txt_x");
        txt_y = window.GetProperty("txt_y");
    
        txt_x = txt_x >= ww - 50 && txt_x >= 0 ? ww - 50 : txt_x;
        txt_y = txt_y >= wh - 50 && txt_y >= 0 ? wh - 50 : txt_y;
       
        get_b_text_array();
    }


    Тот же скрипт с изменениями от zeremy и немного от меня.



    ИЗМЕНЕНИЯ:
    • добавлена поддержка много-язычного интерфейса (12 языков, но перевод интерфейса только на английский / русский);
    • автоматически с выбором языка выбирается и языковая страница Last.fm.

    Код:
    // ==PREPROCESSOR==
    // @name "Biography Text && Picture. www.last.fm"
    // @author "kgena_ua - mod zeremy for multilanguage "
    // @version "02032016"
    // @feature "v1.4"
    // @feature "watch-metadb"
    // ==/PREPROCESSOR==
    
    
    
    function RGB(r, g, b) {
       return (0xff000000 | (r << 16) | (g << 8) | (b));
    }
    function RGBA(r, g, b, a) {
       return ((a << 24) | (r << 16) | (g << 8) | (b));
    }
    function getRed(color) {
       return ((color >> 16) & 0xff);
    };
    function getGreen(color) {
       return ((color >> 8) & 0xff);
    };
    function getBlue(color) {
       return (color & 0xff);
    };
    
    DT_LEFT = 0x00000000;
    DT_RIGHT = 0x00000002;
    DT_CENTER = 0x00000001;
    DT_VCENTER = 0x00000004;
    DT_SINGLELINE = 0x00000020;
    DT_WORD_ELLIPSIS = 0x00040000;
    DT_WORDBREAK = 0x00000010;
    DT_CALCRECT = 0x00000400;
    DT_NOPREFIX = 0x00000800;
    
    var ww, wh;
    
    var font_name_a = window.GetProperty("font name: artist", "Arial");
    var font_name_b = window.GetProperty("font name: biography", "Arial");
    var font_size_a_d = window.GetProperty("font size: artist (delta)", 0);
    var font_size_b = window.GetProperty("font size: biography", 12);
    var a_font_style = window.GetProperty("font style: artist", 1);
    var b_font_style = window.GetProperty("font style: biography", 0);
    var min_font_size = 10;
    var max_font_size = 16;
    
    var a_font, b_font;
    get_font();
    
    function get_font() {
       a_font = gdi.Font(font_name_a, font_size_b + font_size_a_d, a_font_style);
       b_font = gdi.Font(font_name_b, font_size_b, b_font_style);
    }
    
    ColorTypeCUI = {
       text : 0,
       selection_text : 1,
       inactive_selection_text : 2,
       background : 3,
       selection_background : 4,
       inactive_selection_background : 5,
       active_item_frame : 6
    };
    /*
    function get_color(){
    bgcolor = window.GetColorCUI(ColorTypeCUI.background);
    a_color = window.GetColorCUI(ColorTypeCUI.text);
    b_color = window.GetColorCUI(ColorTypeCUI.inactive_selection_text);
    }
    
    get_color();
     */
    
    var bgcolor = RGB(31, 41, 48);
    var a_color = RGB(220, 220, 220);
    var b_color = RGB(255, 255, 230);
    
    var transparent = 200;
    
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    var doc = new ActiveXObject("htmlfile");
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var WshShell = new ActiveXObject("WScript.Shell");
    var script_path = fb.ProfilePath + "\\tmp_Biography\\download\\";
    var vbs = "cscript //nologo \"" + script_path + "download.vbs\"";
    
    var tmp_b_path = fb.ProfilePath + "\\tmp_Biography\\";
    if (!fso.FolderExists(tmp_b_path)) {
       fso.CreateFolder(tmp_b_path)
    };
    if (!fso.FolderExists(tmp_b_path + "\\download\\")) {
       fso.CreateFolder(tmp_b_path + "\\download\\")
    };
    if (!fso.FileExists(tmp_b_path + "\\download\\" + "download.vbs")) {
       create_download_file()
    };
    var nocover_path = window.GetProperty("nocover path", ".\\nocover\\nocover.png");
    var nocover = window.GetProperty("nocover image", false);
    
    var last_fm_logo;
    load_last_fm_logo();
    
    var artist, old_artis;
    
    var g_img = null;
    var p_margin = window.GetProperty("margin: picture", 10);
    var files = [], selected = 0;
    var limit = window.GetProperty("download limit", 5);
    var cycle = window.GetProperty("auto cycle (sec)", 0);
    var pic_scroll = false;
    
    var scrollbar = window.GetProperty("scrollbar", false);
    var sb_down = false;
    var sb_scroll = false;
    var scrollbar_k;
    var posy = 0;
    
    var t_margin = window.GetProperty("margin: text", 10);
    var txt_x = window.GetProperty("txt_x", window.Width / 2);
    var txt_y = window.GetProperty("txt_y", window.Height / 2);
    var delta_x, delta_y;
    var artist_x, artist_y;
    var b_x = 0, b_y = 0;
    var text = "";
    var s_text = 0;
    var string_width;
    var strings_array = [];
    var b_text_rows = 0;
    var b_text_row_height = 0;
    var b_text_visable_rows = 0;
    var b_text_visable_height = 0;
    var b_text_array = [];
    var k_down = false;
    var text_scroll = false;
    
    var abc_lang = new Array("", "ru/", "es/", "fr/", "it/", "ja/", "pl/", "pt/", "de/", "sv/", "tr/", "zh/");
    var abc = window.GetProperty("abc", 0);
    
    var if_not_found = new Array("Nothing found", "Ничего не найдено", "Nothing found", "Nothing found", "Nothing found", "Nothing found", "Nothing found", "Nothing found", "Nothing found", "Nothing found", "Nothing found", "Nothing found");   // var if_not_found = new Array(_("Nothing found"), _("Nothing found"));
    var select_p_a = window.GetProperty("pictures/albums", 0);
    var select_p_a_old;
    var p_a = new Array("images", "albums");
    
    var selection_mode = window.GetProperty("selection mode", 0);
    var metadb;
    
    function _(s) {
       switch (abc) {
       case 1:
          if (typeof(ru) != 'undefined' && ru[s]) {
             return ru[s];
          }
          return s;
          break;
       case 2:
          if (typeof(es) != 'undefined' && es[s]) {
             return es[s];
          }
          return s;
          break;
       case 3:
          if (typeof(fr) != 'undefined' && fr[s]) {
             return fr[s];
          }
          return s;
          break;
       case 4:
          if (typeof(it) != 'undefined' && it[s]) {
             return it[s];
          }
          return s;
          break;
       case 5:
          if (typeof(ja) != 'undefined' && ja[s]) {
             return ja[s];
          }
          return s;
          break;
       case 6:
          if (typeof(pl) != 'undefined' && pl[s]) {
             return pl[s];
          }
          return s;
          break;
       case 7:
          if (typeof(pt) != 'undefined' && pt[s]) {
             return pt[s];
          }
          return s;
          break;
       case 8:
          if (typeof(de) != 'undefined' && de[s]) {
             return de[s];
          }
          return s;
          break;
       case 9:
          if (typeof(sv) != 'undefined' && sv[s]) {
             return sv[s];
          }
          return s;
          break;
       case 10:
          if (typeof(tr) != 'undefined' && tr[s]) {
             return tr[s];
          }
          return s;
          break;
       case 11:
          if (typeof(zh) != 'undefined' && zh[s]) {
             return zh[s];
          }
          return s;
          break;
    
       default:
          return s;
       }
    }
    
    var ru = {
       "Nothing found" : "Ничего не найдено",
       "off" : "Отключено",
       "sec" : "сек",
       "auto cycle" : "Зацикливание изображений",
       "Prefer now playing" : "Предпочитать воспроизводимый",
       "Follow selected track" : "Следовать за выбранным треком",
       "Artist pictures" : "Фото исполнителя",
       "Albums pictures" : "Обложка альбома",
       "last.fm Artist" : "Страничка исполнителя на Last.fm",
       "Reload" : "Перезагрузить",
       "Properties" : "Свойства WSH",
       "Configure..." : "Настройки WSH..."
    };
    
    var es = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var fr = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var it = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var ja = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var pl = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var pt = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var de = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var sv = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var tr = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    var zh = {
       "Nothing found" : "",
       "off" : "",
       "sec" : "",
       "auto cycle" : "",
       "Prefer now playing" : "",
       "Follow selected track" : "",
       "Artist pictures" : "",
       "Albums pictures" : "",
       "last.fm Artist" : "",
       "Reload" : "",
       "Properties" : "",
       "Configure..." : ""
    };
    
    on_item_focus_change();
    
    function on_paint(gr) {
       !window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
    
       paint(gr);
    
       if (set_cycle) {
          gr.FillSolidRect(0, 0, ww, wh, RGBA(getRed(bgcolor), getGreen(bgcolor), getBlue(bgcolor), transparent));
          var txt_cycle = cycle == 0 ? _("off") : cycle + " " + _("sec");
          set_cycle && gr.GdiDrawText(_("auto cycle") + " \n" + txt_cycle, b_font, b_color, 15, 15, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS);
       } else {
          gr.FillSolidRect(txt_x, txt_y, ww - txt_x, wh - txt_y, RGBA(getRed(bgcolor), getGreen(bgcolor), getBlue(bgcolor), transparent));
       }
    
       gr.GdiDrawText(artist, a_font, RGB(0, 0, 0), artist_x + 1, artist_y + 2, ww - artist_x - t_margin, wh, DT_LEFT | DT_WORD_ELLIPSIS);
       gr.GdiDrawText(artist, a_font, a_color, artist_x, artist_y, ww - artist_x - t_margin, wh, DT_LEFT | DT_WORD_ELLIPSIS);
    
       for (var i = 0; i < b_text_visable_rows; i++) {
          gr.GdiDrawText(b_text_array[i + s_text], b_font, RGB(0, 0, 0), b_x + 1, b_y + b_text_row_height * i + 2, ww, wh, DT_LEFT);
          gr.GdiDrawText(b_text_array[i + s_text], b_font, b_color, b_x, b_y + b_text_row_height * i, ww, wh, DT_LEFT);
       }
    
       scrollbar && draw_scrollbar(gr);
    
       gr.GdiDrawText("", b_font, b_color, 15, 0, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS);
    }
    
    function paint(gr) {
       g_img = gdi.Image(files[selected]);
       if (!g_img && nocover) {
          try {
             g_img = gdi.Image(nocover_path);
          } catch (e) {};
       }
    
       if (g_img) {
          var scale_w = (ww - p_margin * 2) / g_img.Width;
          var scale_h = (wh - p_margin * 2) / g_img.Height;
          var scale = Math.min(scale_w, scale_h);
    
          if (files.length > 0) {
             g_img = g_img.CreateRawBitmap();
             gr.GdiDrawBitmap(g_img, p_margin, p_margin, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
          } else {
             gr.DrawImage(g_img, p_margin, p_margin, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height, 0, 100);
          }
       }
    
       logo_img = gdi.Image(tmp_b_path + "\\download\\" + "last_fm_logo.jpg");
       if (logo_img && files.length == 0 && !nocover) {
          gr.DrawImage(logo_img, p_margin, p_margin, logo_img.Width * 0.8, logo_img.Height * 0.8, 0, 0, logo_img.Width, logo_img.Height, 0, 255);
       }
    }
    
    function draw_scrollbar(gr) {
       scrollbar_h = b_text_rows > b_text_visable_rows ? b_text_visable_height * (b_text_visable_rows / b_text_rows) : 0;
       scrollbar_y = s_text > 0 ? s_text * scrollbar_k : 0;
    
       gr.FillSolidRect(ww - 4, b_y + scrollbar_y, 2, scrollbar_h, a_color);
    }
    
    function on_playlist_switch() {
       on_item_focus_change();
    }
    
    function on_playback_new_track() {
       on_item_focus_change();
    }
    
    function on_playback_dynamic_info_track() {
       on_item_focus_change();
    }
    
    function on_playback_stop() {
       on_item_focus_change();
    }
    
    function on_selection_changed(metadb) {
       on_item_focus_change();
    }
    
    function on_item_focus_change() {
       switch (selection_mode) {
       case 0:
          metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
          break;
       case 1:
          metadb = fb.GetFocusItem();
          break;
       }
       if (metadb)
          on_metadb_changed();
    }
    
    function Eval(field) {
       if (!metadb)
          return;
       path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
       //return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval() : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
       return fb.Titleformat("[" + field + "]").EvalWithMetadb(metadb) ? fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb) : fb.TitleFormat("[" + field + "]").Eval(true);
    }
    
    function on_metadb_changed() {
       if (!metadb)
          return;
       artist = Eval("%artist%");
       if (artist != old_artis || select_p_a != select_p_a_old) {
          CollectGarbage();
          g_img = null;
          files = [];
          del_files_from_dir();
          selected = 0;
          s_text = 0;
          text = "";
          get_b_text_array()
          get_pic();
          old_artis = artist;
          select_p_a_old = select_p_a;
       }
    }
    
    function get_pic() {
       var url1 = ("http://www.last.fm/music/" + encodeURIComponent(artist) + "/+" + p_a[select_p_a]);
       xmlhttp.open("GET", url1, true);
       xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
       xmlhttp.send();
       xmlhttp.onreadystatechange = function () {
          if (xmlhttp.readyState == 4) {
             if (xmlhttp.status == 200) {
                doc.open();
                var div = doc.createElement("div");
                div.innerHTML = xmlhttp.responsetext;
                var data = div.getElementsByTagName("img");
                var urls = [];
                for (i = 0; i < data.length; i++) {
                   if (data[i].className == "image-list-image") {
                      if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/avatar170s") == 0)
                         urls.push(data[i].src.replace("avatar170s", ""));
                   }
                   if (data[i].className == "album-grid-album-art") {
                      if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/300") == 0 && data[i].src.indexOf("c6f59c1e5e7240a4c0d427abd71f3dbb") < 0)
                         urls.push(data[i].src.replace("300", ""));
                   }
                }
                for (i = 0; i < Math.min(urls.length, limit); i++) {
                   file = "\"" + tmp_b_path + artist + "_" + i + "_" + p_a[select_p_a] + ".jpg" + "\"";
                   WshShell.Run(vbs + " " + urls[i] + " " + file, false);
                }
                doc.close();
             }
             get_b_text();
          }
       }
    }
    
    function get_files_from_dir() {
       files = [];
       var e = new Enumerator(fso.GetFolder(tmp_b_path).Files);
       while (!e.atEnd()) {
          var name = e.item().Name;
          if (name.indexOf(artist) == 0) {
             files.push(tmp_b_path + name);
          }
          e.moveNext();
       }
    }
    
    /*function get_files_from_dir() {
    files = [];
    files = utils.Glob(tmp_b_path + artist + "*.*").toArray();
    }
     */
    function get_b_text() {
       var url2 = ("http://www.last.fm/" + abc_lang[abc] + "music/" + encodeURIComponent(artist) + "/+wiki");
       xmlhttp.open("GET", url2, true);
       xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
       xmlhttp.send();
       xmlhttp.onreadystatechange = function () {
          if (xmlhttp.readyState == 4) {
             if (xmlhttp.status == 200) {
                doc.open();
                var div = doc.createElement("div");
                div.innerHTML = xmlhttp.responsetext;
                var data = div.getElementsByTagName("div");
                for (i = 0; i < data.length; i++) {
                   if (data[i].className == "wiki-content") {
                      text = strip_tags(data[i].innerHTML);
                      break;
                   }
                }
                doc.close();
    
             }
             if (text == "")
                text = if_not_found[abc];   // text = if_not_found[abc];
             get_b_text_array();
          }
       }
    }
    
    function strip_tags(t) {
       doc.open();
       var div = doc.createElement("div");
       div.innerHTML = t.replace(/<[Pp][^>]*>/g, "").replace(/<\/[Pp]>/g, "<br>").replace(/\n/g, "<br>");
       var text = div.innerText;
       doc.close();
       return text;
    }
    
    function get_b_text_array() {
       artist_x = txt_x + t_margin;
       artist_y = txt_y + t_margin;
       strings_array = [];
       b_text_array = [];
    
       temp_bmp = gdi.CreateImage(1, 1);
       temp_gr = temp_bmp.GetGraphics();
    
       b_x = txt_x + t_margin;
       b_y = txt_y + temp_gr.CalcTextHeight("text", a_font) + t_margin * 2;
    
       b_text_row_height = temp_gr.CalcTextHeight("text", b_font)
          string_width = Math.max(ww - b_x - 10, 0);
    
       if (text)
          strings_array = temp_gr.EstimateLineWrap(text, b_font, string_width).toArray();
    
       for (var i = 0; i < strings_array.length; i += 2) {
          b_text_array.push(strings_array[i].replace(/^\s+|\s+$/g, ""));
       }
    
       b_text_rows = b_text_array.length;
       b_text_visable_rows = Math.round((wh - b_y - 10) / b_text_row_height);
       b_text_visable_height = Math.round(wh - b_y - 10);
    
       temp_bmp.ReleaseGraphics(temp_gr);
       temp_bmp.Dispose();
       temp_gr = null;
       temp_bmp = null;
    
       if (b_text_visable_rows + s_text > b_text_rows && s_text > 0) {
          s_text = b_text_rows - b_text_visable_rows;
       };
    
       scrollbar_k = b_text_visable_height / b_text_rows;
       window.Repaint();
    }
    
    function on_mouse_rbtn_up(x, y) {
       var _menu = window.CreatePopupMenu();
       var _firstgroup = window.CreatePopupMenu();
       var i = 1;
    
       MF_ENABLED = 0x00000000;
       MF_GRAYED = 0x00000001;
       MF_SEPARATOR = 0x00000800;
       
       _firstgroup.AppendTo(   _menu, MF_ENABLED, "Language / Язык");
       
       _firstgroup.AppendMenuItem(MF_ENABLED, 101, "EN - English");
       _firstgroup.AppendMenuItem(MF_ENABLED, 102, "RU - Русский");
       _firstgroup.AppendMenuItem(MF_ENABLED, 103, "ES - Español");
       _firstgroup.AppendMenuItem(MF_ENABLED, 104, "FR - Français");
       _firstgroup.AppendMenuItem(MF_ENABLED, 105, "IT - Italiano");
       _firstgroup.AppendMenuItem(MF_ENABLED, 106, "JA - 日本語");
       _firstgroup.AppendMenuItem(MF_ENABLED, 107, "PL - Polski");
       _firstgroup.AppendMenuItem(MF_ENABLED, 108, "PT - Português");
       _firstgroup.AppendMenuItem(MF_ENABLED, 109, "DE - Deutsch");
       _firstgroup.AppendMenuItem(MF_ENABLED, 110, "SV - Svenska");
       _firstgroup.AppendMenuItem(MF_ENABLED, 111, "TR - Türkçe");
       _firstgroup.AppendMenuItem(MF_ENABLED, 112, "ZH - 中国人");
    
       _menu.CheckMenuRadioItem(101, 112, abc + 101);
       _menu.EnableMenuItem(abc + 101, 1);
    
       _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    
       _menu.AppendMenuItem(MF_ENABLED, 3, _("Prefer now playing"));
       _menu.AppendMenuItem(MF_ENABLED, 4, _("Follow selected track"));
       _menu.CheckMenuRadioItem(3, 4, selection_mode + 3);
       _menu.EnableMenuItem(selection_mode + 3, 1);
    
       _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
       _menu.AppendMenuItem(MF_ENABLED, 5, _("Artist pictures"));
       _menu.AppendMenuItem(MF_ENABLED, 6, _("Albums pictures"));
       _menu.CheckMenuRadioItem(5, 6, select_p_a + 5);
       _menu.EnableMenuItem(select_p_a + 5, 1);
    
       _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
       var is_artist = artist ? MF_ENABLED : MF_GRAYED;
       _menu.AppendMenuItem(is_artist, 7, _("last.fm Artist"));
    
       //    if (ShiftDown) {
    
    if (("Reload" in window)) {
       _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
      _menu.AppendMenuItem(MF_ENABLED, 10, _("Reload"));
      }
       _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
       _menu.AppendMenuItem(MF_ENABLED, 20, _("Properties"));
       _menu.AppendMenuItem(MF_ENABLED, 30, _("Configure..."));
       //    }
    
       ret = _menu.TrackPopupMenu(x, y);
    
       switch (ret) {
       case 101:
          abc = 0;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 102:
          abc = 1;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 103:
          abc = 2;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 104:
          abc = 3;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 105:
          abc = 4;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 106:
          abc = 5;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 107:
          abc = 6;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 108:
          abc = 7;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 109:
          abc = 8;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 110:
          abc = 9;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 111:
          abc = 10;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 112:
          abc = 11;
          window.SetProperty("abc", abc);
          s_text = 0;
          text = "";
          get_b_text();
          break;
       case 3:
          selection_mode = 0;
          window.SetProperty("selection_mode", selection_mode);
          on_item_focus_change();
          break;
       case 4:
          selection_mode = 1;
          window.SetProperty("selection_mode", selection_mode);
          on_item_focus_change();
          break;
       case 5:
          select_p_a = 0;
          window.SetProperty("pictures/albums", select_p_a);
          on_metadb_changed();
          break;
       case 6:
          select_p_a = 1;
          window.SetProperty("pictures/albums", select_p_a);
          on_metadb_changed();
          break;
       case 7:
          WshShell.run("http://www.last.fm/" + abc_lang[abc] + "music/" + encodeURIComponent(artist));
          break;
       case 10:
          window.Reload();
          break;
       case 20:
          window.ShowProperties();
          break;
       case 30:
          window.ShowConfigure();
          break;
       }
       _menu.Dispose();
       return true;
    }
    
    var timer = window.SetInterval(on_timer, 1000);
    var step = 0;
    var set_cycle = false;
    var dis_timer, dis = 0;
    
    function on_timer(id) {
       step = set_cycle || cycle == 0 ? 0 : step + 1;
       if (files.length == 0) {
          get_files_from_dir();
          window.Repaint();
       };
    
       if (cycle > 0 && step >= cycle) {
          selected = selected >= files.length - 1 ? 0 : selected = selected + 1;
          window.Repaint();
          step = 0;
       }
    }
    
    function on_key_down(vkey) {
       if (vkey == 16) {
          set_cycle = true;
          dis_set();
          window.Repaint();
       }
    }
    
    function dis_set() {
       dis = 0;
       dis_timer && window.ClearInterval(dis_timer);
       dis_timer = window.SetInterval(function () {
             if (set_cycle) {
                dis++;
                if (dis == 1) {
                   set_cycle = false;
                   window.ClearInterval(dis_timer);
                   window.Repaint();
                };
             }
          }, 1000);
    }
    
    var delay = false;
    
    function fdelay() {
       var delay_timer = window.SetTimeout(function () {
             delay = false;
             window.ClearTimeout(delay_timer);
          }, 200);
    }
    
    function del_files_from_dir() {
       var del_files = [];
       var e = new Enumerator(fso.GetFolder(tmp_b_path).Files);
       while (!e.atEnd()) {
          var name = e.item().Name;
          try {
             fso.deleteFile(tmp_b_path + name);
          } catch (e) {};
          e.moveNext();
       }
    }
    
    /*
    function del_files_from_dir() {
    del_files = [];
    del_files = utils.Glob(tmp_b_path + "*.*").toArray();
    
    
    for (i in del_files) {
    try {
    fso.deleteFile(del_files[i]);
    } catch(e) {};
    }
    }
     */
    
    function load_last_fm_logo() {
       if (!fso.FileExists(tmp_b_path + "\\download\\" + "last_fm_logo.jpg")) {
          var url = "http://www.last.fm/static/images/logo_beta.png?eb6d3ca20e73"
             var file = "\"" + tmp_b_path + "\\download\\" + "last_fm_logo.jpg" + "\"";
          WshShell.Run(vbs + " " + url + " " + file, false);
          var url = "http://static-web.last.fm/static/images/favicon.702b239b6194.ico"
             var file = "\"" + tmp_b_path + "\\download\\" + "last_fm_ico.ico" + "\"";
          WshShell.Run(vbs + " " + url + " " + file, false);
       }
    }
    
    function create_download_file() {
       try {
          file = fso.CreateTextFile(tmp_b_path + "\\download\\" + "download.vbs")
    
             var text =
             "If (WScript.Arguments.Count <> 2) Then" + "\n\r" +
             "   WScript.Quit" + "\n\r" +
             "End If" + "\n\r" + "\n\r" +
    
             "url = WScript.Arguments(0)" + "\n\r" +
             "file = WScript.Arguments(1)" + "\n\r" + "\n\r" +
    
             "Set objFSO = Createobject(" + '"Scripting.FileSystemObject"' + ")" + "\n\r" +
             "If objFSO.Fileexists(file) Then" + "\n\r" +
             "   Set objFSO = Nothing" + "\n\r" +
             "   WScript.Quit" + "\n\r" +
             "End If" + "\n\r" + "\n\r" +
    
             "Set objXMLHTTP = CreateObject(" + '"MSXML2.XMLHTTP"' + ")" + "\n\r" +
             "objXMLHTTP.open " + '"GET"' + ", url,false" + "\n\r" +
             "objXMLHTTP.send()" + "\n\r" + "\n\r" +
    
             "If objXMLHTTP.Status = 200 Then" + "\n\r" +
             "   Set objADOStream = CreateObject(" + '"ADODB.Stream"' + ")" + "\n\r" +
             "   objADOStream.Open" + "\n\r" +
             "   objADOStream.Type = 1" + "\n\r" +
             "   objADOStream.Write objXMLHTTP.ResponseBody" + "\n\r" +
             "   objADOStream.Position = 0" + "\n\r" +
             "   objADOStream.SaveToFile file" + "\n\r" +
             "   objADOStream.Close" + "\n\r" +
             "   Set objADOStream = Nothing" + "\n\r" +
             "End If" + "\n\r" + "\n\r" +
    
             "Set objFSO = Nothing" + "\n\r" +
             "Set objXMLHTTP = Nothing";
    
          file.WriteLine(text);
          file.Close();
       } catch (e) {};
    }
    
    function on_mouse_move(x, y) {
       window.SetCursor(32649);
    
       text_scroll = x >= txt_x && x < ww - 20 && y >= txt_y ? true : false;
       sb_scroll = x > ww - 20 && y >= txt_y ? true : false;
       pic_scroll = !text_scroll && !sb_scroll ? true : false;
    
       if (k_down) {
          txt_x = x - delta_x;
          txt_y = y - delta_y;
    
          txt_x = txt_x <= 0 ? 0 : txt_x >= ww - 50 ? ww - 50 : txt_x;
          txt_y = txt_y <= 0 ? 0 : txt_y >= wh - 50 ? wh - 50 : txt_y;
          get_b_text_array();
       }
    
       if (sb_down && scrollbar) {
          posy = y + delta_y;
          s_text = y + delta_y >= 0 ? y + delta_y <= (b_text_rows - b_text_visable_rows) * scrollbar_k ? Math.round(posy / scrollbar_k) : b_text_rows - b_text_visable_rows : 0;
          window.Repaint();
       }
    }
    
    function on_mouse_wheel(delta) {
       ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
    
       if (!delay && pic_scroll && !ShiftDown) {
          delay = true;
          fdelay();
          get_files_from_dir();
          if (delta < 0) {
             selected = selected <= 0 ? files.length - 1 : selected = selected - 1
          };
          if (delta > 0) {
             selected = selected >= files.length - 1 ? 0 : selected = selected + 1
          };
    
       }
    
       if (text_scroll && !ShiftDown) {
          if (b_text_rows > b_text_visable_rows) {
             if (delta < 0) {
                s_text = b_text_rows - s_text <= b_text_visable_rows ? b_text_rows - b_text_visable_rows : s_text += 1
             }
             if (delta > 0) {
                s_text = s_text <= 0 ? 0 : s_text -= 1
             }
    
          }
       }
    
       if (!delay && text_scroll && ShiftDown) {
          delay = true;
          fdelay();
          if (delta < 0) {
             font_size_b = font_size_b <= min_font_size ? min_font_size : font_size_b - 2;
          };
          if (delta > 0) {
             font_size_b = font_size_b >= max_font_size ? max_font_size : font_size_b + 2;
          };
          window.SetProperty("font size: biography", font_size_b);
          get_font();
          get_b_text_array();
       }
    
       if (set_cycle && pic_scroll) {
          if (delta < 0) {
             cycle = cycle <= 0 ? 0 : cycle - 5;
          };
          if (delta > 0) {
             cycle = cycle >= 60 ? 60 : cycle + 5;
          };
          window.SetProperty("auto cycle (sec)", cycle);
    
       }
       window.Repaint();
    }
    
    function on_mouse_lbtn_down(x, y) {
       if (text_scroll) {
          k_down = true;
          delta_x = x - txt_x;
          delta_y = y - txt_y;
       }
       if (sb_scroll) {
          sb_down = true;
          posy = s_text * scrollbar_k;
          delta_y = posy - y;
       }
    }
    
    function on_mouse_lbtn_up(x, y) {
       window.SetProperty("txt_x", txt_x);
       window.SetProperty("txt_y", txt_y);
       k_down = false;
       sb_down = false;
    }
    
    function on_mouse_lbtn_dblclk(x, y) {
       if (text_scroll) {
          abc = abc == 1 ? 0 : 1;
          window.SetProperty("abc", abc);
          s_text = 0;
          b_text_array = [];
          text = "";
          get_b_text();
       }
       if (files[selected] && pic_scroll)
          WshShell.run('"' + files[selected] + '"');
    }
    
    function on_mouse_leave() {
       window.SetCursor(32512);
       window.Repaint();
    }
    
    function on_size() {
       ww = window.Width;
       wh = window.Height;
    
       txt_x = window.GetProperty("txt_x");
       txt_y = window.GetProperty("txt_y");
    
       txt_x = txt_x >= ww - 50 && txt_x >= 0 ? ww - 50 : txt_x;
       txt_y = txt_y >= wh - 50 && txt_y >= 0 ? wh - 50 : txt_y;
    
       get_b_text_array();
    }
    Последний раз редактировалось MC Web; 02.03.2016 в 15:39.

  5. #25
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    1 466

    Скрипт WSH Biography Text & Album Info & Picture Rus (kgena_ua)

    Кодировка должна быть UTF-8.

    Дальнейшее развитие панели для отображения биографии исполнителя с возможностью выбора фото исполнителя или обложек альбома с Last.fm (страничка оригинального скрипта от kgena_ua находится здесь).



    ВОЗМОЖНОСТИ:
    • Выбор языка для выводимой информации (английский / русский);
    • Не сохраняет получаемую информацию в папке foobar2000, при выборе Сохранять изображения и текст - будет сохранять все скаченные файлы в соответствующих папках, которые будут находится в папке tmp_Biography (необходимо, если потребуется работа скрипта при отсутствии Интернет);
    • Перемещение поля с текстом - мышь при нажатой ЛКМ на тексте;
    • Прокрутка текста - колесо мыши на тексте;
    • Прокрутка изображений - колесо мыши на изображении;
    • Двойной щелчок на изображении - переключение режимов Фото исполнителя / Обложка альбома;
    • При включении Информация об альбоме в режиме Обложка альбома будет выводится информация об отображаемом в панели альбоме (информация не для всех альбомов есть и чаще на английском языке);
    • Установка времени смены изображения ( от 0 до 60 секунд с шагом 5) - SHIFT + колесо мыши на изображении;
    • Изменение размера шрифта (12 - 16) - SHIFT + колесо мыши на тексте;
    • Пункт меню Страничка исполнителя на Last.fm / Альбом исполнителя на Last.fm - переходит на страницу Last.fm в зависимости от выбранного языка;
    • Пункт меню Копировать в папку с треком... - откроется окно с указанием места, куда будет производится копирование;
    • Качество изображения: низкое, среднее, высокое - выбор примерного разрешения скачиваемых изображений, соответственно: менее 300, более 300, более 770;
    • Открыть изображение - открывает изображения для просмотра во внешней программе просмотра, заданной по умолчанию Windows;
    • Включение / отключение nocover через меню Свойства WSH. При отключенном nocover логотип last fm;
    • Включение / отключение scrollbar через меню Свойства WSH;
    • Максимально выведены в меню Свойства WSH необходимые для пользователя настройки;
    • Размер шрифта для исполнителя привязан к размеру шрифта биографии через переменную font size: artist (delta) в меню Свойства WSH.

    Код:
    // ==PREPROCESSOR==
    // @name "Biography Text & Album Info & Picture. www.last.fm"
    // @author "kgena_ua"
    // @version "01032017"
    // @feature "v1.4"
    // @feature "watch-metadb"
    // ==/PREPROCESSOR==
    
    function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
    function RGBA(r,g,b,a) { return ((a << 24) | (r << 16) | (g << 8) | (b)); }
    function getRed(color) {return ((color >> 16) & 0xff);};
    function getGreen(color) {return ((color >> 8) & 0xff);};
    function getBlue(color) {return (color & 0xff);};
    
    DT_LEFT = 0x00000000;
    DT_RIGHT = 0x00000002;
    DT_CENTER = 0x00000001;
    DT_VCENTER = 0x00000004;
    DT_SINGLELINE = 0x00000020;
    DT_WORD_ELLIPSIS = 0x00040000;
    DT_WORDBREAK = 0x00000010;
    DT_CALCRECT = 0x00000400;
    DT_NOPREFIX = 0x00000800;
    
    MF_ENABLED = 0x00000000;   
    MF_GRAYED = 0x00000001;   
    MF_SEPARATOR = 0x00000800;  
    
    var ww = 600, wh = 600;
    
    var font_name_h = window.GetProperty(" font name: artist", "Verdana");      ////
    var font_name_t = window.GetProperty(" font name: biography", "Arial");
    var font_size_h = window.GetProperty("font size: artist", 16);              ////
    var font_size_t = window.GetProperty("font size: biography", 12);
    var h_font_style = window.GetProperty(" font style: artist", 2);            ////
    var t_font_style = window.GetProperty(" font style: biography", 0);
    var min_font_size = window.GetProperty(" font size: min", 12);
    var max_font_size = window.GetProperty(" font size: max", 16);
    var txt_shadow = window.GetProperty(" shadow of the text", false);
    
    var h1_font, h2_font, t_font;
    get_font();
    
    function get_font(){
        h1_font = gdi.Font(font_name_h, font_size_h, h_font_style);
        h2_font = gdi.Font(font_name_t, font_size_h, h_font_style);           ////
        t_font = gdi.Font(font_name_t, font_size_t, t_font_style);
    }   
    
    ColorTypeCUI = {
        text: 0,
        selection_text: 1,
        inactive_selection_text: 2,
        background: 3,
        selection_background: 4,
        inactive_selection_background: 5,
        active_item_frame: 6
    };
    
    ColorTypeDUI = {
    	text: 0,
    	background: 1,
    	highlight: 2,
    	selection: 3
    };
    
    function get_color(){   
        if (window.InstanceType == 0){
            bgcolor = window.GetColorCUI(ColorTypeCUI.background);
            h_color = window.GetColorCUI(ColorTypeCUI.text);
            t_color = window.GetColorCUI(ColorTypeCUI.inactive_selection_text);
        } else if (window.InstanceType == 1) { 
            bgcolor = window.GetColorDUI(ColorTypeDUI.background);
            h_color = window.GetColorDUI(ColorTypeDUI.text);
            t_color = window.GetColorDUI(ColorTypeDUI.highlight);
        }
        window.Repaint();
    };
    
    get_color();
    
    function on_colors_changed(){
        get_color();
    }
    
    
    var custom_colors = window.GetProperty(" colors: custom", true); 
    
    var c_bgcolor = customColor(window.GetProperty(" color: background", "19-30-38"));
    var c_h_color = customColor(window.GetProperty(" color: header", "128-192-255"));  
    var c_t_color = customColor(window.GetProperty(" color: text", "180-180-180"));
    
    bgcolor = custom_colors ? c_bgcolor : bgcolor;
    h_color = custom_colors ? c_h_color : h_color;
    t_color = custom_colors ? c_t_color : t_color;
    
    function customColor(colour){
       tempc = colour.split("-");
       return (0xff000000 | (tempc[0]<<16) | (tempc[1]<<8) | (tempc[2]));
    }
    
    var colors_swap = window.GetProperty(" colors: swap", false);
    var tmp_h_color = h_color;
    var tmp_t_color = t_color;
    h_color = !colors_swap ? tmp_h_color : tmp_t_color;
    t_color = !colors_swap ? tmp_t_color : tmp_h_color;
    
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    
    var tmp_b_path = fb.ProfilePath + "\\tmp_Biography\\";
    if (!fso.FolderExists(tmp_b_path)) {fso.CreateFolder(tmp_b_path)};
    
    var script_path = tmp_b_path + "_download\\";
    if (!fso.FolderExists(script_path)) {fso.CreateFolder(script_path)};
    if (!fso.FileExists(script_path + "download.vbs")) {create_download_file()};
    
    var doc = new ActiveXObject("htmlfile");
    var WshShell = new ActiveXObject("WScript.Shell");
    var vbs = "cscript //nologo \"" + script_path + "download.vbs\"";
    
    var default_img_path = window.GetProperty(" default img path",".\\tmp_Biography\\_download\\nocover.png");  ////
    var default_img = window.GetProperty(" default img", true);
    var default_img_transparent = window.GetProperty(" default img transparent (0-255)", 255);                  ////
    
    load_last_fm_logo();
    var logo_img = gdi.Image(script_path + "footer_logo.png");
    
    var artist = "", tf_artist = "", old_artist = "", album = "";
    var path, directory_path; 
    
    function clean_name(n) {
        if (!n) return;
        return n.replace(/[\.\/\:\*\?\"\<\>\|]/g,'').replace(/^\s+|\s+$/g,"").substr(0,200);
    }
    
    function artist_folder_path(n) {
        if (!n) return;
        return tmp_b_path + n;
    }
    
    function check_folder(n) {
        if (!n) return;
        try {
            if(!fso.FolderExists(n)) {fso.CreateFolder(n)};
        } catch(e) {}
    }
    
    function get_fn(p) {
        if (!p) return;
        return p.replace(/.*\\|\.[^.]+$/g,'')
    }
    
    function get_fnext(p) {
        if (!p) return;
        return p.replace(/.*\\/g,'');
    }
    
    String.prototype.repeat = function(n) {
        return new Array(n + 1).join(this);
    }
    
    window.SetProperty(" - user", "");
    if (window.GetProperty(" - user") != "" ) window.SetProperty(" - user", "");
    window.SetProperty("-".repeat(50), "");
    if (window.GetProperty("-".repeat(50)) != "" ) window.SetProperty("-".repeat(50), "");
    
    var g_img = null;
    var p_margin = window.GetProperty(" margin: picture", 0);
    var align_mode_a = new Array("Подогнать", "Подогнать сверху - по центру", "Подогнать сверху - слева", "По центру", "По центру - сверху", "Растянуть");
    var align_mode = window.GetProperty("align mode", 1);
    var selected = 0;
    var files = [];
    var images = [];
    var save_images = window.GetProperty("save images", false);
    var limit = window.GetProperty(" download limit",5);
    var cycle = window.GetProperty("auto cycle (sec)", 0);
    if (cycle > 0) set_cycle_timer();
    var cycle_txt_y = 20;
    var fader = 255;
    var fade_effect = window.GetProperty("fade effect", false);
    var fade_step = window.GetProperty("fade step", 25);
    var on_pic = false;
    var img_f_info = window.GetProperty(" img file info", false);
    
    var download_quality = window.GetProperty("download quality", 1);
    var quality = [
        [ "Низкое",    "avatar170s",   "avatar170s"],
        [ "Среднее", "300x300",      "300x300"],
        [ "Высокое",   "770x0",        "770x0"]
    ];
    
    var select_albums_order = window.GetProperty("select albums_order", 0);
    var albums_order = [
        ["Самые популярные", "", "popular"],                    // ["most popular", "", "popular"]
        ["Дата релиза", "?order=release_date", "release"]       // ["release date", "?order=release_date", "release"]
    ];
    
    var scrollbar = window.GetProperty(" scrollbar", true);
    var scrollbar_w = window.GetProperty(" scrollbar width ", 4);
    var scrollbar_k;
    var sb_x = 0;
    var sb_posy = 0;
    var on_sb = false;
    var on_sb_down = false;
    var sb_color;
    
    var bg_transparent = window.GetProperty(" bg transparent (0-255)", 200);
    var t_margin = window.GetProperty(" margin: text", 0);      // 10
    var txt_x = window.GetProperty("txt_x", window.Width / 2);
    var old_txt_x = 0;
    var txt_y = window.GetProperty("txt_y", window.Height / 2);
    var delta_x, delta_y;
    var h_x, h1_y, h2_y, t_x, t_x;
    var text;
    var text_array = [];
    var text_row_height;
    var text_rows;
    var text_visable_rows;
    var text_visable_height;
    var info_a_text;
    var text_not_found = new Array("\nНичего не найдено", "\nНичего не найдено");
    var s_text = 0;
    var h1_char_width;
    var h1_text_array = [];
    var h1_text_row_height;
    var h1_text_visable_rows;
    var h2_text_array = [];
    var h2_text_row_height;
    var h2_text_visable_rows;
    var on_text = false;
    var on_header = false;
    var on_text_down = false;
    var on_text_dblclk = false;
    var refresh_txt = true;
    var text_hiden = window.GetProperty("txt hiden", false);
    
    var album_info = window.GetProperty("album info", true);
    
    var lang_query = new Array("", "ru/");
    var lang_text = new Array("Английский", "Русский");
    
    //var lang_query = new Array("", "ru/", "zh/");
    //var lang_text = new Array("in", "ru", "zh");
    
    var lang = window.GetProperty("lang", 1);
    var language_tooltip = window.GetProperty(" language tooltip", true); 
    
    var select_p_a = window.GetProperty("artist/album", 0);
    var p_a = new Array("images", "albums");
    
    var panel_on = true;
    
    var selection_mode = window.GetProperty("selection mode", 0);
    var metadb;
    on_item_focus_change();
    
    var pos_x = 0, pos_y = 0;
    
    function on_paint(gr){   
       !window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
       
        if (!artist){
            txt_shadow && gr.GdiDrawText( "Ничего не найдено", gdi.Font("Arial",12, 0), RGB(0,0,0), 0 + 1, 0 + 2, ww, wh, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_WORD_ELLIPSIS ); 
            gr.GdiDrawText( "Ничего не найдено", gdi.Font("Arial",12, 0), h_color, 0, 0, ww, wh, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_WORD_ELLIPSIS ); 
        }
        
        draw_image(gr); 
    
        if(set_cycle && on_pic){   
            gr.FillSolidRect(0, 0, ww, wh, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),bg_transparent));   
            var txt_cycle = cycle == 0 ? "Отключено" : cycle + " сек.";  
            txt_shadow && gr.GdiDrawText("Зацикливание изображений\n" + txt_cycle, t_font, RGB(0,0,0), 0 + 1, cycle_txt_y + 2, ww, wh, DT_CENTER | DT_WORD_ELLIPSIS );
            gr.GdiDrawText("Зацикливание изображений\n" + txt_cycle, t_font, t_color, 0, cycle_txt_y, ww, wh, DT_CENTER | DT_WORD_ELLIPSIS );
        } else{   
            if (artist) gr.FillSolidRect(txt_x, txt_y, ww - txt_x, wh - txt_y, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),bg_transparent));   
        }   
    
        if(img_f_info && set_cycle && on_pic){   
            draw_img_file_info(gr);  
        }  
        
        draw_scrollbar(gr);    
        
        for (var i = 0; i < h1_text_visable_rows; i += 1) {
            try {
                txt_shadow && gr.GdiDrawText( h1_text_array[i], h1_font, RGB(0,0,0), h_x + 1, h1_y + h1_text_row_height * i + 2, ww, wh, DT_CENTER | DT_NOPREFIX );   
                gr.GdiDrawText( h1_text_array[i], h1_font, h_color, h_x, h1_y + h1_text_row_height * i, ww, wh, DT_CENTER | DT_NOPREFIX );   
            } catch(e) {}
        }
    
        if (album_info && select_p_a == 1){
            for (var i = 0; i < h2_text_visable_rows; i += 1) {
                try {
                    txt_shadow && gr.GdiDrawText( h2_text_array[i], h2_font, RGB(0,0,0), h_x + 1, h2_y + h2_text_row_height * i + 2, ww, wh, DT_CENTER | DT_NOPREFIX );   
                    gr.GdiDrawText( h2_text_array[i], h2_font, RGB(192,224,255), h_x, h2_y + h2_text_row_height * i, ww, wh, DT_CENTER | DT_NOPREFIX );   
                } catch(e) {}
            }
        }
    
        for (var i = 0; i < text_visable_rows * 2; i += 2) {
            try {
                txt_shadow && gr.GdiDrawText( text_array[i + s_text * 2].replace(/^\s+|\s+$/g, ""), t_font, RGB(0,0,0), t_x + 1, t_y + text_row_height * i / 2 + 2, ww, wh, DT_LEFT | DT_NOPREFIX );
                gr.GdiDrawText( text_array[i + s_text * 2].replace(/^\s+|\s+$/g, ""), t_font, t_color, t_x, t_y + text_row_height * i / 2 , ww, wh, DT_LEFT | DT_NOPREFIX );
            } catch(e) {}
        }
        
        draw_lang(gr);
    
        //gr.FillSolidRect(0, 0, ww, 50, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),180));
        
        gr.GdiDrawText( "", gdi.Font("Arial",12, 0), t_color, 10, 0, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS ); 
        gr.GdiDrawText( "" ,gdi.Font("Arial",12, 0), t_color, 10, 20, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS ); 
        gr.GdiDrawText( "", gdi.Font("Arial",12, 0), t_color, 10, 40, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS ); 
        gr.GdiDrawText( "", gdi.Font("Arial",12, 0), t_color, 10, 60, ww, wh, DT_LEFT | DT_WORDBREAK ); 
        gr.GdiDrawText( "", gdi.Font("Arial",12, 0), t_color, 10, 80, ww, wh, DT_LEFT | DT_WORDBREAK ); 
    }
    
    function draw_image(gr){
        if (g_img && images.length > 0){
            var size = calc_img_size(g_img);
            gr.DrawImage(g_img, size.x, size.y, size.width, size.height, size.cx, size.cy, size.cwidth, size.cheight, 0, fader);
        }
       
        if (logo_img && images.length == 0 && !default_img){
            gr.DrawImage(logo_img, 10, 10, logo_img.Width * 1, logo_img.Height * 1, 0, 0, logo_img.Width, logo_img.Height, 0, 100);          
        }
    
        if (images.length == 0 && default_img){
            try {
                nc_img = gdi.Image(default_img_path);
                var size = calc_img_size(nc_img);
                gr.DrawImage(nc_img, size.x, size.y, size.width, size.height, size.cx, size.cy, size.cwidth, size.cheight, 0, default_img_transparent);
            } catch(e) {};
        }
    }
    
    function draw_scrollbar(gr){
        scrollbar_h = text_rows > text_visable_rows ? text_visable_height * (text_visable_rows / text_rows) : 0;
        if (text_rows > text_visable_rows){ scrollbar_h = Math.max(5, scrollbar_h)}
        scrollbar_y = s_text > 0 ? s_text * scrollbar_k : 0;
    
        sb_x = ww - t_margin - scrollbar_w;
        
        sb_alpha = on_sb || on_sb_down ? 150 : 50;
        sb_color = RGBA(getRed(h_color), getGreen(h_color), getBlue(h_color), sb_alpha);
        
        scrollbar && gr.FillSolidRect(sb_x, t_y + scrollbar_y, scrollbar_w, scrollbar_h, sb_color);
    }
    
    function draw_img_file_info(gr){   
        txt_shadow && gr.GdiDrawText( img_file_info(), gdi.Font("Arial",12, 0), RGB(0,0,0), 0 + 1, cycle_txt_y + 2, ww, wh, DT_CENTER | DT_WORDBREAK | DT_NOPREFIX); 
        gr.GdiDrawText( img_file_info(), gdi.Font("Arial",12, 0), h_color, 0, cycle_txt_y, ww, wh, DT_CENTER | DT_WORDBREAK | DT_NOPREFIX); 
    }
    
    function draw_lang(gr){
        t = lang_text[lang].toUpperCase();
        t_h = gr.CalcTextHeight(t, h1_font) + 2;
        t_w = gr.CalcTextWidth(t, h1_font) + 12;
    
        on_text_dblclk && gr.FillSolidRect(pos_x - t_w * 0.7, pos_y - t_h - 8, t_w, t_h, t_color);
        on_text_dblclk && gr.GdiDrawText( t, h1_font, bgcolor, pos_x - t_w * 0.7, pos_y - t_h - 8, t_w, t_h, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
    }
    
    function on_playlist_switch() {
        on_item_focus_change();
    }
    
    function on_playback_new_track() {
        on_item_focus_change();
    }
    
    function on_playback_dynamic_info_track() {
        on_item_focus_change();
    }
    
    function on_playback_stop() {
        on_item_focus_change();
    }
    
    function on_selection_changed(metadb) {
       on_item_focus_change();
    }
    
    function on_item_focus_change() {
        switch (selection_mode) {
        case 0:
            metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();   
            break;   
        case 1:   
            metadb = fb.GetFocusItem();
            break;   
        }   
        if (metadb) on_metadb_changed();   
    }   
    
    function Eval(field) {   
        if (!metadb) return;   
        path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
        directory_path = fb.Titleformat("$directory_path(%path%)").EvalWithMetadb(metadb); 
        return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval(true) : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
    }   
    
    function on_metadb_changed() {
        if (!panel_on) return; 
        if (!metadb) return; 
        artist = Eval("$upper([%artist%])");    // вывод заглавными буквами
    //  artist = Eval("%artist%");
        tf_artist = Eval("$upper([%artist%])");    // вывод заглавными буквами
    //  tf_artist = Eval("%artist%");    
        artist = artist ? clean_name(artist) : "";
        tf_artist = tf_artist ? tf_artist : "";   
        
        if (artist != old_artist){
            check_folder(artist_folder_path(artist));
            if (!save_images) del_folders(artist);
            get_pic();
            old_artist = artist;
        }
    }    
    
    function get_pic() {
        clear_txt_var();
        img_nf = "",
        images = [];
        files = [];
        selected = 0;
        g_img = null;
        window.Repaint();
        
        if (fso.FolderExists(artist_folder_path(artist))){
            get_files_from_dir(artist_folder_path(artist));
            if (!g_img && images.length > 0) {
                next_image(0);
                get_text();
            } else {
                switch(select_p_a) {	
    	        case 0:	
                    get_lastFM_artist_img(artist_folder_path(artist));
                    break;
    	        case 1:
                    get_lastFM_album_img(artist_folder_path(artist));
                    break;
                }
            } 
        }
    }
    
    function get_files_from_dir(p) {
        if (!artist) return; 
    
        switch(select_p_a) {	
        case 0:	
            files = utils.Glob(p + "\\" + artist + "*" + p_a[select_p_a] + ".jpg").toArray();
            break;
        case 1:
            files = utils.Glob(p + "\\" + artist + "*" + p_a[select_p_a] + "_" + albums_order[select_albums_order][2] + ".jpg").toArray();
            break;
        }
    
        if (files.length > images.length){
            images = [];
            files = naturalSort(files);
            
            for (var i = 0; i < files.length; i += 1) {
                try {
                    images.push(resize_image(gdi.Image(files[i])));
                } catch(e) {}
            }
        }
    }
    
    function next_image(d){
        fader = fade_effect ? 0 : 255;
        if (d < 0) {selected = selected <= 0 ? images.length - 1 : selected = selected - 1};
        if (d > 0) {selected = selected >= images.length - 1 ? 0 : selected = selected + 1};
        g_img = images[selected];
        if (g_img && fade_effect) fader_timer();
        window.Repaint();
        if (album_info && select_p_a == 1) {get_text();}
    }
    
    function resize_image(img){
        if (!img || !ww || !wh) return;
        
        var scale_w = ww / img.Width;
        var scale_h = wh / img.Height;
        var scale = Math.max(scale_w, scale_h);
    
        var nww = Math.round(img.Width * scale);
        var nwh = Math.round(img.Height * scale)
    
        return img.Resize(nww, nwh, 2);
        img && img.Dispose();
    }
    
    
    function get_text(){
        clear_txt_var();
        if (album_info && select_p_a == 1){
            get_a_text(selected);
        } else {
            get_b_text();
        }
    }
    
    function clear_txt_var() {
        album = "";
        s_text = 0;
        text = "";
        info_a_text = "";
        text_array = [];
        get_text_array();
        window.Repaint();
    }
    
    function get_b_text() {
        //clear_txt_var(); 
        refresh_txt = true;
        var b_text_file = artist_folder_path(artist) + "\\" + artist + "_biography_" + lang_text[lang] + ".txt";
    
        if (fso.FolderExists(artist_folder_path(artist))){
            if (fso.FileExists(b_text_file)){
                text = utils.ReadTextFile(b_text_file);
                get_text_array();
            } else{
                get_lastFM_b_text(b_text_file);
            }
        }
    }
    
    function strip_tags(t) {
        doc.open();
        var div = doc.createElement("div");
        div.innerHTML = t.replace(/<[Pp][^>]*>/g, "").replace(/<\/[Pp]>/g, "<br>").replace(/\n/g, "<br>");
        var text = div.innerText;
        doc.close();
        return text;
    }
    
    function get_text_array() {
        h_x = txt_x + t_margin;
        h1_y = txt_y + t_margin;
        t_x = txt_x + t_margin;
        
        h_string_width = scrollbar ? Math.max(ww - t_x - t_margin, 0) : Math.max(ww - t_x - t_margin, 0);
        string_width = scrollbar ? Math.max(ww - t_x - t_margin - scrollbar_w - 10, 0) : Math.max(ww - t_x - t_margin, 0);
      
        temp_bmp = gdi.CreateImage(1, 1);
        temp_gr = temp_bmp.GetGraphics();
        
        if (artist) h1_char_width = temp_gr.CalcTextWidth(artist.substr(0,1), h1_font);
    
        h1_text_row_height = temp_gr.CalcTextHeight("Header_1", h1_font);
        h1_text_visable_area = Math.floor(Math.max(0, window.Height - t_margin - h1_y));
        h1_text_visable_rows = Math.max(1, Math.floor(h1_text_visable_area / h1_text_row_height));
    
        h1_text_array = [];
        var h1_text_array_tmp = temp_gr.EstimateLineWrap(tf_artist.replace(/^\s+|\s+$/g, ""), h1_font, h_string_width).toArray();
    
        for (var i = 0; i < h1_text_array_tmp.length; i += 2) {
            h1_text_array.push(h1_text_array_tmp[i].replace(/^\s+|\s+$/g, ""));
        }
    
        h2_y = h1_y + h1_text_array.length * h1_text_row_height;
    
        h2_text_row_height = temp_gr.CalcTextHeight("Header_2", h2_font);
        h2_text_visable_area = Math.floor(Math.max(0, window.Height - t_margin - h2_y));
        h2_text_visable_rows = Math.floor(h2_text_visable_area / h2_text_row_height);
    
        h2_text_array = [];
        var h2_text_array_tmp = temp_gr.EstimateLineWrap(album.replace(/^\s+|\s+$/g, ""), h2_font, h_string_width).toArray();
    
        for (var i = 0; i < h2_text_array_tmp.length; i += 2) {
            h2_text_array.push(h2_text_array_tmp[i].replace(/^\s+|\s+$/g, ""));
        }
        
        text_row_height = temp_gr.CalcTextHeight("Biography", t_font);
        
        t_y = (album_info && select_p_a == 1 ? h2_y + h2_text_array.length * h2_text_row_height : h1_y + h1_text_array.length * h1_text_row_height) + text_row_height;
    
        if (Math.abs(txt_x - old_txt_x) > 5 || refresh_txt){
            text_array = [];
            if (text || info_a_text) text_array = temp_gr.EstimateLineWrap(info_a_text + text, t_font, string_width).toArray();
            old_txt_x = txt_x;
            refresh_txt = false;
        }
        
        text_rows = text_array.length / 2;
    
        b_text_visable_area = Math.floor(Math.max(0, window.Height - t_margin - t_y));
        text_visable_rows = Math.floor(b_text_visable_area / text_row_height);
        text_visable_height = text_visable_rows * text_row_height;
    
        if (text_visable_rows + s_text > text_rows && s_text > 0) {
            s_text = (text_rows - text_visable_rows);
        }
    
        scrollbar_k = text_visable_height / text_rows;
        
        temp_bmp.ReleaseGraphics(temp_gr);
        temp_bmp.Dispose();
        temp_gr = null;
        temp_bmp = null;
        window.Repaint();
    }
    
    function save_txt_file(t, p){
        if (!artist) return; 
        if (fso.FolderExists(artist_folder_path(artist))){
            try {
                file = fso.OpenTextFile( p, 2, true, -1)
                file.Write(t);
                file.Close();
            } catch(e) {
                return;
            }
        }
    }
    
    function on_mouse_rbtn_up (x, y){     
        var _menu = window.CreatePopupMenu();
        
        _menu.AppendMenuItem(MF_ENABLED, 10, lang_text[0] + " язык");   
        _menu.AppendMenuItem(MF_ENABLED, 11, lang_text[1] + " язык");   
    //  _menu.AppendMenuItem(MF_ENABLED, 12, lang_text[2] + " text");   // китайский язык 
        _menu.CheckMenuRadioItem(10, 12, lang + 10);         
        _menu.EnableMenuItem(lang + 10, 1);     
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
        _menu.AppendMenuItem(MF_ENABLED, 20, "Предпочитать воспроизводимый");   
        _menu.AppendMenuItem(MF_ENABLED, 21, "Следовать за выбранным треком");   
        _menu.CheckMenuRadioItem(20, 21 , selection_mode + 20);   
        _menu.EnableMenuItem(selection_mode + 20, 1);
           
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);  
        _menu.AppendMenuItem(MF_ENABLED, 30, "Фото исполнителя");   
        _menu.AppendMenuItem(MF_ENABLED, 31, "Обложка альбома");   
        _menu.CheckMenuRadioItem(30, 31 , select_p_a + 30);   
        _menu.EnableMenuItem(select_p_a + 30, 1);
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);  
        _menu.AppendMenuItem(MF_ENABLED, 40, "Информация об альбоме");
        _menu.CheckMenuItem(40, album_info);
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
        _menu.AppendMenuItem(MF_ENABLED, 41, "Порядок альбомов: " + albums_order[0][0]);   
        _menu.AppendMenuItem(MF_ENABLED, 42, "Порядок альбомов: " + albums_order[1][0]);   
        _menu.CheckMenuRadioItem(41, 42 , select_albums_order + 41);   
        _menu.EnableMenuItem(select_albums_order + 41, 1);
     
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
        IS_ARTIST = artist ? MF_ENABLED : MF_GRAYED;   
        _menu.AppendMenuItem(IS_ARTIST, 50, "Страничка исполнителя на Last.fm");
        _menu.AppendMenuItem(IS_ARTIST, 51, "Альбомы исполнителя на Last.fm: " + albums_order[select_albums_order][0]);
        
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
        _menu.AppendMenuItem(MF_ENABLED, 60, "Эффект плавного перехода");
        _menu.CheckMenuItem(60, fade_effect);
    
        _firstgroup = window.CreatePopupMenu();
        _firstgroup.AppendTo(_menu,MF_ENABLED,  "Выравнивание : " + align_mode_a[align_mode]);
        
        _firstgroup.AppendMenuItem(MF_ENABLED, 70, align_mode_a[0]);			
        _firstgroup.AppendMenuItem(MF_ENABLED, 71, align_mode_a[1]);
        _firstgroup.AppendMenuItem(MF_ENABLED, 72, align_mode_a[2]);
        _firstgroup.AppendMenuItem(MF_ENABLED, 73, align_mode_a[3]);
        _firstgroup.AppendMenuItem(MF_ENABLED, 74, align_mode_a[4]);
        _firstgroup.AppendMenuItem(MF_ENABLED, 75, align_mode_a[5]);
        _firstgroup.CheckMenuRadioItem(70, 75, align_mode + 70);
        _firstgroup.EnableMenuItem(align_mode + 70, 1);
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
        _secondgroup = window.CreatePopupMenu();
        _secondgroup.AppendTo(_menu,MF_ENABLED,  "Качество изображения : " + quality[download_quality][0]);
        
        _secondgroup.AppendMenuItem(MF_ENABLED, 80, quality[0][0]);
        _secondgroup.AppendMenuItem(MF_ENABLED, 81, quality[1][0]);
        _secondgroup.AppendMenuItem(MF_ENABLED, 82, quality[2][0]);
        _secondgroup.CheckMenuRadioItem(80, 82, download_quality + 80);
        _secondgroup.EnableMenuItem(download_quality + 80, 1);
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
        _thirdgroup = window.CreatePopupMenu();
        
        MF_STRING = images.length > 0 ? MF_ENABLED : MF_GRAYED;
        _thirdgroup.AppendTo(_menu,MF_STRING,  "Копировать в папку с треком...");
        
        _thirdgroup.AppendMenuItem(MF_STRING, 90, "Копировать файл");
        _thirdgroup.AppendMenuItem(MF_STRING, 91, "Копировать файлы");
        
        _menu.AppendMenuItem(MF_STRING, 100, "Открыть изображение");
        
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
        _menu.AppendMenuItem(MF_ENABLED, 110, "Сохранять изображения и текст");
        _menu.CheckMenuItem(110, save_images);
        
        //_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
        //_menu.AppendMenuItem(MF_ENABLED, 120, "Загрузить обложку альбома с LastFM");
    
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
        _menu.AppendMenuItem(MF_ENABLED, 500, "Перезагрузить");   
        _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);   
        _menu.AppendMenuItem(MF_ENABLED, 510, "Свойства WSH");   
        _menu.AppendMenuItem(MF_ENABLED, 520, "Настройки WSH...");
    
        ret = _menu.TrackPopupMenu(x,y);
    
        switch (ret) {
        case 10:
        case 11:
        case 12:
            lang = ret - 10;
            window.SetProperty("lang", lang);
            get_text();
            language_tooltip && lang_tooltip();
            break;
        case 20:
            selection_mode = 0;
            window.SetProperty("selection mode", selection_mode);
            on_item_focus_change();
            break;
        case 21:
            selection_mode = 1;
            window.SetProperty("selection mode", selection_mode);
            on_item_focus_change();
            break;
        case 30:
            select_p_a = 0;
            window.SetProperty("artist/album", select_p_a);
            get_pic();
            break;
        case 31:
            select_p_a = 1;
            window.SetProperty("artist/album", select_p_a);
            get_pic();
            break;
        case 40:
            window.SetProperty("album info", ! album_info);
            album_info = window.GetProperty("album info");
            get_text();
            break;
        case 41:
        case 42:
            select_albums_order = ret - 41;
            window.SetProperty("select albums_order", select_albums_order);
            get_pic();
            break;
        case 50:
            WshShell.run("https://www.last.fm/" + lang_query[lang] + "music/" + encodeURIComponent(artist));
            break;
        case 51:
            WshShell.run("https://www.last.fm/" + lang_query[lang] + "music/" + encodeURIComponent(artist) + "/" + "+albums" + albums_order[select_albums_order][1]);
            break;
        case 60:
            window.SetProperty("fade effect", !fade_effect);
            fade_effect = window.GetProperty("fade effect");
            break;
        case 70:
        case 71:
        case 72: 
        case 73:
        case 74:
        case 75:
            align_mode = ret - 70;
            window.SetProperty("align mode", align_mode);
            window.Repaint();
            break;
        case 80:
        case 81:
        case 82:    
            download_quality = ret - 80;
            window.SetProperty("download quality", download_quality);
            break;
        case 90:
            select_file = 0;
            copy_files();
            break;
        case 91:
            select_file = 1;
            copy_files();
            break;
        case 100:
            try {
               switch(select_p_a) {	
                case 0:	
                    if (images[selected]) WshShell.run( '"' + artist_folder_path(artist)+ "\\" + artist + "_"  + selected + "_" + p_a[select_p_a] + ".jpg" + '"' );
                    break;
                case 1:
                    if (images[selected]) WshShell.run( '"' + artist_folder_path(artist)+ "\\" + artist + "_"  + selected + "_" + p_a[select_p_a] + "_" +  albums_order[select_albums_order][2] + ".jpg" + '"' );
                     break;
                } 
            } catch(e) {}
            break;
        case 110:
            window.SetProperty("Save images", !save_images);
            save_images = window.GetProperty("Save images");
            break;
        case 120:
            //.......................;
            break;
        case 500:
            try {
                window.Reload();	
            } catch(e) {};
            break;
        case 510:
            window.ShowProperties();
            break;   
        case 520:
            window.ShowConfigure();   
            break;   
       }
        _menu.Dispose();   
        return true;   
    }   
    
    var timer;
    
    function get_files_if_loaded(p){
        timer && window.ClearInterval(timer);
        timer = window.SetInterval(function() {
            get_files_from_dir(p);
            for (var i = 0; i < files.length; i += 1) {
                if (get_fn(files[i]).replace(/^(.*?)_|_.*/g,'') == 0 && images.length > 0) {
                    next_image(0);
                    window.ClearInterval(timer); 
                 }                 
            }
        }, 500 );
    }
    
    var set_cycle = false;
    
    function on_key_down(vkey) {
        if (vkey == 16){
            set_cycle = true;
            dis_set();
            window.Repaint();
        }
    }
    
    var cycle_timer, step = 0;
    
    function set_cycle_timer(){
    ****cycle_timer && window.ClearInterval(cycle_timer);
    ****cycle_timer = window.SetInterval(function() {
            step =  set_cycle ? 0 : step + 1;
            if (cycle > 0 && step >= cycle){
                get_files_from_dir(artist_folder_path(artist));
                if (images.length > 1){
                    next_image(1);
                    step = 0;
                }
            }
            window.Repaint(); 
    ****}, 1000 );
    }
    
    var dis_timer, dis = 0;
    
    function dis_set(){
        dis = 0;
    ****dis_timer && window.ClearInterval(dis_timer);
    ****dis_timer = window.SetInterval(function() {
            if (set_cycle) {
                dis++;
                if(dis == 1) {
                    set_cycle = false; 
                    if (cycle > 0) set_cycle_timer();
                    if (cycle == 0) window.ClearInterval(cycle_timer);
                    window.ClearInterval(dis_timer)
                    window.Repaint(); 
                };
            }
    ****}, 1000 );
    }
    
    var delay = false;
    
    function fdelay(){
        var delay_timer = window.SetTimeout(function() {
            delay = false;
            window.ClearTimeout(delay_timer);
        }, 200);
    }
    
    var ftimer;
    
    function fader_timer(){
        fader = 0;
    ****ftimer && window.ClearInterval(ftimer);
    ****ftimer = window.SetInterval(function() {
            fader = fader + fade_step;
            if (fader >= 255) {
                fader= 255;
                window.ClearInterval(ftimer);
            }
            window.Repaint(); 
    ****}, 42 ); 
    }
    
    var  tooltip_timer;
    
    function lang_tooltip() {
        on_text_dblclk = true;
        window.Repaint();
        tooltip_timer &&  window.ClearTimeout(tooltip_timer);
        tooltip_timer = window.SetTimeout(function() {
            on_text_dblclk = false;
            window.Repaint();
            tooltip_timer && window.ClearTimeout(tooltip_timer);
        }, 1500);
    }
    
    function load_last_fm_logo(){
        if(!fso.FileExists(script_path + "footer_logo.png")) {
            var url = "https://static-web.last.fm/static/images/favicon.702b239b6194.ico"
            var file = "\"" + script_path + "last_fm_ico.ico" + "\"";
            WshShell.Run(vbs + " " + url + " " + file, false);
    
            var url = "https://static-web.last.fm/static/images/footer_logo.ddcfd65712a6.png"
            var file = "\"" + script_path + "footer_logo.png" + "\"";
            WshShell.Run(vbs + " " + url + " " + file, false);
        }
    }
    
    /*
    var url = "http://www.last.fm/static/images/logo_static.png?7b581436b23f"
    var file = "\"" + script_path + "logo_static.png" + "\"";
    WshShell.Run(vbs + " " + url + " " + file, false);
            
    var url = "http://www.last.fm/static/images/logo_animate.gif?7b581436b23f"
    var file = "\"" + script_path + "logo_animate.gif" + "\"";
    WshShell.Run(vbs + " " + url + " " + file, false);
    */
    
    function create_download_file() {
        try {
            file = fso.CreateTextFile(script_path + "download.vbs" )
           
            var text =   
                "If (WScript.Arguments.Count <> 2) Then" + "\n\r" +   
                "   WScript.Quit" + "\n\r" +
                "End If" + "\n\r" + "\n\r" +   
    
                "url = WScript.Arguments(0)" + "\n\r" +   
                "file = WScript.Arguments(1)" + "\n\r"  + "\n\r" +   
    
                "Set objFSO = Createobject(" + '"Scripting.FileSystemObject"' + ")" + "\n\r" +   
                "If objFSO.Fileexists(file) Then" + "\n\r" +   
                "   Set objFSO = Nothing" + "\n\r" +
                "   WScript.Quit" + "\n\r" +
                "End If" + "\n\r" + "\n\r" +   
    
                "Set objXMLHTTP = CreateObject(" + '"MSXML2.XMLHTTP"' + ")" + "\n\r" +   
                "objXMLHTTP.open " + '"GET"' + ", url,false" + "\n\r" +   
                "objXMLHTTP.send()" + "\n\r" + "\n\r" +   
    
                "If objXMLHTTP.Status = 200 Then" + "\n\r" +   
                "   Set objADOStream = CreateObject(" + '"ADODB.Stream"' + ")" + "\n\r" +
                "   objADOStream.Open" + "\n\r" +
                "   objADOStream.Type = 1" + "\n\r" +
                "   objADOStream.Write objXMLHTTP.ResponseBody" + "\n\r" +
                "   objADOStream.Position = 0" + "\n\r" +
                "   objADOStream.SaveToFile file" + "\n\r" +
                "   objADOStream.Close" + "\n\r" +
                "   Set objADOStream = Nothing" + "\n\r" +
                "End If" + "\n\r" + "\n\r" +   
    
                "Set objFSO = Nothing" + "\n\r" +   
                "Set objXMLHTTP = Nothing"   
            ;
    
            file.WriteLine(text);
            file.Close();
        } catch(e) {};
    }
    
    function on_mouse_move(x, y) {
        window.SetCursor(32649);
        
        pos_x = x;
        pos_y = y; 
        if (on_text_dblclk) window.Repaint();
    
        on_header = x >= txt_x && x < ww && y >= txt_y && y < t_y ? true : false;
        on_text = x >= txt_x && x < sb_x && y >= t_y && y <= wh ? true : false;
        on_sb =  x >= sb_x && x < ww && y >= t_y && y <= wh ? true : false;
        on_pic = !on_text && !on_header && !on_sb ? true : false;
    
        if (on_text_down){
            txt_x = x - delta_x;
            txt_y = y - delta_y;
            
            txt_x = txt_x <= 0 ? 0 : txt_x >= ww - t_margin * 2 - h1_char_width ? ww - t_margin * 2 - h1_char_width : txt_x;
            txt_y = txt_y <= 0 ? 0 : txt_y >= wh - (h1_text_row_height + t_margin) ? wh - (h1_text_row_height + t_margin) : txt_y;
    
            get_text_array();
        }
    
        if (on_sb_down && scrollbar && text_rows > text_visable_rows){
            sb_posy = y + delta_y;
            s_text = y + delta_y >= 0 ? y + delta_y <= (text_rows - text_visable_rows) * scrollbar_k ? Math.round(sb_posy / scrollbar_k) : text_rows - text_visable_rows : 0;
            window.RepaintRect(txt_x, txt_y, ww - txt_x, wh - txt_y);
        }
        
        window.RepaintRect(sb_x, txt_y, ww, wh);
        
        if (on_header && on_text_down) {
            text_hiden = false;
            window.SetProperty("txt hiden", text_hiden);
        }
    }
    
    function on_mouse_wheel(delta) {
        ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
       
        if (on_pic && !set_cycle && !delay){
            get_files_from_dir(artist_folder_path(artist));
            if (files.length > 1){
                delay = true;
                fdelay();
                next_image(delta);
                if (cycle > 0) step = 0;
            }
        }
       
        if ((on_header || on_text || on_sb) && !ShiftDown){
            if (text_rows > text_visable_rows){
                if (delta < 0) {s_text = text_rows - s_text <= text_visable_rows ? text_rows - text_visable_rows : s_text += 1}
                if (delta > 0) {s_text = s_text <= 0 ? 0 : s_text -= 1}
            }
            window.RepaintRect(txt_x, txt_y, ww - txt_x, wh - txt_y);
        }
       
        if ((on_header || on_text) && ShiftDown && !delay){
            delay = true;
            fdelay();
            if (on_header && delta < 0) {font_size_h = font_size_h <= min_font_size ? min_font_size : font_size_h - 2;};
            if (on_header && delta > 0) {font_size_h = font_size_h >= max_font_size ? max_font_size : font_size_h + 2;};
            window.SetProperty("font size: artist", font_size_h);
            if (on_text && delta < 0) {font_size_t = font_size_t <= min_font_size ? min_font_size : font_size_t - 2;};
            if (on_text && delta > 0) {font_size_t = font_size_t >= max_font_size ? max_font_size : font_size_t + 2;};
            window.SetProperty("font size: biography", font_size_t);
            get_font();
            refresh_txt = true;
            get_text_array();
        }
    
        if (on_pic && set_cycle && ShiftDown) {
            if (delta < 0) {cycle = cycle <= 0 ? 0 : cycle - 5;};
            if (delta > 0) {cycle = cycle >= 60 ? 60 : cycle + 5;};
            window.SetProperty("auto cycle (sec)", cycle);
            window.Repaint();
        }
    }
    
    function on_mouse_lbtn_down(x,y){
        if (on_header || on_text){
            on_text_down = true;
            delta_x = x - txt_x;
            delta_y = y - txt_y;
        }
        if (on_sb){
            on_sb_down = true;
            sb_posy = s_text * scrollbar_k;
            delta_y = sb_posy - y;
        }
    }
    
    function on_mouse_lbtn_up(x,y){
        window.SetProperty("txt_x", txt_x);
        window.SetProperty("txt_y", txt_y);
        on_text_down = false;
        on_sb_down = false;
    }
    
    function on_mouse_lbtn_dblclk (x,y){
        if (on_text){
            lang = lang == 1 ? 0 : 1;
            window.SetProperty("lang", lang);
            get_text();
            language_tooltip && lang_tooltip();
        }
    
        if (on_pic){
            select_p_a = select_p_a == 1 ? 0 : 1;
            window.SetProperty("artist/album", select_p_a);
            get_pic();
        }
    }
    
    function on_mouse_mbtn_dblclk (x,y){
        if (on_header){
            !text_hiden && hide_text(x,y);
            text_hiden && restore_text(); 
            text_hiden = !text_hiden;
            window.SetProperty("txt hiden", text_hiden);
            
            window.SetProperty("txt_x", txt_x);
            window.SetProperty("txt_y", txt_y);
        }
    }
    
    function on_mouse_leave() {
        window.SetCursor(32512);
        on_sb = false;
        window.Repaint(); 
    }
    
    function on_size(){
        ww = window.Width;   
        wh = window.Height;
       
        txt_x = window.GetProperty("txt_x");
        txt_y = window.GetProperty("txt_y");
    
        txt_x = txt_x >= ww - 50 && txt_x >= 0 ? ww - 50 : txt_x;
        txt_y = txt_y >= wh - (h1_text_row_height + t_margin) && txt_y >= 0 ? wh - (h1_text_row_height + t_margin) : txt_y;
       
        refresh_txt = true;
        get_text_array();
        get_pic()
    }
    
    function del_folders(n){
        var dir = fso.GetFolder(tmp_b_path);
        var e = new Enumerator( dir.SubFolders );
        try {
            for(; !e.atEnd(); e.moveNext() ) {
                var name = e.item().Name;
                if (name.indexOf("_download") < 0){
                    if (name.indexOf(n) < 0){
                        fso.deleteFolder(tmp_b_path + name, true);
                    }
                }   
            }
        } catch(e) {};
    }
    
    function calc_img_size(img){
        if(!img) return;
        var size = {x:0, y:0, width:0, height:0, cx:0, cy:0, cwidth:0, cheight:0};
    
        switch(align_mode) {	
    	case 0: // adjust		
            var sw = ww / img.Width;
            var sh = wh / img.Height;
            var s = Math.min(sw, sh);
            
            var x = 0;
            var y = 0;
            
            if (sw > sh) x = (ww - img.Width * s) / 2;
            else if (sw < sh) y = (wh - img.height * s) / 2;
    
            var width = img.Width * s;
            var height = img.Height * s;
            var cx = 0;
            var cy = 0;
            var cwidth = img.Width;
            var cheight = img.Height;
    		break;
            
        case 1: // adjust top - center
            var sw = ww / img.Width;
            var sh = wh / img.Height;
            var s = Math.min(sw, sh);
    
            var x = 0;
            if (sw > sh) x = (ww - img.Width * s) / 2;
            var y = 0;
            var width = img.Width * s;
            var height = img.Height * s;
            var cx = 0;
            var cy = 0;
            var cwidth = img.Width;
            var cheight = img.Height;
    		break;
            
        case 2: // adjust top - left
            var sw = ww / img.Width;
            var sh = wh / img.Height;
            var s = Math.min(sw, sh);
            
            var x = 0;
            var y = 0;
            var width = img.Width * s;
            var height = img.Height * s;
            var cx = 0;
            var cy = 0;
            var cwidth = img.Width;
            var cheight = img.Height;
    		break;
    
    	case 3: // centre	
    		var sr = img.Width / img.Height;	
    		var dr = ww / wh;	
    		if (sr < dr) {	
    			var r = img.Width / ww;
    			var cheight = wh * r;
    			var cy = Math.round((img.Height - cheight) / 2);
    			var cwidth = img.Width;
    			var cx = 0;
    		} else {	
    			var r = img.Height / wh;
    			var cwidth = ww * r;
    			var cx = Math.round((img.Width - cwidth) / 2);
    			var cheight = img.Height;
    			var cy = 0;
    		}	
            var x = 0;			
            var y = 0;			
            var width = ww;			
            var height = wh;			
    		break;	
            
    	case 4: // centre - top		
    		var sr = img.Width / img.Height;	
    		var dr = ww / wh;	
    		if (sr < dr) {	
    			var r = img.Width / ww;
    			var cheight = wh * r;
    			var cy = 0;
    			var cwidth = img.Width;
    			var cx = 0;
    		} else {	
    			var r = img.Height / wh;
    			var cwidth = ww * r;
    			var cx = Math.round((img.Width - cwidth) / 2);
    			var cheight = img.Height;
    			var cy = 0;
    		}
            var x = 0;
            var y = 0;
            var width = ww;
            var height = wh;
    		break;	
            
    	case 5: // stretch		
            var x = 0;
            var y = 0;
            var width = ww;
            var height = wh;
            var cx = 0;
            var cy = 0;
            var cwidth = img.Width;
            var cheight = img.Height;
    		break;	
        }
        
        size.x = x + p_margin;
        size.y = y + p_margin; 
        size.width = width - p_margin * 2; 
        size.height = height - p_margin * 2; 
        size.cx = cx; 
        size.cy = cy;
        size.cwidth = cwidth;
        size.cheight = cheight;
        
        return size;
    }
    
    var select_file = 0;
    
    function copy_files(){
        var destination_path;
        var tmp_files = [];
        var tmp_artist = artist;
        var tmp_p_a = p_a[select_p_a];
        var tmp_directory_path;
    
        if (path.indexOf('://') > 0 || path.indexOf('youtube') == 0 || path.indexOf('cdda') == 0) {
            tmp_directory_path = fb.ProfilePath + "tmp_lastFM_img\\";
        } else {
            tmp_directory_path = directory_path + "\\" + tmp_p_a + "\\";
        }   
        
        var nl = "\" + chr(10) + \"";
    
        if (select_file == 0){
            files = naturalSort(files);
            tmp_files.push(files[selected]);
            var input_box_text = "Копировать  " + nl + nl + get_fnext(tmp_files[0]) + nl + nl + "файл в";
        } else {
            tmp_files = files;
            var input_box_text = "Копировать  " + nl + nl + tmp_artist + " " + tmp_p_a + ".jpg" + nl + nl + "файлы в";
        }
    
        var string = input_box(input_box_text, tmp_directory_path, "Foobar 2000");
        
        if (string){
            destination_path = folder_exists(string);
            
            if(fso.FolderExists(destination_path)) {
                copy_files_to_folder(destination_path, tmp_files, tmp_p_a);
            }else{
                copy_files();
            }
        }
    }
    
    function copy_files_to_folder(p, f, pa){
        for (i in f) {
            if (f[i].indexOf(pa) > 0){
                try {
                    fso.CopyFile (f[i], p  , 1 );
                } catch(e) {}
            }
        }
    }
    
    function input_box(p_text, d_text, w_title){
        vbe = new ActiveXObject('ScriptControl');
        vbe.Language = 'VBScript';
        return vbe.eval( "InputBox(\"" + p_text + "\",\"" + w_title + "\",\"" + d_text + "\")");
    }
    
    function clean_path_name(n) {
        if (!n) return;
        return n.replace(/[\/\:\*\?\"\<\>\|]/g,'');
    }
    
    function folder_exists(n) {
        var driver = fso.GetDriveName(n);
        if (!fso.DriveExists(driver)) {
            return "";
        } else {
            var p = "";
            var split_string = [];
            split_string = n.replace(/\\$/g, "").split("\\");
    
            for (var i = 1; i < split_string.length; i += 1) {
                p = p + clean_path_name(split_string[i]) + "\\";
                try {
                    if(!fso.FolderExists(driver + "\\" + p)) fso.CreateFolder(driver + "\\" + p);
                } catch(e) {};
            }
            return driver + "\\" + p;
        }
    }
    
    function on_notify_data(name, info) {
        if(name == "panel") {
            if (info == "bio"){
                panel_on = true;
                artist = "";
                on_metadb_changed();
            } else{
                panel_on =  false;
            }
        }
    }
    
    function img_file_info(){
        var img_w, img_h, img_name, img_dim;
        if (files[selected]){
            img_name = "\n\n" + get_fnext(files[selected]);
            img_w = gdi.Image(files[selected]).width;
            img_h = gdi.Image(files[selected]).Height;
            img_dim = "\n" + img_w + " x " + img_h;
            return img_name + img_dim;
        } else {
            return "";
        }
    }
    
    function hide_text(x,y){  
        window.SetProperty("tmp_txt_x", txt_x);
        window.SetProperty("tmp_txt_y", txt_y);
        
        txt_x = ww - t_margin * 2 - h1_char_width;
        txt_y = wh - (h1_text_row_height + t_margin);
        get_text_array();
    }
    
    function restore_text(){  
        txt_x = window.GetProperty("tmp_txt_x");
        txt_y = window.GetProperty("tmp_txt_y");
        get_text_array();
    }
    
    function naturalSort(stringArray) {
        var xor = function(a, b) {
            return a ? !b : b;
        }
        var isDigit = function(chr) {
            var charCode = function(ch) {
                return ch.charCodeAt(0);
            };
            var code = charCode(chr);
            return (code >= charCode('0')) && (code <= charCode('9'));
        }
        var splitString = function(str) {
            var from = 0;   
            var index = 0;
            var count = 0;  
            var splitter = {};
    
            splitter.count = function () {
                return count;
            }
            splitter.next = function() {
                if (index === str.length) {
                    return null;
                }
                while(++index) {
                    var currentIsDigit = isDigit(str.charAt(index - 1));  
                    var nextChar = str.charAt(index);
                    var currentIsLast = (index === str.length);
                    var isBorder = currentIsLast || xor(currentIsDigit, isDigit(nextChar));        
                    if (isBorder) {
                    var part = str.slice(from, index);
                        from = index;
                        count++;
                        return {
                            IsNumber: currentIsDigit,
                            Value: currentIsDigit ? Number(part) : part
                        }
                    }
                } 
            } 
            return splitter;
        }
        var compareStrings = function(str1, str2) {
            var compare = function(a, b) {  
                return (a < b) ? -1 : (a > b) ? 1 : 0;
            }
            var splitter1 = splitString(str1);
            var splitter2 = splitString(str2);
            while (true) {
                var first = splitter1.next();
                var second = splitter2.next();
                if (null !== first && null !== second) {
                    if (xor(first.IsNumber, second.IsNumber)) {
                        return first.IsNumber ? -1 : 1;        
                    } else {                    
                        var comp = compare(first.Value, second.Value);    
                        if (comp != 0) {
                            return comp;
                        }
                    }
                } else {
                    return compare(splitter1.count(), splitter2.count());
                }
            }
        }
        var arr = stringArray;
        return arr.sort(compareStrings);  
    }
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    function get_lastFM_artist_img(p){
        var xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");   
        var url1 = ("https://www.last.fm/" + lang_query[lang] + "music/" + encodeURIComponent(artist) + "/+" + "images" + "?page=" + 1);  
        xmlhttp1.open("GET", url1, true );  
        xmlhttp1.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
        xmlhttp1.send(null);     
        xmlhttp1.onreadystatechange = function () { 
            if (xmlhttp1.readyState == 4) { 
                if (xmlhttp1.status == 200) {  
                    doc.open();     
                    var div = doc.createElement("div");
                    div.innerHTML = xmlhttp1.responsetext;
                    var data = div.getElementsByTagName("img");
                    var urls = [];
    
                    for (i = 0; i < data.length; i++) {    
                        if (data[i].className == "image-list-image"){       
                            if (data[i].src.indexOf("https://img2-ak.lst.fm/i/u/avatar170s") == 0 || data[i].src.indexOf("https://lastfm-img2.akamaized.net/i/u/avatar170s") == 0) {
                                urls.push(data[i].src.replace("avatar170s", quality[download_quality][1]));
                            }     
                        } 
                    }
                    
                    for (i = 0; i < Math.min(urls.length, limit); i++) {  
                        var file = "\"" + p + "\\" + artist + "_"  + i + "_images.jpg" + "\"";     
                        WshShell.Run(vbs + " " + urls[i] + " " + file, 0, false);
                    }  
                    doc.close();
                    if (urls.length > 0) get_files_if_loaded(p);
                    get_text();
                }
            } 
        }     
    }
    
    function get_lastFM_album_img(p){
        var xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");   
        var url1 = ("https://www.last.fm/" + lang_query[lang] + "music/" + encodeURIComponent(artist) + "/+" + "albums" + albums_order[select_albums_order][1]);  
        xmlhttp1.open("GET", url1, true );  
        xmlhttp1.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
        xmlhttp1.send(null);     
        xmlhttp1.onreadystatechange = function () { 
            if (xmlhttp1.readyState == 4) { 
                if (xmlhttp1.status == 200) {  
                    doc.open();     
                    var div = doc.createElement("div");
                    div.innerHTML = xmlhttp1.responsetext;
                    var data = div.getElementsByTagName("img");
                    var an = div.getElementsByTagName("p");
                    var urls = [];
                    var urls_img = [];
    
                    var item_main_text = [];
                    var item_aux_text = [];
     
                    for (i = 0; i < an.length; i++) {   
                        if (an[i].className == "album-grid-item-main-text" ){    // album name  
                            item_main_text.push(an[i].innerHTML.replace(/(&amp;)/g,'&'));
                        }
                        if (an[i].className == "album-grid-item-aux-text" ){     // listeners, release date 
                            item_aux_text.push(an[i].innerHTML.replace(/\,|(&nbsp;)/g,' '));
                        }
                    }  
    
                    for (i = 0; i < data.length; i++) {  
                        if (data[i].className == "album-grid-album-art"){       // all imgs  
                            if ((data[i].src.indexOf("https://img2-ak.lst.fm/i/u/300") == 0 || data[i].src.indexOf("https://lastfm-img2.akamaized.net/i/u/300") == 0)) {   
                                urls.push(data[i].src);
                            }
                        }
                    }
    
                    var name1 = [], name2 = [], name3 = [];
    
                    for (i = 0; i < urls.length; i++) { 
                        if (urls[i].indexOf("c6f59c1e5e7240a4c0d427abd71f3dbb") < 0) {      // if img not c6f59c1e5e7240a4c0d427abd71f3dbb
                            urls_img.push(urls[i].replace("300x300", quality[download_quality][2]));
                            name1.push(item_main_text[i]);          // album name
                            name2.push(item_aux_text[i * 2]);       // listeners
                            name3.push(item_aux_text[i * 2 + 1]);   // release date
                        }
                    }
    
                    for (i = 0; i < Math.min(urls_img.length, limit); i++) {  
                        utils.WriteINI( p + "\\" + artist + "_album_info.ini", "album_name_" + albums_order[select_albums_order][2], i, name1[i]);
                        utils.WriteINI( p + "\\" + artist + "_album_info.ini", "listeners_" + albums_order[select_albums_order][2] + "_" + lang_text[lang], i, name2[i]);
                        utils.WriteINI( p + "\\" + artist + "_album_info.ini", "release_date_" + albums_order[select_albums_order][2] + "_" + lang_text[lang], i, name3[i]);
                        var file = "\"" + p + "\\" + artist + "_"  + i + "_albums_" + albums_order[select_albums_order][2] + ".jpg" + "\"";   
                        WshShell.Run(vbs + " " + urls_img[i] + " " + file, 0, false);
                    }    
                    doc.close();
                    if (urls_img.length > 0) get_files_if_loaded(p);
                    get_text();
                }
            } 
        }     
    }
    
    function get_lastFM_b_text(p){
        xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
        url2 = ("https://www.last.fm/" + lang_query[lang] + "music/" + encodeURIComponent(artist) + "/+wiki");
        xmlhttp2.open("GET", url2, true);
        xmlhttp2.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
        xmlhttp2.send(null);
        xmlhttp2.onreadystatechange = function () {
            if (xmlhttp2.readyState == 4) {
                if (xmlhttp2.status == 200) {
                    doc.open();
                    var div = doc.createElement("div");
                    div.innerHTML = xmlhttp2.responsetext;
                    var data = div.getElementsByTagName("div");
                    
                    for (i = 0; i < data.length; i++) {
                        if (data[i].className == "wiki-content") {
                            text = strip_tags(data[i].innerHTML);
                            break;
                        }
                    }
                    doc.close();
                }
                if (text != "") save_txt_file(text, p);
                if (text == "") text = text_not_found[lang];
                get_text_array();
            }
        }
    }
    
    function get_a_text(s) {
        //clear_txt_var();    //
        refresh_txt = true;
        var a_text_file = artist_folder_path(artist) + "\\" + artist + "_" + s + "_albums_" +  albums_order[select_albums_order][2] + "_" + lang_text[lang] + ".txt";   
        album = utils.ReadINI( artist_folder_path(artist) + "\\" + artist + "_album_info.ini", "album_name_" + albums_order[select_albums_order][2], s );
    
        info_a_text = get_info_a_text(s);
    
        if (!info_a_text) {
            get_lastFM_album_img(artist_folder_path(artist));
        } else {
            if (fso.FileExists(a_text_file)){
                text = utils.ReadTextFile(a_text_file);
                get_text_array();
            } else{
                get_lastFM_a_text(album, a_text_file);
            }
        }
    }
    
    function get_info_a_text(s) {
        var listeners = utils.ReadINI( artist_folder_path(artist) + "\\" + artist + "_album_info.ini", "listeners_" + albums_order[select_albums_order][2] + "_" + lang_text[lang], s );
        var release_date = utils.ReadINI( artist_folder_path(artist) + "\\" + artist + "_album_info.ini", "release_date_" + albums_order[select_albums_order][2] + "_" + lang_text[lang], s );
        return (listeners ? listeners + "\n" : "") + (release_date ? release_date + "\n\n" : ""); 
    }
    
    function get_lastFM_a_text(album, p){
        xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
        url3 = ("https://www.last.fm/" + lang_query[lang] + "music/" + encodeURIComponent(artist) + "/" + encodeURIComponent(album) + "/+wiki");
        xmlhttp3.open("GET", url3, true);
        xmlhttp3.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
        xmlhttp3.send(null);
        xmlhttp3.onreadystatechange = function () {
            if (xmlhttp3.readyState == 4) {
                if (xmlhttp3.status == 200) {
                    doc.open();
                    var div = doc.createElement("div");
                    div.innerHTML = xmlhttp3.responsetext;
                    var data = div.getElementsByTagName("div");
    
                    for (i = 0; i < data.length; i++) {
                        if (data[i].className == "wiki-content" && album) {
                            text = strip_tags(data[i].innerHTML);
                            break;
                        }
                    }
                    doc.close();
                }
                if (text != "") save_txt_file(text, p);
                if (text == "") text = text_not_found[lang];
                get_text_array();
            }
        }
    }
    
    function print(msg) {
    	fb.trace(msg);
    }
    Обновление скрипта (07.01.2017):
    • разбивка на строки с переносом текста заголовка при большой длине;
    • минимальный и максимальный размер шрифт вынесен в Свойства WSH;
    • включение отключение тени для текста в Свойства WSH;
    • информация о файле (имя и размер в пикселях) при нажатом Shift - ЛКМ на изображении

    Обновление скрипта (16.02.2017):
    • в связи с изменениями на Last.fm восстановлена работоспособность скрипта

    Обновление скрипта (04.03.2017):
    ДОБАВЛЕНО:
    • установка пользовательских цветов - фон (color: background), заголовок (color: header), текст (color: text) - меню Свойства WSH;
    • переключение между системным цветом и пользовательским - пункт меню colors: custom - меню Свойства WSH;
    • два пункта в меню для выбора порядка отображения (загрузки) альбомов: самые популярные (most popular) и дата релиза (release date);
    • отображение кол-ва слушателей, кол-ва композиций и года релиза для альбома;
    • индикация выбранного языка при переключении. Включается/отключается в пункте language tooltip - меню Свойства WSH.

    Скрипт не совместим со старыми версиями в плане имен загружаемых файлов.
    Последний раз редактировалось MC Web; 04.03.2017 в 20:53.

  6. #26
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    1 466

    Скрипт JS Biography Rus от Wilb для JScript Panel

    Русифицированный скрипт JScript Biography, представляет из себя панель Биографии.


    ПРИМЕЧАНИЕ:
    • при отсутствии данных биографии выводится обложка воспроизводимого файла;
    • выбор источника для получения данных: Allmusic, Last.fm или foobar2000;
    • в корневой папке foobar2000 создается папка yttm и в ней сохраняются все фото и текст биографии

    Скачать JS Biography 0.8.5.1 Rus с Яндекс.Диск (55 кБ)
    Последний раз редактировалось MC Web; 10.09.2017 в 13:15.

  7. #27
    Участник форума
    Регистрация
    29.03.2017
    Сообщений
    4
    Не подскажите в чем дело?

  8. #28
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    1 466
    vik-tan, я даже в заголовке этого скрипта написал: Скрипт JS Biography Rus от Wilb для JScript Panel и в названии JScript Biography, а не WSH.

  9. #29
    Участник форума
    Регистрация
    29.03.2017
    Сообщений
    4
    MC Web, виноват. Сделал как нужно-работает!!!! Спасибо!!!!
    Последний раз редактировалось vik-tan; 30.03.2017 в 16:57.

  10. #30
    Участник форума Аватар для maniac
    Регистрация
    19.12.2017
    Сообщений
    1
    Вопрос по Скрипт JS-marc2003. Использовал из данного пакета скрипт с кнопками - замечательно работает, но хочется добавить кнопок. Возможно ли и как это сделать если это возможно? Требуется помощь поскольку с JScript ни разу не сталкивался и с наскоку разобраться не получается. Потребность в 3 кнопках - Open file, Open containing folder и Preferences. До этого раньше пользовался исключительно оригинальным дистром Foobar поэтому опыт настройки интерфейса нулевой. Надеюсь на понимание.

Метки этой темы

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •