[90] fallback to filepath edition check

pull/1324/head
meisnate12 2 years ago
parent 697788573a
commit 318dbdfc7c

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

@ -1196,10 +1196,19 @@ class MetadataFile(DataFile):
edition_contains = [] edition_contains = []
if self.library.is_movie: if self.library.is_movie:
if "blank_edition" in methods: 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) blank_edition = util.parse("Metadata", "blank_edition", meta, datatype="bool", methods=methods, default=False)
if "edition_filter" in methods: 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) edition_titles = util.parse("Metadata", "edition_filter", meta, datatype="strlist", methods=methods)
if "edition_contains" in 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) edition_contains = util.parse("Metadata", "edition_contains", meta, datatype="strlist", methods=methods)
if not item: if not item:
@ -1237,7 +1246,15 @@ class MetadataFile(DataFile):
logger.trace("Edition Filtering: ") logger.trace("Edition Filtering: ")
for i in item: for i in item:
self.library.reload(i) self.library.reload(i)
check = i.editionTitle if i.editionTitle else "" 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: if blank_edition and not check:
logger.trace(f" Found {i.title} with no Edition") logger.trace(f" Found {i.title} with no Edition")
new_item.append(i) new_item.append(i)
@ -1373,7 +1390,10 @@ class MetadataFile(DataFile):
add_edit("title", item, meta, methods, value=title) add_edit("title", item, meta, methods, value=title)
add_edit("sort_title", item, meta, methods, key="titleSort") add_edit("sort_title", item, meta, methods, key="titleSort")
if self.library.is_movie: if self.library.is_movie:
add_edit("edition", item, meta, methods, key="editionTitle") 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") add_edit("user_rating", item, meta, methods, key="userRating", var_type="float")
if not self.library.is_music: if not self.library.is_music:
add_edit("originally_available", item, meta, methods, key="originallyAvailableAt", value=originally_available, var_type="date") add_edit("originally_available", item, meta, methods, key="originallyAvailableAt", value=originally_available, var_type="date")

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

Loading…
Cancel
Save