From 4803d9bf78dada0e4fe4f7602ce042422d55fc3c Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 5 Jul 2019 01:03:08 -0700 Subject: [PATCH] updated to posix compliance --- ytdl | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/ytdl b/ytdl index e5de5da..2c28b82 100755 --- a/ytdl +++ b/ytdl @@ -1,8 +1,18 @@ -#!/bin/bash -dir=$(find ~/Music/ -maxdepth 1 -type d | dmenu -i -p "Pick a directory") -url="$(echo '' | dmenu -p 'Enter a url')" -[ -z "$url" ] && exit 0 -youtube-dl --extract-audio \ +#!/bin/sh +dir=`for d in ~/Music/*;do + if [ -d "$d" ] + then + basename "$d" + fi +done | dmenu -i -l 10 -p 'Pick a directory'` +echo ~/Music/$dir +if [ -z "$dir" ]; then exit; fi + +url=`echo '' | dmenu -p 'Enter a url'` +if [ -z "$url" ]; then exit; fi + +# youtube-dl constantly breaks so --verbose is here for your pleasure +youtube-dl --extract-audio --verbose \ --audio-format mp3 \ - -o "$dir/%(title)s.%(ext)s" \ - $url + -o "~/Music/$dir/%(title)s.%(ext)s" \ + "$url"