osx print/dont upload if encode failed, only encode if we get info from file

This commit is contained in:
j 2011-01-18 15:22:13 +05:30
parent a5e68aeaaa
commit e1b313d2a4

View file

@ -25,6 +25,8 @@ default_media_cache = os.environ.get('oxMEDIA', os.path.expanduser('~/.ox/media'
def encode(filename, prefix, profile): def encode(filename, prefix, profile):
info = utils.avinfo(filename) info = utils.avinfo(filename)
if not 'oshash' in info:
return None
oshash = info['oshash'] oshash = info['oshash']
frames = [] frames = []
for pos in utils.video_frame_positions(info['duration']): for pos in utils.video_frame_positions(info['duration']):
@ -364,8 +366,11 @@ class API(object):
def uploadVideo(self, filename, data, profile): def uploadVideo(self, filename, data, profile):
if DEBUG: if DEBUG:
print filename print filename.encode('utf-8')
i = encode(filename, self.media_cache, profile) i = encode(filename, self.media_cache, profile)
if not i:
print "failed"
return
#upload frames #upload frames
form = ox.MultiPartForm() form = ox.MultiPartForm()