Список разделов › foobar2000 › Секреты foobar2000
У меня DUIkgena_ua:2.Для использования цвета фона в настройках PSS:
//ColorTypeCUI = { background: 3,};
//var bgcolor = window.GetColorCUI(ColorTypeCUI.background);
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",10,1);
var fading = 1;
var fader = 0;
var fader2;
var fading_step = 1;
var fading_step_on = 5;
var g_timer;
var g_timer_refresh = 10;
var delay = 400;
var fading_step_v = 1;
var v_st = 0;
var g_timer_v;
var g_timer_refresh_v = 3;
var g_drag = 0;
var v;
var text, text_muted, text_width, left_right;
var row = 1;
var line_height = 2;
var txt_row = row + line_height + 1;
var on_mouse = false;
var state = 0;
function pos2vol(pos) { return (50 * Math.log(0.99 * pos + 0.01) / Math.LN10); }
function on_paint(gr) {
var volume = fb.Volume;
var www = Math.pow(10,((fb.Volume+100)/50));
var ww = window.Width;
var wh = window.Height;
// gr.FillSolidRect (0, 0, ww, wh, bgcolor);
gr.FillSolidRect (0, 0, ww, wh, RGB(30,30,30));
var pos = www*ww/100;
if(volume == -100) pos=0;
gr.FillSolidRect( 0, row + line_height, pos, 1, RGBA(0,0,0,100));
gr.FillSolidRect( 0, row, pos, line_height, RGBA(100,113,149,100));
text_muted = volume == -100 ? " Muted" : "" ;
gr.DrawString( text_muted, font, RGB(0,0,0), 1, txt_row + 1, text_width, wh, 0);
gr.DrawString( text_muted, font, RGB(100,115,143), 0, txt_row, text_width, wh, 0);
text = volume == -100 ? " Muted" : " " + Math.round(volume) + " db " ;
text_width = gr.CalcTextWidth(text, font);
left_right = pos < text_width ? 1 : 0;
if(left_right==1) {
gr.DrawString( text, font, RGBA(0,0,0,fader), 1, txt_row + 1, text_width, wh, 0);
gr.DrawString( text, font, RGBA(0,157,255,fader), 0, txt_row, text_width, wh, 0);
} else {
gr.DrawString( text, font, RGBA(0,0,0,fader), pos-text_width + 1, txt_row + 1, text_width, wh, 0);
gr.DrawString( text, font, RGBA(0,157,255,fader), pos-text_width, txt_row, text_width, wh, 0);
}
fader2 = fader - 150 < 0 ? 0 : fader - 150 ;
// gr.FillSolidRect( pos - 3 , row, 3, line_height, RGBA(0,129,215,150 - fader2));
gr.FillSolidRect( 0, row, pos, line_height, RGBA(0,129,215,fader2));
// gr.FillSolidRect( pos, row, ww - pos , line_height , RGBA(0,20,40,fader2));
if ( fading == 1) {
if(on_mouse){
delay = 400;
window.ClearInterval(g_timer);
g_timer = window.SetInterval(function(){
fader = fader + fading_step_on ;
if ( fader >= 255) { fader = 255; window.ClearInterval(g_timer)}
window.Repaint();
}, g_timer_refresh);
}
if(!on_mouse){
window.ClearInterval(g_timer);
g_timer = window.SetInterval(function(){
if ( delay > 0 ) { delay = delay - fading_step };
if ( delay == 0) { fader = fader - fading_step };
if ( fader <= 0) { fader = 0; window.ClearInterval(g_timer)}
window.Repaint();
}, g_timer_refresh);
}
}
// gr.DrawString( delay + " " + fader , font, RGBA(250,250,250,255), 50, 1, ww, wh, 0 );
}
function on_mouse_lbtn_down(x,y) {
g_drag = 1;
}
function on_mouse_lbtn_up(x,y) {
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y) {
if ( fading == 0) { fader = 255 };
on_mouse = true;
window.SetCursor(32649);
if(g_drag) {
v = (x / window.Width)*100;
v = (v<0) ? 0 : (v<100) ? v : 100;
v = -100 + pos2vol(v);
if(fb.Volume!=v) fb.Volume = v;
}
if(on_mouse || g_drag) {
window.Repaint();
}
}
function on_mouse_leave() {
if ( fading == 0) { fader = 0 };
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_mouse_wheel(delta) {
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}
function on_volume_change(val) {
window.Repaint();
}
function on_mouse_mbtn_up(x,y) {
if ( fb.Volume > -100){
v_st = 1;
state =fb.Volume
// fb.Volume = -100;
}else{
v_st = 2;
// fb.Volume = state;
}
window.ClearInterval(g_timer_v);
g_timer_v = window.SetInterval(function(){
if ( v_st == 1){
fb.Volume = fb.Volume - fading_step_v;
if ( fb.Volume <= -100 ) { v_st = 0; window.ClearInterval(g_timer_v)}
}
if ( v_st == 2){
fb.Volume = fb.Volume + fading_step_v;
if ( fb.Volume >= state) { v_st = 0; window.ClearInterval(g_timer_v)}
}
window.Repaint();
}, g_timer_refresh_v);
}
Пожалуйста!вовасбрат:Крепыш, Спасибо! Теперь меньше телодвижений.... И в папке wsh_lastfm теперь каталоги сохраняются с правильным названием (имя артиста)
//ColorTypeCUI = { background: 3,};
//var bgcolor = window.GetColorCUI(ColorTypeCUI.background);
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",10,1);
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var WshShell = new ActiveXObject("WScript.Shell");
var path = fb.ProfilePath;
//var path = fb.ProfilePath + "\\maybe\\settings\\";
var fading = true;
var fader = 0;
var fader1, fader2;
var fading_step = 1;
var fading_step_on = 5;
var g_timer;
var g_timer_refresh = 10;
var delay = 0;
var g_drag = 0;
var g_drag_seek = 0;
var text, text_width, left_right;
var text_h, text_width_h, left_right_h;
var row = 1;
var line_height = 2;
var txt_row = row + line_height + 1;
var on_mouse = false;
var PBTime, SeekTime, PBLength;
var seek_mode ;
var start_end_track = false;
function sec2time(sec) {
var h,m,s;
h = Math.floor(sec/3600);
m = Math.floor((sec-h*3600)/60);
s = sec - h*3600 - m*60;
if(m<10 && h!=0) m = "0" + m;
if(s<10) s = "0" + s;
return (h==0 ? "" : h+":") + m + ":" + s;
}
function on_paint(gr) {
seek_mode = parseInt( utils.ReadINI( path + 'settings.ini', 'seekbar_mode', 'seek_mode', 1) );
var ww = window.Width;
var wh = window.Height;
// gr.FillSolidRect (0, 0, ww, wh, bgcolor);
gr.FillSolidRect (0, 0, ww, wh, RGB(30,30,30));
var pos = 0;
var length = fb.PlaybackLength;
var pos_h = 0;
if(length > 0) {
if(g_drag){
pos = ww * g_drag_seek;
} else {
pos = ww * (fb.PlaybackTime / length);
}
}
pos_h = ww * g_drag_seek;
gr.FillSolidRect( 0, row + line_height, pos, 1, RGBA(0,0,0,100) );
gr.FillSolidRect( 0, row, pos, line_height, RGBA(100,113,149,100) );
if (fb.IsPlaying) {
PBTime = sec2time(Math.floor(fb.PlaybackTime));
SeekTime = sec2time(Math.floor(length*g_drag_seek ));
PBLength = sec2time(Math.floor(fb.PlaybackLength));
// text = " " + sec2time(Math.floor((g_drag && length>0) ? length*g_drag_seek : fb.PlaybackTime )) + " " ;
text = " " + ((g_drag && length>0) ? SeekTime + ((seek_mode == 3) ? " ▪ " + PBLength : "") : PBTime ) + " " ;
text_width = gr.CalcTextWidth(text, font);
left_right = pos < text_width ? 1 : 0;
switch (seek_mode) {
case 2:
text_h = " " + SeekTime + " "; break;
case 3:
text_h = " " + SeekTime + " ▪ " + PBLength + " " ; break;
}
text_width_h = gr.CalcTextWidth(text_h, font) ;
left_right_h = pos_h < text_width_h ? 1 : 0;
if( ( pos_h > text_width_h ? pos_h : text_width_h ) < pos- text_width || pos_h > pos + text_width_h || seek_mode == 1 || g_drag == 1) {
fader1 = fader ;
} else {
fader1 = fader - 100 < 0 ? 0 : fader - 100 ;
}
if(left_right==1) {
gr.DrawString( text, font, RGBA(0,0,0,fader1), 1, txt_row + 1, text_width, wh, 0 );
gr.DrawString( text, font, RGBA(0,157,255,fader1), 0, txt_row, text_width, wh, 0 );
} else {
gr.DrawString( text, font, RGBA(0,0,0,fader1), pos-text_width + 1, txt_row + 1, text_width, wh, 0 );
gr.DrawString( text, font, RGBA(0,157,255,fader1), pos-text_width, txt_row, text_width, wh, 0 );
}
fader2 = fader - 150 < 0 ? 0 : fader - 150 ;
gr.FillSolidRect( 0, row, pos , line_height , RGBA(0,129,215,fader2) );
// gr.FillSolidRect( pos, row, ww - pos , line_height , RGBA(0,20,40,fader2) );
if(g_drag == 0 && seek_mode > 1) {
gr.FillSolidRect( pos_h - 3, row + line_height, 3, 1, RGBA(0,0,0,fader) );
gr.FillSolidRect( pos_h - 3, row, 3, line_height, RGBA(140,164,179,fader) );
if(left_right_h==1) {
gr.DrawString( text_h, font, RGBA(0,0,0,fader), 1, txt_row + 1, text_width_h, wh, 0 );
gr.DrawString( text_h, font, RGBA(140,164,179,fader), 0, txt_row, text_width_h, wh, 0 );
} else {
gr.DrawString( text_h, font, RGBA(0,0,0,fader), pos_h - text_width_h + 1, txt_row + 1, text_width_h, wh, 0 );
gr.DrawString( text_h, font, RGBA(140,164,179,fader), pos_h - text_width_h, txt_row, text_width_h, wh, 0 );
}
}
}
if( (fb.PlaybackLength - fb.PlaybackTime) < 5 || fb.PlaybackTime < 1 ){
start_end_track = true;
} else {
start_end_track = false;
}
// gr.DrawString( start_end_track + " " + delay + " " + fader + " " + on_mouse_sb, font, RGBA(255,255,200,255), ww - 200, txt_row, ww , wh, 0);
if ( fading ) {
if(on_mouse || start_end_track){
delay = 400;
window.ClearInterval(g_timer);
g_timer = window.SetInterval(function(){
fader = fader + fading_step_on ;
if ( fader >= 255) { fader = 255; window.ClearInterval(g_timer)}
window.Repaint();
}, g_timer_refresh);
}
if(!(on_mouse || start_end_track)){
window.ClearInterval(g_timer);
g_timer = window.SetInterval(function(){
if ( delay > 0 ) { delay = delay - fading_step };
if ( delay == 0) { fader = fader - fading_step };
if ( fader <= 0) { fader = 0; window.ClearInterval(g_timer)}
window.Repaint();
}, g_timer_refresh);
}
}
}
function on_mouse_lbtn_down(x,y) {
g_drag = 1;
}
function on_mouse_lbtn_up(x,y) {
if(g_drag) {
g_drag = 0;
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
}
function on_mouse_move(x,y){
if ( !fading ) { fader = 255 };
on_mouse = true;
if(fb.IsPlaying) window.SetCursor(32649);
g_drag_seek = x / window.Width ;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
if(g_drag){
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
}
if(on_mouse || g_drag) {
window.Repaint();
}
}
function on_mouse_leave() {
if ( !fading ) { fader = 0 };
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_playback_new_track(info) {
window.Repaint();
}
function on_playback_stop(reason) {
window.Repaint();
}
function on_playback_seek(time) {
window.Repaint();
}
function on_playback_time(time) {
window.Repaint();
}
function on_mouse_wheel(delta) {
fb.PlaybackTime = delta>0 ? fb.PlaybackTime + 1 : fb.PlaybackTime - 1;
window.Repaint();
}
function on_mouse_rbtn_up (x, y){
var _menu = window.CreatePopupMenu();
var ret = 1;
_menu.AppendMenuItem(0x00000000, ret ++, "PBTime");
_menu.AppendMenuItem(0x00000000, ret ++, "PBTime, seek");
_menu.AppendMenuItem(0x00000000, ret ++, "PBTime, seek, PBLength");
_menu.AppendMenuItem(0x00000800, 0, 0);
var queue_total = plman.GetPlaybackQueueCount();
if (queue_total > 0){
_menu.AppendMenuItem(0x00000000, 4, "Flush playback query");
_menu.AppendMenuItem(0x00000800, 0, 0);
}
_menu.AppendMenuItem(0x00000000, 5, "Configure ...");
_menu.CheckMenuRadioItem(1, ret, seek_mode);
_menu.EnableMenuItem(seek_mode, 1);
ret = _menu.TrackPopupMenu(x, y);
if (ret == 0) return;
switch (ret) {
case 1:
utils.WriteINI( path + 'settings.ini', 'seekbar_mode', 'seek_mode', 1);
break;
case 2:
utils.WriteINI( path + 'settings.ini', 'seekbar_mode', 'seek_mode', 2);
break;
case 3:
utils.WriteINI( path + 'settings.ini', 'seekbar_mode', 'seek_mode', 3);
break;
case 4:
plman.FlushPlaybackQueue();
break;
case 5:{
window.ShowConfigure();
}
break;
_menu.Dispose();
}
return true;
}
function on_mouse_mbtn_up(x,y) {
fb.RunMainMenuCommand('View/Columns playlist/Activate now playing');
}
Scripting Engine Initialization Failed (GUID: 4397BBA8-9D64-4B2B-A0CA-3FFF9B45A54B, CODE: 0x80020101)kgena_ua:По аналоги с WSH Volume bar - Seek bar
Попробовал: "SCRIPT ERROR"kgena_ua:файл нстроек в корне. Я думаю в этом бок. Попробуйте без галочки
Интересно.Nikolaich:Попробуй тот, что у меня
а вот тебе ещё неплохой "track info", коим пользуюсь я:vladj:Конечно интересно, ибо думаю, это лучший сикбар
в любой тег из текстового файла, выделив нужные треки (нужен масттаггер!):kgena_ua:записать значение рейтинга в тэг
Вернуться в Секреты foobar2000