This commit is contained in:
deathbybandaid 2023-03-16 09:44:00 -04:00
parent a0d56c6ec0
commit 7fb28c1860
2 changed files with 42 additions and 0 deletions

41
plex-analyze.sh Normal file
View File

@ -0,0 +1,41 @@
#!/bin/sh
update_from_cli() {
# ChuckPa already wrote a great function for getting host info
source ./HostConfig.sh
echo "Getting Host Information"
HostConfig
plex_scanner_location="$PKGDIR/Plex Media Scanner"
echo "Getting Plex Library list"
echo $("$plex_scanner_location" --list)
exit
}
update_from_api() {
# 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: ${LOCAL_PLEX_TOKEN}" http://127.0.0.1:32400/library/sections | jq -M -r '.MediaContainer.Directory[] | "\(.key)"'`
do
echo "Analyzing for key: ${library_number}"
curl -X PUT http://127.0.0.1:32400/library/sections/${library_number}/analyze\?X-Plex-Token=${LOCAL_PLEX_TOKEN}
done
}
case "$2" in
cli) update_from_cli;;
""|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

View File

@ -6,6 +6,7 @@ case "$1" in
token) source ./plex-token.sh;; token) source ./plex-token.sh;;
freshen) source ./plex-freshen.sh;; freshen) source ./plex-freshen.sh;;
trash) source ./plex-emptytrash.sh;; trash) source ./plex-emptytrash.sh;;
analyze) source ./plex-analyze.sh;;
bundles) source ./plex-cleanbundles.sh;; bundles) source ./plex-cleanbundles.sh;;
metadata) source ./plex-refreshmetadata.sh;; metadata) source ./plex-refreshmetadata.sh;;
claim) source ./claimpms.sh;; claim) source ./claimpms.sh;;