mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-10 23:11:47 +08:00
fix 关注订阅时判断历史记录
This commit is contained in:
@@ -798,6 +798,11 @@ class SubscribeChain(ChainBase, metaclass=Singleton):
|
|||||||
doubanid=share_sub.get("doubanid"),
|
doubanid=share_sub.get("doubanid"),
|
||||||
season=share_sub.get("season")):
|
season=share_sub.get("season")):
|
||||||
continue
|
continue
|
||||||
|
# 已经订阅过跳过
|
||||||
|
if self.subscribeoper.exist_history(tmdbid=share_sub.get("tmdbid"),
|
||||||
|
doubanid=share_sub.get("doubanid"),
|
||||||
|
season=share_sub.get("season")):
|
||||||
|
continue
|
||||||
# 去除无效属性
|
# 去除无效属性
|
||||||
for key in list(share_sub.keys()):
|
for key in list(share_sub.keys()):
|
||||||
if not hasattr(schemas.Subscribe(), key):
|
if not hasattr(schemas.Subscribe(), key):
|
||||||
|
|||||||
@@ -73,6 +73,18 @@ class SubscribeHistory(Base):
|
|||||||
result = db.query(SubscribeHistory).filter(
|
result = db.query(SubscribeHistory).filter(
|
||||||
SubscribeHistory.type == mtype
|
SubscribeHistory.type == mtype
|
||||||
).order_by(
|
).order_by(
|
||||||
SubscribeHistory.date.desc()
|
SubscribeHistory.date.desc()
|
||||||
).offset((page - 1) * count).limit(count).all()
|
).offset((page - 1) * count).limit(count).all()
|
||||||
return list(result)
|
return list(result)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@db_query
|
||||||
|
def exists(db: Session, tmdbid: int = None, doubanid: str = None, season: int = None):
|
||||||
|
if tmdbid:
|
||||||
|
if season:
|
||||||
|
return db.query(SubscribeHistory).filter(SubscribeHistory.tmdbid == tmdbid,
|
||||||
|
SubscribeHistory.season == season).first()
|
||||||
|
return db.query(SubscribeHistory).filter(SubscribeHistory.tmdbid == tmdbid).first()
|
||||||
|
elif doubanid:
|
||||||
|
return db.query(SubscribeHistory).filter(SubscribeHistory.doubanid == doubanid).first()
|
||||||
|
return None
|
||||||
|
|||||||
@@ -118,3 +118,16 @@ class SubscribeOper(DbOper):
|
|||||||
kwargs.pop("id")
|
kwargs.pop("id")
|
||||||
subscribe = SubscribeHistory(**kwargs)
|
subscribe = SubscribeHistory(**kwargs)
|
||||||
subscribe.create(self._db)
|
subscribe.create(self._db)
|
||||||
|
|
||||||
|
def exist_history(self, tmdbid: int = None, doubanid: str = None, season: int = None):
|
||||||
|
"""
|
||||||
|
判断是否存在订阅历史
|
||||||
|
"""
|
||||||
|
if tmdbid:
|
||||||
|
if season:
|
||||||
|
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
|
||||||
|
elif doubanid:
|
||||||
|
return True if SubscribeHistory.exists(self._db, doubanid=doubanid) else False
|
||||||
|
return False
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
APP_VERSION = 'v2.2.4'
|
APP_VERSION = 'v2.2.4-1'
|
||||||
FRONTEND_VERSION = 'v2.2.4'
|
FRONTEND_VERSION = 'v2.2.4'
|
||||||
|
|||||||
Reference in New Issue
Block a user