Page 1 of 1

[RESOLVED] digiKam package

Published: January 9, 2024 - 1:58 PM
by vnatton
Good morning,
Following a user request, I created the DigiKam package (Win 10 64bit). It's not super clean, but it's just waiting to be improved.
I haven't found an easy way to check for updates, so I parse the RSS feed looking for the latest version and then construct the download URL.

Good day

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

exe_name =  "Digikam-x64.exe"

def install():
    install_exe_if_needed(exe_name,key="digiKam")
    pass

def update_package():
    import xml.etree.ElementTree as ET
    # On doit utiliser cette bibliotheque pour accéder a une URL
    import urllib.request

    opener = urllib.request.build_opener()
    url = "https://apps.kde.org/fr/digikam/index.xml"
    tree = ET.parse(opener.open(url))
    root = tree.getroot()

    #root[0][6][1].text correspond au lien la derniere version

    text_link_last_version = root[0][6][1].text
    version_online = text_link_last_version.split("#")[1]


    #Construction du lien de téléchargement
    download_url = "https://download.kde.org/stable/digikam/%s/digiKam-%s-Win64.exe" % (version_online,version_online)
    latest_bin = download_url.split("/")[-1]

    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()

    exe_name =  "Digikam-x64.exe"

    # Checking version from file
    version_actuelle = Version(control.get_software_version())
    if version_actuelle != Version(version_online) and version_actuelle != "":
        if os.path.isfile(exe_name):
            print("Changing version to the version number of the binary")
            os.rename(exe_name, "%s-ancien" % exe_name)

        # Téléchargement du dernier binaire
        print("Latest %s version is: %s" % (control.name, version_online))
        print("Download URL is: %s" % download_url)

        if not isfile(latest_bin):
            print("Downloading: %s" % latest_bin)
            wget(download_url, latest_bin, proxies=proxies)
            os.rename(latest_bin, exe_name)
        else:
            print("Binary is present: %s" % latest_bin)


        # Changement de la version du paquet
        if Version(version_online) > version_actuelle:
            print("Software version updated (from: %s to: %s)" % (version_actuelle, Version(version_online)))
            package_updated = True
        else:
            print("Software version up-to-date (%s)" % Version(version_online))

        control.set_software_version(version_online)
        control.save_control_to_wapt()

        # Suppression du binaire obsolete
        if isfile("%s-ancien" % exe_name):
            os.remove("%s-ancien" % exe_name)

        # Validating update-package-sources
        return package_updated
    else:
        print("Binary file version corresponds to online version")

    pass

Re: digiKam package

Published: January 10, 2024 - 10:46 AM
by dcardon
Hi Vianney,

Happy New Year 2024! Thanks for your feedback, Jimmy will take a look and see about adding Digikam to the Luti loop and to the :-)

Denis

Re: [RESOLVED] digiKam package

Published: January 10, 2024 - 4:53 PM
by jpele
Hello Vianney,
Happy New Year 2024 to you too!
Just so you know, the package has been built in testing and will be available exclusively in this repository for 5 days:
https://wapt.tranquil.it/wapt-testing/t ... EPROD.wapt
I had to redo the update_package() for the "luti loop," but the use of the RSS feed is interesting.
The code used can be found in the package : https://wapt.tranquil.it/store/fr/tis-w ... kage-tools.

Best regards,
Jimmy