mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-05-22 08:51:18 +00:00
Normalize media path handling in handlers
This commit is contained in:
@@ -806,10 +806,9 @@ def _process_single_media(data, content, media_folder, mime, separate_media, fix
|
|||||||
file_path, new_path, message.timestamp,
|
file_path, new_path, message.timestamp,
|
||||||
timezone_offset, embed_exif, rename_media
|
timezone_offset, embed_exif, rename_media
|
||||||
)
|
)
|
||||||
message.data = final_path
|
|
||||||
else:
|
else:
|
||||||
shutil.copy2(file_path, new_path)
|
final_path = new_path
|
||||||
message.data = new_path
|
shutil.copy2(file_path, final_path)
|
||||||
elif embed_exif or rename_media:
|
elif embed_exif or rename_media:
|
||||||
# Handle in-place processing when not separating
|
# Handle in-place processing when not separating
|
||||||
# Create a copy with timestamp processing in the same folder
|
# Create a copy with timestamp processing in the same folder
|
||||||
@@ -817,9 +816,9 @@ def _process_single_media(data, content, media_folder, mime, separate_media, fix
|
|||||||
file_path, file_path, message.timestamp,
|
file_path, file_path, message.timestamp,
|
||||||
timezone_offset, embed_exif, rename_media
|
timezone_offset, embed_exif, rename_media
|
||||||
)
|
)
|
||||||
message.data = final_path
|
|
||||||
else:
|
else:
|
||||||
message.data = file_path
|
final_path = file_path
|
||||||
|
message.data = final_path
|
||||||
else:
|
else:
|
||||||
message.data = "The media is missing"
|
message.data = "The media is missing"
|
||||||
message.mime = "media"
|
message.mime = "media"
|
||||||
|
|||||||
@@ -495,20 +495,18 @@ def process_media_item(content, data, media_folder, mime, separate_media, fix_do
|
|||||||
file_path, new_path, message.timestamp,
|
file_path, new_path, message.timestamp,
|
||||||
timezone_offset, embed_exif, rename_media
|
timezone_offset, embed_exif, rename_media
|
||||||
)
|
)
|
||||||
message.data = '/'.join(final_path.split("\\")[1:])
|
|
||||||
else:
|
else:
|
||||||
shutil.copy2(file_path, new_path)
|
final_path = new_path
|
||||||
message.data = '/'.join(new_path.split("\\")[1:])
|
shutil.copy2(file_path, final_path)
|
||||||
elif embed_exif or rename_media:
|
elif embed_exif or rename_media:
|
||||||
# Handle in-place processing when not separating
|
# Handle in-place processing when not separating
|
||||||
final_path = process_media_with_timestamp(
|
final_path = process_media_with_timestamp(
|
||||||
file_path, file_path, message.timestamp,
|
file_path, file_path, message.timestamp,
|
||||||
timezone_offset, embed_exif, rename_media
|
timezone_offset, embed_exif, rename_media
|
||||||
)
|
)
|
||||||
message.data = '/'.join(final_path.split("/")[1:])
|
|
||||||
else:
|
else:
|
||||||
message.data = '/'.join(file_path.split("/")[1:])
|
final_path = file_path
|
||||||
|
message.data = os.path.join(*final_path.split(os.sep)[1:])
|
||||||
else:
|
else:
|
||||||
# Handle missing media
|
# Handle missing media
|
||||||
message.data = "The media is missing"
|
message.data = "The media is missing"
|
||||||
|
|||||||
Reference in New Issue
Block a user