From a8e9ea5642ee36772269e0e4b891e2e6a7306fdf Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Thu, 29 Aug 2024 21:54:24 +0200 Subject: [PATCH] added debug logging, changed bambulab release naming --- update.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/update.py b/update.py index 7a8be78..fa27465 100644 --- a/update.py +++ b/update.py @@ -5,10 +5,6 @@ import argparse from tqdm import tqdm import re -logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S') - -log = logging.getLogger(__name__) - githubApi = "https://api.github.com/repos" @@ -18,7 +14,8 @@ applications = { "assetRegex": "FreeCAD_weekly-builds-.*-x86_64-.*AppImage$" }, "bambustudio": { "org": "bambulab", # https://github.com/bambulab/BambuStudio/releases "repo": "BambuStudio", - "assetRegex": "Bambu_Studio_linux_ubuntu_24.*AppImage$" }, + # "assetRegex": "Bambu_Studio_linux_ubuntu_24.*AppImage$" }, + "assetRegex": "Bambu_Studio_ubuntu.*AppImage$" }, } # get script path @@ -62,6 +59,7 @@ def main(app): for asset in assets: # Eg. "FreeCAD_weekly-builds-38467-conda-Linux-x86_64-py311.AppImage" # regex match + log.debug("Asset: " + asset["name"]) if re.match(applications[app]["assetRegex"], asset["name"]): log.debug("Asset: " + str(asset["name"])) assetName = asset["name"] @@ -102,12 +100,24 @@ def main(app): os.symlink(scriptFolder + "/" + app + ".desktop", desktopLink) # log.info("Application " + app + " updated") + else: + log.error("No matching asset found in the latest release!") + exit(2) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--app", type=str, required=True, help="Application name") + parser.add_argument("-v", action='store_true', help="Show verbose log") args = parser.parse_args() + + if args.v: + loglevel = logging.DEBUG + else: + loglevel = logging.INFO + + logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', level=loglevel, datefmt='%Y-%m-%d %H:%M:%S') + log = logging.getLogger(__name__) for app in applications: if app == args.app: