Update 'root/app/fanficdownload.py'

This commit is contained in:
sam 2023-06-06 20:16:36 +00:00
parent 419151cc51
commit cfc536dcd3

View File

@ -128,6 +128,8 @@ def downloader(args):
# loc = '/config/downloads' # loc = '/config/downloads'
if not exists('/config/downloads'): if not exists('/config/downloads'):
makedirs('/config/downloads') makedirs('/config/downloads')
copyfile("/config/personal.ini", "{}/personal.ini".format(loc))
copyfile("/config/defaults.ini", "{}/defaults.ini".format(loc))
loc = '/config/downloads' loc = '/config/downloads'
output = "" output = ""
output += log("Working with url {}".format(url), 'HEADER', live) output += log("Working with url {}".format(url), 'HEADER', live)
@ -154,8 +156,8 @@ def downloader(args):
output += log("\tStory is not in Calibre", 'WARNING', live) output += log("\tStory is not in Calibre", 'WARNING', live)
cur = url cur = url
moving = 'cd "{}" && '.format(loc) moving = 'cd "{}" && '.format(loc)
copyfile("/config/personal.ini", "{}/personal.ini".format(loc)) # copyfile("/config/personal.ini", "{}/personal.ini".format(loc))
copyfile("/config/defaults.ini", "{}/defaults.ini".format(loc)) # copyfile("/config/defaults.ini", "{}/defaults.ini".format(loc))
output += log('\tRunning: {}python3.9 -m fanficfare.cli -u "{}" --update-cover --non-interactive'.format( output += log('\tRunning: {}python3.9 -m fanficfare.cli -u "{}" --update-cover --non-interactive'.format(
moving, cur), 'BLUE', live) moving, cur), 'BLUE', live)
res = check_output('{}python3.9 -m fanficfare.cli -u "{}" --update-cover --non-interactive --config={}/personal.ini'.format( res = check_output('{}python3.9 -m fanficfare.cli -u "{}" --update-cover --non-interactive --config={}/personal.ini'.format(
@ -228,13 +230,13 @@ def downloader(args):
live) live)
if not live: if not live:
print(output.strip()) print(output.strip())
rmtree(loc) # rmtree(loc)
except Exception as e: except Exception as e:
output += log("Exception: {}".format(e), 'FAIL', live) output += log("Exception: {}".format(e), 'FAIL', live)
if not live: if not live:
print(output.strip()) print(output.strip())
try: try:
rmtree(loc) # rmtree(loc)
except BaseException: except BaseException:
pass pass
with open(inout_file, "a") as fp: with open(inout_file, "a") as fp: