plex-playlist-sync icon indicating copy to clipboard operation
plex-playlist-sync copied to clipboard

Add playlist to multiple users

Open aNerdgirl opened this issue 3 years ago • 24 comments

First of all, thanks for the amazing script. It works very well.

I have a question/ feature request. Instead of adding the playlist 'only' for one user, I would like to add it to the main user + one additional user in plex. The reason: the audio app (Plexamp) doesn't show shared playlists, but only playlists created by the user.

Would it be possible to add this feature (or you could also give me a hint here and I could try myself). Thanks in advance.

aNerdgirl avatar Mar 13 '22 18:03 aNerdgirl

It's possible to copy playlist(s) created from main user to other users. But there are a few problems with it.

  1. Copying playlists with Playlist.copyToUser will NOT copy the posters and summary of the playlist.
  2. Will not delete existing playlists. Will keep on creating duplicate playlists on each copy.

Maybe there is a workaround to these but I haven't looked much into it.

You may ask why not just run another docker container with the user's credentials. I don't think this is not possible because the users will not have a plex token. I will leave this issue open.

rnagabhyrava avatar Mar 13 '22 18:03 rnagabhyrava

Thanks for the fast reply. Hm copy could be an option if I run it only once. However, I agree it is not suited for regular synchs. I will have a look if there is a workaround, if I find something, I will let you know (though I am not too good with python).

I also tried to run the same script with a different plex token, and it indeed fails to work (as you said as well).

Thank you for your reply and effort!

aNerdgirl avatar Mar 14 '22 08:03 aNerdgirl

I see two ways to enable multiple user support without sharing from one user, which appears to me as a 'hack'.

  1. We use different profiles for each user which would be read from a config file. Each profile would have a different spotify id and deezer id as well as different plex credentials. This would require a slight rewrite of the present software.
  2. People that want to sync multiple users simply spawn multiple docker instances of the software.

anatosun avatar Aug 29 '22 13:08 anatosun

No offense but did you read completely said above?

You may ask why not just run another docker container with the user's credentials. I don't think this is not possible because the users will not have a plex token. I will leave this issue open.

Users WILL NOT have a plex token (only admin gets token) so cannot login to api which is needed to run api.

rnagabhyrava avatar Aug 29 '22 15:08 rnagabhyrava

None taken, this is clearly my fault.

So only the first solution (in the two points I cited above) seems viable, right? Do you think an OAuth mechanism would work?

anatosun avatar Aug 29 '22 15:08 anatosun

You first point will also need some sort of plex authentication and token key from the user, users wont have token so not sure how this different from your other point. If you have a POC of this working, I am happy to implement it.

rnagabhyrava avatar Aug 29 '22 15:08 rnagabhyrava

@rnagabhyrava thanks for making this it's super useful!

I just wanted to add my own 2 cents to this. I've been able to create 2 containers for this (one for me and one for my partner) which synchronises our playlists against our Deezer and Plex account individually. I found out after quite a bit of research that home users also have plex tokens, you just have to dig around to find them. You have to log in as the managed user, open up the bottom console and go to the network tab and play songs etc and you find it here https://i.imgur.com/ainu7v1.png

The only issue is they don't get a poster assigned to the playlist - but I think that's a plex bug as managed users can't upload posters for some reason (unauthorized error 401). This is a bug report on plex so I think they'll fix it eventually.

Hope that's helpful to someone looking to do the same.

rocstack avatar Oct 20 '22 10:10 rocstack

@rocstack Thanks for digging into it. The reason for posters not showing up is very well do to access issue. I believe users will not have write access to the server. I may be wrong tho.... Anyways, thanks for the comment. I'll update the readme.

rnagabhyrava avatar Oct 20 '22 17:10 rnagabhyrava

No worries. I found out that if you get the managed users playlist ID you can upload it using the admin users token via the API. That way you get around the access issue.

So just make a POST request to this with the playlist ID and whatever image you want as a param: http://192.168.0.21:32400/library/metadata/<playlistId>/posters?url=https://someimage.jpg&X-Plex-Token=XXXXXX

Not sure if that could be automated as part of this project - doing it manually is a bit tedious. Otherwise I'll create a script and share it.

rocstack avatar Oct 20 '22 19:10 rocstack

I never looked into this. Looks easy enough to upload the posters but I have to edit some components of the code to handle multiple users. I'll try to get this done in a week or two.

