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

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #725
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.
Could not reproduce your problem - I've tested with the following file structure:
Code: [Select]
fb2k_dir/
  folder/
    one.js
    sub1/
      sub2/
        two.js

one.js content:
Code: [Select]
include('sub1/sub2/two.js')

Are you sure you are not using junctions again? =)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #726
Are you sure you are not using junctions again? =)
I am (and don't knock junctions, they're awesome  :)) )

Okay, set this as the content of one.js and let's see if this is minimally reproducible for you:
Code: [Select]
function loadAsyncFile(filePath) {
    return new Promise(resolve => {
        setTimeout(() => {
            include(filePath);
            resolve();
        }, 1);
    })
}

const loadAsync = true; // works if false
async function includeFiles(fileList) {
    if (loadAsync) {
        for (let i = 0; i < fileList.length; i++) {
            await loadAsyncFile(fileList[i]);
        }
    } else {
        // this works
        fileList.forEach(filePath => include(filePath));
    }
}

includeFiles(['sub1/sub2/two.js']);

If I don't load with promises inside an await, everything is fine. Unfortunately as discussed months ago, if I don't load my theme using Promises, I get the "script is taking too long" popup when starting up foobar when my HDD isn't spinning.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #727
Not sure if this is the right thread so forgive me if that's the case.

I'm using Spider Monkey Panel and the Muzicbrainz discography script that comes with it.  It's great, but of course it requires the MUSICBRAINZ_ARTISTID tag to pull the info from Musicbrainz.  I've been diligently populating my files with that tag for the last few weeks until I realized I should probably be using Picard to do so instead.   However, apparently Picard populates the files with the tag "MUSICBRAINZ ARTISTID" (no underscore) instead of "MUSICBRAINZ_ARTISTID" that the script looks for.

Is there a way to have the script look for both versions of the tag, and use whichever is present?  (Or perhaps there's a way to change Picard's behavior?  Of  course this is the wrong thread for this latter solution...)  I'm open to any suggestions.

Thanks all.  Great work you've done with these features. <3



Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #729
Hope you reconsider the support for native playlists methods: (saving to given path without UI windows & loading directly to handle and not requiring an intermediate playlist being created on the UI)
https://hydrogenaud.io/index.php?topic=120394.msg994362#msg994362

For playlist manager:
Playlists with tons of tracks become totally unmanageable in m3u format (loading time), thus making the playlist manager functional only for auto-playlists and small standard playlist. Forcing to load them as read-only locked playlists, to rewrite them as m3u (loading time problem) or manually saving them via user intervention (making auto-updates useless). Also fpl playlist are the only one I can not check their size without loading them first on UI...

For Graph scripts:
A set of reference tracks could be saved to fpl playlists to be loaded later (via handles) as 'moods'. It seems natural to use native foobar format for that... and they could be integrated in the manager too (to allow direct user updating). Yep I could save 'tags' to json, but then they lose the point of being user configurable.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #730
Hope you reconsider the support for native playlists methods: (saving to given path without UI windows & loading directly to handle and not requiring an intermediate playlist being created on the UI)
https://hydrogenaud.io/index.php?topic=120394.msg994362#msg994362
So I've been only sorta paying attention to this discussion, but I don't really get what you're trying to accomplish with m3u/fpl playlists. You seem to be developing a script which generates playlists of songs with a similar "mood" and then what exactly are you trying to do with them? Why are you even trying to save them to arbitrary locations? Also, does foo-jesus not handle your auto-saving issues?

Maybe I'm wrong, but you seem to be trying to force foobar/SMP to behave in a way that is kind of outside its design.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #731
Obviously you have not understand it (?) I really feel like I have to explain my motivations to someone who has not spent any time reading the thread... with all due respect. And that's weird... Specially when my request are 2 basic things. Saving fpl playlists without an annoying UI window to give a path, and loading a fpl playlist without loading it into the playlists tabs first.

