Skip to content

Commit c584bb8

Browse files
committed
added the run progress
1 parent 2a99899 commit c584bb8

File tree

2 files changed

+16
-140
lines changed

2 files changed

+16
-140
lines changed

.gitignore

Lines changed: 0 additions & 129 deletions
This file was deleted.

pympeg/_filter.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ._node import (InputNode, FilterNode, Label,
1313
OptionNode, OutputNode, GlobalNode, stream)
1414
from ._util import get_str_from_filter, get_str_from_global
15+
from . import ffpbar
1516

1617

1718
__all__ = ["input", "filter", "output", "arg", "run", "graph", "option",
@@ -658,20 +659,24 @@ def run(caller, display_command=True):
658659
if display_command:
659660
print(command)
660661

661-
return
662-
process = Popen(args=command,
663-
shell=True,
664-
stdout=PIPE,
665-
stderr=STDOUT,
666-
universal_newlines=True)
662+
progress = ffpbar.Progress()
663+
process = Popen(
664+
args=command,
665+
shell=True,
666+
stdout=PIPE,
667+
stderr=STDOUT,
668+
universal_newlines=True,
669+
encoding='utf-8'
670+
)
667671

668-
out, err = process.communicate()
669-
code = process.poll()
672+
for out in process.stdout:
673+
progress.display(out)
670674

671-
if code:
672-
raise FFmpegException('ffmpeg', out, err)
675+
code = process.wait()
673676

674-
return out, err
677+
if code:
678+
progress.clear()
679+
FFmpegException('ffmpeg', "", code)
675680

676681

677682
@stream()

0 commit comments

Comments
 (0)