Skip to content

Commit

Permalink
v1.1 but I actually tested it
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgrstuff committed Feb 19, 2021
1 parent 03fc71a commit a36a193
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rpcgecko.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, cfg, titles, icons):

def load(self):
try: f = open(self.cfg_file, "r")
except (FileNotFoundError, yaml.Scanner.ScannerError):
except FileNotFoundError:
ui.autoconfig()
f = open(self.cfg_file, "r")
cf = yaml.safe_load(f)
Expand All @@ -47,6 +47,7 @@ def dump(self, cf):

def load_titles(self):
if os.path.isfile(self.titles) == False:
print("Downloading title database...")
response = requests.get("https://dmgrstuff.github.io/rpcgecko/titles.csv") # get our file from the server
if response.status_code == 200: # if everything is good,
f = open(self.titles, "w+", encoding="utf-8")
Expand All @@ -66,6 +67,7 @@ def load_titles(self):

def load_icons(self):
if os.path.isfile(self.icons) == False:
print("Downloading icon database...")
response = requests.get("https://dmgrstuff.github.io/rpcgecko/icons.yml")
if response.status_code == 200:
f = open(self.icons, "w+")
Expand Down Expand Up @@ -141,6 +143,7 @@ def autoconfig(self): # creates config.yml if it doesn't exist
print(f"That's all we need for now. You can change these and other settings anytime in the menu or config.yml. ({sec})")
time.sleep(1)
print("\u001b[2A")
print("\n")

def menu(self, error=None):
if type(error) == str:
Expand Down Expand Up @@ -395,8 +398,7 @@ def clear(self):
try: rpc = rpc(cf["client_id"])
except (TypeError, KeyError): ui.autoconfig()
print(f"\033]0;{ui.app_name} {ui.version_str} ({platform.system()})\007", end="") # window title
try:
ui.cls()
try:
ui.update_check(return_err=False) # checks for updates on startup, you could effectively disable this by replacing it with ui.menu()
except KeyboardInterrupt: # handle Ctrl+C a little more gracefully
print("Closing...")
Expand Down

0 comments on commit a36a193

Please sign in to comment.