mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[75] add playlist user exclude
This commit is contained in:
parent
5114b4476f
commit
cdee4dfc65
11 changed files with 55 additions and 11 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.18.0-develop74
|
||||
1.18.0-develop75
|
||||
|
|
|
@ -62,6 +62,7 @@ settings:
|
|||
ignore_imdb_ids:
|
||||
item_refresh_delay: 0
|
||||
playlist_sync_to_user: all
|
||||
playlist_exclude_user:
|
||||
playlist_report: false
|
||||
verify_ssl: true
|
||||
custom_repo:
|
||||
|
|
|
@ -45,6 +45,7 @@ templates:
|
|||
visible_library_<<key>>: <<visible_library>>
|
||||
visible_home_<<key>>: <<visible_home>>
|
||||
visible_shared_<<key>>: <<visible_shared>>
|
||||
minimum_items_<<key>>: <<minimum_items>>
|
||||
optional:
|
||||
- use_<<key>>
|
||||
- allowed_libraries
|
||||
|
@ -58,6 +59,7 @@ templates:
|
|||
- image
|
||||
- ignore_ids
|
||||
- ignore_imdb_ids
|
||||
- minimum_items
|
||||
allowed_library_types:
|
||||
- <<use_<<key>>>>
|
||||
- <<allowed_libraries>>
|
||||
|
@ -73,6 +75,7 @@ templates:
|
|||
item_sonarr_tag: <<item_sonarr_tag_<<key>>>>
|
||||
sort_title: "!<<collection_section>><<pre>><<order_<<key>>>><<sort>>"
|
||||
url_poster: <<url_poster_<<key>>>>
|
||||
minimum_items: <<minimum_items_<<key>>>>
|
||||
|
||||
trakt:
|
||||
optional:
|
||||
|
|
|
@ -97,6 +97,7 @@ settings:
|
|||
ignore_imdb_ids:
|
||||
item_refresh_delay: 0
|
||||
playlist_sync_to_user: all
|
||||
playlist_exclude_user:
|
||||
playlist_report: false
|
||||
verify_ssl: true
|
||||
custom_repo:
|
||||
|
|
|
@ -52,6 +52,7 @@ The available setting attributes which can be set at each level are outlined bel
|
|||
| [`ignore_imdb_ids`](#ignore-imdb-ids) | ✅ | ✅ | ✅ |
|
||||
| [`item_refresh_delay`](#item-refresh-delay) | ✅ | ✅ | ✅ |
|
||||
| [`playlist_sync_to_users`](#playlist-sync-to-users) | ✅ | ❌ | ✅ |
|
||||
| [`playlist_exclude_users`](#playlist-exclude-users) | ✅ | ❌ | ✅ |
|
||||
| [`playlist_report`](#playlist-report) | ✅ | ❌ | ❌ |
|
||||
| [`custom_repo`](#custom-repo) | ✅ | ❌ | ❌ |
|
||||
| [`verify_ssl`](#verify-ssl) | ✅ | ❌ | ❌ |
|
||||
|
@ -540,6 +541,19 @@ Set the default playlist `sync_to_users`. To Sync a playlist to only yourself le
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
## Playlist Exclude Users
|
||||
Set the default playlist `exclude_users`.
|
||||
<table class="dualTable colwidths-auto align-default table">
|
||||
<tr>
|
||||
<th>Default Value</th>
|
||||
<td><code> </code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Allowed Values</th>
|
||||
<td>list of users or comma-separated string of users</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Playlist Report
|
||||
Set `playlist_report` to true to print out a playlist report at the end of the log.
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ Below are the available variables which can be used to customize the file.
|
|||
| `collection_mode` | **Description:** Controls the collection mode of all collections in a Defaults file.<br>**Values:**<table class="clearTable"><tr><td>`default`</td><td>Library default</td></tr><tr><td>`hide`</td><td>Hide Collection</td></tr><tr><td>`hide_items`</td><td>Hide Items in this Collection</td></tr><tr><td>`show_items`</td><td>Show this Collection and its Items</td></tr></table> |
|
||||
| `ignore_ids` | **Description:** Set a list or comma-separated string of TMDb/TVDb IDs to ignore in all collections.<br>**Values:** List or comma-separated string of TMDb/TVDb IDs |
|
||||
| `ignore_imdb_ids` | **Description:** Set a list or comma-separated string of IMDb IDs to ignore in all collections.<br>**Values:** List or comma-separated string of IMDb IDs |
|
||||
| `minimum_items` | **Description:** Set the number of minimum items for a collection to be created for all collections.<br>**Values:** Any Number greater then 0 |
|
||||
| `minimum_items_<<key>>`<sup>1</sup> | **Description:** Set the number of minimum items for a collection to be created for the specified key's collection.<br>**Values:** Any Number greater then 0 |
|
||||
| `url_poster_<<key>>`<sup>1</sup> | **Description:** Changes the poster url of the specified key's collection.<br>**Values:** URL directly to the Image |
|
||||
| `visible_library` | **Description:** Controls visible on Library for all collections in a Defaults file. (Only works with Plex Pass)<br>**Values:**<table class="clearTable"><tr><td>`true`</td><td>Visible</td></tr><tr><td>`false`</td><td>Not Visible</td></tr><tr><td>[Any `schedule` Option](../metadata/details/schedule)</td><td>Visible When Scheduled</td></tr></table> |
|
||||
| `visible_library_<<key>>`<sup>1</sup> | **Description:** Controls visible on Library of the specified key's collection. (Only works with Plex Pass)<br>**Default:** `visible_library`<br>**Values:**<table class="clearTable"><tr><td>`true`</td><td>Visible</td></tr><tr><td>`false`</td><td>Not Visible</td></tr><tr><td>[Any `schedule` Option](../metadata/details/schedule)</td><td>Visible When Scheduled</td></tr></table> |
|
||||
|
|
|
@ -296,7 +296,7 @@ docker run -it -v "X:\Media\Plex Meta Manager\config:/config:rw" meisnate12/plex
|
|||
|
||||
### Collections Only
|
||||
|
||||
Only run collection metadata/YAML files, skip library operations, overlays, and collections/metadata.
|
||||
Only run collection metadata/YAML files, skip library operations, overlays, and playlists.
|
||||
|
||||
<table class="dualTable colwidths-auto align-default table">
|
||||
<tr>
|
||||
|
|
|
@ -44,11 +44,12 @@ There are multiple types of attributes that can be utilized within a playlist:
|
|||
|
||||
### Special Playlist Attributes
|
||||
|
||||
| Attribute | Description | Required |
|
||||
|:------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|
|
||||
| `libraries` | Determine which libraries the playlist will be built from.<br>**Options:** Comma-separated string or list of library mapping names defined in the `libraries` attribute in the base of your [Configuration File](../config/configuration). | ✅ |
|
||||
| `sync_to_users` | Determine which Users have the playlist synced.<br>This will override the global [`playlist_sync_to_users` Setting](../config/settings.md#playlist-sync-to-users).<br>**Options:** Comma-separated string or list of users, `all` for every user who has server access, or leave blank for just the server owner. | ❌ |
|
||||
| `delete_playlist` | Will delete this playlist for the users defined by sync_to_users.<br>**Options:** `true` or `false` | ❌ |
|
||||
| Attribute | Description | Required |
|
||||
|:------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|
|
||||
| `libraries` | Determine which libraries the playlist will be built from.<br>**Options:** Comma-separated string or list of library mapping names defined in the `libraries` attribute in the base of your [Configuration File](../config/configuration). | ✅ |
|
||||
| `sync_to_users` | Determine which Users have the playlist synced.<br>This will override the global [`playlist_sync_to_users` Setting](../config/settings.md#playlist-sync-to-users).<br>**Options:** Comma-separated string or list of users, `all` for every user who has server access, or leave blank for just the server owner. | ❌ |
|
||||
| `exclude_users` | Determine which Users will be excluded from having the playlist synced.<br>This will override the global [`playlist_excude_users` Setting](../config/settings.md#playlist-exclude-users).<br>**Options:** Comma-separated string or list of users, `all` for every user who has server access, or leave blank for just the server owner. | ❌ |
|
||||
| `delete_playlist` | Will delete this playlist for the users defined by sync_to_users.<br>**Options:** `true` or `false` | ❌ |
|
||||
|
||||
* Any defined playlist will be always be visible by The Plex Media Server owner, so it doesn't need to be defined within `sync_to_users`.
|
||||
|
||||
|
|
|
@ -335,6 +335,7 @@ class CollectionBuilder:
|
|||
self.overlay = Overlay(config, library, metadata, str(self.mapping_name), overlay_data, suppress, self.builder_level)
|
||||
|
||||
self.sync_to_users = None
|
||||
self.exclude_users = None
|
||||
self.valid_users = []
|
||||
if self.playlist:
|
||||
if "sync_to_users" in methods or "sync_to_user" in methods:
|
||||
|
@ -344,18 +345,35 @@ class CollectionBuilder:
|
|||
logger.debug(f"Value: {self.data[methods[s_attr]]}")
|
||||
self.sync_to_users = self.data[methods[s_attr]]
|
||||
else:
|
||||
logger.warning(f"Playlist Error: sync_to_users attribute not found defaulting to playlist_sync_to_users: {self.sync_to_users}")
|
||||
self.sync_to_users = config.general["playlist_sync_to_users"]
|
||||
logger.warning(f"Playlist Warning: sync_to_users attribute not found defaulting to playlist_sync_to_users: {self.sync_to_users}")
|
||||
|
||||
if "exclude_users" in methods or "exclude_user" in methods:
|
||||
s_attr = f"exclude_user{'s' if 'exclude_users' in methods else ''}"
|
||||
logger.debug("")
|
||||
logger.debug(f"Validating Method: {s_attr}")
|
||||
logger.debug(f"Value: {self.data[methods[s_attr]]}")
|
||||
self.exclude_users = self.data[methods[s_attr]]
|
||||
elif config.general["playlist_exclude_users"]:
|
||||
self.exclude_users = config.general["playlist_exclude_users"]
|
||||
logger.warning(f"Playlist Warning: exclude_users attribute not found defaulting to playlist_exclude_users: {self.exclude_users}")
|
||||
|
||||
plex_users = self.library.users
|
||||
|
||||
self.exclude_users = util.get_list(self.exclude_users)
|
||||
for user in self.exclude_users:
|
||||
if user not in plex_users:
|
||||
raise Failed(f"Playlist Error: User: {user} not found in plex\nOptions: {plex_users}")
|
||||
|
||||
if self.sync_to_users:
|
||||
if str(self.sync_to_users) == "all":
|
||||
self.valid_users = plex_users
|
||||
self.valid_users = [p for p in plex_users if p not in self.exclude_users]
|
||||
else:
|
||||
for user in util.get_list(self.sync_to_users):
|
||||
if user not in plex_users:
|
||||
raise Failed(f"Playlist Error: User: {user} not found in plex\nOptions: {plex_users}")
|
||||
self.valid_users.append(user)
|
||||
if user not in self.exclude_users:
|
||||
self.valid_users.append(user)
|
||||
|
||||
if "delete_playlist" in methods:
|
||||
logger.debug("")
|
||||
|
|
|
@ -371,6 +371,7 @@ class ConfigFile:
|
|||
"ignore_ids": check_for_attribute(self.data, "ignore_ids", parent="settings", var_type="int_list", default_is_none=True),
|
||||
"ignore_imdb_ids": check_for_attribute(self.data, "ignore_imdb_ids", parent="settings", var_type="list", default_is_none=True),
|
||||
"playlist_sync_to_users": check_for_attribute(self.data, "playlist_sync_to_users", parent="settings", default="all", default_is_none=True),
|
||||
"playlist_exclude_users": check_for_attribute(self.data, "playlist_exclude_users", parent="settings", default_is_none=True),
|
||||
"playlist_report": check_for_attribute(self.data, "playlist_report", parent="settings", var_type="bool", default=True),
|
||||
"verify_ssl": check_for_attribute(self.data, "verify_ssl", parent="settings", var_type="bool", default=True),
|
||||
"custom_repo": check_for_attribute(self.data, "custom_repo", parent="settings", default_is_none=True),
|
||||
|
|
|
@ -715,7 +715,10 @@ class Plex(Library):
|
|||
return self._users
|
||||
|
||||
def delete_user_playlist(self, title, user):
|
||||
self.delete(self.PlexServer.switchUser(user).playlist(title))
|
||||
try:
|
||||
self.delete(self.PlexServer.switchUser(user).playlist(title))
|
||||
except NotFound as e:
|
||||
raise Failed(e)
|
||||
|
||||
@property
|
||||
def account(self):
|
||||
|
|
Loading…
Reference in a new issue