Skip to content

Commit

Permalink
fix output file location
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfwithSword committed Aug 23, 2024
1 parent 6be47c8 commit 9997023
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
cwd = os.getcwd()
config_path = os.path.join(cwd, 'config.ini')
OUTPUT_FILE = "output.html"
custom_output = False

argv = sys.argv
conf_parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -68,6 +69,7 @@
quit()
OUTPUT_FILE = args.output_file
logger.info(f"Output will go to: {OUTPUT_FILE}")
custom_output = True

################
# End of Setup #
Expand Down Expand Up @@ -160,11 +162,12 @@ async def twitch_run():
net.set_template_dir(os.path.join(cwd, 'templates'), 'template.html')

output_dir = os.path.dirname(OUTPUT_FILE)
if not os.path.exists(output_dir):

if custom_output and not os.path.exists(output_dir):
os.makedirs(output_dir)
net.write_html(name=OUTPUT_FILE, notebook=False, local=True, open_browser=False)

if not os.path.exists(os.path.join(output_dir, 'lib')) and os.path.exists('lib'):
if custom_output and not os.path.exists(os.path.join(output_dir, 'lib')) and os.path.exists('lib'):
shutil.copytree("lib", os.path.join(output_dir, "lib"))

logger.info("Completed in {:.2f} seconds".format(time_since(start_time=start_time)))
Expand Down

0 comments on commit 9997023

Please sign in to comment.