From 17773913ae5dd4e4bd86c1613b1cabd201a6e335 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 2 Feb 2026 14:23:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E4=BA=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2=E4=B8=AD=20season=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=9A=84=E9=9D=9E=E7=A9=BA=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BB=A5=E6=AD=A3=E7=A1=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86=20season=3D0=20=E7=9A=84=E6=83=85=E5=86=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/db/models/downloadhistory.py | 8 ++++---- app/db/models/subscribe.py | 12 ++++++------ app/db/models/subscribehistory.py | 4 ++-- app/db/models/transferhistory.py | 10 +++++----- app/db/subscribe_oper.py | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/db/models/downloadhistory.py b/app/db/models/downloadhistory.py index 8b39ea9a..d1653fdb 100644 --- a/app/db/models/downloadhistory.py +++ b/app/db/models/downloadhistory.py @@ -104,14 +104,14 @@ class DownloadHistory(Base): # TMDBID + 类型 if tmdbid and mtype: # 电视剧某季某集 - if season and episode: + if season is not None and episode: return db.query(DownloadHistory).filter(DownloadHistory.tmdbid == tmdbid, DownloadHistory.type == mtype, DownloadHistory.seasons == season, DownloadHistory.episodes == episode).order_by( DownloadHistory.id.desc()).all() # 电视剧某季 - elif season: + elif season is not None: return db.query(DownloadHistory).filter(DownloadHistory.tmdbid == tmdbid, DownloadHistory.type == mtype, DownloadHistory.seasons == season).order_by( @@ -124,14 +124,14 @@ class DownloadHistory(Base): # 标题 + 年份 elif title and year: # 电视剧某季某集 - if season and episode: + if season is not None and episode: return db.query(DownloadHistory).filter(DownloadHistory.title == title, DownloadHistory.year == year, DownloadHistory.seasons == season, DownloadHistory.episodes == episode).order_by( DownloadHistory.id.desc()).all() # 电视剧某季 - elif season: + elif season is not None: return db.query(DownloadHistory).filter(DownloadHistory.title == title, DownloadHistory.year == year, DownloadHistory.seasons == season).order_by( diff --git a/app/db/models/subscribe.py b/app/db/models/subscribe.py index 02a9f5e5..c4e58b5e 100644 --- a/app/db/models/subscribe.py +++ b/app/db/models/subscribe.py @@ -93,7 +93,7 @@ class Subscribe(Base): def exists(cls, db: Session, tmdbid: Optional[int] = None, doubanid: Optional[str] = None, season: Optional[int] = None): if tmdbid: - if season: + if season is not None: return db.query(cls).filter(cls.tmdbid == tmdbid, cls.season == season).first() return db.query(cls).filter(cls.tmdbid == tmdbid).first() @@ -106,7 +106,7 @@ class Subscribe(Base): async def async_exists(cls, db: AsyncSession, tmdbid: Optional[int] = None, doubanid: Optional[str] = None, season: Optional[int] = None): if tmdbid: - if season: + if season is not None: result = await db.execute( select(cls).filter(cls.tmdbid == tmdbid, cls.season == season) ) @@ -148,7 +148,7 @@ class Subscribe(Base): @classmethod @db_query def get_by_title(cls, db: Session, title: str, season: Optional[int] = None): - if season: + if season is not None: return db.query(cls).filter(cls.name == title, cls.season == season).first() return db.query(cls).filter(cls.name == title).first() @@ -156,7 +156,7 @@ class Subscribe(Base): @classmethod @async_db_query async def async_get_by_title(cls, db: AsyncSession, title: str, season: Optional[int] = None): - if season: + if season is not None: result = await db.execute( select(cls).filter(cls.name == title, cls.season == season) ) @@ -169,7 +169,7 @@ class Subscribe(Base): @classmethod @db_query def get_by_tmdbid(cls, db: Session, tmdbid: int, season: Optional[int] = None): - if season: + if season is not None: return db.query(cls).filter(cls.tmdbid == tmdbid, cls.season == season).all() else: @@ -178,7 +178,7 @@ class Subscribe(Base): @classmethod @async_db_query async def async_get_by_tmdbid(cls, db: AsyncSession, tmdbid: int, season: Optional[int] = None): - if season: + if season is not None: result = await db.execute( select(cls).filter(cls.tmdbid == tmdbid, cls.season == season) ) diff --git a/app/db/models/subscribehistory.py b/app/db/models/subscribehistory.py index 37d1ca66..bf9c7b3d 100644 --- a/app/db/models/subscribehistory.py +++ b/app/db/models/subscribehistory.py @@ -99,7 +99,7 @@ class SubscribeHistory(Base): def exists(cls, db: Session, tmdbid: Optional[int] = None, doubanid: Optional[str] = None, season: Optional[int] = None): if tmdbid: - if season: + if season is not None: return db.query(cls).filter(cls.tmdbid == tmdbid, cls.season == season).first() return db.query(cls).filter(cls.tmdbid == tmdbid).first() @@ -112,7 +112,7 @@ class SubscribeHistory(Base): async def async_exists(cls, db: AsyncSession, tmdbid: Optional[int] = None, doubanid: Optional[str] = None, season: Optional[int] = None): if tmdbid: - if season: + if season is not None: result = await db.execute( select(cls).filter(cls.tmdbid == tmdbid, cls.season == season) ) diff --git a/app/db/models/transferhistory.py b/app/db/models/transferhistory.py index 7399da6c..325bb8ff 100644 --- a/app/db/models/transferhistory.py +++ b/app/db/models/transferhistory.py @@ -266,14 +266,14 @@ class TransferHistory(Base): # TMDBID + 类型 if tmdbid and mtype: # 电视剧某季某集 - if season and episode: + if season is not None and episode: return db.query(cls).filter(cls.tmdbid == tmdbid, cls.type == mtype, cls.seasons == season, cls.episodes == episode, cls.dest == dest).all() # 电视剧某季 - elif season: + elif season is not None: return db.query(cls).filter(cls.tmdbid == tmdbid, cls.type == mtype, cls.seasons == season).all() @@ -290,14 +290,14 @@ class TransferHistory(Base): # 标题 + 年份 elif title and year: # 电视剧某季某集 - if season and episode: + if season is not None and episode: return db.query(cls).filter(cls.title == title, cls.year == year, cls.seasons == season, cls.episodes == episode, cls.dest == dest).all() # 电视剧某季 - elif season: + elif season is not None: return db.query(cls).filter(cls.title == title, cls.year == year, cls.seasons == season).all() @@ -312,7 +312,7 @@ class TransferHistory(Base): return db.query(cls).filter(cls.title == title, cls.year == year).all() # 类型 + 转移路径(emby webhook season无tmdbid场景) - elif mtype and season and dest: + elif mtype and season is not None and dest: # 电视剧某季 return db.query(cls).filter(cls.type == mtype, cls.seasons == season, diff --git a/app/db/subscribe_oper.py b/app/db/subscribe_oper.py index 0dd82f3c..ed1b902d 100644 --- a/app/db/subscribe_oper.py +++ b/app/db/subscribe_oper.py @@ -92,7 +92,7 @@ class SubscribeOper(DbOper): 判断是否存在 """ if tmdbid: - if season: + if season is not None: return True if Subscribe.exists(self._db, tmdbid=tmdbid, season=season) else False else: return True if Subscribe.exists(self._db, tmdbid=tmdbid) else False @@ -195,7 +195,7 @@ class SubscribeOper(DbOper): 判断是否存在订阅历史 """ if tmdbid: - if season: + if season is not None: return True if SubscribeHistory.exists(self._db, tmdbid=tmdbid, season=season) else False else: return True if SubscribeHistory.exists(self._db, tmdbid=tmdbid) else False