50 | ffmpeg_progress_yield.__main__
51 |
52 |
53 |
54 |
55 |
56 |
57 | 1import sys 58 | 2 59 | 3from . import __version__ as version 60 | 4from .ffmpeg_progress_yield import FfmpegProgress 61 | 5 62 | 6 63 | 7def main() -> None: 64 | 8 if len(sys.argv) <= 1 or sys.argv[1] in ("-h", "-help"): 65 | 9 print( 66 | 10 f"ffmpeg-progress-yield v{version}\n\n" 67 | 11 "Usage: ffmpeg-progress-yield [-h] ffmpeg-command\n\n" 68 | 12 "Arguments:\n" 69 | 13 " ffmpeg-command: Any ffmpeg command. Do not quote this argument.\n\n" 70 | 14 "Options:\n -h/--help: Show this help and exit." 71 | 15 ) 72 | 16 sys.exit(1) 73 | 17 74 | 18 ff = FfmpegProgress(sys.argv[1:]) 75 | 19 76 | 20 try: 77 | 21 from tqdm import tqdm 78 | 22 79 | 23 with tqdm(total=100, position=1, desc="Test") as pbar: 80 | 24 for progress in ff.run_command_with_progress(): 81 | 25 pbar.update(progress - pbar.n) 82 | 26 except ImportError: 83 | 27 for progress in ff.run_command_with_progress(): 84 | 28 print(f"{progress}/100") 85 | 29 86 | 30 print(ff.stderr) 87 | 31 88 | 32 89 | 33if __name__ == "__main__": 90 | 34 main() 91 |
8def main() -> None: 107 | 9 if len(sys.argv) <= 1 or sys.argv[1] in ("-h", "-help"): 108 | 10 print( 109 | 11 f"ffmpeg-progress-yield v{version}\n\n" 110 | 12 "Usage: ffmpeg-progress-yield [-h] ffmpeg-command\n\n" 111 | 13 "Arguments:\n" 112 | 14 " ffmpeg-command: Any ffmpeg command. Do not quote this argument.\n\n" 113 | 15 "Options:\n -h/--help: Show this help and exit." 114 | 16 ) 115 | 17 sys.exit(1) 116 | 18 117 | 19 ff = FfmpegProgress(sys.argv[1:]) 118 | 20 119 | 21 try: 120 | 22 from tqdm import tqdm 121 | 23 122 | 24 with tqdm(total=100, position=1, desc="Test") as pbar: 123 | 25 for progress in ff.run_command_with_progress(): 124 | 26 pbar.update(progress - pbar.n) 125 | 27 except ImportError: 126 | 28 for progress in ff.run_command_with_progress(): 127 | 29 print(f"{progress}/100") 128 | 30 129 | 31 print(ff.stderr) 130 |