https://bugs.gpodder.org/show_bug.cgi?id=533

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #25 from [email protected] 2010-02-28 20:07:06 GMT ---
(In reply to comment #24)
> Created an attachment (id=443)
 --> (https://bugs.gpodder.org/attachment.cgi?id=443) [details]
> Add file tagging, beta
> 
> This should work. I give it beta status

To get this to work for me I had to change tagger.py to the following.

The changes are UTF8 encoding the filename and saving the file at the end, but
I'm not sure if the save is actually required.

Ian

# gPodder - A media aggregator and podcast client
# Copyright (c) 2010 Hilton Shumway
#
# gPodder is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# gPodder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

#This file is a track tagger for gPodder. It will correct the tags on poorly-
#tagged comment files.




from gpodder.liblogger import log


import tagpy

class Tagger(object):
    """This class accepts a path to a file and updates the tags for it based 
    on the attributes of the file (name of podcast, episode number, etc) and 
    also the user's config.
    """

    def __init___(self,config):
        self.config = config    

    def update_tag(self, episode):
        filename = episode.local_filename(create=False)
        if filename is None:
            log('Cannot update tag of non-existing file')
            return False
        try: 
            fileref = tagpy.FileRef(filename.encode('utf-8'))
            file = fileref.file()
            tag = fileref.tag()
            except Exception, e:
            log('Unable to read tag %s', e.message)
            return False

        self.artist = self.config.tag_artist
        log('Artist %s', self.config.tag_artist)
        log('Artist %s', self.artist)
        self.album = self.config.tag_album
        log('Album %s', self.config.tag_album)
        log('Album %s', self.album)
        self.genre = self.config.tag_genre
        log('Genre %s', self.config.tag_genre)
        log('Genre %s', self.genre)
        self.title = self.config.tag_title
        log('Title %s', self.config.tag_title)
        log('Title %s', self.title)
        tagvalues = {'channel.title': None,'episode.title':None,'artist':None}
        tagvalues['channel.title'] = episode.channel.title
        tagvalues['episode.title'] = episode.title
        #tagvalues['artist'] =  #Figure this out too


        tag.title = self.title % tagvalues
        tag.genre = self.genre % tagvalues
        tag.album = self.album % tagvalues

        log('Artist %s', tag.artist)
        log('Album %s', tag.album)
        log('Genre %s', tag.genre)
        log('Title %s', tag.title)
        file.save()
        #tag.title = self.title 
        #tag.genre = self.genre 
        #tag.album = self.album 
        #tag.artist = self.artist % tagvalues # Don't know what to use for this
yet
        log('Tagging Finished')
        return True

-- 
Configure bugmail: https://bugs.gpodder.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
_______________________________________________
gPodder-Bugs mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-bugs

Reply via email to