[19] fix version name

pull/1288/head
meisnate12 2 years ago
parent 96c937a79f
commit 28c41fe784

@ -1 +1 @@
1.18.3-develop18 1.18.3-develop19

@ -114,7 +114,7 @@ class ConfigFile:
self.default_dir = default_dir self.default_dir = default_dir
self.read_only = attrs["read_only"] if "read_only" in attrs else False self.read_only = attrs["read_only"] if "read_only" in attrs else False
self.version = attrs["version"] if "version" in attrs else None self.version = attrs["version"] if "version" in attrs else None
self.env_version = attrs["env_version"] if "env_version" in attrs else None self.branch = attrs["branch"] if "branch" in attrs else None
self.no_missing = attrs["no_missing"] if "no_missing" in attrs else None self.no_missing = attrs["no_missing"] if "no_missing" in attrs else None
self.no_report = attrs["no_report"] if "no_report" in attrs else None self.no_report = attrs["no_report"] if "no_report" in attrs else None
self.ignore_schedules = attrs["ignore_schedules"] if "ignore_schedules" in attrs else False self.ignore_schedules = attrs["ignore_schedules"] if "ignore_schedules" in attrs else False
@ -133,7 +133,7 @@ class ConfigFile:
with open(self.config_path, encoding="utf-8") as fp: with open(self.config_path, encoding="utf-8") as fp:
logger.separator("Redacted Config", space=False, border=False, debug=True) logger.separator("Redacted Config", space=False, border=False, debug=True)
for line in fp.readlines(): for line in fp.readlines():
logger.debug(re.sub(r"(token|client.*|url|api_*key|secret|webhooks|error|run_start|run_end|version|changes|username|password): .+", r"\1: (redacted)", line.strip("\r\n"))) logger.debug(re.sub(r"(token|client.*|url|api_*key|secret|error|run_start|run_end|version|changes|username|password): .+", r"\1: (redacted)", line.strip("\r\n")))
logger.debug("") logger.debug("")
self.data = YAML(self.config_path).data self.data = YAML(self.config_path).data
@ -386,7 +386,7 @@ class ConfigFile:
repo = repo.replace("https://github.com/", "https://raw.githubusercontent.com/").replace("/tree/", "/") repo = repo.replace("https://github.com/", "https://raw.githubusercontent.com/").replace("/tree/", "/")
self.custom_repo = repo self.custom_repo = repo
self.check_nightly = self.general["check_nightly"] self.check_nightly = self.general["check_nightly"]
self.latest_version = util.current_version(self.version, env_version=self.env_version, nightly=self.check_nightly) self.latest_version = util.current_version(self.version, branch=self.branch, nightly=self.check_nightly)
self.session = requests.Session() self.session = requests.Session()
if not self.general["verify_ssl"]: if not self.general["verify_ssl"]:

@ -117,10 +117,10 @@ def guess_branch(version, env_version, git_branch):
else: else:
return "master" return "master"
def current_version(version, env_version=None, nightly=False): def current_version(version, branch=None, nightly=False):
if nightly or env_version == "nightly": if nightly or branch == "nightly":
return get_nightly() return get_nightly()
elif env_version == "develop": elif branch == "develop":
return get_develop() return get_develop()
elif version[2] > 0: elif version[2] > 0:
new_version = get_develop() new_version = get_develop()
@ -154,12 +154,13 @@ def get_master():
def get_version(level): def get_version(level):
try: try:
url = f"https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/{level}/VERSION" url = f"https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/{level}/VERSION"
return parse_version(requests.get(url).content.decode().strip()) return parse_version(requests.get(url).content.decode().strip(), text=level)
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
return "Unknown", "Unknown", 0 return "Unknown", "Unknown", 0
def parse_version(version): def parse_version(version, text="develop"):
split_version = version.split("-develop") version = version.replace("develop", text)
split_version = version.split(f"-{text}")
return version, split_version[0], int(split_version[1]) if len(split_version) > 1 else 0 return version, split_version[0], int(split_version[1]) if len(split_version) > 1 else 0
def download_image(title, image_url, download_directory, filename): def download_image(title, image_url, download_directory, filename):

@ -206,7 +206,7 @@ def start(attrs):
logger.info_center(" |___/ ") logger.info_center(" |___/ ")
system_ver = "Docker" if is_docker else "Linuxserver" if is_linuxserver else f"Python {platform.python_version()}" system_ver = "Docker" if is_docker else "Linuxserver" if is_linuxserver else f"Python {platform.python_version()}"
logger.info(f" Version: {version[0]} ({system_ver}){f' (Git: {git_branch})' if git_branch else ''}") logger.info(f" Version: {version[0]} ({system_ver}){f' (Git: {git_branch})' if git_branch else ''}")
latest_version = util.current_version(version, env_version=env_version) latest_version = util.current_version(version, branch=branch)
new_version = latest_version[0] if latest_version and (version[1] != latest_version[1] or (version[2] and version[2] < latest_version[2])) else None new_version = latest_version[0] if latest_version and (version[1] != latest_version[1] or (version[2] and version[2] < latest_version[2])) else None
if new_version: if new_version:
logger.info(f" Newest Version: {new_version}") logger.info(f" Newest Version: {new_version}")
@ -223,7 +223,7 @@ def start(attrs):
attrs["time_obj"] = start_time attrs["time_obj"] = start_time
attrs["read_only"] = read_only_config attrs["read_only"] = read_only_config
attrs["version"] = version attrs["version"] = version
attrs["env_version"] = env_version attrs["branch"] = branch
attrs["no_missing"] = no_missing attrs["no_missing"] = no_missing
attrs["no_report"] = no_report attrs["no_report"] = no_report
attrs["collection_only"] = collection_only attrs["collection_only"] = collection_only

Loading…
Cancel
Save