feat: recommend from Deezer and YouTube Music radios
- Deezer: /artist/{id}/radio for collection artists, affinity 2.0
- YouTube Music: RDAMVM watch playlist via yt-dlp, affinity 2.0
- seed radios from the 2 newest songs of the mood's own catalog
- dedupe candidates by recording, not only by external id
- clean raw YouTube titles and Topic suffixes when indexing
- tests, smoke marker for the RDAMVM path, docs
This commit is contained in:
1 parent
62bcefad20
commit
26c41cc7d9
12 files changed
+296
-44
No files matched your search
@@ -60,6 +60,18 @@ for arg in "$@"; do
|
||||
prev="$arg"
|
||||
done
|
||||
|
||||
if [[ " $* " == *"RDAMVM"* ]]; then
|
||||
# YouTube Music's watch-playlist radio: record that it was requested.
|
||||
printf '%s\n' "$*" >> "$(dirname "$0")/../yt-radio.log"
|
||||
cat <<'JSON'
|
||||
{"entries":[
|
||||
{"id":"vid-radio","title":"Radio Artist - Radio Track","duration":210,"channel":"Radio Artist"},
|
||||
{"id":"vid-rec-a","title":"Downloaded Track","artist":"New Artist","album":"New Album","duration":180,"channel":"New Artist"}
|
||||
]}
|
||||
JSON
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ " $* " == *" music.youtube.com/search "* || " $* " == *" --flat-playlist "* ]]; then
|
||||
cat <<'JSON'
|
||||
{"entries":[
|
||||
@@ -417,6 +429,11 @@ log "Recommendations"
|
||||
expect "refresh recommendations" "200" "POST" "/moods/$MOOD_ID/recommendations/refresh"
|
||||
REC_VIDEO="$(printf '%s' "$HTTP_BODY" | python3 -c 'import json,sys;r=json.load(sys.stdin)["recommendations"];print(r[0]["externalId"] if r else "")')"
|
||||
wait_for 90 "recommendations download" 'd["mood"]["recommendationReady"] >= 1' "/moods/$MOOD_ID"
|
||||
if [[ -f "$WORK/yt-radio.log" ]]; then
|
||||
pass "YouTube Music radio discovery"
|
||||
else
|
||||
fail "YouTube Music radio discovery" "no RDAMVM playlist was requested"
|
||||
fi
|
||||
expect "add a recommendation" "200" "POST" "/moods/$MOOD_ID/recommendations/$REC_VIDEO/add"
|
||||
SECOND_REC="$(printf '%s' "$HTTP_BODY" | python3 -c 'import json,sys;r=json.load(sys.stdin)["detail"]["recommendations"];print(r[0]["externalId"] if r else "")')"
|
||||
if [[ -n "$SECOND_REC" ]]; then
|
||||
|
||||
Reference in new issue
Block a user