this fixes the controls moving if song name long modified updater to restart completely if killed/encounters exception
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import urllib
|
|
from urllib.request import urlopen
|
|
from zipfile import ZipFile
|
|
from io import BytesIO
|
|
from time import sleep
|
|
import subprocess
|
|
|
|
|
|
# while True:
|
|
# try:
|
|
# urlopen('http://bbrunson.com', timeout=1)
|
|
# print("Connection to server established.")
|
|
# break
|
|
# except:
|
|
# pass
|
|
|
|
|
|
# try:
|
|
# print("Checking for updates...")
|
|
# with ZipFile(BytesIO((urlopen('http://files.bbrunson.com/spotify-gui/update.zip')).read())) as zipObj:
|
|
# zipObj.extractall()
|
|
# print("Update successfully installed.")
|
|
# except urllib.error.HTTPError:
|
|
# print("No update available.")
|
|
# pass
|
|
|
|
|
|
while True:
|
|
try:
|
|
urlopen('http://bbrunson.com', timeout=1)
|
|
print("Connection to server established.")
|
|
try:
|
|
print("Checking for updates...")
|
|
with ZipFile(BytesIO((urlopen('http://files.bbrunson.com/spotify-gui/update.zip')).read())) as zipObj:
|
|
zipObj.extractall()
|
|
print("Update successfully installed.")
|
|
except urllib.error.HTTPError:
|
|
print("No update available.")
|
|
pass
|
|
subprocess.check_call(['python3', 'spotifycontroller.py'])
|
|
except:
|
|
print("An error has ocurred, checking server connection, checking for update, and then reestablishing the application in 10 seconds.")
|
|
sleep(10)
|
|
continue |