本文整理汇总了Python中audiotools.MetaData.date方法的典型用法代码示例。如果您正苦于以下问题:Python MetaData.date方法的具体用法?Python MetaData.date怎么用?Python MetaData.date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类audiotools.MetaData
的用法示例。
在下文中一共展示了MetaData.date方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: inject_metadata
# 需要导入模块: from audiotools import MetaData [as 别名]
# 或者: from audiotools.MetaData import date [as 别名]
def inject_metadata(self, format, version):
"""
audiotools.MetaData
"""
meta = MetaData()
"""
prepare metadata object
"""
# track-level metadata
meta.track_name = self.name
meta.track_number = self.tracknumber
meta.media = 'DIGITAL'
meta.isrc = self.isrc
""" Needs fixing...
for extra_artist in self.extra_artists.all():
print extra_artist
meta.performer_name =
meta.composer_name =
meta.conductor_name =
"""
# release-level metadata
if self.release:
meta.album_name = self.release.name
meta.catalog = self.release.catalognumber
meta.track_total = len(self.release.media_release.all())
if self.release.releasedate:
try:
meta.year = str(self.release.releasedate.year)
meta.date = str(self.release.releasedate)
except Exception, e:
print e
try:
cover_image = self.release.cover_image if self.release.cover_image else self.release.main_image
if meta.supports_images() and cover_image:
for i in meta.images():
meta.delete_image(i)
opt = dict(size=(200, 200), crop=True, bw=False, quality=80)
image = get_thumbnailer(cover_image).get_thumbnail(opt)
meta.add_image(get_raw_image(image.path, 0))
except Exception, e:
print e
示例2: inject_metadata
# 需要导入模块: from audiotools import MetaData [as 别名]
# 或者: from audiotools.MetaData import date [as 别名]
def inject_metadata(self, path, media):
log = logging.getLogger('util.process.Process.inject_metadata')
log.debug('inject metadata to: %s' % (path))
log.debug('source: %s' % (media))
"""
audiotools.MetaData
http://audiotools.sourceforge.net/programming/audiotools.html?highlight=set_metadata#audiotools.MetaData
class audiotools.MetaData([track_name][, track_number][, track_total][, album_name][, artist_name]
[, performer_name][, composer_name][, conductor_name][, media][, ISRC][, catalog][, copyright]
[, publisher][, year][, data][, album_number][, album_total][, comment][, images])
"""
meta = MetaData()
"""
prepare metadata object
"""
# track-level metadata
meta.track_name = media.name
meta.track_number = media.tracknumber
meta.media = 'DIGITAL'
meta.isrc = media.isrc
meta.genre = 2
# release-level metadata
if media.release:
meta.album_name = media.release.name
meta.catalog = media.release.catalognumber
meta.track_total = len(media.release.media_release.all())
if media.release.releasedate:
try:
meta.year = str(media.release.releasedate.year)
meta.date = str(media.release.releasedate)
except Exception, e:
print e
try:
cover_image = media.release.cover_image if media.release.cover_image else media.release.main_image
if meta.supports_images() and cover_image:
for i in meta.images():
meta.delete_image(i)
opt = dict(size=(200, 200), crop=True, bw=False, quality=80)
image = get_thumbnailer(cover_image).get_thumbnail(opt)
meta.add_image(get_raw_image(image.path, 0))
except Exception, e:
print e