Advertisement
Guest User

Untitled

a guest
Nov 13th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.46 KB | None | 0 0
  1. # This module's future home should be inside userdata/addon_data/script.cinema.experience/ha_scripts
  2. # to make sure it does not get over written when updating the script
  3.  
  4. import xbmc, xbmcaddon, urllib2, subprocess
  5.  
  6. _A_ = xbmcaddon.Addon('script.cinema.experience')
  7. _L_ = _A_.getLocalizedString
  8. _S_ = _A_.getSetting
  9.  
  10. def activate_on( trigger = "None" ):
  11. """
  12. Scripting to trigger almost anything(HA, other scripts, etc...) when videos start.
  13.  
  14. Usage:
  15. activate_on( "Movie" )
  16. will trigger code that is set under the Movie heading.
  17.  
  18. """
  19. if trigger == "None":
  20. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - No Trigger Sent, Returning", level=xbmc.LOGNOTICE )
  21. return
  22. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - activate_on( %s ) Triggered" % trigger, level=xbmc.LOGNOTICE )
  23. # Script Start
  24. if trigger == _L_( 32613 ) and _S_( "ha_script_start" ) == "true":
  25. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32613 ), level=xbmc.LOGNOTICE )
  26. # place code below this line
  27. subprocess.call(['C:\\Betaoff.exe'])
  28. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
  29. # Trivia Intro
  30. elif trigger == _L_( 32609 ) and _S_( "ha_trivia_intro" ) == "true":
  31. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32609 ), level=xbmc.LOGNOTICE )
  32. # place code below this line
  33. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
  34. # Trivia
  35. elif trigger ==_L_( 32615 ) and _S_( "ha_trivia_start" ) == "true":
  36. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32615 ), level=xbmc.LOGNOTICE )
  37. # place code below this line
  38. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
  39. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
  40. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
  41. subprocess.call(['C:\\TriviaBB.exe'])
  42. # Trivia Outro
  43. elif trigger ==_L_( 32610 ) and _S_( "ha_trivia_outro" ) == "true":
  44. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32610 ), level=xbmc.LOGNOTICE )
  45. # place code below this line
  46. subprocess.call(['C:\\Betaoff.exe'])
  47. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
  48. # Movie Theatre Intro
  49. elif trigger ==_L_( 32607 ) and _S_( "ha_mte_intro" ) == "true":
  50. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32607 ), level=xbmc.LOGNOTICE )
  51. # place code below this line
  52. subprocess.call(['C:\\Cartoon.exe'])
  53. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
  54. # Coming Attractions Intro
  55. elif trigger ==_L_( 32600 ) and _S_( "ha_cav_intro" ) == "true":
  56. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32600 ), level=xbmc.LOGNOTICE )
  57. # place code below this line
  58. subprocess.call(['C:\\Betaoff.exe'])
  59. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
  60. # Trailer
  61. elif trigger ==_L_( 32605 ) and _S_( "ha_trailer_start" ) == "true":
  62. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32605 ), level=xbmc.LOGNOTICE )
  63. # place code below this line
  64. subprocess.call(['C:\\Previews.exe'])
  65. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
  66. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
  67. # Coming Attractions Outro
  68. elif trigger ==_L_( 32608 ) and _S_( "ha_cav_outro" ) == "true":
  69. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32608 ), level=xbmc.LOGNOTICE )
  70. # place code below this line
  71. subprocess.call(['C:\\Betaoff.exe'])
  72. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
  73. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
  74. # Feature Presentation Intro
  75. elif trigger ==_L_( 32601 ) and _S_( "ha_fpv_intro" ) == "true":
  76. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32601 ), level=xbmc.LOGNOTICE )
  77. # place code below this line
  78. subprocess.call(['C:\\about2begin.exe'])
  79. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
  80. # MPAA Rating
  81. elif trigger ==_L_( 32603 ) and _S_( "ha_mpaa_rating" ) == "true":
  82. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32603 ), level=xbmc.LOGNOTICE )
  83. # place code below this line
  84. subprocess.call(['C:\\herewego.exe'])
  85. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
  86. # Countdown
  87. elif trigger ==_L_( 32611 ) and _S_( "ha_countdown_video" ) == "true":
  88. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32611 ), level=xbmc.LOGNOTICE )
  89. # place code below this line
  90. subprocess.call(['C:\\begins.exe'])
  91. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
  92. # Audio Format
  93. elif trigger ==_L_( 32606 ) and _S_( "ha_audio_format" ) == "true":
  94. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32606 ), level=xbmc.LOGNOTICE )
  95. # place code below this line
  96. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
  97. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
  98. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
  99. subprocess.call(['C:\\seats.exe'])
  100. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
  101. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
  102. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
  103. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
  104. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
  105. # Movie
  106. elif trigger ==_L_( 32616 ) and _S_( "ha_movie" ) == "true":
  107. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32616 ), level=xbmc.LOGNOTICE )
  108. # place code below this line
  109. subprocess.call(['C:\\Betaoff.exe'])
  110. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
  111. # Feature Presentation Outro
  112. elif trigger ==_L_( 32602 ) and _S_( "ha_fpv_outro" ) == "true":
  113. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32602 ), level=xbmc.LOGNOTICE )
  114. # place code below this line
  115. # Movie Theatre Intro
  116. elif trigger ==_L_( 32617 ) and _S_( "ha_mte_outro" ) == "true":
  117. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32617 ), level=xbmc.LOGNOTICE )
  118. # place code below this line
  119. # Intermission
  120. elif trigger ==_L_( 32612 ) and _S_( "ha_intermission" ) == "true":
  121. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32612 ), level=xbmc.LOGNOTICE )
  122. # place code below this line
  123. # Script End
  124. elif trigger ==_L_( 32614 ) and _S_( "ha_script_end" ) == "true":
  125. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32614 ), level=xbmc.LOGNOTICE )
  126. # place code below this line
  127. # Paused
  128. elif trigger ==_L_( 32618 ) and _S_( "ha_paused" ) == "true":
  129. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32618 ), level=xbmc.LOGNOTICE )
  130. # place code below this line
  131. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
  132. # Resumed
  133. elif trigger ==_L_( 32619 ) and _S_( "ha_resumed" ) == "true":
  134. xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32619 ), level=xbmc.LOGNOTICE )
  135. # place code below this line
  136. urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
  137.  
  138.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement