Files
spotify-gui/update.py
Brandon4466 88c877c50f added liking by double tapping album art
add exception handling to update.py, prepping for handling script
2023-03-04 13:46:12 -08:00

25 lines
748 B
Python

import urllib
from urllib.request import urlopen
from zipfile import ZipFile
from io import BytesIO
from spotipy import exceptions as SpotipyExceptions
from requests import exceptions as RequestsExceptions
while True:
try:
urlopen('http://bbrunson.com', timeout=1)
break
except:
pass
try:
with ZipFile(BytesIO((urlopen('http://files.bbrunson.com/spotify-gui/update.zip')).read())) as zipObj:
zipObj.extractall()
except urllib.error.HTTPError:
pass
try:
exec(open('spotifycontroller.py').read())
except (RequestsExceptions.HTTPError, SpotipyExceptions.SpotifyException):
print("An error has ocurred, saving and reestablishing application now.")
exec(open('spotifycontroller.py').read())