fix arg handlers and album versions route

This commit is contained in:
geoffrey45
2023-05-07 14:02:46 +03:00
parent be7fc26fce
commit 45bf7570a3
6 changed files with 15 additions and 11 deletions
+3
View File
@@ -141,6 +141,7 @@ def get_album_versions():
artisthash: str = data['artisthash'] artisthash: str = data['artisthash']
albums = AlbumStore.get_albums_by_artisthash(artisthash) albums = AlbumStore.get_albums_by_artisthash(artisthash)
print(base_title, artisthash)
albums = [ albums = [
a for a in albums a for a in albums
@@ -148,6 +149,8 @@ def get_album_versions():
create_hash(a.base_title) == create_hash(base_title) and create_hash(og_album_title) != create_hash(a.og_title) create_hash(a.base_title) == create_hash(base_title) and create_hash(og_album_title) != create_hash(a.og_title)
] ]
print(albums)
return { return {
"data": albums "data": albums
} }
+4 -4
View File
@@ -44,7 +44,7 @@ class HandleArgs:
""" """
Runs Pyinstaller. Runs Pyinstaller.
""" """
if ALLARGS.build in ARGS: if ALLARGS.build.value in ARGS:
with open("pyinstaller.config.ini", "w", encoding="utf-8") as file: with open("pyinstaller.config.ini", "w", encoding="utf-8") as file:
config["DEFAULT"]["BUILD"] = "True" config["DEFAULT"]["BUILD"] = "True"
config.write(file) config.write(file)
@@ -73,7 +73,7 @@ class HandleArgs:
@staticmethod @staticmethod
def handle_port(): def handle_port():
if ALLARGS.port in ARGS: if ALLARGS.port.value in ARGS:
index = ARGS.index(ALLARGS.port.value) index = ARGS.index(ALLARGS.port.value)
try: try:
port = ARGS[index + 1] port = ARGS[index + 1]
@@ -89,7 +89,7 @@ class HandleArgs:
@staticmethod @staticmethod
def handle_host(): def handle_host():
if ALLARGS.host in ARGS: if ALLARGS.host.value in ARGS:
index = ARGS.index(ALLARGS.host.value) index = ARGS.index(ALLARGS.host.value)
try: try:
@@ -105,7 +105,7 @@ class HandleArgs:
""" """
Modifies the config path. Modifies the config path.
""" """
if ALLARGS.config in ARGS: if ALLARGS.config.value in ARGS:
index = ARGS.index(ALLARGS.config.value) index = ARGS.index(ALLARGS.config.value)
try: try:
+1 -1
View File
@@ -64,7 +64,7 @@ def extract_thumb(filepath: str, webp_path: str) -> bool:
return False return False
def extract_date(date_str: str | None) -> int: def extract_date(date_str: str | None, filepath: str) -> int:
try: try:
return int(date_str.split("-")[0]) return int(date_str.split("-")[0])
except: # pylint: disable=bare-except except: # pylint: disable=bare-except
+1
View File
@@ -55,6 +55,7 @@ class Album:
if get_flag(ParserFlags.CLEAN_ALBUM_TITLE): if get_flag(ParserFlags.CLEAN_ALBUM_TITLE):
# if FromFlags.CLEAN_ALBUM_TITLE: # if FromFlags.CLEAN_ALBUM_TITLE:
self.title, self.versions = get_base_title_and_versions(self.title) self.title, self.versions = get_base_title_and_versions(self.title)
self.base_title = self.title
if "super_deluxe" in self.versions: if "super_deluxe" in self.versions:
self.versions.remove("deluxe") self.versions.remove("deluxe")
+1 -1
View File
@@ -21,7 +21,7 @@ def recent_fav_album_serializer(album: Album) -> dict:
""" """
return { return {
"image": album.image, "image": album.image,
"title": album.og_title, "title": album.title,
"albumhash": album.albumhash, "albumhash": album.albumhash,
"colors": album.colors, "colors": album.colors,
} }
+5 -5
View File
@@ -145,19 +145,19 @@ class ALLARGS(Enum):
class FromFlags: class FromFlags:
EXTRACT_FEAT = False EXTRACT_FEAT = True
""" """
Whether to extract the featured artists from the song title. Whether to extract the featured artists from the song title.
""" """
REMOVE_PROD = False REMOVE_PROD = True
""" """
Whether to remove the producers from the song title. Whether to remove the producers from the song title.
""" """
CLEAN_ALBUM_TITLE = False CLEAN_ALBUM_TITLE = True
REMOVE_REMASTER_FROM_TRACK = False REMOVE_REMASTER_FROM_TRACK = True
SHOW_ALBUM_VERSION = False SHOW_ALBUM_VERSION = True
DO_PERIODIC_SCANS = True DO_PERIODIC_SCANS = True
PERIODIC_SCAN_INTERVAL = 300 # seconds PERIODIC_SCAN_INTERVAL = 300 # seconds