First, I have created a playlist manager. SMP allows to write/read files directly so I can create and load m3u, pls or m3u8 playlists via scripts. That means I can track a folder with playlists, load them on demand (instead of having them always loaded within foobar), autoupdate them, etc. Foobar currently only supports loading a playlist, and then playlists are saved to internal format to its profile folder, not to their original folder... They also get cryptic filenames, etc.  You can not filter playlists by name, by user-set tags/categories, sort them, lock them, show only autoplaylists, create autoplaylists and save them without having them on the UI (marc's script did that and it was clearly within SMP/foobar's scope), regenerate their size, assign playlists files to playlists within foobar and autosave changes, etc. My manager is just a generalization of that design.

Foo-jesus has nothing to do with a playlist manager. You have a library manager, which does the same things (searching, sorting, etc.), without needing to send tracks first to a playlist. A playlist manager does the same without needing to send playlist to the playlist tab (just using physical files). That's the main point. Many people have created library managers with SMP, was that outside SMP design?

The manager is fully functional right now. There is only 1 thing missing, foobar ironically doesn't have open fpl playlist support and SMP doesn't have any method to work with fpl playlist. You can not load a playlist to a handle list without loading it on the UI first, and you can not save a playlist to a path directly (like any other file).  Also, not having fpl support means all autosaving/updating features are disabled for them. Or they have to be rewritten to m3u8 format... but then when you load a playlists with 1K tracks as m3u8, it takes a full min. instead of seconds (when using fpl).

That means... a playlist manager thought to manage foobar playlists can manage anything but native playlists, a bit ironic.



Is like saying creating a theme is forcing SMP/foobar to behave in a way that is kind of outside its design. I don't really get your point, if you know what I mean ;) Specially when a playlist manager is something basic in a music player, and it has been done a dozen of times as plugin (but without all these features).

Second, the graph scripts... Again, it's fully functional and it has been since weeks XD I still don't get the point of trying SMP to behave in a way that is kind of outside its design. I'm not going to explain again what these scripts do since it's all in the thread, but essentially I have managed to create intelligent playlists the same than spotify/genius or any other online player does. Using open source offline data. And it can be configurable by artist, genre, style, moods, in key mixing, etc. What you do with those playlists is your problem XD I don't understand your questions.

Having SMP methods to load/write fpl playlists without UI intervention (which is clearly within design, since you already manage handle lists via scripts, and can load fpl playlists to UI) would allow the user to select 4 tracks, call them 'Happy mood' and then use that playlist or 'mood' as a set of references to create dynamic playlists similar to them.

It's my impression that makes more sense than selecting 4 tracks, saving their tags to a json file and doing all in a non transparent way. I mean... since 'moods' or these playlists are meant to be user configurable, It's obviously more easy for anyone to just load a playlist file, add/remove tracks and save it again. Instead of regenerating json  files, creating new menus, a new UI window to show the tracks currently on the 'mood' or virtual file, specific logic to add/remove tracks, etc. If the fpl is clearly a container for tracks, I don't see why using it as a container of tracks is outside its design. It's just a feature I would like to add (https://www.spicefly.com/article.php?page=musicip-moods) and being a thing which clearly needs things already implemented, needing just a native method to do it without UI intervention, would be much simpler than the json way...

Btw... since I have already create a playlist manager... If we had native methods to read/save fpl playlists, then I could track the folder with 'moods' and autosave any change done within foobar to those playlists. Therefore having the files always updated, apart from foobar's internal folder. Which again... serves another purpose. Since moods are playlist not meant to be always loaded on the UI, but just containers.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #732
With all due respect, I've read every single post in this thread. Yesterday I also went and reread all of your posts through the last 4 pages of this thread and every post in your linked thread. You are extremely verbose (and that's saying something coming from me!) and it can be very difficult to understand exactly what you're trying to do and what your issues are. I think what you're trying to do with the mood/similar playlists is really cool and interesting, but despite everything you wrote to me, I still don't understand why you need what you think you need.

From what I can tell you are:
Generating new playlists. Obviously no issues there.
You want to be able to save these playlists as .fpl's, but that's already the native format that SMP/fb2k saves playlists.
You want to be able to save these playlists on demand. I mentioned foo_jesus because it will force writing .fpls to disk.
You want to be able to save these playlists in arbitrary locations with arbitrary names. Why? Why does having them automatically saved in the Playlists-1.4 folder not work for you? The playlist already has an internal name that you give it.
You want to be able to read playlists from arbitrary locations without actually loading the playlist. This part I also don't think you've adequately explained.

Is the issue that you're wanting to generate hundreds/thousands of playlists and not incur a hit at startup? Is there even much of a performance hit with non-autoplaylists? I added 10 playlist with 7800 files each (all different since the playlist manager is smart about duplicate playlists) and my startup time was essentially exactly the same as the 2 seconds it was before I added them.

Is the issue that don't want the playlists to show up in foobar's playlist manager? In that case yeah, you're probably out of luck, but since you're creating your own playlist manager you could you easily use smart naming to filter out what you don't want to see, right? Again, maybe scale makes that impossible to do well. Only you know that.

What I see you asking for is the ability to write .fpls to a different location using a new SMP method, and then read from those locations without foobar itself loading the playlists (for reasons?) which I'd be surprised if the fb2k API even supports. Some of this you should probably make a pull-request for if you can figure out how to do it, or even develop your own playlist reading/writing component which you could then control through SMP. It seems pretty niche to me, and whenever I come to that realization I end up having to code it myself  ;D

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #733
Don't really get the point of discussing with you when TheQwertiest knows exactly which are the 'limitations' with  fb.SavePlaylist() and fb.AddLocations.... really, reread what you are writing...

Quote
You want to be able to save these playlists as .fpl's, but that's already the native format that SMP/fb2k saves playlists.
No. That's your interpretation.

Quote
You want to be able to save these playlists in arbitrary locations with arbitrary names. Why? Why does having them automatically saved in the Playlists-1.4 folder not work for you? The playlist already has an internal name that you give it.
That's the freakin point of a playlist manager lol. Instead of discussing the point, just create yourself 40 playlist within foobar. Now what, you have 40 playlist loaded always in the playlist tab? Why? Are you using the 40 playlist at the same time?

What was the point of marc's autoplaylist manager then?
https://github.com/TheQwertiest/smp_2003/blob/master/autoplaylists.js

Obviously you are clearly missing some people have tons of playlists and having them loaded for no reason, when they can be loaded on demand makes no sense. They clutter the UI and make searching for something really slow.

But please, do it. Create your 40 playlists and 40 autoplaylists and then tell me how they are being saved in foobar 1.4 like you said. And then tell me which file is linked to which playlist. And then tell me what happens when you have many autoplaylists at startup. Then close those playlists and tell me where they go on the next session ;)

It's not so hard to understand foobar treats playlist as virtual files, not something linked to physical files. Yep, they are saved periodically IF you have another component AND WHILE you have them loaded within foobar. That clearly doesn't cover the usage of a playlist manager, which manages playlist not loaded too.

And again, you are clearly missing having a window with a tracked folder which shows all the playlist files, with sorting, filtering and many more features. But hey... if you like having criptic names, and all the limits with current playlist management.. go with it. I will not discuss your use-case nor your theme aim, since that's ridiculous. Obviously everyone does what he likes. We could eveny say having a library manager is stupid. Just use the explorer.. hahahaha Why not?... wow.

Quote
You want to be able to read playlists from arbitrary locations without actually loading the playlist. This part I also don't think you've adequately explained.
Again, why do I have to explain it to you to justify its use? I don't see you justifying me why you have created a theme or you want X or Y Really, this makes no sense. You have just come here judging what I do without a reason. What's the point or value of this discussion? I have made a request, have given reasons, they are not directed to you and I CLEARLY KNOW there is no other method to do what I want.

Quote
Is the issue that you're wanting to generate hundreds/thousands of playlists and not incur a hit at startup? Is there even much of a performance hit with non-autoplaylists? I added 10 playlist with 7800 files each (all different since the playlist manager is smart about duplicate playlists) and my startup time was essentially exactly the same as the 2 seconds it was before I added them.
The playlist manager manages both, standard playlists and autoplaylists. Thanks for telling me what I already know anyway...

Quote
Is the issue that don't want the playlists to show up in foobar's playlist manager? In that case yeah, you're probably out of luck, but since you're creating your own playlist manager you could you easily use smart naming to filter out what you don't want to see, right? Again, maybe scale makes that impossible to do well. Only you know that.
.... that's why I'm requesting a NATIVE METHOD to save fpl playlist to a path, and loading FPL playlist to handle list. But again thanks for telling me what I need.

