added tor notify
This commit is contained in:
		| @@ -5,5 +5,8 @@ | ||||
|     "password": "admin", | ||||
|     "loglevel": "INFO", | ||||
|     "logpath": "./qc.log", | ||||
|     "age": 2419200 | ||||
|     "age": 2419200, | ||||
|     "use_pushover": true, | ||||
|     "po_key": "", | ||||
|     "po_token": "" | ||||
| } | ||||
| @@ -1,5 +1,6 @@ | ||||
| #The first file shall contain an client to the qbit api and the processing of the torrents. | ||||
| import qbittorrentapi | ||||
| import pushover | ||||
| from json import load | ||||
| from qlist import * | ||||
| from qlogging import * | ||||
| @@ -22,10 +23,15 @@ class Qbt: | ||||
|         ) | ||||
|         # Create the logging object | ||||
|         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 | ||||
|         self.logpath=self.config["logpath"] | ||||
|         self.loglevel=self.config["loglevel"] | ||||
|         torlog(self) | ||||
|         tornotify(self) | ||||
|         self.t = time | ||||
|         f = open('./tracker-whitelist.json') | ||||
|         self.tracker_whitelist = load(f) | ||||
|   | ||||
| @@ -1,14 +1,15 @@ | ||||
| #The third file shall contain logging and email communication. | ||||
|  | ||||
| def torlog(self): | ||||
|      | ||||
|     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) | ||||
|     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) | ||||
|  | ||||
| def toremail(self): | ||||
|     pass | ||||
| def tornotify(self): | ||||
|     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): | ||||
|     self.uts = self.t.time() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user