MCPcopy Create free account
hub / github.com/CCSH/IPTV / process_single_line

Function process_single_line

main.py:312–326  ·  view source on GitHub ↗
(line: str, classifier: ChannelClassifier, corrections: dict)

Source from the content-addressed store, hash-verified

310 print(f"[ERROR] 处理远程源 {url} 失败: {str(e)}")
311
312def process_single_line(line: str, classifier: ChannelClassifier, corrections: dict):
313 if "#genre#" in line or "#EXTINF:" in line or "," not in line or "://" not in line:
314 return
315 try:
316 channel_name, channel_address = line.split(',', 1)
317 except ValueError:
318 return
319 # 频道名标准化(简繁转换→清理→纠错)
320 channel_name = traditional_to_simplified(channel_name)
321 channel_name = clean_channel_name(channel_name)
322 channel_name = correct_channel_name(channel_name, corrections)
323 channel_address = clean_url(channel_address)
324 new_line = f"{channel_name},{channel_address}"
325 # 传入标准化后的频道名做分类(保证计数统一)
326 classifier.classify(channel_name, channel_address, new_line)
327
328def sort_channel_data(channel_data: list, chn_type: str, cfg_list: list) -> list:
329 if not channel_data:

Callers 2

process_remote_urlFunction · 0.85
main.pyFile · 0.85

Calls 5

clean_channel_nameFunction · 0.85
correct_channel_nameFunction · 0.85
clean_urlFunction · 0.85
classifyMethod · 0.80

Tested by

no test coverage detected