pushing existing work
This commit is contained in:
33
clogging.py
Normal file
33
clogging.py
Normal file
@@ -0,0 +1,33 @@
|
||||
def cont_log(self):
|
||||
"""Setting up the log file, if self.use_log is set to true and self.loglevel is DEBUG OR INFO"""
|
||||
if self.use_log:
|
||||
if self.log_level == 'DEBUG':
|
||||
self.tl.basicConfig(filename=self.log_path, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.DEBUG)
|
||||
elif self.log_level == 'INFO':
|
||||
self.tl.basicConfig(filename=self.log_path, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.INFO)
|
||||
|
||||
def cont_notify(self):
|
||||
"""Seting up to use pushover, if self.use_pushover is set to true and
|
||||
if valid self.po_key and self.po_token is provided in the config file"""
|
||||
if self.use_pushover:
|
||||
self.poc = self.po.Client(self.po_key, api_token=self.po_token)
|
||||
|
||||
def cont_notify_summary(self):
|
||||
"""Main notification method when the app is used in an automated fashion"""
|
||||
self.poc.send_message(f" \
|
||||
{self.extm}", title="--- qbit-maid summary ---")
|
||||
|
||||
def list_first_cont(self, index=0):
|
||||
"""Only lists the first torrent"""
|
||||
self.tl.debug('First torrent in the list:')
|
||||
torrent = self.torrent_list[index]
|
||||
for k,v in torrent.items():
|
||||
self.tl.debug(f'{k}: {v}')
|
||||
self.tl.debug('\n')
|
||||
|
||||
def get_script_runtime(self):
|
||||
elapsed_time = self.et - self.st
|
||||
if self.use_log:
|
||||
self.tl.info(f'Execution time: [{elapsed_time}]')
|
||||
if self.use_pushover:
|
||||
self.extm = f"Execution time: [{elapsed_time}]"
|
||||
Reference in New Issue
Block a user