Skip to content

Commit

Permalink
desktop.media.tomkv: explicitly flush stdout before ffmpeg uses it
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-fg committed Nov 17, 2024
1 parent 18eda7d commit a90e764
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions desktop/media/tomkv
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def main(args=None):
parser.add_argument('-n', '--name',
metavar='tpl', default='{name}.mkv', help=dd('''
Template to rename resulting file(s), instead of default: %(default)s
Can be used to set non-mkv container format, e.g. mp4.
ffmpeg auto-detects it from extension, so it must be something conventional.
Names are deduplicated with number-suffix when multiple sources are used.
Substituted keys: "name" - source filename without extension.'''))
parser.add_argument('-r', '--rm-list', metavar='file[:factor]', help=dd('''
Expand Down Expand Up @@ -192,7 +194,7 @@ def main(args=None):
if n <= nx: continue
if dry_run: msg = msg.strip()
print(msg); print(' '.join((repr(a) if any(
c in a for c in '\'" ') else a) for a in cmd), end='\n\n')
c in a for c in '\'" ') else a) for a in cmd), end='\n\n', flush=True)
if dry_run: continue

sp.run(cmd, check=True, stdin=sp.DEVNULL)
Expand Down Expand Up @@ -224,6 +226,6 @@ def main(args=None):
else: st += ( f' :: {m-n} file(s) / {sz_repr(sz)}'
f' left to process :: {sz_repr(szx_a)}-{sz_repr(szx_b)} to add'
f' in {td_repr((m-nd) * td/nd)} (est. ~{sz_repr(sz1+szx_b)} final)' )
print(st)
print(st, flush=True)

if __name__ == '__main__': sys.exit(main())

0 comments on commit a90e764

Please sign in to comment.