fixed time
This commit is contained in:
parent
7638cd937e
commit
98677892e2
2 changed files with 7 additions and 2 deletions
|
@ -24,6 +24,7 @@ class SonarrAPI(object):
|
||||||
def get_missing(self, days_past):
|
def get_missing(self, days_past):
|
||||||
endpoint = '/api/calendar'
|
endpoint = '/api/calendar'
|
||||||
last_days = str(date.today() + timedelta(days=-days_past))
|
last_days = str(date.today() + timedelta(days=-days_past))
|
||||||
|
self.now = datetime.now(timezone.utc).astimezone().isoformat()
|
||||||
params = {'start': last_days, 'end': self.today}
|
params = {'start': last_days, 'end': self.today}
|
||||||
influx_payload = []
|
influx_payload = []
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ class SonarrAPI(object):
|
||||||
@logging
|
@logging
|
||||||
def get_future(self, future_days):
|
def get_future(self, future_days):
|
||||||
endpoint = '/api/calendar/'
|
endpoint = '/api/calendar/'
|
||||||
|
self.now = datetime.now(timezone.utc).astimezone().isoformat()
|
||||||
future = str(date.today() + timedelta(days=future_days))
|
future = str(date.today() + timedelta(days=future_days))
|
||||||
influx_payload = []
|
influx_payload = []
|
||||||
|
|
||||||
|
@ -109,6 +111,7 @@ class SonarrAPI(object):
|
||||||
def get_queue(self, notimplemented):
|
def get_queue(self, notimplemented):
|
||||||
influx_payload = []
|
influx_payload = []
|
||||||
endpoint = '/api/queue'
|
endpoint = '/api/queue'
|
||||||
|
self.now = datetime.now(timezone.utc).astimezone().isoformat()
|
||||||
|
|
||||||
for server in self.servers:
|
for server in self.servers:
|
||||||
queue = []
|
queue = []
|
||||||
|
|
|
@ -5,12 +5,13 @@ import requests
|
||||||
from Varken.helpers import TautulliStream, geo_lookup
|
from Varken.helpers import TautulliStream, geo_lookup
|
||||||
from Varken.logger import logging
|
from Varken.logger import logging
|
||||||
|
|
||||||
|
|
||||||
class TautulliAPI(object):
|
class TautulliAPI(object):
|
||||||
def __init__(self, servers, influx_server):
|
def __init__(self, servers, influx_server):
|
||||||
# Set Time of initialization
|
# Set Time of initialization
|
||||||
self.now = datetime.now(timezone.utc).astimezone().isoformat()
|
self.now = datetime.now(timezone.utc).astimezone().isoformat()
|
||||||
self.influx = InfluxDBClient(influx_server.url, influx_server.port, influx_server.username,
|
self.influx = InfluxDBClient(influx_server.url, influx_server.port, influx_server.username,
|
||||||
influx_server.password, 'plex')
|
influx_server.password, 'plex2')
|
||||||
self.servers = servers
|
self.servers = servers
|
||||||
self.session = requests.Session()
|
self.session = requests.Session()
|
||||||
self.endpoint = '/api/v2'
|
self.endpoint = '/api/v2'
|
||||||
|
@ -21,6 +22,7 @@ class TautulliAPI(object):
|
||||||
|
|
||||||
@logging
|
@logging
|
||||||
def get_activity(self, notimplemented):
|
def get_activity(self, notimplemented):
|
||||||
|
self.now = datetime.now(timezone.utc).astimezone().isoformat()
|
||||||
params = {'cmd': 'get_activity'}
|
params = {'cmd': 'get_activity'}
|
||||||
influx_payload = []
|
influx_payload = []
|
||||||
|
|
||||||
|
@ -53,6 +55,7 @@ class TautulliAPI(object):
|
||||||
|
|
||||||
@logging
|
@logging
|
||||||
def get_sessions(self, notimplemented):
|
def get_sessions(self, notimplemented):
|
||||||
|
self.now = datetime.now(timezone.utc).astimezone().isoformat()
|
||||||
params = {'cmd': 'get_activity'}
|
params = {'cmd': 'get_activity'}
|
||||||
influx_payload = []
|
influx_payload = []
|
||||||
|
|
||||||
|
@ -60,7 +63,6 @@ class TautulliAPI(object):
|
||||||
params['apikey'] = server.apikey
|
params['apikey'] = server.apikey
|
||||||
g = self.session.get(server.url + self.endpoint, params=params, verify=server.verify_ssl)
|
g = self.session.get(server.url + self.endpoint, params=params, verify=server.verify_ssl)
|
||||||
get = g.json()['response']['data']['sessions']
|
get = g.json()['response']['data']['sessions']
|
||||||
print(get)
|
|
||||||
sessions = [TautulliStream(**session) for session in get]
|
sessions = [TautulliStream(**session) for session in get]
|
||||||
|
|
||||||
for session in sessions:
|
for session in sessions:
|
||||||
|
|
Loading…
Reference in a new issue