auto-update deemix plugin with AUTOCONFIG
This commit is contained in:
parent
6a19f12f56
commit
e1f4910276
|
@ -76,14 +76,22 @@ apiKey="$(curl \
|
||||||
$url/initialize.js |
|
$url/initialize.js |
|
||||||
sed -n "s/apiKey: '\(.*\)'.*/\1/p")"
|
sed -n "s/apiKey: '\(.*\)'.*/\1/p")"
|
||||||
|
|
||||||
if ! isPresent $urlPlugin "system/plugins"; then
|
plugin=$(apiCall "GET" "system/plugins" | jq '.[]|select(.name=="Deemix")')
|
||||||
echo "[autoconfig] Installing plugin"
|
|
||||||
|
if [ -z "$plugin" ] || [ "$(echo "$plugin" | jq .updateAvailable)" = "true" ]; then
|
||||||
|
echo "[autoconfig] Installing / Updating Deemix plugin"
|
||||||
githubRate=$(curl -s https://api.github.com/rate_limit | jq .rate)
|
githubRate=$(curl -s https://api.github.com/rate_limit | jq .rate)
|
||||||
if [ "$(echo "$githubRate" | jq .remaining)" = "60" ]; then
|
if [ "$(echo "$githubRate" | jq .remaining)" = "60" ]; then
|
||||||
echo "[autoconfig] Waiting github rate limit reset"
|
echo "[autoconfig] Waiting github rate limit reset"
|
||||||
sleep $(( $(echo "$githubRate" | jq .reset) - $(date +%s) + 5 ))
|
sleep $(( $(echo "$githubRate" | jq .reset) - $(date +%s) + 5 ))
|
||||||
fi
|
fi
|
||||||
apiCall "POST" "command" '{"name":"InstallPlugin","githubUrl":"'$urlPlugin'"}'
|
apiCall "POST" "command" '{"name":"InstallPlugin","githubUrl":"'$urlPlugin'"}'
|
||||||
|
|
||||||
|
while "$(apiCall "GET" "system/plugins" | jq '.[]|select(.name=="Deemix").updateAvailable')" -eq "true"; do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
echo "[autoconfig] Stopping"
|
||||||
|
/run/s6/basedir/bin/halt
|
||||||
fi
|
fi
|
||||||
if ! isPresent "path" "rootFolder"; then
|
if ! isPresent "path" "rootFolder"; then
|
||||||
echo "[autoconfig] Setting /music rootFolder"
|
echo "[autoconfig] Setting /music rootFolder"
|
||||||
|
|
Loading…
Reference in New Issue