Handle lack of source directory properly
This commit is contained in:
parent
2b847fe41e
commit
1fa81a61e4
1 changed files with 11 additions and 3 deletions
14
main.py
14
main.py
|
@ -12,7 +12,7 @@ try:
|
|||
# Argument parser code go here
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("source", help="The directory containing the music library you want to convert")
|
||||
parser.add_argument("target", help="The directory where the converted library should go. Will be created if it does not exist.")
|
||||
parser.add_argument("target", help="The directory where the converted library should go. Will be created if it does not exist. Defaults to <source>_<target format>")
|
||||
parser.add_argument("-f", "--format", help="Target format. Defaults to mp3.")
|
||||
parser.add_argument("-b", "--bitrate", help="Target bitrate. Not specified by default.")
|
||||
parser.add_argument("-k", "--keepotherfiles", help="Also copy over files that aren't audio", action="store_true")
|
||||
|
@ -26,8 +26,16 @@ try:
|
|||
keepOtherFiles = args.keepotherfiles
|
||||
preserveMetadata = not args.stripmetadata
|
||||
|
||||
startDir = args.source
|
||||
outDir = args.target
|
||||
startDir = ""
|
||||
if(args.source):
|
||||
startDir = args.source
|
||||
else:
|
||||
print("No source directory specified!")
|
||||
exit()
|
||||
|
||||
outDir = startDir+"_"+targetFormat
|
||||
if(args.target):
|
||||
outDir = args.target
|
||||
|
||||
filecount = 0
|
||||
for path,dirs,files in os.walk(startDir):
|
||||
|
|
Loading…
Reference in a new issue