2022-05-01 12:00:20 +00:00
|
|
|
# coding=utf-8
|
|
|
|
|
|
|
|
import logging
|
|
|
|
import requests
|
|
|
|
|
|
|
|
from app.config import settings
|
2023-10-26 03:04:03 +00:00
|
|
|
from sonarr.info import url_api_sonarr
|
2022-05-01 12:00:20 +00:00
|
|
|
from constants import headers
|
|
|
|
|
|
|
|
|
|
|
|
def notify_sonarr(sonarr_series_id):
|
|
|
|
try:
|
2023-10-26 03:04:03 +00:00
|
|
|
url = f"{url_api_sonarr()}command?apikey={settings.sonarr.apikey}"
|
2022-05-01 12:00:20 +00:00
|
|
|
data = {
|
|
|
|
'name': 'RescanSeries',
|
|
|
|
'seriesId': int(sonarr_series_id)
|
|
|
|
}
|
2023-01-25 20:26:22 +00:00
|
|
|
requests.post(url, json=data, timeout=int(settings.sonarr.http_timeout), verify=False, headers=headers)
|
2022-05-01 12:00:20 +00:00
|
|
|
except Exception:
|
|
|
|
logging.exception('BAZARR cannot notify Sonarr')
|