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)



RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - giftie - 2014-03-01

(2014-03-01, 09:15)thekow Wrote: Is there any reason why intro and outro sometimes get skipped?
Say if i add cinema intro and outro, then coming soon will be skipped or if i add a coming soon outro
some other thing will be skipped. I knew there was a bug a while back but i haven't been able to figure out whats happening.

Just trying to figure out a solution to make all my pre videos work

Coming Attraction intro/outros will get skipped if there are no trailers available. Intros/outros can get skipped when errors occur. If this is the case, please post a full debug log


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - giftie - 2014-03-01

(2014-03-01, 21:34)gilphilbert Wrote:
(2014-02-28, 19:51)giftie Wrote: I did some quick research and there seems to be an easy method using requests as seen on this module - https://github.com/EirikAskheim/pymoticz/blob/master/pymoticz.py
Which is similar to the Insteon Hub.. When I get a chance this weekend I'll look into it. There is also this addon that methods could be pulled from - https://github.com/h4wkmoon/xbmc-domoticz

Thanks giftie, I really appreciate your help. I've been tearing my hair out over this as it seems so simple but just won't work.

I've created my own bastardized version of the pymoticz.py script purely for testing. I'm running this on OpenELEC so some of the libraries aren't available that are used in that script. Mine works perfectly, although I obviously have to change the settings myself in the script, but it shows that it works: http://pastebin.com/HBKWJvFY

So, I then created my own home_automation.py script (http://pastebin.com/SNtSpUEK) - it might not be finished, but you can see what I'm trying to get at.

In CE settings, I've got Home Automation enabled and a single trigger for Movie Start. When I start a movie with CE though, I can see the script running (see logs below) but the light level doesn't change. The script is obviously picking up the trigger, but it's like the code for that option isn't being run.

XBMC logs (irrelevant stuff removed): http://pastebin.com/DMes9crR

Can you suggest any further troubleshooting steps?

Many thanks

Can you post a full debug log, so I can see the setting from Cinema Experience.


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - gilphilbert - 2014-03-01

(2014-03-01, 22:15)giftie Wrote: Can you post a full debug log, so I can see the setting from Cinema Experience.

Of course: xbmc.log

EDIT: realised I didn't have debugging enabled...


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - giftie - 2014-03-01

(2014-03-01, 22:28)gilphilbert Wrote:
(2014-03-01, 22:15)giftie Wrote: Can you post a full debug log, so I can see the setting from Cinema Experience.

Of course: xbmc.log

EDIT: realised I didn't have debugging enabled...

Well it does show that Cinema is triggering home_automation.py at the correct point. You placed the home_automation.py file into the userdata/addon_data/script.cinema.experience/ha_scripts folder correct?

You might want to add some logging statements to show when certain stage happen. print statement are good enough, as they are printed in the log.


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - hoa2014 - 2014-03-02

Here is the full debug log that you asked for.

http://xbmclogs.com/show.php?id=141222


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - gilphilbert - 2014-03-02

(2014-03-01, 22:54)giftie Wrote: Well it does show that Cinema is triggering home_automation.py at the correct point. You placed the home_automation.py file into the userdata/addon_data/script.cinema.experience/ha_scripts folder correct?

You might want to add some logging statements to show when certain stage happen. print statement are good enough, as they are printed in the log.

Unbelievably embarrassed (and annoyed with myself) because I was actually editing the source script in addons, not the one in addon_data even though it says so in the script. Sorry. Blush

One last question though - some HA events seem to be triggered early. I've set up my lights to dim when the script starts which works fine. However, the lights turn off as the 'coming attractions into' even though the trigger is set for 'movie start' in the ha script.

Any thoughts?

Thanks so much for your help so far - and CE is simply amazing Smile


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - giftie - 2014-03-02

(2014-03-02, 00:58)gilphilbert Wrote: Unbelievably embarrassed (and annoyed with myself) because I was actually editing the source script in addons, not the one in addon_data even though it says so in the script. Sorry. Blush

One last question though - some HA events seem to be triggered early. I've set up my lights to dim when the script starts which works fine. However, the lights turn off as the 'coming attractions into' even though the trigger is set for 'movie start' in the ha script.

Any thoughts?

Thanks so much for your help so far - and CE is simply amazing Smile

Need to a debug log to see the trigger points.. Sometimes a bugs will cause the script to trigger prematurely...


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - Batiatus - 2014-03-02

I've been playing around with the new Cinema Experience adding 3D integration. I've got a questions/issue.

The 3D film tagging makes sense IF you are using all sorts of different types of 3D video. Almost all of my 3D movies, for now, are 3d ISO Blu-ray rips. I'm hoping to get 3D MVC MKV to work soon as well. But all of these files use the simple tag of 3DBD, which doesn't get flagged by CE. Non of the tags listed in CE seem to relate to the types of 3D files I have. Can 3DBD be added to the recognized tags?

I also found some of the re-ordering of events in the new CE confusing. I think it would be helpful to add a THX trailer slot in the process either before or after the audio format trailer. Lots of people use THX trailers even if they don't have a THX set-up.

Also, has anyone found a source for 3D audio format videos? I've got 1 dts-HD and 1 THX trailer from demo world. I'm sure there's got to be others out there. How about "Put your 3D Glasses on" trailers in 3D? I found the star Wars one on YouTube but it's only 2D. http://youtu.be/-J0erD49rw8


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - giftie - 2014-03-03

(2014-03-02, 15:28)Batiatus Wrote: I've been playing around with the new Cinema Experience adding 3D integration. I've got a questions/issue.

The 3D film tagging makes sense IF you are using all sorts of different types of 3D video. Almost all of my 3D movies, for now, are 3d ISO Blu-ray rips. I'm hoping to get 3D MVC MKV to work soon as well. But all of these files use the simple tag of 3DBD, which doesn't get flagged by CE. Non of the tags listed in CE seem to relate to the types of 3D files I have. Can 3DBD be added to the recognized tags?

If you check the instructions that are with the setting 3D Movie file tags, you will see the following:
Code:
Separate tags with '|'(pipe) and include spaces if required
You can add your own. Also the Gotham version uses Gothams method so you would also need to modify the advancedsettting.xml for XBMC to properly pick it up.
Quote:I also found some of the re-ordering of events in the new CE confusing. I think it would be helpful to add a THX trailer slot in the process either before or after the audio format trailer. Lots of people use THX trailers even if they don't have a THX set-up.
Playlist files can be used to add what ever videos you want to specific 'slots'.
Quote:Also, has anyone found a source for 3D audio format videos? I've got 1 dts-HD and 1 THX trailer from demo world. I'm sure there's got to be others out there. How about "Put your 3D Glasses on" trailers in 3D? I found the star Wars one on YouTube but it's only 2D. http://youtu.be/-J0erD49rw8
Other than Demo World, I don't know of any 'commercial' locactions.. CinemaVision has a few custom made ones.


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - blank - 2014-03-03

(2014-02-27, 22:13)giftie Wrote: I see the two typos and have fixed them.

Thanks.. Let me know what needs to change

Actually, I think that was it, my last issue was probably one of my test machines that was the issue, I think it is running Gotham..

Well, I just tested it on my laptop with Frodo, and got it working just fine,
so it is time to give it a go on my "live" MCE running Linux, and finetune the last stuff (brightness on each level, hue, saturation and stuff)

A big thanks for your help Smile

script
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
import socket, sys, httplib
from threading import Thread

triggers       = sys.modules[ "__main__" ].triggers
ha_settings    = sys.modules[ "__main__" ].ha_settings

class Automate:
    def __init__( self ):
        #  Put the Philips Hub address and api key here.
        self.hue_address = '192.168.0.7'
        self.hue_api_key = 'philipshue'
        self.command_groups = '/api/%s/groups/%s/action'
        self.command_light = '/api/%s/lights/%s/state'
    
    def philips_hue( self, group = -1, light = -1, content = "" ):
        """ This function provides simple control of single groups and single lights.
            
            The following websites might prove to be useful:
            
            http://developers.meethue.com/1_lightsapi.html
            http://developers.meethue.com/2_groupsapi.html
            http://rsmck.co.uk/hue
            
            Ussage:
                To call the philips_hue function, you need to provide the group or
                light number as well as the function you would like to use.
                
                Groups:
                
                    The function call to create an action for a group is the following:
                    
                        self.philips_hue( group = group_number, content = body_content )
                            # where group_number is the actual group number and body_content the action.
                            
                    You can actually use the above line exactly how it is with declaring the variables be for it.
                    
                        group_number = 7
                        body_content = '''{"on":true}'''
                        self.philips_hue( group = group_number, content = body_content )
                        
                        This would turn on group 7.
                
                Lights:
                    The function call to set a light is almost the same as the group function:
                    
                        self.philips_hue( light = light_number, content = body_content )
                            # where light_number is the actual light number and body_content the action.
                            
                    You can actually use the above line exactly how it is with declaring the variables be for it.
                    
                        light_number = 1
                        body_content = '''{"bri": 254, "on": true}'''
                        self.philips_hue( light = light_number, content = body_content )
                        
                        This would turn on light 1 at full brightness.
        """
        if light > -1: # Not sure if there is a light number 0, but this will take care of it.
            command = self.command_light % ( self.hue_api_key, light )
        else:
            command = self.command_groups % ( self.hue_api_key, group )
        connection = httplib.HTTPConnection( self.hue_address )
        connection.request( 'PUT', command, content )
    
    def broadcastUDP( self, data, port = 8278, ipaddress = '255.255.255.255' ): # XBMC's former HTTP API output port is 8278
        IPADDR = ipaddress
        PORTNUM = port
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
        if hasattr(socket,'SO_BROADCAST'):
            s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
        s.connect((IPADDR, PORTNUM))
        s.send(data)
        s.close()
    
    def activate_ha( self, trigger = None, prev_trigger = None, mode="thread" ):
        if ha_settings[ "ha_enable" ]:
            if ha_settings[ "ha_multi_trigger" ] and prev_trigger == trigger:
                pass
            elif mode != "thread":
                self.activate_on( trigger )
            else:
                thread = Thread( name='ha_trigger', target=self.activate_on, args=( trigger, ) )
                thread.start()
        return prev_trigger

    def activate_on( self, 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 not trigger:
            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 )
        if trigger in triggers:
            xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - Trigger %s" % trigger, level=xbmc.LOGNOTICE )
        # Script Start
        if trigger == "Script Start" and ha_settings[ "ha_script_start" ]:
            # place code below this line
            body_content = '{"on":true, "bri":150, "transitiontime":50}'
            self.philips_hue( group = 1, content = body_content )
            pass
        # Trivia Intro
        elif trigger == "Trivia Intro" and ha_settings[ "ha_trivia_intro" ]:
            pass
            # place code below this line
        # Trivia
        elif trigger == "Trivia" and ha_settings[ "ha_trivia_start" ]:
            pass
            # place code below this line
        # Trivia Outro
        elif trigger == "Trivia Outro" and ha_settings[ "ha_trivia_outro" ]:
            pass
            # place code below this line
        # Movie Theatre Intro
        elif trigger == "Movie Theater Intro" and ha_settings[ "ha_mte_intro" ]:
            pass
            # place code below this line
        # Coming Attractions Intro
        elif trigger == "Coming Attractions Intro" and ha_settings[ "ha_cav_intro" ]:
            pass
            # place code below this line
        # Trailer
        elif trigger == "Movie Trailer" and ha_settings[ "ha_trailer_start" ]:
            pass
            # place code below this line
        # Coming Attractions Outro
        elif trigger == "Coming Attractions Outro" and ha_settings[ "ha_cav_outro" ]:
            pass
            # place code below this line
        # Feature Presentation Intro
        elif trigger == "Feature Presentation Intro" and ha_settings[ "ha_fpv_intro" ]:
            pass
            # place code below this line
        # MPAA Rating
        elif trigger == "MPAA Rating" and ha_settings[ "ha_mpaa_rating" ]:
            pass
            # place code below this line
        # Countdown
        elif trigger == "Countdown" and ha_settings[ "ha_countdown_video" ]:
            pass
            # place code below this line
        # Audio Format
        elif trigger == "Audio Format" and ha_settings[ "ha_audio_format" ]:
            pass
            # place code below this line
            body_content = '{"on":true, "bri":50, "transitiontime":50}'
            self.philips_hue( group = 1, content = body_content )
        # Movie
        elif trigger == "Movie" and ha_settings[ "ha_movie" ]:
            pass
            # place code below this line
            body_content = '{"on":false, "transitiontime":50}'
            self.philips_hue( group = 1, content = body_content )
        # Feature Presentation Outro
        elif trigger == "Feature Presentation Outro" and ha_settings[ "ha_fpv_outro" ]:
            pass
            # place code below this line
        # Movie Theatre Intro
        elif trigger == "Movie Theatre Outro" and ha_settings[ "ha_mte_outro" ]:
            pass
            # place code below this line
        # Intermission
        elif trigger == "Intermission" and ha_settings[ "ha_intermission" ]:
            pass
            # place code below this line
        # Script End
        elif trigger == "Script End" and ha_settings[ "ha_script_end" ]:
            pass
            # place code below this line
            body_content = '{"on":true, "bri":200, "transitiontime":50}'
            self.philips_hue( group = 1, content = body_content )
        # Paused
        elif trigger == "Pause" and ha_settings[ "ha_paused" ]:
            pass
            # place code below this line
            body_content = '{"on":true, "bri":120, "transitiontime":50}'
            self.philips_hue( group = 1, content = body_content )
        # Resumed
        elif trigger == "Resume" and ha_settings[ "ha_resumed" ]:
            pass
            # place code below this line
            body_content = '{"on":false, "transitiontime":50}'
            self.philips_hue( group = 1, content = body_content )
        else:
            xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - Opps. Something happened", level=xbmc.LOGNOTICE )



RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - Batiatus - 2014-03-03

(2014-03-03, 04:47)giftie Wrote:
(2014-03-02, 15:28)Batiatus Wrote: I've been playing around with the new Cinema Experience adding 3D integration. I've got a questions/issue.

The 3D film tagging makes sense IF you are using all sorts of different types of 3D video. Almost all of my 3D movies, for now, are 3d ISO Blu-ray rips. I'm hoping to get 3D MVC MKV to work soon as well. But all of these files use the simple tag of 3DBD, which doesn't get flagged by CE. Non of the tags listed in CE seem to relate to the types of 3D files I have. Can 3DBD be added to the recognized tags?

If you check the instructions that are with the setting 3D Movie file tags, you will see the following:
Code:
Separate tags with '|'(pipe) and include spaces if required
You can add your own. Also the Gotham version uses Gothams method so you would also need to modify the advancedsettting.xml for XBMC to properly pick it up.
Quote:I also found some of the re-ordering of events in the new CE confusing. I think it would be helpful to add a THX trailer slot in the process either before or after the audio format trailer. Lots of people use THX trailers even if they don't have a THX set-up.
Playlist files can be used to add what ever videos you want to specific 'slots'.
Quote:Also, has anyone found a source for 3D audio format videos? I've got 1 dts-HD and 1 THX trailer from demo world. I'm sure there's got to be others out there. How about "Put your 3D Glasses on" trailers in 3D? I found the star Wars one on YouTube but it's only 2D. http://youtu.be/-J0erD49rw8
Other than Demo World, I don't know of any 'commercial' locactions.. CinemaVision has a few custom made ones.

Accept you can't use a | in a file name, so I'm not sure how that does anything to help tag 3D files for CE. I renamed 1 movie with a supported tag (which has nothing to do with the type of 3D file it was) and CE picked it up. Thor 3DBD 3DSBS (2011) gets flagged by CE to run the 3D script, even though it's no a side-by-side file. None of my 3D files match any of the supported 3D tags. Just not sure why the 3DBD tag can't be added.

Playlists can't play a random video from a folder of various videos. It will only play the specific playlist in order.

Also, dts-HD 3D audio trailers do not work under the former folder naming. Is there a new way to name the folder for 3D audio format files?


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - giftie - 2014-03-03

(2014-03-03, 14:08)Batiatus Wrote:
(2014-03-03, 04:47)giftie Wrote:
(2014-03-02, 15:28)Batiatus Wrote: I've been playing around with the new Cinema Experience adding 3D integration. I've got a questions/issue.

The 3D film tagging makes sense IF you are using all sorts of different types of 3D video. Almost all of my 3D movies, for now, are 3d ISO Blu-ray rips. I'm hoping to get 3D MVC MKV to work soon as well. But all of these files use the simple tag of 3DBD, which doesn't get flagged by CE. Non of the tags listed in CE seem to relate to the types of 3D files I have. Can 3DBD be added to the recognized tags?

If you check the instructions that are with the setting 3D Movie file tags, you will see the following:
Code:
Separate tags with '|'(pipe) and include spaces if required
You can add your own. Also the Gotham version uses Gothams method so you would also need to modify the advancedsettting.xml for XBMC to properly pick it up.
Quote:I also found some of the re-ordering of events in the new CE confusing. I think it would be helpful to add a THX trailer slot in the process either before or after the audio format trailer. Lots of people use THX trailers even if they don't have a THX set-up.
Playlist files can be used to add what ever videos you want to specific 'slots'.
Quote:Also, has anyone found a source for 3D audio format videos? I've got 1 dts-HD and 1 THX trailer from demo world. I'm sure there's got to be others out there. How about "Put your 3D Glasses on" trailers in 3D? I found the star Wars one on YouTube but it's only 2D. http://youtu.be/-J0erD49rw8
Other than Demo World, I don't know of any 'commercial' locactions.. CinemaVision has a few custom made ones.

Accept you can't use a | in a file name, so I'm not sure how that does anything to help tag 3D files for CE. I renamed 1 movie with a supported tag (which has nothing to do with the type of 3D file it was) and CE picked it up. Thor 3DBD 3DSBS (2011) gets flagged by CE to run the 3D script, even though it's no a side-by-side file. None of my 3D files match any of the supported 3D tags. Just not sure why the 3DBD tag can't be added.

The pipe separator is for the setting. You need to add the tag to the setting, separating the tag with the pipe(' | ") symbol.

Quote:Playlists can't play a random video from a folder of various videos. It will only play the specific playlist in order.

Also, dts-HD 3D audio trailers do not work under the former folder naming. Is there a new way to name the folder for 3D audio format files?

You need to set the 3D intro/outro folders in the 3D settings. The script uses the same file methods for 2D as it does for 3D.


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - Batiatus - 2014-03-03

(2014-03-03, 15:58)giftie Wrote: The pipe separator is for the setting. You need to add the tag to the setting, separating the tag with the pipe(' | ") symbol.

You need to set the 3D intro/outro folders in the 3D settings. The script uses the same file methods for 2D as it does for 3D.

OK, I must have mistaken what that meant. I will play around with it.edit: Got that to work. Feel real dumb now :$

I've set the 3D video folders the same way I've done the 2D. I have a 3D Audio folder which then has a sub-folder for DTS-HD Master Audio, the same name as for 2D. It doesn't trigger the DTS trailer at all.

Always appreciate the response Giftie. You aren't shy to help out those of us with questions and concerns. Thank you very much!


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - giftie - 2014-03-04

(2014-03-03, 23:50)Batiatus Wrote:
(2014-03-03, 15:58)giftie Wrote: The pipe separator is for the setting. You need to add the tag to the setting, separating the tag with the pipe(' | ") symbol.

You need to set the 3D intro/outro folders in the 3D settings. The script uses the same file methods for 2D as it does for 3D.

OK, I must have mistaken what that meant. I will play around with it.edit: Got that to work. Feel real dumb now :$

I've set the 3D video folders the same way I've done the 2D. I have a 3D Audio folder which then has a sub-folder for DTS-HD Master Audio, the same name as for 2D. It doesn't trigger the DTS trailer at all.

Always appreciate the response Giftie. You aren't shy to help out those of us with questions and concerns. Thank you very much!

Need a debug log to see what is going on with you audio intro's


RE: [RELEASE] Cinema Experience - the new Home Theater Experience Script - Batiatus - 2014-03-05

Stupid me. Had the dts folder misspelled. Bloody dyslexia. All good now.

A quick question to ask. Is there a keyboard shortcut (which can be mapped to a remote) to skip to the next item in the CE playlist? I can only seem to do this with the on screen player controls and for testing it's handy to not have to sit through every item being played or only skip ahead a few seconds via the remote controls I've been able to map. Even if I'm running CE for viewing sometimes I don't really want to watch the trailer it's picked or something but I can't skip the entire video in any way but on screen.