Example #1
0
    def extract_metadata(self):
        self.__log.debug('Extracting metadata for %s', self.__filepath)

        if self._ask_gpodder_for_metadata():
            if self.coverart is None:
                self.coverart = self.__find_coverart()
            return

        filetype = util.detect_filetype(self.__filepath)

        if filetype == 'mp3':
            import mutagen.mp3 as meta_parser
        elif filetype == 'ogg':
            import mutagen.oggvorbis as meta_parser
        elif filetype == 'flac':
            import mutagen.flac as meta_parser
        elif filetype in ['mp4', 'm4a']:
            import mutagen.mp4 as meta_parser
        else:
            self.__log.info(
                'Extracting metadata not supported for %s files.', filetype )
            return False

        try:
            metadata = meta_parser.Open(self.__filepath)
            self.__metadata_extracted = True
        except Exception, e:
            self.title = util.pretty_filename(self.__filepath)
            self.__log.exception('Error running metadata parser...')
            self.__metadata_extracted = False
            return False
Example #2
0
    def extract_metadata(self):
        self.__log.debug('Extracting metadata for %s', self.__filepath)

        if self._ask_gpodder_for_metadata():
            if self.coverart is None:
                self.coverart = self.__find_coverart()
            return

        filetype = util.detect_filetype(self.__filepath)

        if filetype == 'mp3':
            import mutagen.mp3 as meta_parser
        elif filetype == 'ogg':
            import mutagen.oggvorbis as meta_parser
        elif filetype == 'flac':
            import mutagen.flac as meta_parser
        elif filetype in ['mp4', 'm4a']:
            import mutagen.mp4 as meta_parser
        else:
            self.__log.info('Extracting metadata not supported for %s files.',
                            filetype)
            return False

        try:
            metadata = meta_parser.Open(self.__filepath)
            self.__metadata_extracted = True
        except Exception, e:
            self.title = util.pretty_filename(self.__filepath)
            self.__log.exception('Error running metadata parser...')
            self.__metadata_extracted = False
            return False
Example #3
0
    def __get_title(self):
        """ Get the title of item, priority is (most important first):
            1. the title given in playlist metadata
            2. the title in the file's metadata (ex. ID3)
            3. a "pretty" version of the filename """

        if self.playlist_title is not None:
            return self.playlist_title
        elif self.__metadata.title:
            return self.__metadata.title
        else:
            return util.pretty_filename(self.filepath)
Example #4
0
    def __get_title(self):
        """ Get the title of item, priority is (most important first):
            1. the title given in playlist metadata
            2. the title in the file's metadata (ex. ID3)
            3. a "pretty" version of the filename """

        if self.playlist_title is not None:
            return self.playlist_title
        elif self.__metadata.title:
            return self.__metadata.title
        else:
            return util.pretty_filename(self.filepath)