added hashing to radarr
This commit is contained in:
parent
4f1ec17538
commit
8ef4b7fd0f
3 changed files with 17 additions and 8 deletions
|
@ -2,7 +2,7 @@ from requests import Session
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from Varken.logger import logging
|
from Varken.logger import logging
|
||||||
from Varken.helpers import Movie, Queue
|
from Varken.helpers import Movie, Queue, hashit
|
||||||
|
|
||||||
|
|
||||||
class RadarrAPI(object):
|
class RadarrAPI(object):
|
||||||
|
@ -34,6 +34,7 @@ class RadarrAPI(object):
|
||||||
missing.append((movie_name, ma, movie.tmdbId))
|
missing.append((movie_name, ma, movie.tmdbId))
|
||||||
|
|
||||||
for title, ma, mid in missing:
|
for title, ma, mid in missing:
|
||||||
|
hash_id = hashit('{}{}{}'.format(self.server.id, title, mid))
|
||||||
influx_payload.append(
|
influx_payload.append(
|
||||||
{
|
{
|
||||||
"measurement": "Radarr",
|
"measurement": "Radarr",
|
||||||
|
@ -41,11 +42,12 @@ class RadarrAPI(object):
|
||||||
"Missing": True,
|
"Missing": True,
|
||||||
"Missing_Available": ma,
|
"Missing_Available": ma,
|
||||||
"tmdbId": mid,
|
"tmdbId": mid,
|
||||||
"server": self.server.id
|
"server": self.server.id,
|
||||||
|
"name": title
|
||||||
},
|
},
|
||||||
"time": self.now,
|
"time": self.now,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": title
|
"hash": hash_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -77,20 +79,22 @@ class RadarrAPI(object):
|
||||||
protocol_id, queue_item.id))
|
protocol_id, queue_item.id))
|
||||||
|
|
||||||
for movie, quality, protocol, protocol_id, qid in queue:
|
for movie, quality, protocol, protocol_id, qid in queue:
|
||||||
|
hash_id = hashit('{}{}{}'.format(self.server.id, movie, quality))
|
||||||
influx_payload.append(
|
influx_payload.append(
|
||||||
{
|
{
|
||||||
"measurement": "Radarr",
|
"measurement": "Radarr",
|
||||||
"tags": {
|
"tags": {
|
||||||
"type": "Queue",
|
"type": "Queue",
|
||||||
"tmdbId": qid,
|
"tmdbId": qid,
|
||||||
"server": self.server.id
|
"server": self.server.id,
|
||||||
},
|
|
||||||
"time": self.now,
|
|
||||||
"fields": {
|
|
||||||
"name": movie,
|
"name": movie,
|
||||||
"quality": quality,
|
"quality": quality,
|
||||||
"protocol": protocol,
|
"protocol": protocol,
|
||||||
"protocol_id": protocol_id
|
"protocol_id": protocol_id
|
||||||
|
},
|
||||||
|
"time": self.now,
|
||||||
|
"fields": {
|
||||||
|
"hash": hash_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -77,7 +77,11 @@ class SonarrAPI(object):
|
||||||
|
|
||||||
for show in tv_shows:
|
for show in tv_shows:
|
||||||
sxe = 'S{:0>2}E{:0>2}'.format(show.seasonNumber, show.episodeNumber)
|
sxe = 'S{:0>2}E{:0>2}'.format(show.seasonNumber, show.episodeNumber)
|
||||||
air_days.append((show.series['title'], show.hasFile, sxe, show.title, show.airDate, show.id))
|
if show.hasFile:
|
||||||
|
downloaded = 1
|
||||||
|
else:
|
||||||
|
downloaded = 0
|
||||||
|
air_days.append((show.series['title'], downloaded, sxe, show.title, show.airDate, show.id))
|
||||||
|
|
||||||
for series_title, dl_status, sxe, episode_title, air_date, sonarr_id in air_days:
|
for series_title, dl_status, sxe, episode_title, air_date, sonarr_id in air_days:
|
||||||
hash_id = hashit('{}{}{}'.format(self.server.id, series_title, sxe))
|
hash_id = hashit('{}{}{}'.format(self.server.id, series_title, sxe))
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from geoip2.errors import AddressNotFoundError
|
from geoip2.errors import AddressNotFoundError
|
||||||
from requests import Session
|
from requests import Session
|
||||||
|
|
||||||
from Varken.helpers import TautulliStream, geo_lookup
|
from Varken.helpers import TautulliStream, geo_lookup
|
||||||
from Varken.logger import logging
|
from Varken.logger import logging
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue