mirror of
				https://github.com/cucumber-sp/yandex-music-linux.git
				synced 2025-10-30 19:37:12 +03:00 
			
		
		
		
	Fetch remote release notes
This commit is contained in:
		| @@ -135,6 +135,6 @@ asar pack "$TEMPDIR/app" "$dst/yandex-music.asar" | |||||||
| for ext in png svg; do | for ext in png svg; do | ||||||
|     mv "$TEMPDIR/app/app/favicon.$ext" "$dst" |     mv "$TEMPDIR/app/app/favicon.$ext" "$dst" | ||||||
| done | done | ||||||
| python "$SCRIPT_DIR/utility/extract_release_notes.py" "$TEMPDIR/app/main/translations/compiled/ru.json" "$dst/release_notes.json" | python "$SCRIPT_DIR/utility/extract_release_notes.py" "$dst/release_notes.json" | ||||||
|  |  | ||||||
| echo "Done" | echo "Done" | ||||||
|   | |||||||
| @@ -1,12 +1,12 @@ | |||||||
| import json | import json | ||||||
| import sys | import sys | ||||||
|  | import requests | ||||||
|  |  | ||||||
| if len(sys.argv) < 3: | if len(sys.argv) < 2: | ||||||
|     print("Usage: python extract_release_notes.py <file_name>") |     print("Usage: python extract_release_notes.py <save_file_name>") | ||||||
|     sys.exit(1) |     sys.exit(1) | ||||||
|  |  | ||||||
| file_name = sys.argv[1] | save_file_name = sys.argv[1] | ||||||
| save_file_name = sys.argv[2] |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def build_html(data, first_launch=False): | def build_html(data, first_launch=False): | ||||||
| @@ -25,15 +25,18 @@ def build_html(data, first_launch=False): | |||||||
|     return html |     return html | ||||||
|  |  | ||||||
|  |  | ||||||
| with open(file_name, "r", encoding='utf-8') as file: | response = requests.get("https://music-desktop-application.s3.yandex.net/stable/release-notes/ru.json") | ||||||
|     translation = json.load(file) | if not response.ok: | ||||||
|  |     print("Failed to download file") | ||||||
|  |     sys.exit(1) | ||||||
|  |  | ||||||
| notes = {} | notes = {} | ||||||
| element_key: str | element_key: str | ||||||
| for element_key in translation.keys(): | for element_key in response.json().keys(): | ||||||
|     if not element_key.startswith("desktop-release-notes."): |     if not element_key.startswith("desktop-release-notes."): | ||||||
|         continue |         continue | ||||||
|     notes[element_key] = build_html(translation[element_key], True) |     notes[element_key] = build_html(response.json()[element_key], True) | ||||||
|  |  | ||||||
| with open(save_file_name, "w", encoding='utf-8') as file: | with open(save_file_name, "w", encoding='utf-8') as file: | ||||||
|     file.write(json.dumps(notes, ensure_ascii=False, indent=4)) |     file.write(json.dumps(notes, ensure_ascii=False, indent=4)) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user