fix multipass encoding for server/client

This commit is contained in:
j 2017-12-08 09:15:06 +01:00
parent 8df27cfb21
commit bb2aafcb9d
2 changed files with 39 additions and 30 deletions

View file

@ -44,7 +44,10 @@ class DistributedClient:
return True
return False
def encode(self, oshash, cmd, output):
def encode(self, oshash, cmds, output):
if not isinstance(cmds[0], list):
cmds = [cmds]
for cmd in cmds:
cmd[0] = extract.command('ffmpeg')
if 'webm' in cmd and not self.supported_formats['webm']:
print("ffmpeg is compiled without WebM support")
@ -73,6 +76,8 @@ class DistributedClient:
if os.path.exists(output):
os.unlink(output)
sys.exit(1)
if r != 0:
break
if r == 0:
self.upload(oshash, output)
else:

View file

@ -159,6 +159,10 @@ class Server(Resource):
url = 'http://%s:%s/get/%s' % (request.host.host, request.host.port, oshash)
output = '/tmp/%s.%s' % (oshash, self.client.profile(info))
response['cmd'] = extract.video_cmd(url, output, self.client.profile(info), info)
if isinstance(response['cmd'][0], list):
for part in response['cmd']:
part[0] = 'ffmpeg'
else:
response['cmd'][0] = 'ffmpeg'
response['output'] = output
self.update_status(oshash, 'active')