51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "content-type: text/html"
|
|
echo
|
|
echo '<html>
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta name="robots" content="noindex" />
|
|
</head>
|
|
<center>
|
|
'
|
|
source style.css
|
|
|
|
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"
|
|
|
|
if [[ $(ps -aux | grep "lib/spotify-ripper" | grep -v grep | awk '{print $2}') != '' ]]; then
|
|
echo "Service is already in use, please wait"
|
|
exit 1
|
|
fi
|
|
./kill_panic.sh&
|
|
|
|
result=$(timeout 600 ../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 "<div class='container'>
|
|
<br>
|
|
<h1>$track</center></h1>
|
|
<br><br><br><br><br><br>
|
|
<center>
|
|
<audio id=\"player\" controls>
|
|
<source src=\"https://spotify-dl.p2p.legal/play/$result\">
|
|
Your browser does not support the audio element.
|
|
</audio>
|
|
<br><br>
|
|
<h3><a href=\"https://spotify-dl.p2p.legal/dl/$result\">DOWNLOAD</a></h3>
|
|
<br><br>
|
|
</center>
|
|
</div>"
|
|
else
|
|
echo "<center>No result found, please try again.</center>"
|
|
# echo "<meta http-equiv = \"refresh\" content = \" 2 \"/>"
|
|
fi
|
|
|
|
## redirection: echo "<meta http-equiv = \"refresh\" content = \" 0 ; url = https://spotify-dl.p2p.legal/play/$result\"/>"
|
|
|
|
echo "</html>"
|