Kodi Community Forum
[RELEASE] Cinema Experience - the new Home Theater Experience Script - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: [RELEASE] Cinema Experience - the new Home Theater Experience Script (/showthread.php?tid=87563)



- aussieburger - 2011-05-04

Wish I knew how I managed to get it working again exactly to help everyone out. My latest theory on what might have fixed it for me, if someone wanted to try, was pressing the 'Defaults' button in the cinema movie experience settings then configuring it all again from scratch, then restarting XBMC.

My guess why this might work is some of the newer cinema experience settings not being set properly with the normal update so by setting back to default they are set correctly?

Almost wish mine wasn't working again so I could figure it out (I've done a lot of software bug testing for work, so disapointed I couldn't figure out the exact way to fix ...)

EDIT: actually I did manage to break it again somehow by looking into the Cimena Experience settings. So I tried what I wrote above and it worked again! (the restart of XBMC being needed, it did not work when I tried without the restart).

PS: I'm using the confluence skin with a custom Cinema Experience button in the movie info - no trivia, one random intro movie vid, one coming soon vid, two streamed trailers from apple (newest), no ratings vid, one feature presentation vid, one random audio vid, all other settings defaults


- giftie - 2011-05-05

markimark Wrote:Hi giftie,

thanks for the info. I am moving forward to fix the situation to keep the "old" performance as best as I can.

I donĀ“t like the download trailer thing so much because of the trivia it will need and it would be still unsure if the trivia always is enough to cover the download time.

Granted... it does require some time, though if you set it up to download two trailers, it will still download them. Then if it does not finish them(ie no trivia) it will not play them, until the next round time around(still set to download) I know it's not the best solution for you.

Quote:I set up my personal intro plus a feature presentation that is linked to a trailer folder to random chose 2 trailers from.

You don't have to have your trailers in the feature presentation intro. If you set the trailer option to 'Local Folder' and point it to that folder it will pull from those trailers.


Quote:What I would like to ask you is, do know a good way for me to download those trailers in a format your script can use? I have no clou at all where and how to get those trailers from. Can you help me?

There are a couple of programs now, The one I think is the best is HD-Trailer.Net Downloader which ijourneaux(on HD-Trailer.net Downloader side) and I(on Cinema Experience side) worked together to get really good trailer integration(Thumbnails, proper NFO's) Check it out....

There is also BR Movie Tool though I haven't tried it yet and I am a little doubtful if it produces NFO files..

Quote:Cheers.



- giftie - 2011-05-05

aussieburger Wrote:Wish I knew how I managed to get it working again exactly to help everyone out. My latest theory on what might have fixed it for me, if someone wanted to try, was pressing the 'Defaults' button in the cinema movie experience settings then configuring it all again from scratch, then restarting XBMC.

My guess why this might work is some of the newer cinema experience settings not being set properly with the normal update so by setting back to default they are set correctly?

Almost wish mine wasn't working again so I could figure it out (I've done a lot of software bug testing for work, so disapointed I couldn't figure out the exact way to fix ...)

EDIT: actually I did manage to break it again somehow by looking into the Cimena Experience settings. So I tried what I wrote above and it worked again! (the restart of XBMC being needed, it did not work when I tried without the restart).

PS: I'm using the confluence skin with a custom Cinema Experience button in the movie info - no trivia, one random intro movie vid, one coming soon vid, two streamed trailers from apple (newest), no ratings vid, one feature presentation vid, one random audio vid, all other settings defaults

Way to go... Now break it again Smile lol.. Though I can't see how this could fix it, I've been fooled before.. The other strange thing is how consistent it is on Windows, but not really consistent on Linux(I have mine to test) We all have different networks, even different OSes(a few on Win7, one on Win XP, me on Linux) I would like to know what really is causing the hang up/ crash(which is what my system does when it gets the error)

I think I need more debugging tools on my Linux Box.. :S


- loggio - 2011-05-05

lol ok, i've had a little play with the whole home automation and eventghost, and the whole thing is just to confusing for me to bother with lol.

If anyone has a "fool proof" easy way to get eventghost to recognise the events cinema experience is suppose to be sending, then please... speak up.

Cheers,
Loggio.


- aptalca - 2011-05-05

Hi giftie, great work in this script.

I too am having difficulty setting up the automation events with eventghost. Here is my log: http://pastebin.ca/2054289

I am using this plugin to receive the udp events broadcast by xbmc in eventghost. It works really well, I get all key presses, media played with their names and also pause, play and stop events even without the home automation features of this script. Just using the built in udp event broadcasting of dharma.

However, eventghost cannot distinguish between trailers, trivia music or the actual movie. I was under the impression that enabling the home automation settings in cinema experience would broadcast these specific events so that they would be distinguishable from each other, and specific actions such as dimming the lights to 30% when trailers start, and turning the lights completely off when movie starts, etc. could be achieved.

Unfortunately, I am not seeing any udp event broadcast by the cinema experience script. Only the generic xbmc ones.

I would appreciate any help.

Thanks


- giftie - 2011-05-06

Actually this should be fairly simple to do(after getting XBMC Event Receiver up and running)

Even though I personally have not used EventGhost(at the moment, I don't have a reason to) I barely knew of it's existence in fact(I know, shame on me..)

But i have a solution for you that use Cinema Experience and want to integrate what I have provided with your Home Automation....

So here we go... Big Grin

We will use HTTP-API(It is depreciated, but it should be around even for Eden still, if not, we'll conquer that when it happens)

When the script runs for the first time(I think since about version 1.0.40) the script will copy a folder and it's contents to your userdata\addon_data\script.cinema.experience folder. Inside the folder is a file called "home_automation.py". This file is the bread and butter of the integration. This file is a python script that Cinema Experience will trigger, for those who know programming, it is run as a Thread, so it does not interfere with Cinema Experiences timing, nor should it really affect CPU load. Here is were the fun coding begins(it's fairly simple)

Code:
def activate_on( trigger = "None" ):
    """
        Scripting to trigger almost anything(HA, other scripts, etc...) when videos start.  
        
        Usage:
            activate_on( "Movie" )
            will trigger code that is set under the Movie heading.
            
    """
    if trigger == "None":
        xbmc.output( "[script.cinema.experience] - [ home_automation.py ] - No Trigger Sent, Returning", level=xbmc.LOGNOTICE )
        return
    xbmc.output( "[script.cinema.experience] - [ home_automation.py ] - activate_on( %s ) Triggered" % trigger, level=xbmc.LOGNOTICE )
    # Script Start
    if trigger == _L_( 32613 ) and _S_( "ha_script_start" ) == "true":
        xbmc.output( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32613 ), level=xbmc.LOGNOTICE )
        # place code below this line
    # Trivia Intro

This is a clip from the file. So we will start where it says "# place code below this line" - for those not familiar with python, '#' are comment lines

To get the information to EventGhost(EG from now on), we need the script to send a broadcast. The HTTP API is perfect for this. We will use the command xbmc.executeHTTPAPI() to create our broadcasts.

The broadcast we need to send from CE is something that we can easily identify and distinguish in EG. For this example we will use "CE_Automate".
We will also use <b> to start the broadcast and </b> to end the broadcast, as well as <li> to separate the trigger.

So each of the Event triggers will start with "CE_Automate", ie "<b>CE_Automate<li>script_start</b>", "<b>CE_Automate<li>trivia_start</b>"

Let's put it into the code.. But first a little tip about the indentation. Python really likes indentation, in fact it will not work and through a fit if the indentation is not correct. The script uses 4 spaces per indentation, these are also not tabs. The code we insert will need to line up with the other indented lines.

Here we really go...
Code:
# Script Start
    if trigger == _L_( 32613 ) and _S_( "ha_script_start" ) == "true":
        xbmc.output( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32613 ), level=xbmc.LOGNOTICE )
        # place code below this line
        xbmc.executehttpapi( "Broadcast(<b>CE_Automate<li>script_start</b>)" )

Now when ever the script starts, it broadcasts "<b>CE_Automate<li>script_start</b>".
Continue on, adding the triggers... or download this file - http://www.mediafire.com/file/zpx33v60iifai06/home_automation.py

Now we need to turn our attention to EG...

Install the XBMC Event Receiver plugin - http://www.eventghost.net/forum/viewtopic.php?f=10&t=2140&start=30#p18203 - follow aptalca's instructions if you don't have it working yet.

The triggers we need to look for are the messages that we have broadcasted from CE. The XBMC Event Receiver prefixes the broadcast with XBMC-Event. so the event we will be looking for looks like this: "XBMC-Event.<b>CE_Automate<li>script_start</b>"

So now create a Macro, use the "XBMC-Event.<b>CE_Automate<li>script_start</b>" as the Event, then add what you want EG to do when this Event happens.

That's it.... Not too painful Smile

If the script sensed that the script has stopped playing(ie by pressing stop, video crash, etc) it will trigger the script_end trigger

The triggers in the file are the following:

Script Start - XBMC-Event.<b>CE_Automate<li>script_start</b>
Script End - XBMC-Event.<b>CE_Automate<li>script_end</b>
Trivia Intro - XBMC-Event.<b>CE_Automate<li>trivia_intro</b>
Trivia Start - XBMC-Event.<b>CE_Automate<li>trivia_start</b>
Trivia Outro - XBMC-Event.<b>CE_Automate<li>trivia_outro</b>
Movie Theatre Intro - XBMC-Event.<b>CE_Automate<li>movie_theatre_intro</b>
Coming Attraction Intro - XBMC-Event.<b>CE_Automate<li>coming_attractions_intro</b>
Trailer - XBMC-Event.<b>CE_Automate<li>trailer</b>
Coming Attraction Outro - XBMC-Event.<b>CE_Automate<li>coming_attractions_outro</b>
Feature Presentation Intro - XBMC-Event.<b>CE_Automate<li>feature_intro</b>
Countdown Video - XBMC-Event.<b>CE_Automate<li>countdown_video</b>
Audio Format Video - XBMC-Event.<b>CE_Automate<li>audio_video</b>
MPAA Rating Video - XBMC-Event.<b>CE_Automate<li>mpaa_rating</b>
Movie - XBMC-Event.<b>CE_Automate<li>movie_start</b>
Intermission - XBMC-Event.<b>CE_Automate<li>intermission</b>
Feature Presentation Outro - XBMC-Event.<b>CE_Automate<li>feature_outro</b>
Movie Theatre Outro - XBMC-Event.<b>CE_Automate<li>movie_theatre_outro</b>
Paused - XBMC-Event.<b>CE_Automate<li>paused</b>
Resumed - XBMC-Event.<b>CE_Automate<li>resumed</b>


