Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add the ability to set exclusion labels per user #336

Closed
khaosx opened this issue Mar 20, 2022 · 7 comments
Closed

Please add the ability to set exclusion labels per user #336

khaosx opened this issue Mar 20, 2022 · 7 comments

Comments

@khaosx
Copy link

khaosx commented Mar 20, 2022

Is your feature request an improvement on an existing script? Please link to script.

This request is for modification of utility/plex_api_share.py to allow for setting any/all users' exclusion labels within Plex. I've seen a couple of commits that appear to set the stage for this, but I don't see anything that completely enables it. I use this script to declaratively assign permissions for remote users to ensure recoverability and config management. Every morning at 02:00 I unshare everything from all users and reassign based on rules I've built in my script. I've recently been playing around with excluding content based off the sharing tag within Plex and would like to incorporate this into my workflow by adding an exclude tag for all users (e.g. "TotallyUsingThisTagToKeepMyKidsFromSeeingMyWifesFreakyPornStash").

Is your feature request related to a problem? Please describe.
No, but I am always frustrated when I think about my kids seeing my wife's freaky porn stash. Yep. Not trying to hide my questionable anime. Not at all.

Describe alternatives you've considered
I've considered selling them to the circus, but I don't think the circus actually exists anymore. I've also considered setting the inclusion tags on 99% of my media to "TotesNotPorn", but that's a lot of management. There are various ways I could accomplish this with other tools, or even manually, but this script is perfect for my needs except for this minor piece. Thank you for your consideration!

@blacktwin
Copy link
Owner

Try #262 and the latest version of PlexAPI. Let me know if it works and I'll merge it.

@khaosx
Copy link
Author

khaosx commented Apr 3, 2022

@blacktwin Tested and verified. Thanks!

edit: Spoke too soon. Movies works perfectly, TV throws the following error:

No Plex Pass moving on...
Traceback (most recent call last):
  File "/home/kris/scripts/jbops/utility/plex_api_share.py", line 456, in <module>
    share(user, addedLibraries, sync, camera, channels, filterMovies, filterTelevision,
  File "/home/kris/scripts/jbops/utility/plex_api_share.py", line 228, in share
    plex.myPlexAccount().updateFriend(user=user, server=plex, sections=sections, allowSync=allowSync,
  File "/home/kris/.local/lib/python3.9/site-packages/plexapi/myplex.py", line 475, in updateFriend
    params['filterTelevision'] = self._filterDictToStr(filterTelevision or {})
  File "/home/kris/.local/lib/python3.9/site-packages/plexapi/myplex.py", line 570, in _filterDictToStr
    values.append('%s=%s' % (key, '%2C'.join(vals)))
TypeError: sequence item 0: expected str instance, list found```

@khaosx
Copy link
Author

khaosx commented May 4, 2022

@blacktwin Any thoughts on this?

@blacktwin
Copy link
Owner

Do you have a Plex Pass? Also can you provide your entire command string?

@khaosx
Copy link
Author

khaosx commented May 4, 2022

Correct - I have Plex Pass. As noted, the exclude labels work on movies, just not on TV episodes.

Commands I have tried:
python3 /home/kris/scripts/jbops/utility/plex_api_share.py --user "Kris Newman" --add --movieLabels label!=Restricted --tvLabels label!=Restricted - never works, same error as below

python3 /home/kris/scripts/jbops/utility/plex_api_share.py --user "Kris Newman" --add --movieLabels label!=Restricted - works every time

python3 /home/kris/scripts/jbops/utility/plex_api_share.py --user "Kris Newman" --add --tvLabels label!=Restricted

This returns:

No Plex Pass moving on...
Traceback (most recent call last):
  File "/home/kris/scripts/jbops/utility/plex_api_share.py", line 456, in <module>
    share(user, addedLibraries, sync, camera, channels, filterMovies, filterTelevision,
  File "/home/kris/scripts/jbops/utility/plex_api_share.py", line 228, in share
    plex.myPlexAccount().updateFriend(user=user, server=plex, sections=sections, allowSync=allowSync,
  File "/home/kris/.local/lib/python3.9/site-packages/plexapi/myplex.py", line 475, in updateFriend
    params['filterTelevision'] = self._filterDictToStr(filterTelevision or {})
  File "/home/kris/.local/lib/python3.9/site-packages/plexapi/myplex.py", line 570, in _filterDictToStr
    values.append('%s=%s' % (key, '%2C'.join(vals)))
TypeError: sequence item 0: expected str instance, list found

Weirdly, I can set them manually in Plex, and then run a backup from the same script, and those values are present in the JSON, and respected on restore. Not sure if that's connected or not, but I thought I'd mention it.

blacktwin added a commit that referenced this issue May 6, 2022
@blacktwin
Copy link
Owner

@khaosx try now, please

@khaosx
Copy link
Author

khaosx commented May 6, 2022

Tested and verified. Thank you for this addition! Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants