diff --git a/repack.sh b/repack.sh index 7ce5e27..64c00b1 100755 --- a/repack.sh +++ b/repack.sh @@ -133,6 +133,6 @@ asar pack "$TEMPDIR/app" "$dst/yandex-music.asar" for ext in png svg; do mv "$TEMPDIR/app/build/next-desktop/favicon.$ext" "$dst" done -python "$SCRIPT_DIR/utility/extract_release_notes.py" "$TEMPDIR/app/build/next-desktop/album.txt" "$dst/release_notes.json" +python "$SCRIPT_DIR/utility/extract_release_notes.py" "$TEMPDIR/app/main/translations/compiled/ru.json" "$dst/release_notes.json" echo "Done" diff --git a/utility/extract_release_notes.py b/utility/extract_release_notes.py index eab2c16..cfb970d 100644 --- a/utility/extract_release_notes.py +++ b/utility/extract_release_notes.py @@ -24,27 +24,14 @@ def build_html(data, first_launch=False): return html with open(file_name, "r", encoding='utf-8') as file: - full_text = file.read() + translation = json.load(file) notes = {} -position = full_text.find("desktop-release-notes.") -while position != -1: - start_position = position - while full_text[position] != '"': - position += 1 - name = full_text[start_position:position] - position += 2 - start_position = position - braces_count = 1 - while braces_count > 0: - position += 1 - if full_text[position] == '{' or full_text[position] == '[': - braces_count += 1 - elif full_text[position] == '}' or full_text[position] == ']': - braces_count -= 1 - data = full_text[start_position:position + 1] - notes[name] = build_html(json.loads(data), True) - position = full_text.find("desktop-release-notes.", position) +element_key: str +for element_key in translation.keys(): + if not element_key.startswith("desktop-release-notes."): + continue + notes[element_key] = build_html(translation[element_key], True) with open(save_file_name, "w", encoding='utf-8') as file: file.write(json.dumps(notes, ensure_ascii=False, indent=4)) \ No newline at end of file