plex-tools/plex-library-ids.sh
deathbybandaid cdf9fd740e test
2024-02-22 08:12:34 -05:00

14 lines
600 B
Bash

#!/bin/bash
ids_from_api() {
source ./plex-token.sh
echo "Getting Plex Library list"
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
""|silent) ids_from_api;;
*) echo "'$2' is not a valid plex-tools library id command";;
esac