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


Python Video.name方法代码示例

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


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

示例1: import_vdn_dataset_url

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import name [as 别名]
def import_vdn_dataset_url(server, url, user):
    r = requests.get(url)
    response = r.json()
    vdn_dataset = create_dataset(response, server)
    vdn_dataset.save()
    video = Video()
    if user:
        video.uploader = user
    video.name = vdn_dataset.name
    video.vdn_dataset = vdn_dataset
    video.save()
    if vdn_dataset.download_url:
        task_name = 'import_vdn_file'
        import_video_task = TEvent()
        import_video_task.video = video
        import_video_task.operation = task_name
        import_video_task.save()
        app.send_task(name=task_name, args=[import_video_task.pk, ], queue=settings.TASK_NAMES_TO_QUEUE[task_name])
    elif vdn_dataset.aws_key and vdn_dataset.aws_bucket:
        task_name = 'import_vdn_s3'
        import_video_task = TEvent()
        import_video_task.video = video
        import_video_task.operation = task_name
        import_video_task.save()
        app.send_task(name=task_name, args=[import_video_task.pk, ], queue=settings.TASK_NAMES_TO_QUEUE[task_name])
    else:
        raise NotImplementedError
开发者ID:ycaihua,项目名称:DeepVideoAnalytics,代码行数:29,代码来源:shared.py

示例2: parse_video_data

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import name [as 别名]
    def parse_video_data(self, meta_data, video_url):
        """
        提取视频数据
        
        参数:
            meta_data tuple 包含(playlist_id, vid)
            video_url string 提取页面的地址
        
        返回:
            temp_video Video()实例
        """

        r = requests.get('http://pl.hd.sohu.com/videolist', params={'playlistid': meta_data[0], 'vid': meta_data[1]})
        if r.status_code == 200:
            info = json.loads(r.text)
            extra_video_info = self.extra_video_info(info, video_url)
            vote_info = self.get_vote_info(meta_data)
            if vote_info:
                temp_video = Video()

                temp_video.name = extra_video_info['name']
                temp_video.en_name = info['tvEnglishName']
                temp_video.thumbnail = extra_video_info['largePicUrl']
                temp_video.directors = str(info['directors'])
                temp_video.actors = str(info['actors'])
                temp_video.categories = str(info['categories'])
                temp_video.description = info['albumDesc']
                temp_video.page_url = video_url

                temp_video.album_name = info['albumName']
                temp_video.album_thumbnail = info['largeVerPicUrl']
                temp_video.album_page_url = info['albumPageUrl']
                temp_video.default_page_url = info['defaultPageUrl']

                temp_video.playlist_id = meta_data[0]
                temp_video.vid = meta_data[1]
                temp_video.pid = info['pid']

                temp_video.update_time = info['updateTime']
                temp_video.publish_year = info['publishYear']
                temp_video.area = info['area']
                temp_video.play_length = extra_video_info['playLength']
                temp_video.publish_time = extra_video_info['publishTime']

                temp_video.up_vote = int(vote_info[0])
                temp_video.down_vote = int(vote_info[1])

                return temp_video
        else:
            print('无法读取网页', video_url)
开发者ID:ysmoe,项目名称:sohutv,代码行数:52,代码来源:get_data.py

示例3: handle_youtube_video

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import name [as 别名]
def handle_youtube_video(name, url, extract=True, user=None, rate=30, rescale=0):
    video = Video()
    if user:
        video.uploader = user
    video.name = name
    video.url = url
    video.youtube_video = True
    video.save()
    task_name = 'segment_video'
    extract_frames_task = TEvent()
    extract_frames_task.video = video
    extract_frames_task.operation = task_name
    extract_frames_task.arguments_json = json.dumps({'rate': rate,'rescale': rescale})
    extract_frames_task.save()
    if extract:
        app.send_task(name=task_name, args=[extract_frames_task.pk, ], queue=settings.TASK_NAMES_TO_QUEUE[task_name])
    return video
开发者ID:ycaihua,项目名称:DeepVideoAnalytics,代码行数:19,代码来源:shared.py

示例4: handle_uploaded_file

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import name [as 别名]
def handle_uploaded_file(f, name, extract=True, user=None, rate=30, rescale=0):
    video = Video()
    if user:
        video.uploader = user
    video.name = name
    video.save()
    primary_key = video.pk
    filename = f.name
    filename = filename.lower()
    if filename.endswith('.dva_export.zip'):
        create_video_folders(video, create_subdirs=False)
        with open('{}/{}/{}.{}'.format(settings.MEDIA_ROOT, video.pk, video.pk, filename.split('.')[-1]),
                  'wb+') as destination:
            for chunk in f.chunks():
                destination.write(chunk)
        video.uploaded = True
        video.save()
        task_name = 'import_video_by_id'
        import_video_task = TEvent()
        import_video_task.video = video
        import_video_task.save()
        app.send_task(name=task_name, args=[import_video_task.pk, ], queue=settings.TASK_NAMES_TO_QUEUE[task_name])
    elif filename.endswith('.mp4') or filename.endswith('.flv') or filename.endswith('.zip'):
        create_video_folders(video, create_subdirs=True)
        with open('{}/{}/video/{}.{}'.format(settings.MEDIA_ROOT, video.pk, video.pk, filename.split('.')[-1]),
                  'wb+') as destination:
            for chunk in f.chunks():
                destination.write(chunk)
        video.uploaded = True
        if filename.endswith('.zip'):
            video.dataset = True
        video.save()
        if extract:
            extract_frames_task = TEvent()
            extract_frames_task.arguments_json = json.dumps({'rate': rate,'rescale': rescale})
            extract_frames_task.video = video
            task_name = 'extract_frames' if video.dataset else 'segment_video'
            extract_frames_task.operation = task_name
            extract_frames_task.save()
            app.send_task(name=task_name, args=[extract_frames_task.pk, ],
                          queue=settings.TASK_NAMES_TO_QUEUE[task_name])
    else:
        raise ValueError, "Extension {} not allowed".format(filename.split('.')[-1])
    return video
开发者ID:ycaihua,项目名称:DeepVideoAnalytics,代码行数:46,代码来源:shared.py


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