Remove custom config file path
This commit is contained in:
@@ -34,14 +34,14 @@ def argparse_function(ver: str) -> [str, str, bool]:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("file", default='', nargs='?', help="Single Movie file path.")
|
||||
parser.add_argument("-p","--path",default='',nargs='?',help="Analysis folder path.")
|
||||
parser.add_argument("-c", "--config", default='config.ini', nargs='?', help="The config file Path.")
|
||||
# parser.add_argument("-c", "--config", default='config.ini', nargs='?', help="The config file Path.")
|
||||
parser.add_argument("-n", "--number", default='', nargs='?', help="Custom file number")
|
||||
parser.add_argument("-a", "--auto-exit", dest='autoexit', action="store_true",
|
||||
help="Auto exit after program complete")
|
||||
parser.add_argument("-v", "--version", action="version", version=ver)
|
||||
args = parser.parse_args()
|
||||
|
||||
return args.file, args.path, args.config, args.number, args.autoexit
|
||||
return args.file, args.path, args.number, args.autoexit
|
||||
|
||||
|
||||
def movie_lists(root, escape_folder):
|
||||
@@ -137,14 +137,15 @@ if __name__ == '__main__':
|
||||
version = '4.6.2'
|
||||
|
||||
# Parse command line args
|
||||
single_file_path, folder_path, config_file, custom_number, auto_exit = argparse_function(version)
|
||||
single_file_path, folder_path, custom_number, auto_exit = argparse_function(version)
|
||||
|
||||
print('[*]================== AV Data Capture ===================')
|
||||
print('[*]' + version.center(54))
|
||||
print('[*]======================================================')
|
||||
|
||||
# Read config.ini
|
||||
conf = config.Config(path=config_file)
|
||||
conf = config.Config("config.ini")
|
||||
|
||||
|
||||
if conf.update_check():
|
||||
check_update(version)
|
||||
|
||||
26
config.py
26
config.py
@@ -1,8 +1,8 @@
|
||||
import os
|
||||
import sys
|
||||
import configparser
|
||||
import codecs
|
||||
|
||||
|
||||
class Config:
|
||||
def __init__(self, path: str = "config.ini"):
|
||||
if os.path.exists(path):
|
||||
@@ -12,16 +12,20 @@ class Config:
|
||||
except:
|
||||
self.conf.read(path, encoding="utf-8")
|
||||
else:
|
||||
try:
|
||||
self.conf = configparser.ConfigParser()
|
||||
try: # From single crawler debug use only
|
||||
self.conf.read('../' + path, encoding="utf-8-sig")
|
||||
except:
|
||||
self.conf.read('../' + path, encoding="utf-8")
|
||||
except Exception as e:
|
||||
print("[-]Config file not found! Use the default settings")
|
||||
print("[-]",e)
|
||||
self.conf = self._default_config()
|
||||
print("[-]Config file not found!")
|
||||
sys.exit(3)
|
||||
# self.conf = self._default_config()
|
||||
# try:
|
||||
# self.conf = configparser.ConfigParser()
|
||||
# try: # From single crawler debug use only
|
||||
# self.conf.read('../' + path, encoding="utf-8-sig")
|
||||
# except:
|
||||
# self.conf.read('../' + path, encoding="utf-8")
|
||||
# except Exception as e:
|
||||
# print("[-]Config file not found! Use the default settings")
|
||||
# print("[-]",e)
|
||||
# sys.exit(3)
|
||||
# #self.conf = self._default_config()
|
||||
|
||||
def main_mode(self) -> str:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user