コード例 #1
0
ファイル: taggerutils.py プロジェクト: triplem/discogstagger
    def embed_coverart_track(self, disc, track, imgdata):
        """
            Embed cover art into a single file
        """
        if disc.target_dir != None:
            track_dir = os.path.join(self.album.target_dir, disc.target_dir)
        else:
            track_dir = self.album.target_dir

        track_file = os.path.join(track_dir, track.new_file)
        metadata = MediaFile(track_file)
        metadata.art = imgdata
        metadata.save()
コード例 #2
0
ファイル: taggerutils.py プロジェクト: triplem/discogstagger
    def embed_coverart_track(self, disc, track, imgdata):
        """
            Embed cover art into a single file
        """
        if disc.target_dir != None:
            track_dir = os.path.join(self.album.target_dir, disc.target_dir)
        else:
            track_dir = self.album.target_dir

        track_file = os.path.join(track_dir, track.new_file)
        metadata = MediaFile(track_file)
        metadata.art = imgdata
        metadata.save()
コード例 #3
0
    def embed_coverart_track(self, disc, track, imgdata):
        """
            Embed cover art into a single file
        """

        if disc.target_dir != None:
            track_dir = os.path.join(self.album.target_dir, disc.target_dir)
        else:
            track_dir = self.album.target_dir

        track_file = os.path.join(track_dir, track.new_file)
        metadata = MediaFile(track_file)
        try:
            metadata.art = imgdata
            metadata.save()
        except Exception as e:
            logger.error("Unable to embed image '{}'".format(track_file))
            print(e)
コード例 #4
0
ファイル: taggerutils.py プロジェクト: triplem/discogstagger
    def tag_single_track(self, target_folder, track):
        # load metadata information
        logger.debug("target_folder: %s" % target_folder)

        metadata = MediaFile(os.path.join(target_folder, track.new_file))

        # read already existing (and still wanted) properties
        keepTags = {}
        for name in self.keep_tags.split(","):
            logger.debug("name %s" % name)
            if getattr(metadata, name):
                keepTags[name] = getattr(metadata, name)

        # remove current metadata
        metadata.delete()

        # set album metadata
        metadata.album = self.album.title
        metadata.composer = self.album.artist

        # use list of albumartists
        metadata.albumartists = self.album.artists

        # !TODO really, or should we generate this using a specific method?
        metadata.albumartist_sort = self.album.sort_artist

        # !TODO should be joined
        metadata.label = self.album.labels[0]

        metadata.year = self.album.year
        metadata.country = self.album.country

        metadata.catalognum = self.album.catnumbers[0]

        # add styles to the grouping tag
        metadata.groupings = self.album.styles

        # use genres to allow multiple genres in muliple fields
        metadata.genres = self.album.genres

        # this assumes, that there is a metadata-tag with the id_tag_name in the
        # metadata object
        setattr(metadata, self.config.id_tag_name, self.album.id)
        metadata.discogs_release_url = self.album.url

        metadata.disc = track.discnumber
        metadata.disctotal = len(self.album.discs)

        if self.album.is_compilation:
            metadata.comp = True

        metadata.comments = self.album.notes

        tags = self.config.get_configured_tags
        logger.debug("tags: %s" % tags)
        for name in tags:
            value = self.config.get("tags", name)
            if not value == None:
                setattr(metadata, name, value)

        # set track metadata
        metadata.title = track.title
        metadata.artists = track.artists

        # !TODO take care about sortartist ;-)
        metadata.artist_sort = track.sort_artist
        metadata.track = track.tracknumber

        metadata.tracktotal = len(self.album.disc(track.discnumber).tracks)

        if not keepTags is None:
            for name in keepTags:
                setattr(metadata, name, keepTags[name])

        metadata.save()
コード例 #5
0
ファイル: taggerutils.py プロジェクト: triplem/discogstagger
    def tag_single_track(self, target_folder, track):
        # load metadata information
        logger.debug("target_folder: %s" % target_folder)

        metadata = MediaFile(os.path.join(target_folder, track.new_file))

        # read already existing (and still wanted) properties
        keepTags = {}
        for name in self.keep_tags.split(","):
            logger.debug("name %s" % name)
            if getattr(metadata, name):
                keepTags[name] = getattr(metadata, name)

        # remove current metadata
        metadata.delete()

        # set album metadata
        metadata.album = self.album.title
        metadata.composer = self.album.artist

        # use list of albumartists
        metadata.albumartists = self.album.artists

# !TODO really, or should we generate this using a specific method?
        metadata.albumartist_sort = self.album.sort_artist

# !TODO should be joined
        metadata.label = self.album.labels[0]

        metadata.year = self.album.year
        metadata.country = self.album.country

        metadata.catalognum = self.album.catnumbers[0]

        # add styles to the grouping tag
        metadata.groupings = self.album.styles

        # use genres to allow multiple genres in muliple fields
        metadata.genres = self.album.genres

        # this assumes, that there is a metadata-tag with the id_tag_name in the
        # metadata object
        setattr(metadata, self.config.id_tag_name, self.album.id)
        metadata.discogs_release_url = self.album.url

        metadata.disc = track.discnumber
        metadata.disctotal = len(self.album.discs)

        if self.album.is_compilation:
            metadata.comp = True

        metadata.comments = self.album.notes

        tags = self.config.get_configured_tags
        logger.debug("tags: %s" % tags)
        for name in tags:
            value = self.config.get("tags", name)
            if not value == None:
                setattr(metadata, name, value)

        # set track metadata
        metadata.title = track.title
        metadata.artists = track.artists

# !TODO take care about sortartist ;-)
        metadata.artist_sort = track.sort_artist
        metadata.track = track.tracknumber

        metadata.tracktotal = len(self.album.disc(track.discnumber).tracks)

        if not keepTags is None:
            for name in keepTags:
                setattr(metadata, name, keepTags[name])

        metadata.save()