Quote
What I see you asking for is the ability to write .fpls to a different location using a new SMP method, and then read from those locations without foobar itself loading the playlists (for reasons?) which I'd be surprised if the fb2k API even supports.
... so, according to you, you have queries which can create handle-lists without involving UI or virtual playlist. You have handle-lists, which are equivalent to a playlist and you can work with them in any way you want without involving a playlist.
A playlist is just a handle-list... but the problem is the API magically always converts a handle-list to a playlist. And it's impossible to just skip the creation of an UI object to work with that file list. Aha, it makes so much sense.

Some of this you should probably make a pull-request for if you can figure out how to do it, or even develop your own playlist reading/writing component which you could then control through SMP. It seems pretty niche to me, and whenever I come to that realization I end up having to code it myself  ;D
I have already written a script to read/write playlist through SMP. For m3u8, m3u and pls formats. Again, you are just speaking what if's and telling me what to do without a reason. But thanks.
And it works perfectly fine for fpl playlists, except those are treated as read-only.

But since fpl format is NOT PUBLIC, the only way to ask for it is here at the forums. And being SMP already interacts with the SDK, the proper way to do it would be giving fb.savePlaylist a path, and having a fb.loadPlaylist method to load handle-lists.

Quote
It seems pretty niche to me
And that was the point of all the discussion, since you find no utility on what I do, you feel the need to discuss it. Great. Thanks.
Well, considering there have been 4 playlist manager plugins and one Jscript/SMP script plugin to to partially what I have done, I would say it is not niche. But hey... I will simply stop my verbose answers, since it doesn't matter how much I write you already have your opinion even without ever having seen the scripts or their usage.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #734
@regor You're kind of being... let's go with rude. There's really no need to be so combative.

I'm not asking to justify your use case, I'm trying to get you to concisely explain the problem you're trying to solve, and what shortcomings you feel SMP has to see if there's potentially an alternative you've overlooked, or something that could actually be done. I'm a professional JS developer, and have developed an 8k+ line theme, and, unlike you, I've actually contributed to the SMP codebase so it's not like I'm just some ass on a forum saying your idea is dumb (and I'm clearly not saying that -- again it's a neat idea).

I did also want to point out that you were correct that given the ephemeral nature of fpl's you're either stuck with a million playlists loaded which is not ideal (even if your component could effectively emulate hierarchical style viewing which was my thought), and that closing a playlist is identical to deletion. So I fully understand the limitation there and you're right, it's a big one.

Don't really get the point of discussing with you when TheQwertiest knows exactly which are the 'limitations' with  fb.SavePlaylist() and fb.AddLocations.... really, reread what you are writing...
So what exactly are you wanting him to do? All SavePlaylist and LoadPlaylist do is make a call to the SDK, just like if you selected the entry from the FileMenu. If Peter doesn't expose the functionality you want, what do you think @TheQwertiest is gonna be able to do?  ;D Marc has pointed out that this functionality does exist in the SDK. Mea culpa.

In the original post I responded to, you asked him to "reconsider adding support for native playlists". Now you freely admit that the FPL format is not public. Again, what magic do you think TheQwertiest can work with a non-public format that the fb2k SDK only exposes by manually loading them. Why aren't you asking @Peter for this?

Part of the disconnect is that you keep saying Playlist Manager, when typically in the context of foobar that refers to playlists that are already loaded. What you're hoping to be able to build is a File Manager operating only on playlist formats (because you want some meta information about them, but clearly don't want to load them into memory) that allows you to open and close playlists at will. Linking to scripts that list loaded auto-playlists as proof of... *something* isn't quite the same thing.

Anyway, I wish you the best of luck, and hope someday you can build exactly what you want.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #735
Again, what magic do you think TheQwertiest can work with a non-public format that the fb2k SDK only exposes by manually loading them. Why aren't you asking @Peter for this?

What are you dribbling on about? regor asked for this in SMP AFTER I had the used the SDK to implement the same feature in JSP. I didn't point to the source code at the time but it's here.... all one line of it.

