diff options
author | Radostin Stoyanov | 2018-01-03 12:21:48 +0000 |
---|---|---|
committer | Radostin Stoyanov | 2018-01-03 12:21:48 +0000 |
commit | c8ed4efdc7b731388c7f33ad9f79f7476c2fe48d (patch) | |
tree | a5c75026eebf4419fbc09e0fb7e0bf291d3caf2f /youtube-dl-mp3 | |
parent | 1ae7006cc7b461ed8ba995195e866851393978b2 (diff) | |
download | aur-c8ed4efdc7b731388c7f33ad9f79f7476c2fe48d.tar.gz |
Get URL from clipboard if no arguments are given
Use `xclip` to get URL from clipboard
Diffstat (limited to 'youtube-dl-mp3')
-rwxr-xr-x | youtube-dl-mp3 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube-dl-mp3 b/youtube-dl-mp3 index c1f44bfbb8db..6ea53f1f2634 100755 --- a/youtube-dl-mp3 +++ b/youtube-dl-mp3 @@ -1,2 +1,8 @@ #!/bin/bash -youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --ignore-errors -o "%(title)s.%(ext)s" $@ + +# Check if xclip is installed and no argument are passed +if [ -x "$(command -v xclip)" ] && [ "$#" -le 1 ] ; then + youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --ignore-errors -o "%(title)s.%(ext)s" "$(xclip -o)" +else + youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --ignore-errors -o "%(title)s.%(ext)s" $@ +fi |