2024-01-08 09:20:36 +00:00
|
|
|
import requests
|
|
|
|
import json
|
2024-01-08 12:53:45 +00:00
|
|
|
import configparser
|
|
|
|
config = configparser.RawConfigParser()
|
|
|
|
config.read('config.cfg')
|
|
|
|
|
|
|
|
token = config._sections['sonarr']['token']
|
|
|
|
base_url = config._sections['sonarr']['url']
|
2024-01-08 09:20:36 +00:00
|
|
|
|
|
|
|
def update_show_in_soarr(show_id):
|
2024-01-08 12:53:45 +00:00
|
|
|
url = f"{base_url}/api/v3/command"
|
2024-01-08 09:20:36 +00:00
|
|
|
|
|
|
|
payload = json.dumps({
|
|
|
|
"name": "RefreshSeries",
|
|
|
|
"seriesId": show_id
|
|
|
|
})
|
|
|
|
headers = {
|
|
|
|
'Content-Type': 'application/json',
|
2024-01-08 09:22:21 +00:00
|
|
|
'X-Api-Key': token,
|
2024-01-08 09:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
|
|
|
if response.status_code != 404:
|
|
|
|
print("Updated show in Sonarr")
|