From c0a4d3e2081359a88ae7799e4a511b1e86ad41fe Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 22 Feb 2024 07:54:23 -0500 Subject: [PATCH] test --- plex-analyze.sh | 11 +++-------- plex-emptytrash.sh | 11 +++-------- plex-freshen.sh | 7 +++++-- plex-refreshmetadata.sh | 5 +++-- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/plex-analyze.sh b/plex-analyze.sh index e87b37a..64ac431 100644 --- a/plex-analyze.sh +++ b/plex-analyze.sh @@ -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 "Analyzing for key: ${library_number}" @@ -33,9 +34,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 diff --git a/plex-emptytrash.sh b/plex-emptytrash.sh index beccd71..6159a5b 100644 --- a/plex-emptytrash.sh +++ b/plex-emptytrash.sh @@ -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 "Emptying Trash for key: ${library_number}" @@ -33,9 +34,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 diff --git a/plex-freshen.sh b/plex-freshen.sh index 798b7de..cb5a859 100644 --- a/plex-freshen.sh +++ b/plex-freshen.sh @@ -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}" @@ -28,8 +29,10 @@ update_from_api() { curl -X PUT http://127.0.0.1:32400/library/sections/${library_number}/emptyTrash\?X-Plex-Token=${LOCAL_PLEX_TOKEN} done + echo "Cleaning Bundles" curl -X PUT http://127.0.0.1:32400/library/clean/bundles?X-Plex-Token=${LOCAL_PLEX_TOKEN} + } case "$2" in diff --git a/plex-refreshmetadata.sh b/plex-refreshmetadata.sh index 4b248ff..2c18af6 100644 --- a/plex-refreshmetadata.sh +++ b/plex-refreshmetadata.sh @@ -1,5 +1,6 @@ #!/bin/sh + update_from_cli() { # ChuckPa already wrote a great function for getting host info source ./HostConfig.sh @@ -22,8 +23,8 @@ update_from_api() { 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} - curl -X PUT "http://127.0.0.1:32400/library/sections/${library_number}/refresh?force=1&X-Plex-Token=${LOCAL_PLEX_TOKEN}" + curl -X GET http://127.0.0.1:32400/library/sections/${library_number}/refresh\?force=1\&X-Plex-Token=${LOCAL_PLEX_TOKEN} + #curl -X PUT "http://127.0.0.1:32400/library/sections/${library_number}/refresh?force=1&X-Plex-Token=${LOCAL_PLEX_TOKEN}" done }