6 Commits
3 changed files with 46 additions and 16 deletions
+23
View File
@@ -0,0 +1,23 @@
name: Release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- run: git log $(git describe --tags --abbrev=0 HEAD~1)..HEAD --oneline > changelog.txt
- uses: softprops/action-gh-release@v2
with:
make_latest: true
body_path: changelog.txt
files: astrolobot.py
+22 -15
View File
@@ -10,24 +10,27 @@ import json,sys,webbrowser,importlib,tomllib
def update(): def update():
print('checking for updates...') print('checking for updates...')
with open(script_path()+'astrolobot.py','r') as file: try:
current_script=file.read() with open(script_path()+'astrolobot.py','r') as file:
urlretrieve( current_script=file.read()
'https://github.com/sugoidogo/astrolobot/releases/latest/download/astrolobot.py', urlretrieve(
script_path()+'astrolobot.py' 'https://gitea.sugoidogo.com/SugoiDogo/astrolobot/releases/download/latest/astrolobot.py',
) script_path()+'astrolobot.py'
with open(script_path()+'astrolobot.py','r') as file: )
updated_script=file.read() with open(script_path()+'astrolobot.py','r') as file:
if current_script==updated_script: updated_script=file.read()
print('up to date') if current_script==updated_script:
else: print('up to date')
print('update downloaded, restart script to apply') else:
print('update downloaded, restart script to apply')
except:
print('update check failed, ignoring')
def dependency_setup(): def dependency_setup():
if not path.exists(script_path()+'pip'): if not path.exists(script_path()+'pip'):
print('installing dependencies') print('installing dependencies')
from pip._internal.cli.main import main as pip from pip._internal.cli.main import main as pip
pip(['install','-qq','pyswisseph','twitch.py','--target',script_path()+'pip']) pip(['install','-qq','-r',script_path()+'/requirements.txt','--target',script_path()+'pip'])
sys.path.append(script_path()+'pip') sys.path.append(script_path()+'pip')
@@ -394,7 +397,11 @@ def login(*args):
global device_code global device_code
if device_code==None: if device_code==None:
print('astrolobot is still starting, please wait',sys.stderr) print('astrolobot is still starting, please wait',sys.stderr)
webbrowser.open('https://www.twitch.tv/activate?public=true&device-code='+device_code) else:
login_url='https://www.twitch.tv/activate?public=true&device-code='+device_code
print("if your browser doesn't automatically open, go to the following url:")
print(login_url)
webbrowser.open(login_url)
def save_tokens(access_token,refresh_token): def save_tokens(access_token,refresh_token):
with open(script_path()+'tokens.json','w') as file: with open(script_path()+'tokens.json','w') as file:
@@ -463,7 +470,7 @@ def main():
async def on_code(code: str): async def on_code(code: str):
global device_code, obs_settings global device_code, obs_settings
device_code=code device_code=code
if obs_settings == None: if len(tokens)==0:
login() login()
@client.event @client.event
+1 -1
View File
@@ -1,2 +1,2 @@
pyswisseph pyswisseph
twitch.py twitch.py == 3.*