Modify the root directory name of iOS media

This commit is contained in:
KnugiHK
2023-06-13 17:00:40 +08:00
parent 8294f06587
commit 8cdb694a16
3 changed files with 6 additions and 7 deletions

View File

@@ -242,7 +242,7 @@ def main():
vcard = extract_iphone.vcard vcard = extract_iphone.vcard
create_html = extract_iphone.create_html create_html = extract_iphone.create_html
if args.media is None: if args.media is None:
args.media = "Message" args.media = "AppDomainGroup-group.net.whatsapp.WhatsApp.shared"
if args.backup is not None: if args.backup is not None:
if not os.path.isdir(args.media): if not os.path.isdir(args.media):
extract_iphone_media.extract_media(args.backup) extract_iphone_media.extract_media(args.backup)

View File

@@ -152,12 +152,11 @@ def media(db, data, media_folder):
content = c.fetchone() content = c.fetchone()
mime = MimeTypes() mime = MimeTypes()
while content is not None: while content is not None:
file_path = f"{media_folder}/{content['ZMEDIALOCALPATH']}" file_path = f"{media_folder}/Message/{content['ZMEDIALOCALPATH']}"
_id = content["_id"] _id = content["_id"]
ZMESSAGE = content["ZMESSAGE"] ZMESSAGE = content["ZMESSAGE"]
message = data[_id].messages[ZMESSAGE] message = data[_id].messages[ZMESSAGE]
message.media = True message.media = True
if os.path.isfile(file_path): if os.path.isfile(file_path):
message.data = file_path message.data = file_path
if content["ZVCARDSTRING"] is None: if content["ZVCARDSTRING"] is None:
@@ -207,7 +206,7 @@ def vcard(db, data):
contents = c.fetchall() contents = c.fetchall()
total_row_number = len(contents) total_row_number = len(contents)
print(f"\nProcessing vCards...(0/{total_row_number})", end="\r") print(f"\nProcessing vCards...(0/{total_row_number})", end="\r")
base = "Message/vCards" base = "AppDomainGroup-group.net.whatsapp.WhatsApp.shared/Message/vCards"
if not os.path.isdir(base): if not os.path.isdir(base):
Path(base).mkdir(parents=True, exist_ok=True) Path(base).mkdir(parents=True, exist_ok=True)
for index, content in enumerate(contents): for index, content in enumerate(contents):

View File

@@ -113,14 +113,14 @@ def extract_media(base_dir):
FROM Files FROM Files
WHERE domain = '{_wts_id}' WHERE domain = '{_wts_id}'
ORDER BY relativePath""") ORDER BY relativePath""")
if not os.path.isdir("WhatsApp"): if not os.path.isdir(_wts_id):
os.mkdir("WhatsApp") os.mkdir(_wts_id)
row = c.fetchone() row = c.fetchone()
while row is not None: while row is not None:
if row["relativePath"] == "": if row["relativePath"] == "":
row = c.fetchone() row = c.fetchone()
continue continue
destination = os.path.join("WhatsApp/", row["relativePath"]) destination = os.path.join(_wts_id, row["relativePath"])
hashes = row["fileID"] hashes = row["fileID"]
folder = hashes[:2] folder = hashes[:2]
flags = row["flags"] flags = row["flags"]