--- a/src/pyams_media/process.py Tue Sep 08 17:01:11 2015 +0200
+++ b/src/pyams_media/process.py Tue Sep 08 17:01:39 2015 +0200
@@ -92,14 +92,18 @@
# extract converter output
logger.debug("Starting conversion process for {0!r} to {1}".format(media, media_format))
manager = ITransactionManager(media)
- for loop, conversion in converter.convert(media):
- logger.debug("Finished FFmpeg conversion process. {0} bytes output".format(len(conversion)))
+ for width, conversion in converter.convert(media):
+ logger.debug("Finished FFmpeg conversion process to {0}, {1} bytes output".format(media_format,
+ len(conversion)))
# add conversion in a transaction attempts loop
- for attempt in manager.attempts():
- with attempt as t:
- IMediaConversions(media).add_conversion(conversion, media_format, converter.format, loop)
- if t.status == 'Committed':
- break
+ if len(conversion) > 0:
+ for attempt in manager.attempts():
+ with attempt as t:
+ IMediaConversions(media).add_conversion(conversion, media_format, converter.format, width)
+ if t.status == 'Committed':
+ break
+ else:
+ logger.warning("Finished FFmpeg conversion process with **NO OUTPUT** !!!")
finally:
if manager is not None:
manager.abort()
@@ -129,11 +133,12 @@
def test(self, settings):
messages = ['Conversion process ready to handle requests.']
- ffmpeg = shutil.which('ffmpeg')
- if ffmpeg is None:
- messages.append("WARNING: missing 'ffmpeg' command!")
- else:
- messages.append("'ffmpeg' command is available.")
+ for command in ('ffmpeg', 'ffprobe'):
+ whereis = shutil.which(command)
+ if whereis is None:
+ messages.append("WARNING: missing required command '{0}'!".format(command))
+ else:
+ messages.append("Required command '{0}' is available.".format(command))
return [200, '\n'.join(messages)]