当前位置: 首页>>代码示例>>Python>>正文


Python MetaData.add_image方法代码示例

本文整理汇总了Python中audiotools.MetaData.add_image方法的典型用法代码示例。如果您正苦于以下问题:Python MetaData.add_image方法的具体用法?Python MetaData.add_image怎么用?Python MetaData.add_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在audiotools.MetaData的用法示例。


在下文中一共展示了MetaData.add_image方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: inject_metadata

# 需要导入模块: from audiotools import MetaData [as 别名]
# 或者: from audiotools.MetaData import add_image [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
开发者ID:hzlf,项目名称:openbroadcast,代码行数:58,代码来源:_orig_mediamodels.py

示例2: inject_metadata

# 需要导入模块: from audiotools import MetaData [as 别名]
# 或者: from audiotools.MetaData import add_image [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
开发者ID:hzlf,项目名称:openbroadcast,代码行数:57,代码来源:process.py

示例3: metadata_audiotools

# 需要导入模块: from audiotools import MetaData [as 别名]
# 或者: from audiotools.MetaData import add_image [as 别名]
    def metadata_audiotools(self, path, media):

        from audiotools import MetaData
        import audiotools

        meta = MetaData()

        # release-level metadata
        if media.release and media.release.main_image:

            if meta.supports_images() and os.path.exists(media.release.main_image.path):
                opt = dict(size=(200, 200), crop=True, bw=False, quality=80)
                image = get_thumbnailer(media.release.main_image).get_thumbnail(opt)
                meta.add_image(get_raw_image(image.path, 0))

        audiotools.open(path).update_metadata(meta)

        return
开发者ID:alainwolf,项目名称:openbroadcast.org,代码行数:20,代码来源:process.py


注:本文中的audiotools.MetaData.add_image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。