From b0a8170a05ce4d58d5862047206265e9cf5a833f Mon Sep 17 00:00:00 2001 From: Chris McKeever Date: Sat, 31 Dec 2022 11:40:42 -0600 Subject: [PATCH] omit downloads fix success code config handling config config --- .gitignore | 2 ++ config.example.sh | 7 +++++++ fetch.sh | 18 ++++++++++++++++++ main.py | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 config.example.sh create mode 100755 fetch.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..edfb6e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*/ +config.sh \ No newline at end of file diff --git a/config.example.sh b/config.example.sh new file mode 100644 index 0000000..22f2ba5 --- /dev/null +++ b/config.example.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export PLEXPASS='PLEXPASSWORD' \ +export PLEXUSER="PLEXUSER" + + +LIST="" \ No newline at end of file diff --git a/fetch.sh b/fetch.sh new file mode 100755 index 0000000..bf215c4 --- /dev/null +++ b/fetch.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +source config.sh + +IFSO=$IFS +IFS=$'\n' + +open . + +source env/bin/activate +for url in $LIST +do + echo "Fetching ${url: -20}" + python3 main.py -u ${PLEXUSER} -p ${PLEXPASS} $url +done +deactivate + +IFS=$IFSO diff --git a/main.py b/main.py index 8e1dca2..ad6453c 100644 --- a/main.py +++ b/main.py @@ -41,7 +41,7 @@ def login(self): r = requests.post("https://plex.tv/users/sign_in.json", headers=self.headers, data=payload) - if r.status_code != 200: + if r.status_code != 201: print(r.json()["error"]) quit(1)