https://github.com/marc2k3/foo_jscript_panel/blob/b99537003e0d3b6787931cc4b1f2dad70eb0f5d7/src/ScriptInterface/MetadbHandleList.cpp#L379

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #736
What are you dribbling on about? regor asked for this in SMP AFTER I had the used the SDK to implement the same feature in JSP. I didn't point to the source code at the time but it's here.... all one line of it.

https://github.com/marc2k3/foo_jscript_panel/blob/b99537003e0d3b6787931cc4b1f2dad70eb0f5d7/src/ScriptInterface/MetadbHandleList.cpp#L379
My bad. Seems pretty straightforward, and regor could easily create a pull request to utilize that and g_save_playlist it seems, although maybe TQ has nixed that idea completely.

However, Regor also apparently wants to be able to read playlists without actually loading them in foobar, which is what I was referencing in the part you quoted.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #737
Again, what magic do you think TheQwertiest can work with a non-public format that the fb2k SDK only exposes by manually loading them. Why aren't you asking @Peter for this?

What are you dribbling on about? regor asked for this in SMP AFTER I had the used the SDK to implement the same feature in JSP. I didn't point to the source code at the time but it's here.... all one line of it.

https://github.com/marc2k3/foo_jscript_panel/blob/b99537003e0d3b6787931cc4b1f2dad70eb0f5d7/src/ScriptInterface/MetadbHandleList.cpp#L379
Thanks...

In fact the saving part is the most important piece of code, since that would make the manager fully functional for fpl (autosaving, autoupdating, notable speed improvements over m3u8). I would not be able to get the playlist size for fpl playlists (until it's loaded on the UI)... but that's a minor thing compared to the other features.

Quote
@regor You're kind of being... let's go with rude. There's really no need to be so combative.
Really, it is not my intention to be combative. Sorry.  But please reread your comments, you have simply prejudged I didn't know what I wanted, why I wanted it or  how I wanted to do it. It's fine, I understand everyone may miss an obvious alternative of doing things, but you crossed the line multiple times even when I gave you clear answers and asked you to stop it. This discussion has been totally pointless, for many reasons. Will not answer to the rest, since it's a dead end road (who has more lines of code, really?) I'm waiting for those fpl functions and a bit of testing before releasing the code publicly too ;) Anyway, if you want to see what I have done, just drop me a line. It is not like it's secret code, I simply have no time -now- for updating a github with beta code and documentation everyday .

Anyway, 'native fpl support' just meant using the already existing functions on the SDK to manage playlists without involving UI, via scripts. I don't ask for hocus pocus or TQ giving us the format of FPL when that's clearly outside his reach. I thought that was pretty obvious, given the context and that you are a developer...

Let's forget this and continue with our work.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #738
Anyway, 'native fpl support' just meant using the already existing functions on the SDK to manage playlists without involving UI, via scripts. I don't ask for hocus pocus or TQ giving us the format of FPL when that's clearly outside his reach. I thought that was pretty obvious, given the context and that you are a developer...
Sorry, I had seen you request this: "loading directly to handle and not requiring an intermediate playlist being created on the UI)" multiple times now which is what I thought you were referring to with native support. That's also what I meant when I originally said you seemed to be violating foobar's design.

Quote
Let's forget this and continue with our work.
Agreed. Let's chalk it up to language differences and I apologize for the poor behavior on my part.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #739
I like "JS Smooth Playlist" from the samples in this plugin, but it doesn't let you change the default displayed fields. Has anyone tried modifying this script to add more customization options?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #740
Edit: In the course of writing this post I verified it was an FSM problem, and so I just created a ticket and moved the original contents of this post here: https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/135

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #741
I like "JS Smooth Playlist" from the samples in this plugin, but it doesn't let you change the default displayed fields. Has anyone tried modifying this script to add more customization options?
Changing over to 'JS Playlist' (or as well called 'jsplaylist-mod') gives full ability to modification, see here. Runs as well in SMP, is activated in SMP by
Code: [Select]
include('samples/jsplaylist-mod/jsplaylist main script.js');
or of course by selecting the script source 'Sample' and then ' jsplaylist-mod\jsplaylist main script.js' in the SMP Configuration.

