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

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #700
Well, off the top of my head:
- Package is installed and unpacked automatically either via `Import` button or just by drug-n-dropping. So users don't need to know the "correct" location (or the correct folder structure).
- Packages has persistent id, meaning that the path to package content is always persistent and can be relied upon (e.g. by other packages).
- User can easily switch between packages in a single panel without needing to copy-paste script content anywhere.
- Same package can be reused in multiple panels (again, without needing to copy-paste script content).
Okay, so drag-n-drop is a neat feature. For that should it be a .zip file that has the package.json at the root level, or does it need to include the GUID folder as well? For upgrades, dropping/installing an updated package will overwrite the original contents I assume?

Edit: I did a bunch of tests and I can't figure out how to create a zip file package that can be installed correctly. I copied your package to a new location, changed the GUID and then zipped it up and attempted to import. Getting this error whatever basically whatever I do:
copy: The system cannot find the path specified.: "D:\Source\foobar2000_portable\foo_spider_monkey_panel\tmp\unpacked_package", "D:\Source\foobar2000_portable\foo_spider_monkey_panel\packages\{AAAAFFEF-C88A-4849-94D5-F33C71649927}"

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #701
Okay, so drag-n-drop is a neat feature. For that should it be a .zip file that has the package.json at the root level, or does it need to include the GUID folder as well? For upgrades, dropping/installing an updated package will overwrite the original contents I assume?
To create a package click "New Package" in package manager: this will create all the necessary files for the package (and this is the only proper way to create one).
To pack a package into an archive of importable format click "Export" in package manager.
Package id is used to identify a package, so importing a package with the same id will replace the current package.

What if I have 5 panels ?
You'll have to split it in at least 5 packages =)
Drag-n-drop package import support batch import as well.
Thus the whole theme could be reduced to N script packages and a .fcl file. And it's installation might be done as follows:
- User installs all the required packages (via drag-n-drop).
- User imports theme's .fcl (via fb2k preferences).

Note: common theme stuff can be extracted to a separate `utility` package, the one that does nothing, but is accessed via `utils.GetPackagePath()` from other packages.

Any file can be drag-n-dropped to the `Package files` control on package tab and it will automatically copied in a proper place. Note though, that folders are always put in `assets` folder (even if they contain only scripts), thus they have to be moved to the `scripts` folder manually.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #702
Thanks, that makes sense. So from my tests, when I update a package the entire contents of the package folder are wiped, and then the new package is extracted there.

I've been creating a config.json file with my theme so that users can non-destructively make changes for title-formatting strings without having to touch the actual code so that updates don't overwrite their changes. Seems like for me to make this work I'd need to store these config files in a different location outside the package itself. fb.ProfilePath maybe? I've also got some other assets that users tend to add their own things to so either I need to continue to use a centralized Georgia folder outside the package or maybe just continue doing things the way I've been doing them. Need to think about this a bit more.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #703
Version: 1.4.1
Link: https://github.com/TheQwertiest/foo_spider_monkey_panel/releases/tag/v1.4.1
Changelog:
Hotfix for v1.4.0 (see changelog above)
Spoiler (click to show/hide)
Detailed description of API changes: https://theqwertiest.github.io/foo_spider_monkey_panel/docs/script_documentation/api_changes/#v141

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #704
Hello, I'm experiencing a conflict between assorted SMP scripts and a setup that uses a high DPI scaling override(to make fb2k usable on large/high res screens). I'm not sure if this is more an issue with SMP or with windows, but as far as I've seen so far, SMP elements are the only ones so specifically affected so I thought to mention it here. It's not new to 1.4/1.4.1.

In a nutshell if you have:

-Win10 display settings set to use a scaling factor of >100%

-Foobar2000.exe set to override that scaling factor using "System (enhanced)" (foobar2000.exe ->properties->compatibility->change high DPI settings->High DPI scaling override)

Then a number of elements are prone to getting white box artifacts, for example the bottom bar in the StrigUI2.0 theme looks like this after any of the buttons have been moused over (or things like the timer and the non-waveform seekbar incur it passively), and the white boxes persist until something is clicked. Similar white boxing happens to the biography panel by WilB, and the scrollbars in JS Playlist.

