Skip to content

Commit

Permalink
added defaultpath config option, fixed typo, hid some unhelpful log e…
Browse files Browse the repository at this point in the history
…ntries
  • Loading branch information
sh4dow committed Jun 23, 2022
1 parent 107c474 commit e0ac5b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions downloader.py
Expand Up @@ -46,8 +46,9 @@ def download():
# don't start multiple steamcmd instances
global running
global cfg
global URLinput
global steampath
global defaultpath
global URLinput
global button1
global output
global login
Expand Down Expand Up @@ -99,6 +100,11 @@ def download():
while True:
out = process.stdout.readline()
#print(out.strip())
if m := re.search("Redirecting stderr to",out):
output.insert(tk.END,out[:m.span()[0]]+"\n")
break
if re.match("-- type 'quit' to exit --",out):
continue
output.insert(tk.END,out)
output.see(tk.END)
output.update()
Expand All @@ -114,9 +120,11 @@ def download():
# move mods
pc = {} # path cache
for appid, wid in batch:
if appid in pc or (str(appid) in cfg and 'path' in cfg[str(appid)]):
path = pc.get(appid,cfg[str(appid)]['path'])
if appid in pc or cfg.get(str(appid),'path',fallback=None) or defaultpath:
path = pc.get(appid,cfg.get(str(appid),'path',
fallback = os.path.join(defaultpath,str(appid))))
if os.path.exists(modpath(steampath,appid,wid)):
# download was successful
output.insert(tk.END, "Moving "+str(wid)+" ...")
output.see(tk.END)
output.update()
Expand All @@ -143,6 +151,7 @@ def download():
def main():
global cfg
global steampath
global defaultpath
global login
global passw
global button1
Expand All @@ -167,14 +176,15 @@ def main():

# set globals
steampath = cfg['general']['steampath']
defaultpath = cfg.get('general','defaultpath',fallback=None)
theme = cfg['general']['theme']
lim = int(cfg['general']['batchsize'])
login = None
passw = None
if 'login' in cfg['general']:
login = cfg['general']['login']
if 'passw' in cfg['general']:
passw = cfg['general']['login']
passw = cfg['general']['passw']

padx = 7
pady = 4
Expand Down Expand Up @@ -244,8 +254,9 @@ def main():

root.mainloop()

with open('downloader.ini', 'w') as file:
cfg.write(file)
if not os.path.exists('downloader.ini'): # remove this when in-app options menu exists
with open('downloader.ini', 'w') as file:
cfg.write(file)

if __name__ == '__main__':
main()
Binary file modified release/downloader.exe
Binary file not shown.

0 comments on commit e0ac5b6

Please sign in to comment.