From c75a62db4c435f761a10f466fda9c0516efaa8dd Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 22 Feb 2024 08:49:11 -0500 Subject: [PATCH] test --- plex-scan.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 plex-scan.sh diff --git a/plex-scan.sh b/plex-scan.sh new file mode 100644 index 0000000..50da20a --- /dev/null +++ b/plex-scan.sh @@ -0,0 +1,30 @@ +#!/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 + + echo "Scanning All Libraries" + plex_api_url="http://127.0.0.1:32400/library/sections/all/refresh\?X-Plex-Token=${LOCAL_PLEX_TOKEN}" + curl -X PUT $plex_api_url + +} + +case "$2" in + cli) update_from_cli;; + ""|api) update_from_api;; + *) echo "'$2' is not a valid plex-tools freshen command";; +esac