avinfo should not fail for emptpy files

This commit is contained in:
j 2010-02-27 17:17:13 +05:30
parent 70f9fc2b6f
commit a5a2780525
1 changed files with 5 additions and 4 deletions

View File

@ -60,7 +60,8 @@ def oshash(filename):
return "IOError"
def avinfo(filename):
p = subprocess.Popen(['ffmpeg2theora', '--info', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
info, error = p.communicate()
return simplejson.loads(info)
if os.path.getsize(filename):
p = subprocess.Popen(['ffmpeg2theora', '--info', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
info, error = p.communicate()
return simplejson.loads(info)
return {'path': filename, 'size': 0}