Refactor a bit

This commit is contained in:
KnugiHK
2023-06-20 14:50:57 +08:00
parent 4fa360a389
commit cc0105647a
3 changed files with 14 additions and 33 deletions

View File

@@ -702,10 +702,7 @@ def create_html(
contact,
w3css,
f"{safe_file_name}-{current_page + 1}.html",
chat.my_avatar,
chat.their_avatar,
chat.their_avatar_thumb,
chat.status
chat
)
render_box = [message]
current_size = 0
@@ -724,10 +721,7 @@ def create_html(
contact,
w3css,
False,
chat.my_avatar,
chat.their_avatar,
chat.their_avatar_thumb,
chat.status
chat
)
else:
render_box.append(message)
@@ -741,10 +735,7 @@ def create_html(
contact,
w3css,
False,
chat.my_avatar,
chat.their_avatar,
chat.their_avatar_thumb,
chat.status
chat
)
if current % 10 == 0:
print(f"Generating chats...({current}/{total_row_number})", end="\r")

View File

@@ -368,10 +368,7 @@ def create_html(
contact,
w3css,
f"{safe_file_name}-{current_page + 1}.html",
chat.my_avatar,
chat.their_avatar,
chat.their_avatar_thumb,
chat.status
chat
)
render_box = [message]
current_size = 0
@@ -390,10 +387,7 @@ def create_html(
contact,
w3css,
False,
chat.my_avatar,
chat.their_avatar,
chat.their_avatar_thumb,
chat.status
chat
)
else:
render_box.append(message)
@@ -407,10 +401,7 @@ def create_html(
contact,
w3css,
False,
chat.my_avatar,
chat.their_avatar,
chat.their_avatar_thumb,
chat.status
chat
)
if current % 10 == 0:
print(f"Generating chats...({current}/{total_row_number})", end="\r")

View File

@@ -69,24 +69,23 @@ def rendering(
contact,
w3css,
next,
my_avatar,
their_avatar,
their_avatar_thumb,
status
chat,
):
if their_avatar_thumb is None and their_avatar is not None:
their_avatar_thumb = their_avatar
if chat.their_avatar_thumb is None and chat.their_avatar is not None:
their_avatar_thumb = chat.their_avatar
else:
their_avatar_thumb = chat.their_avatar_thumb
with open(output_file_name, "w", encoding="utf-8") as f:
f.write(
template.render(
name=name,
msgs=msgs,
my_avatar=my_avatar,
their_avatar=their_avatar,
my_avatar=chat.my_avatar,
their_avatar=chat.their_avatar,
their_avatar_thumb=their_avatar_thumb,
w3css=w3css,
next=next,
status=status,
status=chat.status,
)
)