INTERACT FORUM

More => Old Versions => JRiver Media Center 28 for Windows => Topic started by: zybex on November 24, 2021, 11:36:16 am

Title: MCWS API requests
Post by: zybex on November 24, 2021, 11:36:16 am
Hi team,
While using MCWS API to process files in bulk I ran into some limitations. Could you please consider adding these functions:

Playlist\Clear
Purpose: remove all files from a playlist without deleting the playlist.
Reason: I need to recreate playlists from scratch, without changing their ID so that existing Views/Expressions/Playlists that rely on the ID keep working. Deleting and recreating a playlist is fast, but the ID changes.

Playlist\AddFiles
Purpose: add a list of files (by key list) to an existing playlist
Reason: this avoids having to do 1000 API calls to add 1000 files. Playlist\Build can do that, but only when creating a new list. Also, when creating a new list with a few thousand files it's not possible to add them all in a single go as the URL would exceed the maximum length. So this new Playlist\AddFiles would allow creating large lists in batches.

Playlist\RemoveFiles
Purpose: the complement to AddFiles above.

Thank you, and happy thanksgiving!
Title: Re: MCWS API requests
Post by: Matt on November 25, 2021, 07:58:41 am
I agree with your ideas.  I'll try to hook it up sometime in the future.  Thanks.
Title: Re: MCWS API requests
Post by: Matt on December 07, 2021, 11:11:01 am
Coming next build:
NEW: Added the MCWS function Playlist/AddFiles.
NEW: Added the MCWS function Playlist/Clear.
NEW: Added the MCWS function Playlist/RemoveFiles.

Thanks for the suggesion.
Title: Re: MCWS API requests
Post by: zxsix on December 07, 2021, 11:18:28 am
Thanks.  Looking forward to this.
Sytax help with adding only the currently playing track to a specific playlist ID would be appreciated.
Title: Re: MCWS API requests
Post by: Hendrik on December 07, 2021, 11:20:19 am
Get the key of the currently playing file from any of the Info commands, and use the new Playlist/AddFiles command to add it to one. Seems pretty straight forward.
Title: Re: MCWS API requests
Post by: zybex on December 07, 2021, 11:20:36 am
Thanks again Matt!
Just remembered a useful parameter to AddFiles, perhaps you thought of it too: &allowdups=0 to remove duplicates; default is 1 to allow duplicates (or vice versa, up to you).

Alternative solutions:
/playlist/clear&dupsonly=1
/playlist/cleardups
Title: Re: MCWS API requests
Post by: Matt on December 07, 2021, 12:17:04 pm
We'll do this to avoid function pollution:
NEW: Added the MCWS function Playlist/RemoveDuplicates.
Title: Re: MCWS API requests
Post by: zxsix on December 07, 2021, 08:12:39 pm
I was successful using Playlist/Addfile
Thanks for this nice enhancement!   ;D