Список разделов › foobar2000 › Есть вопрос!
Блин там сэмплы только, скрипты из темы вытаскивать придется. Но все равно спасибоvladj:Скачай тему ОТСЮДА, там
Смотри сборки от Максима.Гость:чтобы автоматически чередовались все картинки в папке трека
Ни с одного адреса не удалось скачать сборку от максима. Ссылки битые - пишут что она умерла.kgena_ua:kgena_ua » 42 минуты назад
Гость писал(а):чтобы автоматически чередовались все картинки в папке трека
Смотри сборки от Максима.
//Maxim Terpilovsky's script Artwork (http://terpilovsky.ru))\\\
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
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 WshShell = new ActiveXObject("WScript.Shell");
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var g_font = gdi.Font("Tahoma", 11);
function CoverShow( metadb ) {
this.CachedPath = 0;
// Search for files
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|tif|bmp)$/i) ) {
array.push( e.item().Path );
}
e.moveNext();
}
}
// Find all covers in the folder
this.GetExternalCovers = function( path ) {
var files = [];
var covers = [];
try {
var dir = FSO.GetFile( path ).ParentFolder;
this.Search(files, dir);
var e = new Enumerator( dir.SubFolders );
for(; !e.atEnd(); e.moveNext() ) {
this.Search(files, e.item() );
}
} catch(e) { fb.trace( 'this.GetExternalCovers / path: ' + e.message ); }
if ( files.length > 0 ) {
for ( key in files ) {
var name = files[key];
if ( name.match(/.*(cover|front|folder).*\.(jpg|jpeg|gif|png)$/i) ) {
covers.push( name );
files[key] = null;
}
}
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 ) {
var embedded = this.GetEmbeddedCovers();
var external = this.GetExternalCovers( path );
var allcovers = new Array();
if ( 2== 1 ) allcovers = allcovers.concat(embedded, external);
else allcovers = allcovers.concat(external, embedded);
this.Covers = allcovers;
if ( this.Covers.length > 0 ) {
try {
if ( typeof this.Covers[0] == 'object' ) return this.Covers[0];
else return gdi.Image( this.Covers[0] );
}
catch(e) { fb.trace( 'return this.Covers: ' + e.message ); return null; }
}
else {
this.Covers = null;
return null;
}
}
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) {
gr.FillGradRect(0,0,window.Width/2,window.Height, -60,RGB(19,30,38),RGB(100,100,100));
gr.FillGradRect(window.Width/2,0,window.Width/2,window.Height,60,RGB(100,100,100),RGB(19,30,38));
if ( this.Covers != undefined && !this.CurrentCover ) {
if ( typeof this.Covers[ this.CurrentCoverNumber ] == 'object' ) {
this.CurrentCover = this.Covers[ this.CurrentCoverNumber ].Clone(0, 0, this.Covers[ this.CurrentCoverNumber ].Width, this.Covers[ this.CurrentCoverNumber ].Height);
}
else {
this.CurrentCover = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
}
}
if ( !this.CurrentCover ) {
var img = gdi.Image( fb.ProfilePath + "images\\nocover.png" );
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 img = this.CurrentCover;
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);
}
}
}
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);
gr.DrawImage( img,
(iw < ih) ? ((iw < window.Width) ? ((window.Width - iw)/2) : 0 ) : ((iw >= window.Width) ? 0 : ((window.Width - iw)/2)),
(iw > ih) ? ((ih < window.Height) ? ((window.Height - ih)/2) : 0 ) : ((ih >= window.Height) ? 0 : ((window.Height - ih)/2)),
img.Width, img.Height, 0,0, img.Width, img.Height );
}
this.ChangeImage = function( val ) {
this.CurrentCover = val;
}
this.NextCover = function() {
if ( this.Covers != null && 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 ];
else var temp = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
if ( temp ) {
this.ChangeImage( temp );
window.Repaint();
}
else this.NextCover();
} catch (e) {
this.NextCover();
}
}
}
this.PrevCover = function() {
if ( this.Covers != null && 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 ];
else var temp = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
if ( temp ) {
this.ChangeImage( temp );
window.Repaint();
}
else this.PrevCover();
} catch (e) {
this.PrevCover();
}
}
}
this.StopTimer = function() {
this.CycleTimer ? window.KillTimer( this.CycleTimer ) : '';
}
this.StartTimer = function() {
this.CycleTimer = window.CreateTimerInterval( 17000 );
}
this.OutputMetadb = function() {
return ( fb.IsPlaying ? fb.GetNowPlaying() : ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false ));
}
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 ) {
// fb.trace( 'UPDATED!' );
this.CurrentCoverNumber = 0;
this.CurrentCover = this.GetCovers( this.MetaPath );
this.CachedPath = this.MetaPath;
}
else {
this.Covers = null;
this.CurrentCover = this.NoCover;
this.CurrentCover = null;
}
}
this.Update(metadb);
this.CycleTimer = 0;
this.TimerStarted = false;
}
var Cover = new CoverShow();
var a, b, g_hover = 0;
function on_paint( gr ) {
var text, measure;
Cover.DrawCover( gr );
if ( Cover.Covers != null && g_hover ) {
if ( Cover.Covers.length > 0 ) {
text = "wheel - on, double-click - view";
measure = gr.MeasureString( text, g_font, 0, 0, window.Width, 0, 0);
gr.FillSolidRect( 0, 0, window.Width, 2*measure.Height, RGBA(32,32,32,100));
gr.GdiDrawText( text, g_font, RGB(255,255,255), 0, 0, window.Width, measure.Height, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
if ( typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) text = "Enclosing the track" + Cover.MetaPath.replace(/(.*)\\(.*)\.(.*)$/,'$2.$3') + '"' + " [" + (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length + "]";
else text = Cover.Covers[ Cover.CurrentCoverNumber ].replace(/(.*)\\(.*)\.(.*)$/,'$2.$3') + " [" + (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length + "]";
}
measure = gr.MeasureString( text, g_font, 5, 0, window.Width-6, 0, 0);
gr.FillSolidRect( 0, window.Height - measure.Height, window.Width, measure.Height, RGBA(32,32,32,100));
gr.GdiDrawText( text, g_font, RGB(204,219,216), 0, window.Height - measure.Height, window.Width, measure.Height, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
}
}
function on_playback_new_track( metadb ){
Cover.Update( metadb );
Cover.StartTimer();
window.Repaint();
}
function on_mouse_move(x, y) {
if ( !g_hover ) {
g_hover = 1;
window.Repaint();
}
}
function on_mouse_leave() {
g_hover = 0;
window.Repaint();
}
function on_mouse_wheel( step ) {
(step < 0) ? Cover.NextCover() : Cover.PrevCover();
}
function on_mouse_lbtn_dblclk(x, y) {
if ( Cover.Covers != undefined )
{
if( Cover.Covers[ Cover.CurrentCoverNumber ] ) WshShell.run( '"' + Cover.Covers[ Cover.CurrentCoverNumber ] + '"' );
}
}
function on_playback_stop( Reason ) {
Cover.StopTimer();
}
function on_playlist_switch() {
var a = Cover.CachedPath ? Cover.CachedPath : ' ';
var b = Cover.OutputMetadb() ? Cover.OutputMetadb().Path : ' ';
if ( a.replace(/(.*)\\(.*)\.(.*)$/,'$1') != b.replace(/(.*)\\(.*)\.(.*)$/,'$1') ) {
Cover.Update();
window.Repaint();
}
}
function on_timer(id) {
if ( Cover.CycleTimer.ID == id ) {
Cover.NextCover();
}
}
Спасибо за код. Он работает под Defult_User_Interface.vladj:vladj » 34 минуты назад
Код: Выделить всё
// 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(19,30,38));
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(19,30,38));
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(19,30,38));
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();
}
}
Большое спасибо. Это что нужно. Много ручных настроек. Со скриптом разбираться буду потом, а сейчас просто выставил смену через 5 сек и все прекрасно - картинки меняются. Красота.vladj:vladj » 21 минуту назад
Скрипт из рабочей сборки, перед выкладыванием проверил. Цикл включён, время великовато правда у меня.
Сменить можно в строке ...
this.StartTimer = function() {
this.CycleTimer = window.CreateTimerInterval( 17000 );
Меняем значение, щёлкаем применить, смотрим что получилось и т.д. пока нужный период не найдём.
Можно другой от него-же поставить, там настройки правой по панели...только код больше намного...
// Maxim Terpilovsky's script
// http://terpilovsky.ru
// Artwork / Updated 27-01-2014
DT_END_ELLIPSIS = 0x00008000;
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;
MK_SHIFT = 0x0004;
DT_NOPREFIX = 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");
var ww, wh;
var g_hover = 0;
if ( utils.CheckFont( "Segoe UI" ) ) {
var g_font = gdi.Font("Segoe UI", 13);
var g_font2 = gdi.Font("Segoe UI", 12, 0);
var g_font_small = gdi.Font("Segoe UI", 11, 0);
} else {
var g_font = gdi.Font("Tahoma", 13);
var g_font2 = gdi.Font("Tahoma", 11, 1);
var g_font_small = gdi.Font("Tahoma", 10, 1);
}
///var arrow_left, arrow_right, info_hover = 0;
///try {
/// var arrow_left = gdi.Image( fb.FoobarPath + "\\s7e_files\\images\\arrow_left.png" );
/// var arrow_right = gdi.Image( fb.FoobarPath + "\\s7e_files\\images\\arrow_right.png" );
/// var picture = gdi.Image( fb.FoobarPath + "\\s7e_files\\images\\picture.png" );
/// var user_image = gdi.Image( fb.FoobarPath + "\\s7e_files\\images\\user.png" );
///} catch(e) {
/// // fb.trace(e.message);
///}
function CoverShow( metadb ) {
this.CachedPath = 0;
this.CachedCoversNumber = 0;
// Current Mode
this.CurrentMode = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'displayed_cover', 1) );
// Current Mode
this.DisplayMode = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'disp_mode', 1) );
// Priority
this.Priority = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'cover_priority', 2) );
// Exclude
this.Exclude = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'exclude_covers', 0) );
// Pattern
// 1 - *keywords*.*
// 2 - keywords.*
this.MatchPattern = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'match_pattern', 1) );
// Aspect ratio
this.Aspect = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'covers_aspect', 1) );
// Gesture
this.GestureInverted = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'gesture_inverted', 0) );
// Covers from Root folder
this.RootCovers = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'root_covers', 1) );
// Covers from subfolders
this.SubCovers = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'sub_covers', 1) );
// Interval
this.Interval = parseInt( utils.ReadINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'interval', 1) );
this.Intervals = new Array(5000, 15000, 30000, 60000, 120000);
cache_path = utils.ReadINI(fb.FoobarPath + 's7e.ini', 'bio', 'cache_path');
this.CachePath = cache_path ? cache_path : false;
// No Cover and Case
//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) { }
// Metadb
this.OutputMetadb = function() {
return ( this.CurrentMode == 3 || !fb.IsPlaying ? fb.GetFocusItem(true) : fb.GetNowPlaying() );
}
this.FormatMeta = function( meta, db ) {
if ( db ) {
s = fb.TitleFormat("%" + meta + "%").EvalWithMetadb( db );
s = s.replace(/[\/\\\:\*\?\"\<\>\|]/g,'-');
s = s.replace(/(^\s+)|(\s+$)/g, "");
return s;
} else return '';
}
// Search for files
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|tiff)$/i) ) {
array.push( e.item().Path );
}
e.moveNext();
}
}
// Find all covers in the folder
this.GetExternalCovers = function( path ) {
var files = [];
var files_this = [];
var files_subs = [];
var covers = [];
try {
var dir = FSO.GetFolder( path );
var root = dir.ParentFolder;
this.Search(files_this, dir);
this.Search(files_this, root);
if ( this.SubCovers ) {
var e = new Enumerator( dir.SubFolders );
for(; !e.atEnd(); e.moveNext() ) {
this.Search(files_subs, e.item() );
}
}
} catch(e) {
// fb.trace( 'this.GetExternalCovers / path: ' + e.message );
}
if ( files_this.length > 0 || files_subs.length > 0 ) {
files_this.sort();
files_subs.sort();
files = files.concat(files_this, files_subs);
var k = files.length;
files.reverse();
while (k--){
var name = files[k];
if ( this.MatchPattern == 1 ) {
if ( name.match(/.*(cover|front|folder)([^\\]*)\.(jpg|jpeg|gif|png|bmp|tiff)$/i) ) {
covers.push( name );
files[k] = null;
}
}
else {
if ( name.match(/\\(cover|front|folder)\.(jpg|jpeg|gif|png|bmp|tiff)$/i) ) {
covers.push( name );
files[k] = null;
}
}
}
overall = covers;
k = files.length;
while (k--){
var cur = files[k];
if ( typeof( cur ) == 'string' ) overall.push( cur );
}
return overall;
}
else return new Array();
}
this.GetCovers = function( path ) {
switch ( this.Exclude ) {
case 0:
var embedded = this.DisplayMode == 2 && this.CachePath ? [] : this.GetEmbeddedCovers( this.Metadb );
var external = this.GetExternalCovers( path );
var allcovers = [];
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.DisplayMode == 2 && this.CachePath ? [] : this.GetEmbeddedCovers( this.Metadb );
this.Covers = embedded;
break;
}
if ( this.Covers.length > 0 ) {
try {
var temp = this.Covers[0];
return ( typeof temp == 'object' ? temp.Clone( 0, 0, temp.Width, temp.Height ) : gdi.LoadImageAsync( window.ID, temp ) );
}
catch(e) { return undefined; }
}
else {
this.Covers = false;
return 0;
}
}
this.GetEmbeddedCovers = function( metadb ) {
if ( metadb ) {
var embedded = [];
var c = 5;
while ( c-- ) {
if ( c == 3 ) continue;
var temp = utils.GetAlbumArtEmbedded( metadb.RawPath, c );
if ( temp ) embedded.push( temp );
}
return embedded;
} else return [];
}
this.CompareDirs = function() {
metadb = this.OutputMetadb();
try {
artist = this.Eval( this.Metadb, 'artist' );
metapath = metadb.Path;
metapath = this.DisplayMode == 2 && this.CachePath && FSO.FolderExists( this.CachePath + '\\' + artist ) ? this.CachePath + '\\' + artist : metapath.replace(/\\([^\\]*)$/g, '');
}
catch (e) { metapath = 0; }
if ( metapath ) {
switch ( this.Exclude ) {
case 0:
var embedded = this.DisplayMode == 2 && this.CachePath ? [] : this.GetEmbeddedCovers( this.Metadb );
var external = this.GetExternalCovers( metapath );
var allcovers = [];
if ( this.Priority == 1 ) allcovers = allcovers.concat(embedded, external);
else allcovers = allcovers.concat(external, embedded);
//this.Covers = allcovers;
break;
case 1:
var allcovers = this.GetExternalCovers( metapath );
//this.Covers = external;
break;
case 2:
var allcovers = this.DisplayMode == 2 && this.CachePath ? [] : this.GetEmbeddedCovers();
//this.Covers = embedded;
break;
}
var allcovers = new Array();
allcovers = allcovers.concat(embedded, external);
return this.CachedCoversNumber == allcovers.length;
}
}
this.ChangeImage = function( val ) {
this.CurrentCover = val;
}
this.NextCover = function() {
if ( this.Covers && this.Covers.length > 1 ) {
this.CurrentCoverNumber = this.CurrentCoverNumber + 1 == this.Covers.length ? 0 : this.CurrentCoverNumber + 1;
try {
var temp = this.Covers[ this.CurrentCoverNumber ];
var img = ( typeof temp == 'object' ) ? temp.Clone(0,0,temp.Width,temp.Height) : gdi.LoadImageAsync(window.ID, temp);
} catch (e) { var img = undefined; }
this.ChangeImage( img );
window.Repaint();
}
else if ( !this.Covers ) { this.Update(); }
}
this.MultipleCovers = function() {
return ( this.Covers && this.Covers.length > 1 );
}
this.PrevCover = function() {
if ( this.Covers && this.Covers.length > 1 ) {
this.CurrentCoverNumber = ( this.CurrentCoverNumber == 0 ) ? this.Covers.length - 1 : this.CurrentCoverNumber - 1;
try {
var temp = this.Covers[ this.CurrentCoverNumber ];
var img = ( typeof temp == 'object' ) ? temp.Clone(0,0,temp.Width,temp.Height) : gdi.LoadImageAsync(window.ID, temp);
} catch (e) { var img = undefined; }
this.ChangeImage( img );
window.Repaint();
}
else if ( !this.Covers ) { this.Update(); }
}
this.StopTimer = function() {
this.CycleTimer ? window.ClearInterval(this.CycleTimer) : '';
}
this.StartTimer = function() {
if ( this.CycleTimer ) window.ClearInterval( this.CycleTimer );
if ( this.CurrentMode == 2 ) this.CycleTimer = window.SetInterval( function() { Cover.NextCover() }, this.Intervals[ this.Interval ] );
}
this.Reset = function() {
this.Covers = false;
this.CoverX = null;
this.CoverY = null;
this.CurrentCoverNumber = 0;
this.CurrentCover = 0;
this.CachedPath = '';
this.CachedCoversNumber = 0;
this.CachedArtist = '';
}
this.Eval = function( meta, field ) {
path = meta ? meta.Path : '';
if ( path ) return path.indexOf('://') > 0 ? fb.TitleFormat("[%" + field + "%]").Eval( true ) : fb.TitleFormat("[%" + field + "%]").EvalWithMetadb( meta );
}
this.Update = function( metadb ) {
this.Metadb = metadb ? metadb : this.OutputMetadb();
artist = this.Eval( this.Metadb, 'artist' );
try {
dir = this.Metadb.Path;
dir = dir.replace(/\\([^\\]*)$/g, '');
this.MetaPath = this.DisplayMode == 2 && this.CachePath && FSO.FolderExists( this.CachePath + '\\' + artist ) ? this.CachePath + '\\' + artist : dir;
}
catch (e) { this.MetaPath = 0; }
if ( this.MetaPath && artist ) {
var artist_temp = this.Eval( this.Metadb, 'artist' );
var a = this.CachedPath ? this.CachedPath : ' ';
var b = this.MetaPath;
if ( a != b || ( this.CachedArtist != artist_temp ) ) {
this.Covers = false;
this.CurrentCoverNumber = 0;
this.CurrentCover = this.GetCovers( this.MetaPath );
this.CachedPath = this.MetaPath;
this.CachedCoversNumber = this.Covers != undefined ? this.Covers.length : 0;
this.CachedArtist = artist_temp;
window.Repaint();
}
}
else {
this.Reset();
window.Repaint();
}
}
//this.Update( metadb);
this.CachedArtist = '';
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;
this.Covers = undefined;
}
var Cover = new CoverShow();
function on_size() {
ww = window.Width;
wh = window.Height;
/// if ( ww && wh ) { Cover.Reset(); Cover.Update(); }
}
function on_paint( gr ) {
//d = new Date();
//t = d.getTime();
gr.SetSmoothingMode( 4 );
gr.SetInterpolationMode( 1 );
gr.FillSolidRect(0, 0, ww, wh, RGB(10,10,10));
if ( Cover.Covers ) {
// Bottom box
/// gr.FillSolidRect( 0, wh - 27, ww, 27, RGBA(255,255,255,150));
// Check if it's corrupted or not loaded
if ( !Cover.CurrentCover ) {
Cover.CoverX = null;
Cover.CoverY = null;
var cov = Cover.Covers[ Cover.CurrentCoverNumber ];
if ( typeof cov == 'object' ) {
Cover.CurrentCover = cov == null ? false : cov.Clone(0,0,cov.Width,cov.Height);
var image_name = 'Embedded image';
}
else {
Cover.CurrentCover = gdi.Image( cov );
if ( Cover.CurrentCover == null ) Cover.CurrentCover = false;
var image_name = 'Image';
}
if ( !Cover.CurrentCover ) gr.GdiDrawText( image_name + ' is probably corrupted and cannot be displayed.', g_font, RGB(0,0,0), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
if ( !Cover.CurrentCover ) gr.GdiDrawText( image_name + ' is probably corrupted and cannot be displayed.', g_font, RGB(140,164,179), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
}
if ( typeof Cover.CurrentCover == 'object' ) {
var img = Cover.CurrentCover;
// Width, height, coords
/// var resulting_height = wh - 53;
if ( Cover.Aspect ) {
if ( img.Width > ww || img.Height > wh ) {
// if ( img.Width > ww || img.Height > resulting_height ) {
var iw1 = ww;
var iw2 = img.Width / ( img.Height / wh );
/// var iw2 = img.Width / ( img.Height / resulting_height );
var ih1 = wh;
/// var ih1 = resulting_height;
var ih2 = img.Height / ( img.Width / ww );
var iw = Math.min(iw1, iw2);
var ih = Math.min(ih1, ih2);
}
else {
var iw = img.Width;
var ih = img.Height;
}
}
else {
var iw = ( img.Width > ww ) ? ww : img.Width;
var ih = ( img.Height > wh ) ? wh : img.Height;
/// var ih = ( img.Height > resulting_height ) ? resulting_height : img.Height;
}
img = img.CreateRawBitmap();
var x = (iw < ih) ? ((iw < ww) ? ((ww - iw)/2) : 0 ) : ((iw >= ww) ? 0 : ((ww - iw)/2));
var y = (iw > ih) ? ((ih < wh) ? ((wh - ih)/2) : 0 ) : ((ih >= wh) ? 0 : ((wh - ih)/2));
/// var y = (iw > ih) ? ((ih < resulting_height) ? ((wh - ih)/2) : 0 ) : ((ih >= resulting_height) ? 0 : ((wh - ih)/2));
Cover.CoverX = x;
Cover.CoverY = y;
// Draw cover
gr.GdiDrawBitmap( img, x, y, iw, ih, 0, 0, img.Width, img.Height );
if((wh - ih)/2 < 15 && g_hover == 1){
gr.FillSolidRect (0, 0, ww, 18, RGBA(0,20,30,150));
gr.FillSolidRect (0, wh - 18, ww, wh, RGBA(0,20,30,150));
}
// Resolution
/// gr.GdiDrawText( Cover.CurrentCover.Width + " × " + Cover.CurrentCover.Height, g_font_small, RGB(0,0,0), 0, wh - 25, ww, 25, DT_CENTER | DT_VCENTER | DT_CALCRECT);
if (g_hover == 1) {
gr.GdiDrawText( Cover.CurrentCover.Width + " X " + Cover.CurrentCover.Height, g_font_small, RGB(0,0,0), 7, 1, ww, 18, DT_LEFT| DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT);
gr.GdiDrawText( Cover.CurrentCover.Width + " X " + Cover.CurrentCover.Height, g_font_small, RGB(140,164,179), 6, 0, ww, 18, DT_LEFT| DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT);
}
// Filesize
/// try { var size = Math.round( FSO.GetFile( Cover.Covers[ Cover.CurrentCoverNumber ] ).size / 1024 ) + " KB"; }
/// catch(e) { var size = ''; }
/// gr.GdiDrawText( size, g_font_small, RGB(0,0,0), 6, wh - 25, ww, 25, DT_LEFT| DT_VCENTER | DT_CALCRECT);
// Release graphics
var graphics = Cover.CurrentCover.GetGraphics();
Cover.CurrentCover.ReleaseGraphics( graphics );
Cover.CurrentCover.Dispose();
Cover.CurrentCover = 0;
}
else if ( typeof Cover.CurrentCover == 'number' ) {
gr.GdiDrawText( 'Loading...', g_font2, RGB(0,0,0), 1, 1, ww, wh, DT_CENTER | DT_VCENTER | DT_CALCRECT);
gr.GdiDrawText( 'Loading...', g_font2, RGB(140,164,179), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_CALCRECT);
}
// Cover Number
if (g_hover == 1) {
gr.GdiDrawText( (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length, g_font_small, RGB(0,0,0), -5, wh - 20, ww, 25, DT_RIGHT | DT_VCENTER | DT_CALCRECT);
gr.GdiDrawText( (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length, g_font_small, RGB(140,164,179), -6, wh - 21, ww, 25, DT_RIGHT | DT_VCENTER | DT_CALCRECT);
}
/// gr.DrawLine( 0, wh - 25, ww, wh - 25, 1, RGB(218,219,220));
// Filename
if ( typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) var filename = 'Embedded';
else if ( Cover.Covers[ Cover.CurrentCoverNumber ] ) var filename = Cover.Covers[ Cover.CurrentCoverNumber ].replace(/(.*)\\(.*)$/i,"$2");
/// estimate = gr.EstimateLineWrap(filename, g_font_small, ww - 10);
/// estimate = estimate.toArray();
/// if ( picture && user_image ) gr.DrawImage( Cover.DisplayMode == 2 ? user_image : picture, 5, 5, picture.Width, picture.Height, 0, 0, picture.Width, picture.Height, angle = 0, alpha = 255);
if (g_hover == 1) {
gr.GdiDrawText( filename, g_font_small, RGB(0,0,0), 6, wh - 17, ww - 39, 18, DT_LEFT| DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT);
gr.GdiDrawText( filename, g_font_small, RGB(140,164,179), 5, wh - 18, ww - 40, 18, DT_LEFT| DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT);
}
/// gr.DrawLine( 0, 25, ww, 25, 1, RGB(218,219,220));
}
else {
metadb = Cover.OutputMetadb();
if ( metadb ) info = fb.TitleFormat(Cover.DisplayMode == 2 ? "[%artist%]" : "[%artist%][ — %album%]").EvalWithMetadb( metadb );
else info = false;
Cover.CoverX = null;
Cover.CoverY = null;
gr.GdiDrawText( 'No images', g_font2, RGB(0,0,0), 1, 1, ww, wh, DT_CENTER | DT_VCENTER | DT_CALCRECT);
gr.GdiDrawText( 'No images', g_font2, RGB(140,164,179), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_CALCRECT);
// ARTIST BAR
/// if ( info ) {
/// gr.FillSolidRect(0, 0, ww, 25, RGB(255,255,255));
/// gr.GdiDrawText( info, g_font2, RGB(0, 0, 0), 24, 0, ww - 50, 25, DT_LEFT | DT_VCENTER | DT_EDITCONTROL | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX);
/// gr.DrawLine( 0, 25, ww, 25, 1, RGB(218,219,220));
/// if ( picture && user_image ) gr.DrawImage( Cover.DisplayMode == 2 ? user_image : picture, 5, 4, user_image.Width, user_image.Height, 0, 0, user_image.Width, user_image.Height, angle = 0, alpha = 255);
/// }
}
//d = new Date();
//t2 = d.getTime();
//fb.trace( 'Repaint: ' + (t2 - t) + ' ms' );
}
function on_load_image_done(cookie, image) {
Cover.CurrentCover = image == null ? false : image;
window.Repaint();
}
function on_mouse_move(x, y) {
if ( !g_hover ) {
g_hover = 1;
window.Repaint();
if ( !Cover.CompareDirs() ) {
Cover.Reset();
Cover.Update();
}
}
if ( Cover.MultipleCovers() && Cover.X1 ) {
Cover.X2 = x;
}
}
function on_mouse_leave() {
g_hover = 0;
info_hover = 0;
Cover.X1 = 0;
Cover.X2 = 0;
Cover.X = 0;
Cover.MouseGesture = 0;
window.Repaint();
}
function on_mouse_wheel( step ) {
(step < 0) ? Cover.NextCover() : Cover.PrevCover();
}
function on_mouse_lbtn_down(x, y, mask) {
if ( mask == 1 ) {
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 if ( Cover.X1 > ww / 2 ) Cover.NextCover();
else if ( Cover.X1 < ww / 2 ) Cover.PrevCover();
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(/\\([^\\]*)$/g, '') + '"' );
else if ( Cover.Covers[ Cover.CurrentCoverNumber ] ) WshShell.run( '"' + Cover.Covers[ Cover.CurrentCoverNumber ] + '"' );
}
else if ( mask == MK_SHIFT ) {
WshShell.run( '"' + Cover.MetaPath.replace(/\\([^\\]*)$/g, '') + '"' );
}
}
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 _tenthgroup = window.CreatePopupMenu();
var i = 1;
var ret;
artist = Cover.FormatMeta('artist', Cover.OutputMetadb() );
_firstgroup.AppendMenuItem(MF_STRING, i++, "Playing item (no cycle)");
_firstgroup.AppendMenuItem(MF_STRING, i++, "Playing item (cycle images)");
_firstgroup.AppendMenuItem(MF_STRING, i++, "Current selection");
_firstgroup.EnableMenuItem( Cover.CurrentMode, 1 );
_firstgroup.CheckMenuRadioItem( 1, i-1, Cover.CurrentMode );
_firstgroup.AppendMenuSeparator();
_firstgroup.AppendMenuItem(MF_STRING, i++, "Artwork: front, back, disc, etc.");
_firstgroup.AppendMenuItem(MF_STRING, i++, "Artist images");
_firstgroup.EnableMenuItem( i-1 , !Cover.CachePath ? 1 : 0 );
_firstgroup.EnableMenuItem( Cover.DisplayMode + 3, 1 );
_firstgroup.CheckMenuRadioItem( i-2, i-1, Cover.DisplayMode + 3 );
_secondgroup.AppendMenuItem(MF_STRING, i++, "Embedded covers");
_secondgroup.AppendMenuItem(MF_STRING, i++, "External covers");
_secondgroup.EnableMenuItem( Cover.Priority + 5, 1 );
_secondgroup.CheckMenuRadioItem( i-2, i-1, Cover.Priority + 5 );
_thirdgroup.AppendMenuItem(MF_STRING, i++, "Embedded covers");
_thirdgroup.AppendMenuItem(MF_STRING, i++, "External covers");
if ( Cover.Exclude ) {
// _thirdgroup.EnableMenuItem( Cover.Exclude + 5, 1 );
_thirdgroup.CheckMenuRadioItem( i-2, i-1, Cover.Exclude + 7 );
}
_fourthgroup.AppendMenuItem(MF_STRING, i++, "*keywords*.*");
_fourthgroup.AppendMenuItem(MF_STRING, i++, " keywords.*");
_fourthgroup.EnableMenuItem( Cover.MatchPattern + 9, 1 );
_fourthgroup.CheckMenuRadioItem( i-2, i-1, Cover.MatchPattern + 9 );
_fivthgroup.AppendMenuItem(MF_STRING, i++, "5 sec");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "15 sec");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "30 sec");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "1 min");
_fivthgroup.AppendMenuItem(MF_STRING, i++, "2 mins");
_fivthgroup.EnableMenuItem( Cover.Interval + 12, 1 );
_fivthgroup.CheckMenuRadioItem( i-5, i-1, Cover.Interval + 12 );
_sixthgroup.AppendMenuItem(MF_STRING, i++, "No aspect ratio");
_sixthgroup.AppendMenuItem(MF_STRING, i++, "Correct aspect ratio");
_sixthgroup.EnableMenuItem( Cover.Aspect + 17, 1 );
_sixthgroup.CheckMenuRadioItem( i-2, i-1, Cover.Aspect + 17 );
_seventhgroup.AppendMenuItem(MF_STRING, i++, "Inverted left/right gesture");
_seventhgroup.CheckMenuItem( i-1, Cover.GestureInverted );
_eighthgroup.AppendMenuItem(MF_STRING, i++, "Show covers from root folder");
_eighthgroup.CheckMenuItem( i-1, Cover.RootCovers );
_eighthgroup.AppendMenuItem(MF_STRING, i++, "Show covers from subfolders");
_eighthgroup.CheckMenuItem( i-1, Cover.SubCovers );
_ninthgroup.AppendMenuItem(MF_STRING, i++, "cover.*");
_ninthgroup.AppendMenuItem(MF_STRING, i++, "folder.*");
_ninthgroup.AppendMenuItem(MF_STRING, i++, "front.*");
_ninthgroup.AppendMenuItem(MF_STRING, i++, "back.*");
_ninthgroup.AppendMenuItem(MF_STRING, i++, "disc.*");
_ninthgroup.AppendMenuItem(MF_STRING, i++, "%album%.*");
_tenthgroup.AppendMenuItem(MF_STRING, i, "Current image");
if ( Cover.Covers && typeof Cover.Covers[ Cover.CurrentCoverNumber ] != 'object' ) {
fb.trace( Cover.Covers );
var imagepath = Cover.Covers[ Cover.CurrentCoverNumber ];
var dir = imagepath.replace(/\\([^\\]*)$/g, '');
var imagename = imagepath.replace(/\\([^\\]*)$/g, "$1");
var ext = imagename.replace(/(.*)\.([^\.]*)$/,'$2');
if ( imagename == ('cover.' + ext ) || FSO.FileExists( dir + '\\cover.' + ext ) ) _ninthgroup.EnableMenuItem( 22, 1 );
if ( imagename == ('folder.' + ext ) || FSO.FileExists( dir + '\\folder.' + ext ) ) _ninthgroup.EnableMenuItem( 23, 1 );
if ( imagename == ('front.' + ext ) || FSO.FileExists( dir + '\\front.' + ext ) ) _ninthgroup.EnableMenuItem( 24, 1 );
if ( imagename == ('back.' + ext ) || FSO.FileExists( dir + '\\back.' + ext ) ) _ninthgroup.EnableMenuItem( 25, 1 );
if ( imagename == ('disc.' + ext ) || FSO.FileExists( dir + '\\disc.' + ext ) ) _ninthgroup.EnableMenuItem( 26, 1 );
var album = fb.Titleformat("$replace(%album%,/,-,\,-,:,-,*,-,?,-,\",-,<,-,>,-,|,-)").EvalWithMetadb( Cover.OutputMetadb() );
if ( imagename == (album + '.' + ext ) || FSO.FileExists( dir + '\\' + album + '.' + ext ) ) _ninthgroup.EnableMenuItem( 27, 1 );
}
else {
_ninthgroup.EnableMenuItem( 22, 1 );
_ninthgroup.EnableMenuItem( 23, 1 );
_ninthgroup.EnableMenuItem( 24, 1 );
_ninthgroup.EnableMenuItem( 25, 1 );
_ninthgroup.EnableMenuItem( 26, 1 );
_ninthgroup.EnableMenuItem( 27, 1 );
_tenthgroup.EnableMenuItem( 28, 1 );
}
_firstgroup.AppendTo( _menu, MF_STRING, "Focus settings");
_secondgroup.AppendTo( _menu, MF_STRING, "Priority settings");
_thirdgroup.AppendTo( _menu, MF_STRING, "Exclude from search");
_fourthgroup.AppendTo( _menu, MF_STRING, "Cover match settings");
_fivthgroup.AppendTo( _menu, MF_STRING, "Interval settings");
_sixthgroup.AppendTo( _menu, MF_STRING, "Aspect settings");
_seventhgroup.AppendTo( _menu, MF_STRING, "Mouse settings");
_eighthgroup.AppendTo( _menu, MF_STRING, "Additional settings");
_menu.AppendMenuSeparator();
_ninthgroup.AppendTo( _menu, MF_STRING, "Rename current image to...");
_tenthgroup.AppendTo( _menu, MF_STRING, "Delete...");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING, ++i, "Update covers");
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING, ++i, "Open folder");
_menu.AppendMenuItem(MF_STRING, ++i, "Open cover");
// Open cover option handle
if ( !Cover.Covers || typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) {
_menu.EnableMenuItem( 31, 1 );
}
if ( !Cover.CachePath && !FSO.FolderExists( Cover.CachePath + '\\' + artist ) ) {
_menu.EnableMenuItem( 29, 1 );
}
_menu.AppendMenuSeparator();
_menu.AppendMenuItem(MF_STRING, ++i, "Settings");
ret = _menu.TrackPopupMenu(x, y);
if (ret >= 1 && ret <= 3) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'displayed_cover', Cover.CurrentMode = ret );
Cover.StopTimer();
Cover = new CoverShow();
Cover.Update();
Cover.StartTimer();
}
else if (ret >= 4 && ret <= 5) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'disp_mode', Cover.DisplayMode = ret - 3);
Cover.Reset();
Cover.Update();
}
else if (ret >= 6 && ret <= 7) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'cover_priority', Cover.Priority = ret - 5);
Cover = new CoverShow();
Cover.Update();
}
else if (ret >= 8 && ret <= 9) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'exclude_covers', ( ret - 7 == Cover.Exclude ) ? Cover.Exclude = 0 : Cover.Exclude = ret - 7 );
Cover.Reset();
Cover.Update();
}
else if (ret >= 10 && ret <= 11) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'match_pattern', Cover.MatchPattern = ret - 9 );
Cover.Reset();
Cover.Update();
}
else if (ret >= 12 && ret <= 16) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'interval', Cover.Interval = ret - 12);
Cover.StopTimer();
Cover.StartTimer();
}
else if (ret >= 17 && ret <= 18) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'covers_aspect', Cover.Aspect = ret - 17 );
Cover.Reset();
Cover.Update();
}
else if (ret == 19) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'gesture_inverted', Cover.GestureInverted = Cover.GestureInverted == 1 ? 0 : 1);
}
else if (ret == 20) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'root_covers', Cover.RootCovers = Cover.RootCovers == 1 ? 0 : 1);
Cover.Reset();
Cover.Update();
}
else if (ret == 21) {
utils.WriteINI( fb.FoobarPath + 's7e.ini', 'artwork-settings', 'sub_covers', Cover.SubCovers = Cover.SubCovers == 1 ? 0 : 1);
Cover.Reset();
Cover.Update();
}
else if (ret == 22) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\cover.' + ext );
Cover.Reset();
Cover.Update();
} catch(e) { }
}
else if (ret == 23) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\folder.' + ext );
Cover.Reset();
Cover.Update();
} catch(e) { }
}
else if (ret == 24) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\front.' + ext );
Cover.Reset();
Cover.Update();
} catch(e) { }
}
else if (ret == 25) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\back.' + ext );
Cover.Reset();
Cover.Update();
} catch(e) { }
}
else if (ret == 26) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\disc.' + ext );
Cover.Reset();
Cover.Update();
} catch(e) { }
}
else if (ret == 27) {
try {
FSO.MoveFile( Cover.Covers[ Cover.CurrentCoverNumber ], Cover.Covers[ Cover.CurrentCoverNumber ] = dir + '\\' + album + '.' + ext );
Cover.Reset();
Cover.Update();
} catch(e) { }
}
else if (ret == 28 ) {
try {
FSO.DeleteFile( Cover.Covers[ Cover.CurrentCoverNumber ] );
Cover.Reset();
Cover.Update();
} catch(e) { }
}
else if (ret == 29 ) {
Cover.Reset();
Cover.Update();
}
else if (ret == 30 ) {
WshShell.run( '"' + Cover.MetaPath + '"' );
}
else if (ret == 31 ) {
if ( Cover.Covers[ Cover.CurrentCoverNumber ] ) WshShell.run( '"' + Cover.Covers[ Cover.CurrentCoverNumber ] + '"' );
}
else if (ret == 32 ) {
window.ShowConfigure();
}
return true;
}
function on_playback_dynamic_info_track() {
Cover.Reset();
Cover.Update();
}
function on_playback_starting() {
// some
}
function on_playback_stop( Reason ) {
Cover.StopTimer();
if ( Reason == 0 ) on_item_focus_change();
}
function on_item_focus_change() {
if ( !fb.IsPlaying || Cover.CurrentMode == 3) { Cover.Update(); }
}
function on_playlist_items_added(playlist) { Cover.Update(); }
function on_playlist_items_removed(playlist, new_count) { Cover.Update(); }
function on_playlist_switch() { Cover.Update(); }
function on_playback_new_track( metadb ){
Cover.Update( metadb );
Cover.StartTimer();
}
function on_mouse_mbtn_up(x,y) {
artist = Cover.FormatMeta('artist', Cover.OutputMetadb() );
if ( (Cover.CachePath && FSO.FolderExists( Cover.CachePath + '\\' + artist )) || Cover.DisplayMode == 2 ) {
utils.WriteINI(fb.FoobarPath + 's7e.ini', 'artwork-settings', 'disp_mode', Cover.DisplayMode = Cover.DisplayMode == 1 ? 2 : 1);
Cover.Reset();
Cover.Update();
}
}
function on_notify_data( name, info) {
if ( info == 'refresh' && name == '314FBCC4-9383-48CD-B2DA-45593D3BE1FF' ) {
Cover.Reset();
Cover.Update();
}
else if ( info == true && name == '314FBCC4-9383-48CD-B2DA-45593D3BE1FF' ) {
on_mouse_mbtn_up();
}
else if ( name == '314FBCC4-9383-48CD-B2DA-45593D3BE1FF' ) {
Cover.CachePath = info;
Cover.Reset();
Cover.Update();
}
}
function on_key_down(vkey) {
if ( vkey == 0x00000021 || vkey == 0x00000026 ) {
Cover.PrevCover();
}
else if ( vkey == 0x00000022 || vkey == 0x00000028 ) {
Cover.NextCover();
}
else if ( vkey == 0x00000023 ) {
if ( Cover.Covers != undefined ) {
Cover.CurrentCoverNumber = Cover.Covers.length - 1;
var tmp = Cover.Covers[ Cover.CurrentCoverNumber ];
var img;
try { img = ( typeof tmp == 'object' ) ? tmp.Clone(0,0,tmp.Width,tmp.Height) : gdi.LoadImageAsync( window.ID, Cover.Covers[ Cover.CurrentCoverNumber ] ); }
catch (e) { img = undefined; }
Cover.ChangeImage( img );
window.Repaint();
}
}
else if ( vkey == 0x00000024 ) {
if ( Cover.Covers != undefined ) {
Cover.CurrentCoverNumber = 0;
var tmp = Cover.Covers[ Cover.CurrentCoverNumber ];
var img;
try { img = ( typeof tmp == 'object' ) ? tmp.Clone(0,0,tmp.Width,tmp.Height) : gdi.LoadImageAsync( window.ID, Cover.Covers[ Cover.CurrentCoverNumber ] ); }
catch (e) { img = undefined; }
Cover.ChangeImage( img );
window.Repaint();
}
}
}
function on_timer(id) {
//if ( Cover.CurrentMode == 2 && Cover.CycleTimer.ID == id ) Cover.NextCover();
}