Список разделов › foobar2000 › Есть вопрос!
// Maxim Terpilovsky's script
// http://terpilovsky.ru
// Artwork / Updated 26-04-2011
DT_EDITCONTROL = 0x00002000;
DT_TOP = 0x00000000;
DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_BOTTOM = 0x00000008;
DT_WORDBREAK = 0x00000010;
MF_STRING = 0x00000000;
MK_CONTROL = 0x0008;
DT_CALCRECT = 0x00000400;
MF_POPUP = 0x00000010;
MF_SEPARATOR = 0x00000800;
function StrFmt(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
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 FSO = new ActiveXObject("Scripting.FileSystemObject");
var WshShell = new ActiveXObject("WScript.Shell");
if ( utils.CheckFont( "Segoe UI" ) ) {
var g_font = gdi.Font("Segoe UI", 28);
var g_font2 = gdi.Font("Segoe UI", 11, 1);
var g_font_small = gdi.Font("Segoe UI", 10, 1);
} else {
var g_font = gdi.Font("Tahoma", 12);
var g_font2 = gdi.Font("Tahoma", 11, 1);
var g_font_small = gdi.Font("Tahoma", 10, 1);
}
var tooltip = window.CreateTooltip();
tooltip.SetMaxWidth( 300 );
var arrow_left, arrow_right, info_hover = 0;
try {
var arrow_left = gdi.Image( fb.FoobarPath + "\\themes\\DarkOne\\images\\arrow_left.png" );
var arrow_right = gdi.Image( fb.FoobarPath + "\\themes\\DarkOne\\images\\arrow_right.png" );
var information = gdi.Image( fb.FoobarPath + "\\themes\\DarkOne\\images\\information.png" );
} catch(e) { fb.trace(e.message); }
function CoverShow( metadb ) {
this.CachedPath = 0;
this.CachedCoversNumber = 0;
this.SetMode = function() {
var mode = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'settings', 'displayed_cover') );
if ( !mode ) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'displayed_cover', 1);
var mode = 1;
}
return mode;
}
this.CurrentMode = this.SetMode();
this.SetPriority = function() {
var priority = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'settings', 'cover_priority') );
if ( !priority ) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'cover_priority', 2);
var priority = 2;
}
return priority;
}
this.Priority = this.SetPriority();
this.SetExclude = function() {
var exclude = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'settings', 'exclude_covers') );
if ( isNaN(exclude) ) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'exclude_covers', 0);
var exclude = 0;
}
return exclude;
}
this.Exclude = this.SetExclude();
this.SetPattern = function() {
var pattern = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'settings', 'match_pattern') );
if ( isNaN(pattern) ) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'match_pattern', 1);
var pattern = 1;
}
return pattern;
}
this.MatchPattern = this.SetPattern();
this.SetAspect = function() {
var aspect = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'settings', 'covers_aspect') );
if ( isNaN(aspect) ) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'covers_aspect', 1);
var aspect = 1;
}
return aspect;
}
this.Aspect = this.SetAspect();
this.SetGesture = function() {
var gesture = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'settings', 'gesture_inverted') );
if ( isNaN(gesture) ) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'gesture_inverted', 0);
var gesture = 0;
}
return gesture;
}
this.GestureInverted = this.SetGesture();
this.SetInterval = function() {
var interval = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'settings', 'interval') );
if ( isNaN(interval) ) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'interval', 1);
var interval = 1;
}
return interval;
}
this.Interval = this.SetInterval();
this.Intervals = new Array(5000, 15000, 30000, 60000, 120000);
try {
this.NoCover = gdi.Image( fb.ProfilePath + "s7e_files\\images\\nocover.png" );
this.Case = gdi.Image( fb.ProfilePath + "s7e_files\\images\\case.png" );
}
catch(e) { fb.trace( 'this.NoCover / this.Case:' + e.message ); }
this.OutputMetadb = function() {
switch ( this.CurrentMode ) {
case 3 :
return ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false );
break;
default:
return ( fb.IsPlaying ? fb.GetNowPlaying() : ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false ));
}
}
this.Search = function( array, dir) {
var e = new Enumerator( dir.Files );
while( !e.atEnd() ) {
var name = e.item().Name;
if( name.match(/\.(jpg|jpeg|png|gif|bmp)$/i) ) {
array.push( e.item().Path );
}
e.moveNext();
}
}
this.GetExternalCovers = function( path ) {
var files = [];
var covers = [];
// try - пробуйте
try {
//ParentFolder - Родительская папка
var dir = FSO.GetFile( path ).ParentFolder;
this.Search(files, dir);
var e = new Enumerator( dir.SubFolders );
// SubFolders - вложенные
for(; !e.atEnd(); e.moveNext() ) {
this.Search(files, e.item() );
}
} catch(e) { fb.trace( 'this.GetExternalCovers / path: ' + e.message ); }
if ( files.length > 0 ) {
files.sort();
// push - нажим (на кнопку ?)
for ( key in files ) {
var name = files[key];
// MatchPattern - совпадает шаблон
if ( this.MatchPattern == 1 ) {
if ( name.match(/.*(cover|front|folder)([^\\]*)\.(jpg|jpeg|gif|png|bmp)$/i) ) {
covers.push( name );
files[key] = null;
}
}
else {
if ( name.match(/\\(cover|front|folder)\.(jpg|jpeg|gif|png|bmp)$/i) ) {
covers.push( name );
files[key] = null;
}
}
}
// overall - полный, всеобщий
overall = covers;
for ( key in files ) {
if ( typeof( files[key] ) == 'string' ) overall.push( files[key] );
}
return overall;
}
else return new Array();
}
this.GetCovers = function( path ) {
switch ( this.Exclude ) {
case 0:
var embedded = this.GetEmbeddedCovers();
var external = this.GetExternalCovers( path );
var allcovers = new Array();
if ( this.Priority == 1 ) allcovers = allcovers.concat(embedded, external);
else allcovers = allcovers.concat(external, embedded);
this.Covers = allcovers;
break;
case 1:
var external = this.GetExternalCovers( path );
this.Covers = external;
break;
case 2:
var embedded = this.GetEmbeddedCovers();
this.Covers = embedded;
break;
default:
}
if ( this.Covers.length > 0 ) {
try {
if ( typeof this.Covers[0] == 'object' ) return this.Covers[0].Clone(0, 0, this.Covers[0].Width, this.Covers[0].Height);
else return gdi.Image( this.Covers[0] );
}
catch(e) { fb.trace( 'return this.Covers: ' + e.message ); return undefined; }
}
else {
this.Covers = undefined;
return 0;
}
}
this.GetEmbeddedCovers = function() {
var embedded = [];
for ( c = 0; c < 5; c++) {
if ( c == 3 ) continue;
if ( utils.GetAlbumArtEmbedded( this.Metadb.RawPath, c ) )
embedded.push( utils.GetAlbumArtEmbedded( this.Metadb.RawPath, c ) );
}
return embedded;
}
this.FindEmbeddedCover = function() {
return utils.GetAlbumArtEmbedded( this.Metadb.RawPath, art_id = 0);
}
this.DrawCover = function(gr) {
}
this.ChangeImage = function( val ) {
this.CurrentCover = val;
}
this.NextCover = function() {
if ( this.Covers != undefined && this.Covers.length > 1 ) {
this.CurrentCoverNumber++;
if ( this.CurrentCoverNumber == this.Covers.length ) {
this.CurrentCoverNumber = 0;
}
try {
if ( typeof this.Covers[ this.CurrentCoverNumber ] == 'object' ) var temp = this.Covers[ this.CurrentCoverNumber ].Clone(0, 0, this.Covers[ this.CurrentCoverNumber ].Width, this.Covers[ this.CurrentCoverNumber ].Height);
else var temp = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
if ( temp ) {
this.ChangeImage( temp );
window.Repaint();
}
else {
this.NextCover();
}
} catch (e) {
this.NextCover();
}
}
else if ( this.Covers == undefined ) { this.Update(metadb); window.Repaint(); }
}
this.MultipleCovers = function() {
if ( this.Covers != undefined && this.Covers.length > 1 ) return true;
else return false;
}
this.PrevCover = function() {
if ( this.Covers != undefined && this.Covers.length > 1 ) {
this.CurrentCoverNumber--;
if ( this.CurrentCoverNumber < 0 ) {
this.CurrentCoverNumber = this.Covers.length;
}
try {
if ( typeof this.Covers[ this.CurrentCoverNumber ] == 'object' ) var temp = this.Covers[ this.CurrentCoverNumber ].Clone(0, 0, this.Covers[ this.CurrentCoverNumber ].Width, this.Covers[ this.CurrentCoverNumber ].Height);
else var temp = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
if ( temp ) {
this.ChangeImage( temp );
window.Repaint();
}
else {
this.PrevCover();
}
} catch (e) {
this.PrevCover();
}
}
else if ( this.Covers == undefined ) { this.Update(metadb); window.Repaint(); }
}
this.StopTimer = function() {
this.CycleTimer ? window.KillTimer( this.CycleTimer ) : '';
}
this.StartTimer = function() {
if ( this.CurrentMode == 2 ) {
this.CycleTimer = window.CreateTimerInterval( this.Intervals[ this.Interval ] );
}
}
this.Update = function( metadb) {
this.Metadb = metadb ? metadb : this.OutputMetadb();
try { this.MetaPath = this.Metadb.Path ? this.Metadb.Path : 0; }
catch (e) { fb.trace( 'this.Update / this.MetaPath = ' + e.message); this.MetaPath = 0; }
if ( this.MetaPath ) {
var a = this.CachedPath ? this.CachedPath : ' ';
var b = this.MetaPath;
if ( a.replace(/(.*)\\(.*)\.(.*)$/,'$1') != b.replace(/(.*)\\(.*)\.(.*)$/,'$1') ) {
var update = 1;
}
else {
}
if ( update == 1 ) {
this.Covers = undefined;
this.CurrentCoverNumber = 0;
this.CurrentCover = this.GetCovers( this.MetaPath );
this.CachedPath = this.MetaPath;
this.CachedCoversNumber = this.Covers != undefined ? this.Covers.length : 0;
window.Repaint();
fb.trace('s7e-artwork-panel: covers updated, files reread.');
}
}
else {
fb.trace( 's7e-artwork-panel: can\'t update.' );
this.Covers = undefined;
this.CoverX = null;
this.CoverY = null;
this.CurrentCoverNumber = 0;
this.CurrentCover = 0;
this.CachedPath = '';
this.CachedCoversNumber = 0;
window.Repaint();
}
}
this.Update( metadb);
this.CachedCoversNumber = this.Covers != undefined ? this.Covers.length : 0;
this.CycleTimer = 0;
this.TimerStarted = false;
this.LbtnPressed = 0;
this.X1 = 0;
this.X2 = 0;
this.X = 0;
this.MouseGesture = 0;
this.CoverX = null;
this.CoverY = null;
}
var Cover = new CoverShow();
var a, b, g_hover = 0;
function on_paint( gr ) {
var text, measure;
gr.SetSmoothingMode( 4 );
gr.SetInterpolationMode( 7 );
if ( Cover.Covers != undefined ) {
if ( !Cover.CurrentCover ) {
if ( typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) {
Cover.CurrentCover = Cover.Covers[ Cover.CurrentCoverNumber ].Clone(0, 0, Cover.Covers[ Cover.CurrentCoverNumber ].Width, Cover.Covers[ Cover.CurrentCoverNumber ].Height);
}
else {
Cover.CurrentCover = gdi.Image( Cover.Covers[ Cover.CurrentCoverNumber ] );
}
}
if ( !Cover.CurrentCover ) {
Cover.CoverX = null;
Cover.CoverY = null;
gr.FillSolidRect(0, 0, window.Width, window.Height, RGB(33,33,33));
gr.GdiDrawText( 'Inet Radio', g_font, RGB(128,128,128), 0, 0, window.Width, window.Height, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
}
else {
gr.FillSolidRect(0, 0, window.Width, window.Height, RGB(33,33,33));
var img = Cover.CurrentCover;
if ( Cover.Aspect ) {
if ( img.Width > window.Width || img.Height > window.Height ) {
if ( img.Width / img.Height > window.Width / window.Height ) {
var iw = window.Width;
var ih = img.Height / ( img.Width / window.Width );
img = img.Resize( iw, ih);
}
else {
var ih = window.Height;
var iw = img.Width / ( img.Height / window.Height );
img = img.Resize( iw, ih);
}
}
else {
var iw = img.Width;
var ih = img.Height;
}
}
else {
var iw = ( img.Width > window.Width ) ? window.Width : img.Width;
var ih = ( img.Height > window.Height ) ? window.Height : img.Height;
img = img.Resize( iw, ih);
}
img = img.CreateRawBitmap();
var x = (iw < ih) ? ((iw < window.Width) ? ((window.Width - iw)/2) : 0 ) : ((iw >= window.Width) ? 0 : ((window.Width - iw)/2));
var y = (iw > ih) ? ((ih < window.Height) ? ((window.Height - ih)/2) : 0 ) : ((ih >= window.Height) ? 0 : ((window.Height - ih)/2));
Cover.CoverX = x;
Cover.CoverY = y;
gr.GdiDrawBitmap( img,
x,
y,
img.Width,
img.Height,
0,0, img.Width, img.Height );
if ( g_hover ) {
if ( information ) gr.DrawImage( information, x, y, 16, 16, 0, 0, 16, 16, 0, 150);
if ( info_hover ) {
var text = '1. Следующее изображение (Левая кн. или колесико мыши)\n\n2. Следующее изображение (Левая кн + жест мыши)\n\n3. Просмотр внешней программой(Ctrl + Левая кн. мыши)';
measure = gr.MeasureString( text, g_font_small, 0, 0, window.Width / 2, 0, DT_LEFT | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
gr.FillSolidRect( (window.Width - measure.Width - 10) / 2, ( window.Height - measure.Height - 10 ) / 2, measure.Width + 10, measure.Height + 10, RGBA(0,0,0,150));
gr.GdiDrawText( text, g_font_small, RGB(255,255,255), (window.Width - measure.Width) / 2, ( window.Height - measure.Height ) / 2, measure.Width, measure.Height, DT_LEFT | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
}
measure = gr.MeasureString( Cover.CurrentCover.Width + " ? " + Cover.CurrentCover.Height, g_font_small, 5, 0, window.Width-10, 0, 0);
gr.FillSolidRect( x + img.Width - measure.Width - 10, y + img.Height - measure.Height - 5, measure.Width + 10, measure.Height + 5, RGBA(32,32,32,150));
gr.GdiDrawText( Cover.CurrentCover.Width + " ? " + Cover.CurrentCover.Height, g_font_small, RGB(255,255,255), x + img.Width - measure.Width - 10, y + img.Height - measure.Height - 5, measure.Width + 10, measure.Height + 5, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
measure = gr.MeasureString( (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length, g_font_small, 5, 0, window.Width-10, 0, 0);
gr.FillSolidRect( x + img.Width - measure.Width - 10, y , measure.Width + 10, measure.Height, RGBA(32,32,32,150));
gr.GdiDrawText( (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length, g_font_small, RGB(255,255,255), x + img.Width - measure.Width - 10, y , measure.Width + 10, measure.Height, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
if ( Cover.MouseGesture ) {
if ( Cover.MouseGesture == 'next' && arrow_right ) {
gr.FillEllipse( window.Width - 18, ( window.Height - arrow_right.Height ) / 2 - 1, 18, 18, RGBA(255,255,255,255));
gr.DrawImage( arrow_right, window.Width - 16, ( window.Height - arrow_right.Height ) / 2, 16, 16, 0, 0, 16, 16, 0, 255);
}
else if ( Cover.MouseGesture == 'prev' && arrow_left ) {
gr.FillEllipse( 0, ( window.Height - arrow_left.Height ) / 2 - 1, 18, 18, RGBA(255,255,255,255));
gr.DrawImage( arrow_left, 0, ( window.Height - arrow_left.Height ) / 2, 16, 16, 0, 0, 16, 16, 0, 255);
}
}
}
var graphics = Cover.CurrentCover.GetGraphics();
Cover.CurrentCover.ReleaseGraphics( graphics );
Cover.CurrentCover.Dispose();
Cover.CurrentCover = 0;
}
}
else {
Cover.CoverX = null;
Cover.CoverY = null;
gr.FillSolidRect(0, 0, window.Width, window.Height, RGB(33,33,33));
gr.GdiDrawText( 'Inet Radio', g_font, RGB(128,128,128), 0, 0, window.Width, window.Height, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
}
}
function on_mouse_move(x, y) {
if ( Cover.Covers != undefined && !Cover.X1 ) {
var rep = 0;
if ( Cover.Covers.length > 0 && !g_hover && Cover.Covers[ Cover.CurrentCoverNumber ] ) {
g_hover = 1;
if ( typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) var text = 'Embedded into "' + Cover.MetaPath.replace(/(.*)\\(.*)\.(.*)$/,'$2.$3') + '"';
else {
try { var a = '\nSize: ' + Math.round( FSO.GetFile( Cover.Covers[ Cover.CurrentCoverNumber ] ).size / 1024 ) + " Kb"; }
catch(e) { var a = ''; }
var b = 'Path: ' + Cover.Covers[ Cover.CurrentCoverNumber ];
var text = b + a;
}
tooltip.Text = text;
tooltip.Activate();
var rep = 1;
}
if ( info_hover == 0 && (x >= Cover.CoverX && x <= Cover.CoverX + 16) && (y >= Cover.CoverY && y <= Cover.CoverY + 16) ) {
info_hover = 1;
var rep = 1;
}
else if ( info_hover == 1 && ((x < Cover.CoverX || x > Cover.CoverX + 16) || (y < Cover.CoverY || y > Cover.CoverY + 16)) ) {
info_hover = 0;
var rep = 1;
}
if ( rep == 1 ) window.Repaint();
}
else if ( Cover.MultipleCovers() && Cover.X1 ) {
info_hover = 0;
Cover.X2 = x;
if ( Cover.X1 < Cover.X2 && Math.abs( Cover.X1 - Cover.X2 ) > 8 ) Cover.GestureInverted == 1 ? Cover.MouseGesture = 'next' : Cover.MouseGesture = 'prev';
else if ( Cover.X1 > Cover.X2 && Math.abs( Cover.X1 - Cover.X2 ) > 8 ) Cover.GestureInverted == 1 ? Cover.MouseGesture = 'prev' : Cover.MouseGesture = 'next';
if ( Cover.MouseGesture == 'prev' ^ Cover.MouseGesture == 'next' ) {
window.Repaint();
}
}
}
function on_mouse_leave() {
g_hover = 0;
info_hover = 0;
Cover.X1 = 0;
Cover.X2 = 0;
Cover.X = 0;
Cover.MouseGesture = 0;
tooltip.Deactivate();
window.Repaint();
}
function on_mouse_wheel( step ) {
(step < 0) ? Cover.NextCover() : Cover.PrevCover();
}
function on_mouse_lbtn_down(x, y, mask) {
Cover.LbtnPressed = 1;
Cover.X1 = x;
}
function on_mouse_lbtn_up(x, y, mask) {
if ( !mask && Cover.MultipleCovers() && Cover.X1 ) {
Cover.X2 = x;
if ( Cover.X1 < Cover.X2 && Math.abs( Cover.X1 - Cover.X2 ) > 8 ) Cover.GestureInverted == 1 ? Cover.NextCover() : Cover.PrevCover();
else if ( Cover.X1 > Cover.X2 && Math.abs( Cover.X1 - Cover.X2 ) > 8 ) Cover.GestureInverted == 1 ? Cover.PrevCover() : Cover.NextCover();
else Cover.NextCover();
Cover.LbtnPressed = 0;
Cover.X1 = 0;
Cover.X2 = 0;
Cover.X = 0;
Cover.MouseGesture = 0;
}
else if ( mask == MK_CONTROL ) {
if ( typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) WshShell.run( '"' + Cover.MetaPath.replace(/\\\w*\..*/, '') + '"' );
else if ( Cover.Covers[ Cover.CurrentCoverNumber ] ) WshShell.run( '"' + Cover.Covers[ Cover.CurrentCoverNumber ] + '"' );
}
}
function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var _firstgroup = window.CreatePopupMenu();
var _secondgroup = window.CreatePopupMenu();
var _thirdgroup = window.CreatePopupMenu();
var _fourthgroup = window.CreatePopupMenu();
var _fivthgroup = window.CreatePopupMenu();
var _sixthgroup = window.CreatePopupMenu();
var _seventhgroup = window.CreatePopupMenu();
var _eighthgroup = window.CreatePopupMenu();
var _ninthgroup = window.CreatePopupMenu();
var i = 1;
var ret;
_firstgroup.AppendMenuItem(MF_STRING, i++, "Переключение вручную");
_firstgroup.AppendMenuItem(MF_STRING, i++, "Переключение автоматическое");
_firstgroup.AppendMenuItem(MF_STRING, i++, "Текущий выбор");
_firstgroup.EnableMenuItem( Cover.CurrentMode, 1 );
_firstgroup.CheckMenuRadioItem( 1, i-1, Cover.CurrentMode );
_secondgroup.AppendMenuItem(MF_STRING, i++, "Вложеные обложки");
_secondgroup.AppendMenuItem(MF_STRING, i++, "Внешние обложки");
_secondgroup.EnableMenuItem( Cover.Priority + 3, 1 );
_secondgroup.CheckMenuRadioItem( i-2, i-1, Cover.Priority + 3 );
_thirdgroup.AppendMenuItem(MF_STRING, i++, "Вложеные обложки");
_thirdgroup.AppendMenuItem(MF_STRING, i++, "Внешние обложки");
if ( Cover.Exclude ) {
_thirdgroup.CheckMenuRadioItem( i-2, i-1, Cover.Exclude + 5 );
}
_fourthgroup.AppendMenuItem(MF_STRING, i++, "*ключевое слово*.*");
_fourthgroup.AppendMenuItem(MF_STRING, i++, " ключевое слово.*");
_fourthgroup.EnableMenuItem( Cover.MatchPattern + 7, 1 );
_fourthgroup.CheckMenuRadioItem( i-2, i-1, Cover.MatchPattern + 7 );
_fivthgroup.AppendMenuItem(MF_STRING, i++, "5 секунд");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "15 секунд");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "30 секунд");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "1 минута");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "2 минуты");
_fivthgroup.EnableMenuItem( Cover.Interval + 10, 1 );
_fivthgroup.CheckMenuRadioItem( i-5, i-1, Cover.Interval + 10 );
_sixthgroup.AppendMenuItem(MF_STRING, i++, "По размеру окна");
_sixthgroup.AppendMenuItem(MF_STRING, i++, "Исходное соотношение сторон");
_sixthgroup.EnableMenuItem( Cover.Aspect + 15, 1 );
_sixthgroup.CheckMenuRadioItem( i-2, i-1, Cover.Aspect + 15 );
_seventhgroup.AppendMenuItem(MF_STRING, i++, "Инвертировать лев./прав. жест");
_seventhgroup.CheckMenuItem( i-1, Cover.GestureInverted );
_eighthgroup.AppendMenuItem(MF_STRING, i++, "cover.*");
_eighthgroup.AppendMenuItem(MF_STRING, i++, "folder.*");
_eighthgroup.AppendMenuItem(MF_STRING, i++, "front.*");
_eighthgroup.AppendMenuItem(MF_STRING, i++, "back.*");
_eighthgroup.AppendMenuItem(MF_STRING, i++, "disc.*");
_eighthgroup.AppendMenuItem(MF_STRING, i++, "%album%.*");
_ninthgroup.AppendMenuItem(MF_STRING, i, "Текущее изображение");
if ( Cover.Covers && typeof Cover.Covers[ Cover.CurrentCoverNumber ] != 'object' ) {
var imagepath = Cover.Covers[ Cover.CurrentCoverNumber ];
var dir = imagepath.replace(/(.*)\\(.*)\.(.*)$/,'$1');
var imagename = imagepath.replace(/(.*)\\(.*)\.(.*)$/,'$2.$3');
var ext = imagename.replace(/(.*)\.(.*)$/,'$2');
if ( imagename == ('cover.' + ext ) || FSO.FileExists( dir + '\\cover.' + ext ) ) _eighthgroup.EnableMenuItem( 18, 1 );
if ( imagename == ('folder.' + ext ) || FSO.FileExists( dir + '\\folder.' + ext ) ) _eighthgroup.EnableMenuItem( 19, 1 );
if ( imagename == ('front.' + ext ) || FSO.FileExists( dir + '\\front.' + ext ) ) _eighthgroup.EnableMenuItem( 20, 1 );
if ( imagename == ('back.' + ext ) || FSO.FileExists( dir + '\\back.' + ext ) ) _eighthgroup.EnableMenuItem( 21, 1 );
if ( imagename == ('disc.' + ext ) || FSO.FileExists( dir + '\\disc.' + ext ) ) _eighthgroup.EnableMenuItem( 22, 1 );
var album = fb.Titleformat("$replace(%album%,/,-,\,-,:,-,*,-,?,-,\",-,<,-,>,-,|,-)").EvalWithMetadb( Cover.OutputMetadb() );
if ( imagename == (album + '.' + ext ) || FSO.FileExists( dir + '\\' + album + '.' + ext ) ) _eighthgroup.EnableMenuItem( 23, 1 );
}
else {
_eighthgroup.EnableMenuItem( 18, 1 );
_eighthgroup.EnableMenuItem( 19, 1 );
_eighthgroup.EnableMenuItem( 20, 1 );
_eighthgroup.EnableMenuItem( 21, 1 );
_eighthgroup.EnableMenuItem( 22, 1 );
_eighthgroup.EnableMenuItem( 23, 1 );
_ninthgroup.EnableMenuItem( 24, 1 );
}
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _firstgroup.ID, "Режимы просмотра");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _secondgroup.ID, "Приоритет просмотра");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _thirdgroup.ID, "Исключить из просмотра");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _fourthgroup.ID, "Настройки соответствия");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _fivthgroup.ID, "Интервалы переключения");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _sixthgroup.ID, "Размер изображения");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _seventhgroup.ID, "Жесты мыши");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _eighthgroup.ID, "Переименовать изображение в...");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _ninthgroup.ID, "Удалить...");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING, ++i, "Остановить просмотр");
_menu.AppendMenuItem(MF_STRING, ++i, "Просмотр внешней программой");
if ( !Cover.Covers || typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) {
_menu.EnableMenuItem( 26, 1 );
}
ret = _menu.TrackPopupMenu(x, y);
if (ret >= 1 && ret <= 3) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'displayed_cover', ret);
Cover = new CoverShow();
window.Repaint();
}
else if (ret >= 4 && ret <= 5) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'cover_priority', ret - 3);
Cover = new CoverShow();
window.Repaint();
}
else if (ret >= 6 && ret <= 7) {
if ( ( ret - 5 ) == Cover.Exclude ) utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'exclude_covers', 0);
else utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'exclude_covers', ret - 5);
Cover = new CoverShow();
window.Repaint();
}
else if (ret >= 8 && ret <= 9) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'match_pattern', ret - 7 );
Cover.MatchPattern = ret - 7;
Cover = new CoverShow();
window.Repaint();
}
else if (ret >= 10 && ret <= 14) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'interval', ret - 10);
Cover.Interval = ret - 10;
Cover.StopTimer();
Cover.StartTimer();
window.Repaint();
}
else if (ret >= 15 && ret <= 16) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'covers_aspect', ret - 15);
Cover.Aspect = ret - 15;
window.Repaint();
}
else if (ret == 17) {
if ( Cover.GestureInverted == 1 ) utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'gesture_inverted', 0);
else utils.WriteINI( fb.FoobarPath + 's7e.ini', 'settings', 'gesture_inverted', 1);
Cover.GestureInverted = Cover.GestureInverted == 1 ? 0 : 1;
}
else if (ret == 18) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], dir + '\\cover.' + ext );
Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\cover.' + ext;
window.Repaint();
} catch(e) { }
}
else if (ret == 19) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], dir + '\\folder.' + ext );
Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\folder.' + ext;
window.Repaint();
} catch(e) { }
}
else if (ret == 20) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], dir + '\\front.' + ext );
Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\front.' + ext;
window.Repaint();
} catch(e) { }
}
else if (ret == 21) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], dir + '\\back.' + ext );
Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\back.' + ext;
window.Repaint();
} catch(e) { }
}
else if (ret == 22) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], dir + '\\disc.' + ext );
Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\disc.' + ext;
window.Repaint();
} catch(e) { }
}
else if (ret == 23) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], dir + '\\' + album + '.' + ext );
Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\' + album + '.' + ext;
window.Repaint();
} catch(e) { }
}
else if (ret == 24 ) {
try {
if ( Cover.Covers && Cover.Covers[ Cover.CurrentCoverNumber ] ) {
FSO.DeleteFile( Cover.Covers[ Cover.CurrentCoverNumber ] );
Cover = new CoverShow();
window.Repaint();
}
} catch(e) { }
}
else if (ret == 25 ) {
Cover = new CoverShow();
window.Repaint();
}
else if (ret == 26 ) {
if ( Cover.Covers && typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) WshShell.run( '"' + Cover.MetaPath.replace(/\\\w*\..*/, '') + '"' );
else if ( Cover.Covers && Cover.Covers[ Cover.CurrentCoverNumber ] ) WshShell.run( '"' + Cover.Covers[ Cover.CurrentCoverNumber ] + '"' );
}
return true;
}
function on_playback_stop( Reason ) {
Cover.StopTimer();
if ( Reason == 0 ) on_item_focus_change();
}
function on_item_focus_change() {
Cover.Update();
}
function on_playlist_switch() {
Cover.Update();
}
function on_playback_new_track( metadb ){
Cover.Update( metadb );
Cover.StartTimer();
}
function on_timer(id) {
if ( Cover.CurrentMode == 2 && Cover.CycleTimer.ID == id ) {
Cover.NextCover();
}
}
Гость:обложки у меня лежат в подпапках Scans или Covers с альбомами? как сделать, чтою плеер брал их от туда?