Created
May 15, 2020 18:46
-
-
Save t-buss/37effb4b16006be4780eb02bddf7fe84 to your computer and use it in GitHub Desktop.
mq - mpd queue: Search YouTube for a music video, then add the track to mpd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
QUERY_RESULT=$(mktemp) | |
youtube-dl -J -f140 "ytsearch15:$*" | jq ".entries" > $QUERY_RESULT | |
TITLE=$(jq -r ".[] | .title" $QUERY_RESULT | fzf) | |
LINK=$(jq -r ".[] | |
| select(.title==\"$TITLE\") | |
| .formats | |
| .[] | |
| select(.format==\"140 - audio only (tiny)\") | |
| .url" $QUERY_RESULT) | |
mpc add "$LINK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment