Fixed: Streamlined API calls to Radarr and Sonarr (#221)

This commit is contained in:
Robin Dadswell 2022-01-17 01:40:12 +00:00 committed by GitHub
parent 9508c3c3f7
commit 870c6cdee2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 31 deletions

View file

@ -18,17 +18,6 @@ class RadarrAPI(object):
def __repr__(self):
return f"<radarr-{self.server.id}>"
def get_movie(self, id):
endpoint = '/api/v3/movie/'
req = self.session.prepare_request(Request('GET', self.server.url + endpoint + str(id)))
get = connection_handler(self.session, req, self.server.verify_ssl)
if not get:
return
return RadarrMovie(**get)
def get_missing(self):
endpoint = '/api/v3/movie'
now = datetime.now(timezone.utc).astimezone().isoformat()
@ -84,7 +73,7 @@ class RadarrAPI(object):
now = datetime.now(timezone.utc).astimezone().isoformat()
influx_payload = []
pageSize = 250
params = {'pageSize': pageSize}
params = {'pageSize': pageSize, 'includeMovie': True}
queueResponse = []
queue = []
@ -118,7 +107,7 @@ class RadarrAPI(object):
return
for queue_item in download_queue:
movie = self.get_movie(queue_item.movieId)
movie = queue_item.movie
name = f'{movie.title} ({movie.year})'