@TheQwertiest by the way: in your (great!) SMP component homepage, the pics and path of JS Smooth Playlist and JS Smooth Playlist Manager seem to be reversed.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #742
Hi all
foobar 1.6.4 crash when I want to add smp 1.4.1.
Do you have a solution . thank you


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #743
https://hydrogenaud.io/index.php?topic=120394.msg994849#msg994849

Created the first package for SMP and have some questions about the way it works.
Code: [Select]
try { //May be loaded along other buttons
window.DefinePanel('Top Tracks Button', {author:'xxx'});
include(fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\helpers\\buttons_xxx.js');
var g_font = gdi.Font('Segoe UI', 12);
var buttonCoordinates = {x: 0, y: 0, w: 98, h: 22};
var buttonOrientation = 'x';
} catch (e) {
buttonCoordinates = {x: 0, y: 0, w: buttonOrientation == 'x' ? 98 : buttonCoordinates.w , h: buttonOrientation == 'y' ? 22 : buttonCoordinates.h}; // Reset
console.log('Top Tracks Button loaded.');
}

I use that code to check if the button file is being loaded within a button bar or as standalone. The idea is the button bar is loaded first so window.DefinePanel has been already called and therefore "try" thows an error. Works great using standard scripts, but in packages window.DefinePanel and window.DefineScript always throw an error... rendering that method obsolete.

A button bar would simply follow the same structure and include the buttons files.

Code: [Select]
try { //May be loaded along other buttons
window.DefinePanel('Merged Buttons bar', {author:'xxx'});
include(fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\helpers\\buttons_xxx.js');
var g_font = gdi.Font('Segoe UI', 12);
var buttonCoordinates = {x: 0, y: 0, w: 98, h: 22};
var buttonOrientation = 'x';
} catch (e) {
buttonCoordinates = {x: 0, y: 0, w: buttonOrientation == 'x' ? 98 : buttonCoordinates.w , h: buttonOrientation == 'y' ? 22 : buttonCoordinates.h}; // Reset
console.log('Merged Buttons loaded.');
}

// Global width - Height overrides
buttonCoordinates.w += 40; // Only works for 'y' orientation
buttonCoordinates.h += 0; //For 'x' orientation

// Global toolbar color
bToolbar = true; // Change this on buttons bars files to set the background color
toolbarColor = RGB(211,218,237);


{ // Buttons
let buttonsPath = [ // Add here your buttons path
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_same_style.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_same_style_moods.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_similar_by.js',  //+15 w
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_top_tracks.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_remove_duplicates.js',  //+25 w
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_bydistance.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_tags_automation.js',
];

for (let i = 0; i < buttonsPath.length; i++) {
if ((isCompatible('1.4.0') ? utils.IsFile(buttonsPath[i]) : utils.FileTest(buttonsPath[i], "e"))) {
include(buttonsPath[i], {always_evaluate: true});
} else {
console.log(buttonsPath[i] +' not loaded');
}
}

/*
OR just add them manually:
include(fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_same_style.js', {always_evaluate: true});
...
*/
}

This way merging buttons becames a matter of editing 1 line. And anyone can create their own bars easily.

How could I do the same within packages?
Is there a universal way to do it? I would prefer to not have 2 versions of the same script, one for packages and other for standard scripts...
Is there a way to check if the script is being loaded within a package?
Could window.DefinePanel or window.DefineScript work within a package?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #744
And have another suggestion related to the SMP menu and executing arbitrary scripts on demand. While trying to link a standard foobar button to a script, obviously I found the only way was to link the button to main menu SMP entry. Then adding a script at some panel to populate that menu entry with my desired function... but what about dynamic main/contextual menus? I now we talked about it some time ago and I think I have a pretty good concept of how it could work.


For example masstagger creates menus dynamically according to the "presets" you create.


Now back to SMP, a panel within foobar preferences could be created (the same than jScript) with a simple UI.


Solves complex logic to create dynamic menus. Does not require a dummy script to add on menu callbacks and functions there..  and is user configurable without limits. Just the same than adding scripts to the panels.


Creating buttons with SMP functionality would be pretty easy since they would be integrated in foobar the same than any other button... and without X entries limit. It would not require extra js files to draw buttons or menus for panels. Also my reasoning to create both, menu and context menus is simple. For buttons it may not change anything, but for mouse menus it does. It would show some menus when right clicking on tracks, and others on file menu, allowing some fine tuning.



This simple change would change drastically script integration. For ex. anyone could add scripts to any theme using menus/buttons without touching the panels at all (pretty useful for playlist generation scripts, etc.) This would further differentiate utility scripts (meant to be used only on demand) and UI/panel scripts (meant to draw items dynamically or always loaded). Utility scripts would be much more useful and simpler to use.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #745
Is it possible to check for compatibility Spider Monkey Panel v.1.4.1 and foo dockable panels (foo_dockable_panels).
foobar 1.5 crash when I want to add Spider Monkey Panel v.1.4.1. using foo dockable panels.
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #746
foo_spider_monkey_panel v 1.4.1
foobar2000_v1.5
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #747
I'm having problems using on_playback_queue_changed(origin). I can use it without the parameter, but that works with every queue change and I have no use for that. ;) I need to set it to "playback advance", but when I try to execute on_playback_queue_changed(2) I'm getting an error message:
Code: [Select]
missing formal parameter

File: track info scroll.js
Line: 209, Column: 35
Source: function on_playback_queue_changed(2) {
Any ideas what can be wrong with this?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #748
If I don't load with promises inside an await, everything is fine. Unfortunately as discussed months ago, if I don't load my theme using Promises, I get the "script is taking too long" popup when starting up foobar when my HDD isn't spinning.
Okay, I see what the problem is, I'll take a look.

@TheQwertiest by the way: in your (great!) SMP component homepage, the pics and path of JS Smooth Playlist and JS Smooth Playlist Manager seem to be reversed.
Thanks, I'll fix that =)

in packages window.DefinePanel and window.DefineScript always throw an error... rendering that method obsolete.
Yes, that's intentional. Package contains all the necessary info about the included scripts, so there is no need to define it in the script itself.

The primary (and the only) purpose of `DefinePanel`/`DefineScript` is to provide the user with the information about the script in case it fails. I.e. it's for troubleshooting only.

In your case, there is zero need for `DefineScript` and it can be easily substituted with smth like
Code: [Select]
if (typeof loaded_scripts === 'undefined') {
    loaded_scripts = {}
}
if (!(script_id in loaded_scripts)) {
   load_script(script_id);
  loaded_scripts[script_id] = true;
}

PS: `window.DefinePanel` is marked as deprecated

Is it possible to check for compatibility Spider Monkey Panel v.1.4.1 and foo dockable panels (foo_dockable_panels).
foobar 1.5 crash when I want to add Spider Monkey Panel v.1.4.1. using foo dockable panels.
Does foobar2000 crash or is it the script that is crashing?
If it's the latter and your next post contains the corresponding error text, then it might be the same problem as the one that @MordredKLB has.

I'm having problems using on_playback_queue_changed(origin). I can use it without the parameter, but that works with every queue change and I have no use for that. ;) I need to set it to "playback advance", but when I try to execute on_playback_queue_changed(2) I'm getting an error message:
`on_playback_queue_changed` is a callback that's invoked by SMP, so I'm not sure what you are trying to do here.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #749
Quote
I'm having problems using on_playback_queue_changed(origin). I can use it without the parameter, but that works with every queue change and I have no use for that. ;) I need to set it to "playback advance", but when I try to execute on_playback_queue_changed(2) I'm getting an error message:
`on_playback_queue_changed` is a callback that's invoked by SMP, so I'm not sure what you are trying to do here.

I'll admit that I'm a complete noob and I don't know first thing about java script (I have no idea what SMP is). I'm trying to use whatever basic knowledge I have in php and guess what I need to do. So maybe that's why my question seems unclear. Anyway, I'm trying to monitor for when the queue runs out and then play a specified track from a playlist. So far what I managed to do is play the specified track whenever the queue changes, but that's not gonna work for my purpose. I need to use on_playback_queue_changed(2) for that and I can't. How shall I use it?

 
SimplePortal 1.0.0 RC1 © 2008-2021