Iniital Commit
This commit is contained in:
parent
91245007e6
commit
f20aa9b0d8
6 changed files with 168 additions and 1 deletions
28
lidarr_helpers.py
Normal file
28
lidarr_helpers.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
from config import *
|
||||
import requests
|
||||
|
||||
def lidarr_api_add_artist(mbid):
|
||||
lookup_url = f"{LIDARR_URL}/api/v1/artist/lookup?term=mbid:{mbid}"
|
||||
headers = {"X-Api-Key": LIDARR_API_KEY, "Content-Type": "application/json"}
|
||||
|
||||
res = requests.get(lookup_url, headers=headers)
|
||||
if not res.ok or not res.json():
|
||||
return False
|
||||
|
||||
artist = res.json()[0]
|
||||
payload = {
|
||||
"foreignArtistId": artist['foreignArtistId'],
|
||||
"artistName": artist['artistName'],
|
||||
"monitored": True,
|
||||
"qualityProfileId": QUALITY_PROFILE_ID,
|
||||
"metadataProfileId": 1,
|
||||
"rootFolderPath": ROOT_FOLDER,
|
||||
"addOptions": {
|
||||
"monitor": "all",
|
||||
"searchForMissingAlbums": True
|
||||
}
|
||||
}
|
||||
|
||||
add_url = f"{LIDARR_URL}/api/v1/artist"
|
||||
post_res = requests.post(add_url, headers=headers, json=payload)
|
||||
return post_res.ok
|
||||
Loading…
Add table
Add a link
Reference in a new issue