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