Страница 6 из 7 ПерваяПервая ... 567 ПоследняяПоследняя
Показано с 51 по 60 из 69

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

  1. #51
    Участник форума
    Регистрация
    23.10.2023
    Сообщений
    68

    WSH Search by kgena_ua

    Подскажите, этот скрипт может искать не по Библиотеке, а по текущему плейлисту?
    Код:
    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)); } 
    
    var font = gdi.Font("arial",12,1);
    var font2 = gdi.Font("arial",10,0);
    var ww = window.Width;   
    var wh = window.Height;  
    
    DT_CENTER = 0x00000001;
    DT_RIGHT = 0x00000002;
    DT_SINGLELINE = 0x00000020; 
    DT_VCENTER = 0x00000004;
    
    var t_color = RGB(180,180,180);
    var m_color = RGB(120,120,120);
    var sel_color = RGB(250,250,250);
    var sel_bg_color = RGB(100,100,100);
    
    var t_row = 1, t_row1, t_row2, t_row3, t_height;
    var string = "", search_query;
    var tag_search = window.GetProperty("tag_search", 1);
    var previous_pll = plman.ActivePlaylist;
    
    var sort = "%album artist%|%date%|%album%|%discnumber%|%tracknumber%|%title%";
    var on_mouse = false;
    var ab, ab1, ab2;
    var ab_I, ab_C, ab_F, ab_M;
    var it, it1, it2, itM;
    var line1 = false, line2 = false, line3 = false;
    var lang = 1;
    
    function on_paint(gr) {
        gr.FillSolidRect (0, 0, ww, wh, RGB(30,30,30)); 
        
        t_height = gr.CalcTextheight("abc", font) + 3;
        t_row1 = t_row + t_height + 0;
        t_row2 = t_row1 + t_height + 0;
        t_row3 = t_row2 + t_height + 0;
    
        ab_I = Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","<","...")
        ab_F = Array("1","2","3","4","5","6","7","8","9","0","/","'","#",",","-",":"," ","<","...")
        ab_C = Array("А","Б","В","Г","Д","Е","Ё","Ж","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ъ","Ы","Ь","Э","Ю","Я"," ","<","...")   
        ab_M = Array("all","artist","album","title","genre","date","rating");
        
        if (lang == 1) ab_M = ab_M.concat("ая","09");
        if (lang == 2) ab_M = ab_M.concat("az","09");
        if (lang == 3) ab_M = ab_M.concat("az","ая");
        
        itM = ab_M.length;
    
        if (lang == 1) ab = ab_I;
        if (lang == 2) ab = ab_C;
        if (lang == 3) ab = ab_F;
           
        it = ab.length;
    
        it1 = Math.round(it/2);
        it2 = it - it1;
        ab1 = ab.splice(0,it1);
        ab2 = ab.splice(0,it2);
    
        if(on_mouse && line1) gr.FillSolidRect (x_col1, t_row1, ww / it1, t_height, sel_bg_color);
        if(on_mouse && line2) gr.FillSolidRect (x_col2, t_row2, ww / it2, t_height, sel_bg_color);
        if(on_mouse && line3) gr.FillSolidRect (x_col3, t_row3, ww / itM, t_height, sel_bg_color);
    
        gr.GdiDrawText(string, font, search ? sel_color : t_color, 10, t_row, ww , t_height, DT_SINGLELINE | DT_VCENTER);
    
        for (var i = 0; i < it1; i = i + 1) {
            color = x_color > ww / it1 * i && x_color < ww / it1 * (i + 1) && on_mouse && line1 ? sel_color : t_color;
            gr.GdiDrawText(ab1[i] == " " ? "_" : ab1[i], font, color, ww / it1 * i, t_row1, ww / it1 , t_height, DT_CENTER |DT_SINGLELINE | DT_VCENTER);   
        }
        
        for (var i = 0; i < it2; i = i + 1) {
            color = x_color > ww / it2 * i && x_color < ww / it2 * (i + 1) && on_mouse && line2 ? sel_color : t_color;
            gr.GdiDrawText(ab2[i] == " " ? "_" : ab2[i], font, color, ww / it2 * i, t_row2, ww / it2 , t_height, DT_CENTER |DT_SINGLELINE | DT_VCENTER);   
        }
        
        for (var i = 0; i < itM; i = i + 1) {
            color = (x_color > ww / itM * i && x_color < ww / itM * (i + 1) && on_mouse && line3) || tag_search == i + 1 ? sel_color : m_color;
            gr.GdiDrawText(ab_M[i], font2, color, ww / itM * i, t_row3, ww / itM , t_height, DT_CENTER |DT_SINGLELINE | DT_VCENTER);   
        }
    
    //    gr.GdiDrawText(line1 + " " + line2 + " " + line3, font2, RGB(200,200,200), 0, 5, ww - 10  , wh, DT_RIGHT);
    }
    
    var ch;
    var x_col1, x_col2, x_col3;
    var x_color;
    
    function on_mouse_lbtn_up (x, y){
        line1 = y >= t_row1 && y <= t_row1 + t_height ? true : false;
        line2 = y >= t_row2 && y <= t_row2 + t_height ? true : false;
        line3 = y >= t_row3 && y <= t_row3 + t_height ? true : false;
        
        if (!line1 && !line2 && !line3) return; // ???
        if (!search) previous_pll = plman.ActivePlaylist;
        library_view_idx();
        
        for (var i = 0; i < it1; i = i + 1) {
            if (x > ww / it1 * i && x < ww / it1 * (i + 1) && line1) {ch = ab1[i]}
        } 
        for (var i = 0; i < it2; i = i + 1) {
            if (x > ww / it2 * i && x < ww / it2 * (i + 1) && line2) {ch = ab2[i]} 
        } 
        for (var i = 0; i < itM; i = i + 1) {
            if (x > ww / itM * i && x < ww / itM * (i + 1) && line3) {
                if (i < itM - 2) {
                    tag_search = i + 1; tag_search_change();return;
                } else {
                    ch = ab_M[i] }
            } 
        } 
    
        if (ch == "az") {ch = ""; lang = 1; return};
        if (ch == "ая") {ch = ""; lang = 2; return};
        if (ch == "09") {ch = ""; lang = 3; return};
        if (ch == "<")  {ch = ""; string = string.substring(0,string.length - 1)};   
        if (ch == "..."){ch = ""; string = ""};
    
        string = string + ch;   
        string = string.charAt(0) == " " ? "" : string;
        string = string.replace("  "," "); 
        if (string.length > 0 || search) pll_search();
    }
    
    var search = false;
    var count;
    
    function pll_search() {    
        remove_pll("search");
        
        switch(tag_search) {
            case 1:
                search_query =  "%artist% HAS " + string + " OR " + "%album% HAS " + string + " OR " + "%title% HAS " + string + " OR " + "%genre% HAS " + string + " OR " + "%date% HAS " + string;
                break;
            case 2:
                search_query =  "%artist% HAS " + string;
                break;
            case 3:
                search_query =  "%album% HAS " + string;
                break;
            case 4:
                search_query =  "%title% HAS " + string;
                break;
            case 5:
                search_query =  "%genre% HAS " + string;
                break;
            case 6:
                search_query =  "%date% HAS " + string;
                break;
            case 7:
                search_query =  "rating HAS "  + string.charAt(0) + " OR " + "%rating% HAS " + string.charAt(0)
                                + " OR " + "rating HAS "  + string.charAt(1) + " OR " + "%rating% HAS " + string.charAt(1)
                                + " OR " + "rating HAS "  + string.charAt(2) + " OR " + "%rating% HAS " + string.charAt(2) 
                                + " OR " + "rating HAS "  + string.charAt(3) + " OR " + "%rating% HAS " + string.charAt(3)            
                                + " OR " + "rating HAS "  + string.charAt(4) + " OR " + "%rating% HAS " + string.charAt(4)            
                ;
                break;
        }
        
        idx = plman.PlaylistCount;
        fb.CreateAutoPlaylist(idx, "search", search_query, sort, 0);
        count = fb.PlaylistItemCount(idx)
        
        if (count > 0) {
            fb.ActivePlaylist = idx; search = true
        } else {
    //        fb.ActivePlaylist = previous_pll;   // ???
    //        fb.ActivePlaylist = 0;            // ???
            fb.ActivePlaylist = lib_v_idx;    // ???
            remove_pll("search"); 
            search = false;
        }
    }
    
    function remove_pll(pll_name){
        search = false;
        remove_idx = fb.PlaylistCount;
        for (var i = 0; i < remove_idx; i++) {
           if (fb.GetPlaylistName(i) == pll_name) {fb.RemovePlaylist(i)}
        }
    }
    
    var lib_v_idx;
    function library_view_idx(){
        idx = fb.PlaylistCount;
        for (var i = 0; i < idx; i++) {
           if (fb.GetPlaylistName(i) == "Library view") {lib_v_idx = i}
        }
    }
    
    function on_playback_starting(cmd, is_paused) {
        string = "";
        search = false;
        if (fb.GetPlaylistName(fb.ActivePlaylist) != "search") {remove_pll("search");}
    }
    
    function on_mouse_move(x,y) {
        window.SetCursor(32649);
        on_mouse = true;
        line1 = y >= t_row1 && y <= t_row1 + t_height ? true : false;
        line2 = y >= t_row2 && y <= t_row2 + t_height ? true : false;
        line3 = y >= t_row3 && y <= t_row3 + t_height ? true : false;
        x_color = x;
    
        for (var i = 0; i < it1; i = i + 1) {
            if (x > ww / it1 * i) {x_col1 = ww / it1 * i}
        } 
        for (var i = 0; i < it2; i = i + 1) {
            if (x > ww / it2 * i) {x_col2 = ww / it2 * i}             
        }
        for (var i = 0; i < itM; i = i + 1) {
            if (x > ww / itM * i) {x_col3 = ww / itM * i}             
        }     
    
        window.Repaint(); 
    }
    
    function on_size(){   
        ww = window.Width;   
        wh = window.Height;   
    }   
    
    function on_mouse_leave() {
        window.SetCursor(32512);
        on_mouse = false;
        window.Repaint();
    }
    
    function on_mouse_rbtn_up (x, y){  
        var _menu = window.CreatePopupMenu();
        var i = 1;
    
        _menu.AppendMenuItem(0x00000000, i++, "all");
        _menu.AppendMenuItem(0x00000000, i++, "artist");
        _menu.AppendMenuItem(0x00000000, i++, "album");
        _menu.AppendMenuItem(0x00000000, i++, "title");
        _menu.AppendMenuItem(0x00000000, i++, "genre");
        _menu.AppendMenuItem(0x00000000, i++, "date");
        _menu.AppendMenuItem(0x00000000, i++, "rating");
    
        _menu.CheckMenuRadioItem(1, i, tag_search);
        _menu.EnableMenuItem(tag_search, 1);   
        
        _menu.AppendMenuItem(0x00000800, 0, 0);   
        _menu.AppendMenuItem(0x00000000, 10, "Configure ...");
    
        ret = _menu.TrackPopupMenu(x, y);
        if (ret == 0) return;
    
        switch (ret) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 6:
        case 7:
            tag_search = 7;
            tag_search_change();
            break;
        case 10:   
            window.ShowConfigure();   
            break;   
        }
        _menu.Dispose();
        return true;
    }
    
    function tag_search_change(){
        window.SetProperty("tag_search", tag_search);
        if (string.length > 0) pll_search();
    }
    Есть что-то подобное для WSH Panel Mod (1.5.6) с поиском по тегам по текущему плейлисту?

  2. #52
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    2 110
    g00drich, всем этим требованиям и даже больше, соответствует Quick Search Toolbar (Панель быстрого поиска).

  3. #53
    Участник форума
    Регистрация
    23.10.2023
    Сообщений
    68
    Цитата Сообщение от MC Web Посмотреть сообщение
    всем этим требованиям и даже больше, соответствует Quick Search Toolbar (Панель быстрого поиска).
    С компонентами все понятно, остановился на Facets.

    Я хочу попробовать добавить элементы поиска в готовый скрипт WSH Panel Mod, для своей задумки.
    Все что попалось из скриптов с поиском, работает в основном через авто-плейлист, который смотрит всю библиотеку, а не текущий плейлист...

  4. #54
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    2 110
    Цитата Сообщение от g00drich Посмотреть сообщение
    Все что попалось из скриптов с поиском, работает в основном через авто-плейлист, который смотрит всю библиотеку, а не текущий плейлист...
    Судя по интерфейсу, этот скрипт панели поиска создавался для работы с сенсорным экраном, когда нет клавиатуры (предположение).
    Если именно это и нужно, то заметил заремленные строки в коде, возможно kgena_ua планировал добавить и поиск по плейлистам:
    Код:
        if (count > 0) {
            fb.ActivePlaylist = idx; search = true
        } else {
    //        fb.ActivePlaylist = previous_pll;   // ???
    //        fb.ActivePlaylist = 0;            // ???
            fb.ActivePlaylist = lib_v_idx;    // ???
            remove_pll("search");
            search = false;
        }
    Попробуйте, может получится добавить поиск и по плейлистам...

  5. #55
    Участник форума
    Регистрация
    23.10.2023
    Сообщений
    68

    Tag Results

    Нашел вот такой скрипт, назовем его "Tag Results".

    Работает с текущим плейлистом, собирает тэги и выдает их значение, плюс сортирует в новом плейлисте по значениям.
    Нажмите на изображение для увеличения. 

Название:	Tag Results_02-04-2025_01.jpg 
Просмотров:	24 
Размер:	12,4 Кб 
ID:	2055
    Нажмите на изображение для увеличения. 

Название:	Tag Results_02-04-2025_02.jpg 
Просмотров:	6 
Размер:	11,5 Кб 
ID:	2056
    Код:
    function RGB(r, g, b) {
        return (0xff000000 | (r << 16) | (g << 8) | (b));
    }
    
    IDC_ARROW = 32512;
    IDC_HAND = 32649;
    // window.SetCursor()
    
    NOT_FOUND = 4294967295;
    // MetaFind() and elsewhere for consistency
    
    /**
    Colors, coordinates, etc
    **/
    
    // General
    meta_field = "rating";
    tag_delimiter = ";";
    
    working_playlist_name = "Tag Results";
    playing_playlist_name = "Tag Results (Playback)";
    
    font_std = gdi.Font("Segoe UI", 10, 0);
    font_bold = gdi.Font("Segoe UI", 10, 1);
    font_ital = gdi.Font("Segoe UI", 10, 2);
    
    // Tags
    t_x = 8;
    t_y = 8;
    t_spc = 8;
    
    little_x = "ˣ";
    
    label_color = RGB(151, 181, 192);
    label_text_color = RGB(252, 252, 252);
    
    fallback_text = "nothing here";
    fallback_text_color = RGB(205, 205, 205);
    
    // Status
    s_x = 24;
    s_y = 32;
    
    status_line = "Found %t %btag%s in playlist:"
    
    status_text_color = RGB(49, 49, 49);
    
    // Columns
    c_y = 55;
    
    row_h = 24;
    row_w = .8; // %
    column_indent = 8;
    
    no_of_columns = 5;
    scroll_step = 1;
    
    text_omitted = " ...";
    
    tag_name_color = RGB(49, 49, 49);
    alt_row_color = RGB(241, 246, 243);
    
    /**
    Playlist dict
    **/
    
    function build_dict() {
        tag_dict = {};
        for (n = 0; n < playlistdb.Count; n++) {
            track = playlistdb.Item(n);
            metadb = track.GetFileInfo();
    
            tag_idx = metadb.MetaFind(meta_field);
            if (tag_idx == NOT_FOUND)
                continue;
            tag_cnt = metadb.MetaValueCount(tag_idx);
            for (t = 0; t < tag_cnt; t++) {
                tag = metadb.MetaValue(tag_idx, t);
                dict_push(tag, track, tag_dict);
            }
        }
    }
    
    function get_keys(dict) {
        keys = [];
        for (key in dict)
            keys.push(key);
        return keys;
    }
    
    function dict_push(key, v, dict) {
        if (!(key in dict))
            dict[key] = plman.GetPlaylistItems(-1);
        dict[key].Add(v);
    }
    
    /**
    Playlist utility
    **/
    
    function assess_playlist() {
        playlistdb = plman.GetPlaylistItems(parent_playlist);
        build_dict();
        playlistdb.RemoveAll();
    }
    
    function playlist_add(tag) {
        new_tag = tag_dict[tag];
    
        switch (mode) {
            case "&&":
                playlistdb = new_tag.Clone();
                build_dict();
                break;
            case "||":
                playlistdb.AddRange(new_tag);
                break;
        }
    }
    
    function remake_playlist() {
        assess_playlist();
        for (tag in active_tags) {
            playlist_add(tag);
        }
    }
    
    function update_playlist() {
        suppress_pl_events = true;
        switch (working_playlist_index) {
            case fb.PlayingPlaylist:
                freeze_playlist();
            case NOT_FOUND:
                make_playlist();
        }
        focus_playlist();
        clear_playlist();
        plman.InsertPlaylistItems(working_playlist_index, 0, playlistdb);
    }
    
    function make_playlist() {
        working_playlist_index = fb.PlaylistCount;
        fb.CreatePlaylist(working_playlist_index, working_playlist_name);
    }
    
    function focus_playlist() {
        fb.ActivePlaylist = working_playlist_index;
    }
    
    function clear_playlist() {
        selection = [];
        p_c = fb.PlaylistItemCount(fb.ActivePlaylist);
        for (idx = 0; idx < p_c; idx++) {
            selection.push(idx);
        }
        plman.SetPlaylistSelection(fb.ActivePlaylist, selection, true);
        plman.RemovePlaylistSelection(fb.ActivePlaylist);
    }
    
    function freeze_playlist() {
        fb.RenamePlaylist(working_playlist_index, playing_playlist_name);
        playing_playlist_index = working_playlist_index;
    }
    
    // ~~~
    
    function locate_playlists() {
        // Called on init and on_playlists_changed()
        working_playlist_index = NOT_FOUND,
            playing_playlist_index = NOT_FOUND;
        for (pl_idx = 0; pl_idx < fb.PlaylistCount; pl_idx++) {
            pl_name = plman.GetPlaylistName(pl_idx);
            if (pl_name == working_playlist_name) {
                working_playlist_index = pl_idx;
            } else if (pl_name == playing_playlist_name) {
                playing_playlist_index = pl_idx;
            }
        }
    }
    
    /**
    Tags
    **/
    
    function draw_labels(gr) {
        x = t_x;
        y = t_y;
        run_w = t_x;
        if (len_active_tags() == 0) {
            w = gr.CalcTextWidth(fallback_text, font_ital),
                h = gr.CalcTextHeight(fallback_text, font_ital);
            gr.GdiDrawText(fallback_text, font_ital, fallback_text_color, x, y, w, h);
        } else {
            for (tag in active_tags) {
                active_tags[tag].draw(gr);
            }
        }
    }
    
    label = function(tag) {
        this.name = tag;
        this.draw = function(gr) {
            txt_w = gr.CalcTextWidth(this.name, font_std),
                txt_h = gr.CalcTextHeight(this.name, font_std);
    
            x = t_x + run_w;
            y = t_y;
            txt_pad_r = txt_h,
                txt_pad_l = txt_h / 2,
                bg_w = txt_pad_l + txt_w + txt_pad_r,
                bg_h = txt_h + 3,
                bg_arc = bg_h / 2,
                text_x = x + txt_pad_l,
                text_y = y + 1,
                close_x = x + txt_w + txt_pad_r - 3,
                close_y = y + 4;
            // ~~~
            gr.SetSmoothingMode(2);
            gr.FillRoundRect(x, y, bg_w, bg_h, bg_arc, bg_arc, label_color);
            gr.GdiDrawText(this.name, font_std, label_text_color, text_x, text_y, txt_w, txt_h);
            gr.GdiDrawText(little_x, font_std, label_text_color, close_x, close_y, txt_h, txt_h, label_color);
            // ~~~
            run_w += bg_w + t_spc;
            this.left = x,
                this.right = x + bg_w,
                this.top = y,
                this.bottom = y + bg_h;
        }
        this.check_mouse = function(evt, x, y) {
            mouse_is_over = (x >= this.left && x <= this.right &&
                y >= this.top && y <= this.bottom);
            if (mouse_is_over) {
                switch (evt) {
                    case "up":
                        dismiss(this.name);
                        break;
                    case "move":
                        set_hand_cursor = true;
                        break;
                }
            }
        }
    }
    
    function len_active_tags() {
        n = 0;
        for (tag in active_tags)
            n++;
        return n;
    }
    
    /**
    Status
    **/
    
    function say_status(gr) {
        text = status_line;
        text = text.replace("%t", tags.tags.length)
            .replace("%b", len_active_tags() > 0 && mode == "&&" ? "sub" : "")
            .replace("%s", tags.tags.length == 1 ? "" : "s")
            .replace("%a", len_active_tags())
            .replace("%S", len_active_tags() == 1 ? "" : "s")
            .replace("%p", fb.PlaylistItemCount(fb.ActivePlaylist));
        text_w = gr.CalcTextWidth(text, font_ital);
        text_h = gr.CalcTextHeight(text, font_ital);
        gr.GdiDrawText(text, font_ital, status_text_color, s_x, s_y, text_w, text_h);
    }
    
    /**
    Columns
    **/
    
    tag_list = function() {
        this.update = function() {
            this.offset = 0;
            this.tags = get_keys(tag_dict);
            this.tags.sort();
            // ~~~
            space_avail = (wh - c_y);
            total_rows = Math.ceil(this.tags.length / no_of_columns);
            rows_possible = Math.floor(space_avail / row_h) - 1;
            this.visible_rows = Math.min(rows_possible, total_rows);
            this.out_of_bounds = total_rows - this.visible_rows;
        }
        this.draw_rows = function(gr) {
            h = row_h;
            w = row_w * ww;
            x = (ww - w) / 2;
            y = c_y;
            min = this.offset;
            max = this.offset + this.visible_rows;
            for (n = min; n < max; n++) {
                if (n % 2 == 0) {
                    gr.FillSolidRect(x, y, w, h, alt_row_color);
                }
                y += h;
            }
            this.left = x;
            this.right = x + w;
            this.top = c_y;
            this.bottom = c_y + this.visible_rows * h;
            this.column_w = w / no_of_columns;
        }
        this.populate = function(gr) {
            th = gr.CalcTextHeight(".", font_std);
            // Should be consistent
            x = this.left + column_indent;
            y = this.top + (row_h - th) / 2 - 1;
            min = no_of_columns * this.offset;
            max = Math.min(no_of_columns * (this.offset + this.visible_rows), this.tags.length);
    
            for (n = min; n < max; n++) {
                tag = this.tags[n];
                font = font_std;
                if (tag in active_tags)
                    font = font_bold;
    
                tw = gr.CalcTextWidth(tag, font);
                while (column_indent + tw > this.column_w) {
                    if (tag.length == 0) break;
                    tag = tag.slice(0, -1);
                    tw = gr.CalcTextWidth(tag + text_omitted, font);
                }
                if (tag != this.tags[n]) tag += text_omitted;
                gr.GdiDrawText(tag, font, tag_name_color, x, y, tw, th);
                x += this.column_w;
                if ((n + 1) % no_of_columns == 0) {
                    x = this.left + column_indent;
                    y += row_h;
                }
            }
        }
        this.check_mouse = function(x, y) {
            mouse_is_over = (x >= this.left && x <= this.right &&
                y >= this.top && y <= this.bottom);
            if (mouse_is_over) {
                idx = this.check_index(x, y);
                if (idx < this.tags.length) {
                    this.toggle(idx);
                }
            }
        }
        this.toggle = function(idx) {
            tag = this.tags[idx];
            if (tag in active_tags)
                dismiss(tag);
            else
                activate(tag);
        }
        this.check_index = function(x, y) {
            idx = no_of_columns * this.offset;
            idx += Math.floor((y - this.top) / row_h) * no_of_columns;
            idx += Math.floor((x - this.left) / this.column_w);
            return idx;
        }
        this.jump_to_index = function(chr) {
            for (t = 0; t < this.tags.length; t++) {
                tag = this.tags[t];
                first_chr = tag.charAt(0).toUpperCase();
                if (chr == first_chr) {
                    new_offset = Math.floor(t / no_of_columns);
                    this.offset = Math.min(new_offset, this.out_of_bounds);
                    return;
                }
            }
        }
    }
    
    function activate(tag) {
        active_tags[tag] = new label(tag);
        playlist_add(tag);
        update_playlist();
        if (mode == "&&") {
            this.offset = 0;
            tags.update();
        }
    }
    
    function dismiss(tag) {
        delete active_tags[tag];
    
        if (len_active_tags() > 0) {
            remake_playlist();
            update_playlist();
        } else {
            fb.ActivePlaylist = parent_playlist;
        }
        if (mode == "&&") {
            this.offset = 0;
            tags.update();
        }
    }
    
    /**
    Init, defaults, main events
    **/
    
    mode = "&&";
    tags = new tag_list();
    
    locate_playlists();
    on_new_playlist();
    
    function on_size() {
        wh = window.Height,
            ww = window.Width;
        tags.update();
    }
    
    function on_paint(gr) {
        draw_labels(gr);
        tags.draw_rows(gr);
        tags.populate(gr);
        say_status(gr);
        // ~~~
        suppress_pl_events = false;
        // Won't do at the end of update_playlist(). Not sure how else to execute this last.
    }
    
    /**
    Mouse, key events
    **/
    
    function on_mouse_lbtn_up(x, y) {
        tags.check_mouse(x, y);
        for (tag in active_tags) {
            active_tags[tag].check_mouse("up", x, y);
        }
        window.Repaint();
    }
    
    function on_mouse_move(x, y) {
        set_hand_cursor = false;
        for (tag in active_tags) {
            active_tags[tag].check_mouse("move", x, y);
        }
        set_hand_cursor ? window.SetCursor(IDC_HAND) : window.SetCursor(IDC_ARROW);
    }
    
    function on_mouse_wheel(step) {
        if (step > 0) {
            tags.offset -= scroll_step;
            tags.offset = Math.max(tags.offset, 0);
        } else {
            tags.offset += scroll_step;
            tags.offset = Math.min(tags.offset, tags.out_of_bounds);
        }
        window.Repaint();
    }
    
    function on_key_down(vkey) {
        chr = String.fromCharCode(vkey);
        tags.jump_to_index(chr);
        // Gets awfully wonky with non-alpha characters, whatever "vkey" is doesn't
        // mirror the common ASCII alphabet
        window.Repaint();
    }
    
    /**
    Playlist events
    **/
    
    function on_new_playlist() {
        // Not a native event
        active_tags = {};
        parent_playlist = fb.ActivePlaylist;
        assess_playlist();
    }
    
    function on_playlists_changed() {
        if (suppress_pl_events) return;
        // ~~~
        locate_playlists();
    }
    
    function on_playback_new_track() {
        if (playing_playlist_index != fb.PlayingPlaylist) {
            fb.RemovePlaylist(playing_playlist_index);
        }
    }
    
    function on_playlist_items_added() {
        on_playlist_x();
    }
    
    function on_playlist_items_removed() {
        on_playlist_x();
    }
    
    function on_playlist_switch() {
        on_playlist_x();
    }
    
    var suppress_pl_events;
    
    function on_playlist_x() {
        if (suppress_pl_events) return;
        // ~~~
        on_new_playlist();
        tags.update();
        window.Repaint();
    }
    Хотелось бы переделать все это дело под некую панель рейтингов плейлиста...
    Что-то типа такого (фотошоп), показывающего сразу количество и звезды
    Нажмите на изображение для увеличения. 

Название:	Tag Results_02-04-2025_03.jpg 
Просмотров:	4 
Размер:	34,2 Кб 
ID:	2057

    У самого знаний совсем мало, может кто возьмется...

  6. #56
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    2 110
    Цитата Сообщение от g00drich Посмотреть сообщение
    Что-то типа такого (фотошоп), показывающего сразу количество и звезды
    Взялся было попробовать, но данный скрипт подсчёт количества треков по рейтингам из метаданных не ведёт:

    Нажмите на изображение для увеличения. 

Название:	Image 001.png 
Просмотров:	7 
Размер:	20,7 Кб 
ID:	2058 Нажмите на изображение для увеличения. 

Название:	Image 002.png 
Просмотров:	8 
Размер:	17,5 Кб 
ID:	2059

    Как работает с рейтингами из статистики не проверял, т.к. её не использую в последнее время.

    В общих чертах "хотелка" понятна, а какое её практическое применение, кроме лицезрения / сравнения разных плейлистов по рейтингам?

  7. #57
    Участник форума
    Регистрация
    23.10.2023
    Сообщений
    68
    Цитата Сообщение от MC Web Посмотреть сообщение
    Взялся было попробовать, но данный скрипт подсчёт количества треков по рейтингам из метаданных не ведёт:
    В менеджере создает плейлист Tag Results с количеством треков, попробовать это достать...
    Ну и посмотреть, что там этот скрипт за словарь тегов создает, может там можно чего подсчитать.

    Нажмите на изображение для увеличения. 

