Skip to content

Commit

Permalink
Update live.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwang1978 committed Nov 15, 2024
1 parent 6e6c837 commit 6ddde95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add merged_output.txt
git add merged_output.m3u
git add merged_output_simple.txt
git add merged_output_simple.m3u
git add others_output.txt
git add merged_output.txt merged_output.m3u merged_output_simple.txt merged_output_simple.m3u others_output.txt
git add live.txt live.m3u live_lite.txt live_lite.m3u
git commit -m ":tada: AutoUpdate $(date +'%Y%m%d')"
current_datetime=$(date +"%Y%m%d_%H%M%S")
Expand Down
24 changes: 21 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,10 @@ def get_random_url(file_path):
output_file_simple = "merged_output_simple.txt"
others_file = "others_output.txt"

# NEW将合并后的文本写入文件
new_output_file = "live.txt"
new_output_file_simple = "live_lite.txt"

# # custom定制
# output_file_custom_zhang = "custom/zhang.txt"

Expand All @@ -689,11 +693,23 @@ def get_random_url(file_path):
for line in all_lines_simple:
f.write(line + '\n')
print(f"合并后的文本已保存到文件: {output_file_simple}")

with open(new_output_file_simple, 'w', encoding='utf-8') as f:
for line in all_lines_simple:
f.write(line + '\n')
print(f"合并后的文本已保存到文件: {new_output_file_simple}")

# 全集版
with open(output_file, 'w', encoding='utf-8') as f:
for line in all_lines:
f.write(line + '\n')
print(f"合并后的文本已保存到文件: {output_file}")

with open(new_output_file, 'w', encoding='utf-8') as f:
for line in all_lines:
f.write(line + '\n')
print(f"合并后的文本已保存到文件: {new_output_file}")

# 其他
with open(others_file, 'w', encoding='utf-8') as f:
for line in other_lines:
Expand Down Expand Up @@ -751,7 +767,7 @@ def get_logo_by_channel_name(channel_name):
# print("merged_output.m3u文件已生成。")


def make_m3u(txt_file, m3u_file):
def make_m3u(txt_file, m3u_file, m3u_file_copy):
try:
#output_text = '#EXTM3U x-tvg-url="https://live.fanmingming.com/e.xml,https://epg.112114.xyz/pp.xml.gz,https://assets.livednow.com/epg.xml"\n'
output_text = '#EXTM3U x-tvg-url="https://live.fanmingming.com/e.xml.gz"\n'
Expand Down Expand Up @@ -792,13 +808,15 @@ def make_m3u(txt_file, m3u_file):

with open(f"{m3u_file}", "w", encoding='utf-8') as file:
file.write(output_text)
with open(f"{m3u_file_copy}", "w", encoding='utf-8') as file:
file.write(output_text)

print(f"M3U文件 '{m3u_file}' 生成成功。")
except Exception as e:
print(f"发生错误: {e}")

make_m3u(output_file, "merged_output.m3u")
make_m3u(output_file_simple, "merged_output_simple.m3u")
make_m3u(output_file, "merged_output.m3u", "live.m3u")
make_m3u(output_file_simple, "merged_output_simple.m3u", "live_lite.m3u")


# 执行结束时间
Expand Down

0 comments on commit 6ddde95

Please sign in to comment.