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 | |
parent | 1ae7006cc7b461ed8ba995195e866851393978b2 (diff) | |
download | aur-c8ed4efdc7b731388c7f33ad9f79f7476c2fe48d.tar.gz |
Get URL from clipboard if no arguments are given
Use `xclip` to get URL from clipboard
-rw-r--r-- | PKGBUILD | 4 | ||||
-rwxr-xr-x | youtube-dl-mp3 | 8 |
2 files changed, 9 insertions, 3 deletions
@@ -1,8 +1,8 @@ # Maintainer: Radostin Stoyanov <rstoyanov1 at gmail dot com> pkgname=youtube-dl-mp3 -pkgver=2017.04.14 +pkgver=2018.01.03 _appname=youtube-dl-mp3 -_release=2017.04.14 +_release=2018.01.03 pkgrel=1 pkgdesc="Convert YouTube videos in HQ audio with mp3 format." arch=('any') 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 |