diff --git a/api/search b/api/search new file mode 100755 index 0000000..b6c4528 --- /dev/null +++ b/api/search @@ -0,0 +1,62 @@ +#!/bin/bash + +echo "content-type: text/html" +echo +echo "" + +args=$(echo "$SP_TRACK" | awk -F? '{print $2}' | sed 's/%20/ /g') + +#session_id=$(echo $RANDOM | md5sum | head -c 20; echo) +log_file="/tmp/spotify-dl.log" + +result=$(../spotify-dl.sh "$args" | tee $log_file 2>&1 | grep "/var/www/spotify-dl/" | grep -v "Format String:" | awk -F/ '{print $NF}' | rev | cut -c6- | rev | head -n1) +track=$(echo "$result" | awk -F '.mp3' '{print $1}') + +if [[ $track ]];then + echo "