changed readme and added more tornotify functions

This commit is contained in:
jblu 2022-07-20 10:19:12 -05:00
parent 4908d62999
commit 81df444765
4 changed files with 33 additions and 17 deletions

View File

@ -8,16 +8,16 @@ The objective is to filter torrents based on the following criteria:
- ratio
- state
The first file shall contain an client to the qbit api and the processing of the torrents.
Client to the qbit api and the processing of the torrents.
qbit-clean.py
The second file shall contain functions to build out a list of torrents.
Functions to build out a list of torrents.
qlist.py
The third file shall contain logging and email communication.
Logging and push notification communication.
qlogging.py
The fourth file shall be logic to process torrents.
Logic to process torrents.
qprocess.py
You will need a config.json in the root directory.
@ -30,9 +30,12 @@ It should look something like this:
"password": "admin",
"loglevel": "INFO",
"logpath": "./qc.log",
"age": 2419200
"age": 2419200,
"use_pushover": true,
"po_key": "",
"po_token": ""
}
loglevel is what log messages are written to the log file. It only accepts INFO or DEBUG.
loglevel - is what log messages are written to the log file. It only accepts INFO or DEBUG.
Age is a number in seconds for how long we keep torrents from IPTORRENTS.
age - is a number in seconds for how long we keep torrents from IPTORRENTS.

View File

@ -7,6 +7,7 @@
"logpath": "./qc.log",
"age": 2419200,
"use_pushover": true,
"use_log": true,
"po_key": "",
"po_token": ""
}

View File

@ -24,12 +24,13 @@ 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"]
self.use_pushover = self.config["use_pushover"]
self.use_log = self.config["use_log"]
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"]
self.logpath = self.config["logpath"]
self.loglevel = self.config["loglevel"]
torlog(self)
tornotify(self)
self.t = time
@ -55,6 +56,8 @@ class Qbt:
torrentcount(self)
torprocessor(self)
printprocessor(self)
if self.use_pushover:
tornotifysummary(self)
tordelete(self)
if __name__== "__main__":

View File

@ -1,15 +1,24 @@
#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)
if self.use_log:
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)
elif 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 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 tornotifytest(self):
self.poc.send_message("Test Message", title="qbit-maid")
def tornotifysummary(self):
self.poc.send_message(f' Protected torrents: {len(self.tracker_protected_list)}\n\
Non-protected torrents: {len(self.tracker_nonprotected_list)}\n\
Total torrents set for deletion: {len(self.torrent_hash_delete_list)}', title="qbit-maid summary")
def getunixtimestamp(self):
self.uts = self.t.time()