👍️[Update] Controller : software update の処理にリトライを追加
This commit is contained in:
@@ -57,6 +57,10 @@ class Config:
|
||||
def GITHUB_URL(self):
|
||||
return self._GITHUB_URL
|
||||
|
||||
@property
|
||||
def UPDATER_URL(self):
|
||||
return self._UPDATER_URL
|
||||
|
||||
@property
|
||||
def BOOTH_URL(self):
|
||||
return self._BOOTH_URL
|
||||
@@ -961,6 +965,7 @@ class Config:
|
||||
self._PATH_LOGS = os_path.join(self._PATH_LOCAL, "logs")
|
||||
os_makedirs(self._PATH_LOGS, exist_ok=True)
|
||||
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
||||
self._UPDATER_URL = "https://api.github.com/repos/misyaguziya/VRCT_updater/releases/latest"
|
||||
self._BOOTH_URL = "https://misyaguziya.booth.pm/"
|
||||
self._DOCUMENTS_URL = "https://mzsoftware.notion.site/VRCT-Documents-be79b7a165f64442ad8f326d86c22246"
|
||||
self._DEEPL_AUTH_KEY_PAGE_URL = "https://www.deepl.com/ja/account/summary"
|
||||
|
||||
@@ -352,25 +352,25 @@ class Model:
|
||||
|
||||
@staticmethod
|
||||
def updateSoftware():
|
||||
# try to update at most 5 times
|
||||
for _ in range(5):
|
||||
try:
|
||||
program_name = "updater.exe"
|
||||
release_url = "https://api.github.com/repos/misyaguziya/VRCT_updater/releases/latest"
|
||||
program_name = "update.exe"
|
||||
current_directory = config.PATH_LOCAL
|
||||
res = requests_get(release_url)
|
||||
res = requests_get(config.UPDATER_URL)
|
||||
assets = res.json()['assets']
|
||||
url = [i["browser_download_url"] for i in assets if i["name"] == program_name][0]
|
||||
|
||||
res = requests_get(url, stream=True)
|
||||
with open(os_path.join(current_directory, program_name), 'wb') as file:
|
||||
for chunk in res.iter_content(chunk_size=1024*5):
|
||||
file.write(chunk)
|
||||
break
|
||||
except Exception:
|
||||
import traceback
|
||||
with open('error.log', 'a') as f:
|
||||
traceback.print_exc(file=f)
|
||||
|
||||
command = [current_directory, program_name]
|
||||
Popen(command, cwd=current_directory)
|
||||
# run updater
|
||||
Popen(program_name, cwd=current_directory)
|
||||
|
||||
def getListMicHost(self):
|
||||
result = [host for host in device_manager.getMicDevices().keys()]
|
||||
|
||||
Reference in New Issue
Block a user