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