From 7e54698dac1c2122ec5a9d450698d988317534ca Mon Sep 17 00:00:00 2001 From: Jean Philip Orsini Date: Thu, 28 Jan 2016 17:43:49 +0100 Subject: [PATCH] cleanup --- mp3tohtml/mp3tohtml.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mp3tohtml/mp3tohtml.py b/mp3tohtml/mp3tohtml.py index 0ef84de..db32bdc 100755 --- a/mp3tohtml/mp3tohtml.py +++ b/mp3tohtml/mp3tohtml.py @@ -15,7 +15,6 @@ import eyeD3 import fnmatch import glob import os -import os.path import re import sys @@ -43,23 +42,27 @@ def fma_copyright_to_html(path, copyright): return copyright def copy_header(path): - header_path = os.path.dirname(path) + "/header.tpl" + header_path = path + "/header.tpl" header = open(header_path, "r") for line in header: sys.stdout.write(line) def copy_footer(path): - footer_path = os.path.dirname(path) + "/footer.tpl" + footer_path = path + "/footer.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') +parser.add_argument("--config", help="The directory containing the configuration") args = parser.parse_args() -cfg_dir = sys.argv[0] +if (args.config is None): + cfg_dir = os.path.dirname(sys.argv[0]) +else: + cfg_dir = args.config copy_header(cfg_dir) -- 2.7.4