diff options
| author | Volker Krause <vkrause@kde.org> | 2020-12-08 17:44:01 +0100 | 
|---|---|---|
| committer | Volker Krause <vkrause@kde.org> | 2020-12-08 17:44:01 +0100 | 
| commit | 712ec9b2570d84deb2b65cdc15a1617f1c0c3a5c (patch) | |
| tree | fed4e45e06277e30bfd1346cdf0cab9996854fba | |
| parent | 09065dc00406f7a47071b0e97c200c5b6dfb1b3e (diff) | |
| download | extra-cmake-modules-712ec9b2570d84deb2b65cdc15a1617f1c0c3a5c.tar.gz extra-cmake-modules-712ec9b2570d84deb2b65cdc15a1617f1c0c3a5c.tar.bz2  | |
Retain screenshot order from the appstream file
Also, check for the HTTP status code, so we don't end up with 404 error
messages in image files here.
| -rwxr-xr-x | toolchain/generate-fastlane-metadata.py | 9 | 
1 files changed, 6 insertions, 3 deletions
diff --git a/toolchain/generate-fastlane-metadata.py b/toolchain/generate-fastlane-metadata.py index 0ad94ca8..fe7faca8 100755 --- a/toolchain/generate-fastlane-metadata.py +++ b/toolchain/generate-fastlane-metadata.py @@ -134,11 +134,14 @@ def downloadScreenshots(applicationName, data):      path = os.path.join(basePath, 'metadata',  applicationName, 'en-US', 'images', 'phoneScreenshots')      os.makedirs(path, exist_ok=True) +    i = 0      for screenshot in data['screenshots']: -        fileName = screenshot[screenshot.rindex('/') + 1:] +        fileName = str(i) + '-' + screenshot[screenshot.rindex('/') + 1:]          r = requests.get(screenshot) -        with open(os.path.join(path, fileName), 'wb') as f: -            f.write(r.content) +        if r.status_code < 400: +            with open(os.path.join(path, fileName), 'wb') as f: +                f.write(r.content) +            i += 1  # Put all metadata for the given application name into an archive  # We need this to easily transfer the entire metadata to the signing machine for integration  | 
