本文整理汇总了Python中eyed3.load方法的典型用法代码示例。如果您正苦于以下问题:Python eyed3.load方法的具体用法?Python eyed3.load怎么用?Python eyed3.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eyed3
的用法示例。
在下文中一共展示了eyed3.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testNewTagReleaseDate
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagReleaseDate(self, version=id3.ID3_DEFAULT_VERSION):
for date in ["1981", "1981-03-06", "1981-03"]:
orig_date = core.Date.parse(date)
for opts in [ ["--release-date=%s" % str(date), self.test_file] ]:
self._addVersionOpt(version, opts)
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert (retval == 0)
af = eyed3.load(self.test_file)
assert (af is not None)
assert (af.tag is not None)
assert (af.tag.release_date == orig_date)
示例2: testNewTagEncodingDate
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagEncodingDate(self, version=id3.ID3_DEFAULT_VERSION):
for opts in [ ["--encoding-date=2012-10-23T20:22", self.test_file] ]:
self._addVersionOpt(version, opts)
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert (retval == 0)
af = eyed3.load(self.test_file)
assert (af is not None)
assert (af.tag is not None)
assert (af.tag.encoding_date.year == 2012)
assert (af.tag.encoding_date.month == 10)
assert (af.tag.encoding_date.day == 23)
assert (af.tag.encoding_date.hour == 20)
assert (af.tag.encoding_date.minute == 22)
示例3: testNewTagTaggingDate
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagTaggingDate(self, version=id3.ID3_DEFAULT_VERSION):
for opts in [ ["--tagging-date=2012-10-23T20:22", self.test_file] ]:
self._addVersionOpt(version, opts)
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert (retval == 0)
af = eyed3.load(self.test_file)
assert (af is not None)
assert (af.tag is not None)
assert (af.tag.tagging_date.year == 2012)
assert (af.tag.tagging_date.month == 10)
assert (af.tag.tagging_date.day == 23)
assert (af.tag.tagging_date.hour == 20)
assert (af.tag.tagging_date.minute == 22)
示例4: testNewTagBpm
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagBpm(self):
for expected, opts in [ (1, ["--bpm=1", self.test_file]),
(180, ["--bpm=180", self.test_file]),
(117, ["--bpm", "116.7", self.test_file]),
(116, ["--bpm", "116.4", self.test_file]),
]:
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert (retval == 0)
af = eyed3.load(self.test_file)
assert (af is not None)
assert (af.tag is not None)
assert (af.tag.bpm == expected)
示例5: testBasicVbrMp3
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testBasicVbrMp3():
audio_file = eyed3.load(os.path.join(DATA_D, "notag-vbr.mp3"))
assert isinstance(audio_file, eyed3.mp3.Mp3AudioFile)
assert audio_file.info is not None
assert audio_file.info.time_secs == 262
assert audio_file.info.size_bytes == 6272220
# Variable bit rate, ~191
assert audio_file.info.bit_rate[0] == True
assert audio_file.info.bit_rate[1] == 191
assert audio_file.info.bit_rate_str == "~191 kb/s"
assert audio_file.info.mode == "Joint stereo"
assert audio_file.info.sample_freq == 44100
assert audio_file.info.mp3_header is not None
assert audio_file.info.mp3_header.version == 1.0
assert audio_file.info.mp3_header.layer == 3
assert audio_file.info.xing_header is not None
assert audio_file.info.lame_tag is not None
assert audio_file.info.vbri_header is None
assert audio_file.tag is None
示例6: test_ObjectFrame
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def test_ObjectFrame(audiofile, id3tag):
sixsixsix = b"\x29\x0a" * 666
with Path(__file__).open("rb") as fp:
thisfile = fp.read()
obj1 = ObjectFrame(description=u"Test Object", object_data=sixsixsix,
filename=u"666.txt", mime_type="text/satan")
obj2 = ObjectFrame(description=u"Test Object2", filename=unicode(__file__),
mime_type="text/python", object_data=thisfile)
id3tag.frame_set[OBJECT_FID] = obj1
id3tag.frame_set[OBJECT_FID].append(obj2)
audiofile.tag = id3tag
audiofile.tag.save()
file = eyed3.load(audiofile.path)
assert len(file.tag.objects) == 2
obj1_2 = file.tag.objects.get(u"Test Object")
assert obj1_2.mime_type == "text/satan"
assert obj1_2.object_data == sixsixsix
assert obj1_2.filename == u"666.txt"
obj2_2 = file.tag.objects.get(u"Test Object2")
assert obj2_2.mime_type == "text/python"
assert obj2_2.object_data == thisfile
assert obj2_2.filename == __file__
示例7: editTag
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def editTag(self, artist, song, full_filename):
song_path = '{}/{}'.format(Globals.DOWNLOAD_PATH, full_filename)
# song_path = '\ '.join(song_path.split())
# #song_path = song_path.replace(' ','\ ')
#song_path = song_path.replace('\\','\')
# song_path = '"' + song_path + '"'
print('Commenting out id3 tag stuff ID3TagEditInterface')
print 'song path: ',song_path
# audiofile = eyed3.load(song_path)
# audiofile.initTag()
# audiofile.tag.artist = artist.decode('utf-8')
# audiofile.tag.title = song.decode('utf-8')
# audiofile.tag.save()
示例8: selectFolder
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def selectFolder(self):
folder = QFileDialog()
selectFolder = folder.getExistingDirectory()
if not selectFolder:
pass
else:
self.folder.append(selectFolder)
mediaFiles = glob.glob(selectFolder+'/*.mp3')
allFolder = getAllFolder(selectFolder)
for i in allFolder:
mediaFiles.extend(glob.glob(i+'/*.mp3'))
length = len(mediaFiles)
self.native.singsTable.setRowCount(self.native.singsTable.rowCount()+length)
self.musicList = []
for i in enumerate(mediaFiles):
music = eyed3.load(i[1])
if not music:
self.singsTable.removeRow(i[0])
continue
name = music.tag.title
if not name:
name = i[1].split('\\')[-1][:-4]
author = music.tag.artist
if not author:
author = '????'
time = itv2time(music.info.time_secs)
self.musicList.append({'name': name, 'author': author, 'time': time, 'url': i[1], 'music_img': 'None'})
self.native.singsTable.setItem(i[0], 0, QTableWidgetItem(name))
self.native.singsTable.setItem(i[0], 1, QTableWidgetItem(author))
self.native.singsTable.setItem(i[0], 2, QTableWidgetItem(time))
# ???
示例9: test_import_load
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def test_import_load():
assert eyed3.load == core.load
# eyed3.load raises IOError for non files and non-existent files
示例10: test_ioerror_load
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def test_ioerror_load():
# Non existent
with pytest.raises(IOError):
core.load("filedoesnotexist.txt")
# Non file
with pytest.raises(IOError):
core.load(os.path.abspath(os.path.curdir))
示例11: test_none_load
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def test_none_load():
# File mimetypes that are not supported return None
assert core.load(__file__) == None
示例12: testNewTagArtist
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagArtist(self, version=id3.ID3_DEFAULT_VERSION):
for opts in [ ["-a", "The Cramps", self.test_file],
["--artist=The Cramps", self.test_file] ]:
self._addVersionOpt(version, opts)
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert retval == 0
af = eyed3.load(self.test_file)
assert af is not None
assert af.tag is not None
assert af.tag.artist == u"The Cramps"
示例13: testNewTagComposer
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagComposer(self, version=id3.ID3_DEFAULT_VERSION):
for opts in [ ["--composer=H.R.", self.test_file] ]:
self._addVersionOpt(version, opts)
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert retval == 0
af = eyed3.load(self.test_file)
assert af is not None
assert af.tag is not None
assert af.tag.composer == u"H.R."
示例14: testNewTagAlbumArtist
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagAlbumArtist(self, version=id3.ID3_DEFAULT_VERSION):
for opts in [ ["-b", "Various Artists", self.test_file],
["--album-artist=Various Artists", self.test_file] ]:
self._addVersionOpt(version, opts)
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert (retval == 0)
af = eyed3.load(self.test_file)
assert af is not None
assert af.tag is not None
assert af.tag.album_artist == u"Various Artists"
示例15: testNewTagTitle
# 需要导入模块: import eyed3 [as 别名]
# 或者: from eyed3 import load [as 别名]
def testNewTagTitle(self, version=id3.ID3_DEFAULT_VERSION):
for opts in [ ["-t", "Green Door", self.test_file],
["--title=Green Door", self.test_file] ]:
self._addVersionOpt(version, opts)
with RedirectStdStreams() as out:
args, _, config = main.parseCommandLine(opts)
retval = main.main(args, config)
assert (retval == 0)
af = eyed3.load(self.test_file)
assert (af is not None)
assert (af.tag is not None)
assert (af.tag.title == u"Green Door")