From: Jean Philip Orsini Date: Wed, 27 Jan 2016 22:31:56 +0000 (+0100) Subject: cleanup X-Git-Url: http://git.wpitchoune.net/gitweb/?p=radio.git;a=commitdiff_plain;h=0cb401ee6342433ff43fed9a9f7a4032550a0139 cleanup --- diff --git a/mp3tohtml.py b/mp3tohtml.py index a683c88..f0ba0d1 100755 --- a/mp3tohtml.py +++ b/mp3tohtml.py @@ -48,12 +48,20 @@ def copy_header(path): for line in header: sys.stdout.write(line) +def copy_footer(path): + footer_path = os.path.dirname(path) + "/header.tpl" + footer = open(footer_path, "r") + for line in footer: + sys.stdout.write(line) + parser = argparse.ArgumentParser(description='Generate an HTML containing information about the MP3 files.') parser.add_argument('dir', help='The directory containing the MP3 files') args = parser.parse_args() -copy_header(sys.argv[0]) +cfg_dir = sys.argv[0] + +copy_header(cfg_dir) files = [] for root, dirnames, filenames in os.walk(args.dir): @@ -102,6 +110,8 @@ for f in files: print("\t") +copy_footer(cfg_dir) + print("") print ("