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

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #825
Quote
utils.WriteTextFile(fn, text, bom)
"bum" - Help. I can't understand what it means.
BOM is Byte-Order Mark. It's used by programs reading the file to determining the endian-ness of a file. If that sentence means nothing to you, don't worry about it. You don't need to include it when calling WriteTextFile (it defaults to true) so you can just do:
Code: [Select]
utils.WriteTextFile(filename, text);

You only need to worry about that setting if you're writing files that another program that isn't foobar is reading.

 

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #826
@MordredKLB , SMP doesn't support .webp images.
Are there any news on WebP on SMP? This format is used quite often in YT thumbnails, I miss them e.g. at SMP-based Georgia from @MordredKLB or Biography from @WilB. In Marcs JSP scripts such as 'Album Art' or 'Track Info + Seekbar + Buttons', WebP-based YT thumbnails are shown without any problems.
Would be great to be available as well for SMP-based scripts.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #827
Well I tested it on win 10 and the same code does what it's supposed to do. i.e. it always returns true while the key is pressed, and as result my file is never deleted (while pressing shift). Also tried with multiple variants... loops, intervals, etc. All are fine.

Yesterday I was working on win 7. So I think that we got another function (like utils.FileTest() ) behaving different in win 7 and win 10.
Will check all tests again on the other PC asap, but if it's another SO behavior mismatch the func is totally broken on win 7.

Quote
Could be an issue with your keyboard or something in the OS (stickykeys/filterkeys maybe? I know those are related to holding shift)

I don't use any of that. But I will check it since I have access to multiple PCs with win 7.

Have tested it again and ... the same code did not work as expected on win 7. Tried multiple things without luck (specially following MordredKLB thoughts about some keyboard filter on background) and finally after reinstalling SMP component it worked. So have no idea what was going on but now there is no bug. Consider it solved (?).

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #828
Are there any news on WebP on SMP? This format is used quite often in YT thumbnails, I miss them e.g. at SMP-based Georgia from @MordredKLB or Biography from @WilB. In Marcs JSP scripts such as 'Album Art' or 'Track Info + Seekbar + Buttons', WebP-based YT thumbnails are shown without any problems.
Would be great to be available as well for SMP-based scripts.
@MojoBass see discussion here:
https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/111

Seems marc did some work to get this to work well in JSP, but currently SMP just can't handle webp.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #829
In the details tab of properties and "selection properties" panel.there is a SMP section with playcount values, always empty.

Which script do they belong to? are they necessary to SMP proper operation?

If not....Is there a way to disabled?

It's weird to have repeated values in the "selection properties" panel.




Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #831
In the details tab of properties and "selection properties" panel.there is a SMP section with playcount values, always empty.

Which script do they belong to? are they necessary to SMP proper operation?

If not....Is there a way to disabled?

It's weird to have repeated values in the "selection properties" panel.

I've submitted a pull request on github that fixes this. You'll have to wait and see if it gets accepted or not.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #832
In the details tab of properties and "selection properties" panel.there is a SMP section with playcount values, always empty.

Which script do they belong to? are they necessary to SMP proper operation?

If not....Is there a way to disabled?

It's weird to have repeated values in the "selection properties" panel.

I've submitted a pull request on github that fixes this. You'll have to wait and see if it gets accepted or not.

Cool  8)




Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #833
Is there some way to replicate the shortcut tip of foobar menus on SMP?

X

Note they are aligned to the right and don't make the menu to be bigger! If you simply add that string to the menu text, it just increases the width, so you could make it "centered" leaving blank spaces but never like the image.

It would be a wonderful addition to add shortcuts in a clear way.


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #835
Just use \t like this:

Code: [Select]
menu.AppendMenuItem(MF_STRING, 1, "Search\tCtrl+F");
Works perfectly. Thanks! Thought it was somehow hard-coded.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #836
Now I think I found some weird behavior.

On_key_up(vkey) needs as requirement "Grab focus" enabled in the Configuration window.

But there is no such thing for external scripts, only for packages (!).

So I thought.. hey lets use DefinePanel(). I know it's deprecated but thats why I had on all my scripts yet.
grab_focus is not supported there according to the documentation, have not tried it though.
So I replaced DefinePanel with DefineScript, put the option and bingo it works.

The thing is... I reverted the changes and used again DefinePanel(). And that option remained active. i.e. I can still use key callbacks. Reloading the panel or restarting foobar obviously doesn't change anything.

Not necessarily a bug, since it makes sense that the option remains active until you directly change it. But since there is no UI to change it in standard scripts, it's really weird...

Scripts:
X

Packages
X

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #837
Another 2 questions.

Does on_char(code) require panel focus? I have not been able to use it for global shortcuts without the mouse clicking on the panel first, but the documentation does not say anything about it. (while it does on on_key_down/...)

