mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
add new flags to disable cleaning track and album titles
+ update readme +
This commit is contained in:
+54
-8
@@ -28,8 +28,14 @@ class HandleArgs:
|
||||
self.handle_host()
|
||||
self.handle_port()
|
||||
self.handle_config_path()
|
||||
|
||||
self.handle_no_feat()
|
||||
self.handle_remove_prod()
|
||||
self.handle_cleaning_albums()
|
||||
self.handle_cleaning_tracks()
|
||||
self.handle_periodic_scan()
|
||||
self.handle_periodic_scan_interval()
|
||||
|
||||
self.handle_help()
|
||||
self.handle_version()
|
||||
|
||||
@@ -68,7 +74,7 @@ class HandleArgs:
|
||||
@staticmethod
|
||||
def handle_port():
|
||||
if ALLARGS.port in ARGS:
|
||||
index = ARGS.index(ALLARGS.port)
|
||||
index = ARGS.index(ALLARGS.port.value)
|
||||
try:
|
||||
port = ARGS[index + 1]
|
||||
except IndexError:
|
||||
@@ -84,7 +90,7 @@ class HandleArgs:
|
||||
@staticmethod
|
||||
def handle_host():
|
||||
if ALLARGS.host in ARGS:
|
||||
index = ARGS.index(ALLARGS.host)
|
||||
index = ARGS.index(ALLARGS.host.value)
|
||||
|
||||
try:
|
||||
host = ARGS[index + 1]
|
||||
@@ -92,7 +98,7 @@ class HandleArgs:
|
||||
print("ERROR: Host not specified")
|
||||
sys.exit(0)
|
||||
|
||||
settings.FLASKVARS.FLASK_HOST = host # type: ignore
|
||||
settings.FLASKVARS.set_flask_host(host) # type: ignore
|
||||
|
||||
@staticmethod
|
||||
def handle_config_path():
|
||||
@@ -100,7 +106,7 @@ class HandleArgs:
|
||||
Modifies the config path.
|
||||
"""
|
||||
if ALLARGS.config in ARGS:
|
||||
index = ARGS.index(ALLARGS.config)
|
||||
index = ARGS.index(ALLARGS.config.value)
|
||||
|
||||
try:
|
||||
config_path = ARGS[index + 1]
|
||||
@@ -119,22 +125,62 @@ class HandleArgs:
|
||||
@staticmethod
|
||||
def handle_no_feat():
|
||||
# if ArgsEnum.no_feat in ARGS:
|
||||
if any((a in ARGS for a in ALLARGS.show_feat)):
|
||||
if any((a in ARGS for a in ALLARGS.show_feat.value)):
|
||||
settings.FromFlags.EXTRACT_FEAT = False
|
||||
|
||||
@staticmethod
|
||||
def handle_remove_prod():
|
||||
if any((a in ARGS for a in ALLARGS.show_prod)):
|
||||
if any((a in ARGS for a in ALLARGS.show_prod.value)):
|
||||
settings.FromFlags.REMOVE_PROD = False
|
||||
|
||||
@staticmethod
|
||||
def handle_cleaning_albums():
|
||||
if any((a in ARGS for a in ALLARGS.dont_clean_albums.value)):
|
||||
settings.FromFlags.CLEAN_ALBUM_TITLE = False
|
||||
|
||||
@staticmethod
|
||||
def handle_cleaning_tracks():
|
||||
if any((a in ARGS for a in ALLARGS.dont_clean_tracks.value)):
|
||||
settings.FromFlags.REMOVE_REMASTER_FROM_TRACK = False
|
||||
|
||||
@staticmethod
|
||||
def handle_periodic_scan():
|
||||
if any((a in ARGS for a in ALLARGS.no_periodic_scan.value)):
|
||||
settings.FromFlags.DO_PERIODIC_SCANS = False
|
||||
|
||||
@staticmethod
|
||||
def handle_periodic_scan_interval():
|
||||
if any((a in ARGS for a in ALLARGS.periodic_scan_interval.value)):
|
||||
index = [ARGS.index(a) for a in ALLARGS.periodic_scan_interval.value if a in ARGS][0]
|
||||
|
||||
try:
|
||||
interval = ARGS[index + 1]
|
||||
except IndexError:
|
||||
print("ERROR: Interval not specified")
|
||||
sys.exit(0)
|
||||
|
||||
# psi = 0
|
||||
|
||||
try:
|
||||
psi = int(interval)
|
||||
except ValueError:
|
||||
print("ERROR: Interval should be a number")
|
||||
sys.exit(0)
|
||||
|
||||
if psi < 0:
|
||||
print("WADAFUCK ARE YOU TRYING?")
|
||||
sys.exit(0)
|
||||
|
||||
settings.FromFlags.PERIODIC_SCAN_INTERVAL = psi
|
||||
|
||||
@staticmethod
|
||||
def handle_help():
|
||||
if any((a in ARGS for a in ALLARGS.help)):
|
||||
if any((a in ARGS for a in ALLARGS.help.value)):
|
||||
print(HELP_MESSAGE)
|
||||
sys.exit(0)
|
||||
|
||||
@staticmethod
|
||||
def handle_version():
|
||||
if any((a in ARGS for a in ALLARGS.version)):
|
||||
if any((a in ARGS for a in ALLARGS.version.value)):
|
||||
print(settings.Release.APP_VERSION)
|
||||
sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user