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: JScript Panel (Read 295651 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Re: JScript Panel

Reply #500
I have updated version 2.4.0 to 2.5.0. The images in the biography (Biography 0.9.0.5 by WilB) panel have stopped scrolling. Photos are uploaded to the folder, but only one is shown or not at all.


Re: JScript Panel

Reply #502
Yes, it also seems incompatible with the UI Hacks component. When editing scripts directly in the panels themselves, the player crashes.

Re: JScript Panel

Reply #503
Can't reproduce - works for me.

FWIW, I have access to crash reports submitted via the foobar2000 troubleshooter so everyone should use it where possible.

Re: JScript Panel

Reply #504
Yes, these are not UI Hacks. I started removing the components one at a time and checked each time. After removing the "foo_wave_seekbar" component, the crashes stopped.


Re: JScript Panel

Reply #506
I have the "Punto Switcher" keyboard layout switch installed and always running. If I try to switch the layout in the JS panel with the keys, it hangs. This was not the case in version 2.4.0.


Re: JScript Panel

Reply #508
I cannot change the input language in the script editing window using the "Shift + Alt" keys when the "Punto Switcher is an automatic language switch of the input text" program is running.

Re: JScript Panel

Reply #509
Well whatever the problem, it's far beyond my capabilities to "fix". Thanks for your help reporting those other bugs but I can't do anything about this.

My only suggestion is to have a preprocessor section that doesn't change and use an external editor to make changes to the imported .js files and reload whenever edits are made.


Re: JScript Panel

Reply #511
lol .... RemoveDuplicatesByFormat

On SMP that took me 400 lines of code, it would have been great to see it before! Thanks

Re: JScript Panel

Reply #512
It only takes a few lines for SMP to give the same results. One iteration over the handle list modifying it in place...

Code: [Select]
var items = fb.GetLibraryItems();
var tfo = fb.TitleFormat("%artist% - %title%");
var i = 0;
var set = new Set(); // SMP only, can't do this with JSP
while (i < items.Count) {
    var str = tfo.EvalWithMetadb(items[i]);
    if (set.has(str)) {
        items.RemoveById(i);
    } else {
        set.add(str);
        i++;
    }
}

 

Re: JScript Panel

Reply #513
Wow, I totally missed that option. A pity I didn't mention it before, but thanks! Much faster too, I will update my scripts with that.

Re: JScript Panel

Reply #514
Hi, I use the JScript Panel 2.5.1 component and "YouTube Track Manager 3.9.5.4" When creating the tags album, it is not displayed correctly.If you manually change UTF-8 to UTF-8 with the specification, the playlist starts to display correctly.With earlier versions of JScript Panel, everything is displayed correctly
YouTube Music

Re: JScript Panel

Reply #515
Everyone using WilB's scripts should be using the Spider Monkey Panel versions by now.

But FWIW, I always test text conversion on a whole bunch of multi-language files and the current version of JSP has no issue with Cyrillic characters that I can see.

If using foo_tags and that expects UTF8 with BOM then that would be a problem as that functionality was removed in v2.3.0 ages ago. The component now writes UTF8 without BOM only.


Re: JScript Panel

Reply #516
Thanks for the clarification
YouTube Music


Re: JScript Panel

Reply #518
Oh great! The fpl playlist saving comes handy hahaha. I was expecting not having to manually re-write m3u8 playlists on track changes, but will have to do so until SMP adds the fpl functionality.

I think the playlist manager script as is should work on jscript panels. I will check which scripts work so other people with this panel can use them too. The graph part seems out of question since I had to use extensive use of sets.

Btw, many scripts on your release file on github are .txt files now instead of .js. Not sure if it's intended (?)

Re: JScript Panel

Reply #519
Also for m3u8 playlist creations, your example at docs does not adhere to the standard.  You need to add at least #EXTM3U as first line. And it's recommended to add the encoding too.

Code: [Select]
...
// Get track paths
const tfo = fb.TitleFormat('%path%');
const items = plman.GetPlaylistItems(playlistIndex);
// Header text
let playlistText = [];
playlistText.push('#EXTM3U');
playlistText.push('#EXTENC: UTF-8');
// Tracks text
let trackText = [];
trackText = tfo.EvalWithMetadbs(items);
// Join and separte with new lines
playlistText = playlistText.concat(trackText).join('\r\n');
// Write to file
utils.WriteTextFile(playlistPath, playlistText);
...

Re: JScript Panel

Reply #520
I'm not entirely sure what programs need the #EXTM3U but I've added it anyway. The encoding should be obvious from the file extension.

fb2k itself doesn't care and neither does mp3tag or Media Player Classic Black Edition. I'm too lazy to download and test other software I don't already have installed.

Re: JScript Panel

Reply #521
It's usually used for streaming purposes, servers, etc. They don't care about extension, but the file content.
You may have track names on the file as UTF-8, but the files may have other encoding. Also some programs can read the UTF-8 m3u8 file but not manage tracks with names encoded like that... (even if that makes no sense).

There is an interminable list of #directives used on streaming programs. And even playlists pointing to playlists. You can also have a playlist name different than the filename. For example, to have duration, artist and title while streaming then the playlist must be formatted like this:
Code: [Select]
	...	
let playlistText = [];
playlistText.push('#EXTM3U');
playlistText.push('#EXTENC:UTF-8');
playlistText.push('#PLAYLIST:' + playlistName);
playlistText.push('#PLAYLISTSIZE:');
if (playlistIndex != -1) { // Tracks from playlist
let trackText = [];
// var tfo = fb.TitleFormat('%path%');
var tfo = fb.TitleFormat('#EXTINF:%_length_seconds%,%artist% - %title%$crlf()' + '%path%');
var items = plman.GetPlaylistItems(playlistIndex);
trackText = tfo.EvalWithMetadbs(items);
playlistText[3] += items.Count; // Add number of tracks to size
playlistText = playlistText.concat(trackText);
} else { //  Else empty playlist
playlistText[3] += 0; // Add number of tracks to size
}


Code: [Select]
#EXTM3U
#EXTENC:UTF-8
#PLAYLIST:Filter Results
#PLAYLISTSIZE:7
#EXTINF:154,Exuma - Don't let go
D:\foobar2000\_\510 Don't let go.mp3
#EXTINF:372,Faris Amine Bottazzi - Alwaq semman
D:\foobar2000\_\494 Alwaq semman.mp3
#EXTINF:249,Hamza El Din - Anesigu
D:\foobar2000\_\504 Anesigu.mp3
#EXTINF:276,Hamza El Din - Childhood
D:\foobar2000\_\503 Childhood.mp3
#EXTINF:262,Hamza El Din - The message bearer
D:\foobar2000\_\496 The message bearer.mp3
#EXTINF:181,Tamikrest - Nak akaline tinza (tinzaouatene)
D:\foobar2000\_\500 Nak akaline tinza (tinzaouatene).mp3
#EXTINF:214,Terakaft - Imad halan
D:\foobar2000\_\508 Imad halan.mp3

May seem useless for many programs as you noted but in my use-case for the playlist manager, for example, there is no way to know how many tracks a playlist have without loading it, since I'm just showing a list of files. To bypass that limitation I can either count the number of lines (not #) for every playlist at playlist library reload (and then cache it) or just read the size directive. Name and tracks infos are useful for streaming, although I can also use name to set that as playlist name within foobar instead of the filename.

Anyway, for sure, the program must support all those standard directives to make playlist work right. Otherwise those lines just get skipped. If you create a playlist with those lines an open it on VLC for example, you will see the length, artist and title get loaded from the playlist even if it points to non existent files. Foobar seems to skip that info... so that seems to be more a limitation of foobar rather than the directives being useless.
X
X


Re: JScript Panel

Reply #523
Well there are other programs, that's just an example hahaha
As I said, you may not use playlists for streaming, other people do. VLC may be terrible, foobar has its flaws too. This is one of them, considering foobar is used for streaming purposes too... (locations, radio stations, youtube, upnp plugins, etc.)

EDIT: I mean... we have m-tags and all those workarounds for streaming tagging but I'm surprised to see the standard method is missing (?)

Re: JScript Panel

Reply #524
v2.5.3 https://github.com/marc2k3/foo_jscript_panel/releases

- Add `IMetadbHandle` `ShowAlbumArtViewer` which uses the new internal viewer added in foobar2000 `v1.6.2`. You will see a popup text message if you try and use it on earlier versions. Check the docs for options.
- The included `Album art` sample now has 3 choices available for the `double click` action. Use the right click menu to choose.
  * Open using external viewer
  * Open using new internal viewer mentioned above
  * Open containing folder