From 7f1eae9c66bd14d1dc9d4f76710c2b4b6fb0913a Mon Sep 17 00:00:00 2001 From: Johannes Stelzer Date: Mon, 20 Feb 2023 10:10:51 +0100 Subject: [PATCH] relative path --- movie_util.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/movie_util.py b/movie_util.py index 2d1a92d..704e77d 100644 --- a/movie_util.py +++ b/movie_util.py @@ -183,19 +183,17 @@ def concatenate_movies(fp_final: str, list_fp_movies: List[str]): list_concat.append(f"""file '{fp_part}'""") # save this list - fp_list = fp_final[:-3] + "txt" + fp_list = "tmp_move.txt" with open(fp_list, "w") as fa: for item in list_concat: fa.write("%s\n" % item) cmd = f'ffmpeg -f concat -safe 0 -i {fp_list} -c copy {fp_final}' dp_movie = os.path.split(fp_final)[0] - if len(dp_movie) > 0: - subprocess.call(cmd, shell=True, cwd=dp_movie) - else: - subprocess.call(cmd, shell=True) + subprocess.call(cmd, shell=True) os.remove(fp_list) - print(f"concatenate_movies: success! Watch here: {fp_final}") + if os.path.isfile(fp_final): + print(f"concatenate_movies: success! Watch here: {fp_final}") class MovieReader():