add sonarr api

This commit is contained in:
jxxghp
2023-06-14 10:53:20 +08:00
parent 4284358093
commit 762c1bec8d
2 changed files with 122 additions and 6 deletions

View File

@ -14,6 +14,7 @@ class Subscribe(Base):
type = Column(String)
keyword = Column(String)
tmdbid = Column(Integer, index=True)
tvdbid = Column(Integer, index=True)
doubanid = Column(String)
season = Column(Integer)
image = Column(String)
@ -41,3 +42,11 @@ class Subscribe(Base):
@staticmethod
def get_by_tmdbid(db: Session, tmdbid: int):
return db.query(Subscribe).filter(Subscribe.tmdbid == tmdbid).first()
@staticmethod
def get_by_title(db: Session, title: str):
return db.query(Subscribe).filter(Subscribe.name == title).first()
@staticmethod
def get_by_tvdbid(db: Session, tvdbid: int):
return db.query(Subscribe).filter(Subscribe.tvdbid == tvdbid).first()