Probably not exactly what you needed, since I'm using other script. But sure you can take the path part to suit your needs.
window.DefinePanel("LoadImageAsync", { author: "XXX" });
let sel = ""
let path = ""
if (fb.IsPlaying) {
sel = fb.GetNowPlaying();
path = fb.TitleFormat("$directory_path(%path%)").EvalWithMetadb(sel);
}
// Get a list of jpg files from a folder
var pathart = ""
if (utils.FileTest(path + '\\art', "e"))
pathart = '\\art\\';
else if (utils.FileTest(path + '\\artwork', "e"))
pathart = '\\artwork\\';
else if (utils.FileTest(path + '\\_artwork', "e"))
pathart = '\\_artwork\\';
const g_image_list = utils.Glob(path + pathart + '*.jpg');
let ww = 0, wh = 0;
let g_img = null;
let g_valid_tid = 0;
// Trigger every 5 seconds.
let g_timer = setInterval(function () {
load_random_image_async();
}, 5000);
load_random_image_async();
function on_playback_new_track() {
let g_timer = setTimeout(function () {
window.Reload();
}, 1000);
}
function on_playback_starting() {
let g_timer = setTimeout(function () {
window.Reload();
}, 1000);
}
function load_random_image_async() {
// Load a random image from the list
let path = g_image_list[Math.floor(Math.random() * g_image_list.length)];
// on_load_image_done will be triggered when the image has been loaded
g_valid_tid = gdi.LoadImageAsync(window.ID, path);
}
function on_size() {
ww = window.Width;
wh = window.Height;
}
function on_paint(gr) {
if (!g_img) {
return;
}
let scale_w = ww / g_img.Width;
let scale_h = wh / g_img.Height;
let scale = Math.min(scale_w, scale_h);
let pos_x = 0, pos_y = 0;
if (scale_w < scale_h) {
pos_y = (wh - g_img.Height * scale) / 2;
}
else if (scale_w > scale_h) {
pos_x = (ww - g_img.Width * scale) / 2;
}
gr.DrawImage(g_img, pos_x, pos_y, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
}
// After loading image is done in the background, this callback will be invoked
function on_load_image_done(tid, image, image_path) {
if (g_valid_tid === tid) {
g_img = image;
window.Repaint();
}
}
"Pathart" is the subfolder part you want. Ex:
ACDC/Black in black/Artwork/front.jpg
ACDC/Black in black/Artwork/...
ACDC/Black in black/track1
....
ACDC/Black in black/cover.jpg
I only have 3 possible artwork sub-folder names, so that's the 3 "if sentences" part.
Then const g_image_list = utils.Glob(path + pathart + '*.jpg') just merges the file path (track folder) with the subfolder path and takes all jpg files. It should work with any other extension, but beware I have no idea if js displays png or other image files right. I just note you can put whatever you want on that list.
So the first part of this script should work for you in your script in some way. It just displays 1 image at a time and cycle it.
About adding the embedded artwork, I have a "cover.jpg" file present on the base folder, so that's what I would check. Adding that file to the image list too. If you talk about the cover within the track, then you can check "GetAlbumArtAsync.js" on samples folder.
EDIT: After re-reading.. btw if it's just a matter of config editing and you can put whatever tittle-formatting you want then:
$directory_path(%path%) --> $directory_path(%path%)\artwork
That should do. Or your desired subfolder name. (Note, anyway, that would restrict the images to just the subfolder).