Try fix _tmp on linux

This commit is contained in:
Lovi 2025-02-08 17:16:56 +01:00
parent 54567a8711
commit 335d97ec2d
4 changed files with 26 additions and 21 deletions

View File

@ -384,7 +384,6 @@ class M3U8_Segments:
return ( return (
f"{Colors.YELLOW}Proc{Colors.WHITE}: " f"{Colors.YELLOW}Proc{Colors.WHITE}: "
f"{Colors.RED}{{percentage:.2f}}% " f"{Colors.RED}{{percentage:.2f}}% "
f"{Colors.WHITE}| "
f"{Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]" f"{Colors.CYAN}{{remaining}}{{postfix}} {Colors.WHITE}]"
) )

View File

@ -127,16 +127,16 @@ class M3U8_Ts_Estimator:
retry_count = self.segments_instance.active_retries if self.segments_instance else 0 retry_count = self.segments_instance.active_retries if self.segments_instance else 0
progress_str = ( progress_str = (
#f"{Colors.WHITE}[ {Colors.GREEN}{number_file_downloaded} {Colors.WHITE}< " #f"{Colors.WHITE}[ {Colors.GREEN}{number_file_downloaded} {Colors.WHITE}< "
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size} " f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}"
f"{Colors.WHITE}| {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit} " f"{Colors.WHITE} {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit}"
f"{Colors.WHITE}| {Colors.GREEN}CRR {Colors.RED}{retry_count}" f"{Colors.WHITE} {Colors.GREEN}CRR {Colors.RED}{retry_count} "
) )
else: else:
retry_count = self.segments_instance.active_retries if self.segments_instance else 0 retry_count = self.segments_instance.active_retries if self.segments_instance else 0
progress_str = ( progress_str = (
#f"{Colors.WHITE}[ {Colors.GREEN}{number_file_downloaded} {Colors.WHITE}< " #f"{Colors.WHITE}[ {Colors.GREEN}{number_file_downloaded} {Colors.WHITE}< "
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size} " f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}"
f"{Colors.WHITE}| {Colors.GREEN}CRR {Colors.RED}{retry_count}" f"{Colors.WHITE} {Colors.GREEN}CRR {Colors.RED}{retry_count} "
) )
progress_counter.set_postfix_str(progress_str) progress_counter.set_postfix_str(progress_str)

View File

@ -202,20 +202,26 @@ class OsManager:
""" """
try: try:
# List all files in the folder # First, try to make all files writable
files_in_folder = os.listdir(folder_path) for root, dirs, files in os.walk(self.temp_dir):
for dir_name in dirs:
# Iterate over each file in the folder dir_path = os.path.join(root, dir_name)
for file_name in files_in_folder: os.chmod(dir_path, 0o755) # rwxr-xr-x
file_path = os.path.join(folder_path, file_name) for file_name in files:
file_path = os.path.join(root, file_name)
# Check if the file is not the one to keep and is a regular file os.chmod(file_path, 0o644) # rw-r--r--
if file_name != keep_file and os.path.isfile(file_path):
os.remove(file_path) # Delete the file # Then remove the directory tree
shutil.rmtree(self.temp_dir, ignore_errors=True)
# If directory still exists after rmtree, try force remove
if os.path.exists(self.temp_dir):
import subprocess
subprocess.run(['rm', '-rf', self.temp_dir], check=True)
except Exception as e: except Exception as e:
logging.error(f"An error occurred: {e}") logging.error(f"Failed to cleanup temporary directory: {str(e)}")
raise pass
def check_file(self, file_path: str) -> bool: def check_file(self, file_path: str) -> bool:
""" """

View File

@ -22,7 +22,7 @@
"telegram_bot": false "telegram_bot": false
}, },
"REQUESTS": { "REQUESTS": {
"timeout": 20, "timeout": 25,
"max_retry": 8, "max_retry": 8,
"proxy_start_min": 0.1, "proxy_start_min": 0.1,
"proxy_start_max": 0.5 "proxy_start_max": 0.5
@ -31,7 +31,7 @@
"tqdm_delay": 0.01, "tqdm_delay": 0.01,
"default_video_workser": 12, "default_video_workser": 12,
"default_audio_workser": 12, "default_audio_workser": 12,
"segment_timeout": 7, "segment_timeout": 8,
"download_audio": true, "download_audio": true,
"merge_audio": true, "merge_audio": true,
"specific_list_audio": [ "specific_list_audio": [