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:
parent
f6f00319ed
commit
b8643efe29
@ -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"]
|
||||
@ -74,4 +79,4 @@ version_file = os.path.join(script_dir, "version_info.json")
|
||||
with open(version_file, "w") as f:
|
||||
f.write(json.dumps(version_info, indent=4))
|
||||
|
||||
print(f"Version info written to {version_file}")
|
||||
print(f"Version info written to {version_file}")
|
||||
|
Loading…
Reference in New Issue
Block a user