Jump to content

Run custom script (e.g. python, perl, etc.) when using Emby Theater


jdotero

Recommended Posts

Hello,

 

Is there a way to run a custom script when using emby theater / cinema mode?  In short, I would like the script to dim my lights (run an Insteon scene) when using emby theater and when the main feature beings.  Ideally the script would allow the "previews" to first play, then the "custom intro", then the script executes as the main feature starts.

 

1) Cinema Mode Trailers (x2) <-- do nothing; wait

2) Custom Intro trailer (x1) <-- do nothing; wait

3) Main Feature <-- execute script

 

Ideally emby would also be able to pass some environmental information (i.e. connected client and device) to the script when it is called. For example, I would only want this script to run iff user == x  && client == y.  (I don't need the lights to dim [or turn on] if I am watching from my laptop remotely or in a different room.)

 

Writing the python or perl script would be quite trivial as I already know how to interface that with my home lighting system.  I just want theater mode / cinema mode to trigger that script and pass the proper variables at the correct time (after trailers and custom intro, but before main feature.)

 

A current workaround may be to use prowl (or some other message server) and watch for events.  If the events are detailed enough, I can pattern to find the client and device, and match do detect when the the main feature starts and then execute the python script, but this is not as elegant as it may take a different machine to watch the events. 

 

Any pointers or thoughts anyone may be able to give would be most appreciated.

 

Cheers,

Jose

 

 

 

 

Link to comment
Share on other sites

Cool.  I'd really like to see this option.  If you want to pursue this, I can tell you more about what I envision and help beta test it.  Not sure what environment you program in, but one could imagine just a few lines of code.  (system or exec call referencing the script in the web interface; maybe fork at the same time the main feature starts to play). 

 

Either way keep up the good work.  Really enjoying emby!

Link to comment
Share on other sites

kgschlosser

All of the above is possible.

 

I am almost done writing a plugin for a piece of software called EventGhost. It is capable of doing all of the things you mentioned very easily. and it interfaces with Emby. It is going to give you the ability to control just about every aspect of Emby and also get various state changes. Emby does have a websocket connection that notifications are sent through for things like. Play.. pause and stop.. The only thing i do not think We will be able to determine is what mode Emby is in, this is because I do not think this information is available from the backend. Now there are other aspects we can leverage. EventGhost is a windows based program. and if you are running your HTPC on a windows based machine we can check to see if Emby is currently full screen. I do not know if that would be good enough in determining if Emby is running in Cinema mode or not.

 

http://eventghost.net

  • Like 1
Link to comment
Share on other sites

This sounds cool.  Unfortunately I am running my emby server on a debian machine so what you say likely won't work for me.  But if it is ever ported to Linux, I will try it out.  I am starting to play around with the emby API.  I don't have much experience with it yet, but I maybe able to figure something out on this side as well.  Won't be elegant but may be able to figure out something.  Keep up the good work.  Even though I don't run Windows, I will be sure to look at it when released.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...