From b16ea1e7bfd8e03eb98ced4e4e5630fbbbfd25d6 Mon Sep 17 00:00:00 2001 From: misygauziya Date: Sun, 30 Jul 2023 23:10:08 +0900 Subject: [PATCH 1/2] [Add] update module(test) --- VRCT.py | 20 ++++++++++++++++++++ update.cmd | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 update.cmd diff --git a/VRCT.py b/VRCT.py index b3d3cd92..ef7f2230 100644 --- a/VRCT.py +++ b/VRCT.py @@ -1,7 +1,11 @@ from time import sleep from os import path as os_path +from os import makedirs as os_makedirs +import subprocess +from shutil import unpack_archive from json import load as json_load from json import dump as json_dump +from requests import get as requests_get from queue import Queue import tkinter as tk import customtkinter @@ -21,6 +25,8 @@ from audio_transcriber import AudioTranscriber from translation import Translator from notification import notification_xsoverlay_for_vrct +__version__ = "1.3.1" + class App(CTk): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -420,6 +426,20 @@ class App(CTk): # check osc started send_test_action() + # auto update + response = requests_get("https://api.github.com/repos/misyaguziya/VRCT/releases/latest") + tag_name = response.json()["tag_name"] + if tag_name != __version__: + url = response.json()["assets"][0]["browser_download_url"] + res = requests_get(url, stream=True) + os_makedirs("./tmp", exist_ok=True) + with open("./tmp/download.zip", 'wb') as file: + for chunk in res.iter_content(chunk_size=1024): + file.write(chunk) + unpack_archive('./tmp/download.zip', './tmp') + command = "update.cmd" + subprocess.Popen(command.split()) + def button_config_callback(self): self.foreground_stop() self.transcription_stop() diff --git a/update.cmd b/update.cmd new file mode 100644 index 00000000..6d5587d1 --- /dev/null +++ b/update.cmd @@ -0,0 +1,15 @@ +set "current_dir=%CD%" +taskkill /im VRCT.exe /F +timeout 2 +for /d /r %%i in (*) do ( + set "folder=%%i" + set "folder=!folder:%current_dir%\=!" + if "!folder!" neq "\tmp\" ( + rd /s /q "%%i" + ) +) +timeout 2 +xcopy /s /e /y ".\tmp\VRCT\*" ".\" +timeout 2 +for /f "delims=" %%i in ('dir /b /s /ad "%current_dir%\tmp"') do rd /s /q "%%i" +VRCT.exe \ No newline at end of file From 4286fe6aabf8f51c64f272f2fedd0d2560fdc93a Mon Sep 17 00:00:00 2001 From: misygauziya Date: Sun, 30 Jul 2023 23:52:45 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Update]=20=E8=87=AA=E5=8B=95=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E3=81=AF=E5=8D=B1=E9=99=BA=E3=81=AA=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E3=82=A2=E3=83=83=E3=83=97=E3=83=87=E3=83=BC=E3=83=88=E3=81=AE?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=94=A8=E3=83=95=E3=83=A9=E3=82=B0=E3=81=AE?= =?UTF-8?q?=E3=81=BF=E3=81=AE=E5=AE=9F=E8=A3=85=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VRCT.py | 13 +++---------- update.cmd | 15 --------------- 2 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 update.cmd diff --git a/VRCT.py b/VRCT.py index ef7f2230..e7b0c545 100644 --- a/VRCT.py +++ b/VRCT.py @@ -88,6 +88,7 @@ class App(CTk): self.ENABLE_AUTO_CLEAR_CHATBOX = False self.ENABLE_OSC = False self.ENABLE_NOTICE_XSOVERLAY =False + self.UPDATE_FLAG = False # load config if os_path.isfile(self.PATH_CONFIG) is not False: @@ -426,19 +427,11 @@ class App(CTk): # check osc started send_test_action() - # auto update + # check update response = requests_get("https://api.github.com/repos/misyaguziya/VRCT/releases/latest") tag_name = response.json()["tag_name"] if tag_name != __version__: - url = response.json()["assets"][0]["browser_download_url"] - res = requests_get(url, stream=True) - os_makedirs("./tmp", exist_ok=True) - with open("./tmp/download.zip", 'wb') as file: - for chunk in res.iter_content(chunk_size=1024): - file.write(chunk) - unpack_archive('./tmp/download.zip', './tmp') - command = "update.cmd" - subprocess.Popen(command.split()) + self.UPDATE_FLAG = True def button_config_callback(self): self.foreground_stop() diff --git a/update.cmd b/update.cmd deleted file mode 100644 index 6d5587d1..00000000 --- a/update.cmd +++ /dev/null @@ -1,15 +0,0 @@ -set "current_dir=%CD%" -taskkill /im VRCT.exe /F -timeout 2 -for /d /r %%i in (*) do ( - set "folder=%%i" - set "folder=!folder:%current_dir%\=!" - if "!folder!" neq "\tmp\" ( - rd /s /q "%%i" - ) -) -timeout 2 -xcopy /s /e /y ".\tmp\VRCT\*" ".\" -timeout 2 -for /f "delims=" %%i in ('dir /b /s /ad "%current_dir%\tmp"') do rd /s /q "%%i" -VRCT.exe \ No newline at end of file