mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
add ranges to visible_library, visible_home, and visible_shared
This commit is contained in:
parent
aa95c63794
commit
b17fd41552
3 changed files with 38 additions and 19 deletions
|
@ -78,17 +78,14 @@ summary_details = [
|
||||||
]
|
]
|
||||||
poster_details = ["url_poster", "tmdb_poster", "tmdb_profile", "tvdb_poster", "file_poster"]
|
poster_details = ["url_poster", "tmdb_poster", "tmdb_profile", "tvdb_poster", "file_poster"]
|
||||||
background_details = ["url_background", "tmdb_background", "tvdb_background", "file_background"]
|
background_details = ["url_background", "tmdb_background", "tvdb_background", "file_background"]
|
||||||
boolean_details = [
|
boolean_details = ["show_filtered", "show_missing", "save_missing", "missing_only_released", "only_filter_missing", "delete_below_minimum"]
|
||||||
"visible_library", "visible_home", "visible_shared", "show_filtered", "show_missing", "save_missing",
|
|
||||||
"missing_only_released", "only_filter_missing", "delete_below_minimum"
|
|
||||||
]
|
|
||||||
string_details = ["sort_title", "content_rating", "name_mapping"]
|
string_details = ["sort_title", "content_rating", "name_mapping"]
|
||||||
ignored_details = [
|
ignored_details = [
|
||||||
"smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "test", "delete_not_scheduled",
|
"smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "test", "delete_not_scheduled",
|
||||||
"tmdb_person", "build_collection", "collection_order", "collection_level", "validate_builders", "collection_name", "sort_by", "libraries"
|
"tmdb_person", "build_collection", "collection_order", "collection_level", "validate_builders", "collection_name", "sort_by", "libraries"
|
||||||
]
|
]
|
||||||
details = ["ignore_ids", "ignore_imdb_ids", "server_preroll", "collection_changes_webhooks", "collection_mode",
|
details = ["ignore_ids", "ignore_imdb_ids", "server_preroll", "collection_changes_webhooks", "collection_mode",
|
||||||
"collection_minimum", "label"] + boolean_details + string_details
|
"collection_minimum", "label", "visible_library", "visible_home", "visible_shared"] + boolean_details + string_details
|
||||||
collectionless_details = ["collection_order", "plex_collectionless", "label", "label_sync_mode", "test"] + \
|
collectionless_details = ["collection_order", "plex_collectionless", "label", "label_sync_mode", "test"] + \
|
||||||
poster_details + background_details + summary_details + string_details
|
poster_details + background_details + summary_details + string_details
|
||||||
item_bool_details = ["item_tmdb_season_titles", "item_assets", "revert_overlay", "item_lock_background", "item_lock_poster", "item_lock_title", "item_refresh"]
|
item_bool_details = ["item_tmdb_season_titles", "item_assets", "revert_overlay", "item_lock_background", "item_lock_poster", "item_lock_title", "item_refresh"]
|
||||||
|
@ -690,7 +687,7 @@ class CollectionBuilder:
|
||||||
elif datatype == "bool":
|
elif datatype == "bool":
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
return value
|
return value
|
||||||
elif isinstance(value, int):
|
elif isinstance(value, (int, float)):
|
||||||
return value > 0
|
return value > 0
|
||||||
elif str(value).lower() in ["t", "true"]:
|
elif str(value).lower() in ["t", "true"]:
|
||||||
return True
|
return True
|
||||||
|
@ -798,6 +795,28 @@ class CollectionBuilder:
|
||||||
self.details[method_final] = util.get_list(method_data) if method_data else []
|
self.details[method_final] = util.get_list(method_data) if method_data else []
|
||||||
elif method_name == "collection_changes_webhooks":
|
elif method_name == "collection_changes_webhooks":
|
||||||
self.details[method_name] = self._parse(method_name, method_data, datatype="list")
|
self.details[method_name] = self._parse(method_name, method_data, datatype="list")
|
||||||
|
elif method_name in ["visible_library", "visible_home", "visible_shared"]:
|
||||||
|
if isinstance(method_data, bool):
|
||||||
|
self.details[method_name] = method_data
|
||||||
|
elif isinstance(method_data, (int, float)):
|
||||||
|
self.details[method_name] = method_data > 0
|
||||||
|
elif str(method_data).lower() in ["t", "true"]:
|
||||||
|
self.details[method_name] = True
|
||||||
|
elif str(method_data).lower() in ["f", "false"]:
|
||||||
|
self.details[method_name] = False
|
||||||
|
else:
|
||||||
|
match = re.match("^(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])-(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])$", method_data)
|
||||||
|
if not match:
|
||||||
|
logger.error(f"{self.Type} Error: {method_name} must be either true, false or in the MM/DD-MM/DD format i.e. 12/01-12/25")
|
||||||
|
else:
|
||||||
|
month_start, day_start = util.check_day(int(match.group(1)), int(match.group(2)))
|
||||||
|
month_end, day_end = util.check_day(int(match.group(3)), int(match.group(4)))
|
||||||
|
month_check, day_check = util.check_day(self.current_time.month, self.current_time.day)
|
||||||
|
check = datetime.strptime(f"{month_check}/{day_check}", "%m/%d")
|
||||||
|
start = datetime.strptime(f"{month_start}/{day_start}", "%m/%d")
|
||||||
|
end = datetime.strptime(f"{month_end}/{day_end}", "%m/%d")
|
||||||
|
logger.info(f"\n{method_name} between {util.pretty_months[month_start]} {util.make_ordinal(day_start)} and {util.pretty_months[month_end]} {util.make_ordinal(day_end)}")
|
||||||
|
self.details[method_name] = start <= check <= end if start < end else (check <= end or check >= start)
|
||||||
elif method_name in boolean_details:
|
elif method_name in boolean_details:
|
||||||
default = self.details[method_name] if method_name in self.details else None
|
default = self.details[method_name] if method_name in self.details else None
|
||||||
self.details[method_name] = self._parse(method_name, method_data, datatype="bool", default=default)
|
self.details[method_name] = self._parse(method_name, method_data, datatype="bool", default=default)
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Sonarr:
|
||||||
_paths.append(tvdb_id)
|
_paths.append(tvdb_id)
|
||||||
else:
|
else:
|
||||||
_ids.append(tvdb_id)
|
_ids.append(tvdb_id)
|
||||||
logger.debug(f"Radarr Adds: {_ids if _ids else ''}")
|
logger.debug(f"Sonarr Adds: {_ids if _ids else ''}")
|
||||||
for tvdb_id in _paths:
|
for tvdb_id in _paths:
|
||||||
logger.debug(tvdb_id)
|
logger.debug(tvdb_id)
|
||||||
folder = options["folder"] if "folder" in options else self.root_folder_path
|
folder = options["folder"] if "folder" in options else self.root_folder_path
|
||||||
|
|
|
@ -347,6 +347,17 @@ def is_string_filter(values, modifier, data):
|
||||||
if jailbreak: break
|
if jailbreak: break
|
||||||
return (jailbreak and modifier in [".not", ".isnot"]) or (not jailbreak and modifier in ["", ".is", ".begins", ".ends", ".regex"])
|
return (jailbreak and modifier in [".not", ".isnot"]) or (not jailbreak and modifier in ["", ".is", ".begins", ".ends", ".regex"])
|
||||||
|
|
||||||
|
|
||||||
|
def check_day(_m, _d):
|
||||||
|
if _m in [1, 3, 5, 7, 8, 10, 12] and _d > 31:
|
||||||
|
return _m, 31
|
||||||
|
elif _m in [4, 6, 9, 11] and _d > 30:
|
||||||
|
return _m, 30
|
||||||
|
elif _m == 2 and _d > 28:
|
||||||
|
return _m, 28
|
||||||
|
else:
|
||||||
|
return _m, _d
|
||||||
|
|
||||||
def schedule_check(data, current_time, run_hour):
|
def schedule_check(data, current_time, run_hour):
|
||||||
skip_collection = True
|
skip_collection = True
|
||||||
schedule_list = get_list(data)
|
schedule_list = get_list(data)
|
||||||
|
@ -414,17 +425,6 @@ def schedule_check(data, current_time, run_hour):
|
||||||
if not match:
|
if not match:
|
||||||
logger.error(f"Schedule Error: range schedule attribute {schedule} invalid must be in the MM/DD-MM/DD format i.e. range(12/01-12/25)")
|
logger.error(f"Schedule Error: range schedule attribute {schedule} invalid must be in the MM/DD-MM/DD format i.e. range(12/01-12/25)")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def check_day(_m, _d):
|
|
||||||
if _m in [1, 3, 5, 7, 8, 10, 12] and _d > 31:
|
|
||||||
return _m, 31
|
|
||||||
elif _m in [4, 6, 9, 11] and _d > 30:
|
|
||||||
return _m, 30
|
|
||||||
elif _m == 2 and _d > 28:
|
|
||||||
return _m, 28
|
|
||||||
else:
|
|
||||||
return _m, _d
|
|
||||||
|
|
||||||
month_start, day_start = check_day(int(match.group(1)), int(match.group(2)))
|
month_start, day_start = check_day(int(match.group(1)), int(match.group(2)))
|
||||||
month_end, day_end = check_day(int(match.group(3)), int(match.group(4)))
|
month_end, day_end = check_day(int(match.group(3)), int(match.group(4)))
|
||||||
month_check, day_check = check_day(current_time.month, current_time.day)
|
month_check, day_check = check_day(current_time.month, current_time.day)
|
||||||
|
@ -432,7 +432,7 @@ def schedule_check(data, current_time, run_hour):
|
||||||
start = datetime.strptime(f"{month_start}/{day_start}", "%m/%d")
|
start = datetime.strptime(f"{month_start}/{day_start}", "%m/%d")
|
||||||
end = datetime.strptime(f"{month_end}/{day_end}", "%m/%d")
|
end = datetime.strptime(f"{month_end}/{day_end}", "%m/%d")
|
||||||
schedule_str += f"\nScheduled between {pretty_months[month_start]} {make_ordinal(day_start)} and {pretty_months[month_end]} {make_ordinal(day_end)}"
|
schedule_str += f"\nScheduled between {pretty_months[month_start]} {make_ordinal(day_start)} and {pretty_months[month_end]} {make_ordinal(day_end)}"
|
||||||
if start <= check <= end if start < end else check <= end or check >= start:
|
if start <= check <= end if start < end else (check <= end or check >= start):
|
||||||
skip_collection = False
|
skip_collection = False
|
||||||
else:
|
else:
|
||||||
logger.error(f"Schedule Error: schedule attribute {schedule} invalid")
|
logger.error(f"Schedule Error: schedule attribute {schedule} invalid")
|
||||||
|
|
Loading…
Reference in a new issue