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

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1175
I can confirm that drag and drop does not work with v1.6.2 dev.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1176
Hi, I use spider monkey panel with library tree from WilB...,
in the top panel you see the albums and samplers with songs from elton john based on the filter:

artist IS $nowplaying{$meta(artist,0)}

is there a chance to display also the albums of the second or third etc. artist. In the example I want see albums from kiki dee?

Thanks Frank




Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1177
Hi! Got Top Panel crashes on launch. Use SMP with CaTRoX_QWR v.5 on FB2K 2 beta9

Quote
"Error: Spider Monkey Panel v1.6.1 (Top Panel: CaTRoX: Top bar v5.0.0 by TheQwertiest)
IsMainMenuCommandChecked failed:
Unknown menu command: View/Visualizations/Video

File: main.js
Line: 438, Column: 41
Stack trace:
  TopPanel@main.js:438:41
  @main.js:31:17"


UPD.
Solved

It turns out that this problem is solved simply and very banal. This error is related to the foo_youtube plugin, or rather to its settings. In case someone also encounters the same error on this build - after installing the foo_youtube plugin in the settings, set the default English language

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1178
foobar2000 V2.0 beta, Playback Statistics functionality is now built-in.
The foo_playcount mode is disabled in the sample Rating script in Spider Monkey Panel.
How to fix it?

foobar2000 32bit V2.0 beta 9
Spider monkey panel v1.6.1

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1179
Browse inside the component folder \ samples \ complete \ js

and open rating.js in notepad.

Edit the highlighted line...

https://github.com/TheQwertiest/smp_2003/blob/abe16d3095544982ae3bc12ae99e1e041e63d7b2/js/rating.js#L145

to become

Code: [Select]
this.foo_playcount = true;

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1180
Thanks for your answer!
Now it works well!

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1181
I found a font that display Asian and Western characters to use inside  wine (WenQuanYi Micro Hei) .
but I didn¡t find a way to make the samples that SMP include to use it.

To make

and

looks like


Also would be cool changing the tags splitter in the bio panel (the ugly squares)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1182
You should create a .fonts folder inside your $HOME folder. Stick .ttf fonts in there. And the included samples inherit from DUI/CUI preferences so you'd have to set the font there. If you don't want that then you'd have to edit the script here...

https://github.com/TheQwertiest/smp_2003/blob/abe16d3095544982ae3bc12ae99e1e041e63d7b2/js/panel.js#L32L39

You could remove the entire highlighted section and just have

Code: [Select]
const name = "Blah"; //replace with whatever, don't include .ttf

---

Pretty sure the bio script wants FontAwesome (as do most included samples)


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1183
Perfect. That do the trick.
The font was already in place and recognize and used in other instances of foobar. The problem was that I didn't know how to change the sampler's font.


With the Bio and Library Tree I changed them in the properties option. It has separates entries for general, headers, etc. I changed the Segoe UI parts and leave the FontAwesome ones as is. The only problem I found is the separator between genre tags in the headers. Display well with SegoeUI but with others fonts show squares. Sometimes the "-" part and with other fonts a space between the tag and the "-". Could be unicode characters?. Maybe I might ask  Wil-B about his topic.

Anyway this a minor glitch, the important part is that now my foobar can show asian characters in all instances instead of ugly squares.

Thank you



Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1184
The solution was easy...find another font.

Arial Unicode MS display asian characters and the correct ones in bio panel.



Rating stars



and rare characters




Not the best looking font, but fully functional.




Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1187
Hi,

I need a little help for a script which try to open a jpg file from foobar.

Here is the script below. First it creates a jpg file of the cover of the playing song (so you need to play a song with an existing cover before executing my example). Then it try to open it using a WScript.shell. It's supposed to run the default program for displaying jpg. It works on my computer, using windows 10, but it doesn't always work on windows 11.

If someone know a more robust approach in order to do the same thing, I would appreciate. Thanks!

