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 161426 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1125
Tried it on another pc win 10 and same results.
Left and middle buttons work fine with the same test, right button is bugged.

Btw testing your sample file  track info + seekbar + buttons.js-  (which comes with 1.6.1) I had this error just after setting it:
Code: [Select]
Error: Spider Monkey Panel v1.6.1 (Playlist Manager: Track Info + Seekbar + Buttons by marc2003)
DrawImage failed:
GdiPlus error: DrawImage failed with error (0xb): ValueOverflow

File: helpers.js
Line: 175, Column: 6
Stack trace:
  _drawImage@helpers.js:175:6
  on_paint@track info + seekbar + buttons.js:62:4

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1126
Suggestion that has possibly been considered and rejected, sorry:
If and when when there is a new version: Put the github URL (like "https://github.com/TheQwertiest/foo_spider_monkey_panel/releases/") in the component's "about", making it easier to find.
Last two months' worth of foobar2000.org ad revenue has been donated to support war refugees from Ukraine: https://www.foobar2000.org/

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1127
i'm trying to start with SMP. I wantb to use some other components which are relying on SMP

I've installed the SMP component.It's showing up in the components list.
But then the tool relying on SMP asks "to load the .js into SMP

Sorry for this stupid question, but i haven't found where ni can load something into....

Please tell me where this load function is located

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1128
SMP stands for Spider Monkey Panel. So you first have to create a SMP panel in your foobar UI. How to create a panel depends on which of the two UIs, which are available in foobar (Default UI - DUI or Columns UI - CUI), you are using (not going into details here).
As soon as you have created a SMP panel, load the respective js file with clicking on the SMP panel, which opens the editor, then select file/import...

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1129
thank you for your answer. My foobar tells me, that i only have default user interface active.
It's still over my head. Can you provide some walk through / how to links, which help me to start with this?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1130
Check the installation section within the attached PDF. Default UI or CUI are both the same when editing the layout via 'Live editing'.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1131
thanks, that was helpful

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1132
I might have found a bug or at least an unwanted side effect, but it also could be my own fault.
It seems as if when the JavaScript thread is blocked by something synchronous then some keyboard actions in the F2K GUI don't register even though they are interactible with the mouse.
In my example, i can't press Enter on the "Move to" dialogue to confirm the "Run" button while the SMP component i have is waiting for a WScript.Shell.Run call. I'm running a modified version of marc2k3's spectrogram, the main source code is here: https://gist.github.com/FunctionDJ/914b3066d1ab368c1fd1a62b4e13f55f

As soon as the thread is unblocked (the call finishes and the spectrogram is shown) pressing Enter works again. What surprises me is that everything else about the GUI seems to work fine, like using the mouse to press "Run".
When i use a different SMP component, this issue goes away. Any ideas on why these are correllated?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1133
I also have a question: How can i get a FbMetadbHandle from a file path? How can i load the file? From the generated JS doc file it looks like we're not supposed to instantiate FbMetadbHandle ourselves, since the path property is annotated as read-only and not a constructor argument.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1134
So the file is not in the library or any playlist?? You could use fb.GetQueryItems() with the %path% if it was.

Failing that, you'll have to load files to a temp playlist with plman.AddLocations (takes an array of strings which can be paths/urls/playlists etc)

