mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 03:05:35 +00:00
API switch to unrestricted ones
This commit is contained in:
parent
632447bdba
commit
c153247918
@ -54,7 +54,8 @@ def rebuild_store(db_dirs: list[str]):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
populate.Populate(instance_key=instance_key)
|
populate.Populate(instance_key=instance_key)
|
||||||
except populate.PopulateCancelledError:
|
except populate.PopulateCancelledError as e:
|
||||||
|
print(e)
|
||||||
reload_everything(instance_key)
|
reload_everything(instance_key)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ def rebuild_store(db_dirs: list[str]):
|
|||||||
log.info("Rebuilding library... ✅")
|
log.info("Rebuilding library... ✅")
|
||||||
|
|
||||||
|
|
||||||
# I freaking don't know what this function does anymore
|
# I freaking don't know what this function does anymore
|
||||||
def finalize(new_: list[str], removed_: list[str], db_dirs_: list[str]):
|
def finalize(new_: list[str], removed_: list[str], db_dirs_: list[str]):
|
||||||
"""
|
"""
|
||||||
Params:
|
Params:
|
||||||
|
@ -56,8 +56,8 @@ class HandleArgs:
|
|||||||
value = settings.Keys.get(key)
|
value = settings.Keys.get(key)
|
||||||
|
|
||||||
if not value:
|
if not value:
|
||||||
log.error(f"ERROR: {key} not set in environment")
|
log.error(f"WARNING: {key} not set in environment")
|
||||||
sys.exit(0)
|
#sys.exit(0)
|
||||||
|
|
||||||
lines.append(f'{key} = "{value}"\n')
|
lines.append(f'{key} = "{value}"\n')
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ class Populate:
|
|||||||
|
|
||||||
if has_connection():
|
if has_connection():
|
||||||
try:
|
try:
|
||||||
|
print("Attempting to download similar artists...")
|
||||||
FetchSimilarArtistsLastFM(instance_key)
|
FetchSimilarArtistsLastFM(instance_key)
|
||||||
except PopulateCancelledError as e:
|
except PopulateCancelledError as e:
|
||||||
log.warn(e)
|
log.warn(e)
|
||||||
@ -288,6 +289,7 @@ def save_similar_artists(_map: tuple[str, Artist]):
|
|||||||
instance_key, artist = _map
|
instance_key, artist = _map
|
||||||
|
|
||||||
if POPULATE_KEY != instance_key:
|
if POPULATE_KEY != instance_key:
|
||||||
|
print("Warning: Populate key changed")
|
||||||
raise PopulateCancelledError(
|
raise PopulateCancelledError(
|
||||||
"'FetchSimilarArtistsLastFM': Populate key changed"
|
"'FetchSimilarArtistsLastFM': Populate key changed"
|
||||||
)
|
)
|
||||||
@ -323,6 +325,7 @@ class FetchSimilarArtistsLastFM:
|
|||||||
|
|
||||||
with ThreadPoolExecutor(max_workers=CPU_COUNT) as executor:
|
with ThreadPoolExecutor(max_workers=CPU_COUNT) as executor:
|
||||||
try:
|
try:
|
||||||
|
print("Processing similar artists")
|
||||||
results = list(
|
results = list(
|
||||||
tqdm(
|
tqdm(
|
||||||
executor.map(save_similar_artists, key_artist_map),
|
executor.map(save_similar_artists, key_artist_map),
|
||||||
|
@ -258,7 +258,7 @@ class Keys:
|
|||||||
if not cls.LASTFM_API_KEY:
|
if not cls.LASTFM_API_KEY:
|
||||||
# REVIEW Ideally, this shouldn't be fatal
|
# REVIEW Ideally, this shouldn't be fatal
|
||||||
print("WARNING: LASTFM_API_KEY not set in environment. Experimental API calls will be implemented")
|
print("WARNING: LASTFM_API_KEY not set in environment. Experimental API calls will be implemented")
|
||||||
sys.exit(0)
|
#sys.exit(0)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get(cls, key: str):
|
def get(cls, key: str):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user