not all file have samplerate

This commit is contained in:
j 2010-12-29 16:18:42 +05:30
parent da8aa69bf1
commit e402886bd8

View file

@ -102,8 +102,8 @@ class File(models.Model):
self.is_video = False self.is_video = False
if 'audio' in self.info and self.info['audio']: if 'audio' in self.info and self.info['audio']:
self.audio_codec = self.info['audio'][0]['codec'] self.audio_codec = self.info['audio'][0]['codec']
self.samplerate = self.info['audio'][0]['samplerate'] self.samplerate = self.info['audio'][0].get('samplerate', 0)
self.channels = self.info['audio'][0]['channels'] self.channels = self.info['audio'][0].get('channels', 0)
if not self.is_video: if not self.is_video:
self.is_audio = True self.is_audio = True