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

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1350
Anyone knows how to automate this to download Reviews and Art Images for the entire library without going song by song?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1351
A small status update: I've managed to switch jobs and relocate to Netherlands, which should secure my livelihood for mid-term (and hopefully long-term as well). It will be a little hectic while I'm settling down, but after that I should have enough free time and (more importantly :) ) mental energy to work on my components (especially once I secure a proper workstation instead of my subpar-performance netbook).

Meanwhile, I was working a bit on v2 of SMP in the background. It's still far from ready, but I wanted to share a sneak-peek on some of it's features.

One of the main goals of v2 is to make SMP much friendlier for JS devs, both for those who have experience working with JS (e.g. NodeJS, web API) and for those who don't. This is achieved by replacing most(all?) ad-hoc solutions with standard or standard-like solutions:
- New NodeJS-like package format instead of ad-hoc packages.
- Module import/export support instead of `include`.
- API rewrite:
  - 'Modulerised' API: all API is now accessible through built-in modules.
  - WebAPI-like/NodeJS-like API: replaced old API with standard analogues. E.g. `Graphics` > CanvasAPI, static hardcoded event callbacks >`addEventListener` in corresponding objects, `FileSystemObject` and various file text APIs > nodejs fs module.
  - Async/off-thread methods where needed: in v1 some methods perform very CPU intensive operations, which blocks the main thread and makes UI unresponsive. Async methods instead return a Promise which will be resolved in the worker thread, thus removing the blocking.
  - Huge performance and memory consumption improvements.
  - Lots of new stuff that was not possible or available in the v1.
- TypeScript type bindings for SMP API.
- v1 compatibility mode.

Progress on v2 can be tracked via this ticket: https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/213

