Shutdown the system from Plex

I’ve tried several mediacenter applications in Mac and the one I prefer is definitively Plex. There are lots of plugins (even for Spotify, if you are premium) and it has a complete integration with Apple Remote (nobody wants to see a movie from his chair).

If you are using Mac and you are looking for a mediacenter application, I would encourage you to give a try on Plex. At the beginning it’s a little complicated to setup everything and to get used to it, but I thing it’s worth it.

If you are running Windows you can try XBMC.

Many times I’ve been watching some episode or a movie from my bed and, when I was falling asleep, I had to get out of the bed to switch off my computer. That’s not very comfortable. So, what I’ve done is creating two scripts called “Plex Shutdown” and “Plex Sleep” that can be executed directly from Plex with my Apple Remote. The scripts have to be edited with the AppleScript Editor and saved to an application.

The code for the shutdown script is quite simple:

do shell script "shutdown -h now"
password "yourpass" with administrator privileges

And the sleep script:

tell application "System Events" 
end tell

Notice that you need to specify the user password to shutdown the computer, and the user has to be administrator. If not, a dialog will appear asking for the password and the script will be useless (remember, you want to sleep 😉 ).

A screenshot of the AppleScript editor and how to save to an application:

The last step is to execute the script from Plex. To run it, you’ll only need to navigate with your Apple Remote to Programs, then select your drive and browse into your Applications folder and select the application.
And even more, if you sleep your computer, you’ll be able to wake it up with the remote control.

That’s all, enjoy your movies!

Reference: Plex Forums

This entry was posted in Scripting and tagged , , . Bookmark the permalink.

2 Responses to Shutdown the system from Plex

  1. Portrait says:

    Que bueno volviste!

    Por cierto, muerte a los snapshots!!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s