+ def prepare_audio(self, audiobook):
+ total_duration = audiobook.total_duration
+ files = []
+ if self.intro_flac and total_duration > self.intro_min_seconds and audiobook.is_first:
+ files.append(standardize_audio(self.intro_flac.path))
+ files.append(standardize_audio(audiobook.source_file.path))
+ if self.outro_flac and total_duration > self.outro_min_seconds and audiobook.is_last:
+ files.append(standardize_audio(self.outro_flac.path))
+ output = concat_audio(files)
+ for d in files:
+ unlink(d)
+ return output
+