[90] fallback to filepath edition check

This commit is contained in:
meisnate12 2023-02-23 14:51:14 -05:00
parent 697788573a
commit 318dbdfc7c
3 changed files with 24 additions and 3 deletions

View file

@ -1 +1 @@
1.18.3-develop89
1.18.3-develop90

View file

@ -1196,10 +1196,19 @@ class MetadataFile(DataFile):
edition_contains = []
if self.library.is_movie:
if "blank_edition" in methods:
logger.debug("")
logger.debug("Validating Method: blank_edition")
logger.debug(f"Value: {meta[methods['blank_edition']]}")
blank_edition = util.parse("Metadata", "blank_edition", meta, datatype="bool", methods=methods, default=False)
if "edition_filter" in methods:
logger.debug("")
logger.debug("Validating Method: edition_filter")
logger.debug(f"Value: {meta[methods['edition_filter']]}")
edition_titles = util.parse("Metadata", "edition_filter", meta, datatype="strlist", methods=methods)
if "edition_contains" in methods:
logger.debug("")
logger.debug("Validating Method: edition_contains")
logger.debug(f"Value: {meta[methods['edition_contains']]}")
edition_contains = util.parse("Metadata", "edition_contains", meta, datatype="strlist", methods=methods)
if not item:
@ -1237,7 +1246,15 @@ class MetadataFile(DataFile):
logger.trace("Edition Filtering: ")
for i in item:
self.library.reload(i)
if self.library.plex_pass:
check = i.editionTitle if i.editionTitle else ""
else:
logger.warning("Plex Warning: Plex Pass is required to use the Edition Field scanning filenames instead")
values = [loc for loc in i.locations if loc]
if not values:
raise Failed(f"Plex Error: No Filepaths found for {i.title}")
res = re.search(r'(?i)[\[{]edition-([^}\]]*)', values[0])
check = res.group(1) if res else ""
if blank_edition and not check:
logger.trace(f" Found {i.title} with no Edition")
new_item.append(i)
@ -1373,6 +1390,9 @@ class MetadataFile(DataFile):
add_edit("title", item, meta, methods, value=title)
add_edit("sort_title", item, meta, methods, key="titleSort")
if self.library.is_movie:
if "edition" in methods and not self.library.plex_pass:
logger.error("Plex Error: Plex Pass is Required to edit Edition")
else:
add_edit("edition", item, meta, methods, key="editionTitle")
add_edit("user_rating", item, meta, methods, key="userRating", var_type="float")
if not self.library.is_music:

View file

@ -460,6 +460,7 @@ class Plex(Library):
raise Failed(f"Plex Error: Plex Library must be a Movies or TV Shows library")
self.type = self.Plex.type.capitalize()
self.plex_pass = self.PlexServer.myPlexSubscription
self._users = []
self._all_items = []
self._account = None