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


Python BaseVideo.backend方法代码示例

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


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

示例1: create_video_from_json

# 需要导入模块: from weboob.capabilities.video import BaseVideo [as 别名]
# 或者: from weboob.capabilities.video.BaseVideo import backend [as 别名]
    def create_video_from_json(self, _video):
        video = BaseVideo()
        video.id = u'%s' % _video['id']
        video.backend = u'%s' % _video['id'].split('@')[-1]

        if 'url' in _video.keys():
            video.url = u'%s' % _video['url']

        if 'thumbnail' in _video.keys() and _video['thumbnail'] and 'url' in _video['thumbnail'].keys():
            video.thumbnail = BaseImage()
            video.thumbnail.url = u'%s' % _video['thumbnail']['url']
        else:
            video.thumbnail.url = u''
        video.title = u'%s' % _video['title']

        if _video['date']:
            _date = re.search('(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).*', _video['date'])

            try:
                datetime.strptime(_date.group(1), '%Y-%m-%d %H:%M:%S')
            except TypeError:
                datetime(*(time.strptime(_date.group(1), '%Y-%m-%d %H:%M:%S')[0:6]))

        video.description = u'%s' % _video['description']
        video.author = u'%s' % _video['author']

        if _video['duration']:
            _duration = _video['duration'].split(':')
            video.duration = timedelta(hours=int(_duration[0]), minutes=int(_duration[1]), seconds=int(_duration[2]))

        return video
开发者ID:Konubinix,项目名称:weboob,代码行数:33,代码来源:videoobmc.py

示例2: separate_collections_and_videos

# 需要导入模块: from weboob.capabilities.video import BaseVideo [as 别名]
# 或者: from weboob.capabilities.video.BaseVideo import backend [as 别名]
 def separate_collections_and_videos(self, objs):
     videos = []
     categories = []
     for obj in objs:
         if self.is_category(obj):
             categories.append(self.create_category_from_json(obj))
         else:
             video = BaseVideo()
             video.id = obj['id'].split('@')[0]
             video.backend = obj['id'].split('@')[-1]
             videos.append(video)
     return categories, videos
开发者ID:Konubinix,项目名称:weboob,代码行数:14,代码来源:videoobmc.py


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