misc
This commit is contained in:
parent
0b70d93d47
commit
2a49a92bb2
@ -125,13 +125,13 @@ class LyricSearch(FastAPI):
|
||||
"errorText": f"Unknown request source: {data.src}",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
if data.a == "N/A" and data.s == "N/A":
|
||||
return JSONResponse(
|
||||
status_code=200,
|
||||
content={
|
||||
'test': 'success',
|
||||
}
|
||||
"test": "success",
|
||||
},
|
||||
)
|
||||
|
||||
if not data.t:
|
||||
|
@ -96,9 +96,9 @@ class Misc(FastAPI):
|
||||
"""
|
||||
# Measure response time w/ test lyric search
|
||||
time_start: float = time.time() # Start time for response_time
|
||||
test_lyrics_result = await self.redis_client.ft().search( # noqa: F841
|
||||
test_lyrics_result = await self.redis_client.ft().search( # noqa: F841
|
||||
"@artist: test @song: test"
|
||||
)
|
||||
)
|
||||
time_end: float = time.time()
|
||||
# End response time test
|
||||
total_keys = await self.redis_client.dbsize()
|
||||
|
@ -99,9 +99,13 @@ class LRCLib:
|
||||
if isinstance(result["syncedLyrics"], str)
|
||||
]
|
||||
|
||||
best_match = self.matcher.find_best_match(
|
||||
input_track, possible_matches
|
||||
)[0]
|
||||
try:
|
||||
best_match = self.matcher.find_best_match(
|
||||
input_track, possible_matches
|
||||
)[0]
|
||||
except: # noqa
|
||||
pass
|
||||
|
||||
if not best_match:
|
||||
return
|
||||
best_match_id = best_match[0]
|
||||
|
@ -382,7 +382,8 @@ class RadioUtil:
|
||||
"file_path": r["file_path"],
|
||||
"duration": r["duration"],
|
||||
}
|
||||
for r in results if r not in self.active_playlist
|
||||
for r in results
|
||||
if r not in self.active_playlist
|
||||
]
|
||||
logging.info(
|
||||
"Populated active playlists with %s items",
|
||||
@ -390,13 +391,13 @@ class RadioUtil:
|
||||
)
|
||||
|
||||
random.shuffle(self.active_playlist)
|
||||
|
||||
|
||||
"""Dedupe"""
|
||||
logging.info("Removing duplicate tracks...")
|
||||
dedupe_processed = []
|
||||
for item in self.active_playlist:
|
||||
artistsongabc: str = non_alnum.sub('', item.get('artistsong', None))
|
||||
if not artistsongabc:
|
||||
artistsongabc: str = non_alnum.sub("", item.get("artistsong", None))
|
||||
if not artistsongabc:
|
||||
logging.info("Missing artistsong: %s", item)
|
||||
continue
|
||||
if artistsongabc in dedupe_processed:
|
||||
@ -405,9 +406,13 @@ class RadioUtil:
|
||||
|
||||
logging.info(
|
||||
"Duplicates removed." "New playlist size: %s",
|
||||
len(self.active_playlist))
|
||||
|
||||
logging.info("Playlist: %s", [str(a.get('artistsong', '')) for a in self.active_playlist])
|
||||
len(self.active_playlist),
|
||||
)
|
||||
|
||||
logging.info(
|
||||
"Playlist: %s",
|
||||
[str(a.get("artistsong", "")) for a in self.active_playlist],
|
||||
)
|
||||
|
||||
if self.playback_genres:
|
||||
new_playlist: list[dict] = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user