From 7d7ef672e844851a35be99f954d2b0a666838fcb Mon Sep 17 00:00:00 2001 From: taylorbourne Date: Tue, 30 Nov 2021 12:09:33 -0800 Subject: [PATCH] fix: attemping to fix plex update again (#75) --- root/cronjob.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/root/cronjob.sh b/root/cronjob.sh index 150277c..431b00c 100755 --- a/root/cronjob.sh +++ b/root/cronjob.sh @@ -88,11 +88,11 @@ sleep 1 if [ "$use_xTeveAPI" = "yes" ]; then echo "Updating xTeVe..." curl -s -X POST -d '{"cmd":"update.m3u"}' http://127.0.0.1:$XTEVE_PORT/api/ + # sleep 1 + curl -s -X POST -d '{"cmd":"update.xmltv"}' http://$127.0.0.1:$XTEVE_PORT/api/ sleep 1 - curl -s -X POST -d '{"cmd":"update.xmltv"}' http://127.0.0.1:$XTEVE_PORT/api/ - sleep 1 - curl -s -X POST -d '{"cmd":"update.xepg"}' http://127.0.0.1:$XTEVE_PORT/api/ - sleep 1 + curl -s -X POST -d '{"cmd":"update.xepg"}' http://$127.0.0.1:$XTEVE_PORT/api/ + sleep 30 fi # update Emby via API @@ -108,11 +108,19 @@ fi # update Plex via API if [ "$use_plexAPI" = "yes" ]; then + + # get protocol + proto="$(echo $plexUpdateURL | grep :// | sed -e's,^\(.*://\).*,\1,g')" + # remove the protocol + url="$(echo ${plexUpdateURL/$proto/})" + # extract the host + plexHostPort="$(echo ${url/} | cut -d/ -f1)" + echo "Updating Plex..." if [ -z "$plexUpdateURL" ]; then echo "no Plex credentials provided" else - curl -s -X POST "$plexUpdateURL" + curl --location --request POST "$plexUpdateURL" -H "authority: $plexHostPort" -H "content-length: 0" -H "pragma: no-cache" -H "cache-control: no-cache" -H "sec-ch-ua: 'Google Chrome';v='95', 'Chromium';v='95', ';Not A Brand';v='99'" -H "accept: text/plain, */*; q=0.01" -H "x-requested-with: XMLHttpRequest" -H "accept-language: en" -H "sec-ch-ua-mobile: ?0" -H "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36" -H "sec-ch-ua-platform: 'macOS'" -H "origin: http://$plexHostPort" -H "sec-fetch-site: same-origin" -H "sec-fetch-mode: cors" -H "sec-fetch-dest: empty" -H "referer: http://$plexHostPort/web/index.html" sleep 1 fi fi