影片刮削时Ctrl+C立刻退出,而不是加入失败列表并跳到下一部影片
This commit is contained in:
@@ -467,7 +467,7 @@ def download_file_with_filename(url: str, filename: str, path: str) -> None:
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except:
|
except:
|
||||||
print(f"[-]Fatal error! Can not make folder '{path}'")
|
print(f"[-]Fatal error! Can not make folder '{path}'")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
proxies = configProxy.proxies()
|
proxies = configProxy.proxies()
|
||||||
headers = {
|
headers = {
|
||||||
'User-Agent': G_USER_AGENT}
|
'User-Agent': G_USER_AGENT}
|
||||||
@@ -484,7 +484,7 @@ def download_file_with_filename(url: str, filename: str, path: str) -> None:
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except:
|
except:
|
||||||
print(f"[-]Fatal error! Can not make folder '{path}'")
|
print(f"[-]Fatal error! Can not make folder '{path}'")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
headers = {
|
headers = {
|
||||||
'User-Agent': G_USER_AGENT}
|
'User-Agent': G_USER_AGENT}
|
||||||
r = requests.get(url, timeout=configProxy.timeout, headers=headers)
|
r = requests.get(url, timeout=configProxy.timeout, headers=headers)
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ def close_logfile(logdir: str):
|
|||||||
|
|
||||||
def signal_handler(*args):
|
def signal_handler(*args):
|
||||||
print('[!]Ctrl+C detected, Exit.')
|
print('[!]Ctrl+C detected, Exit.')
|
||||||
sys.exit(9)
|
os._exit(9)
|
||||||
|
|
||||||
|
|
||||||
def sigdebug_handler(*args):
|
def sigdebug_handler(*args):
|
||||||
@@ -426,7 +426,7 @@ def create_failed_folder(failed_folder: str):
|
|||||||
os.makedirs(failed_folder)
|
os.makedirs(failed_folder)
|
||||||
except:
|
except:
|
||||||
print(f"[-]Fatal error! Can not make folder '{failed_folder}'")
|
print(f"[-]Fatal error! Can not make folder '{failed_folder}'")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
|
||||||
def rm_empty_folder(path):
|
def rm_empty_folder(path):
|
||||||
@@ -517,7 +517,7 @@ def main(args: tuple) -> Path:
|
|||||||
folder_path = ""
|
folder_path = ""
|
||||||
if main_mode not in (1, 2, 3):
|
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.")
|
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)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
|
|||||||
10
config.py
10
config.py
@@ -69,17 +69,17 @@ class Config:
|
|||||||
elif (Path(__file__).resolve().parent / 'config.ini').is_file():
|
elif (Path(__file__).resolve().parent / 'config.ini').is_file():
|
||||||
res_path = Path(__file__).resolve().parent / 'config.ini'
|
res_path = Path(__file__).resolve().parent / 'config.ini'
|
||||||
if res_path is None:
|
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]:")
|
ins = input("Or, Do you want me create a config file for you? (Yes/No)[Y]:")
|
||||||
if re.search('n', ins, re.I):
|
if re.search('n', ins, re.I):
|
||||||
sys.exit(2)
|
os._exit(2)
|
||||||
# 用户目录才确定具有写权限,因此选择 ~/mdc.ini 作为配置文件生成路径,而不是有可能并没有写权限的
|
# 用户目录才确定具有写权限,因此选择 ~/mdc.ini 作为配置文件生成路径,而不是有可能并没有写权限的
|
||||||
# 当前目录。目前版本也不再鼓励使用当前路径放置配置文件了,只是作为多配置文件的切换技巧保留。
|
# 当前目录。目前版本也不再鼓励使用当前路径放置配置文件了,只是作为多配置文件的切换技巧保留。
|
||||||
write_path = path_search_order[2] # Path.home() / "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')
|
write_path.write_text(res_path.read_text(encoding='utf-8'), encoding='utf-8')
|
||||||
print("Config file '{}' created.".format(write_path.resolve()))
|
print("Config file '{}' created.".format(write_path.resolve()))
|
||||||
input("Press Enter key exit...")
|
input("Press Enter key exit...")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
# self.conf = self._default_config()
|
# self.conf = self._default_config()
|
||||||
# try:
|
# try:
|
||||||
# self.conf = configparser.ConfigParser()
|
# self.conf = configparser.ConfigParser()
|
||||||
@@ -90,7 +90,7 @@ class Config:
|
|||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# print("[-]Config file not found! Use the default settings")
|
# print("[-]Config file not found! Use the default settings")
|
||||||
# print("[-]",e)
|
# print("[-]",e)
|
||||||
# sys.exit(3)
|
# os._exit(3)
|
||||||
# #self.conf = self._default_config()
|
# #self.conf = self._default_config()
|
||||||
|
|
||||||
def set_override(self, option_cmd: str):
|
def set_override(self, option_cmd: str):
|
||||||
@@ -110,7 +110,7 @@ class Config:
|
|||||||
"""
|
"""
|
||||||
def err_exit(str):
|
def err_exit(str):
|
||||||
print(str)
|
print(str)
|
||||||
sys.exit(2)
|
os._exit(2)
|
||||||
|
|
||||||
sections = self.conf.sections()
|
sections = self.conf.sections()
|
||||||
sec_name = None
|
sec_name = None
|
||||||
|
|||||||
9
core.py
9
core.py
@@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@@ -104,7 +105,7 @@ def create_folder(json_data): # 创建文件夹
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except:
|
except:
|
||||||
print(f"[-]Fatal error! Can not make folder '{path}'")
|
print(f"[-]Fatal error! Can not make folder '{path}'")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
return os.path.normpath(path)
|
return os.path.normpath(path)
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ def download_file_with_filename(url, filename, path, filepath):
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except:
|
except:
|
||||||
print(f"[-]Fatal error! Can not make folder '{path}'")
|
print(f"[-]Fatal error! Can not make folder '{path}'")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
proxies = configProxy.proxies()
|
proxies = configProxy.proxies()
|
||||||
headers = {
|
headers = {
|
||||||
'User-Agent': G_USER_AGENT}
|
'User-Agent': G_USER_AGENT}
|
||||||
@@ -141,7 +142,7 @@ def download_file_with_filename(url, filename, path, filepath):
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except:
|
except:
|
||||||
print(f"[-]Fatal error! Can not make folder '{path}'")
|
print(f"[-]Fatal error! Can not make folder '{path}'")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
headers = {
|
headers = {
|
||||||
'User-Agent': G_USER_AGENT}
|
'User-Agent': G_USER_AGENT}
|
||||||
r = requests.get(url, timeout=configProxy.timeout, headers=headers)
|
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)
|
os.makedirs(path)
|
||||||
except:
|
except:
|
||||||
print(f"[-]Fatal error! can not make folder '{path}'")
|
print(f"[-]Fatal error! can not make folder '{path}'")
|
||||||
sys.exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
old_nfo = None
|
old_nfo = None
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user