diff --git a/app/api/settings.py b/app/api/settings.py index 71d49ca..f6190d7 100644 --- a/app/api/settings.py +++ b/app/api/settings.py @@ -208,9 +208,18 @@ def set_setting(): sdb.set_setting(key, value) - if mapp[key] is not False: - flag = mapp[key] - set_flag(flag, value) - reload_all_for_set_setting() + flag = mapp[key] + + if key == "artist_separators": + value = str(value).split(",") + value = set(value) + + set_flag(flag, value) + reload_all_for_set_setting() + + # if value is a set, convert it to a string + # (artist_separators) + if type(value) == set: + value = ",".join(value) return {"result": value} diff --git a/app/db/sqlite/queries.py b/app/db/sqlite/queries.py index 2e15fb3..9fe137f 100644 --- a/app/db/sqlite/queries.py +++ b/app/db/sqlite/queries.py @@ -26,7 +26,7 @@ CREATE TABLE IF NOT EXISTS settings ( id integer PRIMARY KEY, root_dirs text NOT NULL, exclude_dirs text, - artist_separators text NOT NULL default '/,;,&', + artist_separators text NOT NULL default '/,;', extract_feat integer NOT NULL DEFAULT 1, remove_prod integer NOT NULL DEFAULT 1, clean_album_title integer NOT NULL DEFAULT 1, diff --git a/app/db/sqlite/settings.py b/app/db/sqlite/settings.py index b503f9f..c27b7cc 100644 --- a/app/db/sqlite/settings.py +++ b/app/db/sqlite/settings.py @@ -137,7 +137,7 @@ def load_settings(): db_separators = db_separators.replace(" ", "") separators = db_separators.split(",") - separators = set(db_separators) + separators = set(separators) FromFlags.ARTIST_SEPARATORS = separators # boolean settings diff --git a/app/migrations/v1_3_0/__init__.py b/app/migrations/v1_3_0/__init__.py index 96c0a64..2fd8078 100644 --- a/app/migrations/v1_3_0/__init__.py +++ b/app/migrations/v1_3_0/__init__.py @@ -288,7 +288,7 @@ class UpdateAppSettingsTable(Migration): id integer PRIMARY KEY, root_dirs text NOT NULL, exclude_dirs text, - artist_separators text NOT NULL default '/,;,&', + artist_separators text NOT NULL default '/,;', extract_feat integer NOT NULL DEFAULT 1, remove_prod integer NOT NULL DEFAULT 1, clean_album_title integer NOT NULL DEFAULT 1, diff --git a/app/settings.py b/app/settings.py index f7bf208..8bb5532 100644 --- a/app/settings.py +++ b/app/settings.py @@ -168,7 +168,7 @@ class FromFlags: PERIODIC_SCAN_INTERVAL = 300 # seconds MERGE_ALBUM_VERSIONS = False - ARTIST_SEPARATORS = {",", "/", ";", "&"} + ARTIST_SEPARATORS = set() # TODO: Find a way to eliminate this class without breaking typings diff --git a/app/store/albums.py b/app/store/albums.py index 176a27b..0bd6be4 100644 --- a/app/store/albums.py +++ b/app/store/albums.py @@ -38,7 +38,7 @@ class AlbumStore: albumhashes = set(t.albumhash for t in TrackStore.tracks) - for albumhash in tqdm(albumhashes, desc=f"Loading {instance_key}"): + for albumhash in tqdm(albumhashes, desc=f"Loading albums"): if instance_key != ALBUM_LOAD_KEY: return diff --git a/app/utils/parsers.py b/app/utils/parsers.py index 0ec76e2..7e77657 100644 --- a/app/utils/parsers.py +++ b/app/utils/parsers.py @@ -8,7 +8,8 @@ def split_artists(src: str): """ Splits a string of artists into a list of artists. """ - separators = get_flag(ParserFlags.ARTIST_SEPARATORS) + separators: set = get_flag(ParserFlags.ARTIST_SEPARATORS) + separators = separators.union({","}) for sep in separators: src = src.replace(sep, "߸")