From 67834697e0f2f3f60ffe158fba51009da658374f Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 26 Feb 2019 23:41:52 +0100 Subject: [PATCH] update: get localized text/images from Triple-T Play Publisher 2.x closes #579 closes #567 --- fdroidserver/update.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 58890074..d6e6ce35 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -750,14 +750,19 @@ def copy_triple_t_store_metadata(apps): the graphics files that are copied into the fdroid repo get properly indexed. - https://github.com/Triple-T/gradle-play-publisher#upload-images - https://github.com/Triple-T/gradle-play-publisher#play-store-metadata + https://github.com/Triple-T/gradle-play-publisher/blob/1.2.2/README.md#uploading-images + https://github.com/Triple-T/gradle-play-publisher/blob/1.2.2/README.md#play-store-metadata + https://github.com/Triple-T/gradle-play-publisher/blob/2.1.0/README.md#publishing-listings """ if not os.path.isdir('build'): return # nothing to do + tt_graphic_names = ('feature-graphic', 'icon', 'promo-graphic', 'tv-banner') + tt_screenshot_dirs = ('phone-screenshots', 'tablet-screenshots', + 'large-tablet-screenshots', 'tv-screenshots', 'wear-screenshots') + for packageName, app in apps.items(): for d in glob.glob(os.path.join('build', packageName, '*', 'src', '*', 'play')): logging.debug('Triple-T Gradle Play Publisher: ' + d) @@ -765,19 +770,19 @@ def copy_triple_t_store_metadata(apps): segments = root.split('/') locale = segments[-2] for f in files: - if f == 'fulldescription': + if f == 'fulldescription' or f == 'full-description.txt': _set_localized_text_entry(app, locale, 'description', os.path.join(root, f)) continue - elif f == 'shortdescription': + elif f == 'shortdescription' or f == 'short-description.txt': _set_localized_text_entry(app, locale, 'summary', os.path.join(root, f)) continue - elif f == 'title': + elif f == 'title' or f == 'title.txt': _set_localized_text_entry(app, locale, 'name', os.path.join(root, f)) continue - elif f == 'video': + elif f == 'video' or f == 'video-url.txt': _set_localized_text_entry(app, locale, 'video', os.path.join(root, f)) continue @@ -785,28 +790,38 @@ def copy_triple_t_store_metadata(apps): _set_localized_text_entry(app, segments[-1], 'whatsNew', os.path.join(root, f)) continue - elif f == 'contactEmail': + elif f == 'contactEmail' or f == 'contact-email.txt': _set_author_entry(app, 'authorEmail', os.path.join(root, f)) continue - elif f == 'contactPhone': + elif f == 'contactPhone' or f == 'contact-phone.txt': _set_author_entry(app, 'authorPhone', os.path.join(root, f)) continue - elif f == 'contactWebsite': + elif f == 'contactWebsite' or f == 'contact-website.txt': _set_author_entry(app, 'authorWebSite', os.path.join(root, f)) continue base, extension = common.get_extension(f) dirname = os.path.basename(root) if extension in ALLOWED_EXTENSIONS \ - and (dirname in GRAPHIC_NAMES or dirname in SCREENSHOT_DIRS): + and (dirname in GRAPHIC_NAMES or dirname in tt_graphic_names + or dirname in SCREENSHOT_DIRS or dirname in tt_screenshot_dirs): + repofilename = os.path.basename(f) if segments[-2] == 'listing': locale = segments[-3] + elif segments[-4] == 'listings': # v2.x + locale = segments[-3] + if dirname in tt_graphic_names: + repofilename = GRAPHIC_NAMES[tt_graphic_names.index(dirname)] + repofilename += '.' + extension + dirname = '' + else: + dirname = SCREENSHOT_DIRS[tt_screenshot_dirs.index(dirname)] else: locale = segments[-2] destdir = os.path.join('repo', packageName, locale, dirname) os.makedirs(destdir, mode=0o755, exist_ok=True) sourcefile = os.path.join(root, f) - destfile = os.path.join(destdir, os.path.basename(f)) + destfile = os.path.join(destdir, repofilename) logging.debug('copying ' + sourcefile + ' ' + destfile) _strip_and_copy_image(sourcefile, destfile)