3 Commits
Author SHA1 Message Date
sugoidogo e4376a62f2 update in seperate thread 2025-07-20 23:18:24 -07:00
sugoidogo d1892a241f fix typo 2025-07-20 23:15:26 -07:00
sugoidogo eb045fa94a fix update function args 2025-07-20 23:14:19 -07:00
+6 -3
View File
@@ -9,13 +9,13 @@ import json,sys,webbrowser,importlib,tomllib
def update(): def update():
print('checking for updates...') print('checking for updates...')
with open(script_path()+'astrolobott.py','r') as file: with open(script_path()+'astrolobot.py','r') as file:
current_script=file.read() current_script=file.read()
urlretrieve( urlretrieve(
'https://github.com/sugoidogo/astrolobot/releases/latest/download/astrolobot.py', 'https://github.com/sugoidogo/astrolobot/releases/latest/download/astrolobot.py',
script_path()+'astrolobot.py' script_path()+'astrolobot.py'
) )
with open(script_path()+'astrolobott.py','r') as file: with open(script_path()+'astrolobot.py','r') as file:
updated_script=file.read() updated_script=file.read()
if current_script==updated_script: if current_script==updated_script:
print('up to date') print('up to date')
@@ -275,6 +275,9 @@ def script_main():
dependency_setup() dependency_setup()
main() main()
def obs_update(*args):
Thread(target=update,daemon=True).start()
def obs_load_settings(): def obs_load_settings():
import obspython import obspython
global obs_settings global obs_settings
@@ -309,7 +312,7 @@ def script_properties():
import obspython import obspython
properties=obspython.obs_properties_create() properties=obspython.obs_properties_create()
obspython.obs_properties_add_button(properties,'login','Login to Twitch',login) obspython.obs_properties_add_button(properties,'login','Login to Twitch',login)
obspython.obs_properties_add_button(properties,'update','Check for Updates',update) obspython.obs_properties_add_button(properties,'update','Check for Updates',obs_update)
obspython.obs_properties_add_text(properties,'commands','commands',obspython.OBS_TEXT_INFO) obspython.obs_properties_add_text(properties,'commands','commands',obspython.OBS_TEXT_INFO)
obspython.obs_properties_add_text(properties,'positions','positions',obspython.OBS_TEXT_DEFAULT) obspython.obs_properties_add_text(properties,'positions','positions',obspython.OBS_TEXT_DEFAULT)
obspython.obs_properties_add_text(properties,'transits','transits',obspython.OBS_TEXT_DEFAULT) obspython.obs_properties_add_text(properties,'transits','transits',obspython.OBS_TEXT_DEFAULT)