Code: [Select]
var img = utils.GetAlbumArtV2(fb.GetNowPlaying(), 0, false);
var filepath = fb.ProfilePath+"\\original_size.jpg";
img.SaveAs(filepath, "image/jpeg");
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("\"" + filepath + "\"", 0);

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1188
It's entirely up to each user to set a default app for opening jpg (or any other) files. On clean installs, the user is usually prompted the first time they try and open a file from Explorer. Once that is done, the script should succeed.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1189
It's entirely up to each user to set a default app for opening jpg (or any other) files. On clean installs, the user is usually prompted the first time they try and open a file from Explorer. Once that is done, the script should succeed.
I don't think it's the right explanation. I just tried on windows 10 to unset the default app for .jpg, and the script then crashed, saying "unfound app"
One user reported that nothing happens on windows 11 on his side, no error message, just nothing

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1190
I'd wrap all WshShell.Run calls in try/catch just to be safe.

The album art sample bundled with SMP uses it. Double click the panel to test. It will silently fail if no application is associated with the image type.

As for the person with the problem, did they associate a .jpg file with Explorer? If it doesn't work, right click a jpg>Open with



Make sure to check that box.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1191
Yep, I just looked at this album art sample, and it uses the same kind of code that my script. I didn't use try/catch there for testing purpose.
I'll ask some more testing to this guy, thanks marc

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1192
The issue was the intWindowStyle argument of the WshShell.Run method, it was set to 0, and removing it fixed it. Don't know exactly why it doesn't support an intWindowStyle set to 0, but whatever

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1193
Must admit, I totally missed that in your original post. It's expected as that hides the window. You use 0 when you want to run command line apps without a window popping up like my helper here...

https://github.com/TheQwertiest/smp_2003/blob/master/js/helpers.js#L495-L500

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1194
Well since the docs/wiki for framework was not done, seeing what marc did with it's component page, I created 2 for all my SMP scripts.

Scripts for final users
Frameworks:


And... there is a new script named ListenBrainz-SMP, wip, which can be tested by anyone who wants: (*)
https://regorxxx.github.io/foobar2000-SMP.github.io/scripts/listenbrainz-smp/
Essentially uses the ListenBrainz account to retrieve site-wide or user top tracks by a time range, allows to love/hate tracks and finally create playlists with the tracks recommended to the user by ListenBrainz . Requires an user token.

Note I also added full playlist syncing with ListenBrainz on the Playlist Manager script, with content resolution (similar to XSPF playlists), so almost every feature of ListenBrainz is now integrated in foobar2000 with both scripts. Listen syncing requires the foo_listenbrainz2 plugin (and I don't plan to substitute it).

Finally I plan to create another script to notify about new releases for rtists on library. This is trivial with MusicBrainz integration and requires no account. Similar to this, fully automated and configurable by release (album, live, single, ...) and allowing blacklisting / whitelisting.
https://www.musicbutler.io/#top
https://www.whathifi.com/news/spotifys-whats-new-feature-alerts-you-to-new-releases-from-your-favourite-artists

(*) In such case, first update all my other scripts from repository, not the releases. Then install the ListenBrainz script. Otherwise just test it in a new portable install.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1195
hi! i have a couple of questions:

- how do i run a command and read the stdout? i found the WScript.Exec command which surprisingly works, but it always briefly opens a console window when i run ffmpeg, which is annoying. there doesn't seem to be a flag for it like there is for WScript.Run. i'm using ffmpeg to calculate an audio-only hash of files.

- i asked in a new thread about the differences between SpiderMonkeyPanel and JScript 3, the thread probably drowned and i should have asked in this thread in the first place.

thanks a lot! :)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1196
hi! i have a couple of questions:

- how do i run a command and read the stdout? i found the WScript.Exec command which surprisingly works, but it always briefly opens a console window when i run ffmpeg, which is annoying. there doesn't seem to be a flag for it like there is for WScript.Run. i'm using ffmpeg to calculate an audio-only hash of files.

- i asked in a new thread about the differences between SpiderMonkeyPanel and JScript 3, the thread probably drowned and i should have asked in this thread in the first place.