By comparison, using "System" instead of "system (enhanced)" does not cause these issues, but it does leave all the text in fb2k in an undesirable blurry state (as of yet I've found no other combination of windows settings that fixes this without otherwise distorted the UI to an unusable state). On my current setup (using a 4k tv as a monitor) it is necessary to use one of these or the UI will be severely distorted (and the global scaling factor is subjectively necessary to use the setup at all). This also seems to not be a driver related issue a the same thing happens on an Nvidia 2070 Super as an Intel integrated graphics build.

Somewhat related, the sample script at samples/complete/last.fm bio.js is badly rendered in such setups because the font size comes out giant even at the smallest settings.

Unrelated to these scaling related issues, I also just thought to report that 1.4 and 1.4.1 seem to break the Last.fm panel included in StrigUI2.0 with the following error message (I am not personally using/signed into this panel but I noticed it crashing while loading themes investigating the scaling issues):

this.xmlhttp is undefined

File: _LastFM.js
Line: 504, Column: 6
Stack trace:
  lfm_parse_data@_LastFM.js:504:6
  _lastfm/this.get/lastfm_xmlhttp[id].onreadystatechange@_LastFM.js:690:5

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #705
@JoeSyr , SMP does not handle DPI scaling in any way, i.e. everything is implemented (or not) by script authors. Since I don't have a high-DPI display, I don't even try to implement it in any of the scripts.
PS: Some `sample` panels do have DPI scaling code though, all thanks to marc2003 =)

Regarding StrigUI2.0 errors: this script was made by SMP user and is not a part of SMP installation, so you'll have to either request the author of the script for the fix or to fix it yourself. But it seems like a site parsing error, so perhaps last.fm changed the site structure at one point of time, which made the corresponding parsing code incompatible.

PS: It was working in previous SMP versions, because these kind of errors were suppressed before, because of the JS engine limitations (which was rectified in 1.4.0).

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #706
I see, thanks for the insights. I'll give things a spin to see if I can possibly adapt some of marc2003's scripts for my own usage.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #707
Somewhat related, the sample script at samples/complete/last.fm bio.js is badly rendered in such setups because the font size comes out giant even at the smallest settings.

Well this is supposed to one of the scripts with DPI support!!

All I can is that it works fine here but there are caveats:

-because the DPI is read from the registry, any desktop DPI changes means you have to log out and log back in again. It's not enough to restart the application.
-only the primary monitor can be queried. multi-monitor setups with differing DPI settings per monitor are not going to play nice.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #708
Whereas the GdiDrawText() method uses "segoe ui" as a fallback font for missing "segoe mdl2 assets" characters, DrawString() replaces them with empty squares. Is this a limitation of DrawString(), or am I missing something?
I'm late

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #709
I think there is an error in the documentation for IDE integration (https://theqwertiest.github.io/foo_spider_monkey_panel/docs/script_documentation/ide_integration/)

The entry under Visual Studio Code:
/// <reference path="./../../user-components/foo_spider_monkey_panel/docs/js/foo_spider_monkey_panel.js">

Should have a forward slash towards the end as below:
/// <reference path="./../../user-components/foo_spider_monkey_panel/docs/js/foo_spider_monkey_panel.js"/>

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #710
Whereas the GdiDrawText() method uses "segoe ui" as a fallback font for missing "segoe mdl2 assets" characters, DrawString() replaces them with empty squares. Is this a limitation of DrawString(), or am I missing something?

I can't be bothered to trawl the source code so I'm going to assume SMP hasn't deviated from the original WSH/JSP code where font objects have to store 2 different types of WinAPI fonts internally. Those are HFONT and Gdiplus::Font.

GdiDrawText uses HFONT and IIRC you get Arial if the font you ask for is missing
DrawString uses Gdiplus::Font and you get Microsoft Sans Serif if the font you ask for is missing

When you check the properties of any font object in JS (.Name, .Size, .Style), the internal Gdiplus::Font is queried, not the HFONT.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #711
...I'm going to assume SMP hasn't deviated from the original WSH/JSP code where font objects have to store 2 different types of WinAPI fonts internally. Those are HFONT and Gdiplus::Font.

JSP behaves in the same way, so I guess your assumption is correct.


DrawString uses Gdiplus::Font and you get Microsoft Sans Serif if the font you ask for is missing

Yes, if the whole font is missing, it is replaced with the fallback font, but if the font exists, missing glyphs are replaced with a □. GdiDrawText replaces them with the corresponding fallback font glyph, instead.
I'm late


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #713
Since that font is for symbols only, why don't you limit yourself to what is actually there?

Yes, I suppose that's the proper way to go. The idea of relying on the fallback font arises from the need to simplify a few graphical issues when drawing captions (buttons, headers, etc.) with both an icon and a text label. Since I set their dimensions with relative values, based on MeasureStringInfo properties, dealing with just one font makes things easier. With "segoe ui symbol" this was not a problem, because the font provides all the regular "segoe ui" characters. When I moved to "segoe mdl2 assets", which I like better and has many more fonticons, I didn't even realize this was an issue because I was always using GdiDrawText (I actually did mistake the "arial" fallback font for "segoe ui"). Now I made some changes in the scripts, which require using DrawString, though, and here I am.

It's not really a coding problem in a strict sense, I just wanted to make sure I was not overlooking some options available to make DrawString behave like GdiDrawText in this regard, but the more I think about it and the less I like the idea of relying on a fallback font anyway.
I'm late

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #714
In 1.4.1 if I set Script source as file, and then select a file everything works. But when I restart foobar my file selection has lost everything except for what appears to be fb.profilePath. So no file is selected and I get an error and am forced to reselect the file. Interestingly when I go back into the file selection dialog it does remember the full path to the file I had last selected.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #715
In 1.4.1 if I set Script source as file, and then select a file everything works. But when I restart foobar my file selection has lost everything except for what appears to be fb.profilePath. So no file is selected and I get an error and am forced to reselect the file. Interestingly when I go back into the file selection dialog it does remember the full path to the file I had last selected.
Can you provide the full path to file you are trying to use?

And can you try the latest dev build and see if it has the same error?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #716
Can you provide the full path to file you are trying to use?

And can you try the latest dev build and see if it has the same error?
Full path is: D:\Source\foobar2000_portable\georgia\georgia-theme.js

Still seeing the same thing in 1.4.2-dev


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #718
Hm... Still can't reproduce...
Can you try the following custom build?
https://ci.appveyor.com/api/buildjobs/dmess6a7ifkhdl12/artifacts/_result%2FWin32_Release%2Ffoo_spider_monkey_panel.fb2k-component
No joy. I tried this on a non-portable installation and everything worked fine. Can't tell if that's the issue, if it's another component (UIHacks?) or if something just got in a bad state when I was experimenting with packages and now it can't get out.

Edit: I completely removed FSM including the packages folders, then reinstalled and the path seems to survive through restarts now. I guess that's good enough for me.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #719
Okay, I figured out what the issue is. I have a single georgia folder which I use for development and then I drop junction links in my foobar folders so they all always have the same content. Paths inside the junctions are not saved, but if i point directly to the folder not using a link, things work.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #720
I'm having one last issue regarding relative paths and include. From the documentation it seems that if my Script source is a file, then passing a relative path to include should load files correctly, but this does not seem to be the case. I just get "Path does not point to a valid file: js\CaTRoX_QWR\lodash.min.js" when I pass a relative path from where the theme file is loaded.

i.e. I'm loading georgia-theme.js from georgia\ and that folder also contains a js\CaTRoX_QWR sub folders as well but it doesn't seem to be looking in that location.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #721
Hi, could you make the SMP playback stats feature optional as I feel like it's needlessly cluttering the properties window if not in use.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #722
Does someone know if there is a foobar controller (via Web or app) which does interact in some way with custom buttons, menus, etc?
The idea is to run smp scripts while using the controller, for example to create smart playlists. I know I could create a dummy playlist, and sending things to that playlist I could check with callbacks and run scripts but... is there any other way? (somewhat built in, obviously I know I could run menu entries using cmd commands on a local network)

Have tried these but they are limited to library management, playback or streaming
https://play.google.com/store/apps/details?id=com.cav.foobar2000controller&hl=es_GT
https://play.google.com/store/apps/details?id=com.foobar2000.foobar2000
https://hyperblast.org/beefweb/api/#/

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #723
Does someone know if there is a foobar controller (via Web or app) which does interact in some way with custom buttons, menus, etc?
The idea is to run smp scripts while using the controller, for example to create smart playlists. I know I could create a dummy playlist, and sending things to that playlist I could check with callbacks and run scripts but... is there any other way? (somewhat built in, obviously I know I could run menu entries using cmd commands on a local network)

Have tried these but they are limited to library management, playback or streaming
https://play.google.com/store/apps/details?id=com.cav.foobar2000controller&hl=es_GT
https://play.google.com/store/apps/details?id=com.foobar2000.foobar2000
https://hyperblast.org/beefweb/api/#/

There is no such app that I am aware of with such ready made interaction.
My only suggestion is using foo_httpcontrol and an app such as HTTP Request Shortcuts to send the request.

With foo_httpcontrol you can send a command line parameter to execute SMP main menu entries
https://bitbucket.org/oblikoamorale/foo_httpcontrol/wiki/Commands#markdown-header-cmdline

e.g "File / Spider Monkey Panel / 1"
http://localhost:8888/default?cmd=CmdLine&param1=/command:%221%22

In a SMP script create the code to be executed:
Code: [Select]
function on_main_menu(index) {
    switch (index) {
    case 1: // triggered when File>Spider Monkey Panel>1 is run
        fb.ShowPopupMessage("success");
        console.log("success");
        break;
    }
}

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #724
Thanks :) Yep, I was wondering if there was another way of doing it instead of http requests via another app.

That method is good enough for me, but not for the general public... I still find the dummy playlist route better for some use-cases though.
For example creating new playlists using a track as reference: using foobar web/app controllers involves only sending the desired track to that tracked playlist and then I can create a new playlist, change focus via script and automatically start playback as soon as anything is added. Using Http requests I can not point to a track previously selected on the controller app, but it works perfect for 'hardcoded' menu entries as you point.

I will consider a mix of both methods for my use-cases and the scripts I release then.

 
SimplePortal 1.0.0 RC1 © 2008-2021