-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
538 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from .borg_thread import BorgThread | ||
|
||
|
||
class BorgExtractThread(BorgThread): | ||
|
||
def log_event(self, msg): | ||
self.app.backup_log_event.emit(msg) | ||
|
||
def started_event(self): | ||
self.app.backup_started_event.emit() | ||
self.app.backup_log_event.emit('Downloading files from archive..') | ||
|
||
def finished_event(self, result): | ||
self.app.backup_finished_event.emit(result) | ||
self.result.emit(result) | ||
self.app.backup_log_event.emit('Restored files from archive.') | ||
|
||
@classmethod | ||
def prepare(cls, profile, archive_name, selected_files, destination_folder): | ||
ret = super().prepare(profile) | ||
if not ret['ok']: | ||
return ret | ||
else: | ||
ret['ok'] = False # Set back to false, so we can do our own checks here. | ||
|
||
cmd = ['borg', 'extract', '--list', '--info', '--log-json'] | ||
cmd.append(f'{profile.repo.url}::{archive_name}') | ||
for s in selected_files: | ||
cmd.append(s) | ||
|
||
ret['ok'] = True | ||
ret['cmd'] = cmd | ||
ret['cwd'] = destination_folder | ||
|
||
return ret | ||
|
||
def process_result(self, result): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from .borg_thread import BorgThread | ||
|
||
|
||
class BorgListArchiveThread(BorgThread): | ||
|
||
def log_event(self, msg): | ||
self.app.backup_log_event.emit(msg) | ||
|
||
def started_event(self): | ||
self.app.backup_started_event.emit() | ||
self.app.backup_log_event.emit('Getting archive content..') | ||
|
||
def finished_event(self, result): | ||
self.app.backup_finished_event.emit(result) | ||
self.app.backup_log_event.emit('Done getting archive content.') | ||
self.result.emit(result) | ||
|
||
@classmethod | ||
def prepare(cls, profile): | ||
ret = super().prepare(profile) | ||
if not ret['ok']: | ||
return ret | ||
else: | ||
ret['ok'] = False # Set back to false, so we can do our own checks here. | ||
|
||
cmd = ['borg', 'list', '--info', '--log-json', '--format', "{size:8d}{TAB}{mtime}{TAB}{path}{NL}"] | ||
cmd.append(f'{profile.repo.url}') | ||
|
||
ret['ok'] = True | ||
ret['cmd'] = cmd | ||
|
||
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.