MCPcopy
hub / github.com/Guovin/iptv-api / get_result_file_content

Function get_result_file_content

utils/tools.py:502–523  ·  view source on GitHub ↗

Get the content of the result file

(path=None, show_content=False, file_type=None)

Source from the content-addressed store, hash-verified

500
501
502def get_result_file_content(path=None, show_content=False, file_type=None):
503 """
504 Get the content of the result file
505 """
506 result_file = (
507 os.path.splitext(path)[0] + f".{file_type}"
508 if file_type
509 else path
510 )
511 if os.path.exists(result_file):
512 if config.open_m3u_result:
513 if file_type == "m3u" or not file_type:
514 result_file = os.path.splitext(path)[0] + ".m3u"
515 if file_type != "txt" and show_content == False:
516 return send_file(resource_path(result_file), as_attachment=True)
517 with open(result_file, "r", encoding="utf-8") as file:
518 content = file.read()
519 else:
520 content = constants.waiting_tip
521 response = make_response(content)
522 response.mimetype = 'text/plain'
523 return response
524
525
526def remove_duplicates_from_list(data_list, seen, filter_host=False, ipv6_support=True):

Callers 15

show_indexFunction · 0.90
show_txtFunction · 0.90
show_ipv4_txtFunction · 0.90
show_ipv6_txtFunction · 0.90
show_hlsFunction · 0.90
show_hls_txtFunction · 0.90
show_hls_ipv4_txtFunction · 0.90
show_hls_ipv6_txtFunction · 0.90
show_m3uFunction · 0.90
show_hls_m3uFunction · 0.90
show_ipv4_m3uFunction · 0.90
show_ipv4_resultFunction · 0.90

Calls 1

resource_pathFunction · 0.90

Tested by

no test coverage detected