Skip to content

Commit

Permalink
Format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
moehmeni committed Mar 8, 2024
1 parent 0e99113 commit ecfec8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions syncedlyrics/providers/musixmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Musixmatch(LRCProvider):

ROOT_URL = "https://apic-desktop.musixmatch.com/ws/1.1/"

def __init__(self, lang : Optional[str] = None) -> None:
def __init__(self, lang: Optional[str] = None) -> None:
super().__init__()
self.lang = lang
self.token = None
Expand Down Expand Up @@ -83,7 +83,10 @@ def get_lrc_by_id(self, track_id: str) -> Optional[str]:
lrc = body["subtitle"]["subtitle_body"]
if self.lang is not None and body_tr:
for i in body_tr["translations_list"]:
org, tr = i["translation"]["subtitle_matched_line"], i["translation"]["description"]
org, tr = (
i["translation"]["subtitle_matched_line"],
i["translation"]["description"],
)
lrc = lrc.replace(org, org + "\n" + f"({tr})")
return lrc

Expand Down
6 changes: 5 additions & 1 deletion syncedlyrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ def get_best_match(
results = sort_results(results, search_term, compare_key=compare_key)
best_match = results[0]

value_to_compare = best_match[compare_key] if isinstance(compare_key, str) else compare_key(best_match)
value_to_compare = (
best_match[compare_key]
if isinstance(compare_key, str)
else compare_key(best_match)
)
if not str_same(value_to_compare, search_term, n=min_score):
return None
return best_match

0 comments on commit ecfec8b

Please sign in to comment.