Refactor log_entry -> LogEntry
This commit is contained in:
parent
52b62f9705
commit
da47c5a3fb
26
main.py
26
main.py
|
@ -1,26 +1,26 @@
|
||||||
from sys import stdin
|
from sys import stdin
|
||||||
from log_entry import *
|
from LogEntry import *
|
||||||
|
|
||||||
raw_borg_output = stdin.readlines()
|
raw_borg_output = stdin.readlines()
|
||||||
|
|
||||||
attributes = { "Archive name: " : "",
|
attributes = {"Archive name: ": "",
|
||||||
"Archive fingerprint: " : "",
|
"Archive fingerprint: ": "",
|
||||||
"Time (start): " : "",
|
"Time (start): ": "",
|
||||||
"Duration: " : "",
|
"Duration: ": "",
|
||||||
"Number of files: " : "", }
|
"Number of files: ": ""}
|
||||||
|
|
||||||
for i in range(0, len(raw_borg_output)):
|
for i in range(0, len(raw_borg_output)):
|
||||||
|
|
||||||
for key in attributes:
|
for key in attributes:
|
||||||
if raw_borg_output[i].startswith(key):
|
if raw_borg_output[i].startswith(key):
|
||||||
attributes[key] = raw_borg_output[i] \
|
attributes[key] = raw_borg_output[i] \
|
||||||
.strip(key) \
|
.strip(key) \
|
||||||
.rstrip()
|
.rstrip()
|
||||||
|
|
||||||
borg_output = log_entry(attributes["Archive name: "],
|
borg_output = LogEntry(attributes["Archive name: "],
|
||||||
attributes["Archive fingerprint: "],
|
attributes["Archive fingerprint: "],
|
||||||
attributes["Time (start): "],
|
attributes["Time (start): "],
|
||||||
attributes["Duration: "],
|
attributes["Duration: "],
|
||||||
attributes["Number of files: "])
|
attributes["Number of files: "])
|
||||||
|
|
||||||
borg_output.print_to_file("borg.txt")
|
borg_output.print_to_file("borg.txt")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user