From d58ebc1ebecb8f676bd3238ce66812198ec5bc88 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Mon, 9 Nov 2020 21:20:58 -0500 Subject: [PATCH] add debug to convert --- converter.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/converter.py b/converter.py index c9cec2a..e3a7d30 100644 --- a/converter.py +++ b/converter.py @@ -2,21 +2,27 @@ import subprocess import os import time -done_files = [] +convert_dir = "/Users/ducoterra/Desktop/" +debug = False while True: # get a list of all .mov or .gif files - movs = list(filter(lambda item: item.endswith(".mov"), os.listdir())) - print(f"Found {len(movs)} .mov files.") - gifs = list(filter(lambda item: item.endswith(".gif"), os.listdir())) - print(f"Found {len(gifs)} .gif files.") + movs = list(filter(lambda item: item.endswith(".mov"), os.listdir(convert_dir))) + if debug: + print(f"Found {len(movs)} .mov files.") + gifs = list(filter(lambda item: item.endswith(".gif"), os.listdir(convert_dir))) + if debug: + print(f"Found {len(gifs)} .gif files.") # find files that are not already gifs and aren't default not_done = list(filter(lambda mov: mov.replace(".mov",".gif") not in gifs and not mov.startswith("Screen Recording"), movs)) - print(f"Found {len(not_done)} to convert.") + if debug: + print(f"Found {len(not_done)} to convert.") for mov in not_done: print(f"converting {mov}. Ctrl + C to stop...") - subprocess.run(['/usr/local/bin/ffmpeg', '-i', mov, '-filter:v', 'setpts=0.5*PTS', mov.replace(".mov",".gif")], capture_output=True) + if debug: + time.sleep(5) + subprocess.run(['/usr/local/bin/ffmpeg', '-i', convert_dir + mov, '-filter:v', 'setpts=0.5*PTS', convert_dir + mov.replace(".mov",".gif")], capture_output=True) time.sleep(1) \ No newline at end of file