def __init__(self, shuffle, path_in_ipod=None, trackdb=None): self._shuffle = shuffle if not trackdb: trackdb = TrackDB('/' + path_in_ipod) trackdb.type = audio.get_type(os.path.join(self._shuffle.base, path_in_ipod)) super().__init__(shuffle, trackdb, self._shuffle.tracks_voiceoverdb)
def add(self, src): """ store an audio file to storage dir :param src: audio file path :return: checksum value """ if not audio.get_type(src): raise TypeError('The type of this file is not supported.') return super().add(src)
def add_voice(self, src, text, lang, checksum=None): checksum = checksum or get_checksum(src) if not audio.get_type(src) == audio.WAV: raise TypeError filename = self.get_voice(text, lang) if filename: raise Exception self.add(src) filename = self.get_filename(checksum) extra = { 'text': text, 'lang': lang } self.set_extra(filename, extra)
def _check_audio(path): if not audio.get_type(path): raise TypeError('The type of this file is not supported.')