fix bug
This commit is contained in:
@ -31,3 +31,7 @@ class Site(Base):
|
||||
@staticmethod
|
||||
def get_by_domain(db: Session, domain: str):
|
||||
return db.query(Site).filter(Site.domain == domain).first()
|
||||
|
||||
@staticmethod
|
||||
def get_actives(db: Session):
|
||||
return db.query(Site).filter(Site.is_active is True).all()
|
||||
|
@ -31,6 +31,12 @@ class Sites:
|
||||
"""
|
||||
return Site.list(self._db)
|
||||
|
||||
def list_active(self):
|
||||
"""
|
||||
按状态获取站点列表
|
||||
"""
|
||||
return Site.get_actives(self._db)
|
||||
|
||||
def get_by_domain(self, domain: str) -> Site:
|
||||
"""
|
||||
按域名获取站点
|
||||
|
@ -5,7 +5,6 @@ from sqlalchemy.orm import Session
|
||||
from app.core.context import MediaInfo
|
||||
from app.db import SessionLocal
|
||||
from app.db.models.subscribe import Subscribe
|
||||
from app.utils.types import MediaType
|
||||
|
||||
|
||||
class Subscribes:
|
||||
@ -21,15 +20,6 @@ class Subscribes:
|
||||
"""
|
||||
新增订阅
|
||||
"""
|
||||
# 总集数
|
||||
if mediainfo.type == MediaType.TV:
|
||||
if not kwargs.get('total_episode'):
|
||||
total_episode = len(mediainfo.seasons.get(kwargs.get('season') or 1) or [])
|
||||
if not total_episode:
|
||||
return False, "未识别到总集数"
|
||||
kwargs.update({
|
||||
'total_episode': total_episode
|
||||
})
|
||||
subscribe = Subscribe(name=mediainfo.title,
|
||||
year=mediainfo.year,
|
||||
type=mediainfo.type.value,
|
||||
|
Reference in New Issue
Block a user