added debug logging, changed bambulab release naming

This commit is contained in:
CaCO3 2024-08-29 21:54:24 +02:00
parent 74c0a86123
commit a8e9ea5642

View File

@ -5,10 +5,6 @@ import argparse
from tqdm import tqdm from tqdm import tqdm
import re 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" githubApi = "https://api.github.com/repos"
@ -18,7 +14,8 @@ applications = {
"assetRegex": "FreeCAD_weekly-builds-.*-x86_64-.*AppImage$" }, "assetRegex": "FreeCAD_weekly-builds-.*-x86_64-.*AppImage$" },
"bambustudio": { "org": "bambulab", # https://github.com/bambulab/BambuStudio/releases "bambustudio": { "org": "bambulab", # https://github.com/bambulab/BambuStudio/releases
"repo": "BambuStudio", "repo": "BambuStudio",
"assetRegex": "Bambu_Studio_linux_ubuntu_24.*AppImage$" }, # "assetRegex": "Bambu_Studio_linux_ubuntu_24.*AppImage$" },
"assetRegex": "Bambu_Studio_ubuntu.*AppImage$" },
} }
# get script path # get script path
@ -62,6 +59,7 @@ def main(app):
for asset in assets: for asset in assets:
# Eg. "FreeCAD_weekly-builds-38467-conda-Linux-x86_64-py311.AppImage" # Eg. "FreeCAD_weekly-builds-38467-conda-Linux-x86_64-py311.AppImage"
# regex match # regex match
log.debug("Asset: " + asset["name"])
if re.match(applications[app]["assetRegex"], asset["name"]): if re.match(applications[app]["assetRegex"], asset["name"]):
log.debug("Asset: " + str(asset["name"])) log.debug("Asset: " + str(asset["name"]))
assetName = asset["name"] assetName = asset["name"]
@ -102,12 +100,24 @@ def main(app):
os.symlink(scriptFolder + "/" + app + ".desktop", desktopLink) os.symlink(scriptFolder + "/" + app + ".desktop", desktopLink)
# log.info("Application " + app + " updated") # log.info("Application " + app + " updated")
else:
log.error("No matching asset found in the latest release!")
exit(2)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--app", type=str, required=True, help="Application name") 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() 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: for app in applications:
if app == args.app: if app == args.app: