Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Biography Discussion (Read 205927 times) previous topic - next topic
0 Members and 7 Guests are viewing this topic.

Re: Biography Discussion

Reply #950
About the image resizing, there are some factors to keep in mind when it comes to performance.

01. JavaScript is single-threaded and can not process various code in multi-tasking ( let's not start discussion with the web workers )
     That means, the better your single-threaded CPU performs, the faster the code execution with its task will finish.
     Here is the list: https://www.cpubenchmark.net/singleThread.html
     I would still buy AMD CPU's though because multi-threading is more important.

02. You need to keep in mind that there are a lot of heavy CPU intensive tasks going on in the background.
      For example drawing various UI elements ( in your video EOLE has two blended background images, with filmstrip images, with
      continuous lyrics refresh update and playlist, Georgia-ReBORN has beveled bars, styled buttons, rounded progress bar,
      blended background image in biography, filmstrip and playlist ). Also GDI+ is a slow and old graphics renderer.
      @TheQwertiest, has planned to implement Direct2D which would help and have better performance.

03. Performance hit also occurs depending on image size/resolution. If your CPU is old and slow, you can test and try open large
      images in Windows Photo Viewer, e.g 5 mb -10 mb images versus small images, e.g 100 kb - 500 kb images. Then cycle through
      those images and you will see the difference. So this also applies to Biography image resizing, keep in mind it also needs to
      process and finish all tasks illustrated in point 02.

---

Image resizing happens in the on_size callback. When you resize the player, numerous calls need to be executed and finished which are stacked in the queue.
For better performance, you could debounce the on_size method in images.js, like this:

Code: [Select]
	on_size() {
this.debounce = $.debounce(() => {
if (ppt.text_only) {
this.clearCovCache();
this.getFbImg();
}
if (ppt.text_only && !ui.style.isBlur && !ppt.showFilmStrip) return this.init = false;
filmStrip.logScrollPos();
this.clearCache();
if (ppt.artistView) {
if (this.init) this.artistReset();
this.getArtImg();
} else {
this.getFbImg();
if (this.init) {
this.id.albCyc = '';
this.id.curAlbCyc = '';
}
}
this.init = false;
if (ppt.img_only) panel.getList(true, true);
but.refresh(true);
}, 500);
this.debounce();
}

Try playing with various refresh rates, e.g 25, 50, 100, 250, 500, 750, 1000 ( the higher, the better performance ).
When using slow refresh rates, it will have ugly image resizing delays when resizing the player.

The best of course would be to just buy a faster CPU :P

-TT

Out of countless programs and scripts I run on my computer (i5-12400 / 32GB RAM / RX 580 8GB GPU) only Biography (when sizing large images) is slow. Heck, I can use Photoshop with videos and games running.

With my sizing tweak and display theme set to User Interface, Biography runs adequately.

I invite you to read kahel's posts on page 35. He has written about this in more depth. Fortunately, Biography runs fine on your theme because your left side never changes size.

Anyway. thanks for the info.

Re: Biography Discussion

Reply #951
I've forgot to tell you that you can put the whole debounce method in the Image's constructor to be sure to call it only once in on_size to improve performance:

Code: [Select]
class Images {
constructor() {
       // Put the debounce code at the end of the constructor
}
}

Code: [Select]
on_size() {
this.debounce();
}

Fortunately, Biography runs fine on your theme because your left side never changes size.
What do you exactly mean by that? You can change width or height or both at the same time so all the sizes change.

P.S So yeah, I've read the kahel's posts you pointed out and it confirms that it very well may be the slow old GDI+ ( that SMP is using )
I've mentioned at the end in point 02. JSP uses Direct2D which should have better performance of course...

-Tom

Re: Biography Discussion

Reply #952
Here is what GPT-4 says:

Q: Is Direct2D faster to render large images than GDI+ ?

A: Yes, Direct2D is generally faster and more efficient at rendering large images than GDI+.

GDI+ is an older API and while it can still be useful for simple 2D graphics, it doesn't take full advantage of modern graphics hardware. GDI+ primarily uses the CPU for rendering, which can be slower and less efficient, especially for large and complex images.

On the other hand, Direct2D is a newer, hardware-accelerated API. It uses the GPU for rendering, which can handle large and complex images more efficiently. Direct2D is designed to work well with other Direct family APIs like Direct3D, and it supports more advanced features like shader effects.

However, the speed advantage of Direct2D may not be noticeable for simple graphics or small images. The difference becomes more apparent when dealing with larger images, complex drawing operations, or when you need to take advantage of the advanced features Direct2D offers.

---

It would be great to do a comparison between GDI+ and Direct2D but we have to wait until TheQwertiest has implemented and
released it in SMP v2.

-Tom

Re: Biography Discussion

Reply #953
Here is another window resizing comparison. Wil-B vs kgena_ua.

www.youtube.com/watch?v=C7huUT6Q0bk

Of course, Wil'B's Bio is constantly resizing the image to its proper aspect ratio with each movement of the window. kgena_ua's Bio does not do this, and I don't know of any other script (except for Wil-B's Library) that does this.

My 'winner' comment at the end of the video does not imply that I like kgena_ua's Bio better.

Edit: "and I don't know of any other script (except for Wil-B's Library) that does this." - This could be an inaccurate comment. (Still processing all this stuff)

Re: Biography Discussion

Reply #954
I've forgot to tell you that you can put the whole debounce method in the Image's constructor to be sure to call it only once in on_size to improve performance:

Code: [Select]
class Images {
constructor() {
       // Put the debounce code at the end of the constructor
}
}

Code: [Select]
on_size() {
this.debounce();
}

Fortunately, Biography runs fine on your theme because your left side never changes size.
What do you exactly mean by that? You can change width or height or both at the same time so all the sizes change.

P.S So yeah, I've read the kahel's posts you pointed out and it confirms that it very well may be the slow old GDI+ ( that SMP is using )
I've mentioned at the end in point 02. JSP uses Direct2D which should have better performance of course...

-Tom


Ok, got it. Thanks again for your info. I'll try the debounce thing and report back if there is any improvement.

Re: Biography Discussion

Reply #955
The video comparison is not really fair, try to disable filmstrip and use the Biography's default theme "User Interface", i.e no blending.
( The blending, bio themes "Dark", "Blend", "Light", "Random" are complex and CPU intensive ).
You will see the resizing performance is much better when you're using the default settings, because it does not need to calculate
the large blended background image, the filmstrip thumbnails and the large image itself.

Drawing blended backgrounds/images ( basically blends the large image in the background ), gradients, fast refresh rates, etc
hits on the performance. It also depends how many UI elements have these styles that need to be constantly drawn.
I know this from experience when I've created the many theme presets in Georgia-ReBORN, the performance will become even
worse when the window size becomes larger and larger. 4K res hits even harder.
But if you have a decent CPU, even a 4K res player size with different styles should not be a problem because you listen to music
and do not constantly resize your player all the time...

You can also check and test for yourself, I have implemented various Georgia-ReBORN performance presets depending
on CPU speed. If you want to stress test your CPU, try top menu Options > Settings > Theme performance > Highest quality.
This preset was intended only for benchmark on very high end CPUs, it hits really hard if additionally using a blended
preset, for example top menu Options > Preset > Reborn > Blended and now also go to the Details panel.
When using slow and decent CPUs, foobar will become unresponsive. To make it responsive again, click the foobar pause button
when mouse hovering on your desktop taskbar.
Then you can right click on the progress bar and change refresh rate to 60 or 100 ms, disable disc art opacity etc.
Or just change to high/balanced performance preset. As you see, it all depends on various operations how complex drawing is...

So all in all, I still blame the poor performance of GDI+ when drawing complex elements and large images.

-Tom

Re: Biography Discussion

Reply #956
The video comparison is not really fair, try to disable filmstrip and use the Biography's default theme "User Interface", i.e no blending.
( The blending, bio themes "Dark", "Blend", "Light", "Random" are complex and CPU intensive ).
You will see the resizing performance is much better when you're using the default settings, because it does not need to calculate
the large blended background image, the filmstrip thumbnails and the large image itself.

Drawing blended backgrounds/images ( basically blends the large image in the background ), gradients, fast refresh rates, etc
hits on the performance. It also depends how many UI elements have these styles that need to be constantly drawn.
I know this from experience when I've created the many theme presets in Georgia-ReBORN, the performance will become even
worse when the window size becomes larger and larger. 4K res hits even harder.
But if you have a decent CPU, even a 4K res player size with different styles should not be a problem because you listen to music
and do not constantly resize your player all the time...

You can also check and test for yourself, I have implemented various Georgia-ReBORN performance presets depending
on CPU speed. If you want to stress test your CPU, try top menu Options > Settings > Theme performance > Highest quality.
This preset was intended only for benchmark on very high end CPUs, it hits really hard if additionally using a blended
preset, for example top menu Options > Preset > Reborn > Blended and now also go to the Details panel.
When using slow and decent CPUs, foobar will become unresponsive. To make it responsive again, click the foobar pause button
when mouse hovering on your desktop taskbar.
Then you can right click on the progress bar and change refresh rate to 60 or 100 ms, disable disc art opacity etc.
Or just change to high/balanced performance preset. As you see, it all depends on various operations how complex drawing is...

So all in all, I still blame the poor performance of GDI+ when drawing complex elements and large images.

-Tom


Although I haven't really delved into your options, I have no performance issues with your Georgia theme. I just used your theme, in the first window resizing test, as example. Everyone runs these themes full screen,
so hardly anyone is going to be dragging windows like that

You are correct about disabling blending, and I forgot to kill the filmstrip.  It does speed things up. If I were to rate the scaling of Wil-B's Biography with blending and filmstrip ON, I'd give it a 2/10. With blending and filmstrip OFF, I'd say more like 6/10. With my tweak (which is necessary for my theme, with the panel switching), I'd give it a 10/10...even with blending and filmstrip on.


Re: Biography Discussion

Reply #958
let's not start discussion with the web workers
It should be mentioned though, that it's highly likely, that webworker support in v2 would be implemented before direct2d =)
Reasoning: direct2d is faster, but it could be still slow in some cases (e.g. loading image from disk or internet). Off-loading time-intensive tasks from the main thread would solve this problem for every type of graphic backend (and for non graphics tasks as well).

Re: Biography Discussion

Reply #959
@TheQwertiest,

OK, if SMP can provide it, we will gladly take it!

SMP v2 sounds more and more promising BUT I have big fears that we need to rewrite big portions of our scripts
cause of compatibility!? I hope that is not the case and we need to adjust only some things here and there...
The big question is the release date, people are getting a bit impatient and are SO HOT and HUNGRY for it =)
Please do some more small status updates in the SMP thread to inform us a little bit, thanks!

-Tom

Re: Biography Discussion

Reply #960
What is the best/easiest way to disable the filmstrip in WilB's biography script?


Re: Biography Discussion

Reply #962
Perfect! Thanks!

Re: Biography Discussion

Reply #963
Hi everyone

I have problem with dowloading picture from last.fm on bioghrapy 1.4.1. I don't know why.

I using DarkOne4Mod v1.0 (SMP). Before picture was downloading.

Maybe you have idea what i should to do or what check on settings?

In attachement few screenshot from my settings.

Thx for help.


Re: Biography Discussion

Reply #964
Hi everyone

I have problem with dowloading picture from last.fm on bioghrapy 1.4.1. I don't know why.

I using DarkOne4Mod v1.0 (SMP). Before picture was downloading.

Maybe you have idea what i should to do or what check on settings?

In attachement few screenshot from my settings.

Thx for help.



Last.fm with Biography 1.41 works fine for me.

Have you tried mainstream artists?

Re: Biography Discussion

Reply #965
The issue is probably related to the redirect (see last.fm web site screenshot).

I guess the url could be formed like this...

Code: [Select]
https://last.fm/music/+noredirect/ARTIST_NAME/+images

Re: Biography Discussion

Reply #966
The issue is probably related to the redirect (see last.fm web site screenshot).

I guess the url could be formed like this...

Code: [Select]
https://last.fm/music/+noredirect/ARTIST_NAME/+images


for example artist Aly & Fila (from url last.fm web)
https://www.last.fm/pl/music/Aly+&+Fila/+images/c8d2c8e493bf4235b61977cd8fb8d3fa

Can you explain what means or what i must do with this code which you write?

Re: Biography Discussion

Reply #967
I make a test and install virtualbox and put foobar and work well. I have artist image. I think it is something which block dowloading image but i dont know where i must search issue.

Re: Biography Discussion

Reply #968
I have some problem with download artist pic from lastfm and download review from allmusic

Re: Biography Discussion

Reply #969
Allmusic hasn't worked in a few weeks now. Inspecting the website html in the browser doesn't show the review text at all so scripts like this can't scrape it. Pretty sure nothing can be done about that.

Re: Biography Discussion

Reply #970
Allmusic hasn't worked in a few weeks now. Inspecting the website html in the browser doesn't show the review text at all so scripts like this can't scrape it. Pretty sure nothing can be done about that.
Lastfm picture downloader broke too?

Re: Biography Discussion

Reply #971
Reviews appear fine on my browser, but the dropdown uses javascript
https://www.allmusic.com/album/nowhere-to-go-but-up-mw0004132140#review

No idea if that link also works on xmlhttp requests though. Inspecting the js dropdown, it reads a variable on cookies.. which can be used as query too.
https://www.allmusic.com/album/mag-earwhig!-mw0000019690?autotune=false

That seems to load the entire page with reviews.

For user reviews, only checks for the URL hash this way:
Code: [Select]
...
  if (!0 === t.scroll && (window.location.hash = "userReviews"), !i.next().hasClass("tabContent")) {
...
https://www.allmusic.com/album/mag-earwhig!-mw0000019690?autotune=false#userReviews

Re: Biography Discussion

Reply #972
When I said "inspect the website html" I meant right click the page and view source. That is html. That's what scripts see and they can only parse that.

Since I've forgotten to use xmlhttp objects and can't be bothered to trawl old code looking for it, I'll post an example for JScript Panel 3 only......
Code: [Select]
var url = "https://www.allmusic.com/album/nowhere-to-go-but-up-mw0004132140#review";

// second arg 0 means GET request
utils.HTTPRequestAsync(window.ID, 0, url); // returns a task_id but we don't need it here

function on_http_request_done(task_id, success, response) {
   if (success) utils.ShowPopupMessage(response);
   else utils.ShowPopupMessage("FAIL :/");
}

If you can find the review text in that response, you win a prize.



Re: Biography Discussion

Reply #974
Wonder what have I won:
Album:
https://www.allmusic.com/album/mag-earwhig!-mw0000019690
Review:
https://www.allmusic.com/album/mag-earwhig!-mw0000019690/reviewAjax
User review:
https://www.allmusic.com/album/mag-earwhig!-mw0000019690/userReviewsAjax

Code: [Select]
function onStateChange(timer, resolve, reject, func = null) {
if (this !== null && timer !== null) { // this is xmlhttp bound
if (this.readyState === 4) {
clearTimeout(timer); timer = null;
if (this.status === 200) {
if (func) {return func(this.responseText);}
else {resolve(this.responseText);}

} else {
if (!func) {reject({status: this.status, responseText: this.responseText});}
}
}
} else if (!func) {reject({status: 408, responseText: this.responseText})}; // 408 Request Timeout
return null;
}

// May be used to async run a func for the response or as promise
function send({method = 'GET', URL, body = void(0), func = null, requestHeader = [/*[header, type]*/], bypassCache = false}) {
const p = new Promise((resolve, reject) => {
let timer = null;
const xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#bypassing_the_cache
// Add ('&' + new Date().getTime()) to URLS to avoid caching
xmlhttp.open(
method,
URL + (bypassCache
? (/\?/.test(URL) ? '&' : '?') + new Date().getTime()
: '')
);
requestHeader.forEach((pair) => {
if (!pair[0] || !pair[1]) {console.log('HTTP Headers missing: ' + pair); return;}
xmlhttp.setRequestHeader(...pair);
});
if (bypassCache) {
xmlhttp.setRequestHeader('Cache-Control', 'private');
xmlhttp.setRequestHeader('Pragma', 'no-cache');
}
timer = setTimeout((xmlhttp) => {
xmlhttp.abort();
timer = null;
if (!func) { // 408 Request Timeout
let status = 408;
try {status = xmlhttp.status;} catch(e) {}
reject({status, responseText: 'Request Timeout'});
}
}, 30000, xmlhttp);
xmlhttp.onreadystatechange = onStateChange.bind(xmlhttp, timer, resolve, reject, func);
xmlhttp.send(method === 'POST' ? body : void(0));
});
return p;
}


send({method: 'GET', URL: "https://www.allmusic.com/album/mag-earwhig!-mw0000019690/reviewAjax", func: fb.ShowPopupMessage.bind(fb)});

X