Get the content of the result file
(path=None, show_content=False, file_type=None)
| 500 | |
| 501 | |
| 502 | def 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 | |
| 526 | def remove_duplicates_from_list(data_list, seen, filter_host=False, ipv6_support=True): |
no test coverage detected