Last active
September 28, 2024 20:19
-
-
Save murat3/1eace37a6c4a681f19fb044690c2aaac to your computer and use it in GitHub Desktop.
Plex: copy a named playlist from a managed users account to an admin account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Description: Copy a named playlist to another user | |
# Author: murat3 | |
# Requires: | |
# - python >=3.9 | |
# - pip >=3.x | |
# - plexapi >=4.x | |
# - plex >=4.x | |
# | |
# Usage: python3 copy-playlist.py | |
# | |
# Tested with Plex 4.69.1 | |
from plexapi.server import PlexServer | |
baseurl = 'http://plexhost:32400' | |
plexAdminToken = 'adminToken' | |
targetUser = 'targetUser' | |
nameOfPlaylistToCopy = 'aPlaylist' | |
plexAdmin = PlexServer(baseurl, plexAdminToken) | |
def main(): | |
aPlaylist = plexAdmin.playlist(nameOfPlaylistToCopy) | |
aPlaylist.copyToUser(targetUser) | |
print('Playlist ' + aPlaylist.title + ' copied to user: ' + targetUser) | |
if __name__ == "__main__": | |
main() | |
print("Done") |
@bbccdd use the new version; this copies a named playlist to another user; pls check the requirements
Hi @murat3 this is great, but the playlist list presented often has non numeric (hex) identifiers, but the "Select the number of the playlist to copy from" prompt only accepts a numeric. Is there a work around for this?
With the script I can only copy lists created by admin to the manged users. If the other way round, the playlist is not found
What am I doing wrong?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @murat3 that is perfect! Indeed, the token could easily be extracted that way :-) Plexapi is not happy yet however:
plexapi.exceptions.BadRequest: Must include items to add when creating new playlist.
python3 copy-playlist.py
Would you happen to have a clue how to add a wildcard to select all items, or perhaps anohter way around this 'BadRequest' please?
https://python-plexapi.readthedocs.io/en/latest/modules/playlist.html#