Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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, subprocess
- _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
- subprocess.call(['C:\\Betaoff.exe'])
- 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"')
- subprocess.call(['C:\\TriviaBB.exe'])
- # 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
- subprocess.call(['C:\\Betaoff.exe'])
- 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
- subprocess.call(['C:\\Cartoon.exe'])
- 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
- subprocess.call(['C:\\Betaoff.exe'])
- 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
- subprocess.call(['C:\\Previews.exe'])
- 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
- subprocess.call(['C:\\Betaoff.exe'])
- 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
- subprocess.call(['C:\\about2begin.exe'])
- 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
- subprocess.call(['C:\\herewego.exe'])
- 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
- subprocess.call(['C:\\begins.exe'])
- 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"')
- subprocess.call(['C:\\seats.exe'])
- 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
- subprocess.call(['C:\\Betaoff.exe'])
- urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
- # Feature Presentation Outro
- elif trigger ==_L_( 32602 ) and _S_( "ha_fpv_outro" ) == "true":
- xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32602 ), level=xbmc.LOGNOTICE )
- # place code below this line
- # Movie Theatre Intro
- elif trigger ==_L_( 32617 ) and _S_( "ha_mte_outro" ) == "true":
- xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32617 ), level=xbmc.LOGNOTICE )
- # place code below this line
- # Intermission
- elif trigger ==_L_( 32612 ) and _S_( "ha_intermission" ) == "true":
- xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32612 ), level=xbmc.LOGNOTICE )
- # place code below this line
- # Script End
- elif trigger ==_L_( 32614 ) and _S_( "ha_script_end" ) == "true":
- xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32614 ), level=xbmc.LOGNOTICE )
- # place code below this line
- # Paused
- elif trigger ==_L_( 32618 ) and _S_( "ha_paused" ) == "true":
- xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32618 ), level=xbmc.LOGNOTICE )
- # place code below this line
- urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
- # Resumed
- elif trigger ==_L_( 32619 ) and _S_( "ha_resumed" ) == "true":
- xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32619 ), level=xbmc.LOGNOTICE )
- # place code below this line
- urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement