38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
from sqlalchemy import Column, Integer, String, Text, DateTime, SmallInteger, Boolean
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
Base = declarative_base()
|
|
|
|
class ScheduledTask(Base):
|
|
"""定时任务模型"""
|
|
__tablename__ = 'scheduled_tasks'
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
name = Column(String(100), nullable=False)
|
|
cron_expression = Column(String(100), nullable=False) # cron表达式
|
|
spider_name = Column(String(50), nullable=False) # 爬虫名称
|
|
url = Column(Text, nullable=False) # 爬取的URL
|
|
video_list = Column(Integer, nullable=False) # 视频分类ID
|
|
enabled = Column(Boolean, default=True) # 是否启用
|
|
create_time = Column(Text) # SQLite中使用TEXT存储时间
|
|
update_time = Column(Text) # SQLite中使用TEXT存储时间
|
|
|
|
class VideoSQLite(Base):
|
|
"""SQLite视频模型"""
|
|
__tablename__ = 'videos'
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
title = Column(Text)
|
|
description = Column(Text)
|
|
source_url = Column(Text, unique=True)
|
|
publish_time = Column(Text) # SQLite中使用TEXT存储时间
|
|
create_time = Column(Text)
|
|
update_time = Column(Text)
|
|
video_url = Column(Text)
|
|
source_thumbnail_url = Column(Text)
|
|
thumbnail_url = Column(Text)
|
|
duration = Column(Text) # SQLite中duration是TEXT类型
|
|
aliyun_video_id = Column(Text)
|
|
aliyun_status = Column(Text)
|
|
status = Column(Integer) # 0 默认 1 已迁移
|
|
video_list = Column(Integer) # 视频分类ID |