program is not provided

This commit is contained in:
bkfox 2022-03-22 12:56:09 +01:00
parent 2dd2b766a6
commit ec59092d34

View File

@ -82,12 +82,13 @@ class SoundFile:
return sound
# FIXME: sound.program as not null
kwargs['program'] = program or Program.get_from_path(self.path)
if not program:
program = Program.get_from_path(self.path)
kwargs['program_id'] = program.pk
sound, created = Sound.objects.get_or_create(file=self.sound_path, defaults=kwargs) \
if not sound else (sound, False)
self.sound = sound
sound.program = program
if created or sound.check_on_file():
logger.info('sound is new or have been modified -> %s', self.sound_path)