thanks a lot! :)
You can send command output to a txt file and then read the file with SMP.

You can start an executable in a hidden window btw, but just ussing run command. Why do you want to use Exec?

But there is no further interaction between the command line and SMP.

Code: [Select]
const WshShell = new ActiveXObject('WScript.Shell');

function _runHidden() {
try {
WshShell.Run([...arguments].map((arg) => {return '"' + arg + '"';}).join(' '), 0, true);
return true;
} catch (e) {
return false;
}
}

//_runHidden(folders.xxx + 'helpers-external\\fpcalc\\fpcalc.bat', filePath, fpcalcJSON, folders.xxx + 'helpers-external\\fpcalc\\fpcalc.exe');

fpcalc.bat
Code: [Select]
@ECHO OFF
REM Helper to execute fpcalc.exe (%3) on input (%1) and save output to file (%2)
REM Retrieves raw fingerprint as json
%fpPath% -raw -json -length 240 %1>%2

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1197
You can send command output to a txt file and then read the file with SMP. You can start an exec in a hidden window btw.

But there is no further interaction between the command line and SMP.
I could do that but that would be a filesystem roundtrip that I'd really like to avoid. It shouldn't be necessary and it actually isn't, though as i said the problem with the following solution (TypeScript) is that it spawns a console window briefly.
Code: [Select]
// ./utils/shell.ts

interface Stream {
ReadAll(): string;
}

interface ExecObject {
Status: 0 | 1 | 2;
ProcesID: any;
ExitCode: any;
StdOut: Stream;
StdErr: Stream;
}

interface Shell extends ActiveXObject {
Run(command: string, intWindowStyle: number, waitOnReturn: boolean): number;
Exec(command: string): ExecObject;
}

const shell = new ActiveXObject("WScript.Shell") as Shell;

export const exec = (command: string): Promise<string> => {
const execObj = shell.Exec(command);

return new Promise((res, rej) => {
const intervalID = setInterval(() => {
if (execObj.Status === 2) {
rej(execObj.StdErr.ReadAll());
clearInterval(intervalID);
}

if (execObj.Status === 1) {
res(execObj.StdOut.ReadAll());
clearInterval(intervalID);
}

// do nothing
}, 1);
});
};

// usage
import * as shell from "./utils/shell.ts"

shell
.exec(`ffmpeg -i "${metaDB.Path}" -vn -loglevel 0 -f md5 -`)
.then((stuff) => console.log(stuff));

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1198
If you insist on using Exec, try this (obviously window will be shown and there is no way around that):
Code: [Select]
"use strict";
const WshShell = new ActiveXObject('WScript.Shell');
const WshRunning = 0;
const WshFinished = 1;
const WshFailed = 2;
const command = "ping.exe 127.0.0.1"

const obj = WshShell.Exec(command);

const check = setInterval((obj) => {
    let output;
    switch (obj.Status) {
       case WshFinished: {output = obj.StdOut.ReadAll(); break;}
       case WshFailed: {output = obj.StdErr.ReadAll(); break;}
       default: {/*Nothing;*/}
    }
    if (output) {
        clearInterval(check);
        console.log(output);
    }
}, 100, obj);

EDIT: Ups, sorry, didn't saw your post @Function. Similar solution XD, but there you got it in plain JS.

No, there is no workaround to the console showing.

Unless you want to try with bat files or using START command to create another hidden window?
Maybe one of those third party execs out there able to span a process without a console window? Have no idea.

The run approach lets you do it, although I agree it's dirtier. A workaround probably requires a new SMP method, the same than marc implemented a method to run commands on CMD + callback.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1199
No, there is no workaround to the console showing. Unless you want to try with bat files or using START command to create another hidden window? Maybe one of those third party execs out there able to span a process without a console window? Have no idea. The run approach lets you do it.
That's unfortunate. Since the console window is annoying, i'll go with the Shell.Run() solution for now. Maybe TheQwertiest has a tipp or solution? 👀
Anyway, thanks for the reply Regor.