Skip to content

Commit

Permalink
[postprocessor:ugoira] improve error messages (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Aug 31, 2019
1 parent f02a768 commit 5fcebb6
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions gallery_dl/postprocessor/ugoira.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,26 @@ def run(self, pathfmt):

# invoke ffmpeg
pathfmt.set_extension(self.extension)
if self.twopass:
if "-f" not in args:
args += ["-f", self.extension]
args += ["-passlogfile", tempdir + "/ffmpeg2pass", "-pass"]
self._exec(args + ["1", "-y", os.devnull])
self._exec(args + ["2", pathfmt.realpath])
try:
if self.twopass:
if "-f" not in args:
args += ["-f", self.extension]
args += ["-passlogfile", tempdir + "/ffmpeg2pass", "-pass"]
self._exec(args + ["1", "-y", os.devnull])
self._exec(args + ["2", pathfmt.realpath])
else:
args.append(pathfmt.realpath)
self._exec(args)
except OSError as exc:
print()
self.log.error("Unable to invoke FFmpeg (%s: %s)",
exc.__class__.__name__, exc)
pathfmt.realpath = pathfmt.temppath
else:
args.append(pathfmt.realpath)
self._exec(args)

if self.delete:
pathfmt.delete = True
else:
pathfmt.set_extension("zip")
if self.delete:
pathfmt.delete = True
else:
pathfmt.set_extension("zip")

def _exec(self, args):
out = None if self.output else subprocess.DEVNULL
Expand Down

0 comments on commit 5fcebb6

Please sign in to comment.