From ae55cb3ce33913ef8a7954d5ccc39af94abd4166 Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 13 Sep 2019 21:13:48 -0500 Subject: [PATCH] ptgdp: More default-search fixes, change sanitization location --- ptgdp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ptgdp b/ptgdp index d860607..073a61f 100755 --- a/ptgdp +++ b/ptgdp @@ -55,12 +55,14 @@ checkforsong() { [ -z "$1" ] && return 1 # Very rudimentary implementation # TODO: Make this a lot more thorough, maybe ensure MIME is good - for file in "$_ptgdpmusicdir/$1"*; do + sanitize "$1" + for file in "$_ptgdpmusicdir/$_return"*; do if [ -f "$file" ]; then _return="$file" return 0 fi done + unset _return return 1 } cachesong() { @@ -107,10 +109,11 @@ cachesong() { else output="$( youtube-dl \ + --default-search "ytsearch:" \ --get-title \ --geo-bypass \ --playlist-items 1 \ - ytsearch:"$1" 2>&1 + "$1" 2>&1 )" exitcode="$?" if [ $exitcode -gt 0 ]; then @@ -225,7 +228,7 @@ validateplaylistenv() { } sanitize() { [ -z "$1" ] && return 1 # String to strip special chars from - _return="${1//[^ a-zA-Z0-9\[\]|()_-]/}" + _return="${1//[^ a-zA-Z0-9\[\]|()_-:]/}" } # Traps