image_cache = function () {
this._cachelist = {};
this.hit = function (metadb) {
var img = this._cachelist[metadb.Path];
if (list.drag_stop && typeof img == "undefined") {
if(!cover.load_timer) {
cover.load_timer = window.SetTimeout(function() {
utils.GetAlbumArtAsync(window.ID, metadb, 0, true, false, false);
cover.load_timer && window.ClearTimeout(cover.load_timer);
cover.load_timer = false;
}, 20);
};
};
return img;
};
this.getit = function (metadb, track_type, image) {
var img;
var quotient = (panel.flat_mode) ? 2 : 12;
if(cover.keepaspectratio) {
if(!image) {
var pw = (cover.w+cover.margin*quotient);
var ph = (cover.h+cover.margin*quotient);
} else {
if(image.Height>=image.Width) {
var ratio = image.Width / image.Height;
var pw = (cover.w+cover.margin*quotient)*ratio;
var ph = (cover.h+cover.margin*quotient);
} else {
var ratio = image.Height / image.Width;
var pw = (cover.w+cover.margin*quotient);
var ph = (cover.h+cover.margin*quotient)*ratio;
};
};
} else {
var pw = (cover.w+cover.margin*quotient);
var ph = (cover.h+cover.margin*quotient);
};
// item.cover_type : 0 = nocover, 1 = external cover, 2 = embedded cover, 3 = stream
if(track_type!=3) {
if(metadb) {
img = FormatCover(image, pw, ph);
if(!img) {
img = nocover_img;
//item.cover_type = 0;
} else {
//item.cover_type = 1;
};
};
} else {
img = streamcover_img;
//item.cover_type = 3;
};
this._cachelist[metadb.Path] = img;
return img;
};
};
Help convert