JScript Panel users have an additional fb.AddLocationsAsync which does the same thing as plman.AddLocations but sends the handles to a callback (on_locations_added).

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1135
Thanks a lot marc! Good to know! Yeah i meant for files that are not in the library.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1136
I have another question (of course, it never stops, i'm so sorry  :-[ )
When i use fb.RunContextCommandWithMetadb("Play", track) it sometimes just doesn't work and the function also returns false.
marc told me that the returned value of RunContextCommandWithMetadb indicates wether the command exists or not.
So am i using it wrong? The object i'm passing as the second parameter is always a handle of a single file. Why does it sometimes work and sometimes doesn't (returns true or false)?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1137
The function walks over all the commands for a given selection and keeps going until it finds a text match. That's why the return value is true/false based on that.

The component itself is not responsible for the commands that are provided.

This snippet will give the exact same commands for a given handle list so the command/naming must be an exact match for what you see here...

Code: [Select]
var HANDLE_LIST = fb.GetLibraryItems();

function on_mouse_lbtn_up(x, y) {
var menu = window.CreatePopupMenu();
var context = fb.CreateContextMenuManager();
   
    context.InitContext(HANDLE_LIST);
    context.BuildMenu(menu, 1);

var idx = menu.TrackPopupMenu(x, y);
if (idx > 0) {
context.ExecuteByID(idx - 1);
}
}

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1138
The function walks over all the commands for a given selection and keeps going until it finds a text match. That's why the return value is true/false based on that.
[...]

I don't know why or how, but when playing around with the ContextMenuManager and MenuObject it just seemed to fix itself without me actually changing the logic of the playback. Maybe it was also checking and unchecking the "Play" entry in the F2K context menu settings, i'm not sure why it only worked sometimes before and now it works regardless of that setting...
Anyway, thanks a lot - again - for telling me how these APIs work, i learned a lot!

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1139
Btw.... I have been checking it too and noticed a weird thing.
"Play" is NOT available on the contextual menu on playlist items. I double checked and it's enabled on the preferences panel (CUI).
But it's available on the album list panel, whenever you select a single track, but not on multiple selection.

Don't understand the logic behind that behavior, but that may account for the thing you are experiencing... since the entry does not exist in some cases.

PD: even if the entry is hidden, it should work with the proper flag, no matter your preferences.
https://theqwertiest.github.io/foo_spider_monkey_panel/assets/generated_files/docs/html/fb.html#.RunContextCommand

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1140
Very interesting regor!

I wanted to share what i made with SMP: A faster delete command (on my computer at least).
Source code: https://gist.github.com/FunctionDJ/47e37ea673ef3fd22279ee17bec13168
When i use F2K normally and i'm deleting tracks while playing them, it can take a few seconds until F2K has figured everything out, deletes the track, and moves playback to the next track. This wait time is absent when none of the selected tracks are being played back.
Also if i'm deleting the currently playing track (A) and the next track (B) F2K will show an error that it can't read file B because that would be next after A gets deleted.
This script works around these issues by figuring out the next track in the playlist that won't be deleted before deletion is attempted and moves the playback to that track, or stopping the playback if there is no next track that won't be deleted.
With this my workflow of going through my library and deleting stuff after listening to it is sped up a lot.
The speed issue might not exist on other people's machines, but at least the error i described should be reproducible, so if anyone would like to try out this script, please let me know what you think!

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1141
"Play" is NOT available on the contextual menu on playlist items.

There are 3 internal SDK methods for generating context menu items. The issue is explained in point 3.

Here's a snippet of C++ and the direct relationship with SMP methods....

Quote
auto ptr = contextmenu_manager::get();

// 1)
// fb.RunContextCommand(command) and ContextMenuManager InitNowPlaying
// both use this internally so there should be direct correlation between
// behaviour
ptr->init_context_now_playing(contextmenu_manager::flag_view_full);

// 2)
// fb.RunContextCommandWithMetadb(command, handle_or_handle_list) and ContextMenuManager InitContext(handle_list
// both use this internally so there should be direct correlation between
// behaviour. "Play" should be available when the handle list count is 1.
// Album list and any other library viewer should be using this
ptr->init_context(handles, contextmenu_manager::flag_view_full);

// 3)
// Only ContextMenuManager InitContextPlaylist uses this internally - also the same as any proper
// playlist uses. This should be the reason for the difference between album list and playlists.
ptr->init_context_playlist(contextmenu_manager::flag_view_full);

edit: it's possible there are javascript-y playlists out there unaware of InitContextPlaylist and may be using plman.GetPlaylistSelectedItems and passing the result to InitContext. How confusing!

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1142

EDIT... Never mind, I figured it out. I tried gr.DrawString before and it didn't work but that's because I accidentally typed gr.GdiDrawString. Oops.

Question... I'm using a small Scroll Text script and I can't get RGBA to work using gr.GdiDrawText. Only RGB works. Does RGBA not work with gr.GdiDrawText? Is there a work around? I of course have the following at the top:
Quote
// ----- CREATE RGB(A) -------------------------------
function RGBA(r, g, b, a) {
   return ((a << 24) | (r << 16) | (g << 8) | (b));
}

function RGB(r, g, b) {
   return (0xff000000 | (r << 16) | (g << 8) | (b));
}
// ---------------------------------------------------

No smiley faces of course.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1143
Version: 1.6.0

  • Added WIC support in image and art loaders, which enables WebP support (see FAQ for more info).


I'm running FB 1.6.10, SMP 1.6.1 with Wilb's Bio panel 1.2.

Webp files do not display, so I'm wondering:
Are they indeed supported in the 1.6.1 hotfix?
Do panel scripts need to be explicitly updated to support?
Does anyone see webp files in SMP?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1144
Scripts that display images from given folders will need updating. As an example, the included thumbs script would need editing here...

https://github.com/TheQwertiest/smp_2003/blob/abe16d3095544982ae3bc12ae99e1e041e63d7b2/js/thumbs.js#L573

Searching WilB's scripts for jpg might give you a clue as to what you'll need to edit.

Album art scripts that use the built in album art methods don't need updating as such. You just need to make sure the main preferences are updated (File>Preferences>Display>Album art)


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1146
hi, I've got a question about tooltips, I was wondering what the best way of having different tooltips appear in a window based on where the mouse is (or specifically which element the mouse is currently over)? I've been working on a very rudimentary track properties box to fit my theme, and I can add a general tooltip, but I can't quite figure out how to capture the current mouse position to use to change what the tooltip actually says, I'd be grateful of any advice.  :)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1147
A small update: support for all of my component is on-hold, since I have to spend most of my free time to resolve IRL issues caused by a certain February event. ETA of development restart is autumn (if everything works out).

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1148
@TheQwertiest
Nice to know you intend to carry on supporting/developing this component.