mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-23 06:21:37 +00:00
Prepare for size control of output file
This commit is contained in:
@@ -86,34 +86,45 @@ def main():
|
|||||||
"--template",
|
"--template",
|
||||||
dest="template",
|
dest="template",
|
||||||
default=None,
|
default=None,
|
||||||
help="Path to custom HTML template")
|
help="Path to custom HTML template"
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-e",
|
"-e",
|
||||||
"--embedded",
|
"--embedded",
|
||||||
dest="embedded",
|
dest="embedded",
|
||||||
default=False,
|
default=False,
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Embed media into HTML file")
|
help="Embed media into HTML file (not yet implemented)"
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-s",
|
"-s",
|
||||||
"--showkey",
|
"--showkey",
|
||||||
dest="showkey",
|
dest="showkey",
|
||||||
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_argument(
|
parser.add_argument(
|
||||||
"-c",
|
"-c",
|
||||||
"--move-media",
|
"--move-media",
|
||||||
dest="move_media",
|
dest="move_media",
|
||||||
default=False,
|
default=False,
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Move the media directory to output directory if the flag is set, otherwise copy it")
|
help="Move the media directory to output directory if the flag is set, otherwise copy it"
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--offline",
|
"--offline",
|
||||||
dest="offline",
|
dest="offline",
|
||||||
|
|
||||||
default=None,
|
default=None,
|
||||||
help="Relative path to offline static files")
|
help="Relative path to offline static files"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--size",
|
||||||
|
"--output-size",
|
||||||
|
dest="size",
|
||||||
|
default=None,
|
||||||
|
help="Maximum size of a single output file in bytes (not yet implemented)"
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.android and args.iphone:
|
if args.android and args.iphone:
|
||||||
@@ -199,7 +210,14 @@ def main():
|
|||||||
messages(db, data)
|
messages(db, data)
|
||||||
media(db, data, args.media)
|
media(db, data, args.media)
|
||||||
vcard(db, data)
|
vcard(db, data)
|
||||||
create_html(data, args.output, args.template, args.embedded, args.offline)
|
create_html(
|
||||||
|
data,
|
||||||
|
args.output,
|
||||||
|
args.template,
|
||||||
|
args.embedded,
|
||||||
|
args.offline,
|
||||||
|
args.size
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
"The message database does not exist. You may specify the path "
|
"The message database does not exist. You may specify the path "
|
||||||
|
|||||||
@@ -458,7 +458,14 @@ def vcard(db, data):
|
|||||||
print(f"Gathering vCards...({index + 1}/{total_row_number})", end="\r")
|
print(f"Gathering vCards...({index + 1}/{total_row_number})", end="\r")
|
||||||
|
|
||||||
|
|
||||||
def create_html(data, output_folder, template=None, embedded=False, offline_static=False):
|
def create_html(
|
||||||
|
data,
|
||||||
|
output_folder,
|
||||||
|
template=None,
|
||||||
|
embedded=False,
|
||||||
|
offline_static=False,
|
||||||
|
maximum_size=None
|
||||||
|
):
|
||||||
if template is None:
|
if template is None:
|
||||||
template_dir = os.path.dirname(__file__)
|
template_dir = os.path.dirname(__file__)
|
||||||
template_file = "whatsapp.html"
|
template_file = "whatsapp.html"
|
||||||
|
|||||||
Reference in New Issue
Block a user