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 341892 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Spider Monkey Panel (foo_spider_monkey_panel)

Spider Monkey Panel    

fb2k component that allows for creation of full-fledged CUI/DUI panels using JavaScript! 

Base functionality includes:
 - Graphics functions: drawing (text, images, lines, rectangles and etc), image modification (resize, blur, inversion of colours and etc).
 - Access to font and colour settings from CUI/DUI preferences.
 - Capture of foobar2000 events with callbacks.
 - Capture of keystrokes and mouse movement/clicks.
 - Execution of main menu and context menu commands.
 - Creation of custom buttons and menus.
 - Playlist management: create, destroy, sort, change, rename and do anything that fb2k can do.
 - Media Library access with ability to sort and filter it's content.
 - File tag management.
 - Per panel settings storage.
 - Built-in web and filesystem functionality.
 - foo_acfu integration.
 - And more!

Getting started!
 - Use Installation Guide.
 - Check out Samples and User scripts.
 - Take a look at Documentation, if you are craving for more!

Information for JScript Panel users
Spoiler (click to show/hide)

Links
 - Download link
 - Homepage
 - Changelog
 - Detailed list of API Changes
 - Current tasks and plans
 - Dev build

Credits
 - marc2003: original foo_jscript_panel, sample scripts and multiple contributions to this project.
 - T.P. Wang: original WSH Panel Mod
 - #jsapi IRC channel: wouldn't make it through without them, love you guys! 
    Especially huge thanks to sfink and jonco, who spent literally tens of hours helping me! 
 - Respective authors of the code being used in this project.

Re: Spider Monkey Panel

Reply #1
Version: 1.0.0
Link: https://github.com/TheQwertiest/foo_spider_monkey_panel/releases/tag/v1.0.0
Changelog (relative to the latest version of JScript Panel):
Spoiler (click to show/hide)
Detailed description of API changes: https://github.com/TheQwertiest/foo_spider_monkey_panel/wiki/API-Changes#v100

Huge thanks to marc2003 for porting samples and testing the component!

Re: Spider Monkey Panel

Reply #2
Tried to see the cover:
foobar2000 \ user-components \ foo_spider_monkey_panel \ samples \ basic \ GetAlbumArtV2.txt

Code: [Select]
Error: Spider Monkey Panel v1.0.0 (GetAlbumArtV2 by T.P Wang)
g_img.Dispose is not a function

File: <main>
Line: 35, Column: 3

Stack trace:
   on_playback_new_track @ <main>: 35: 3
How to adapt this :
https://hydrogenaud.io/index.php/topic,110938.0.html
Library tree ?

Re: Spider Monkey Panel

Reply #3
Library Tree is in the process of being ported.

Re: Spider Monkey Panel

Reply #4
@TheQwertiest , I can't tell you how excited I am for this! Really want to check it out, but I need to finish my themes 1.0 release before I have to redo everything again :)

You said it's fast, but have you done performance benchmarking? What kind of speed increase are you seeing when initializing 10k files in your playlist component?

I saw this bit in the API docs:
Quote
utils.CreateHtmlWindow() method.
This method allows the creation of HTML windows rendered by IE8 engine.
utils.CreateHtmlWindow(html_code, { width: window_w, height: window_h, title: window_title, data: callback_data, fn: callback_fn }).
If that's using ActiveX to create the window, you can bump it up to IE11 using the FEATURE_BROWSER_EMULATION registry key. Not ideal for sharing themes, but probably possible nonetheless.

Re: Spider Monkey Panel

Reply #5
@TheQwertiest , This is great work, at last an engine that has the latest ECMA support. Now I can use string.startsWith and array.findIndex. Heaven knows what I can do with those async functions!

@WilB, You just knew someone would ask 'What about porting your wonderful Biography panel'.....

Re: Spider Monkey Panel

Reply #6
Tried to see the cover:
foobar2000 \ user-components \ foo_spider_monkey_panel \ samples \ basic \ GetAlbumArtV2.txt
Oops, forgot to nuke that `Dispose` call (will be fixed in v1.0.1).
For now you can just remove the following lines:
Code: [Select]
if (g_img)
    g_img.Dispose();

How to adapt this :
https://hydrogenaud.io/index.php/topic,110938.0.html
Library tree ?
See @WilB 's reply above: it's being ported =)

Library Tree is in the process of being ported.
Nice! Looking forward to ;)

Re: Spider Monkey Panel

Reply #7
@TheQwertiest

I think I've found a problem. The following line;
    fb.RunContextCommandWithMetadb("ReplayGain/Scan as albums (by folders)",plman.GetPlaylistSelectedItems(plman.ActivePlaylist));

gives this error;
'RunContextCommandWithMetadb' failed:
handle argument is invalid

Re: Spider Monkey Panel

Reply #8
You said it's fast, but have you done performance benchmarking? What kind of speed increase are you seeing when initializing 10k files in your playlist component?
I was too lazy to perform any proper benchmarking. AFAIK most(?) operations are faster by at least an order of magnitude. There is one regression I've encountered though (https://bugzilla.mozilla.org/show_bug.cgi?id=1474914), so `Playlist` performance might be further increased by rewriting initialization without `reverse`.

you can bump it up to IE11 using the FEATURE_BROWSER_EMULATION registry key. Not ideal for sharing themes, but probably possible nonetheless.
I'm in progress of total rewrite of `CreateHtmlWindow`, since current implementation has some nasty bugs (like fb2k lockup when user closes html window). As a side effect it should work properly with IE=edge and it will support loading htmls from file.

@TheQwertiest

I think I've found a problem. The following line;
    fb.RunContextCommandWithMetadb("ReplayGain/Scan as albums (by folders)",plman.GetPlaylistSelectedItems(plman.ActivePlaylist));

gives this error;
'RunContextCommandWithMetadb' failed:
handle argument is invalid
See https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/19

Bug will be fixed in v1.0.1

Re: Spider Monkey Panel

Reply #9
@TheQwertiest re issue #19
I've tried 'Build: 21:06:31, Oct  2 2018' patch from github and still get the same problem

Re: Spider Monkey Panel

Reply #10
@Black_Over_Bills_Mothers
Quote
You just knew someone would ask 'What about porting your wonderful Biography panel'.....

Yes, Biography, Library Tree & YouTube Track Manager are all in the process of being ported... Spider Monkey Panel is a really great advancement that will enable them to be used with the newer ECMA features. To implement these properly may take a little time, but hopefully they are not far away...

Re: Spider Monkey Panel

Reply #11
I'm just going to flat out make a request even before I RTFM...

Please, for the love of all that is, add an album rating method. Something similar to jsp_rating would be nice but I'm not that picky. That is the only feature left that I want in foobar and the one thing I miss about not using custom database. (Having custom notes in custom db was nice too but I can do that with a .txt)

And if not, because marc2003 wouldn't do it either when I asked, I'm still going to use this component because it looks great. Thanks for this.

Re: Spider Monkey Panel

Reply #12
Can we please have a better development environment. Links to an external editor such as Notepad++ or at least add text search and brace matching. I know you can export and import script but it's a pain.

Re: Spider Monkey Panel

Reply #13
Can we please have a better development environment. Links to an external editor such as Notepad++ or at least add text search and brace matching.
I'd consider this as a waste of time to implement such functionality. Just place one line like include('path/to/script.js') in the panel code area and do the code editing of this script with an editor of your choice.

Re: Spider Monkey Panel

Reply #14
Can we please have a better development environment. Links to an external editor such as Notepad++ or at least add text search and brace matching.
I'd consider this as a waste of time to implement such functionality. Just place one line like include('path/to/script.js') in the panel code area and do the code editing of this script with an editor of your choice.
Seems interesting but could you explain a little further please.

Re: Spider Monkey Panel

Reply #15
@Black_Over_Bills_Mothers
Quote
You just knew someone would ask 'What about porting your wonderful Biography panel'.....

Yes, Biography, Library Tree & YouTube Track Manager are all in the process of being ported... Spider Monkey Panel is a really great advancement that will enable them to be used with the newer ECMA features. To implement these properly may take a little time, but hopefully they are not far away...
@WilB, great news!
looking forward to new versions of your cool scripts! (Don't forget JScript's version :) )
And I want to test Spider Monkey Panel
@TheQwertiest, thanks a lot for your great work!
Wish you creative success in the development of this project!

Re: Spider Monkey Panel

Reply #16
I've tried 'Build: 21:06:31, Oct  2 2018' patch from github and still get the same problem
That's weird, I'll recheck later.

Wish you creative success in the development of this project!
Haha, thanks!

Please, for the love of all that is, add an album rating method. Something similar to jsp_rating would be nice but I'm not that picky.
Not sure what you mean. Do you want another custom metadb field? Like `smp_album_rating`?
PS: Both JSP and SMP provide a way to edit tags via `UpdateFileInfoFromJSON`.

Seems interesting but could you explain a little further please.
See `docs/js_doc/Interfaces.js` and samples. This method works like `eval`, but accepts path to file and provides better error-reporting.

On another note: JSP and SMP `Configure` window uses the same editor engine as Notepad++ =)

Re: Spider Monkey Panel

Reply #17
On another note: JSP and SMP `Configure` window uses the same editor engine as Notepad++ =)
Maybe he wants Atom :)

Re: Spider Monkey Panel

Reply #18
Maybe he wants Atom :)
Well, to be fair, only internal editor engines are the same, the engine wrappers are different, thus the different experience in Notepad++ compared to `Configure` window in JSP/SMP =)

Re: Spider Monkey Panel

Reply #19
Please, for the love of all that is, add an album rating method. Something similar to jsp_rating would be nice but I'm not that picky.
Not sure what you mean. Do you want another custom metadb field? Like `smp_album_rating`?
PS: Both JSP and SMP provide a way to edit tags via `UpdateFileInfoFromJSON`.
custom metadb field? Like `smp_album_rating`
^ That exactly.  I don't want to be changing the actual tags in the files. I realize I could do this in m-TAGS but that just creates other issues for me personally atm. Custom database was also really good for such things but it just got to the point it crashed so often it was unusable.
Again, Thanks for this component. It looks great.


Re: Spider Monkey Panel

Reply #21
^ That exactly.  I don't want to be changing the actual tags in the files. I realize I could do this in m-TAGS but that just creates other issues for me personally atm. Custom database was also really good for such things but it just got to the point it crashed so often it was unusable.
Hm... Don't really want to add random tags. I'd rather make a generic method to add custom tags (well, if it's possible), smth like
Code: [Select]
utils.CreateCustomTag('smp_new_tag', 'number') ); // CreateCustomTag(tag_name, tag_type);
...
metadb.SetCustomTag('smp_new_tag', 'this is my tag value'); // SetCustomTag(tag_name, tag_value);

"wordwrap" option would be nice! ;)
Do you mean `linewrap` (when line is too big, part of it will move to the next line)?
If you do, then I can add in v1.0.1.

Re: Spider Monkey Panel

Reply #22
^ That exactly.  I don't want to be changing the actual tags in the files. I realize I could do this in m-TAGS but that just creates other issues for me personally atm. Custom database was also really good for such things but it just got to the point it crashed so often it was unusable.
Hm... Don't really want to add random tags. I'd rather make a generic method to add custom tags (well, if it's possible), smth like
Code: [Select]
utils.CreateCustomTag('smp_new_tag', 'number') ); // CreateCustomTag(tag_name, tag_type);
...
metadb.SetCustomTag('smp_new_tag', 'this is my tag value'); // SetCustomTag(tag_name, tag_value);
That would be fine. Great even. I could actually do more with that.

Re: Spider Monkey Panel

Reply #23
Do you mean `linewrap` (when line is too big, part of it will move to the next line)?
If you do, then I can add in v1.0.1.

Notepad++ actually calls it wordwrap - but yes, linewrap option would be great!

Re: Spider Monkey Panel

Reply #24
That would be fine. Great even. I could actually do more with that.
It seems that this is impossible... From fb2k SDK:
Quote
List of fields that you provide is expected to be fixed at run-time. The backend will enumerate your fields only once and refer to them by indexes later.
I.e. all fields must be defined when component loads and can't be added afterwards.
Another way might be to configure custom tags from the component's preferences page, but that would be possible only if component configuration is loaded before fields enumeration (which I doubt is the case).