Filename in Message added
This commit is contained in:
parent
146aeacd9a
commit
5915142821
1 changed files with 15 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ result_msg = []
|
||||||
|
|
||||||
start = datetime.datetime.now()
|
start = datetime.datetime.now()
|
||||||
|
|
||||||
telegram_chat_id = "322673713"rr
|
telegram_chat_id = "322673713"
|
||||||
telegram_token ='NjgyODY5NzgwOTpBQUhzZG5vbTUzU1FHYVlkZ1FCVXJ4ckQyY01rd3VydXBLSQ=='
|
telegram_token ='NjgyODY5NzgwOTpBQUhzZG5vbTUzU1FHYVlkZ1FCVXJ4ckQyY01rd3VydXBLSQ=='
|
||||||
|
|
||||||
def parse_log(logfile, source, target):
|
def parse_log(logfile, source, target):
|
||||||
|
|
@ -106,9 +106,21 @@ result_msg.append(icon + source + " -> " + target + statistic)
|
||||||
end = datetime.datetime.now()
|
end = datetime.datetime.now()
|
||||||
duration = end - start
|
duration = end - start
|
||||||
|
|
||||||
os.remove(logfilepath)
|
|
||||||
|
|
||||||
if duration.total_seconds() >6:
|
|
||||||
|
|
||||||
|
if duration.total_seconds() >0:
|
||||||
notify_telegram(("<b>Backup Statistics:</b>\n\n%s\n\n<i>Start Time</i>: %s\n<i>End Time</i>: %s\n<i>Duration</i>: %s minutes" %
|
notify_telegram(("<b>Backup Statistics:</b>\n\n%s\n\n<i>Start Time</i>: %s\n<i>End Time</i>: %s\n<i>Duration</i>: %s minutes" %
|
||||||
("\n\n".join(result_msg), start.strftime("%Y-%m-%d %H:%M:%S"), end.strftime("%Y-%m-%d %H:%M:%S"),
|
("\n\n".join(result_msg), start.strftime("%Y-%m-%d %H:%M:%S"), end.strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
divmod(duration.total_seconds(), 60)[0])))
|
divmod(duration.total_seconds(), 60)[0])))
|
||||||
|
with open('rclone.log') as f:
|
||||||
|
data = [json.loads(line.rstrip()) for line in f if line[0] == "{"]
|
||||||
|
stats = []
|
||||||
|
operations = []
|
||||||
|
|
||||||
|
for obj in data:
|
||||||
|
if 'object' in obj:
|
||||||
|
print(obj['object'])
|
||||||
|
notify_telegram(obj['object'])
|
||||||
|
|
||||||
|
os.remove(logfilepath)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue