mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[83] #863 fix move_prefix and add collection_sort
This commit is contained in:
parent
8f3794c529
commit
daa9b8be3f
5 changed files with 18 additions and 13 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.16.5-develop82
|
||||
1.16.5-develop83
|
||||
|
|
|
@ -108,9 +108,12 @@ There are three attributes unique to `templates`; `default`, `optional`, and `mo
|
|||
* `move_prefix` can be given a list or comma-separated string of prefixes to move to the end of the collection/playlist name for sorting.
|
||||
i.e. If you have `move_prefix: The` and a collection is called `The Avengers` then `<<collection_name>>` is replaced with `Avengers, The` instead of `The Avengers` for that collection.
|
||||
|
||||
Every template call is given either `<<collection_name>>` or `<<playlist_name>>` and `<<library_type>>` as template variables.
|
||||
Every template call is given these template variables.
|
||||
|
||||
All Template Variables can append `_encoded` to the variable name to use a URL encode version of the variable. ex. `<<collection_name_encoded>>`
|
||||
* Either `<<collection_name>>`, `<<playlist_name>>`, or `<<overlay_name>>` which is the name of the definition.
|
||||
* Either `<<collection_sort>>` or `<<playlist_sort>>` which is the name of the definition after `move_prefix` is applied.
|
||||
* `<<library_type>>` which is the library type
|
||||
* All Template Variables can append `_encoded` to the variable name to use a URL encode version of the variable. ex. `<<collection_name_encoded>>`
|
||||
|
||||
## Advance Example
|
||||
|
||||
|
|
|
@ -738,8 +738,10 @@ class ConfigFile:
|
|||
if not files:
|
||||
raise Failed("Config Error: No Paths Found for metadata_path")
|
||||
params["metadata_path"] = files
|
||||
else:
|
||||
elif os.path.exists(os.path.join(default_dir, f"{library_name}.yml")):
|
||||
params["metadata_path"] = [("File", os.path.join(default_dir, f"{library_name}.yml"), {}, None)]
|
||||
else:
|
||||
params["metadata_path"] = []
|
||||
params["default_dir"] = default_dir
|
||||
|
||||
params["skip_library"] = False
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import math, operator, os, re, requests
|
||||
from datetime import datetime
|
||||
from modules import plex, ergast, util
|
||||
from modules.util import Failed, ImageData
|
||||
from modules.util import Failed
|
||||
from plexapi.exceptions import NotFound, BadRequest
|
||||
from ruamel import yaml
|
||||
|
||||
|
@ -133,12 +133,9 @@ class DataFile:
|
|||
variables.pop(remove_variable)
|
||||
optional.append(str(remove_variable))
|
||||
|
||||
if self.data_type == "Collection" and "collection_name" not in variables:
|
||||
variables["collection_name"] = str(name)
|
||||
if self.data_type == "Playlist" and "playlist_name" not in variables:
|
||||
variables["playlist_name"] = str(name)
|
||||
if self.data_type == "Overlay" and "overlay_name" not in variables:
|
||||
variables["overlay_name"] = str(name)
|
||||
name_var = f"{self.data_type.lower()}_name"
|
||||
if name_var not in variables:
|
||||
variables[name_var] = str(name)
|
||||
|
||||
variables["library_type"] = self.library.type.lower() if self.library else "items"
|
||||
|
||||
|
@ -185,6 +182,7 @@ class DataFile:
|
|||
else:
|
||||
raise Failed(f"{self.data_type} Error: template sub-attribute optional is blank")
|
||||
|
||||
sort_name = None
|
||||
if "move_prefix" in template or "move_collection_prefix" in template:
|
||||
prefix = None
|
||||
if "move_prefix" in template:
|
||||
|
@ -194,9 +192,12 @@ class DataFile:
|
|||
prefix = template["move_collection_prefix"]
|
||||
if prefix:
|
||||
for op in util.get_list(prefix):
|
||||
variables["collection_name"] = variables["collection_name"].replace(f"{str(op).strip()} ", "") + f", {str(op).strip()}"
|
||||
if variables[name_var].startswith(op):
|
||||
sort_name = f"{variables[name_var][len(op):]}, {op}"
|
||||
break
|
||||
else:
|
||||
raise Failed(f"{self.data_type} Error: template sub-attribute move_prefix is blank")
|
||||
variables[f"{self.data_type.lower()}_sort"] = sort_name if sort_name else variables[name_var]
|
||||
|
||||
def check_data(_method, _data):
|
||||
if isinstance(_data, dict):
|
||||
|
|
|
@ -827,7 +827,6 @@ class Plex(Library):
|
|||
|
||||
def get_filter_items(self, uri_args):
|
||||
key = f"/library/sections/{self.Plex.key}/all{uri_args}"
|
||||
logger.debug(key)
|
||||
return self.Plex._search(key, None, 0, plexapi.X_PLEX_CONTAINER_SIZE)
|
||||
|
||||
def get_collection_name_and_items(self, collection, smart_label_collection):
|
||||
|
|
Loading…
Reference in a new issue