Skip to content

Commit

Permalink
fix:UnicodeDecodeError(#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guovin committed Nov 18, 2024
1 parent 1b18565 commit 8a2500a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
from utils.config import config
import utils.constants as constants
from utils.channel import (
get_channel_items,
append_total_data,
Expand Down Expand Up @@ -56,8 +57,11 @@ def show_log():
user_log_file = "output/" + (
"user_result.log" if os.path.exists("config/user_config.ini") else "result.log"
)
with open(user_log_file, "r", encoding="utf-8") as file:
content = file.read()
if os.path.exists(user_log_file):
with open(user_log_file, "r", encoding="utf-8") as file:
content = file.read()
else:
content = constants.waiting_tip
return render_template_string(
"<head><link rel='icon' href='{{ url_for('static', filename='images/favicon.ico') }}' type='image/x-icon'></head><pre>{{ content }}</pre>",
content=content,
Expand Down
2 changes: 2 additions & 0 deletions utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@
foodie_url = "http://www.foodieguide.com/iptvsearch/"

foodie_hotel_url = "http://www.foodieguide.com/iptvsearch/hoteliptv.php"

waiting_tip = "🔍️正在更新,请耐心等待更新完成..."
2 changes: 1 addition & 1 deletion utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def get_result_file_content(show_result=False):
with open(user_final_file, "r", encoding="utf-8") as file:
content = file.read()
else:
content = "🔍️正在更新,请耐心等待更新完成..."
content = constants.waiting_tip
return render_template_string(
"<head><link rel='icon' href='{{ url_for('static', filename='images/favicon.ico') }}' type='image/x-icon'></head><pre>{{ content }}</pre>",
content=content,
Expand Down

0 comments on commit 8a2500a

Please sign in to comment.