コード例 #1
0
 def _make_test(self, ext=b'mp3', id3v23=False):
     self.create_temp_dir()
     src = os.path.join(_common.RSRC, b'full.' + ext)
     self.path = os.path.join(self.temp_dir, b'test.' + ext)
     shutil.copy(src, self.path)
     return mediafile.MediaFile(self.path, id3v23=id3v23)
コード例 #2
0
 def test_unicode_label_in_m4a(self):
     self.mf.label = u'foo\xe8bar'
     self.mf.save()
     new_mf = mediafile.MediaFile(self.path)
     self.assertEqual(new_mf.label, u'foo\xe8bar')
コード例 #3
0
 def setUp(self):
     super(TypeTest, self).setUp()
     path = os.path.join(_common.RSRC, b'full.mp3')
     self.mf = mediafile.MediaFile(path)
コード例 #4
0
 def test_opening_tagless_file_leaves_untouched(self):
     old_mtime = os.stat(self.empty).st_mtime
     mediafile.MediaFile(self.empty)
     new_mtime = os.stat(self.empty).st_mtime
     self.assertEqual(old_mtime, new_mtime)
コード例 #5
0
 def _mediafile_fixture(self, name, extension='mp3'):
     name = bytestring_path(name + '.' + extension)
     src = os.path.join(_common.RSRC, name)
     target = os.path.join(self.temp_dir, name)
     shutil.copy(src, target)
     return mediafile.MediaFile(target)
コード例 #6
0
 def test_soundcheck_non_ascii(self):
     # Make sure we don't crash when the iTunes SoundCheck field contains
     # non-ASCII binary data.
     f = mediafile.MediaFile(os.path.join(_common.RSRC,
                                          b'soundcheck-nonascii.m4a'))
     self.assertEqual(f.rg_track_gain, 0.0)
コード例 #7
0
 def test_old_ape_version_bitrate(self):
     media_file = os.path.join(_common.RSRC, b'oldape.ape')
     f = mediafile.MediaFile(media_file)
     self.assertEqual(f.bitrate, 0)
コード例 #8
0
 def test_tempo_with_bpm(self):
     # Some files have a string like "128 BPM" in the tempo field
     # rather than just a number.
     f = mediafile.MediaFile(os.path.join(_common.RSRC, b'bpm.mp3'))
     self.assertEqual(f.bpm, 128)