commit 0a178c02c1fce7f42bce5e04805c7122e5960068 parent 8f4def470950cba5272e460cd68c6af671c125f2 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Fri, 29 May 2020 09:24:11 +0200 Allow passing URLs as stdin Diffstat:
M | .local/bin/youtube-dl-music | | | 11 | ++++++----- |
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/.local/bin/youtube-dl-music b/.local/bin/youtube-dl-music @@ -11,9 +11,9 @@ die() { } show_help() { - printf 'usage: %s [OPTIONS] URL\n' "${0##*/}" - echo "downloads music from the web and tags it." - echo "Playlists are supported." + printf 'usage: %s [OPTIONS] [URL ..]\n' "${0##*/}" + echo "downloads music from the web and tags it. Playlists are supported." + echo "If no URLs are supplied as arguments, they are expected as stdin." echo echo "OPTIONS are one or more of the following:" echo " -a add metadata without interaction" @@ -152,8 +152,9 @@ while :; do done if [ $# -lt 1 ]; then - show_help - exit 1 + urls="$(cat)" +else + urls="$@" fi for u in "$@"; do