Skip to content

Instantly share code, notes, and snippets.

@badboy
Created January 13, 2018 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badboy/d870a6fb6fe69bed970ad7b06520dba5 to your computer and use it in GitHub Desktop.
Save badboy/d870a6fb6fe69bed970ad7b06520dba5 to your computer and use it in GitHub Desktop.
#!/bin/bash
uri=$(xclip -o -selection clipboard)
notify-send "soundcloud" "Started downloading from URL."
pushd ~/music
bakpl=~/.mpd/playlists/current2.m3u
realpl=~/.mpd/playlists/current.m3u
logfile=/tmp/ytdl-sc.log
date > $logfile
echo "$uri" >> $logfile
youtube-dl "$uri" --exec "mpc update && sleep 2 && mpc add {} && mpc save current2 && mv $bakpl $realpl" &>> $logfile
notify-send "soundcloud" "Added track."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment