Skip to content

Commit 2a1fe90

Browse files
committed
Update syn_local.py
1 parent 6f3069d commit 2a1fe90

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tv/syn_local.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import subprocess
33
import datetime
44
import re
5+
import shutil
56

67
# 获取脚本所在目录
78
script_path = os.path.dirname(os.path.abspath(__file__))
@@ -44,8 +45,23 @@ def print_current_time(message):
4445
# 5. 下载文件列表 - 已移至 iptv_download_merge.py
4546
print("跳过下载文件步骤,请使用 iptv_download_merge.py 进行文件下载")
4647

47-
# 6. 同步文件 - 已移至 iptv_download_merge.py
48-
print("跳过文件同步步骤,请使用 iptv_download_merge.py 进行文件同步")
48+
# 6. 同步文件
49+
print("正在同步IPTV文件...")
50+
files_to_sync = ['iptv4.txt', 'iptv4.m3u', 'iptv6.txt', 'iptv6.m3u']
51+
source_dir = '/docker/iptv4/'
52+
53+
for file_name in files_to_sync:
54+
source_path = os.path.join(source_dir, file_name)
55+
target_path = os.path.join(script_path, file_name)
56+
57+
if os.path.exists(source_path):
58+
try:
59+
shutil.copy2(source_path, target_path)
60+
print(f"成功同步文件: {file_name}{source_dir}{script_path}")
61+
except Exception as e:
62+
print(f"同步文件 {file_name} 时出错: {str(e)}")
63+
else:
64+
print(f"警告:源文件 {source_path} 不存在,跳过同步")
4965

5066
# 7. 合并文件 - 已移至 iptv_download_merge.py
5167
print("跳过文件合并步骤,请使用 iptv_download_merge.py 进行文件合并")

0 commit comments

Comments
 (0)