Use os.path.join for files path

This commit is contained in:
Yorick Barbanneau 2015-12-09 10:37:36 +01:00
parent 2a716b526f
commit d3d81f0eed

View file

@ -90,6 +90,7 @@ def list_file(directory, pattern, recursive):
return
for i in dirs:
logging.debug(' working on file / dir %s', i)
if os.path.isdir(directory + "/" + i) and recursive:
logging.info('directory found : %s', i)
files_list.extend(list_file(
@ -187,7 +188,9 @@ def encode_h264(src, dest):
] + params["h264_acommand"] + [
dest+".mp4"
]
logging.debug("First Pass command %s", firstpass)
execute(firstpass)
logging.debug("Second pass command %s", secondpass)
execute(secondpass)
else:
logging.debug("one pass encoding started ...")
@ -226,14 +229,19 @@ if __name__ == "__main__":
)
for f in video_files:
logging.info('batch encode | file %s', f)
encode_h264(f, params["file_output"] + get_file_name(f))
encode_h264(f, os.path.join(
params["file_output"], get_file_name(f)
))
else:
if os.path.isfile(params["file_input"]):
if not params["file_output"]:
params["file_output"] = get_file_name(params["file_input"])
else:
if os.path.isdir(params["file_output"]):
params["file_input"] += get_file_name(params["file_input"])
params["file_input"] = os.path.join(
params["file_input"],
get_file_name(params["file_input"])
)
logging.info('%s is a file', params["file_input"])
encode_h264(params["file_input"], params["file_output"])
else: