From 8e8382aa882834e7b08fd52147d24dfea5060a85 Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Fri, 24 Apr 2026 14:54:04 +0200 Subject: [PATCH] update --- nicesong | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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