[74] playlist fix

This commit is contained in:
meisnate12 2022-05-07 17:20:22 -04:00
parent ee91abb196
commit 6c44ea858b
4 changed files with 21 additions and 21 deletions

View file

@ -1 +1 @@
1.16.5-develop73
1.16.5-develop74

View file

@ -6,6 +6,8 @@ If utilized to their fullest, these files can be used to maintain the entire ser
Playlists are defined in one or more Playlist files that are mapped in the [Playlist Files Attribute](../config/libraries.md#playlist-files-attribute) within the Configuration File.
You can use the [`playlist_report` setting](../config/settings.md#playlist-report) to get a list of your playlists printed out in your log.
These are the attributes which can be utilized within the Playlist File:
| Attribute | Description |
@ -38,7 +40,7 @@ playlists:
| 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. | &#9989; |
| `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). | &#9989; |
| `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. | &#10060; |
| `delete_playlist` | Will delete this playlist for the users defined by sync_to_users.<br>**Options:** `true` or `false` | &#10060; |

View file

@ -315,6 +315,22 @@ class CollectionBuilder:
self.sync_to_users = None
self.valid_users = []
if self.playlist:
if "libraries" in methods:
logger.debug("")
logger.debug("Validating Method: libraries")
if not self.data[methods["libraries"]]:
raise Failed(f"{self.Type} Error: libraries attribute is blank")
else:
logger.debug(f"Value: {self.data[methods['libraries']]}")
for pl_library in util.get_list(self.data[methods["libraries"]]):
if str(pl_library) in config.library_map:
self.libraries.append(config.library_map[pl_library])
else:
raise Failed(f"Playlist Error: Library: {pl_library} not defined")
self.library = self.libraries[0]
else:
raise Failed("Playlist Error: libraries attribute is required")
self.sync_to_users = config.general["playlist_sync_to_users"]
if "sync_to_users" in methods or "sync_to_user" in methods:
s_attr = f"sync_to_user{'s' if 'sync_to_users' in methods else ''}"
@ -346,22 +362,6 @@ class CollectionBuilder:
if util.parse(self.Type, "delete_not_scheduled", self.data, datatype="bool", methods=methods, default=False):
self.obj = self.library.get_playlist(self.name)
logger.info(self.delete())
if "libraries" in methods:
logger.debug("")
logger.debug("Validating Method: libraries")
if not self.data[methods["libraries"]]:
raise Failed(f"{self.Type} Error: libraries attribute is blank")
else:
logger.debug(f"Value: {self.data[methods['libraries']]}")
for pl_library in util.get_list(self.data[methods["libraries"]]):
if str(pl_library) in config.library_map:
self.libraries.append(config.library_map[pl_library])
else:
raise Failed(f"Playlist Error: Library: {pl_library} not defined")
self.library = self.libraries[0]
else:
raise Failed("Playlist Error: libraries attribute is required")
else:
self.libraries.append(self.library)

View file

@ -516,9 +516,7 @@ class Plex(Library):
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def collection_mode_query(self, collection, data):
if int(collection.collectionMode) not in collection_mode_keys or collection_mode_keys[int(collection.collectionMode)] != data:
collection.modeUpdate(mode=data)
logger.info(f"Collection Mode | {data}")
collection.modeUpdate(mode=data)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def collection_order_query(self, collection, data):