Skip to content

Commit

Permalink
Merge pull request #48 from jmaximusix/bugfix/46
Browse files Browse the repository at this point in the history
Use best match instead of first synced lyrics. Resolves #46
  • Loading branch information
moehmeni authored Jun 12, 2024
2 parents e82d6ec + e2c57e7 commit d83d30d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions syncedlyrics/providers/lrclib.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def get_lrc(self, search_term: str) -> Optional[Lyrics]:
tracks = sort_results(
tracks, search_term, lambda t: f'{t["artistName"]} - {t["trackName"]}'
)
# _id = str(tracks[0]["id"])
_id = str(tracks[0]["id"])
# Getting the first track that its `syncedLyrics` is not empty
_id = None
for track in tracks:
if (track.get("syncedLyrics", "") or "").strip():
_id = str(track["id"])
break
if not _id:
return None
# _id = None
# for track in tracks:
# if (track.get("syncedLyrics", "") or "").strip():
# _id = str(track["id"])
# break
# if not _id:
# return None
return self.get_lrc_by_id(_id)

0 comments on commit d83d30d

Please sign in to comment.