Название:	Tag Results_02-05-2025_01.jpg 
Просмотров:	7 
Размер:	66,8 Кб 
ID:	2060
    Цитата Сообщение от MC Web Посмотреть сообщение
    В общих чертах "хотелка" понятна, а какое её практическое применение, кроме лицезрения / сравнения разных плейлистов по рейтингам?
    Иногда не хватает наглядной статистики по плейлисту, можно весь лист прокрутить, можно в Facets глянуть, но хотелось бы перед глазами иметь "выхлоп" с очередного сборника.
    Беру сборники/альбомы, прослушиваю, ставлю рейтинги понравившимся, собираю в свои сборники годовые, типа Бест2024 (по тысяче треков в год набирается) те треки, что с рейтингами 3-5.

    Неплохо было бы еще иметь общий средний рейтинг сборника
    Последний раз редактировалось g00drich; 05.02.2025 в 08:15.

  8. #58
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    2 110
    Цитата Сообщение от g00drich Посмотреть сообщение
    В менеджере создает плейлист Tag Results с количеством треков, попробовать это достать...
    Цитата Сообщение от g00drich Посмотреть сообщение
    Беру сборники/альбомы, прослушиваю, ставлю рейтинги понравившимся, собираю в свои сборники годовые, типа Бест2024 (по тысяче треков в год набирается) те треки, что с рейтингами 3-5.
    Конечно "хозяин - барин", но по мне удобнее в Быстром поиске.

    Выбираем в контекстном меню:
    • Поиск в (Библиотека, Плейлист, Плейлист (активный), Все плейлисты)
    • Теги (Шаблон, Исполнитель, ..., Рейтинг)
    • Вводим значения и получаем результат в виде готового плейлиста

    Нажмите на изображение для увеличения. 

