You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.6 KiB
75 lines
1.6 KiB
9 months ago
|
from peewee import *
|
||
|
import Contant
|
||
|
import argparse
|
||
|
from LoggerUtils import Logger
|
||
|
|
||
|
parser = argparse.ArgumentParser(description='')
|
||
|
parser.add_argument('--db', type=str, default='')
|
||
|
parser.add_argument('--logDir', type=str, default='')
|
||
|
args = parser.parse_args()
|
||
|
Contant.db = args.db
|
||
|
db = SqliteDatabase(Contant.db)
|
||
|
|
||
|
|
||
|
def ormInit():
|
||
|
Channel.create_table()
|
||
|
Video.create_table()
|
||
|
DownloadInfo.create_table()
|
||
|
ViewCountInfo.create_table()
|
||
|
|
||
|
|
||
|
class BaseModel(Model):
|
||
|
class Meta:
|
||
|
database = db
|
||
|
|
||
|
# 频道信息
|
||
|
|
||
|
|
||
|
class Channel(BaseModel):
|
||
|
id = PrimaryKeyField()
|
||
|
channelId = CharField(null=False)
|
||
|
channelTitle = CharField(null=False)
|
||
|
channelLanguage = CharField()
|
||
|
channelReptileTime = CharField(null=True)
|
||
|
|
||
|
class Meta:
|
||
|
db_table = 'Channel'
|
||
|
|
||
|
# 视频信息
|
||
|
|
||
|
|
||
|
class Video(BaseModel):
|
||
|
id = PrimaryKeyField()
|
||
|
videoId = CharField(null=False)
|
||
|
channelId = CharField(null=False)
|
||
|
videoTitle = CharField()
|
||
|
videoLen = IntegerField()
|
||
|
videoType = CharField()
|
||
|
videoPublishTime = CharField()
|
||
|
videoLanguage = CharField()
|
||
|
isDownload = IntegerField()
|
||
|
|
||
|
class Meta:
|
||
|
db_table = 'Vidoes'
|
||
|
|
||
|
# 下载信息
|
||
|
|
||
|
|
||
|
class DownloadInfo(BaseModel):
|
||
|
id = PrimaryKeyField()
|
||
|
videoId = CharField()
|
||
|
downloadType = IntegerField()
|
||
|
tryTime = IntegerField()
|
||
|
isFinished = IntegerField()
|
||
|
|
||
|
class Meta:
|
||
|
db_table = 'Download_info'
|
||
|
|
||
|
# 播放量信息
|
||
|
class ViewCountInfo(BaseModel):
|
||
|
id = PrimaryKeyField()
|
||
|
videoId = CharField()
|
||
|
viewCount = CharField()
|
||
|
|
||
|
class Meta:
|
||
|
db_table = 'ViewCount_info'
|