fix sonarr

This commit is contained in:
jxxghp 2023-06-14 13:04:59 +08:00
parent 713d3d6a87
commit ec9d07d343

View File

@ -1,6 +1,6 @@
from typing import Any, List
from fastapi import APIRouter, HTTPException, Depends, Request
from fastapi import APIRouter, HTTPException, Depends
from requests import Session
from app import schemas
@ -9,7 +9,6 @@ from app.chain.subscribe import SubscribeChain
from app.core.config import settings
from app.db import get_db
from app.db.models.subscribe import Subscribe
from app.log import logger
from app.schemas import RadarrMovie, SonarrSeries
from app.utils.types import MediaType
from version import APP_VERSION
@ -541,7 +540,7 @@ async def arr_serie(apikey: str, tid: int, db: Session = Depends(get_db)) -> Any
@arr_router.post("/series")
async def arr_add_series(request: Request, apikey: str, tv: schemas.SonarrSeries) -> Any:
async def arr_add_series(apikey: str, tv: schemas.SonarrSeries) -> Any:
"""
新增Sonarr剧集订阅
"""
@ -550,9 +549,10 @@ async def arr_add_series(request: Request, apikey: str, tv: schemas.SonarrSeries
status_code=403,
detail="认证失败!",
)
logger.info(await request.body())
sid = 0
for season in tv.seasons:
if not season.get("monitored"):
continue
sid = SubscribeChain().process(title=tv.title,
year=str(tv.year) if tv.year else None,
season=season.get("seasonNumber"),