Название:	Image 001.png 
Просмотров:	12 
Размер:	386,7 Кб 
ID:	2061

    На скриншоте результат поиска по всем плейлистам, из локальных / онлайн файлов и их количество.

  9. #59
    Модератор Аватар для MC Web
    Регистрация
    25.04.2012
    Сообщений
    2 110
    Цитата Сообщение от g00drich Посмотреть сообщение
    Неплохо было бы еще иметь общий средний рейтинг сборника
    Есть SimPlaylist Manager (Менеджер плейлистов) с дополнительными столбцами, включая Средний рейтинг плейлиста / альбома.

    Заметил интересную особенность, чем больше треков в плейлисте / альбоме имеют рейтинг, тем более насыщенным становится отображение Среднего рейтинга.

    Нажмите на изображение для увеличения. 

Название:	Image 001.png 
Просмотров:	18 
Размер:	81,6 Кб 
ID:	2066 Нажмите на изображение для увеличения. 

Название:	Image 002.png 
Просмотров:	17 
Размер:	80,8 Кб 
ID:	2067

  10. #60
    Участник форума
    Регистрация
    23.10.2023
    Сообщений
    68

    Вопрос

    Подскажите, возможно вообще исполнение Прогресс бара плейлиста, как для отдельного трека по временной шкале?
    Полоска заполняется пока весь плейлист проигрывается...

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

Ваши права

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