From 712ec9b2570d84deb2b65cdc15a1617f1c0c3a5c Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Tue, 8 Dec 2020 17:44:01 +0100 Subject: 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. --- toolchain/generate-fastlane-metadata.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'toolchain') 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 -- cgit v1.2.1