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