This commit is contained in:
deathbybandaid 2024-02-22 07:15:01 -05:00
parent 9f08b6729c
commit df36dd1171
2 changed files with 14 additions and 8 deletions

11
plex-library-ids.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
token_from_api() {
source ./plex-token.sh
LOCAL_LIBRARY_IDS= $(`curl -s -H "Accept: application/json" -H "X-Plex-Token: ${LOCAL_PLEX_TOKEN}" http://127.0.0.1:32400/library/sections | jq -M -r '.MediaContainer.Directory[] | "\(.key)"'`)
}
case "$2" in
""|silent) token_from_Pref_XML;;
*) echo "'$2' is not a valid plex-tools library id command";;
esac

View File

@ -15,10 +15,11 @@ update_from_cli() {
update_from_api() {
# get plex token
source ./plex-token.sh
#source ./plex-token.sh
source ./plex-library-ids.sh
# run a loop against each library
for library_number in `curl -s -H "Accept: application/json" -H "X-Plex-Token: ${LOCAL_PLEX_TOKEN}" http://127.0.0.1:32400/library/sections | jq -M -r '.MediaContainer.Directory[] | "\(.key)"'`
for library_number in LOCAL_LIBRARY_IDS
do
echo "Running Library Update and metadata refresh for key: ${library_number}"
#curl -X PUT http://127.0.0.1:32400/library/sections/${library_number}/refresh\?force=1\&X-Plex-Token=${LOCAL_PLEX_TOKEN}
@ -32,9 +33,3 @@ case "$2" in
""|api) update_from_api;;
*) echo "'$2' is not a valid plex-tools freshen command";;
esac
# clean PhotoTranscoder Cache
#echo "Deleting PhotoTranscoder Cache"
#CACHEPATH="$AppSuppDir/Plex Media Server/Cache/PhotoTranscoder"
#find "${CACHEPATH}" -type f -delete