- aptalca - 2011-05-06

Oh wow, this is amazing,

I downloaded your modified py file, dropped it in, it's beautiful :-)

One bug I noticed is (please don't hate me), if I skip the trivia halfway by pressing backspace, the trailers start, but the event is not broadcast. (No biggie, I could probably add a little video as a trailer intro, that way the broadcast for the intro gets ignored, but the trailer event is broadcast, but I thought you should know)


Now I can do some serious automation. . .


- giftie - 2011-05-06

aptalca Wrote:Oh wow, this is amazing,

I downloaded your modified py file, dropped it in, it's beautiful :-)

One bug I noticed is (please don't hate me), if I skip the trivia halfway by pressing backspace, the trailers start, but the event is not broadcast. (No biggie, I could probably add a little video as a trailer intro, that way the broadcast for the intro gets ignored, but the trailer event is broadcast, but I thought you should know)


Now I can do some serious automation. . .

No problem.. Found the bug... just download the home_automation.py file again(I fixed it, since the error is in there..)

Also if you use multiple trailers and only want the event to be triggered on the first one, make sure you have the 'When Multiple Videos are involved - Trigger only once' set to on. This will only trigger an event on the first video.

Glad you got it up and running.. My Windows box is separate from my XBMC Box(as it runs on Linux) I wasn't sure how well it would work...


- loggio - 2011-05-06

events working a treat in eventghost!! thanks for looking into this giftie :-)

The Event:
XBMC-Event.<b>CE_Automate<li>script_start</b>

Is triggering twice for me. Is this happening for anyone else also?


- serafim - 2011-05-06

Hello.
The countdown video is starting before Audio(DTS,...). According to the first page post, it should be the opposite.

Can you please take a look?

http://pastebin.com/xZspP9DP

Using Aeon MQ2


- giftie - 2011-05-06

loggio Wrote:events working a treat in eventghost!! thanks for looking into this giftie :-)

The Event:
XBMC-Event.<b>CE_Automate<li>script_start</b>

Is triggering twice for me. Is this happening for anyone else also?


I noticed this a couple of times, it is only being sent from the script once. I just tested and all the XBMC Events show up twice on my system :S


- aptalca - 2011-05-07

The trailer broadcast works perfectly (when trivia is skipped) with the updated py file, thanks.

On my system, all events are broadcast once

(win 7 64bit Dharma 10.1 with Transparency v3.11.5)


- drdeath691 - 2011-05-08

I use Metabrowser to scrape my move information and it has a nicely built in trailer download function. The problem is that I can name the movie *-trailer but the folder name remains the default name of the movie. How hard would it be to have the the script search nested folders for trailers. I'll in turn ask the coder of metabrowser about adding an option to rename the folder *-trailer.

Thanks


- giftie - 2011-05-08

drdeath691 Wrote:I use Metabrowser to scrape my move information and it has a nicely built in trailer download function. The problem is that I can name the movie *-trailer but the folder name remains the default name of the movie. How hard would it be to have the the script search nested folders for trailers. I'll in turn ask the coder of metabrowser about adding an option to rename the folder *-trailer.

Thanks

The trailers need to be labeled with the trailing '-trailer' for the script to pick them up as a trailer video, folder names can be anything.

Where are the trailer's located? Are they in their own main folder(ie Trailers)? or Are they inside your Movie Folders?

Do they show up in XBMC's Library?


If the trailers are in a separate main folder(ie - Trailer -> Movie -> movie-trailer.mov, or Trailer -> movie-trailer.mov) you can use the 'Local Folder' Scraper in Trailer options.

If the trailers show up in XBMC's Library, then you can use the 'XBMC Movie Library' scraper

If the trailers are in you Movie Folders, you can use the 'Local Folder' scraper, but this can take a while as there usually is a lot of files that the script checks and ignores.


- someonenice - 2011-05-10

serafim Wrote:Hello.
The countdown video is starting before Audio(DTS,...). According to the first page post, it should be the opposite.

Can you please take a look?

http://pastebin.com/xZspP9DP

Using Aeon MQ2

Mine also does this - I'm also using Aeon MQ2 on a Windows box. :confused2: