فهرست منبع

Deal with auth

Zachary Kotlarek 11 سال پیش
والد
کامیت
342cf43b54
2فایلهای تغییر یافته به همراه12 افزوده شده و 12 حذف شده
  1. 8 1
      pms/PMSCheck.sh
  2. 4 11
      pms/com.uberzach.PMS.check.plist

+ 8 - 1
pms/PMSCheck.sh

@@ -3,7 +3,6 @@
 # Config
 CURL_TIMEOUT=15
 RESTART_DELAY=600
-PMS_URL="http://127.0.0.1:32400/"
 UNWATCHED_SECTION="2"
 UNWATCHED_SLEEP=60
 UNWATCHED_RETRIES=5
@@ -11,6 +10,14 @@ MIN_UNWATCHED_COUNT=10
 MAX_VSIZE=$(( 10 * 1024 * 1024 )) # 10 GB in kB
 ADMIN_EMAIL="zach@kotlarek.com"
 
+# Construct a URL from the envrionment
+if [ -z "${PMS_URL}" ]; then
+	PMS_URL="http://127.0.0.1:32400/"
+fi
+if [ -n "${PMS_TOKEN}" ]; then
+	PMS_URL="${PMS_URL}?X-Plex-Token=${PMS_TOKEN}"
+fi
+
 # Heady allows 0 unwatched
 if hostname | grep -qi heady; then
 	MIN_UNWATCHED_COUNT=0

+ 4 - 11
pms/com.uberzach.PMS.check.plist

@@ -4,23 +4,16 @@
 <dict>
 	<key>LimitLoadToSessionType</key>
 	<string>Aqua</string>
-	<key>LimitLoadToHosts</key>
-	<array>
-		<string>Beddy.local</string>
-		<string>beddy.uberzach.com</string>
-		<string>Heady.local</string>
-		<string>heady.uberzach.com</string>
-		<string>Baldwin.local</string>
-		<string>baldwin.uberzach.com</string>
-	</array>
 	<key>RunAtLoad</key>
 	<true/>
 	<key>Label</key>
 	<string>com.uberzach.PMS.check</string>
 	<key>KeepAlive</key>
+	<true/>
+	<key>EnvironmentVariables</key>
 	<dict>
-		<key>NetworkState</key>
-		<true/>
+		<key>PMS_TOKEN</key>
+		<string>foo</string>
 	</dict>
 	<key>ProgramArguments</key>
 	<array>