From fe4b526eac032ad9123a4b442bf7fd4d6485036e Mon Sep 17 00:00:00 2001 From: Salt Date: Thu, 13 Jun 2019 07:50:58 -0500 Subject: [PATCH] jptgdp: Add error handling, move music dir to Music --- jptgdp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jptgdp b/jptgdp index a7f58f5..22ab7fa 100755 --- a/jptgdp +++ b/jptgdp @@ -10,7 +10,9 @@ _name="$(basename -- "$0")" _tmpdir="${XDG_CACHE_HOME:-$HOME/.cache}/$_name" _tmpfile="$_tmpdir/tmpfile" -_playlistdir="$_tmpdir"/playlist +_xdguserdirs="${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" +[ -f "$_xdguserdirs" ] && source "$_xdguserdirs" +_playlistdir="${XDG_MUSIC_DIR:-$HOME/Music}/JPTGDP Songs" # Helper functions log() { @@ -87,8 +89,11 @@ playlist() { -o "$_tmpfile.%(ext)s" \ ytsearch:"$line" \ > /dev/null 2>&1 & - wait - mv "$_tmpfile"* "$filename" + if wait $!; then + mv "$_tmpfile"* "$filename" + else + log "No results found for \"$line\"" + fi fi [ -z "$_optdownloadonly" ] && audacious -e "$filename" done < <(if [ -n "$_optshuffle" ]; then shuf "$1"; else cat "$1"; fi)