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 radarr.info import url_api_radarr
|
2022-05-01 12:00:20 +00:00
|
|
|
from constants import headers
|
|
|
|
|
|
|
|
|
|
|
|
def notify_radarr(radarr_id):
|
|
|
|
try:
|
2023-10-26 03:04:03 +00:00
|
|
|
url = f"{url_api_radarr()}command?apikey={settings.radarr.apikey}"
|
2022-05-01 12:00:20 +00:00
|
|
|
data = {
|
|
|
|
'name': 'RescanMovie',
|
|
|
|
'movieId': int(radarr_id)
|
|
|
|
}
|
2023-01-25 20:26:22 +00:00
|
|
|
requests.post(url, json=data, timeout=int(settings.radarr.http_timeout), verify=False, headers=headers)
|
2022-05-01 12:00:20 +00:00
|
|
|
except Exception:
|
|
|
|
logging.exception('BAZARR cannot notify Radarr')
|