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: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3 (Read 46164 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #200
You can stick them all in the same folder.

Three of them are now needed there. The Main.js file is the one that gets loaded into the actual JScript panel - when you configure it (or go to Settings -> Configure if it's alreads setup), you can either paste in the contents of Main.js or go Tools -> Import and load the file (annoyingly the file dialog is looking for *.txt but you can easily change that).
 

That worked great.  Thanks!  The fact that the JSP import tool was looking for txts was really throwing me off.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #201
@etip
Feedback:
Crashing when trying to delete a locked playlist.
Adding the following at line 1147 in the this.delete = function ()  stops the process.

Code: [Select]
			if (plman.GetPlaylistLockName(plman.FindByGUID(this.display[selected.index].id))){
var message = "Unable to delete. Playlist is locked by " + plman.GetPlaylistLockName(plman.FindByGUID(this.display[selected.index].id));
utils.ShowPopupMessage(message, "pl_organizer")
console.log(message);
return;
}

And similar validation is required also for "Rename playlist" if such restriction is already applied to the playlist.  

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #202
I don't think that's good enough. Deleting autoplaylists/locked playlists should be fine except when there is a lock in place that prevents removal. You can check the type of lock with plman.GetPlaylistLockFilterMask - I use these helper functions in jsplaylist/smooth playlist manager...

Code: [Select]
function playlist_can_rename(playlistIndex) {
return !(plman.GetPlaylistLockFilterMask(playlistIndex) & PlaylistLockFilterMask.filter_rename);
}

function playlist_can_remove(playlistIndex) {
return !(plman.GetPlaylistLockFilterMask(playlistIndex) & PlaylistLockFilterMask.filter_remove_playlist);
}

https://jscript-panel.github.io/docs/namespaces/plman/#plmangetplaylistlockfiltermaskplaylistindex

PlaylistLockFilterMask is defined in helpers.txt and also here...

https://jscript-panel.github.io/docs/flags/#playlistlockfiltermask

I don't think there should be popup messages either. It should silently fail when using the delete key and menu items should be greyed out when certain actions are not permissable. See here for example...

https://github.com/jscript-panel/component/blob/66c096863ee57acfc4d24312627cd2e292c5692f/samples/smooth/jsspm.js#L696-L697

EnabledMenuIf is a simple function inside helpers.txt..

https://github.com/jscript-panel/component/blob/66c096863ee57acfc4d24312627cd2e292c5692f/helpers.txt#L220






Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #203
And what about the other restrictions (add, remove etc) when dropping items to the playlist?Does it fail silently also?

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #204
If there are locks in place preventing addition of items, any attempts to add always silently fail. There isn't really anything you have to do.

But to make things nicer, feedback can be provided during drag/drop operations that change the mouse pointer to show dropping is allowed/not permitted.

action.Effect should be zero or one depending on whatever conditions you determine...

https://jscript-panel.github.io/docs/interfaces/IDropAction/

edit: just realised I really need to update that to take in to account playlist locks that aren't autoplaylists. I think the bulk of that was written before they were supported.






Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #205
Perhaps an icon(s) should be also displayed next to the playlist indicating such restrictions...
Thanks for your feedback,your knowledge is appreciated on how to handle them, I am just pointing out some problems I encountered to report to the author.

 

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #206
Playlist Organizer (Jscript Panel 3)
v1.8.3
28-05-2023

Version change:
I followed Marc advice :
- If the playlist lock prevents renaming, then the rename menu will be greyed out
- If the playlist lock prevents deleting, then the delete menu will be greyed out
- If the playlist lock prevents adding new songs, then the drag&drop mouse pointer will show it is not permitted.

Again, @marc2k3  : Thanks !

X

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #207
Perhaps an icon(s) should be also displayed next to the playlist indicating such restrictions...
Such an icon (e.g. a lock) next to the playlist would be a dream!

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #208
Playlist Organizer (Jscript Panel 3)
v1.8.4
29-05-2023

Version change:
- I added a lock icon to the right of the playlist name when it's locked for either :
  • Adding items
  • Renaming the playlist
  • Deleting the playlist

I personally dont like it so i made it optional.
It's pretty basic so i'm up for suggestions, let me know what you think.

X

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #209
I personally dont like it so i made it optional.
It's pretty basic so i'm up for suggestions, let me know what you think.

Agreed. I think the icon stands out far too much. A way to minimize that might be to add a custom color to the lock icon (like you did with the folder icon). the option for the user to set a custom opacity of the icon from a range of 0 to 100%. The icon would probably blend in better.


Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #210
Version change:
- I added a lock icon to the right of the playlist name when it's locked
Wow, this is perfect + faster than lightspeed! Great thanks to you etip!!

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #211
I made some changes to the script regarding the context menu. Please add these to the main script if you like them.

- Changed order of items
  - Grouped all items that have to do with folder and playlist maintenance together
- Created submenu for filter items called Sort folder
  - Added the name of the selected folder as a standalone item in this submenu
  - Renamed the filter items to Ascending order and Descending order respectively



Added this line
Code: [Select]
this.sortMenu = window.CreatePopupMenu();

After this line
Code: [Select]
this.createM = window.CreatePopupMenu();

Modified the filter items code to this
Code: [Select]
		// Sort folders
var filt = "";
if (selected.index > -1) {
if (selected.pl == 1) filt = this.display[selected.index].fold;
else filt = this.display[selected.index].name;
}
this.sortMenu.AppendTo(this.s, EnableMenuIf(selected.index > -1), 'Sort Folder');
this.sortMenu.AppendMenuItem(MF_GRAYED, 0, (filt == "" ? 'Root' : filt));
this.sortMenu.AppendMenuSeparator();
this.sortMenu.AppendMenuItem(EnableMenuIf(selected.index > -1), 1450, 'Ascending order');
this.sortMenu.AppendMenuItem(EnableMenuIf(selected.index > -1), 1460, 'Descending order');

And you'll have to sort the items like I did in the included screen shot.

If there is any easier way to do this just let me know. PM me if you want my pl_organizer.js

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #212
I feel like I can't find a setting somewhere:  When I double click a playlist, it unfortunately starts playing.  I don't want to play it - I just want to view it.  How do I view a playlist without starting it going? 

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #213
Here's another modification that adds the string "Total playlists: {amount}" to the context menu. On mine I added it right above the Help item. It will only be displayed if the Header is set to not visible.

Code: [Select]
		// Show total playlist items in context menu
if (!this.header) {
this.s.AppendMenuItem(MF_GRAYED, 0, 'Total playlists: ' + this.data.filter(function (artr) {
return artr.pl == 1;
}).length);
this.s.AppendMenuSeparator();
}

I wanted to add this as the first context menu item in MF_STRING and bold, but I didn't know how to make bold text.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #214
@hexenszene
Settings -> Double Click on Playlist -> Doesn't play song

If you can't see this, you probably need to download the latest version.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #215
@etip I just noticed that the Rename Folder and Delete Folder context menu items are always disabled. Is it broken or am I doing something wrong?

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #216
@etip I just noticed that the Rename Folder and Delete Folder context menu items are always disabled. Is it broken or am I doing something wrong?
weird, it works for me, i did create some specific playlists to double check that.

I wanted to add this as the first context menu item in MF_STRING and bold, but I didn't know how to make bold text.
Not sure it's feasible, unless @marc2k3 ... nevermind :) :)

PM me if you want my pl_organizer.js
Yeah, i'll take your code, verify and integrate it in a new version.
Thanks !

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #217
weird, it works for me, i did create some specific playlists to double check that.

Is there a way to reset all data relevant to this script? Maybe starting from scratch will solve the issue.. I figured out how to clear all the JS properties.

Rename folder and delete folder still disabled :/

Also now there is often a yellow outline around previously selected playlist items. How do I change that?

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #218
do you know the "lock" parameters for your playlist ?
I'm using Marc Smooth Playlist Manager that has a nice box to describe these :
X

The only way to reset all data relevant to the script is to delete the pl_organizer.txt file located in the profile folder (root if you dont have such folder). There is an option to archive your current, then you can delete the file and restore it at any point of time.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #219
do you know the "lock" parameters for your playlist ?
I'm using Marc Smooth Playlist Manager that has a nice box to describe these :
[attach type=thumb]26048[/attach]

The only way to reset all data relevant to the script is to delete the pl_organizer.txt file located in the profile folder (root if you dont have such folder). There is an option to archive your current, then you can delete the file and restore it at any point of time.
I do not know the lock parameters. I have only ever used your script to make the folders. If lock parameters are important they should be integrated into this script?

I can delete and rename playlists, it is just on the folders where these items are disabled on the context menu.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #220
Hmm. Deleting pl_organizer.txt did not work either.

- Deleted pl_organizer.txt
- Restarted foobar2000
- Created new folder
- Right click on newly created folder and Rename and Delete options still disabled.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #221
Looks you're both getting your wires crossed. etip is testing playlists and metal_termite is having problems with folders??

Also, what if a folder contains a playlist that can't be removed? What do you do then? Move it to the root or remove all playlists that can be removed and leave the folder in place with just the playlist(s) that can't be removed. Have fun!

BTW, I probably can add support for bold menu items. Currently not possible but it should be easy enough.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #222
yep, i thought the problem was on the playlists. I'll take a look on this issue.
The way the script works is that if a folder is deleted, the playlists within fall into the level above, they are not deleted.

BTW, I probably can add support for bold menu items. Currently not possible but it should be easy enough.
Yay !


Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #223
Just to be clear, only one menu item is supposed to be bold to indicate the default action (typically pressing the Enter key). Right click a single item in the Default UI/Columns UI playlist view for an example. Obviously this can't be enforced but I just thought I'd mention it.

Re: Playlist Organizer (aka foo_plorg) replacement on Jscript Panel 3

Reply #224
Playlist Organizer (Jscript Panel 3)
v1.8.5
30-05-2023

Version change:
- Menu reordered and rearranged (thanks @metal_termite  !)
- Bug fix : the folder rename and delete menus are back to normal
- Bug fix : the lock icon didnt appear if the playlist was selected.
X