cleanup
authorJean Philip Orsini <orsinije@fr.ibm.com>
Thu, 28 Jan 2016 16:43:49 +0000 (17:43 +0100)
committerJean Philip Orsini <orsinije@fr.ibm.com>
Thu, 28 Jan 2016 16:43:49 +0000 (17:43 +0100)
mp3tohtml/mp3tohtml.py

index 0ef84de..db32bdc 100755 (executable)
@@ -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)