On Thu, Oct 20, 2022, 14:19 Brad @.***> wrote:

No worries. I found out that if you get the managed users playlist ID you can upload it using the admin users token via the API. That way you get around the access issue.

So just make a POST request to this with the playlist ID and whatever image you want as a param: http://192.168.0.21:32400/library/metadata/<playlistId>/posters?url= https://someimage.jpg&X-Plex-Token=XXXXXX

Not sure if that could be automated as part of this project - doing it manually is a bit tedious. Otherwise I'll create a script and share it.

— Reply to this email directly, view it on GitHub https://github.com/rnagabhyrava/plex-playlist-sync/issues/14#issuecomment-1286025574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJEHWS3VBHOEKKWRGA4MYDWEGLMVANCNFSM5QTVUY3A . You are receiving this because you were mentioned.Message ID: @.***>

rnagabhyrava avatar Oct 20 '22 19:10 rnagabhyrava

@rnagabhyrava thanks :)

rocstack avatar Oct 20 '22 19:10 rocstack

Has this been implemented into this project. I'm quite interested in having multiple users having Spotify playlists syncs. Seems easy enough after reading above to create another instance for each user and sync through finding their API. But unsure on the access poster thing. You mention it's a manual process, was there any development on automating this into the code?

nath2125 avatar Apr 26 '23 13:04 nath2125

Has this been implemented into this project. I'm quite interested in having multiple users having Spotify playlists syncs. Seems easy enough after reading above to create another instance for each user and sync through finding their API. But unsure on the access poster thing. You mention it's a manual process, was there any development on automating this into the code?

Not sure if the repository's owner has done anything but I managed to automate all of the above. I would create a PR but the implementation is ugly (I'm not a python dev) and wouldn't want to scramble the existing codebase. So I just created a private fork and use it locally.

Happy to make that public?

rocstack avatar Apr 26 '23 14:04 rocstack

If you don't mind. I'm assuming it is as simple as taking and replacing this repository with yours? Since it's a copy of the original but changed? Do you have any documentation on additional things that are added, or is it pretty much the same with extra fields? How would I go about adding extra users on yours?

nath2125 avatar Apr 26 '23 14:04 nath2125

Pretty much. I'd have build a new docker image for it to share. It would just need one additional field for all the plex users. It's just one container/instance which builds the playlists and copies them to all the users. I'll have a look this weekend.

rocstack avatar Apr 26 '23 14:04 rocstack

No worries, really appreciate your effort on this! But to clarify would it be user1spotify -> user1plex, user2spotify -> user2plex (since its using individual apis for each plex user, should I still assume your going that route?) or more of a case of user1spotify -> all plex users that you have listed in the field?

nath2125 avatar Apr 26 '23 14:04 nath2125

It's just one Spotify account for api access. You define all the playlist IDs in the config and it pulls them from Spotify and copies them to the Plex accounts. You can also pull from playlist groups Spotify define like featured, top, indie, hip-hop etc.. Makes it a bit more dynamic. Might not be exactly what you're looking for but it works well for the accounts on my server.

rocstack avatar Apr 27 '23 10:04 rocstack

Yea, that sounds alright for what I'm doing. Could do it that way too, didn't think of that, instead of having each Spotify accounts with their playlists, just have one and pull the playlist IDs. That makes sense! Let me know when you finish up with it, so I can try out, thanks!

nath2125 avatar Apr 27 '23 12:04 nath2125

It's just one Spotify account for api access. You define all the playlist IDs in the config and it pulls them from Spotify and copies them to the Plex accounts. You can also pull from playlist groups Spotify define like featured, top, indie, hip-hop etc.. Makes it a bit more dynamic. Might not be exactly what you're looking for but it works well for the accounts on my server.

How did you go making it?

nath2125 avatar May 02 '23 13:05 nath2125

How did you go making it?

Everything's working just not in a docker container. Nearly there..

rocstack avatar May 02 '23 17:05 rocstack

Any new updates on the docker container creation? Just thought I would check in?

nath2125 avatar May 11 '23 14:05 nath2125

Yeah give it a try if you like. Let me know if you run into any issues.

rocstack avatar May 11 '23 16:05 rocstack

Do you mind opening the issues tab on your project? Running into a few problems not sure if its the way I have it configured or not

nath2125 avatar May 12 '23 03:05 nath2125

Opened

rocstack avatar May 12 '23 07:05 rocstack