Skip to content

Commit 12c17f1

Browse files
committed
fix(music-release-tracker): yandex music script
1 parent 76772a2 commit 12c17f1

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.github/workflows/music-release-tracker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build music dict
1+
name: Check music releases
22

33
on:
44
workflow_dispatch:

scripts/music-release-tracker/yandex-music/main.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ def is_exact_match(artist: str, title: str, payload: dict) -> bool:
3737
n_title = norm(title)
3838

3939
for track in tracks:
40-
version = track.get("version") or ""
41-
if version:
42-
continue
4340
if norm(track.get("title", "")) != n_title:
4441
continue
4542
artists = [norm(a.get("name", "")) for a in track.get("artists", [])]
@@ -52,12 +49,19 @@ def is_exact_match(artist: str, title: str, payload: dict) -> bool:
5249

5350
def build_dict(artist: str, tracks: list[str]) -> dict:
5451
result = {"yandex_music": {}}
55-
for title in tracks:
56-
try:
57-
payload = fetch_search(artist, title)
58-
found = is_exact_match(artist, title, payload)
59-
except Exception:
60-
found = False
52+
for idx, title in enumerate(tracks):
53+
payload = fetch_search(artist, title)
54+
tracks_list = (
55+
payload.get("result", {})
56+
.get("tracks", {})
57+
.get("results", [])
58+
)
59+
60+
sys.stderr.write(
61+
f"[yandex] '{title}': got {len(tracks_list)} candidates\n"
62+
)
63+
64+
found = is_exact_match(artist, title, payload)
6165
result["yandex_music"][title] = [1 if found else 0]
6266
return result
6367

0 commit comments

Comments
 (0)