And then.. is there some way to add global shortcuts without panel focus? (without using intervals)

Code: [Select]
var keyCallbackDate = Date.now();
function keyCallback() {
if (Date.now() - keyCallbackDate <= 500) {return;} // Limit rate to 500 ms
let bDone = false;
Object.keys(shortcuts).forEach((key) => {
if (bDone) {return;}
const shortcut = shortcuts[key];
if (utils.IsKeyPressed(shortcut.val) && (shortcut.mod === -1 || utils.IsKeyPressed(shortcut.mod))) {shortcut.func(shortcut.menu); bDone = true;}
});
if (bDone) {keyCallbackDate = Date.now();}
}
repeatFn(keyCallback, 100)();

Well that doesn't work as expected since it's really "global", and works even with the main foobar window not being in focus.

Adding if (!window.IsVisible) {return;} does not work as intended if using alt-tab. Since the panel window is considered to be visible even if the main program is not on focus (nor in the screen at all). When it's minimized it seems to work though.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #838
To make shortcuts global, components have to expose main menu or context commands that can be bound in the main preferences dialog. This is why on_main_menu exists but take care to understand the notes I included when I implemented it.

Quote
On the main menu>File>Spider Monkey Panel, there are 10 menu items and whichever number is selected is sent as the "index" to this callback.
Being main menu items now means you can bind them to global keyboard shortcuts, standard toolbar buttons, panel stack splitter buttons, etc.
Remember to think carefully about where you use this code as you probably only want it to run once and so don't include it in common files and scripts where you might have multiple instances.
Important: you should avoid sharing scripts containing this code so as not to conflict with what other users may already be using.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #839
I knew that option, but that's not what I would want to do at all since it involves -as you noted- replacing the main menu entries. Also it's limited to 10 entries, etc. That part requires a rework to be really usable by multiple scripts.
And also it doesn't work as I would want, since it would still require user input to bind shortcuts to those associated entries (which have no names but only 1,2,3..). Too many loops to assign a shortcut to a menu entry in a script (and I have no way to retrieve which keys are set).

Anyway, apart from that. I don't really understand why utils.IsKeyPressed() works even when foobar is not on focus. That doesn't seem to be right if there is no option to limit key checking only when foobar is on focus. Or a "fb.IsVisible" check could simply solve it too. Where it checks if the main window is visible.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #840
Let's say there was no limitation on the number of commands and you could customise the name of each one. That doesn't make them any easier to bind via main preferences and you can't really dictate which shortcuts people must use to match the text on your menu commands (assuming that is your intent). This functionality simply is not meant for shared scripts and nothing can be done to make it any easier.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #841
Let's say there was no limitation on the number of commands and you could customise the name of each one. That doesn't make them any easier to bind via main preferences and you can't really dictate which shortcuts people must use to match the text on your menu commands (assuming that is your intent). This functionality simply is not meant for shared scripts and nothing can be done to make it any easier.
Well my suggestion some months ago about the main menu entries was precisely to change that. Letting users to add arbitrary entries to the SMP config panel and setting shortcuts there. Then, since it's done by SMP, keys could be "suggested", instead of forced (the only way that can be done right now as you note).
https://hydrogenaud.io/index.php?topic=116669.msg994865#msg994865

That's why I say it needs a rework.

Lets say we have something like...

fb.addShortcut(name, func, key). Then it would populate the list on the link, at config, with a new entry. Automatically at script loading! No need for user input. Key would be a suggested key, and foobar already has some capability to check for duplicates keys so... if there was a duplicate, we could simply show a popup to ask the user to change it. Leaving it blank until then.

Quote
This functionality simply is not meant for shared scripts and nothing can be done to make it any easier.

That solves all problems. Scripts could add arbitrary menu entries. They would not be limited to X entries. Keys could be arbitrarily linked to them, and keys could be retrieved by the scripts (to add that info to the menu entries).

Obviously the problem is the menu thing right now,  ::) Not that it can not be changed to an usable thing between different panels.


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #843
Sorry for pointing to a thing which even TheQwertiest admitted was really limited 'as is' and discussing an alternative idea which obviously it's not in my list to do.

Would love to also see such ironic answers when someone appraises other developer's works.
- Hey really good plugin man. Love it as is.
- Do it yourself if you like it so much. I look forward to your implementation.
::) 

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #844
regor, you've got a very specific use-case for your scripts, specifically because you're writing what amounts to add-ons to other scripts/themes that you don't maintain. That's not something that anybody else is doing as far as I'm aware. I understand *why* you're doing it, but it seems to be making things more complicated for you as well.

