Parcourir la source

Launch the Plex client and mount media at login

Zachary Kotlarek il y a 13 ans
Parent
commit
2fc22c8c98

+ 5 - 0
plexMonitor/launchd/com.uberzach.plexMonitor.gui.plist

@@ -19,6 +19,11 @@
 	<dict>
 		<key>NetworkState</key>
 		<true/>
+		<key>OtherJobEnabled</key>
+		<dict>
+			<key>com.uberzach.plexMonitor</key>
+			<true/>
+		</dict>
 	</dict>
 	<key>ProgramArguments</key>
 	<array>

+ 5 - 0
plexMonitor/launchd/com.uberzach.plexMonitor.playing.plist

@@ -19,6 +19,11 @@
 	<dict>
 		<key>NetworkState</key>
 		<true/>
+		<key>OtherJobEnabled</key>
+		<dict>
+			<key>com.uberzach.plexMonitor</key>
+			<true/>
+		</dict>
 	</dict>
 	<key>ProgramArguments</key>
 	<array>

+ 30 - 0
plexMonitor/launchd/com.uberzach.plexMonitor.plist

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>LimitLoadToSessionType</key>
+	<string>Aqua</string>
+	<key>LimitLoadToHosts</key>
+	<array>
+		<string>Beddy.local</string>
+		<string>beddy.uberzach.com</string>
+		<string>Loki.local</string>
+		<string>loki.uberzach.com</string>
+		<string>Heady.local</string>
+		<string>heady.uberzach.com</string>
+	</array>
+	<key>RunAtLoad</key>
+	<true/>
+	<key>Label</key>
+	<string>com.uberzach.plexMonitor</string>
+	<key>KeepAlive</key>
+	<dict>
+		<key>NetworkState</key>
+		<true/>
+	</dict>
+	<key>ProgramArguments</key>
+	<array>
+		<string>/Users/tv/bin/video/plexMonitor/plexHelper.sh</string>
+	</array>
+</dict>
+</plist>

+ 14 - 0
plexMonitor/plexHelper.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# Wait for the media share to be mounted
+if ! ~/bin/video/isMediaMounted; then
+	~/bin/video/mountMedia
+	sleep 5
+	exit 1
+fi
+
+# Kill previous instances
+killall Plex
+
+# Exec
+exec '/Applications/Zach/Media/Plex.app/Contents/MacOS/Plex'