diff --git a/nicesong b/nicesong index 5c70e2c..4f178ef 100755 --- a/nicesong +++ b/nicesong @@ -1,3 +1,29 @@ #!/bin/sh -yt-dlp --embed-metadata -x --audio-format aac -f bestaudio "ytsearch:$(playerctl -i firefox metadata --format '{{ artist }} - {{ title }}')" -o "~/Music/%(artist)s - %(title)s.%(ext)s" +query="$(playerctl -i firefox metadata --format '{{ artist }} - {{ title }}')" + +echo "Searching YouTube for:" +echo " $query" +echo + +yt-dlp "ytsearch1:$query" \ + --print "━━━━━━━━━━━━━━━━━━━━━━━" \ + --print "Title: %(title)s" \ + --print "Artist: %(artist|Unknown)s" \ + --print "Track: %(track|Unknown)s" \ + --print "Channel: %(uploader)s" \ + --print "Duration: %(duration_string)s" \ + --print "Views: %(view_count)s" \ + --print "URL: %(webpage_url)s" \ + --print "━━━━━━━━━━━━━━━━━━━━━━━" + +echo +read -p "Download this? [y/N] " confirm + +if [[ "$confirm" =~ ^[Yy]$ ]]; then + yt-dlp --embed-metadata -x --audio-format aac -f bestaudio \ + "ytsearch1:$query" \ + -o "~/Music/%(artist)s - %(title)s.%(ext)s" +else + echo "Aborted. You resisted entropy." +fi