When you've got a highly specialized use case with limited demand among the user base and it would require substantial dev-effort you can either figure out how to do it yourself and raise a PR, or you can just realize that it's probably not going to happen. Qwertiest has limited time and he's most likely going to allocate it to functionality and bug fixes that affect the most people.

I know you're going to ignore this but I think you're better off just putting the onus on any script writer who wants to include your stuff. If people really want the functionality you're providing, they'll do the heavy lifting themselves.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #845
anyone know if it's possible to request feature (improvement) on the scripts (by marc2003) included with Spider Monkey Panel?

for Artist Images@samples/complete/thumbs.js

1. currently, there is no way to bring up panel configuration (not script editor) unless I bring up fb2k's Preference and go for "configure panel" in the UI setting. would be good to be able to right click on the panel and bring that up so things like panel properties can be configure with ease. I actually didn't know such configuration exists until accidentally found it while configuring UI

2. not able to specify multiple custom folders and completely disable downloading arts

3. currently, custom folder path doesn't take any wild card, so it's not possible to specify some thing like "*scan*" to match folders like "hi-res scans [artist's name]", "scans [artist's name]", "scans booklet"...etc in addition to the regular "scan" folder to look for the arts. perhaps it's due to feature similar to Python's glob is missing

4. can Spider Monkey Panel support webp, tif...etc other popular art formats for thumbs.js to display the arts? tried a bit but couldn't get it to work

5. retain current thumbs (instead of reload and rebuild) when playing the next song in the same album/folder as current song such that there is no change to the available arts

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #846
1) There is nothing in the Properties dialog that cannot be set via the MENU.

2) If in Custom folder mode, no art is downloaded. If in Last.fm Artist mode, right click and uncheck Automatic Downloads. There is no support for multiple folders.

3) It's hardcoded to a single folder. I guess support for multiple folders is possible but I have no idea how to support wildcards in folder names.

4) Spider Monkey Panel does not support webp currently, It's on a to-do list.

5) This already happens. There is no refresh unless the title formatting evaluated for the current folder/artist changes.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #847
1. currently, there is no way to bring up panel configuration (not script editor) unless I bring up fb2k's Preference and go for "configure panel" in the UI setting. would be good to be able to right click on the panel and bring that up so things like panel properties can be configure with ease. I actually didn't know such configuration exists until accidentally found it while configuring UI
This is always possible with <WIN>+<SHIFT>+<RCLICK> -> Properties/Configure

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #848
1. currently, there is no way to bring up panel configuration (not script editor) unless I bring up fb2k's Preference and go for "configure panel" in the UI setting. would be good to be able to right click on the panel and bring that up so things like panel properties can be configure with ease. I actually didn't know such configuration exists until accidentally found it while configuring UI
This is always possible with <WIN>+<SHIFT>+<RCLICK> -> Properties/Configure
thanks. interesting enough that brings up the same menu as when Spider Monkey Panel crashes, which has the option to go panel config

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #849
1) There is nothing in the Properties dialog that cannot be set via the MENU.

2) If in Custom folder mode, no art is downloaded. If in Last.fm Artist mode, right click and uncheck Automatic Downloads. There is no support for multiple folders.

3) It's hardcoded to a single folder. I guess support for multiple folders is possible but I have no idea how to support wildcards in folder names.

4) Spider Monkey Panel does not support webp currently, It's on a to-do list.

5) This already happens. There is no refresh unless the title formatting evaluated for the current folder/artist changes.
1. fbuser provided a way to do it, so I'm good on this one

2. was cleaning up a bunch of unexpected downloaded arts due to trying to recover from weird crashes requiring delete panel from UI and re-add. wanted to directly configure property to custom folder since default is download mode and it looks like it does the download when any song is selected while nothing is playing

3. was looking to make folder a list separated by invalid path character (ex. colon) and iteratively do something similar to https://stackoverflow.com/questions/23809897/node-js-glob-pattern-for-excluding-multiple-files to recursively traverse all levels of each directory and grab all valid files

4. this is good to know

5. I kept hitting out of memory errors like below randomly. now I realize even when Selection mode is prefer now playing, script will react to the current selection when I stopped the playback. this causes crash and fk2k freeze for some time during start up if the resolved customer folder of the select song has high resolution scans (15000 x 9600) on 1080p monitor. note that at this point, if I start playback again either using hotkey or fb2k's menu, fb2k will play the last played song, not current selection. hence playback had never changed album/directory, but script will refresh thumbs/cache due to its context switch when I transition between playback and stopped playback states
Code: [Select]
Error: Spider Monkey Panel v1.4.1 ({2951B685-A759-4726-BC76-AE22F64A5607})
Out of memory: 288/1073741824 bytes

6. a new one. for displaying art, "center" would always leave spaces all around (top, bottom, left and right) while the other 3 modes would not leave space. would be good for center mode to at least fill up 2 of the 4 sides