Remove detailed version of issues
This commit is contained in:
parent
ec85c4b4a6
commit
dfcbee4eb4
5 changed files with 2 additions and 88 deletions
|
@ -123,8 +123,6 @@ if __name__ == "__main__":
|
||||||
schedule.every(server.request_total_run_seconds).seconds.do(threaded, OMBI.get_all_requests)
|
schedule.every(server.request_total_run_seconds).seconds.do(threaded, OMBI.get_all_requests)
|
||||||
if server.issue_status_counts:
|
if server.issue_status_counts:
|
||||||
schedule.every(server.issue_status_run_seconds).seconds.do(threaded, OMBI.get_issue_counts)
|
schedule.every(server.issue_status_run_seconds).seconds.do(threaded, OMBI.get_issue_counts)
|
||||||
if server.issue_total_counts:
|
|
||||||
schedule.every(server.issue_total_run_seconds).seconds.do(threaded, OMBI.get_all_issues)
|
|
||||||
|
|
||||||
if CONFIG.sickchill_enabled:
|
if CONFIG.sickchill_enabled:
|
||||||
for server in CONFIG.sickchill_servers:
|
for server in CONFIG.sickchill_servers:
|
||||||
|
|
|
@ -85,8 +85,6 @@ get_request_total_counts = true
|
||||||
request_total_run_seconds = 300
|
request_total_run_seconds = 300
|
||||||
get_issue_status_counts = true
|
get_issue_status_counts = true
|
||||||
issue_status_run_seconds = 300
|
issue_status_run_seconds = 300
|
||||||
get_issue_total_counts = true
|
|
||||||
issue_total_run_seconds = 300
|
|
||||||
|
|
||||||
[sickchill-1]
|
[sickchill-1]
|
||||||
url = sickchill.domain.tld:8081
|
url = sickchill.domain.tld:8081
|
||||||
|
|
|
@ -183,15 +183,10 @@ class INIParser(object):
|
||||||
|
|
||||||
issue_status_run_seconds = self.config.getint(section, 'issue_status_run_seconds')
|
issue_status_run_seconds = self.config.getint(section, 'issue_status_run_seconds')
|
||||||
|
|
||||||
issue_total_counts = self.config.getboolean(section, 'get_issue_total_counts')
|
|
||||||
|
|
||||||
issue_total_run_seconds = self.config.getint(section, 'issue_total_run_seconds')
|
|
||||||
|
|
||||||
server = OmbiServer(server_id, scheme + url, apikey, verify_ssl, request_type_counts,
|
server = OmbiServer(server_id, scheme + url, apikey, verify_ssl, request_type_counts,
|
||||||
request_type_run_seconds, request_total_counts,
|
request_type_run_seconds, request_total_counts,
|
||||||
request_total_run_seconds, issue_status_counts,
|
request_total_run_seconds, issue_status_counts,
|
||||||
issue_status_run_seconds, issue_total_counts,
|
issue_status_run_seconds)
|
||||||
issue_total_run_seconds)
|
|
||||||
|
|
||||||
if service == 'sickchill':
|
if service == 'sickchill':
|
||||||
get_missing = self.config.getboolean(section, 'get_missing')
|
get_missing = self.config.getboolean(section, 'get_missing')
|
||||||
|
|
|
@ -3,7 +3,7 @@ from requests import Session, Request
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from varken.helpers import connection_handler, hashit
|
from varken.helpers import connection_handler, hashit
|
||||||
from varken.structures import OmbiRequestCounts, OmbiIssuesCounts, OmbiIssue, OmbiMovieRequest, OmbiTVRequest
|
from varken.structures import OmbiRequestCounts, OmbiIssuesCounts, OmbiMovieRequest, OmbiTVRequest
|
||||||
|
|
||||||
|
|
||||||
class OmbiAPI(object):
|
class OmbiAPI(object):
|
||||||
|
@ -193,62 +193,3 @@ class OmbiAPI(object):
|
||||||
]
|
]
|
||||||
|
|
||||||
self.dbmanager.write_points(influx_payload)
|
self.dbmanager.write_points(influx_payload)
|
||||||
|
|
||||||
def get_all_issues(self):
|
|
||||||
now = datetime.now(timezone.utc).astimezone().isoformat()
|
|
||||||
endpoint = '/api/v1/Issues/'
|
|
||||||
|
|
||||||
req = self.session.prepare_request(Request('GET', self.server.url + endpoint))
|
|
||||||
get_issues = connection_handler(self.session, req, self.server.verify_ssl)
|
|
||||||
|
|
||||||
|
|
||||||
if not any([get_issues]):
|
|
||||||
self.logger.error('No json replies. Discarding job')
|
|
||||||
return
|
|
||||||
|
|
||||||
issues_count = len(get_issues)
|
|
||||||
|
|
||||||
try:
|
|
||||||
issue_list = [OmbiIssue(**issue) for issue in get_issues]
|
|
||||||
except TypeError as e:
|
|
||||||
self.logger.error('TypeError has occurred : %s while creating OmbiIssue structure', e)
|
|
||||||
return
|
|
||||||
|
|
||||||
influx_payload = [
|
|
||||||
{
|
|
||||||
"measurement": "Ombi",
|
|
||||||
"tags": {
|
|
||||||
"type": "Issues_Total",
|
|
||||||
"server": self.server.id
|
|
||||||
},
|
|
||||||
"time": now,
|
|
||||||
"fields": {
|
|
||||||
"total": issues_count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
# Request Type: Movie = 1, TV Show = 0
|
|
||||||
# Status: 0 = Pending, 1 = In Progress, 2 = Resolved
|
|
||||||
for issue in issue_list:
|
|
||||||
hash_id = hashit(f'{issue.id}{issue.requestId}{issue.title}')
|
|
||||||
|
|
||||||
influx_payload.append(
|
|
||||||
{
|
|
||||||
"measurement": "Ombi",
|
|
||||||
"tags": {
|
|
||||||
"type": "Issues",
|
|
||||||
"server": self.server.id,
|
|
||||||
"request_type": issue.requestType,
|
|
||||||
"status": issue.status,
|
|
||||||
"title": issue.title,
|
|
||||||
"subject": issue.subject,
|
|
||||||
"description": issue.description
|
|
||||||
},
|
|
||||||
"time": now,
|
|
||||||
"fields": {
|
|
||||||
"hash": hash_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
self.dbmanager.write_points(influx_payload)
|
|
|
@ -63,8 +63,6 @@ class OmbiServer(NamedTuple):
|
||||||
request_total_run_seconds: int = 30
|
request_total_run_seconds: int = 30
|
||||||
issue_status_counts: bool = False
|
issue_status_counts: bool = False
|
||||||
issue_status_run_seconds: int = 30
|
issue_status_run_seconds: int = 30
|
||||||
issue_total_counts: bool = False
|
|
||||||
issue_total_run_seconds: int = 30
|
|
||||||
|
|
||||||
|
|
||||||
class TautulliServer(NamedTuple):
|
class TautulliServer(NamedTuple):
|
||||||
|
@ -404,22 +402,6 @@ class OmbiMovieRequest(NamedTuple):
|
||||||
canApprove: bool = None
|
canApprove: bool = None
|
||||||
id: int = None
|
id: int = None
|
||||||
|
|
||||||
class OmbiIssue(NamedTuple):
|
|
||||||
title: str = None
|
|
||||||
requestType: int = None
|
|
||||||
providerId: int = None
|
|
||||||
requestId: int = None
|
|
||||||
subject: str = None
|
|
||||||
description: str = None
|
|
||||||
issueCategoryId: int = None
|
|
||||||
issueCategory: dict = None
|
|
||||||
status: int = None
|
|
||||||
resovledDate: None = None
|
|
||||||
userReportedId: str = None
|
|
||||||
userReported: str = None
|
|
||||||
comments: str = None
|
|
||||||
id: int = None
|
|
||||||
|
|
||||||
|
|
||||||
class OmbiTVRequest(NamedTuple):
|
class OmbiTVRequest(NamedTuple):
|
||||||
tvDbId: int = None
|
tvDbId: int = None
|
||||||
|
|
Loading…
Reference in a new issue