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


Python File.tags['date']方法代码示例

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


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

示例1: write_info2file

# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
    def write_info2file(self, info):
        # open file with mutagen
        audio = File(info['filename'], easy=True)
        if audio is None:
            return

        # write title+album information into audio files
        if audio.tags is None:
            audio.add_tags()

        # write album+title
        if info['album'] is not None:
            audio.tags['album'] = info['album']
        if info['title'] is not None:
            audio.tags['title'] = info['title']

        # write genre tag
        if self.container.config.genre_tag is not None:
            audio.tags['genre'] = self.container.config.genre_tag
        else:
            audio.tags['genre'] = ''

        # write pubDate
        if info['pubDate'] is not None:
            audio.tags['date'] = info['pubDate']

        audio.save()
开发者ID:fk-lx,项目名称:gpodder,代码行数:29,代码来源:tagging.py

示例2: write_basic_tags

# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
    def write_basic_tags(self, modify_tags, set_artist_to_album, set_version):
        audio = File(self.filename, easy=True)

        if audio.tags is None:
            audio.add_tags()

        if modify_tags:
            if self.album is not None:
                audio.tags['album'] = self.album

            if self.title is not None:
                audio.tags['title'] = self.title

            if self.genre is not None:
                audio.tags['genre'] = self.genre

            if self.pubDate is not None:
                audio.tags['date'] = self.pubDate

            if set_artist_to_album:
                audio.tags['artist'] = self.album

        if type(audio) is EasyMP3:
            audio.save(v2_version=set_version)
        else:
            # Not actually audio
            audio.save()
开发者ID:gpodder,项目名称:gpodder,代码行数:29,代码来源:tagging.py

示例3: on_episode_downloaded

# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
    def on_episode_downloaded(self, episode):
        # exit if mutagen is not installed
        if not mutagen_installed:
            return

        # read filename (incl. file path) from gPodder database
        filename = episode.local_filename(create=False, check_only=True)
        if filename is None:
            return

        # open file with mutagen
        audio = File(filename, easy=True)
        if audio is None:
            return

        # read title+album from gPodder database
        album = episode.channel.title
        title = episode.title
        if (strip_album_from_title and title and album and title.startswith(album)):
            title = title[len(album):].lstrip()

        # convert pubDate to string
        try:
            pubDate =  datetime.datetime.fromtimestamp(episode.pubDate).strftime('%Y-%m-%d %H:%M')
        except:
            pubDate = None

        # write title+album information into audio files
        if audio.tags is None:
            audio.add_tags()

        # write album+title
        if album is not None:
            audio.tags['album'] = album
        if title is not None:
            audio.tags['title'] = title

        # write genre tag
        if genre_tag is not None:
            audio.tags['genre'] = genre_tag
        else:
            audio.tags['genre'] = ''

        # write pubDate
        if pubDate is not None:
            audio.tags['date'] = pubDate

        audio.save()
        log(u'tagging.on_episode_downloaded(%s/%s)' % (episode.channel.title, episode.title))
开发者ID:brot,项目名称:gpodder-hook-scripts,代码行数:51,代码来源:tagging_hook.py

示例4: write_basic_tags

# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
    def write_basic_tags(self):
        audio = File(self.filename, easy=True)

        if audio.tags is None:
            audio.add_tags()

        if self.album is not None:
            audio.tags['album'] = self.album

        if self.title is not None:
            audio.tags['title'] = self.title

        if self.genre is not None:
            audio.tags['genre'] = self.genre

        if self.pubDate is not None:
            audio.tags['date'] = self.pubDate

        audio.save()
开发者ID:GordCaswell,项目名称:gpodderportable,代码行数:21,代码来源:tagging.py

示例5: write_basic_tags

# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
    def write_basic_tags(self):
        audio = File(self.filename, easy=True)

        if audio.tags is None:
            audio.add_tags()

        if self.album is not None:
            audio.tags['album'] = self.album

        if self.title is not None:
            audio.tags['title'] = self.title

        if self.genre is not None:
            audio.tags['genre'] = self.genre

        if self.pubDate is not None:
            audio.tags['date'] = self.pubDate

        if self.container.config.set_artist_to_album:
            audio.tags['artist'] = self.album

        audio.save()
开发者ID:Mortal,项目名称:gpodder,代码行数:24,代码来源:tagging.py


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