def test_transcode_copy(self): """Tests transcoding with copying instead of transcoding.""" self.execute_transcode(Transcode(), in_filename=self.in_filename_mp3) self.execute_transcode(Transcode(), in_filename=self.in_filename_mp3all) self.execute_transcode(Transcode(), in_filename=self.in_filename_mp3empty)
def test_transcode_tracknumber_hack(self): """Tests transcoding with track number hack enabled.""" self.execute_transcode(Transcode(tracknumber_hack=True)) self.execute_transcode(Transcode(tracknumber_hack=True), in_filename=self.in_filename_mp3empty) self.execute_transcode(Transcode(tracknumber_hack=True), in_filename='brokentag_tracknumber.mp3')
def test_transcode_folderimage(self): """Tests transcoding without folder image.""" # Copy input file to a folder without folder.jpg (output folder) in_filename = os.path.join(self.output_path, self.in_filename_flac) shutil.copy(os.path.join(self.input_path, self.in_filename_flac), in_filename) self.execute_transcode(Transcode(), in_filename=in_filename)
def test_transcodeerror_copytags(self): """Tests copying tag failure.""" # Copy tags expects the output file to be an MP3 file. # Don't transcode as this would rewrite the output file. shutil.copy(os.path.join(self.input_path, self.img_filename), os.path.join(self.output_path, self.out_filename)) with pytest.raises(IOError): self.execute_transcode(Transcode(mode='copy'))
def test_transcode_default(self): """Test transcoding with default options.""" self.execute_transcode(Transcode(), in_filename=self.in_filename_flac) self.execute_transcode(Transcode(), in_filename=self.in_filename_flacall) self.execute_transcode(Transcode(), in_filename=self.in_filename_flacempty) self.execute_transcode(Transcode(), in_filename=self.in_filename_ogg) self.execute_transcode(Transcode(), in_filename=self.in_filename_oggall) self.execute_transcode(Transcode(), in_filename=self.in_filename_oggempty) self.execute_transcode(Transcode(), in_filename=self.in_filename_m4a) self.execute_transcode(Transcode(), in_filename=self.in_filename_m4aallJPEG) self.execute_transcode(Transcode(), in_filename=self.in_filename_m4aallPNG) self.execute_transcode(Transcode(), in_filename=self.in_filename_m4aempty)
def test_transcode_replaygainalbum(self): """Tests transcoding with ReplayGain (album based).""" self.execute_transcode(Transcode(mode='replaygain-album', replaygain_preamp_gain=10.0), in_filename=self.in_filename_mp3)
def test_transcode_replaygain(self): """Tests transcoding with ReplayGain (track based).""" self.execute_transcode(Transcode(mode='replaygain'), in_filename=self.in_filename_mp3all) self.execute_transcode(Transcode(mode='replaygain'), in_filename=self.in_filename_mp3)
def test_transcode_transcode(self): """Tests transcoding with forced transcode.""" self.execute_transcode(Transcode(mode='transcode'), in_filename=self.in_filename_mp3)
def test_filename(self): """Tests retrieving the output file name.""" transcode = Transcode() out_filename = transcode.get_out_filename(self.in_filename_flac) assert self.out_filename == out_filename
def test_transcodingerror_format(self): """Tests transcoding a non supported format.""" with pytest.raises(IOError): self.execute_transcode(Transcode(), in_filename=self.in_filename_aiff)
def test_transcodeerror_transcode(self): """Tests transcoding failure.""" # IOError is raised on audiotools.EncodingError. The easiest way that # leads into this exception is writing to a non writable path. with pytest.raises(IOError): self.execute_transcode(Transcode(), out_filename='/')
def test_transcode_discnumber_hack(self): """Tests transcoding with disc number hack enabled.""" self.execute_transcode(Transcode(discnumber_hack=True)) self.execute_transcode(Transcode(discnumber_hack=True), in_filename=self.in_filename_mp3all)
def test_transcode_composer_hack(self): """Tests transcoding with albumartist to composer hack enabled.""" self.execute_transcode(Transcode(albumartist_composer_hack=True)) self.execute_transcode(Transcode(albumartist_composer_hack=True), in_filename=self.in_filename_mp3empty)