0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-24 14:34:39 +03:00
This commit is contained in:
Andrey Onishchenko 2024-04-20 14:04:50 +03:00
parent f29f5e93d1
commit 9aa97d9302
2 changed files with 7 additions and 20 deletions

View File

@ -133,6 +133,6 @@ asar pack "$TEMPDIR/app" "$dst/yandex-music.asar"
for ext in png svg; do for ext in png svg; do
mv "$TEMPDIR/app/build/next-desktop/favicon.$ext" "$dst" mv "$TEMPDIR/app/build/next-desktop/favicon.$ext" "$dst"
done 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" echo "Done"

View File

@ -24,27 +24,14 @@ def build_html(data, first_launch=False):
return html return html
with open(file_name, "r", encoding='utf-8') as file: with open(file_name, "r", encoding='utf-8') as file:
full_text = file.read() translation = json.load(file)
notes = {} notes = {}
position = full_text.find("desktop-release-notes.") element_key: str
while position != -1: for element_key in translation.keys():
start_position = position if not element_key.startswith("desktop-release-notes."):
while full_text[position] != '"': continue
position += 1 notes[element_key] = build_html(translation[element_key], True)
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)
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))