Конфигурация s8e
Скриншоты:
Ссылки:
Список разделов › foobar2000 › Сборки › Релизы сборок
/// DarkOne v2.1 Additional Buttons Panel
// Code by T.P Wang and tedGo
// ==PREPROCESSOR==
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Script.js"
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Button Script.js"
// ==/PREPROCESSOR==
window.MinWidth = window.MaxWidth = 268;
// ----- CREATE BUTTONS ---------------------------------------------
var imgPath = fb.foobarPath + "themes\\DarkOne\\Buttons\\Control\\";
var btn_font = gdi.Font("tahoma", 12, 0);
Buttons.a = new Button(00, 12, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.RunContextCommand("Службы/Last.fm Artist Info");});
Buttons.b = new Button(80, 12, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.RunContextCommand("Службы/Google Artist");});
Buttons.c = new Button(160, 12, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.RunContextCommand("Службы/Google Artist + title");});
Buttons.d = new Button(240, 12, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.RunContextCommand("Службы/CoverFetcher");});
Buttons.e = new Button(320, 12, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.RunContextCommand("Службы/Discogs");});
// ----- DRAW -------------------------------------------------------
function on_paint(gr) {
if (!window.IsTransparent) {
gr.FillSolidRect(0, 0, window.Width, window.Height, ui_backcol);
gr.FillGradRect(0, 0, window.Width, 90, 90, RGBA(151, 180, 202, 28), 0);
}
buttonsDraw(gr);
gr.GdiDrawText("Last.fm Art.", btn_font, ui_btntxtcol, 00, 0, 70, 12, 33);
gr.GdiDrawText("Google Art. ", btn_font, ui_btntxtcol, 84, 0, 60, 12, 32);
gr.GdiDrawText("GArt.+title", btn_font, ui_btntxtcol, 154, 0, 60, 12, 34);
gr.GdiDrawText("Rezerv", btn_font, ui_btntxtcol, 240, 0, 60, 12, 34);
gr.GdiDrawText("Discogs", btn_font, ui_btntxtcol, 320, 0, 60, 12, 34);
}
// Maxim Terpilovsky's script
// http://terpilovsky.ru
// Buttonbar Panel / Updated 28-08-2011
MF_SEPARATOR = 0x00000800;
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
MF_DISABLED = 0x00000002;
MF_UNCHECKED = 0x00000000;
MF_CHECKED = 0x00000008;
MF_STRING = 0x00000000;
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
// Config variables
// Variables
var my_ini_values = new Array;
var default_values = {"AAD_path" : "c:\\Program Files\\AlbumArtDownloaderXUI\\AlbumArt.exe"};
if ( utils.CheckFont( "Segoe UI" ) ) {
var g_font = gdi.Font("Segoe UI", 12);
var g_font2 = gdi.Font("Segoe UI", 10);
} else {
var g_font = gdi.Font("Tahoma", 11);
var g_font2 = gdi.Font("Tahoma", 9);
}
var mode;
var g_move = null;
var show_buttons;
var Active_array = [];
var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var Sup_Buttons = [{name:"Last.fm"}, {name:"Google"}, {name:"Discogs"}, {name:"Allmusic"}, {name:"Selection"}, {name:"Others"}];
var g_button_down = null;
var tooltip = window.CreateTooltip();
tooltip.SetMaxWidth( 200 );
// Script functions
mode = parseInt( utils.ReadINI( fb.FoobarPath + 's7e.ini', 'buttonbar-settings', 'buttonbar_mode', 1) );
// Metadb
OutputMetadb = function() {
if ( mode == 2 ) return ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false );
else return ( fb.IsPlaying ? fb.GetNowPlaying() : ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false ));
}
function my_ini_write(text) {
var fso, f, r, write = text;
var ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
var filename = fb.FoobarPath + "s7e.data";
try {
f = fso.OpenTextFile(filename, ForWriting, true)
f.Write(write);
f.Close();
} catch(e) {
fb.trace(e.message);
}
}
function object2string(obj) {
var val, output = "";
if (obj) {
for (var i in obj) {
val = obj[i];
switch (typeof val) {
case ("string"):
output += i + "=" + val + "\r";
break;
default:
output += i + "=" + val + "\r";
}
}
output = output.substring(0, output.length-1);
}
return output;
}
function my_ini_read() {
var fso, f, r, b;
var ForReading = 1, ForWriting = 2;
var filename = fb.FoobarPath + "s7e.data";
fso = new ActiveXObject("Scripting.FileSystemObject");
if ( fso.FileExists(filename) ) {
f = fso.OpenTextFile(filename, ForReading);
r = f.ReadAll();
var a = r.split("\n");
for (key in a) {
b = a[key].split("=");
my_ini_values[b[0]] = b[1];
}
return my_ini_values;
}
else return false;
}
if ( !my_ini_read() ) my_ini_write(object2string(default_values));
buttons = {
// reset: new Button( "..", "All", function() { show_buttons = null; update(); window.Repaint(); })
lastfm_song: new Button( "Song", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')) + "/_/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%title%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') )); }),
lastfm_album: new Button( "Album", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')) + "/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') )); }),
lastfm_artist: new Button( "Artist", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) )).replace(/%20/g,'+') ); }),
lastfm_group: new Button( "Group", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.last.fm/community/groups/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')); }),
lastfm_images: new Button( "Images", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')) + "/+images" ); }),
lastfm_events: new Button( "Events", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.last.fm/events/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') ); }),
lastfm_search: new Button( "Search by Artist", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.last.fm/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=all" ); }),
google_artist: new Button( "Artist", Sup_Buttons[1].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.google.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&ie=utf-8"); }),
google_album: new Button( "Album", Sup_Buttons[1].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.google.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist% %album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&ie=utf-8"); }),
google_title: new Button( "Song", Sup_Buttons[1].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.google.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist% %title%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&ie=utf-8"); }),
discogs_artist: new Button( "Artist", Sup_Buttons[2].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.discogs.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=artists&btn=Search"); }),
discogs_album: new Button( "Album", Sup_Buttons[2].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.discogs.com/search?q=" + encodeURIComponent( fb.TitleFormat("%album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=releases&btn=Search"); }),
discogs_all: new Button( "Artist - Album", Sup_Buttons[2].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.discogs.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist% %album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=all&btn=Search"); }),
allmusic_artist: new Button( "Artist", Sup_Buttons[3].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.allmusic.com/search/artist/" + encodeURIComponent( fb.TitleFormat("$ascii(%artist%)").EvalWithMetadb(OutputMetadb()) )); }),
allmusic_album: new Button( "Album", Sup_Buttons[3].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.allmusic.com/search/album/" + encodeURIComponent( fb.TitleFormat("$ascii(%album%)").EvalWithMetadb(OutputMetadb()) )); }),
allmusic_title: new Button( "Song", Sup_Buttons[3].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.allmusic.com/search/song/" + encodeURIComponent( fb.TitleFormat("$ascii(%title%)").EvalWithMetadb(OutputMetadb()) )); }),
undo: new Button( "Назад", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Undo"); }),
redo: new Button( "Вперед", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Redo"); }),
sort_by_3d: new Button( "Сортировка", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Sort/Sort by..."); }),
sort_by_fields: new Button( "Sort by fields", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Sort/Sort by fields..."); }),
select_all: new Button( "Выбрать всё", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Select All"); }),
copy_to: new Button( "Копировать в...", Sup_Buttons[4].name, function() { fb.RunContextCommand("File operations/Copy to..."); }),
reverse_selection: new Button( "Reverse", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Sort/Reverse"); }),
remove_selection: new Button( "Remove", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Remove"); }),
copy_to: new Button( "Копировать в...", Sup_Buttons[4].name, function() { fb.RunContextCommand("File operations/Copy to"); }),
wiki_artist: new Button( "Wikipedia Artist", Sup_Buttons[5].name, function() { if ( OutputMetadb() ) WshShell.run("http://en.wikipedia.org/wiki/Special:Search?search=" + encodeURIComponent(fb.TitleFormat("$replace(%artist%, ,_)").EvalWithMetadb(OutputMetadb()))); }),
mb_artist: new Button( "MusicBrainz Artist", Sup_Buttons[5].name, function() { if ( OutputMetadb() ) WshShell.run("http://musicbrainz.org/search?query=" + encodeURIComponent(fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb())) + "&type=artist"); }),
//aad_album: new Button( "Album Art", Sup_Buttons[5].name, function() { WshShell.run('"c:\\Program Files\\AlbumArtDownloaderXUI\\AlbumArt.exe" /ar "' + fb.TitleFormat("%album artist%").Eval(true) + '" /al "' + fb.TitleFormat("%album%").Eval(true) + '" /path "' + fb.TitleFormat("$replace(%path%,%filename_ext%,)folder.jpg").Eval(true) + '"'); }),
reset: new Button( "..", "All", function() { show_buttons = null; buttons_num = null; update(); window.Repaint(); })
}
if ( fso.FileExists( my_ini_values["AAD_path"] ) ) {
buttons.aad_album = new Button( "Album Art", Sup_Buttons[5].name, function() { if ( fb.GetFocusItem() ) WshShell.run('"' + my_ini_values["AAD_path"] + '" /ar "' + fb.TitleFormat("%album artist%").EvalWithMetadb(fb.GetFocusItem()) + '" /al "' + fb.TitleFormat("%album%").EvalWithMetadb(fb.GetFocusItem()) + '" /path "' + fb.TitleFormat("$replace(%path%,%filename_ext%,)folder.jpg").EvalWithMetadb(fb.GetFocusItem()) + '"'); });
}
else if ( fso.FileExists( default_values.AAD_path ) ) {
buttons.aad_album = new Button( "Album Art", Sup_Buttons[5].name, function() { if ( fb.GetFocusItem() ) WshShell.run('"' + default_values.AAD_path + '" /ar "' + fb.TitleFormat("%album artist%").EvalWithMetadb(fb.GetFocusItem()) + '" /al "' + fb.TitleFormat("%album%").EvalWithMetadb(fb.GetFocusItem()) + '" /path "' + fb.TitleFormat("$replace(%path%,%filename_ext%,)folder.jpg").EvalWithMetadb(fb.GetFocusItem()) + '"'); });
}
var MyButtons = new Array(
buttons.reset,
buttons.lastfm_song,
buttons.lastfm_album,
buttons.lastfm_artist,
buttons.lastfm_group,
buttons.lastfm_events,
buttons.lastfm_images,
buttons.lastfm_search,
buttons.google_artist,
buttons.google_album,
buttons.google_title,
buttons.discogs_artist,
buttons.discogs_album,
buttons.discogs_all,
buttons.allmusic_artist,
buttons.allmusic_album,
buttons.allmusic_title,
buttons.undo,
buttons.redo,
buttons.sort_by_3d,
buttons.sort_by_fields,
buttons.select_all,
buttons.random_selection,
buttons.coy_to,
buttons.reverse_selection,
buttons.remove_selection,
buttons.mb_artist,
buttons.wiki_artist,
buttons.aad_album
);
var buttons_num = MyButtons.length;
function Button(name, sup, func) {
this.name = name;
this.sup = sup;
this.func = func;
this.onClick = function () {
this.func && this.func();
}
}
function update() {
if ( show_buttons ) {
Active_array = [];
for (var i in MyButtons ) {
if ( show_buttons != MyButtons[i].sup && MyButtons[i].sup != "All" ) continue;
else {
Active_array.push(MyButtons[i]);
}
}
}
else Active_array = Sup_Buttons;
}
update();
function on_paint(gr){
gr.SetTextRenderingHint(5);
gr.SetSmoothingMode(2);
var ww = window.Width;
var wh = window.Height;
var n;
var t_color;
try {
arrow_image = gdi.Image( fb.FoobarPath + "\\s7e_files\\images\\arrow_down_black.png" );
} catch(e) { fb.trace(e.message); }
if ( g_move != undefined ) {
gr.FillGradRect(1+g_move*ww/Active_array.length, 1, ww/Active_array.length - 2, (wh-1)/2, 90, RGB(248,251,254), RGB(237,242,250));
gr.FillGradRect(1+g_move*ww/Active_array.length, wh/2, ww/Active_array.length - 2, (wh-3)/2, 90, RGB(215,228,244), RGB(193,210,232));
gr.DrawRoundRect(1+g_move*ww/Active_array.length, 1, ww/Active_array.length - 3, wh - 3, 4, 4, 1, RGB(255,255,255));
gr.DrawRoundRect(g_move*ww/Active_array.length, 0, ww/Active_array.length-1, wh-1, 4, 4, 1, RGB(170,190,210));
}
if ( g_button_down != undefined ) {
gr.FillGradRect(1+g_button_down*ww/Active_array.length, 1, ww/Active_array.length - 2, (wh-1)/2, 90, RGB(225,235,245), RGB(216,228,241));
gr.FillGradRect(1+g_button_down*ww/Active_array.length, 0, ww/Active_array.length - 2, 3, 90, RGB(201,212,228), RGB(221,232,241));
gr.FillGradRect(1+g_button_down*ww/Active_array.length, (wh-1)/2, ww/Active_array.length - 2, (wh-3)/2, 90, RGB(207,219,236), RGB(207,220,237));
gr.DrawRoundRect(g_button_down*ww/Active_array.length, 0, ww/Active_array.length-1, wh-1, 4, 4, 1, RGB(170,190,210));
}
for ( n=0; n<Active_array.length; n++ ) {
if ( n == g_move ) t_color = RGB(0,0,0);
else t_color = Active_array[n].name == '..' ? RGB(160,160,160) : RGB(30,50,90);
gr.GdiDrawText( Active_array[n].name == '..' ? '(' + show_buttons + ')\n' + Active_array[n].name : Active_array[n].name, Active_array[n].name == '..' ? g_font2 : g_font, t_color, 2 + n * ww / Active_array.length, 0, ww / Active_array.length - 4, wh, 0x00000001 | 0x00000004 | 0x00040000 | 0x00000400);
var string = gr.MeasureString(Active_array[n].name, g_font, 2 + n * ww / Active_array.length, 0, ww / Active_array.length - 4, wh, 0x00000001 | 0x00000004 | 0x00040000 | 0x00000400);
if ( show_buttons == null && arrow_image ) gr.DrawImage( arrow_image, n * ww / Active_array.length + ( ww / Active_array.length / 2 ) + string.Width / 2 + 5, (wh - 10)/2, 14, 10, 0, 0, 16, 16, 0, 255);
}
}
function on_mouse_lbtn_down(x, y, mask) {
g_move = null;
g_button_down = Math.floor( x / (window.Width/Active_array.length) );
window.Repaint();
}
function on_mouse_lbtn_up(x,y){
g_button_down = null;
window.Repaint();
var i = Math.floor( x / (window.Width/Active_array.length) );
if ( i < Active_array.length ) {
try {
if ( show_buttons ) Active_array[i].onClick();
else {
show_buttons = Sup_Buttons[i].name;
update();
}
}
catch(e) { }
}
}
function on_mouse_move(x,y){
window.SetCursor(32649);
//if ( !g_button_down && g_move != Math.floor( x / (window.Width/Active_array.length) ) ) {
if ( !g_button_down && g_move != Math.floor( x / (window.Width/Active_array.length) ) ) {
if ( x < window.Width ) {
g_move = Math.floor( x / ( window.Width/Active_array.length ) );
//fb.trace( 'x=' + x + '| g_move=' + g_move + ' | Active_array.length=' + Active_array.length + ' | window.Width=' + window.Width + ' | Active_array[g_move].name=' + Active_array[g_move].name);
try {
if ( g_move < Active_array.length ) {
tooltip.Text = Active_array[g_move].name;
tooltip.Activate();
window.Repaint();
}
}
catch(e) { }
}
}
}
function on_mouse_wheel(delta) {
if ( delta > 0 && show_buttons ) {
show_buttons = null;
update();
window.Repaint();
}
}
function on_mouse_leave() {
g_move = null;
window.SetCursor( 32512 );
tooltip.Deactivate();
window.Repaint();
}
function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var i = 1;
var ret;
_menu.AppendMenuItem(MF_STRING, i++, "Playing item");
_menu.AppendMenuItem(MF_STRING, i, "Current selection");
_menu.EnableMenuItem( mode, 1 );
_menu.CheckMenuRadioItem( 1, i, mode );
ret = _menu.TrackPopupMenu(x, y);
if (ret >= 1 && ret <= i) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'buttonbar-settings', 'buttonbar_mode', ret);
mode = ret;
window.Repaint();
}
return true;
}
// Maxim Terpilovsky's script
// http://terpilovsky.ru
// Buttonbar Panel / Updated 28-08-2011
MF_SEPARATOR = 0x00000800;
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
MF_DISABLED = 0x00000002;
MF_UNCHECKED = 0x00000000;
MF_CHECKED = 0x00000008;
MF_STRING = 0x00000000;
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
// Config variables
// Variables
var my_ini_values = new Array;
var default_values = {"AAD_path" : "c:\\Program Files\\AlbumArtDownloaderXUI\\AlbumArt.exe"};
if ( utils.CheckFont( "Segoe UI" ) ) {
var g_font = gdi.Font("Segoe UI", 12);
var g_font2 = gdi.Font("Segoe UI", 10);
} else {
var g_font = gdi.Font("Tahoma", 11);
var g_font2 = gdi.Font("Tahoma", 9);
}
var mode;
var g_move = null;
var show_buttons;
var Active_array = [];
var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var Sup_Buttons = [{name:"Last.fm"}, {name:"Google"}, {name:"Discogs"}, {name:"Allmusic"}, {name:"Selection"}, {name:"Others"}];
var g_button_down = null;
var tooltip = window.CreateTooltip();
tooltip.SetMaxWidth( 200 );
// Script functions
mode = parseInt( utils.ReadINI( fb.FoobarPath + 's7e.ini', 'buttonbar-settings', 'buttonbar_mode', 1) );
// Metadb
OutputMetadb = function() {
if ( mode == 2 ) return ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false );
else return ( fb.IsPlaying ? fb.GetNowPlaying() : ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false ));
}
function my_ini_write(text) {
var fso, f, r, write = text;
var ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
var filename = fb.FoobarPath + "s7e.data";
try {
f = fso.OpenTextFile(filename, ForWriting, true)
f.Write(write);
f.Close();
} catch(e) {
fb.trace(e.message);
}
}
function object2string(obj) {
var val, output = "";
if (obj) {
for (var i in obj) {
val = obj[i];
switch (typeof val) {
case ("string"):
output += i + "=" + val + "\r";
break;
default:
output += i + "=" + val + "\r";
}
}
output = output.substring(0, output.length-1);
}
return output;
}
function my_ini_read() {
var fso, f, r, b;
var ForReading = 1, ForWriting = 2;
var filename = fb.FoobarPath + "s7e.data";
fso = new ActiveXObject("Scripting.FileSystemObject");
if ( fso.FileExists(filename) ) {
f = fso.OpenTextFile(filename, ForReading);
r = f.ReadAll();
var a = r.split("\n");
for (key in a) {
b = a[key].split("=");
my_ini_values[b[0]] = b[1];
}
return my_ini_values;
}
else return false;
}
if ( !my_ini_read() ) my_ini_write(object2string(default_values));
buttons = {
// reset: new Button( "..", "All", function() { show_buttons = null; update(); window.Repaint(); })
lastfm_song: new Button( "Song", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')) + "/_/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%title%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') )); }),
lastfm_album: new Button( "Album", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')) + "/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') )); }),
lastfm_artist: new Button( "Artist", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) )).replace(/%20/g,'+') ); }),
lastfm_group: new Button( "Group", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.last.fm/community/groups/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')); }),
lastfm_images: new Button( "Images", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://last.fm/music/" + encodeURIComponent(encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+')) + "/+images" ); }),
lastfm_events: new Button( "Events", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.last.fm/events/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') ); }),
lastfm_search: new Button( "Search by Artist", Sup_Buttons[0].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.last.fm/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=all" ); }),
google_artist: new Button( "Artist", Sup_Buttons[1].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.google.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&ie=utf-8"); }),
google_album: new Button( "Album", Sup_Buttons[1].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.google.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist% %album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&ie=utf-8"); }),
google_title: new Button( "Song", Sup_Buttons[1].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.google.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist% %title%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&ie=utf-8"); }),
discogs_artist: new Button( "Artist", Sup_Buttons[2].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.discogs.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=artists&btn=Search"); }),
discogs_album: new Button( "Album", Sup_Buttons[2].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.discogs.com/search?q=" + encodeURIComponent( fb.TitleFormat("%album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=releases&btn=Search"); }),
discogs_all: new Button( "Artist - Album", Sup_Buttons[2].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.discogs.com/search?q=" + encodeURIComponent( fb.TitleFormat("%artist% %album%").EvalWithMetadb(OutputMetadb()) ).replace(/%20/g,'+') + "&type=all&btn=Search"); }),
allmusic_artist: new Button( "Artist", Sup_Buttons[3].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.allmusic.com/search/artist/" + encodeURIComponent( fb.TitleFormat("$ascii(%artist%)").EvalWithMetadb(OutputMetadb()) )); }),
allmusic_album: new Button( "Album", Sup_Buttons[3].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.allmusic.com/search/album/" + encodeURIComponent( fb.TitleFormat("$ascii(%album%)").EvalWithMetadb(OutputMetadb()) )); }),
allmusic_title: new Button( "Song", Sup_Buttons[3].name, function() { if ( OutputMetadb() ) WshShell.run("http://www.allmusic.com/search/song/" + encodeURIComponent( fb.TitleFormat("$ascii(%title%)").EvalWithMetadb(OutputMetadb()) )); }),
undo: new Button( "Undo", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Undo"); }),
redo: new Button( "Redo", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Redo"); }),
sort_by_3d: new Button( "Sort by...", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Sort/Sort by..."); }),
sort_by_fields: new Button( "Sort by fields", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Sort/Sort by fields..."); }),
select_all: new Button( "Select All", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Select All"); }),
crop: new Button( "Crop", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Crop"); }),
reverse_selection: new Button( "Reverse", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Sort/Reverse"); }),
remove_selection: new Button( "Remove", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Remove"); }),
random_selection: new Button( "Randomize", Sup_Buttons[4].name, function() { fb.RunMainMenuCommand("Edit/Selection/Sort/Randomize"); }),
wiki_artist: new Button( "Wikipedia Artist", Sup_Buttons[5].name, function() { if ( OutputMetadb() ) WshShell.run("http://en.wikipedia.org/wiki/Special:Search?search=" + encodeURIComponent(fb.TitleFormat("$replace(%artist%, ,_)").EvalWithMetadb(OutputMetadb()))); }),
mb_artist: new Button( "MusicBrainz Artist", Sup_Buttons[5].name, function() { if ( OutputMetadb() ) WshShell.run("http://musicbrainz.org/search?query=" + encodeURIComponent(fb.TitleFormat("%artist%").EvalWithMetadb(OutputMetadb())) + "&type=artist"); }),
//aad_album: new Button( "Album Art", Sup_Buttons[5].name, function() { WshShell.run('"c:\\Program Files\\AlbumArtDownloaderXUI\\AlbumArt.exe" /ar "' + fb.TitleFormat("%album artist%").Eval(true) + '" /al "' + fb.TitleFormat("%album%").Eval(true) + '" /path "' + fb.TitleFormat("$replace(%path%,%filename_ext%,)folder.jpg").Eval(true) + '"'); }),
reset: new Button( "..", "All", function() { show_buttons = null; buttons_num = null; update(); window.Repaint(); })
}
if ( fso.FileExists( my_ini_values["AAD_path"] ) ) {
buttons.aad_album = new Button( "Album Art", Sup_Buttons[5].name, function() { if ( fb.GetFocusItem() ) WshShell.run('"' + my_ini_values["AAD_path"] + '" /ar "' + fb.TitleFormat("%album artist%").EvalWithMetadb(fb.GetFocusItem()) + '" /al "' + fb.TitleFormat("%album%").EvalWithMetadb(fb.GetFocusItem()) + '" /path "' + fb.TitleFormat("$replace(%path%,%filename_ext%,)folder.jpg").EvalWithMetadb(fb.GetFocusItem()) + '"'); });
}
else if ( fso.FileExists( default_values.AAD_path ) ) {
buttons.aad_album = new Button( "Album Art", Sup_Buttons[5].name, function() { if ( fb.GetFocusItem() ) WshShell.run('"' + default_values.AAD_path + '" /ar "' + fb.TitleFormat("%album artist%").EvalWithMetadb(fb.GetFocusItem()) + '" /al "' + fb.TitleFormat("%album%").EvalWithMetadb(fb.GetFocusItem()) + '" /path "' + fb.TitleFormat("$replace(%path%,%filename_ext%,)folder.jpg").EvalWithMetadb(fb.GetFocusItem()) + '"'); });
}
var MyButtons = new Array(
buttons.reset,
buttons.lastfm_song,
buttons.lastfm_album,
buttons.lastfm_artist,
buttons.lastfm_group,
buttons.lastfm_events,
buttons.lastfm_images,
buttons.lastfm_search,
buttons.google_artist,
buttons.google_album,
buttons.google_title,
buttons.discogs_artist,
buttons.discogs_album,
buttons.discogs_all,
buttons.allmusic_artist,
buttons.allmusic_album,
buttons.allmusic_title,
buttons.undo,
buttons.redo,
buttons.sort_by_3d,
buttons.sort_by_fields,
buttons.select_all,
buttons.random_selection,
buttons.crop,
buttons.reverse_selection,
buttons.remove_selection,
buttons.mb_artist,
buttons.wiki_artist,
buttons.aad_album
);
var buttons_num = MyButtons.length;
function Button(name, sup, func) {
this.name = name;
this.sup = sup;
this.func = func;
this.onClick = function () {
this.func && this.func();
}
}
function update() {
if ( show_buttons ) {
Active_array = [];
for (var i in MyButtons ) {
if ( show_buttons != MyButtons[i].sup && MyButtons[i].sup != "All" ) continue;
else {
Active_array.push(MyButtons[i]);
}
}
}
else Active_array = Sup_Buttons;
}
update();
function on_paint(gr){
gr.SetTextRenderingHint(5);
gr.SetSmoothingMode(2);
var ww = window.Width;
var wh = window.Height;
var n;
var t_color;
try {
arrow_image = gdi.Image( fb.FoobarPath + "\\s7e_files\\images\\arrow_down_black.png" );
} catch(e) { fb.trace(e.message); }
if ( g_move != undefined ) {
gr.FillGradRect(1+g_move*ww/Active_array.length, 1, ww/Active_array.length - 2, (wh-1)/2, 90, RGB(248,251,254), RGB(237,242,250));
gr.FillGradRect(1+g_move*ww/Active_array.length, wh/2, ww/Active_array.length - 2, (wh-3)/2, 90, RGB(215,228,244), RGB(193,210,232));
gr.DrawRoundRect(1+g_move*ww/Active_array.length, 1, ww/Active_array.length - 3, wh - 3, 4, 4, 1, RGB(255,255,255));
gr.DrawRoundRect(g_move*ww/Active_array.length, 0, ww/Active_array.length-1, wh-1, 4, 4, 1, RGB(170,190,210));
}
if ( g_button_down != undefined ) {
gr.FillGradRect(1+g_button_down*ww/Active_array.length, 1, ww/Active_array.length - 2, (wh-1)/2, 90, RGB(225,235,245), RGB(216,228,241));
gr.FillGradRect(1+g_button_down*ww/Active_array.length, 0, ww/Active_array.length - 2, 3, 90, RGB(201,212,228), RGB(221,232,241));
gr.FillGradRect(1+g_button_down*ww/Active_array.length, (wh-1)/2, ww/Active_array.length - 2, (wh-3)/2, 90, RGB(207,219,236), RGB(207,220,237));
gr.DrawRoundRect(g_button_down*ww/Active_array.length, 0, ww/Active_array.length-1, wh-1, 4, 4, 1, RGB(170,190,210));
}
for ( n=0; n<Active_array.length; n++ ) {
if ( n == g_move ) t_color = RGB(0,0,0);
else t_color = Active_array[n].name == '..' ? RGB(160,160,160) : RGB(30,50,90);
gr.GdiDrawText( Active_array[n].name == '..' ? '(' + show_buttons + ')\n' + Active_array[n].name : Active_array[n].name, Active_array[n].name == '..' ? g_font2 : g_font, t_color, 2 + n * ww / Active_array.length, 0, ww / Active_array.length - 4, wh, 0x00000001 | 0x00000004 | 0x00040000 | 0x00000400);
var string = gr.MeasureString(Active_array[n].name, g_font, 2 + n * ww / Active_array.length, 0, ww / Active_array.length - 4, wh, 0x00000001 | 0x00000004 | 0x00040000 | 0x00000400);
if ( show_buttons == null && arrow_image ) gr.DrawImage( arrow_image, n * ww / Active_array.length + ( ww / Active_array.length / 2 ) + string.Width / 2 + 5, (wh - 10)/2, 14, 10, 0, 0, 16, 16, 0, 255);
}
}
function on_mouse_lbtn_down(x, y, mask) {
g_move = null;
g_button_down = Math.floor( x / (window.Width/Active_array.length) );
window.Repaint();
}
function on_mouse_lbtn_up(x,y){
g_button_down = null;
window.Repaint();
var i = Math.floor( x / (window.Width/Active_array.length) );
if ( i < Active_array.length ) {
try {
if ( show_buttons ) Active_array[i].onClick();
else {
show_buttons = Sup_Buttons[i].name;
update();
}
}
catch(e) { }
}
}
function on_mouse_move(x,y){
window.SetCursor(32649);
//if ( !g_button_down && g_move != Math.floor( x / (window.Width/Active_array.length) ) ) {
if ( !g_button_down && g_move != Math.floor( x / (window.Width/Active_array.length) ) ) {
if ( x < window.Width ) {
g_move = Math.floor( x / ( window.Width/Active_array.length ) );
//fb.trace( 'x=' + x + '| g_move=' + g_move + ' | Active_array.length=' + Active_array.length + ' | window.Width=' + window.Width + ' | Active_array[g_move].name=' + Active_array[g_move].name);
try {
if ( g_move < Active_array.length ) {
tooltip.Text = Active_array[g_move].name;
tooltip.Activate();
window.Repaint();
}
}
catch(e) { }
}
}
}
function on_mouse_wheel(delta) {
if ( delta > 0 && show_buttons ) {
show_buttons = null;
update();
window.Repaint();
}
}
function on_mouse_leave() {
g_move = null;
window.SetCursor( 32512 );
tooltip.Deactivate();
window.Repaint();
}
function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var i = 1;
var ret;
_menu.AppendMenuItem(MF_STRING, i++, "Playing item");
_menu.AppendMenuItem(MF_STRING, i, "Current selection");
_menu.EnableMenuItem( mode, 1 );
_menu.CheckMenuRadioItem( 1, i, mode );
ret = _menu.TrackPopupMenu(x, y);
if (ret >= 1 && ret <= i) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'buttonbar-settings', 'buttonbar_mode', ret);
mode = ret;
window.Repaint();
}
return true;
}
Так вроде бы можно сделать Автоплейлист из библиотеки.ponomart:Офтоп: может кто знает, есть ли возможность, что бы media library сама по себе являлась плейлистом? Может в какой сборке.
Если музыка в порядке и хочется дерева, но не медиабиблиотеки, для этого существует Tree Explorer. Которому можно при необходимости прописать в качестве root-а свой каталог с музыкой и запускать из него воспроизведение хоть потреково, хоть папками. Он и будет два в одном - и деревом, и плейлистом.ponomart:vladj, музыка конечно в порядке, и в ней легко все находится. Попытаюсь объяснить откуда вопрос. Посмотрите на второй скриншот в шапке: плейлист уже выглядит как развернутый эксплорер. Если бы плейлист был в виде дерева со всей музыкой, то ты просто находишь трек и его запускаешь обходясь без библиотеки.
У меня он что, неправильно настроен ? Потреково я из него запустить не могу, видны только альбомыonv:и запускать из него воспроизведение хоть потреково