From cdf9fd740ee5e77b567cd469a8d92ecca1949e4e Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 22 Feb 2024 08:12:34 -0500 Subject: [PATCH] test --- plex-analyze.sh | 2 +- plex-emptytrash.sh | 8 +++++--- plex-freshen.sh | 2 +- plex-library-ids.sh | 3 ++- plex-refreshmetadata.sh | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plex-analyze.sh b/plex-analyze.sh index 78d9cc3..d4233a9 100644 --- a/plex-analyze.sh +++ b/plex-analyze.sh @@ -19,7 +19,7 @@ update_from_api() { source ./plex-library-ids.sh # run a loop against each library - for library_number in $LOCAL_LIBRARY_IDS + for library_number in $LOCAL_LIBRARIES_IDS do echo "Analyzing for key: ${library_number}" diff --git a/plex-emptytrash.sh b/plex-emptytrash.sh index dfb5598..d7532d9 100644 --- a/plex-emptytrash.sh +++ b/plex-emptytrash.sh @@ -19,11 +19,13 @@ update_from_api() { source ./plex-library-ids.sh # run a loop against each library - for library_number in $LOCAL_LIBRARY_IDS + for i in "${!LOCAL_LIBRARIES_[@]}" do + library_id="${LOCAL_LIBRARIES_IDS[i]}" + library_title="${LOCAL_LIBRARIES_TITLES[i]}" - echo "Emptying Trash for key: ${library_number}" - curl -X GET http://127.0.0.1:32400/library/sections/${library_number}/emptyTrash\?X-Plex-Token=${LOCAL_PLEX_TOKEN} + echo "Emptying Trash for Library: ${library_id} ${library_title}" + curl -X GET http://127.0.0.1:32400/library/sections/${library_id}/emptyTrash\?X-Plex-Token=${LOCAL_PLEX_TOKEN} done diff --git a/plex-freshen.sh b/plex-freshen.sh index 979a701..a109ab2 100644 --- a/plex-freshen.sh +++ b/plex-freshen.sh @@ -19,7 +19,7 @@ update_from_api() { source ./plex-library-ids.sh # run a loop against each library - for library_number in $LOCAL_LIBRARY_IDS + for library_number in $LOCAL_LIBRARIES_ID do echo "Running Library Update and metadata refresh for key: ${library_number}" diff --git a/plex-library-ids.sh b/plex-library-ids.sh index d7a4bb1..86aea1e 100644 --- a/plex-library-ids.sh +++ b/plex-library-ids.sh @@ -3,7 +3,8 @@ ids_from_api() { source ./plex-token.sh echo "Getting Plex Library list" - 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)"'` + LOCAL_LIBRARIES_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)"'` + LOCAL_LIBRARIES_TITLES=`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[] | "\(.title)"'` } case "$2" in diff --git a/plex-refreshmetadata.sh b/plex-refreshmetadata.sh index 04f6231..ab94432 100644 --- a/plex-refreshmetadata.sh +++ b/plex-refreshmetadata.sh @@ -20,7 +20,7 @@ update_from_api() { source ./plex-library-ids.sh # run a loop against each library - for library_number in $LOCAL_LIBRARY_IDS + for library_number in $LOCAL_LIBRARIES_ID do echo "Running Library Update and metadata refresh for key: ${library_number}" curl -X GET http://127.0.0.1:32400/library/sections/${library_number}/refresh\?force=1\&X-Plex-Token=${LOCAL_PLEX_TOKEN}