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


Python Video.raw方法代码示例

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


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

示例1: getVideos

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import raw [as 别名]
def getVideos():
    #Sending Videos#
    #input = {"result":"OK", "videos": [
    #    { "videoId":"1" , "fileName":"abc.mp4", "boxLink":"https://box.com/s/abc.mp4", "folderName":"Game234" },
    #    { "videoId":"2" , "fileName":"abc2.mp4", "boxLink":"https://box.com/s/abc2.mp4", "folderName":"Game234" },
    #    { "videoId":"3" , "fileName":"abc3.mp4", "boxLink":"https://box.com/s/abc3.mp4", "folderName":"Game23" }
    #]}
    #return json.dumps(input)

    #Check if there are any files with not DONE status
    #If so, return those file details
    print 'getVideos called'
    videos = []
    videosInDb = 'True'
    myDB.connect()

    try:
        #for record in Video.select().where(Video.status == 'N').get():
        for record in Video.raw("select * from vm_videos where status='N'"):
            videos.append({'videoId':record.videoId, 'fileName':record.fileName,
                       'folderName':record.folderName, 'boxLink':record.boxLink})
        #print videos
        if len(videos) > 0:
            print str(videos)
            responseJson = {'result':'OK', 'videos':videos}
            #return jsonify(results = videos)
            return jsonify(results = responseJson)
    except Video.DoesNotExist:
        videosInDb = 'False'

    """api_response = getBoxFolder('1311201105')
    #If no files in the table, get it from Box
    items = api_response.json['item_collection']
    filesResponse = []
    for record in items['entries']:
        folderId = record['id']
        count = Video.select().where(Video.folderId == folderId).count()
        if count >= 1:
            continue
        else:
            #Call file API, insert them into Videos table and return those details
            files = getBoxFolder(folderId)
            fileItems = files.json['item_collection']['entries']
            for rs in fileItems:
                print rs['name']
                print rs['id']
            filesResponse.append(fileItems)
            return jsonify(results=filesResponse)
    """
    myDB.close()
    return 'No New Videos'
开发者ID:schiluka,项目名称:vmedia-heroku,代码行数:53,代码来源:app.py

示例2: getFileDetails

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import raw [as 别名]
def getFileDetails():
    #Check if there are any files with not DONE status
    #If so, return those file details
    videos = []
    videosInDb = 'True'
    myDB.connect()
    try:
        #for record in Video.select().where(Video.status == 'N').get():
        for record in Video.raw("select * from vm_videos where status='N'"):
            videos.append({'videoId':record.videoId, 'fileName':record.fileName,
                       'folderName':record.folderName, 'boxLink':record.boxLink})
        #print videos
        if len(videos) > 0:
            return jsonify(results = videos)
    except Video.DoesNotExist:
        videosInDb = 'False'

    """api_response = getBoxFolder('1311201105')
    #If no files in the table, get it from Box
    items = api_response.json['item_collection']
    filesResponse = []
    for record in items['entries']:
        folderId = record['id']
        count = Video.select().where(Video.folderId == folderId).count()
        if count >= 1:
            continue
        else:
            #Call file API, insert them into Videos table and return those details
            files = getBoxFolder(folderId)
            fileItems = files.json['item_collection']['entries']
            for rs in fileItems:
                print rs['name']
                print rs['id']
            filesResponse.append(fileItems)
            return jsonify(results=filesResponse)
    """
    myDB.close()
    return 'No New Videos'        #Insert here
开发者ID:schiluka,项目名称:vmedia-heroku,代码行数:40,代码来源:app.py


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