soundfiles = {}
for soundfile_data in yaml.load(open(os.path.join(dirname, 'contents.yaml'))):
audiobank_id = soundfile_data['attributes']['audiobank_id']
- filepath = os.path.join(dirname, 'casts', '%s.ogg' % audiobank_id)
- if not os.path.exists(filepath):
- continue
+ if audiobank_id:
+ filepath = os.path.join(dirname, 'casts', '%s.ogg' % audiobank_id)
+ if not os.path.exists(filepath):
+ continue
+ audiobank_cast = soundfile_data['attributes'].get('audiobank_cast')
+ if audiobank_cast:
+ filepath = os.path.join(dirname, 'casts', '%s.ogg' % audiobank_cast)
+ if not os.path.exists(filepath):
+ continue
episode = episode_ids[soundfile_data['attributes']['episode_id']]
soundfile, created = SoundFile.objects.get_or_create(
episode_id=episode,