See ya all later and stay safe :)
Hopefully, the visualizations like spectrum analyzer are possible through a non-standard API (since implementing WebAudio API might be completely pointless for fb2k environment except as a separate DSP component that implement these nodes as DSPs, which foo_dsp_effect does similarly for some of them), just like on Wallpaper Engine with web wallpapers (which gets spectrum data for stereo channels), that gets waveform data (since I've used to custom FFTs) of any channels unlike getFloatTimeDomainData method of AnalyserNode

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1352
I made a change in JScommon.js  (line 975) for the Simple Playlist Manager sample and put the background image in the correct size.

Spoiler (click to show/hide)

Now I have to center it, does anyone know how to do it?





Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1353
I made a change in JScommon.js  (line 975) for the Simple Playlist Manager sample and put the background image in the correct size.

Spoiler (click to show/hide)

Now I have to center it, does anyone know how to do it?



Resoveled:

Spoiler (click to show/hide)


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1354

Can anyone, with some spare time on their hands, convert this JSPlaylist wallpaper script below so it can instead load already installed biography images? The images would come from a folder (say, Biography) with subfolders inside. Each subfolder would be the name of the Artist. So something like:

fb.ProfilePath + Biography + artist folder + artist jpg file

So an 'Abba' folder with 'Abba.jpg' inside.

Code: [Select]
// ===================================================== // Wallpaper

function setWallpaperImg(path, metadb) {
    var fmt_path = fb.TitleFormat(properties.wallpaperpath).Eval().replace(/^\.?\\/, fb.ProfilePath);
var fmt_path_arr = utils.Glob(fmt_path);
if (fmt_path_arr.length > 0) {
var final_path = fmt_path_arr[0];
} else {
var final_path = null;
}

if (metadb && properties.wallpapermode > -1) {
var tmp_img = utils.GetAlbumArtV2(metadb, properties.wallpapermode);
} else {
if (final_path) {
tmp_img = gdi.Image(final_path);
} else {
tmp_img = null;
}
}
if (!tmp_img) {
if (final_path) {
tmp_img = gdi.Image(final_path);
} else {
tmp_img = null;
}
}

p.wallpaperImg = null;
var img = FormatWallpaper(tmp_img, ww, wh, 2, 0, 0, "", true);
return img;
}

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1355
No doubt it's because I'm an idiot, but I'm having a hard time working out where to begin when it comes to using Spider Monkey Panel.

I haven't written anything in javascript before, although I suspect learning what I need to know won't be too hard once I know how to get started, as my needs are fairly simple. I want to create a GUI element that displays track/file information to replace the Text Display component. I'm after something similar to the included text display sample script, although I don't need any right click options aside from choosing to display the playing track or the selected one.

What I need at the moment is an example of the syntax required for a GUI element to have the same colors as the DUI, only with a different font, and an example of how to display fb2k's title formatting as text. Hopefully that'll be enough to get me started. If there's a Wiki or help file with the info I'm after I must be too silly to find it, however if that's the case I'd be grateful if someone would point me in the right direction.

Thanks

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1356
If someone knows a way to bypass this bug (since I don't expect and update soon), please let me know.
https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/225

Quote
function a() {
   const handleList =  plman.GetPlaylistItems(plman.PlayingPlaylist);
   const tags = fb.TitleFormat('$if($not(),1,0)').EvalWithMetadbs(handleList);
   console.log(tags);
}
a();

Should output all 1s. but as you can see it output 0s.

EDIT: It's a bug on $not implementation, but it can bypassed adding an argument to not, like $not("").
Thing is different components are applying TF expressions in a different way, giving different results.
https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/225#issuecomment-1819647388

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1357
What makes you blame Spider Monkey Panel? Pretty sure every single instance of title format code in all components is sent to the core to be processed, except Title Formatting Sandbox seems to do its own parsing and appears to break the function as its output doesn't match core results.

The evaluation you are testing is nonsense, The term "$not()" evaluates to nothing as it's missing a variable to not. Your code is functionally equal to "$if(,1,0)".

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1358
Case have you read at all my link? xd like... thanks for repeating the same I said.

The easiest and fatest way to test a TF code is using a sandbox, so one could expect a TF sandbox SHOULD apply TF properly. And the error only appeared on SMP, so that was my first option, obviously. I already stated on the link the bug is not on SMP (?), but the most logical reason was SMP (your own words "every single instance of title format code in all components is sent to the core to be processed", so if I applied that logic to a sandbox... then SMP was the culprit).

Now, saying "$not()" is nonsense (which worked fine on the sandbox)... well, that's your opinion. Let me show you the nonsense on TF:
Code: [Select]
[$ifequal(%RATING%,5,1$not(0),0$not(0))] // 1 or 0
[$ifequal(%RATING%,5,1,0)] // outputs nothing
X
I'm not the one who has coded TF that way, but please don't tell me doing $not() is ridiculous (it is not in any programming language), while $if functions don't output boolean values at all and require hacking $not, $and to output things::)  ::) I mean, maybe native TF doesn't allow $not(), but that's just a design decision, not nonsense.

Lets see more "nonsense" examples:
Code: [Select]
[$ifequal($ifequal(%RATING%,5,1,0),1,%date%,$add(%date%,1))] // 2018
[$ifequal($ifequal(%RATING%,1,1$not(0),0$not(0)),5,%date%,$add(%date%,1))] // 2019
$ifequal($ifequal(%RATING%,5,1,0),1,%date%,$add(%date%,1)) // 2018
$ifequal($ifequal(%RATING%,1,1$not(0),0$not(0)),5,%date%,$add(%date%,1)) // 2019
X

So there was a real reason to make use of $not() within $if functions, to follow the "nonsense" rules of TF. Now, if the sandbox is broken... great. xd And if I simply have to replace $not() with $not(""), so be it. But I don't see a reason to specify an argument when checking for false, it's totally non intuitive.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1359
You are missing the point. The "$not()" function can have its uses in logical operations, but it's used by giving it an argument that you want to negate for the test, like "$if($not(%artist%),No artist tag,Artist tag exists)".

Code: [Select]
[$ifequal(%RATING%,5,1$not(0),0$not(0))] // 1 or 0
[$ifequal(%RATING%,5,1,0)] // outputs nothing
The reason second line outputs nothing is because you are misusing the square brackets. They leave out the output if fields referenced inside are missing. It's meant for just tag fields so that you don't need to hide missing results with complex $if() functions. I think it's a bug that the output is affected by adding the $not() there. Anyway, the square brackets are not needed here as they have no missing tag field question marks to hide. The proper fix is to remove the square brackets and use just
Code: [Select]
$ifequal(%RATING%,5,1,0) // 1 or 0

[...]

Lets see more "nonsense" examples:
Code: [Select]
[$ifequal($ifequal(%RATING%,5,1,0),1,%date%,$add(%date%,1))] // 2018
[$ifequal($ifequal(%RATING%,1,1$not(0),0$not(0)),5,%date%,$add(%date%,1))] // 2019
$ifequal($ifequal(%RATING%,5,1,0),1,%date%,$add(%date%,1)) // 2018
$ifequal($ifequal(%RATING%,1,1$not(0),0$not(0)),5,%date%,$add(%date%,1)) // 2019
I think you made a mistake with your examples. The lines without $not() work logically just like they should. The lines with $not() are nonsensical. The inner $ifequal() returns either 0 or 1 and you compare it against 5 so it is never true.
Here too the square brackets are useless but fortunately don't affect anything.
But why do you have to write these in such complicated manner? The first variant can be simply written as
Code: [Select]
$ifequal(%RATING%,5,%date%,$add(%date%,1))
And it works exactly the same but is much easier to follow.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1360
Change line 132 to this

Code: [Select]
properties.background.value = utils.ColourPicker(window.ID, properties.background.value);

and line 136...

Code: [Select]
properties.text.value = utils.ColourPicker(window.ID, properties.text.value);

I'm using the ColourPicker like this, but I'd like to be able to set its starting value to that stored property. At present, it always opens set to (0, 0, 0). Can this be done?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1361
It was an error typing then. The example is part of a much bigger script, I obviously know there is a more simple way to do output the same thing of the example.

Quote
[...] (conditional section)

Evaluates the expression between [ and ]. If it has the truth value true, its string value and the truth value true are returned. Otherwise an empty string and false are returned.

Example: [%artist%] returns the value of the artist tag, if it exists. Otherwise it returns nothing, when artist would return "?".
Honest question. You say I'm misusing brackets, but the docs clearly states it works for expressions. (?)

And that is reflected by $not() or $and() affecting the brackets.

Otherwise how do you do this?
Code: [Select]
[$if([%RATING%],$not("")$ifequal(%RATING%,5,1,0),)s] // 1s, 0s, nothing
[$if([%RATING%],$not("")$ifequal(%RATING%,5,1,0),)$ifequal(%DATE%,2018,s,o)] // 1s, 0o, nothing

Code: [Select]
[$if([%RATING%],$ifequal(%RATING%,5,1,0),)s] // nothing
[$if([%RATING%],$ifequal(%RATING%,5,1,0),)$ifequal(%DATE%,2018,s,o)] // nothing

Code: [Select]
$if([%RATING%],$ifequal(%RATING%,5,1,0),)s // 1s, 0s, s
$if([%RATING%],$not("")$ifequal(%RATING%,5,1,0),)$ifequal(%DATE%,2018,s,o) // 1s, 0o, o

X

You could convert that to...
Code: [Select]
$if([%RATING%],$not("")$ifequal(%RATING%,5,1s,0s),) // 1s, 0s, nothing
$if([%RATING%],$ifequal(%RATING%,5,1$ifequal(%DATE%,2018,s,o),0$ifequal(%DATE%,2018,s,o)),)// 1s, 0o, nothing

In complex expressions, being able to conditionally evaluate an entire branch (and not a tag) greatly simplifies the usage

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1362
Change line 132 to this

Code: [Select]
properties.background.value = utils.ColourPicker(window.ID, properties.background.value);

and line 136...

Code: [Select]
properties.text.value = utils.ColourPicker(window.ID, properties.text.value);

I'm using the ColourPicker like this, but I'd like to be able to set its starting value to that stored property. At present, it always opens set to (0, 0, 0). Can this be done?

It's a bug.
https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/203
Use the version attached here:
https://github.com/regorxxx/Playlist-Manager-SMP/releases/tag/v0.9.0

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1363
Evaluates the expression between [ and ]. If it has the truth value true, its string value and the truth value true are returned. Otherwise an empty string and false are returned.
The wiki contains user-written content. That is not what official document says. Easy way to prove that square brackets don't return true value for evaluated expression: "$if([$ifequal(1,1,1,)],true,false)" will only return false. The result is false without square brackets too. They are meaningless when not producing output from tag fields.

The official document states
Quote
Discards contents of the bracket when no fields referenced inside are present. Commonly used to create parts of formatting scripts that are active only when relevant fields are found. Example: %artist% - [%album% / ]%title%

Otherwise how do you do this?
Code: [Select]
[$if([%RATING%],$not("")$ifequal(%RATING%,5,1,0),)s] // 1s, 0s, nothing
[$if([%RATING%],$not("")$ifequal(%RATING%,5,1,0),)$ifequal(%DATE%,2018,s,o)] // 1s, 0o, nothing

Using that syntax you would do it like this:
Code: [Select]
$if(%RATING%,$ifequal(%RATING%,5,1,0)s)) // 1s, 0s, nothing
$if(%RATING%,$ifequal(%RATING%,5,1,0)$ifequal(%DATE%,2018,s,o)) // 1s, 0o, nothing

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1364
What I need at the moment is an example of the syntax required for a GUI element to have the same colors as the DUI, only with a different font, and an example of how to display fb2k's title formatting as text.

You can use JScript Panel 3 and my included Text Display clone for this....

https://jscript-panel.github.io/gallery/text-display/

By default it always tracks UI colours and has its own $font function - easier than writing your own javascript. :P


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1365
Public Service Announcement

I just spent more time than I intended learning that using the vertical positioning flags—DT_VCENTER and DT_BOTTOM—with the GdiDrawText method will not actually position the text elsewhere than at the top unless one also adds another flag, DT_CALCRECT. So, do that, then. :)

The other vertical positioning flag, DT_TOP, is the default setting with a value of zero.

Perhaps those who actually know javascript or Windows GUI methods already know this, but I am not one of those.

Now, I shall resume utterly abusing the volume slider in status bar + volume.js. It seems to respond poorly to being maybe-kinda resized and repositioned as one jacks around with the font size of the text around it. I begin to doubt the wisdom of making the font and font size into properties customizable with the context menu, but, by gum, I'll find the way somehow.  :o

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1366
Is there a simple method (IE: plman...) to restore a removed playlist? I'd like to add that to JSPlaylist.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1367
Is there a simple method (IE: plman...) to restore a removed playlist? I'd like to add that to JSPlaylist.

Ah... I forgot FB2K natively can do this. It's been so long since I used the built in pm. So I think I can do it through the fb.RunMainMenuCommand.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1368
There is no main menu command to run unless you mean opening the built in playlist manager??

SMP (and other scripting components) have always been able to restore deleted playlists. You just need to read the docs. Look for recycler.

Re: Spider Monkey Panel (foo_spider_monkey_panel) Cant import packages

Reply #1369
Currently get an error everytime I try to import a package stating "Corrupted package: can't find `package.json`"

 I dont know if Im missing something ashmedly basic, or if something needs to be fixed.

Any help would be appreciated

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1370
Currently get an error everytime I try to import a package stating "Corrupted package: can't find `package.json`"

 I dont know if Im missing something ashmedly basic, or if something needs to be fixed.

Any help would be appreciated
Provide the package

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1371
Thanks for the assistance.

I've attempted to istall these packages (not both at the same time), and I get the same error with both.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1372
Those are not valid packages, not sure where you got them from...

Look at this one, which is valid. All the files are at the root, not a subfolder within the zip.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1373
I've attempted to istall these packages (not both at the same time), and I get the same error with both.
You have downloaded the git main branches from the github repository as zip instead of the releases. You need to follow the "Releases" link on the right side of the page and download the package from there.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #1374
You need to download another archive