2023-05-03 10:19:35 -04:00
#!/bin/sh
file="$(wl-paste)"
directory="$HOME/Music"
case "$file" in
2023-05-04 11:21:53 -04:00
*youtube.com*|*youtu.be*|*bandcamp.com*|*soundcloud.com*)
2023-05-03 10:19:35 -04:00
notify-send "Downloading" "$file"
2023-12-16 17:51:21 -05:00
cd $directory && yt-dlp --embed-metadata --embed-thumbnail -xc -f 'bestaudio[ext=m4a]' "$file" && notify-send "Music added!" "$file is now saved to the music directory."
# --restrict-filenames
# -f bestaudio/best
2023-05-03 10:19:35 -04:00
;;
*mp3|*flac|*opus|*mp3?source*)
notify-send "⏳ Queuing $file..."
cd $directory && curl -LO $file >/dev/null 2>&1 && notify-send "Music added!" "$file is now saved to the music directory." ;;
esac
exit 0