From ace92991b3ad1f816405f91c8235b8ee56b74da8 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 10 Dec 2018 15:06:43 -0800 Subject: [PATCH] Added titleSlug to radarrEnhancement for #50 --- varken/radarr.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/varken/radarr.py b/varken/radarr.py index e04ea49..d4652c6 100644 --- a/varken/radarr.py +++ b/varken/radarr.py @@ -43,10 +43,15 @@ class RadarrAPI(object): ma = 0 else: ma = 1 - movie_name = '{} ({})'.format(movie.title, movie.year) - missing.append((movie_name, ma, movie.tmdbId)) - for title, ma, mid in missing: + movie_name = '{} ({})'.format(movie.title, movie.year) + + title_slug = movie.titleSlug + + missing.append((movie_name, ma, movie.tmdbId, title_slug)) + + + for title, ma, mid, title_slug in missing: hash_id = hashit('{}{}{}'.format(self.server.id, title, mid)) influx_payload.append( { @@ -56,7 +61,8 @@ class RadarrAPI(object): "Missing_Available": ma, "tmdbId": mid, "server": self.server.id, - "name": title + "name": title, + "titleSlug": title_slug }, "time": self.now, "fields": { @@ -94,17 +100,20 @@ class RadarrAPI(object): for queue_item in download_queue: movie = queue_item.movie + name = '{} ({})'.format(movie.title, movie.year) + title_slug = movie.titleSlug + if queue_item.protocol.upper() == 'USENET': protocol_id = 1 else: protocol_id = 0 queue.append((name, queue_item.quality['quality']['name'], queue_item.protocol.upper(), - protocol_id, queue_item.id)) + protocol_id, queue_item.id, title_slug)) - for name, quality, protocol, protocol_id, qid in queue: + for name, quality, protocol, protocol_id, qid, title_slug in queue: hash_id = hashit('{}{}{}'.format(self.server.id, name, quality)) influx_payload.append( { @@ -116,7 +125,8 @@ class RadarrAPI(object): "name": name, "quality": quality, "protocol": protocol, - "protocol_id": protocol_id + "protocol_id": protocol_id, + "titleSlug": title_slug }, "time": self.now, "fields": {