コード例 #1
0
    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
0
ファイル: process.py プロジェクト: hzlf/openbroadcast
    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
コード例 #3
0
    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
コード例 #4
0
 def incect_metadata(self, path, media):
     
     log = logging.getLogger('util.process.Process.incect_metadata')
     log.debug('incect metadata to: %s' % (path))
     log.debug('source: %s' % (media))
     
     
     """
     audiotools.MetaData
     """
     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
コード例 #5
0
ファイル: process.py プロジェクト: ppp0/openbroadcast
    def incect_metadata(self, path, media):

        log = logging.getLogger('util.process.Process.incect_metadata')
        log.debug('incect metadata to: %s' % (path))
        log.debug('source: %s' % (media))
        """
        audiotools.MetaData
        """
        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
コード例 #6
0
    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