25 lines
852 B
Bash
25 lines
852 B
Bash
#!/bin/sh
|
|
|
|
# get plex token
|
|
source ./plex-token.sh
|
|
|
|
# run a loop against each library
|
|
for library_number in `curl -s -H "Accept: application/json" -H "X-Plex-Token: ${TOKEN}" http://127.0.0.1:32400/library/sections | jq -M -r '.MediaContainer.Directory[] | "\(.key)"'`
|
|
do
|
|
|
|
echo "[DEBUG PLEX] Running Library Update for key: ${library_number}"
|
|
curl -X PUT http://127.0.0.1:32400/library/sections/${library_number}/refresh\?force=1\&X-Plex-Token=${TOKEN}
|
|
|
|
# adding 30 sec sleep
|
|
sleep 30
|
|
|
|
echo "[DEBUG PLEX] Emptying Trash for key: ${library_number}"
|
|
curl -X PUT http://127.0.0.1:32400/library/sections/${library_number}/emptyTrash\?X-Plex-Token=${TOKEN}
|
|
|
|
done
|
|
|
|
# clean PhotoTranscoder Cache
|
|
echo "[DEBUG PLEX] Deleting PhotoTranscoder Cache"
|
|
CACHEPATH="$AppSuppDir/Plex Media Server/Cache/PhotoTranscoder"
|
|
find "${CACHEPATH}" -type f -delete
|