import json from Orm import Video from playhouse.shortcuts import model_to_dict, dict_to_model class VideoService: def getOneByVideoId(videoId): return Video.get_or_none(Video.videoId == videoId) def createOne(videoId, channelId, videoTitle, videoLen, videoType, videoPublishTime, videoLanguage, isDownload): Video.create(videoId=videoId, channelId=channelId, videoTitle=videoTitle, videoLen=videoLen, videoType=videoType, videoPublishTime=videoPublishTime, videoLanguage=videoLanguage, isDownload=isDownload) def updateLenByVideoId(videoId, len): Video.update(videoLen=len).where(Video.videoId == videoId).execute() def updateIsDownloadByVideoId(videoId, isDownload): Video.update(isDownload=isDownload).where( Video.videoId == videoId).execute()