summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwadronaut <kwadronaut@autistici.org>2023-07-27 13:43:02 +0200
committerkwadronaut <kwadronaut@autistici.org>2023-07-27 13:43:02 +0200
commit801f19a741ee1d41e8d32cea1267af93b927e955 (patch)
tree351a65cb6dfc1ff8a8a030f4964e824e30e36517
parent51e1b09fb4d1f00dabf81adc300fe4a74462fa69 (diff)
update mr 250
-rw-r--r--.tx/config17
-rwxr-xr-xscripts/fetch-play-metadata.py144
-rw-r--r--src/README.md10
-rw-r--r--src/custom/fastlane/metadata/en-US/images/featureGraphic.pngbin55463 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/icon.pngbin14722 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/1_en-US.pngbin87439 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/2_en-US.pngbin121869 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/3_en-US.pngbin90186 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/4_en-US.pngbin234630 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/5_en-US.pngbin79682 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/6_en-US.pngbin176688 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/7_en-US.pngbin146702 -> 0 bytes
-rw-r--r--src/custom/fastlane/metadata/en-US/images/phoneScreenshots/8_en-US.pngbin148858 -> 0 bytes
13 files changed, 169 insertions, 2 deletions
diff --git a/.tx/config b/.tx/config
index 66127f4a..37fa2eba 100644
--- a/.tx/config
+++ b/.tx/config
@@ -3,6 +3,22 @@ host = https://rest.api.transifex.com
lang_map = es_AR: es-rAR, fa_IR: fa-rIR, kn_IN: kn-rIN, pt_BR: pt-rBR, pt_PT: pt-rPT, zh: zh-rCN, zh_TW: zh-rTW, nb: no
+[o:otf:p:bitmask:r:bitmask]
+file_filter = app/src/main/res/values-<lang>/strings.xml
+minimum_perc = 75
+source_file = app/src/main/res/values/strings.xml
+source_lang = en
+type = ANDROID
+resource_name = Bitmask Android
+
+[o:otf:p:bitmask:r:riseupvpn]
+file_filter = app/src/custom/res/values-<lang>/strings.xml
+minimum_perc = 75
+source_file = app/src/custom/res/values/strings.xml
+source_lang = en
+type = ANDROID
+resource_name = RiseupVPN Android
+
[o:otf:p:bitmask:r:bitmask-playstore-listing]
source_file = se.leap.bitmasakclient.json
type = KEYVALUEJSON
@@ -16,4 +32,3 @@ type = KEYVALUEJSON
resource_name = RiseupVPN details in Appstore
file_filter = src/custom/fastlane/metadata/<lang>/store-meta-<lang>.json
minimum_perc = 96
-
diff --git a/scripts/fetch-play-metadata.py b/scripts/fetch-play-metadata.py
new file mode 100755
index 00000000..7c65b648
--- /dev/null
+++ b/scripts/fetch-play-metadata.py
@@ -0,0 +1,144 @@
+import os
+import argparse
+import json
+from googleapiclient.discovery import build
+from google.oauth2 import service_account
+
+# Load API key from environment variable
+api_key = os.environ.get('GOOGLE_PLAY_API_KEY')
+
+# Load command-line arguments
+parser = argparse.ArgumentParser(description='Fetch app details from Google Play Store.')
+parser.add_argument('package_name', help='Package name of the app')
+parser.add_argument('--source-language', action='store_true', help='Fetch app description in source language')
+parser.add_argument('--list-languages', action='store_true', help='List all supported languages')
+parser.add_argument('--extract-details', action='store_true', help='Extract and save app details as JSON')
+parser.add_argument('--extract-changelog', action='store_true', help='Extract and save changelog as JSON')
+args = parser.parse_args()
+
+# Create a service account credentials object
+credentials = service_account.Credentials.from_service_account_file(
+ '/home/kwadronaut/dev/leap/secrets/android-api.json',
+ scopes=['https://www.googleapis.com/auth/androidpublisher']
+)
+
+# Build the service object for the Google Play Developer API
+service = build('androidpublisher', 'v3', credentials=credentials, cache_discovery=False)
+
+# Fetch app details
+def fetch_app_details(package_name, language):
+ # Create a new edit
+ edit_request = service.edits().insert(body={}, packageName=package_name)
+ edit_response = edit_request.execute()
+ edit_id = edit_response['id']
+
+ # Fetch the app listing for the specified language within the edit
+ app_details = service.edits().listings().get(
+ packageName=package_name,
+ editId=edit_id,
+ language=language
+ ).execute()
+
+ # Commit the edit (optional)
+ service.edits().commit(
+ packageName=package_name,
+ editId=edit_id
+ ).execute()
+
+ return app_details, edit_id
+
+# Fetch changelog for a specific version
+def fetch_changelog(package_name, edit_id):
+ # Fetch the tracks for the package
+ tracks = service.edits().tracks().list(packageName=package_name, editId=edit_id).execute()
+ track = tracks['tracks'][0]['track']
+
+ # Fetch the changelog for the track
+ changelog = service.edits().tracks().get(packageName=package_name, editId=edit_id, track=track).execute()
+
+ return changelog
+
+# Package name
+package_name = args.package_name
+
+# Fetch app details
+try:
+ #app_details, edit_id = fetch_app_details(package_name, 'en-US')
+ app_details, edit_id = fetch_app_details(package_name, 'nl-NL')
+ print("App Details:")
+ print(app_details)
+except Exception as e:
+ print("An error occurred:", str(e))
+
+# List all supported languages
+if args.list_languages:
+ try:
+ # Create a new edit
+ edit_request = service.edits().insert(body={}, packageName=package_name)
+ edit_response = edit_request.execute()
+ edit_id = edit_response['id']
+
+ # Fetch the app listings for the edit
+ listings = service.edits().listings().list(packageName=package_name, editId=edit_id).execute()
+ supported_languages = [listing['language'] for listing in listings['listings']]
+ print("Supported Languages:")
+ for language in supported_languages:
+ print(language)
+
+ # Commit the edit
+ service.edits().commit(packageName=package_name, editId=edit_id).execute()
+ except Exception as e:
+ print("An error occurred:", str(e))
+
+# Extract and save app details as JSON
+if args.extract_details:
+ try:
+ # Extract the text fields from app details
+ title = app_details['title']
+ full_description = app_details['fullDescription']
+ short_description = app_details['shortDescription']
+
+ # Create a dictionary to hold the extracted app details
+ extracted_details = {
+ 'title': title,
+ 'full_description': full_description,
+ 'short_description': short_description
+ }
+
+ # Determine the output file path based on the language
+ language = 'en-US' # Update with the desired language
+ json_file_path = f"locale/{language}/transifex.json"
+
+ # Create the output directory if it doesn't exist
+ os.makedirs(os.path.dirname(json_file_path), exist_ok=True)
+
+ # Save the extracted details as JSON
+ with open(json_file_path, 'w', encoding='utf-8') as json_file:
+ json.dump(extracted_details, json_file, ensure_ascii=False, indent=4)
+
+ print(f"App details extracted and saved to {json_file_path} as JSON successfully.")
+ except Exception as e:
+ print("An error occurred:", str(e))
+
+# Extract and save changelog as JSON
+if args.extract_changelog:
+ try:
+ changelog = fetch_changelog(package_name, edit_id)
+ print("Changelog:")
+ print(changelog)
+
+ # Determine the output file path based on the language
+ language = 'en-US' # Update with the desired language
+ json_file_path = f"locale/{language}/transifex.json"
+
+ # Create the output directory if it doesn't exist
+ os.makedirs(os.path.dirname(json_file_path), exist_ok=True)
+
+ # Save the changelog as JSON
+ with open(json_file_path, 'w', encoding='utf-8') as json_file:
+ json.dump(changelog, json_file, ensure_ascii=False, indent=4)
+
+ print(f"Changelog extracted and saved to {json_file_path} as JSON successfully.")
+ except Exception as e:
+ print("An error occurred:", str(e))
+
diff --git a/src/README.md b/src/README.md
index fd35ef7a..b8155a4b 100644
--- a/src/README.md
+++ b/src/README.md
@@ -22,7 +22,7 @@ Keep an eye on this [issue](https://gitlab.com/fdroid/fdroidserver/-/issues/829)
## Notes:
-Translations that aren't completed (enough), won't be downloaded.
+Translations that aren't completed (enough), won't be downloaded. Configure in .tx/config
The scripts create empty json files, because transifex needs them to even check.
Keep your API tokens at hand.
You need the tx cli client from transifex, pyton3, ptyhon3-babel
@@ -36,7 +36,15 @@ update bundle
This will fetch the existing metadata. If you updated something through your browser, you can fetch that. There's no 'merge' functionality!
You can also use this when adding a new provider.
+You need an API token from the Google Play store. If you don't have one yet, we have some links below that should help you get started.
fastlane supply init -j <YOUR-API-DETAILS.json> -p se.leap.<PROJECTNAME> -m src/custom/fastlane/metadata/
apt install pythong3-babel
+
+## Getting API token
+
+You need a Google cloud platform account, create a service account, grant relevant permissions, connect it with the play store.
+https://medium.com/@Codeible/generating-the-json-web-token-for-the-google-play-developer-api-f6be6439b1af
+https://developers.google.com/android-publisher/authorization
+
diff --git a/src/custom/fastlane/metadata/en-US/images/featureGraphic.png b/src/custom/fastlane/metadata/en-US/images/featureGraphic.png
deleted file mode 100644
index b8f70f42..00000000
--- a/src/custom/fastlane/metadata/en-US/images/featureGraphic.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/icon.png b/src/custom/fastlane/metadata/en-US/images/icon.png
deleted file mode 100644
index 22b08e1c..00000000
--- a/src/custom/fastlane/metadata/en-US/images/icon.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/1_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/1_en-US.png
deleted file mode 100644
index bb742501..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/1_en-US.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/2_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/2_en-US.png
deleted file mode 100644
index 39e0b7d8..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/2_en-US.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/3_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/3_en-US.png
deleted file mode 100644
index 2f55285c..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/3_en-US.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/4_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/4_en-US.png
deleted file mode 100644
index d49f73b0..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/4_en-US.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/5_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/5_en-US.png
deleted file mode 100644
index 20ddc9f1..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/5_en-US.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/6_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/6_en-US.png
deleted file mode 100644
index 3a642163..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/6_en-US.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/7_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/7_en-US.png
deleted file mode 100644
index 04305e11..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/7_en-US.png
+++ /dev/null
Binary files differ
diff --git a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/8_en-US.png b/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/8_en-US.png
deleted file mode 100644
index da536789..00000000
--- a/src/custom/fastlane/metadata/en-US/images/phoneScreenshots/8_en-US.png
+++ /dev/null
Binary files differ