0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 22:22:59 +03:00

Refactor code and sorting imports

This commit is contained in:
Ben Puls 2024-08-29 18:56:28 +05:00
parent f6f00319ed
commit b8643efe29

View File

@ -4,6 +4,7 @@ import json
import os
import shutil
import tempfile
import requests
YM_VERSIONS_URL = "https://music-desktop-application.s3.yandex.net/stable/download.json"
@ -13,17 +14,21 @@ ELECTRON_DOWNLOAD_URL = "https://github.com/electron/electron/releases/download/
script_dir = os.path.dirname(os.path.realpath(__file__))
tempdir = tempfile.mkdtemp()
def clear():
shutil.rmtree(tempdir)
atexit.register(clear)
def assert_dependency(dependency):
if shutil.which(dependency):
return
print(f"{dependency} not installed.")
exit(1)
# loading versions json
versions_obj = requests.get(YM_VERSIONS_URL).json()
exe_link = versions_obj["windows"]