prevent panic
This commit is contained in:
parent
8672323dcb
commit
fbd3d16d51
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
sleep 1
|
||||
|
||||
if [[ $(cat /tmp/spotify-dl.log) == '' ]]; then
|
||||
kill -9 $(ps -aux | grep "lib/spotify-ripper" | grep -v grep | awk '{print $2}')
|
||||
fi
|
39
api/search
39
api/search
|
@ -7,20 +7,28 @@ echo '<html>
|
|||
<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"
|
||||
|
||||
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)
|
||||
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>
|
||||
<center><h1>$track</center></h1>
|
||||
<h1>$track</center></h1>
|
||||
<br><br><br><br><br><br>
|
||||
<center>
|
||||
<audio id=\"player\" controls>
|
||||
|
@ -33,35 +41,10 @@ if [[ $track ]];then
|
|||
</center>
|
||||
</div>"
|
||||
else
|
||||
echo "<center>No result found</center>"
|
||||
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 "
|
||||
<style>
|
||||
html {
|
||||
background-color: #272727;
|
||||
color: #E6E6E6;
|
||||
}
|
||||
a {
|
||||
color: #E6E6E6;
|
||||
}
|
||||
|
||||
#player {
|
||||
min-width: 250px;
|
||||
width: 40%;
|
||||
}
|
||||
.container-dis {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-moz-transform: translateX(-50%) translateY(-50%);
|
||||
-webkit-transform: translateX(-50%) translateY(-50%);
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
}
|
||||
</style>
|
||||
"
|
||||
|
||||
echo "</html>"
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
echo "
|
||||
<style>
|
||||
html {
|
||||
background-color: #272727;
|
||||
color: #E6E6E6;
|
||||
}
|
||||
a {
|
||||
color: #E6E6E6;
|
||||
}
|
||||
|
||||
#player {
|
||||
min-width: 250px;
|
||||
width: 40%;
|
||||
}
|
||||
.container-dis {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-moz-transform: translateX(-50%) translateY(-50%);
|
||||
-webkit-transform: translateX(-50%) translateY(-50%);
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
}
|
||||
</style>
|
||||
"
|
Loading…
Reference in New Issue