Browse Source

Changed backup_filepath to property_file

master
Raphael Roberts 5 years ago
parent
commit
54a2c5f8f8
  1. 12
      tibi_hardlinks/backups.py

12
tibi_hardlinks/backups.py

@ -33,9 +33,9 @@ def create_backup_directory_name(backup_info, time_format="%Y-%m-%d_%H-%M-%S"):
return backup_directory_name
def find_backup_data(backup_filepath: Path, backup_info):
# find the path of the *.apk, *.properties, and *.tar(.gz) corresponding to backup_filepath
backup_root = backup_filepath.parent
def find_backup_data(property_file: Path, backup_info):
# find the path of the *.apk, *.properties, and *.tar(.gz) corresponding to property_file
backup_root = property_file.parent
try:
apk_hash = backup_info["app_apk_md5"]
apk_file = filter(
@ -43,7 +43,7 @@ def find_backup_data(backup_filepath: Path, backup_info):
)
except KeyError:
apk_file = None
related_files = list(backup_root.glob(backup_filepath.stem + "*"))
related_files = list(backup_root.glob(property_file.stem + "*"))
if len(related_files) > 2:
raise Exception
tar_file = None
@ -51,7 +51,7 @@ def find_backup_data(backup_filepath: Path, backup_info):
if ".tar" in filename.name:
tar_file = filename
property_file = backup_filepath
property_file = property_file
return {"property_file": property_file, "apk_file": apk_file, "tar_file": tar_file}
@ -59,7 +59,7 @@ class Backup:
def __init__(self, property_file: Path):
self.property_file = property_file
self.backup_info = read_backup_properties(property_file)
self.related_files = find_backup_data(self.backup_filepath, self.backup_info)
self.related_files = find_backup_data(self.property_file, self.backup_info)
def hardlink_to(self, dest):
for filepath in self.related_files.values():

Loading…
Cancel
Save