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)



Eureka!!!! - Invincer - 2011-10-31

No offense Giftie, but that post was almost solely responsible for me destroying my Harmony controller by throwing it into the wall.. I kept trying all of what was posted there but could not get the XBMC/Cinema Experience to talk to EventGhost the way described.

Jitterjames posted that he couldn't get thart part to work, and after I posted in the X10 Commander Lights thread Shoop_NL said he developed that plugin when he could not get this one to work too. So then I tried thinking about it from a different angle. During this weekend the big difficulty has been the communication from XBMC to EventGhost in what I have tried, there have been numerous macro attempts in EventGhost that seemed to work fine when pressing the test button in EG. On these threads[url=http://forum.xbmc.org/showthread.php?tid=10 are where I got this idea...
1300]http://forum.xbmc.org/showthread.php?tid=101300[/url] and http://forum.melloware.com/viewtopic.php?f=13&t=7718&start=0.

Since it seemed to work in EG as a Python script macro event, I thought why not just call the line straight from your cinema experience script (which is in python) and skip having to use EventGhost at all? I installed X10 Commander from here http://melloware.com/download/ , and now I seem to have it working perfectly.

On the top of your home_automation.py file I added urllib2 in the import lines and for the action codes I used

Code:
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
       urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
etc

I will post my whole working code here, A1 are multicolored strobe lights on my mantel, A2 is my lamp

Code:
# This module's future home should be inside userdata/addon_data/script.cinema.experience/ha_scripts
# to make sure it does not get over written when updating the script

import xbmc, xbmcaddon, urllib2

_A_ = xbmcaddon.Addon('script.cinema.experience')
_L_ = _A_.getLocalizedString
_S_ = _A_.getSetting

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.log( "[script.cinema.experience] - [ home_automation.py ] - No Trigger Sent, Returning", level=xbmc.LOGNOTICE )
        return
    xbmc.log( "[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.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32613 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
    # Trivia Intro
    elif trigger == _L_( 32609 ) and _S_( "ha_trivia_intro" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32609 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
    # Trivia
    elif trigger ==_L_( 32615 ) and _S_( "ha_trivia_start" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32615 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
    # Trivia Outro
    elif trigger ==_L_( 32610 ) and _S_( "ha_trivia_outro" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32610 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
    # Movie Theatre Intro
    elif trigger ==_L_( 32607 ) and _S_( "ha_mte_intro" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32607 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
    # Coming Attractions Intro
    elif trigger ==_L_( 32600 ) and _S_( "ha_cav_intro" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32600 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
    # Trailer
    elif trigger ==_L_( 32605 ) and _S_( "ha_trailer_start" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32605 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
    # Coming Attractions Outro
    elif trigger ==_L_( 32608 ) and _S_( "ha_cav_outro" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32608 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
    # Feature Presentation Intro
    elif trigger ==_L_( 32601 ) and _S_( "ha_fpv_intro" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32601 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
    # MPAA Rating
    elif trigger ==_L_( 32603 ) and _S_( "ha_mpaa_rating" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32603 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')    
    # Countdown
    elif trigger ==_L_( 32611 ) and _S_( "ha_countdown_video" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32611 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
    # Audio Format
    elif trigger ==_L_( 32606 ) and _S_( "ha_audio_format" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32606 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')                
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')        
    # Movie
    elif trigger ==_L_( 32616 ) and _S_( "ha_movie" ) == "true":
        xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32616 ), level=xbmc.LOGNOTICE )
        # place code below this line
        urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')



- boblinds - 2011-11-04

My CinEx had stopped playing the feature (I'm using pre-Eden nightlies) but that pre-Eden build got me running again in time to showoff for a Hollywood studio friend who's coming to visit this weekend.

However, for whatever reason, I've never been able to get streaming to work from Apple Trailers. I have AT Lite installed but no joy. Further, it won't download either, the system just locks. Too lazy to look through 175pp. of previous posts, so let me "bum-out" and ask if anyone else has had and solved this issue.

And thanks Giftie! You can bet that my friend will be green-eyed when he sees CinEx in operation and I intend to gloat for all its worth.


Movie don't play after initial cinema experience videos - darkzone - 2011-11-05

Hi,

First off I just want to say that Cinema Experience really rocks!

Unfortunately I'm having a issue when I want to play a movie in cinema experience, it will play my cinema intro video and the countdown video (These are the only videos I have it setup to play), after that when the movie should start play it jumps back to my movie library. If I now press to play the movie it will start play right away without the cinema experience.

Here is my log file: http://pastebin.com/bgJfA3aN

Thank you for looking into this and hopefully can figure out what is going wrong.


- giftie - 2011-11-07

You would have only needed to read the first page, fifth message. Smile There is a problem with playing a streamed video in a playlist when there is a local video preceding the streamed video. The only work around is to disable any local videos playing before the streamed trailers, or use one of the local trailer options. In regards of the download not working, I would need a debug log to see what is going on.

boblinds Wrote:My CinEx had stopped playing the feature (I'm using pre-Eden nightlies) but that pre-Eden build got me running again in time to showoff for a Hollywood studio friend who's coming to visit this weekend.

However, for whatever reason, I've never been able to get streaming to work from Apple Trailers. I have AT Lite installed but no joy. Further, it won't download either, the system just locks. Too lazy to look through 175pp. of previous posts, so let me "bum-out" and ask if anyone else has had and solved this issue.

And thanks Giftie! You can bet that my friend will be green-eyed when he sees CinEx in operation and I intend to gloat for all its worth.



- giftie - 2011-11-07

About two pages back there is a post about the test versions. I want these tested out as there can be problems. You'll need the 2.0.53 version as you are on Eden

Here are some new test versions...

Dharma Version 1.0.53 -> http://www.mediafire.com/file/6r7d1pqnfeib7xx/script.cinema.experience.1.0.53.zip
Eden Version 2.0.53 -> http://www.mediafire.com/file/3s3l2g3pvmenk02/script.cinema.experience.2.0.53.zip

darkzone Wrote:Hi,

First off I just want to say that Cinema Experience really rocks!

Unfortunately I'm having a issue when I want to play a movie in cinema experience, it will play my cinema intro video and the countdown video (These are the only videos I have it setup to play), after that when the movie should start play it jumps back to my movie library. If I now press to play the movie it will start play right away without the cinema experience.

Here is my log file: http://pastebin.com/bgJfA3aN

Thank you for looking into this and hopefully can figure out what is going wrong.



- giftie - 2011-11-07

That is why the file is pretty much empty, for users to build upon it.

Any chance you can post the full file to pastebin, as the code posted is incomplete(probably due to forum rules)? I'm sure others would want to use it, or build from it.

Thanks


Invincer Wrote:No offense Giftie, but that post was almost solely responsible for me destroying my Harmony controller by throwing it into the wall.. I kept trying all of what was posted there but could not get the XBMC/Cinema Experience to talk to EventGhost the way described.

Jitterjames posted that he couldn't get thart part to work, and after I posted in the X10 Commander Lights thread Shoop_NL said he developed that plugin when he could not get this one to work too. So then I tried thinking about it from a different angle. During this weekend the big difficulty has been the communication from XBMC to EventGhost in what I have tried, there have been numerous macro attempts in EventGhost that seemed to work fine when pressing the test button in EG. On these threads[url=http://forum.xbmc.org/showthread.php?tid=10 are where I got this idea...
1300]http://forum.xbmc.org/showthread.php?tid=101300[/url] and http://forum.melloware.com/viewtopic.php?f=13&t=7718&start=0.

Since it seemed to work in EG as a Python script macro event, I thought why not just call the line straight from your cinema experience script (which is in python) and skip having to use EventGhost at all? I installed X10 Commander from here http://melloware.com/download/ , and now I seem to have it working perfectly.



- xm41907 - 2011-11-08

I'm on the Openelec Eden nightly and when I try installing Cinema Experience version 2.0.53 it says it can't install do to a dependency.


- giftie - 2011-11-08

xm41907 Wrote:I'm on the Openelec Eden nightly and when I try installing Cinema Experience version 2.0.53 it says it can't install do to a dependency.

Ok. found the uneeded module import. please download and try to install it again.

http://www.mediafire.com/file/3s3l2g3pvmenk02/script.cinema.experience.2.0.53.zip


Problem with Apple Movie Trailers - jingai - 2011-11-08

First of all, thank you for the excellent plugin!

Unfortunately, I've got a problem with getting the movie trailer to play. I've got Cinema Experience 2.0.53 (latest copy from Post #175) installed on a build of Eden from 2011/10/11. It is configured to download the trailer instead of stream it, which it does do successfully, but the trailer never plays.

The relevant bits from the log file appear to be:

Code:
16:19:08 T:2956513280  NOTICE: [('4574', u"Marvel's The Avengers", 'http://trailers.apple.com/movies/marvel/theavengers/avengers-tlr1_h640w.mov|User-Agent=QuickTime%2F7.6.5+%28qtver%3D7.6.5%3Bos%3DWindows+NT+5.1Service+Pack+3%29', 'http://trailers.apple.com/trailers/marvel/avengers/images/poster-xlarge.jpg|User-Agent=QuickTime%2F7.6.5+%28qtver%3D7.6.5%3Bos%3DWindows+NT+5.1Service+Pack+3%29', u'Marvel Studios presents in association with Paramount Pictures \u201cMarvel\u2019s The Avengers\u201d\u2014the Super Hero team up of a lifetime, featuring iconic Marvel Super Heroes Iron Man, The Incredible Hulk, Thor, Captain America, Hawkeye and Black Widow. When an unexpected enemy emerges that threatens global safety and security, Nick Fury, Director of the international peacekeeping agency known as S.H.I.E.L.D., finds himself in need of a team to pull the world back from the brink of disaster. Spanning the globe, a daring recruitment effort begins. Starring Robert Downey Jr., Chris Evans, Mark Ruffalo, Chris Hemsworth, Scarlett Johansson, Jeremy Renner and Samuel L. Jackson, and directed by Joss Whedon, \u201cMarvel\u2019s The Avengers\u201d is based on the ever-popular Marvel comic book series \u201cThe Avengers,\u201d first published in 1963 and a comics institution ever since. Prepare yourself for an exciting event movie, packed with action and spectacular special effects, when \u201cMarvel\u2019s The Avengers\u201d assemble in summer 2012. In \u201cMarvel\u2019s The Avengers,\u201d superheroes team up to pull the world back from the brink of disaster when an unexpected enemy threatens global security.', '2:03', 'Not yet rated', '2012-05-04', u'Marvel Studios', 'Science Fiction / Action and Adventure', u'Movie Trailer', u'Joss Whedon')]
16:19:08 T:2956513280  NOTICE: [ script.cinema.experience ] - [ trailer_downloader.py ] - Attempting To Download Trailer: Marvel's The Avengers
16:19:08 T:2955448320  NOTICE: [script.cinema.experience] - [ce_playlist.py] - Rebuilding Playlist
16:19:08 T:2955448320  NOTICE: [{'thumbnail': 'special://masterprofile/Thumbnails/Video/2/288736f9.tbn', 'file': '/Volumes/data/Movies/007 - 01 - Dr. No (1962)/VIDEO_TS/VIDEO_TS.IFO', 'title': '007: 01: Dr. No', 'genre': 'Action / Adventure / Thriller', 'mpaa': '', 'streamdetails': None, 'type': 'movie', 'id': 482, 'label': '007: 01: Dr. No'}]
16:19:08 T:2955448320 WARNING: JSONRPC: Missing property "file" in type
16:19:08 T:2955448320 WARNING: JSONRPC: Missing property "directory" in type
16:19:19 T:2956513280  NOTICE: [ script.cinema.experience ] - [ trailer_downloader.py ] - Successfully Download Trailer: Marvel's The Avengers
16:19:19 T:2956513280  NOTICE: [ script.cinema.experience ] - [ trailer_downloader.py ] - Creating Trailer NFO file
16:19:19 T:2956513280  NOTICE: [ script.cinema.experience ] - [ trailer_downloader.py ] - Saving Trailer NFO file
16:19:19 T:2956513280  NOTICE: [ script.cinema.experience ] - [ trailer_downloader.py ] - Saving List of Downloaded Trailers
16:21:08 T:2955980800  NOTICE: [script.cinema.experience] - Storing Playlist
16:21:08 T:2955980800  NOTICE: [script.cinema.experience] - Building Cinema Experience Playlist
16:21:08 T:2955980800  NOTICE: [script.cinema.experience] - Adding Audio Format Video
16:21:08 T:2955980800  NOTICE: [script.cinema.experience] - Adding Countdown Videos: 0 Video(s)
16:21:08 T:2955980800  NOTICE: [script.cinema.experience] - Adding Ratings Video
16:21:08 T:2955980800  NOTICE: [script.cinema.experience] - Adding Feature Presentation Intro Videos: 1 Videos
16:21:08 T:2955980800  NOTICE: [script.cinema.experience] - Retriving Trailers: 1 Trailers
16:21:08 T:2955980800  NOTICE: [ script.cinema.experience ] - [ local folder scraper ] - Local Folder Trailer Scraper Started
16:21:08 T:2955980800  NOTICE: [ script.cinema.experience ] - [ local folder scraper ] - Fetching Trailers
16:21:08 T:2955980800  NOTICE: [ script.cinema.experience ] - [ local folder scraper ] - Getting Watched List
16:21:08 T:2955980800  NOTICE: [ script.cinema.experience ] - [ local folder scraper ] - Shuffling Trailers
16:21:08 T:2955980800  NOTICE: [ script.cinema.experience ] - [ local folder scraper ] - Saving Watched List
16:21:09 T:2955980800  NOTICE: []
16:21:09 T:2955980800  NOTICE: [script.cinema.experience] - Adding Coming Attraction Outro Video: 1 Videos
16:21:09 T:2955980800  NOTICE: [script.cinema.experience] - Adding Trailers: 0 Trailers
16:21:09 T:2955980800  NOTICE: [script.cinema.experience] - Adding Coming Attraction Intro Videos: 1 Videos
16:21:09 T:2955980800  NOTICE: [script.cinema.experience] - Adding Movie Theatre Intro Videos: 1 Videos
16:21:09 T:2955980800  NOTICE: 1
16:21:09 T:2955980800  NOTICE: [script.cinema.experience] - Adding Trivia Outro Videos: 1 Videos
16:21:11 T:2955980800  NOTICE: [script.cinema.experience] - Adding Feature Presentation Outro Videos: 1 Videos
16:21:11 T:2955980800  NOTICE: [script.cinema.experience] - Adding Movie Theatre Outro Videos: 1 Videos
16:21:11 T:2955980800  NOTICE: [ script.cinema.experience ] - [ ce_playlist.py ] - Looking for 1 files, but only found 0
16:21:11 T:2955980800  NOTICE: [script.cinema.experience] - Playlist Size: 7
16:21:11 T:2955980800  NOTICE: [script.cinema.experience] - Trigger List Size: 7
16:21:11 T:2955980800  NOTICE: [script.cinema.experience] - Saving trigger List
16:21:11 T:2955980800  NOTICE: [script.cinema.experience] - Saving Watch Slide List

I'm not sure what I'm doing wrong. Everything else appears to play as configured.

Here is the log file from this session.

Thanks in advance,
-j


- jingai - 2011-11-09

Figured it out.. apparently if you've got the MPAA rating limit set it just looks through the previously downloaded files for one that matches, and skips playing a trailer if it doesn't find one. It'd be nice if it would choose to download one that matches the rating of the current movie, but I'm not sure Apple provides enough info before the download to do so?

That said, did you intend for us to store the trailers on the local filesystem pretty much indefinitely? That's not a huge issue for me, but I'm curious because I currently clear out that directory once per month via cron.

-j


- jingai - 2011-11-09

Also, forgot to mention, it seems the script sends Pause and Resume commands after each intro/outro video finishes. This is only an issue if you're using the home automation triggers as it will blink my lights on and off.

I could simply ignore Pause and Resume, but it is kind of nice to bring up the lights automatically when the movie is paused. Is there a way to detect within the script whether or not we're currently playing the feature or the intros?


- giftie - 2011-11-09

jingai Wrote:Also, forgot to mention, it seems the script sends Pause and Resume commands after each intro/outro video finishes. This is only an issue if you're using the home automation triggers as it will blink my lights on and off.

I could simply ignore Pause and Resume, but it is kind of nice to bring up the lights automatically when the movie is paused. Is there a way to detect within the script whether or not we're currently playing the feature or the intros?

The pause trigger is somewhat separate from the other triggers. It tests to see if there has been any change in the video time, if there is not a change for about 1.5 seconds the script thinks it is paused. Are your intro/outdo videos stored on a network share? If so, that would explain it, as it can take a short time to start playback. I could add a setting that would allow the user to select this time(still have the default @ 1.5 seconds, just allow for a change ie sensitivity)

And the resume trigger always follows the pause, so fixing the delay before a pause is triggered will fix that as well.


- jingai - 2011-11-10

giftie Wrote:The pause trigger is somewhat separate from the other triggers. It tests to see if there has been any change in the video time, if there is not a change for about 1.5 seconds the script thinks it is paused. Are your intro/outdo videos stored on a network share? If so, that would explain it, as it can take a short time to start playback. I could add a setting that would allow the user to select this time(still have the default @ 1.5 seconds, just allow for a change ie sensitivity)

Ah, yes, all of my videos are on a network share. Making the delay user-configurable seems like the way to go then.

Thanks!
-j


- jitterjames - 2011-11-10

jingai Wrote:Ah, yes, all of my videos are on a network share. Making the delay user-configurable seems like the way to go then.

Thanks!
-j
doesn't XBMC send out a pause event by itself anyway? For me it sends:

<b>OnPlayBackPaused;1</b>

and then

<b>OnPlayBackResumed;1</b>


- jingai - 2011-11-10

jitterjames Wrote:doesn't XBMC send out a pause event by itself anyway?

I haven't actually looked at the code for the plugin, but I presume these Pause/Resume events are different than the ones XBMC sends out. We're talking specifically for the Home Automation scripting that gets called when the video is Paused, which he has said occurs after that 1.5 second delay.

-j