mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-24 23:11:35 +00:00
Implement #25
Copying media folder to the output directory will be the default starting from this commit.
This commit is contained in:
@@ -93,6 +93,13 @@ def main():
|
|||||||
default=False,
|
default=False,
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Show the HEX key used to decrypt the database")
|
help="Show the HEX key used to decrypt the database")
|
||||||
|
parser.add_option(
|
||||||
|
"-c",
|
||||||
|
"--copy-media",
|
||||||
|
dest="copy_media",
|
||||||
|
default=True,
|
||||||
|
action='store_true',
|
||||||
|
help="Copy media directory to output directory, otherwise move the media directory to output directory")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if options.android and options.iphone:
|
if options.android and options.iphone:
|
||||||
@@ -193,13 +200,18 @@ def main():
|
|||||||
)
|
)
|
||||||
exit(2)
|
exit(2)
|
||||||
|
|
||||||
if os.path.isdir(options.media) and \
|
if os.path.isdir(options.media):
|
||||||
not os.path.isdir(f"{options.output}/{options.media}"):
|
if os.path.isdir(f"{options.output}/{options.media}"):
|
||||||
try:
|
print("Media directory already exists in output directory. Skipping...")
|
||||||
shutil.move(options.media, f"{options.output}/")
|
else:
|
||||||
except PermissionError:
|
if options.copy_media:
|
||||||
print("Cannot remove original WhatsApp directory. "
|
shutil.copytree(options.media, f"{options.output}/WhatsApp")
|
||||||
"Perhaps the directory is opened?")
|
else:
|
||||||
|
try:
|
||||||
|
shutil.move(options.media, f"{options.output}/")
|
||||||
|
except PermissionError:
|
||||||
|
print("Cannot remove original WhatsApp directory. "
|
||||||
|
"Perhaps the directory is opened?")
|
||||||
|
|
||||||
if options.json:
|
if options.json:
|
||||||
with open("result.json", "w") as f:
|
with open("result.json", "w") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user