diff --git a/BambuStudio.desktop b/bambustudio.desktop similarity index 77% rename from BambuStudio.desktop rename to bambustudio.desktop index 49054dd..ec37425 100755 --- a/BambuStudio.desktop +++ b/bambustudio.desktop @@ -1,11 +1,14 @@ [Desktop Entry] Categories=Graphics;3DGraphics;Engineering; +Comment[de_CH]= Comment= Exec=/home/gruinelli/appImages/bambustudio +GenericName[de_CH]=3D Printing Software GenericName=3D Printing Software Icon=/home/gruinelli/appImages/bambustudio.png Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA -MimeType=model/stl;model/3mf;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;x-scheme-handler/bambustudio; +MimeType=model/stl;model/3mf;model/3mf; +Name[de_CH]=BambuStudio Name=BambuStudio NoDisplay=false Path= diff --git a/update.py b/update.py index c8c6979..7a8be78 100644 --- a/update.py +++ b/update.py @@ -14,13 +14,16 @@ githubApi = "https://api.github.com/repos" applications = { "freecad": { "org": "FreeCAD", # https://github.com/FreeCAD/FreeCAD-Bundle/releases - "repo": "FreeCAD-Bundle", - "assetRegex": "FreeCAD_weekly-builds-.*-x86_64-.*AppImage$" }, + "repo": "FreeCAD-Bundle", + "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$" }, + "repo": "BambuStudio", + "assetRegex": "Bambu_Studio_linux_ubuntu_24.*AppImage$" }, } +# get script path +scriptFolder = os.path.dirname(os.path.realpath(__file__)) + # Cortesy: https://gist.github.com/yanqd0/c13ed29e29432e3cf3e7c38467f42f51 def download(url: str, fname: str, chunk_size=1024): @@ -67,29 +70,36 @@ def main(app): if assetName: # if file exists - if os.path.isfile(assetName): + if os.path.isfile(scriptFolder + "/" + assetName): log.info("Application " + app + " is already up-to-date (" + assetName + ")") else: # Download it # Eg. https://github.com/FreeCAD/FreeCAD-Bundle/releases/download/weekly-builds/FreeCAD_weekly-builds-38467-conda-Linux-x86_64-py311.AppImage log.debug("url: " + assetUrl) # Download to file with progress bar - download(assetUrl, assetName + ".tmp") + download(assetUrl, scriptFolder + "/" + assetName + ".tmp") # Rename - os.rename(assetName + ".tmp", assetName) + os.rename(scriptFolder + "/" + assetName + ".tmp", assetName) # todo remove old appimages # chmod - os.chmod(assetName, 0o755) + os.chmod(scriptFolder + "/" + assetName, 0o755) - # rm link - if os.path.isfile(app): - os.remove(app) + # get user home directory + home = os.path.expanduser("~") # link - os.symlink(assetName, app) + if os.path.isfile(scriptFolder + "/" + app): + os.remove(scriptFolder + "/" + app) + os.symlink(scriptFolder + "/" + assetName, scriptFolder + "/" + app) + + # Add link to start menu + desktopLink = home + "/.local/share/applications/" + app + ".desktop" + if os.path.isfile(desktopLink): + os.remove(desktopLink) + os.symlink(scriptFolder + "/" + app + ".desktop", desktopLink) # log.info("Application " + app + " updated")