Нашёл сейчас в сундуке Wi-Fi свисток , расшарил мобильный И-нет ,
тут ситуация ещё хуже . Первая станция есть картинки - вторая - уже нет.
Список разделов › foobar2000 › Секреты foobar2000
// ==PREPROCESSOR==
// @name "Biography Text && Picture. www.last.fm"
// @author "kgena_ua"
// @version "13022016"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
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)); }
function getRed(color) {return ((color >> 16) & 0xff);};
function getGreen(color) {return ((color >> 8) & 0xff);};
function getBlue(color) {return (color & 0xff);};
var a_font = gdi.Font("Arial",12, 1);
var b_font = gdi.Font("Arial",12, 0);
var ww,wh;
var on_mouse = false;
DT_LEFT = 0x00000000;
DT_RIGHT = 0x00000002;
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_WORD_ELLIPSIS = 0x00040000;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
var bgcolor = RGB(31,41,48);
var a_color = RGB(220,220,220);
var b_color = RGB(255,255,230);
var transparent = 200;
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var doc = new ActiveXObject("htmlfile");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var tmp_b_path = fb.ProfilePath + "\\tmp_Biography\\";
if(!fso.FolderExists(tmp_b_path)) {fso.CreateFolder(tmp_b_path)};
if(!fso.FolderExists(tmp_b_path + "\\download\\")) {fso.CreateFolder(tmp_b_path + "\\download\\")};
if(!fso.FileExists(tmp_b_path + "\\download\\" + "download.vbs")) {create_download_file()};
var nocover_path = fb.ProfilePath + "nocover.png";
var g_img = null;
var text = "";
var artist, old_artis;
var files = [], selected = 0;
var txt_x = window.GetProperty("txt_x", window.Width / 2);
var txt_y = window.GetProperty("txt_y", window.Height / 2);
var abc_lang = new Array("", "ru/");
var abc = window.GetProperty("abc", 0);
var if_not_found = new Array(". . .", ". . .");
var select_p_a = window.GetProperty("pictures/albums", 0);
var select_p_a_old;
var p_a = new Array("images", "albums");
var artist_x;
var artist_y;
var b_x;
var b_y;
var t_margin = 15;
var string_width;
var b_text_row_height = 0;
var b_text_rows = 0;
var b_text_height = 0;
var s_text = 0;
var strings_array = [];
var b_text_array = [];
var delta_x, delta_y;
var k_down = false;
var text_scroll = false;
var limit = window.GetProperty("download_limit",5);
var p_margn = 10;
var selection_mode = window.GetProperty("selection_mode", 0);
var metadb;
on_item_focus_change();
var WshShell = new ActiveXObject("WScript.Shell");
var script_path = fb.ProfilePath + "\\tmp_Biography\\download\\";
var vbs = "cscript //nologo \"" + script_path + "download.vbs\"";
function on_paint(gr){
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
paint(gr);
if(set_cycle){
gr.FillSolidRect(0, 0, ww, wh, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),transparent));
} else{
gr.FillSolidRect(txt_x, txt_y, ww - txt_x, wh - txt_y, RGBA(getRed(bgcolor),getGreen(bgcolor),getBlue(bgcolor),transparent));
}
gr.GdiDrawText(artist, a_font, a_color, artist_x, artist_y, ww - artist_x, wh, DT_LEFT | DT_WORD_ELLIPSIS );
for (var i = 0; i < b_text_height; i++) {
gr.GdiDrawText(b_text_array[i + s_text], b_font, b_color, b_x, b_y + b_text_row_height * i, ww, wh, DT_LEFT );
}
var txt_cycle = cycle == 0 ? "off" : cycle + " sec";
set_cycle && gr.GdiDrawText("auto cycle \n" + txt_cycle, b_font, b_color, 15, 15, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS );
gr.GdiDrawText("", b_font, b_color, 15, 15, ww, wh, DT_LEFT | DT_WORD_ELLIPSIS );
}
function on_mouse_wheel(delta) {
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
if (!delay && !text_scroll && !ShiftDown){
delay = true;
fdelay();
get_files_from_dir();
if (delta < 0) {selected = selected <= 0 ? files.length - 1 : selected = selected - 1};
if (delta > 0) {selected = selected >= files.length - 1 ? 0 : selected = selected + 1};
}
if (text_scroll && !ShiftDown){
if (b_text_rows > b_text_height){
if (delta < 0) {s_text = b_text_rows - s_text <= b_text_height ? b_text_rows - b_text_height : s_text += 1}
if (delta > 0) {s_text = s_text <= 0 ? 0 : s_text -= 1}
}
}
if (ShiftDown) {
set_cycle = true;
if (delta < 0) {cycle = cycle <= 0 ? 0 : cycle - 5;};
if (delta > 0) {cycle = cycle >= 60 ? 60 : cycle + 5;};
window.SetProperty("auto cycle(sec)", cycle);
}
window.Repaint();
}
function on_playlist_switch() {
on_item_focus_change();
}
function on_playback_new_track() {
on_item_focus_change();
}
function on_playback_dynamic_info_track() {
on_item_focus_change();
}
function on_playback_stop() {
on_item_focus_change();
}
function on_selection_changed(metadb) {
on_item_focus_change();
}
function on_item_focus_change() {
switch (selection_mode) {
case 0:
metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
break;
case 1:
metadb = fb.GetFocusItem();
break;
}
if (metadb) on_metadb_changed();
}
function Eval(field) {
if (!metadb) return;
path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
//return path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval() : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
return fb.Titleformat("[" + field + "]").EvalWithMetadb(metadb) ? fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb) : fb.TitleFormat("[" + field + "]").Eval(true);
}
function on_metadb_changed() {
if (!metadb) return;
artist = Eval("%artist%");
if (artist != old_artis || select_p_a != select_p_a_old){
CollectGarbage();
g_img = null;
files = [];
del_files_from_dir();
selected = 0;
s_text = 0;
text = "";
get_b_text_array()
get_pic();
old_artis = artist;
select_p_a_old = select_p_a;
window.Repaint();
}
}
function get_pic(){
var url1 = ("http://www.last.fm/music/" + encodeURIComponent(artist) + "/+" + p_a[select_p_a]);
xmlhttp.open("GET", url1, true);
xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
doc.open();
var div = doc.createElement("div");
div.innerHTML = xmlhttp.responsetext;
var data = div.getElementsByTagName("img");
var urls = [];
for (i = 0; i < data.length; i++) {
if (data[i].className == "image-list-image"){
if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/avatar170s") == 0) urls.push(data[i].src.replace("avatar170s", ""));
}
if (data[i].className == "album-grid-album-art"){
if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/300") == 0 && data[i].src.indexOf("c6f59c1e5e7240a4c0d427abd71f3dbb") < 0) urls.push(data[i].src.replace("300", ""));
// if (data[i].src.indexOf("http://img2-ak.lst.fm/i/u/300") == 0) urls.push(data[i].src.replace("300", ""));
}
}
for (i = 0; i < Math.min(urls.length, limit); i++) {
file = "\"" + tmp_b_path + artist + "_" + i + ".jpg" + "\"";
WshShell.Run(vbs + " " + urls[i] + " " + file, false);
}
doc.close();
}
get_b_text();
}
}
}
function get_files_from_dir() {
files = [];
var e = new Enumerator( fso.GetFolder(tmp_b_path).Files );
while ( !e.atEnd() ) {
var name = e.item().Name;
if (name.indexOf(artist) == 0){
files.push(tmp_b_path + name);
}
e.moveNext();
}
}
/*function get_files_from_dir() {
files = [];
files = utils.Glob(tmp_b_path + artist + "*.*").toArray();
}
*/
var delay = false;
function fdelay(){
var delay_timer = window.SetTimeout(function() {
delay = false;
window.ClearTimeout(delay_timer);
}, 200);
}
function paint(gr){
g_img = gdi.Image(files[selected]);
if (!g_img){
try {
g_img = gdi.Image(nocover_path);
} catch(e) {};
}
if (g_img){
var scale_w = (ww - p_margn * 2) / g_img.Width;
var scale_h = (wh - p_margn * 2) / g_img.Height;
var scale = Math.min(scale_w, scale_h);
gr.DrawImage(g_img, p_margn, p_margn, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
}
}
function on_mouse_move(x, y) {
on_mouse = true;
window.SetCursor(32649);
if (k_down){
txt_x = x - delta_x ;
txt_y = y - delta_y;
txt_x = txt_x <= 0 ? 0 : txt_x > ww - 50 ? ww - 50: txt_x;
txt_y = txt_y <= 0 ? 0 : txt_y > wh - 50 ? wh - 50: txt_y;
get_b_text_array();
window.Repaint();
}
if (x >= txt_x && y >= txt_y){
text_scroll = true;
} else {
text_scroll = false;
}
get_b_text_array();
}
function on_mouse_leave() {
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_mouse_lbtn_down(x,y){
if (x >= txt_x && y >= txt_y){
k_down = true;
delta_x = x - txt_x;
delta_y = y - txt_y;
}
}
function on_mouse_lbtn_up(x,y){
window.SetProperty("txt_x", txt_x);
window.SetProperty("txt_y", txt_y);
k_down = false;
}
function on_size(){
ww = window.Width;
wh = window.Height;
txt_x = window.GetProperty("txt_x");
txt_y = window.GetProperty("txt_y");
txt_x = txt_x >= ww - 50 && txt_x > 0 ? ww - 50 : txt_x;
txt_y = txt_y >= wh - 50 && txt_y > 0 ? wh - 50 : txt_y;
get_b_text_array();
}
function get_b_text(){
var url2 = ("http://www.last.fm/" + abc_lang[abc] + "music/" + encodeURIComponent(artist) + "/+wiki");
xmlhttp.open("GET", url2, true);
xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
doc.open();
var div = doc.createElement("div");
div.innerHTML = xmlhttp.responsetext;
var data = div.getElementsByTagName("div");
for (i = 0; i < data.length; i++) {
if (data[i].className == "wiki-content") {
text = strip_tags(data[i].innerHTML);
break;
}
}
doc.close();
}
if (text == "") text = if_not_found[abc];
get_b_text_array();
}
}
}
function strip_tags(t) {
doc.open();
var div = doc.createElement("div");
div.innerHTML = t.replace(/<[Pp][^>]*>/g, "").replace(/<\/[Pp]>/g, "<br>").replace(/\n/g, "<br>");
var text = div.innerText;
doc.close();
return text;
}
function get_b_text_array() {
artist_x = txt_x + t_margin;
artist_y = txt_y + t_margin;
strings_array = [];
b_text_array = [];
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
b_x = txt_x + t_margin;
b_y = txt_y + temp_gr.CalcTextHeight("text", a_font) + t_margin * 2;
b_text_row_height = temp_gr.CalcTextHeight("text", b_font)
string_width = Math.max(ww - b_x - t_margin, 0);
if (text) strings_array = temp_gr.EstimateLineWrap(text, b_font, string_width).toArray();
for (var i = 0; i < strings_array.length; i += 2) {
b_text_array.push(strings_array[i].replace(/^\s+|\s+$/g, ""));
}
b_text_rows = b_text_array.length;
b_text_height = Math.ceil((wh - b_y - 20) / b_text_row_height);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
}
function on_mouse_rbtn_up (x, y){
var _menu = window.CreatePopupMenu();
var i = 1;
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
MF_SEPARATOR = 0x00000800;
_menu.AppendMenuItem(MF_ENABLED, i++, "EN text");
_menu.AppendMenuItem(MF_ENABLED, i++, "RU text");
_menu.CheckMenuRadioItem(1, i, abc + 1);
_menu.EnableMenuItem(abc + 1, 1);
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, i++, "Prefer now playing");
_menu.AppendMenuItem(MF_ENABLED, i++, "Follow selected track");
_menu.CheckMenuRadioItem(i - 2, i , selection_mode + 3);
_menu.EnableMenuItem(selection_mode + 3, 1);
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, i++, "Artist pictures");
_menu.AppendMenuItem(MF_ENABLED, i++, "Albums pictures");
_menu.CheckMenuRadioItem(i - 2, i , select_p_a + 5);
_menu.EnableMenuItem(select_p_a + 5, 1);
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
// if (ShiftDown) {
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, 10, "Reload");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, 20, "Properties");
_menu.AppendMenuItem(MF_ENABLED, 30, "Configure ...");
// }
ret = _menu.TrackPopupMenu(x,y);
switch (ret) {
case 1:
abc = 0;
window.SetProperty("abc", abc);
s_text = 0;
text = "";
get_b_text();
break;
case 2:
abc = 1;
window.SetProperty("abc", abc);
s_text = 0;
text = "";
get_b_text();
break;
case 3:
selection_mode = 0;
window.SetProperty("selection_mode", selection_mode);
on_item_focus_change();
break;
case 4:
selection_mode = 1;
window.SetProperty("selection_mode", selection_mode);
on_item_focus_change();
break;
case 5:
select_p_a = 0;
window.SetProperty("pictures/albums", select_p_a);
on_metadb_changed();
break;
case 6:
select_p_a = 1;
window.SetProperty("pictures/albums", select_p_a);
on_metadb_changed();
break;
case 10:
window.Reload();
break;
case 20:
window.ShowProperties();
break;
case 30:
window.ShowConfigure();
break;
}
_menu.Dispose();
return true;
}
var cycle = window.GetProperty("auto cycle(sec)", 0);
var set_cycle = false;
var timer = window.SetInterval(on_timer, 1000);
var step = 0;
var dis;
function on_timer(id) {
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
step = ShiftDown ? 0 : step + 1;
if (files.length == 0) {get_files_from_dir()};
if (cycle > 0 && step >= cycle && !ShiftDown){
selected = selected >= files.length - 1 ? 0 : selected = selected + 1;
window.Repaint();
step = 0;
}
if (!ShiftDown) {
if (set_cycle) dis--; window.Repaint();
if (dis <= 0){
set_cycle = false;
window.Repaint();
}
} else {
dis = 2;
}
}
function on_key_down(vkey) {
if (vkey == 16){
set_cycle = true;
dis = 2;
window.Repaint();
}
}
function on_mouse_lbtn_dblclk (x,y){
if (text_scroll){
abc = abc == 1 ? 0 : 1;
window.SetProperty("abc", abc);
s_text = 0;
b_text_array = [];
text = "";
get_b_text();
}
if (files[selected] && !text_scroll) WshShell.run( '"' + files[selected] + '"' );
}
var del_files = [];
/*
function del_files_from_dir() {
del_files = [];
var e = new Enumerator( fso.GetFolder(tmp_b_path).Files );
while ( !e.atEnd() ) {
var name = e.item().Name;
try {
fso.deleteFile(tmp_b_path + name );
} catch(e) {};
e.moveNext();
}
// window.Repaint();
}
*/
function del_files_from_dir() {
del_files = [];
del_files = utils.Glob(tmp_b_path + "*.*").toArray();
for (i in del_files) {
try {
fso.deleteFile(del_files[i]);
} catch(e) {};
}
}
function create_download_file() {
try {
file = fso.CreateTextFile(tmp_b_path + "\\download\\" + "download.vbs" )
var text =
"If (WScript.Arguments.Count <> 2) Then" + "\n\r" +
" WScript.Quit" + "\n\r" +
"End If" + "\n\r" + "\n\r" +
"url = WScript.Arguments(0)" + "\n\r" +
"file = WScript.Arguments(1)" + "\n\r" + "\n\r" +
"Set objFSO = Createobject(" + '"Scripting.FileSystemObject"' + ")" + "\n\r" +
"If objFSO.Fileexists(file) Then" + "\n\r" +
" Set objFSO = Nothing" + "\n\r" +
" WScript.Quit" + "\n\r" +
"End If" + "\n\r" + "\n\r" +
"Set objXMLHTTP = CreateObject(" + '"MSXML2.XMLHTTP"' + ")" + "\n\r" +
"objXMLHTTP.open " + '"GET"' + ", url,false" + "\n\r" +
"objXMLHTTP.send()" + "\n\r" + "\n\r" +
"If objXMLHTTP.Status = 200 Then" + "\n\r" +
" Set objADOStream = CreateObject(" + '"ADODB.Stream"' + ")" + "\n\r" +
" objADOStream.Open" + "\n\r" +
" objADOStream.Type = 1" + "\n\r" +
" objADOStream.Write objXMLHTTP.ResponseBody" + "\n\r" +
" objADOStream.Position = 0" + "\n\r" +
" objADOStream.SaveToFile file" + "\n\r" +
" objADOStream.Close" + "\n\r" +
" Set objADOStream = Nothing" + "\n\r" +
"End If" + "\n\r" + "\n\r" +
"Set objFSO = Nothing" + "\n\r" +
"Set objXMLHTTP = Nothing"
;
file.WriteLine(text);
file.Close();
} catch(e) {};
}
А что если в Вашей сборке всё-же какая-то настройка хитрая есть . Или и по других прыгали ? :)Сегодня после просмотра видео опять туда сюда "прыгал".
Верю более чем , это ведь не крутилка звука , да и куда "гнать коней" , возможно решение само найдётся со-временем ...И поверьте, мне совсем не доставляет удовольствие, что данный скрипт у кого-то глючит.
Нее харош , я собираюсь обратно режим менять,чтоб, как все)))Всем доброе утро!
seriousstas:Попробуй грузить только аватарки . Тоесть те-же фото, но обрезанные и уменьшенные :
urls.push(data[i].src.replace("avatar170s", "avatar170s"));
Не должно, я не сталкивался.MC Web:все равно проскакивают "большие".
Вообще у меня тоже стоит foo_youtube, может в этом проблемаMC Web:Прюс компонент foo_youtube для проверки с YouTube.
Проблем не было:
var tmp_b_path = fb.ProfilePath + "\\tmp_Biography\\";
var files_biography = [];
function get_files_from_b_dir() {
files_biography = [];
var e = new Enumerator( FSO.GetFolder(tmp_b_path).Files );
while ( !e.atEnd() ) {
var name = e.item().Name;
files_biography.push(tmp_b_path + name);
e.moveNext();
}
}
function on_notify_data(name, info) {
if(name == "b_images") {
get_files_from_b_dir();
window.Repaint();
}
}
files = files.concat(files_this, files_subs);
files = files.concat(files_this, files_subs, files_biography);
window.NotifyOthers("b_images", step);
// Always faster than DrawImage, do not support alpha channel
void GdiDrawBitmap(IGdiRawBitmap, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH);
Естественно.duzzy:Делал изначально под КарПС сборки, но думаю что и в обычных будет работать очень даже не плохо.
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_CALCRECT = 0x00000400;
//function StrFmt(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var WshShell = new ActiveXObject("WScript.Shell");
var ww, wh;
window.MinHeight = window.MaxHeight = 220;
function CoverShow( metadb ) {
this.CachedPath = 0;
this.CachedCoversNumber = 0;
// Interval
this.Interval = 12000;
// Metadb
this.OutputMetadb = function() {
return ( 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);
//SubCovers
var e = new Enumerator(dir.SubFolders );
for(; !e.atEnd(); e.moveNext() ) {
this.Search(files_subs, files_biography, 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 = files.concat(files_this, files_subs);
var k = files.length;
files.reverse();
while (k--){
var name = files[k];
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 ) {
var embedded = this.GetEmbeddedCovers( this.Metadb );
var external = this.GetExternalCovers( path );
var allcovers = []; allcovers = allcovers.concat(external, embedded);
this.Covers = allcovers;
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 ) {
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;
}
this.CompareDirs = function() {
metadb = this.OutputMetadb();
try {
metapath = metadb.Path;
}
catch (e) { metapath = 0; }
if ( metapath ) {
var embedded = this.GetEmbeddedCovers( this.Metadb );
var external = this.GetExternalCovers( metapath );
var allcovers = [];
allcovers = allcovers.concat(external, embedded);
//this.Covers = allcovers;
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 );
this.CycleTimer = window.SetInterval( function() { Cover.NextCover() }, 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.Update = function( metadb ) {
this.Metadb = metadb ? metadb : this.OutputMetadb();
artist = this.FormatMeta( 'artist', this.Metadb );
try {
dir = this.Metadb.Path;
dir = dir.replace(/\\([^\\]*)$/g, '');
this.MetaPath = dir;
}
catch (e) { this.MetaPath = 0; }
if ( this.MetaPath ) {
var artist_temp = fb.TitleFormat("%artist%").EvalWithMetadb( this.Metadb );
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.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 ) {
gr.FillGradRect(0, 0, ww, wh, 240,0xee708040,0xccf0eebb,.4);
if ( Cover.Covers ) {
window.MinHeight = window.MaxHeight = 220;
// 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 = 'вшито';
} else {
Cover.CurrentCover = gdi.Image( cov );
if ( Cover.CurrentCover == null ) Cover.CurrentCover = false;
var image_name = 'Image';
}
// if ( !Cover.CurrentCover ) gr.GdiDrawText( 'Показ невозможен.', g_font, 0xffaaaaaa, 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 - 10;;
if ( img.Width > ww || img.Height > resulting_height ) {
var iw1 = ww;
var iw2 = img.Width / ( img.Height / resulting_height );
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;
}
img = img.CreateRawBitmap();
var x = (iw < ih) ? ((iw < ww) ? ((ww - iw)/2) : 0 ) : ((iw >= ww) ? 0 : ((ww - iw)/2));
var y = (iw > ih) ? ((ih < resulting_height) ? ((wh - ih)/2) : 5 ) : ((ih >= resulting_height) ? 5 : ((wh - ih)/2));
Cover.CoverX = x;
Cover.CoverY = y;
// Draw cover
gr.GdiDrawBitmap( img, x, y, iw, ih, 0, 0, img.Width, img.Height );
// Release graphics
var graphics = Cover.CurrentCover.GetGraphics();
Cover.CurrentCover.ReleaseGraphics( graphics );
Cover.CurrentCover.Dispose();
Cover.CurrentCover = 0;
}
// Cover Number
// if (Cover.Covers.length>1) {
gr.GdiDrawText( (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length, gdi.Font("Tahoma",10), 0xff111111, 1, wh - 10, ww, 11, DT_RIGHT | DT_CALCRECT), gr.GdiDrawText( (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length, gdi.Font("Tahoma",10), 0xffffffff, 0, wh - 11, ww, 11, DT_RIGHT | DT_CALCRECT);
// }
}
else {
window.MinHeight = window.MaxHeight = 1;
}
}
function on_load_image_done(cookie, image) {
Cover.CurrentCover = image == null ? false : image;
window.Repaint();
}
function on_mouse_wheel( step ) {
(step < 0) ? Cover.NextCover() : Cover.PrevCover();
}
function on_playback_dynamic_info_track() {
Cover.Reset();
Cover.Update();
}
function on_playback_stop( Reason ) {
Cover.StopTimer();
}
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_lbtn_dblclk (x,y){
//if (Cover) WshShell.run '"' + Cover.CurrentCover + '"' );
}
function on_notify_data( name, info) {
if ( name == '314FBCC4-9383-48CD-B2DA-45593D3BE1FF' ) {
Cover.CachePath = info;
Cover.Reset();
Cover.Update();
}
}
а зачем в биографии теперь таймер, если картинок нет? Я вообще убрал его и биография отлично работает, оставил только delay_timerkgena_ua:В скрипте Биография в function on_timer(id) { добавил внизу
Вернуться в Секреты foobar2000