Added titleSlug to radarrEnhancement for #50

This commit is contained in:
samwiseg0 2018-12-10 15:06:43 -08:00
parent 2d3b094eca
commit 63aad2b320

View file

@ -43,10 +43,15 @@ class RadarrAPI(object):
ma = 0 ma = 0
else: else:
ma = 1 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)) hash_id = hashit('{}{}{}'.format(self.server.id, title, mid))
influx_payload.append( influx_payload.append(
{ {
@ -56,7 +61,8 @@ class RadarrAPI(object):
"Missing_Available": ma, "Missing_Available": ma,
"tmdbId": mid, "tmdbId": mid,
"server": self.server.id, "server": self.server.id,
"name": title "name": title,
"titleSlug": title_slug
}, },
"time": self.now, "time": self.now,
"fields": { "fields": {
@ -94,17 +100,20 @@ class RadarrAPI(object):
for queue_item in download_queue: for queue_item in download_queue:
movie = queue_item.movie movie = queue_item.movie
name = '{} ({})'.format(movie.title, movie.year) name = '{} ({})'.format(movie.title, movie.year)
title_slug = movie.titleSlug
if queue_item.protocol.upper() == 'USENET': if queue_item.protocol.upper() == 'USENET':
protocol_id = 1 protocol_id = 1
else: else:
protocol_id = 0 protocol_id = 0
queue.append((name, queue_item.quality['quality']['name'], queue_item.protocol.upper(), 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)) hash_id = hashit('{}{}{}'.format(self.server.id, name, quality))
influx_payload.append( influx_payload.append(
{ {
@ -116,7 +125,8 @@ class RadarrAPI(object):
"name": name, "name": name,
"quality": quality, "quality": quality,
"protocol": protocol, "protocol": protocol,
"protocol_id": protocol_id "protocol_id": protocol_id,
"titleSlug": title_slug
}, },
"time": self.now, "time": self.now,
"fields": { "fields": {