Jump to content


Photo

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

script emby theater cinema mode

  • Please log in to reply
4 replies to this topic

#1 jdotero OFFLINE  

jdotero

    Member

  • Members
  • 22 posts
  • Local time: 04:08 AM

Posted 02 September 2018 - 02:16 PM

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

 

 

 

 



#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 136138 posts
  • Local time: 05:08 AM

Posted 02 September 2018 - 10:53 PM

Hi, it's not currently possible but it's not a bad idea. Thanks.



#3 jdotero OFFLINE  

jdotero

    Member

  • Members
  • 22 posts
  • Local time: 04:08 AM

Posted 03 September 2018 - 10:53 AM

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!



#4 kgschlosser OFFLINE  

kgschlosser

    Newbie

  • Members
  • 5 posts
  • Local time: 03:08 AM

Posted 04 September 2018 - 06:09 PM

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


  • jdotero likes this

#5 jdotero OFFLINE  

jdotero

    Member

  • Members
  • 22 posts
  • Local time: 04:08 AM

Posted 04 September 2018 - 06:25 PM

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.







Also tagged with one or more of these keywords: script, emby theater, cinema mode

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users