added tor notify

This commit is contained in:
jblu 2022-07-20 09:57:22 -05:00
parent 829ad31293
commit 4908d62999
3 changed files with 14 additions and 4 deletions

View File

@ -5,5 +5,8 @@
"password": "admin", "password": "admin",
"loglevel": "INFO", "loglevel": "INFO",
"logpath": "./qc.log", "logpath": "./qc.log",
"age": 2419200 "age": 2419200,
"use_pushover": true,
"po_key": "",
"po_token": ""
} }

View File

@ -1,5 +1,6 @@
#The first file shall contain an client to the qbit api and the processing of the torrents. #The first file shall contain an client to the qbit api and the processing of the torrents.
import qbittorrentapi import qbittorrentapi
import pushover
from json import load from json import load
from qlist import * from qlist import *
from qlogging import * from qlogging import *
@ -22,10 +23,15 @@ class Qbt:
) )
# Create the logging object # Create the logging object
self.tl = logging self.tl = logging
self.po = pushover
self.use_pushover= self.config["use_pushover"]
self.po_key=self.config["po_key"]
self.po_token=self.config["po_token"]
# Variables torlog uses from config.json # Variables torlog uses from config.json
self.logpath=self.config["logpath"] self.logpath=self.config["logpath"]
self.loglevel=self.config["loglevel"] self.loglevel=self.config["loglevel"]
torlog(self) torlog(self)
tornotify(self)
self.t = time self.t = time
f = open('./tracker-whitelist.json') f = open('./tracker-whitelist.json')
self.tracker_whitelist = load(f) self.tracker_whitelist = load(f)

View File

@ -1,14 +1,15 @@
#The third file shall contain logging and email communication. #The third file shall contain logging and email communication.
def torlog(self): def torlog(self):
if self.loglevel == 'DEBUG': if self.loglevel == 'DEBUG':
self.tl.basicConfig(filename=self.logpath, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.DEBUG) self.tl.basicConfig(filename=self.logpath, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.DEBUG)
if self.loglevel == 'INFO': if self.loglevel == 'INFO':
self.tl.basicConfig(filename=self.logpath, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.INFO) self.tl.basicConfig(filename=self.logpath, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.INFO)
def toremail(self): def tornotify(self):
pass if self.use_pushover:
self.poc = self.po.Client(self.po_key, api_token=self.po_token)
self.poc.send_message("Test Message", title="qbit-maid")
def getunixtimestamp(self): def getunixtimestamp(self):
self.uts = self.t.time() self.uts = self.t.time()