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: Spider Monkey Panel (foo_spider_monkey_panel) (Read 507526 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1450
I have found a solution to retrieve the current script path, which was not available anywhere, which can be used to install script files along any extra files easily, the same than packages. This was only a problem when you needed to load a file (for ex. an image), since you had to provide the path... so the script was required to be installed at an specific relative path (to the profile folder) set previously by the dev (in my case it was '[profile]\scripts\SMP\xxx-scripts\').
 
With this there is no more need for these hardcoded paths, so people can install them anywhere within the profile folder.

Code: [Select]
const getRoot = (bRelative = true) => {
try { include(''); }
catch (e) { return e.message.replace('include failed:\nPath does not point to a valid file: ' + (bRelative ? fb.ProfilePath : ''), ''); }
};

console.log(getRoot());
console.log(getRoot(false));

Outputs:
Quote
scripts\SMP\xxx-scripts\
B:\foobar2000\profile\scripts\SMP\xxx-scripts\

Will update my scripts with this change, so people can finally put the files wherever they want (or even test multiple versions without needing to touch the code). I would still recommend to install them all on the same choosen folder though, since SMP caches file access...

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1451
Merry Christmas everyone.  :P

I have a new mod based on 1.6.1 so no change to the script engine/windows requirements.

Like my previous mod, this has...

utils.GetClipboardText / utils.SetClipboardText
fixed colour picker
fixes IsFile/IsFolder
updated transparency to use proper code from the Columns UI SDK

New stuff is mainly handle list improvements using newer methods from the fb2k SDK. For that reason, only fb2k 2.0 or later is supported.

Sensible bug reports will be looked in to - Windows only.

edit: forgot to say, this has script fixes by regor (taken from the last JSplitter release)

edit2: on_library_items_changed has been updated with a fromhook argument like on_metadb_changed. This is useful if you want to ignore updates from playback statistic like components pushing database updates which you typically do not want in a library viewer...

Code: [Select]
function on_library_items_changed(handles, fromhook) {
    if (fromhook)
        return;
    //do stuff
}

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1452
The previous attachment has a really stupid bug in it - apologies.

Here's another...

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1453
I'm not sure if I'm imagining things, but now on the old mod and also new one I am able to set the slow script warning to 0 on win 11.

But I swear it was impossible to do before on all SMP versions on my win 7 or win 10 installation. Just checked it and it works even on the original SMP now on win 11.  Can someone more check this on win 10 or win 7? (i.e. it was supposed that inserting a 0 was immediately replaced by 1)

Quote
Merry Christmas everyone.  :P

I have a new mod based on 1.6.1 so no change to the script engine/windows requirements.
Thank you so much marc, sure it will come handy for people using x32 versions. Could you also increase the version number? Since both mod versions share the same version number but they are not compatible with the same foobar versions, it could produce confusion.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1454
Version number will be bumped in the next release.

And there have been no advanced config changes. I really took the code from the git history at the point of the 1.6.1 release with just a handful of cherry picked commits. Just after 1.6.1 was released, the project files were updated for VS2022 but I'm unable to make any of it compile due to my incompetence so that's my main reason for sticking at that point in history. Compiling with the VS2019 toolset just works for me.





Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1456
Trying to play with that method, for waveforms instead of vu meters, but I'm failing to correctly get the entire data for a given track.

Checking the method it doesn't seem to be designed for that, unless I'm missing how to do it.

Also, now that you are checking SMP, could you look at this old error with menu checking?
https://github.com/phw/foo_listenbrainz2/issues/22

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1457
GetAudioChunk is real time only. I have zero clue how you'd go about parsing a whole file.

And the menu command seems to work for me. I even checked with the ListenBrainz component.

A blank panel with this and toggling the main menu/reloading the panel shows the expected result.

Code: [Select]
console.log(fb.IsMainMenuCommandChecked("Submit to ListenBrainz"));

The full form Playback/Submit to ListenBrainz works fine too.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1458
Really I'm so lost about why the same doesn't work for me, it just outputs true in any case (also true if disabled), while working on most other menus.  Will try again in a clean install.

Quote
GetAudioChunk is real time only. I have zero clue how you'd go about parsing a whole file.
That's what I thought, then there is no way to fully parse a file and render a waveform, and also not really viable to paint it on real time while playing. But it's great for VU meters, sure someone else will be interested on creating more scripts.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1459
Clean portable v1 + your old SMP mod -> it fails
Spoiler (click to show/hide)

clean portable v1 +  original SMP -> ok
Spoiler (click to show/hide)

clean portable v2 + new mod -> ok
Spoiler (click to show/hide)

Seems to be an specific problem on your (old) mod and versions based on a specific SMP release. In all cases it's using DUI.

EDIT:
 v1 + Jsplitter 3.1.6.10 -> fails

 v2 + Jsplitter 3.1.6.10 -> fails

Can not test other versions since they just crash for me.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1460
Quote
GetAudioChunk is real time only. I have zero clue how you'd go about parsing a whole file.
That's what I thought, then there is no way to fully parse a file and render a waveform, and also not really viable to paint it on real time while playing.
What you get out of this should be good enough for any graphic purposes. But if the scripting language runs slowly or you call this function too seldom, you may lose samples. But again, unless your monitor has multimegapixel horizontal resolution you will not see anything wrong.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1461
Quote
What you get out of this should be good enough for any graphic purposes. But if the scripting language runs slowly or you call this function too seldom, you may lose samples. But again, unless your monitor has multimegapixel horizontal resolution you will not see anything wrong.
I am not sure about that. I mean, I can not select audio before now playing time and the only way to render the entire track requires to actually play it from start to end (unless I'm missing something on marc's implementation). Therefore if someone plays or stops playback, the data saved is as an incomplete waveform. I see a lot of problems with such approach for a waveform seekbar, for VU meters is fine or other purposes is fine.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1462
That API is of course for realtime visualization purposes, I understood you were just concerned that it doesn't guarantee getting 100% all samples.
If the intention is to get all audio data from a file when wanted, it would need a different API. Access to decoder, ability to decode until end of file and access to the audio chunk data the decoder gives after each call.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1463
fb2k 2.25 has changed the behaviour of FbMetadbHandle RawPath IF you have a portable install AND your music resides on the same drive as that portable install. Any script that does something like startsWith("file://") will fail because RawPath will now start with "file-relative://".

I've compiled an update that works around this.

Also, it's open source here.

https://github.com/marc2k3/foo_spider_monkey_panel

Unlike the original repo, this has no python scripts to run. You simply open the solution file from inside the src folder and go.

It can be compiled with VS2019 or VS2022 but if using VS2022, you must have the v142 toolset installed. If you try with v143, you're on your own fixing the multitude of template errors that are way over my head. :P



Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1464
Too bad this component is stuck for the last 3 years now and never got upgraded to 64-bit
Enjoy life now, this is not a rehearsal.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1465
Too bad this component is stuck for the last 3 years now and never got upgraded to 64-bit
Yeah, but what about JSplitter?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1466
Too bad this component is stuck for the last 3 years now and never got upgraded to 64-bit
Yeah, but what about JSplitter?

Also dumped a few months ago so it is no longer supported.
Beside that Spider Monkey Panel has some capabilities that JSplitter does not (e.g. Library Tree and Biography)
Enjoy life now, this is not a rehearsal.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1467
^ Are you thinking of JScript Panel? Because JSplitter is a clone of SMP in 32/64-bit that can definitely run WilB scripts (last time I tried)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1468

Also dumped a few months ago so it is no longer supported.
Beside that Spider Monkey Panel has some capabilities that JSplitter does not (e.g. Library Tree and Biography)
How do you know it's no longer being supported?  The developer may just be on a longer schedule than we'd like.

JSplitter is running WiLB Biography just fine on my 64-bit Foobar v2.24.5.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1469
fb2k 2.25 has changed the behaviour of FbMetadbHandle RawPath IF you have a portable install AND your music resides on the same drive as that portable install. Any script that does something like startsWith("file://") will fail because RawPath will now start with "file-relative://".

I've compiled an update that works around this.

I think in this case the scripts should be updated instead of touching the handle property at component level, because otherwise scripts will not work with other versions of the component (and being honest here, people are just using whatever it works for them), resulting in a mess. Fixes at script level are easy enough and anyway if new file protocols are the norm in future versions, then scripts should adjust to it. Otherwise we are loosing the possibility to make use of the new protocol for something else.

I have revised all my scripts and it was 10 mins to support both protocols. Library tree and Biography has only 4 places to edit. I can take care of those.

Anyway thanks for the warning.

And finally possible to compile it without dark magic xd thank you so much

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1470
# 1.62.25.05.13
-Add `FbMetadbHandleList` `SaveAs`. Saves using native `.fpl`
format so you should use that as the file extension. The
parent folder must already exist.

-Add `fb.ShowPictureViewer(image_path)`. This uses the image
viewer built in to `foobar2000`.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1471
# 1.62.25.05.13
-Add `FbMetadbHandleList` `SaveAs`. Saves using native `.fpl`
format so you should use that as the file extension. The
parent folder must already exist.
Finally can save into fpl playlists. Is it possible to load a fpl playlist as a handle list (skipping the UI)?


Quote
-Add `fb.ShowPictureViewer(image_path)`. This uses the image
viewer built in to `foobar2000`.
Will add that one to biography, which was the missing bit for art.

Thanks for both!

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1472
Is it possible to load a fpl playlist as a handle list (skipping the UI)?

JSP3 has had this for years and I can probably add it here. But it is asynchronous and I won't be touching promises. It will be a function that returns a task id and then a callback will be triggered that receives the task id and a handle list.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1473
It's trivial to convert callback outputs to promises within JS, so that works for me in both cases.