[2] add collection order option custom.desc

pull/1243/head
meisnate12 2 years ago
parent 81c4ffe53a
commit 7a0fbc88ef

@ -1,29 +1,7 @@
# Requirements Update (requirements will need to be reinstalled)
Updated plexapi requirement to 4.13.2
Updated retrying requirement to 1.3.4
Updated lxml requirement to 4.92
# New Features
Now supports Python 3.11
Wiki CSS update thanks to @YozoraXCII
Added `languages` template variable to the languages default
Added `mdb_average` as an option for `mass_update_*_ratings`
Added `custom_keys` dynamic collection attribute
Better Error handling for move errors
Added Sonarr v4 support
Added `album_genre`, `album_mood`, `album_style`, and `track_mood` as dynamic collection types
Added `only_run_on_create` to only run collections when the collection doesn't exist already
Added `exclude_user` as an option for playlist definitions
Added new collection_order `custom.desc`. ([FR](https://features.metamanager.wiki/features/p/reverse-sort-collectionorder-custom))
# Bug Fixes
Fixed positioning issues with the resolution/editions default and the ratings default
Fixed Metadata Asset Failures
Fixed `smart_label` collection counts
Fixed `delete_collections` operation
Fixed using `include` with the defaults
Fixed #1174 Content mapper error
Fixed mal builder errors
Fixed #1224
Fixed audio_codec and video_format defaults regex patterns
Fixed tvdb xpaths for their builders and operations
Fixed overlays to allow only suppression of overlays which exist inside the same file
Fixed Italian Translation

@ -1 +1 @@
1.18.1-develop1
1.18.1-develop2

@ -4,23 +4,23 @@ All the following attributes update various details of the definition's Metadata
**Only `tmdb_person` works with Playlists.**
| Attribute | Description & Values |
|:-----------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tmdb_person` | **Description:** Changes summary and poster to a TMDb Person's biography and profile as well as allow the people specified to be used in [Plex Searches](../builders/plex.md#plex-search).<br>**Values:** TMDb Person ID (List or Comma-separated string) |
| `sort_title` | **Description:** Changes the sort title.<br>You can "promote" certain collections to the top of a library by creating a sort title starting with a `+` or "demote" certain collections to the bottom of a library by creating a sort title starting with a `~`.<br>**Values:** Text to change Sort Title |
| `content_rating` | **Description:** Changes the content rating.<br>**Values:** Text to change Content Rating |
| `label` | **Description:** Appends new labels.<br>**Values:** Comma-separated string of labels to append |
| `label.remove` | **Description:** Removes existing labels from the collection.<br>**Values:** Comma-separated string of labels to remove |
| `label.sync` | **Description:** Matches the labels of the collection to the labels provided (Leave blank to remove all labels)<br>**Values:** Comma-separated string of labels to sync |
| `collection_mode` | **Description:** Changes the Collection Mode<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> |
| `collection_order` | **Description:** Changes the Collection Order<br>**Normal Collections Only**<br>When using `custom` you can only have a single builder in the collection.<br>**Values:**<table class="clearTable"><tr><td>`release`</td><td>Order Collection by Release Dates</td></tr><tr><td>`alpha`</td><td>Order Collection Alphabetically</td></tr><tr><td>`custom`</td><td>Order Collection Via the Builder Order</td></tr><tr><td>[Any `plex_search` Sort Option](../builders/plex.md#sort-options)</td><td>Order Collection by any `plex_search` Sort Option</td></tr></table> |
| `collection_filtering` | **Description:** Changes the Collection Filtering<br>**Smart Collections Only**<br>**Values:**<table class="clearTable"><tr><td>`admin`</td><td>Always the server admin user</td></tr><tr><td>`user`</td><td>User currently viewing the content</td></tr></table> |
| `builder_level` | **Description:** Make season, episode, album or track collections/overlays from `plex_all`, `plex_search`, `trakt_list`, or `imdb_list` Builders and Filters<br>**Values:**<table class="clearTable"><tr><td>`season`</td><td>Collection contains seasons</td></tr><tr><td>`episode`</td><td>Collection contains episodes</td></tr><tr><td>`album`</td><td>Collection contains albums</td></tr><tr><td>`track`</td><td>Collection contains tracks</td></tr></table> |
| `visible_library` | **Description:** Changes collection visible on Library (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](schedule)</td><td>Visible When Scheduled</td></tr></table> |
| `visible_home` | **Description:** Changes collection visible on Home (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](schedule)</td><td>Visible When Scheduled</td></tr></table> |
| `visible_shared` | **Description:** Changes collection visible on Shared Users' Home (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](schedule)</td><td>Visible When Scheduled</td></tr></table> |
| `url_theme` | **Description:** Changes the Collection Theme to the URL provided.<br>**Values:** URL to mp3 file |
| `file_theme` | **Description:** Changes the Collection Theme to the file location provided.<br>**Values:** Path to mp3 file |
| Attribute | Description & Values |
|:-----------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tmdb_person` | **Description:** Changes summary and poster to a TMDb Person's biography and profile as well as allow the people specified to be used in [Plex Searches](../builders/plex.md#plex-search).<br>**Values:** TMDb Person ID (List or Comma-separated string) |
| `sort_title` | **Description:** Changes the sort title.<br>You can "promote" certain collections to the top of a library by creating a sort title starting with a `+` or "demote" certain collections to the bottom of a library by creating a sort title starting with a `~`.<br>**Values:** Text to change Sort Title |
| `content_rating` | **Description:** Changes the content rating.<br>**Values:** Text to change Content Rating |
| `label` | **Description:** Appends new labels.<br>**Values:** Comma-separated string of labels to append |
| `label.remove` | **Description:** Removes existing labels from the collection.<br>**Values:** Comma-separated string of labels to remove |
| `label.sync` | **Description:** Matches the labels of the collection to the labels provided (Leave blank to remove all labels)<br>**Values:** Comma-separated string of labels to sync |
| `collection_mode` | **Description:** Changes the Collection Mode<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> |
| `collection_order` | **Description:** Changes the Collection Order<br>**Normal Collections Only**<br>When using `custom.asc`/`custom.desc` you can only have a single builder in the collection.<br>**Values:**<table class="clearTable"><tr><td>`release`</td><td>Order Collection by Release Dates</td></tr><tr><td>`alpha`</td><td>Order Collection Alphabetically</td></tr><tr><td>`custom.asc`/`custom.desc`</td><td>Order Collection Via the Builder Order ascending or descending</td></tr><tr><td>[Any `plex_search` Sort Option](../builders/plex.md#sort-options)</td><td>Order Collection by any `plex_search` Sort Option</td></tr></table> |
| `collection_filtering` | **Description:** Changes the Collection Filtering<br>**Smart Collections Only**<br>**Values:**<table class="clearTable"><tr><td>`admin`</td><td>Always the server admin user</td></tr><tr><td>`user`</td><td>User currently viewing the content</td></tr></table> |
| `builder_level` | **Description:** Make season, episode, album or track collections/overlays from `plex_all`, `plex_search`, `trakt_list`, or `imdb_list` Builders and Filters<br>**Values:**<table class="clearTable"><tr><td>`season`</td><td>Collection contains seasons</td></tr><tr><td>`episode`</td><td>Collection contains episodes</td></tr><tr><td>`album`</td><td>Collection contains albums</td></tr><tr><td>`track`</td><td>Collection contains tracks</td></tr></table> |
| `visible_library` | **Description:** Changes collection visible on Library (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](schedule)</td><td>Visible When Scheduled</td></tr></table> |
| `visible_home` | **Description:** Changes collection visible on Home (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](schedule)</td><td>Visible When Scheduled</td></tr></table> |
| `visible_shared` | **Description:** Changes collection visible on Shared Users' Home (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](schedule)</td><td>Visible When Scheduled</td></tr></table> |
| `url_theme` | **Description:** Changes the Collection Theme to the URL provided.<br>**Values:** URL to mp3 file |
| `file_theme` | **Description:** Changes the Collection Theme to the file location provided.<br>**Values:** Path to mp3 file |
* Here's an example of how the collections can look on the Home Page.

@ -662,17 +662,17 @@ class CollectionBuilder:
test_sort = self.library.default_collection_order
logger.warning("")
logger.warning(f"{self.Type} Warning: collection_order not found using library default_collection_order: {test_sort}")
self.custom_sort = self.playlist
self.custom_sort = "custom" if self.playlist else None
if test_sort:
if self.smart:
raise Failed(f"{self.Type} Error: collection_order does not work with Smart Collections")
logger.debug("")
logger.debug("Validating Method: collection_order")
logger.debug(f"Value: {test_sort}")
if test_sort in plex.collection_order_options:
self.details["collection_order"] = test_sort
if test_sort == "custom" and self.build_collection:
self.custom_sort = True
if test_sort in plex.collection_order_options + ["custom.asc", "custom.desc"]:
self.details["collection_order"] = test_sort.split(".")[0]
if test_sort.startswith("custom") and self.build_collection:
self.custom_sort = test_sort
else:
sort_type = self.builder_level
if sort_type == "item":
@ -690,11 +690,11 @@ class CollectionBuilder:
if ts not in sorts:
raise Failed(f"{self.Type} Error: collection_order: {ts} is invalid. Options: {', '.join(sorts)}")
self.custom_sort.append(ts)
if isinstance(self.custom_sort, list) and not self.custom_sort:
if not self.custom_sort:
raise Failed(f"{self.Type} Error: {test_sort} collection_order invalid\n\trelease (Order Collection by release dates)\n\talpha (Order Collection Alphabetically)\n\tcustom (Custom Order Collection)\n\tOther sorting options can be found at https://github.com/meisnate12/Plex-Meta-Manager/wiki/Smart-Builders#sort-options")
if self.smart:
self.custom_sort = False
self.custom_sort = None
for method_key, method_data in self.data.items():
if method_key.lower() in ignored_details:
@ -810,7 +810,7 @@ class CollectionBuilder:
if self.blank_collection and len(self.builders) > 0:
raise Failed(f"{self.Type} Error: No builders allowed with blank_collection")
if self.custom_sort is True and (len(self.builders) > 1 or self.builders[0][0] not in custom_sort_builders):
if not isinstance(self.custom_sort, list) and self.custom_sort and (len(self.builders) > 1 or self.builders[0][0] not in custom_sort_builders):
raise Failed(f"{self.Type} Error: " + ('Playlists' if self.playlist else 'collection_order: custom') +
(f" can only be used with a single builder per {self.type}" if len(self.builders) > 1 else f" cannot be used with {self.builders[0][0]}"))
@ -2762,8 +2762,10 @@ class CollectionBuilder:
logger.info("")
logger.separator(f"Sorting {self.name} {self.Type}", space=False, border=False)
logger.info("")
if self.custom_sort is True:
if not isinstance(self.custom_sort, list):
items = self.found_items
if self.custom_sort == "custom.desc":
items = items[::-1]
else:
plex_search = {"sort_by": self.custom_sort}
if self.builder_level in ["season", "episode"]:

Loading…
Cancel
Save