Beispiel #1
0
def iter_chapters():
    for course in Course.query:
        for i in range(randint(3, 10)):
            yield Chapter(
                name=fake.sentence(),
                course=course,
                vedio_url='https://labfile.oss.aliyuncs.com/courses/923/week2_mp4/2-1-1-mac.mp4',
                vedio_duration='{}:{}'.format(randint(10, 30), randint(10, 59))
            )
def iter_chapters():
    for course in Course.query:
        # 每个课程生成 3-10 个章节
        for i in range(randint(3,10)):
            yield Chapter(
                    # 使用 faker 生成一个句子作为章节名称
                    name=fake.sentence(),
                    course=course,
                    vedio_url='https://labfile.oss/aliyuncs.com/courses/923/week2_mp4/2-1-1-mac.mp4',  # 章节视频自行定义
                    vedio_duration='{}:{}'.format(randint(10,30), randint(10,59))
                    )
def iter_chapters():
    for course in Course.query:
        # 每个课程生成 3~9 个章节
        for i in range(randint(3, 10)):
            yield Chapter(
                # 使用 faker 生成一个句子作为章节名称
                name=fake.sentence(),
                course=course,
                # 所以章节的视频设置成了楼+课程中的某个视频
                video_url='https://labfile.oss.aliyuncs.com/courses/923/week2_mp4/2-1-1-mac.mp4',
                # 视频时长
                video_duration='{}:{}'.format(randint(10, 30), randint(10, 59))
            )
Beispiel #4
0
def iter_chapters():
    for course in Course.query:
        # 每个课程生成 3~10 个章节
        for i in range(randint(3, 10)):
            yield Chapter(
                # 使用 faker 生成一个句子作为章节名称
                name=fake.sentence(),
                course=course,
                # 章节的视频
                video_url='http://aspwangxiaona.get.vip/S2017/ceshi.mp4',
                # 视频时长
                now='{}:{}'.format(randint(10, 30), randint(10, 59))
            )