Extend snapshot Model.

This commit is contained in:
Manu 2018-11-01 19:35:07 +08:00
parent da4b9dbbed
commit dc2a156855
3 changed files with 5 additions and 4 deletions

View File

@ -96,7 +96,6 @@ class BorgThread(QtCore.QThread, BackupProfileMixin):
self.result.emit(result)
self.mutex.unlock()
def process_create_result(self, result):
if result['returncode'] == 0:
new_snapshot, created = SnapshotModel.get_or_create(
@ -104,7 +103,9 @@ class BorgThread(QtCore.QThread, BackupProfileMixin):
defaults={
'name': result['data']['archive']['name'],
'time': parser.parse(result['data']['archive']['start']),
'repo': self.profile.repo
'repo': self.profile.repo,
'duration': result['data']['archive']['duration'],
'size': result['data']['archive']['stats']['deduplicated_size']
}
)
new_snapshot.save()

View File

@ -78,6 +78,8 @@ class SnapshotModel(peewee.Model):
name = peewee.CharField()
repo = peewee.ForeignKeyField(RepoModel, backref='snapshots')
time = peewee.DateTimeField()
duration = peewee.FloatField(null=True)
size = peewee.IntegerField(null=True)
def formatted_time(self):
return

View File

@ -45,8 +45,6 @@ app = BUNDLE(exe,
'CFBundleShortVersionString': '0.2.0'
},
)
# Debug package. (inspired by borg-spec)
if False:
coll = COLLECT(exe,
a.binaries,