def test_save_reload(self): filename = get_temp_copy(self.audio.filename) try: audio = TrueAudio(filename) audio.add_tags() audio.tags.add(TIT1(encoding=0, text="A Title")) audio.save() audio = TrueAudio(filename) self.failUnlessEqual(audio["TIT1"], "A Title") finally: os.unlink(filename)
def test_save_reload(self): try: fd, filename = mkstemp(suffix='.tta') os.close(fd) shutil.copy(self.audio.filename, filename) audio = TrueAudio(filename) audio.add_tags() audio.tags.add(TIT1(encoding=0, text="A Title")) audio.save() audio = TrueAudio(filename) self.failUnlessEqual(audio["TIT1"], "A Title") finally: os.unlink(filename)
def __init__(self, file, threshold=60, duration_distance_threshold=10000): self.file = file self.threshold = threshold self.ddt = duration_distance_threshold self.cleaner = re.compile(r"[^A-Za-z0-9 ]").sub try: self.audio = MP3(file, ID3=EasyID3) except: try: self.audio = FLAC(file) except: try: self.audio = OggVorbis(file) except: try: self.audio = OggFLAC(file) except: try: self.audio = OggTheora(file) except: try: self.audio = APEv2(file) except: try: self.audio = ASF(file) except: try: self.audio = MP4(file) except: try: self.audio = Musepack(file) except: try: self.audio = TrueAudio(file) except: try: self.audio = WavPack(file) except: raise FileTypeException( 'Unknown file type, no metadata, or file not found.' ) try: [title] = self.audio['title'] self.title = self.__clean_literal(str(title)) except: self.title = None try: [artist] = self.audio['artist'] self.artist = self.__clean_literal(str(artist)) except: self.artist = None try: [album] = self.audio['album'] self.album = self.__clean_literal(str(album)) except: self.album = None self.mbzQuery()
def setUp(self): self.audio = TrueAudio(os.path.join(DATA_DIR, "empty.tta"))
def setUp(self): self.audio = TrueAudio(os.path.join("tests", "data", "empty.tta"))