Created
October 16, 2024 19:05
-
-
Save EldonMcGuinness/4ccbd011a6eb1252961fe08dc4551fd9 to your computer and use it in GitHub Desktop.
Manage TV Schedule for Kids
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TOKEN="YOUR_SECRET_KEY" | |
LUKAH=USERID1 | |
MICAH=USERID2 | |
NAME="" | |
LOG=/var/log/tvfilter.log | |
function datestamp { | |
echo $(date +'%Y/%m/%d %H:%M') | |
} | |
plex_call () { | |
echo "[$(datestamp)] Filter: [$1|$2]" | tee -a $LOG | |
curl -X PUT \ | |
-d "filterTelevision=label%3D$1" \ | |
-d "filterMovies=label%3D$1" \ | |
-d "X-Plex-Token=$TOKEN" \ | |
https://plex.tv/api/users/$2 | |
echo "[$(datestamp)] Call Result: [$?]" | tee -a $LOG | |
} | |
case $2 in | |
micah) | |
NAME=$MICAH | |
;; | |
MICAH) | |
NAME=$MICAH | |
;; | |
lukah) | |
NAME=$LUKAH | |
;; | |
LUKAH) | |
NAME=$LUKAH | |
;; | |
esac | |
if [ "$1" == "edu-basic" ]; then | |
LABEL="Youth-Educational-Basic" | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
fi | |
if [ "$1" == "all" ]; then | |
LABEL="Youth" | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
elif [ "$1" == "sleep" ]; then | |
LABEL="Youth-Bedtime" | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
elif [ "$1" == "edu" ]; then | |
LABEL="Youth-Educational" | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
plex_call "$LABEL" $NAME | |
sleep 5; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment