影片刮削时Ctrl+C立刻退出,而不是加入失败列表并跳到下一部影片

This commit is contained in:
lededev
2022-04-18 01:27:46 +08:00
parent 3224f8c1ab
commit 3dda5a94cf
4 changed files with 15 additions and 14 deletions

View File

@@ -467,7 +467,7 @@ def download_file_with_filename(url: str, filename: str, path: str) -> None:
os.makedirs(path)
except:
print(f"[-]Fatal error! Can not make folder '{path}'")
sys.exit(0)
os._exit(0)
proxies = configProxy.proxies()
headers = {
'User-Agent': G_USER_AGENT}
@@ -484,7 +484,7 @@ def download_file_with_filename(url: str, filename: str, path: str) -> None:
os.makedirs(path)
except:
print(f"[-]Fatal error! Can not make folder '{path}'")
sys.exit(0)
os._exit(0)
headers = {
'User-Agent': G_USER_AGENT}
r = requests.get(url, timeout=configProxy.timeout, headers=headers)

View File

@@ -304,7 +304,7 @@ def close_logfile(logdir: str):
def signal_handler(*args):
print('[!]Ctrl+C detected, Exit.')
sys.exit(9)
os._exit(9)
def sigdebug_handler(*args):
@@ -426,7 +426,7 @@ def create_failed_folder(failed_folder: str):
os.makedirs(failed_folder)
except:
print(f"[-]Fatal error! Can not make folder '{failed_folder}'")
sys.exit(0)
os._exit(0)
def rm_empty_folder(path):
@@ -517,7 +517,7 @@ def main(args: tuple) -> Path:
folder_path = ""
if main_mode not in (1, 2, 3):
print(f"[-]Main mode must be 1 or 2 or 3! You can run '{os.path.basename(sys.argv[0])} --help' for more help.")
sys.exit(4)
os._exit(4)
signal.signal(signal.SIGINT, signal_handler)
if sys.platform == 'win32':

View File

@@ -69,17 +69,17 @@ class Config:
elif (Path(__file__).resolve().parent / 'config.ini').is_file():
res_path = Path(__file__).resolve().parent / 'config.ini'
if res_path is None:
sys.exit(2)
os._exit(2)
ins = input("Or, Do you want me create a config file for you? (Yes/No)[Y]:")
if re.search('n', ins, re.I):
sys.exit(2)
os._exit(2)
# 用户目录才确定具有写权限,因此选择 ~/mdc.ini 作为配置文件生成路径,而不是有可能并没有写权限的
# 当前目录。目前版本也不再鼓励使用当前路径放置配置文件了,只是作为多配置文件的切换技巧保留。
write_path = path_search_order[2] # Path.home() / "mdc.ini"
write_path.write_text(res_path.read_text(encoding='utf-8'), encoding='utf-8')
print("Config file '{}' created.".format(write_path.resolve()))
input("Press Enter key exit...")
sys.exit(0)
os._exit(0)
# self.conf = self._default_config()
# try:
# self.conf = configparser.ConfigParser()
@@ -90,7 +90,7 @@ class Config:
# except Exception as e:
# print("[-]Config file not found! Use the default settings")
# print("[-]",e)
# sys.exit(3)
# os._exit(3)
# #self.conf = self._default_config()
def set_override(self, option_cmd: str):
@@ -110,7 +110,7 @@ class Config:
"""
def err_exit(str):
print(str)
sys.exit(2)
os._exit(2)
sections = self.conf.sections()
sec_name = None

View File

@@ -1,5 +1,6 @@
import json
import os.path
import os
import pathlib
import re
import shutil
@@ -104,7 +105,7 @@ def create_folder(json_data): # 创建文件夹
os.makedirs(path)
except:
print(f"[-]Fatal error! Can not make folder '{path}'")
sys.exit(0)
os._exit(0)
return os.path.normpath(path)
@@ -124,7 +125,7 @@ def download_file_with_filename(url, filename, path, filepath):
os.makedirs(path)
except:
print(f"[-]Fatal error! Can not make folder '{path}'")
sys.exit(0)
os._exit(0)
proxies = configProxy.proxies()
headers = {
'User-Agent': G_USER_AGENT}
@@ -141,7 +142,7 @@ def download_file_with_filename(url, filename, path, filepath):
os.makedirs(path)
except:
print(f"[-]Fatal error! Can not make folder '{path}'")
sys.exit(0)
os._exit(0)
headers = {
'User-Agent': G_USER_AGENT}
r = requests.get(url, timeout=configProxy.timeout, headers=headers)
@@ -292,7 +293,7 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f
os.makedirs(path)
except:
print(f"[-]Fatal error! can not make folder '{path}'")
sys.exit(0)
os._exit(0)
old_nfo = None
try: