borg-manager/main.py
George Lacey 5f91901ae3 Newlines removed properly for compatibility
Newlines were removed by stripping '\n' characters, they are now removed
properly using .rsplit() for compatibility with other operating systems.
2016-09-20 09:53:08 +01:00

25 lines
616 B
Python

from sys import stdin
borg_output = stdin.readlines()
attributes = { "Archive name: " : "",
"Archive fingerprint: " : "",
"Time (start): " : "",
"Duration: " : "",
"Number of files: " : "", }
for i in range(0, len(borg_output)):
for key in attributes:
if borg_output[i].startswith(key):
attributes[key] = borg_output[i] \
.strip(key) \
.rstrip()
output = open("borg.txt", "w")
for key, value in attributes.iteritems():
output.write("%s%s\n" % (key, value))
output.close()