summaryrefslogtreecommitdiff
path: root/ar/.config/rmpc/scripts/on_song_change
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-02-21 22:58:57 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-02-21 22:58:57 +0900
commit5328e20a7ee864dd28f68df0ced4c3ce3f0fd5c7 (patch)
treed8fc7f75d56d52a6009fcd88733c092551017464 /ar/.config/rmpc/scripts/on_song_change
parent4612b5e3772ced0f1c3d77c425ab6f5fb4c93296 (diff)
modified rmpc/config.ron, modified scripts/on_song_change, modified bin/qndlHEADmaster
Diffstat (limited to 'ar/.config/rmpc/scripts/on_song_change')
-rwxr-xr-xar/.config/rmpc/scripts/on_song_change22
1 files changed, 18 insertions, 4 deletions
diff --git a/ar/.config/rmpc/scripts/on_song_change b/ar/.config/rmpc/scripts/on_song_change
index 64e9047..2899ab8 100755
--- a/ar/.config/rmpc/scripts/on_song_change
+++ b/ar/.config/rmpc/scripts/on_song_change
@@ -75,19 +75,33 @@ LRCLIB_INSTANCE="https://lrclib.net"
if [ "$HAS_LRC" = "false" ]; then
mkdir -p "$(dirname "$LRC_FILE")"
+ # 1) /api/get with artist + title + album (exact match)
LYRICS="$(curl -X GET -sG \
-H "Lrclib-Client: rmpc-$VERSION" \
--data-urlencode "artist_name=$ARTIST" \
--data-urlencode "track_name=$TITLE" \
--data-urlencode "album_name=$ALBUM" \
- "$LRCLIB_INSTANCE/api/get" | jq -r '.syncedLyrics')"
+ "$LRCLIB_INSTANCE/api/get" | jq -r '.syncedLyrics // empty')"
+ # 2) /api/get without album
if [ -z "$LYRICS" ]; then
- rmpc remote --pid "$PID" status "Failed to download lyrics for $ARTIST - $TITLE" --level error
- exit
+ LYRICS="$(curl -X GET -sG \
+ -H "Lrclib-Client: rmpc-$VERSION" \
+ --data-urlencode "artist_name=$ARTIST" \
+ --data-urlencode "track_name=$TITLE" \
+ "$LRCLIB_INSTANCE/api/get" | jq -r '.syncedLyrics // empty')"
fi
- if [ "$LYRICS" = "null" ]; then
+ # 3) /api/search (fuzzy fallback)
+ if [ -z "$LYRICS" ]; then
+ LYRICS="$(curl -X GET -sG \
+ -H "Lrclib-Client: rmpc-$VERSION" \
+ --data-urlencode "artist_name=$ARTIST" \
+ --data-urlencode "track_name=$TITLE" \
+ "$LRCLIB_INSTANCE/api/search" | jq -r '.[0].syncedLyrics // empty')"
+ fi
+
+ if [ -z "$LYRICS" ]; then
rmpc remote --pid "$PID" status "Lyrics for $ARTIST - $TITLE not found" --level warn
exit
fi