44from datetime import datetime
55import os
66import sys
7- from src import TranscodeSession
7+ sys .path .append (os .path .join (sys .path [0 ], "src" ))
8+ from TranscodeSession import Session
89
910"""
1011
1112TODO:
1213- allow comma-separated string for --preset, e.g. medium,slow,slower, map to list
1314- ~~if presets.json does not exist, download from github~~
1415- need to format source / output filenames: drop resolution suffixes
16+ - add check: if working directory == script location, exit with warning to symlink transcode.py onto $PATH
17+ - add --install arg to create symlink at /usr/local/bin?
1518
1619"""
1720
@@ -32,7 +35,7 @@ def main():
3235 valid_arguments = False
3336
3437 # Validate command-line arguments
35- if not set ([ "source" , "presets.json" ]). issubset ( set ( os .listdir ()) ):
38+ if not "source" in os .listdir ():
3639 print ("FATAL: invalid working directory!" )
3740 elif args .file and not os .path .exists (args .file ):
3841 print ("FATAL:" , args .file , "not found!" )
@@ -47,7 +50,7 @@ def main():
4750 elif args .all and args .quality :
4851 print ("Warning! Combining --all and --quality options is not recommended and may not produce optimal HEVC transcodes." )
4952 while "need response" :
50- reply = str (input ("Proceed? (y/n) cccccccccc " )).lower ().strip ()
53+ reply = str (input ("Proceed? (y/n)" )).lower ().strip ()
5154 if reply [0 ] == "y" :
5255 break
5356 if reply [0 ] == "n" :
@@ -61,7 +64,7 @@ def main():
6164 else :
6265 source_files = [args .file ]
6366 for source_file in source_files :
64- session = TranscodeSession . Session (source_file , args )
67+ session = Session (source_file , args )
6568 if os .path .exists (session .path ["output" ]):
6669 print (" Skipping" , source_file )
6770 source_files = [file for file in source_files if file is not source_file ]
@@ -77,7 +80,7 @@ def main():
7780 # Do the thing
7881 task_start_time = datetime .now ()
7982 for file in source_files :
80- session = TranscodeSession . Session (file , args )
83+ session = Session (file , args )
8184 session .summarize ()
8285 print (session .command + "\n " )
8386 job_start_time = datetime .now ()
0 commit comments