def _play_trivia( self, mpaa, genre, plist, equivalent_mpaa ):
     Launch_automation().launch_automation( triggers[0] ) # Script Start - Or where it seems to be
     if trivia_settings[ "trivia_mode" ] == 2: # Start Movie Quiz Script
         utils.log( "Starting script.moviequiz", xbmc.LOGNOTICE )
         self.start_downloader( mpaa, genre, equivalent_mpaa )
         try:
             _MA_= xbmcaddon.Addon( "script.moviequiz" )
             BASE_MOVIEQUIZ_PATH = xbmc.translatePath( _MA_.getAddonInfo('path') )
             sys.path.append( BASE_MOVIEQUIZ_PATH )
             try:
                 import quizlib.question as question
                 utils.log( "Loaded question module", xbmc.LOGNOTICE )
             except ImportError:
                 traceback.print_exc()
                 utils.log( "Failed to Load question module", xbmc.LOGNOTICE )
             except:
                 traceback.print_exc()
             try:
                 import quizlib.mq_ce_play as moviequiz
                 utils.log( "Loaded mq_ce_play module", xbmc.LOGNOTICE )
             except ImportError:
                 traceback.print_exc()
                 utils.log( "Failed to Load mq_ce_play module", xbmc.LOGNOTICE )
             except:
                 traceback.print_exc()
 #            pDialog.close()
             self.trivia_intro()        
             if playlist.size() > 0:
                 self._wait_until_end()
             xbmc.sleep( 500 ) # wait .5 seconds 
             xbmc.Player().stop()
             path = _MA_.getAddonInfo('path')
             question_type = 1
             mode = ( True, False )[ trivia_settings[ "trivia_moviequiz_mode" ] ]
             mpaa = ( trivia_settings[ "trivia_rating" ], equivalent_mpaa, )[ trivia_settings[ "trivia_limit_query" ] ]
             question_limit = trivia_settings[ "trivia_moviequiz_qlimit" ]
             completion = moviequiz.runCinemaExperience( question_type, mode, mpaa, genre, question_limit )
             if completion:
                 utils.log( "Completed script.moviequiz", xbmc.LOGNOTICE )
             else:
                 utils.log( "Failed in script.moviequiz", xbmc.LOGNOTICE )
         except:
             traceback.print_exc()
             utils.log( "Failed to start script.moviequiz", xbmc.LOGNOTICE )
         _rebuild_playlist( plist )
         import xbmcscript_player as script
         script.Main()
         xbmc.executebuiltin( "XBMC.ActivateWindow(fullscreenvideo)" )
         #xbmc.sleep(500) # wait .5 seconds
         #xbmc.Player().play( playlist )
     elif trivia_settings[ "trivia_folder" ] and trivia_settings[ "trivia_mode" ] == 1:  # Start Slide Show
         self.start_downloader( mpaa, genre, equivalent_mpaa )
         if not trivia_settings[ "trivia_music" ] == 0:
             build_music_playlist()
         # set the proper mpaa rating user preference
         mpaa = ( trivia_settings[ "trivia_rating" ], equivalent_mpaa, )[ trivia_settings[ "trivia_limit_query" ] ]
         utils.log( "Slide MPAA Rating: %s" % equivalent_mpaa, xbmc.LOGNOTICE )
         # import trivia module and execute the gui
         slide_playlist = _fetch_slides( equivalent_mpaa )
         self.trivia_intro()
         if playlist.size() > 0:
             Launch_automation().launch_automation( triggers[1] ) # Trivia Intro
             xbmc.sleep( 500 ) # wait .5 seconds 
             self._wait_until_end()
         #xbmc.sleep(500) # wait .5 seconds 
         xbmc.Player().stop()
         __builtin__.plist = plist
         __builtin__.slide_playlist = slide_playlist
         __builtin__.movie_mpaa = mpaa
         __builtin__.movie_genre = genre
         from xbmcscript_trivia import Trivia
         utils.log( "Starting Trivia script", xbmc.LOGNOTICE )
         Launch_automation().launch_automation( triggers[2] ) # Trivia Start
         ui = Trivia( "script-CExperience-trivia.xml", __addon__.getAddonInfo('path'), "Default", "720p" )
         ui.doModal()
         del ui
         # we need to activate the video window
         #xbmc.sleep(5) # wait .005 seconds
         xbmc.executebuiltin( "XBMC.ActivateWindow(fullscreenvideo)" )
         #xbmc.Player().play( playlist )
     elif trivia_settings[ "trivia_mode" ] == 0: # No Trivia
         # no trivia slide show so play the video
         self.start_downloader( mpaa, genre, equivalent_mpaa )
         _rebuild_playlist( plist )
         # play the video playlist
         import xbmcscript_player as script
         script.Main()
         xbmc.executebuiltin( "XBMC.ActivateWindow(fullscreenvideo)" )
         xbmc.sleep( 500 ) # wait .5 seconds
    def _play_trivia(self, mpaa, genre, plist, equivalent_mpaa):
        Launch_automation().launch_automation(
            triggers[0])  # Script Start - Or where it seems to be
        if trivia_settings["trivia_mode"] == 2:  # Start Movie Quiz Script
            log("Starting script.moviequiz", xbmc.LOGNOTICE)
            self.start_downloader(mpaa, genre, equivalent_mpaa)
            try:
                _MA_ = xbmcaddon.Addon("script.moviequiz")
                BASE_MOVIEQUIZ_PATH = xbmc.translatePath(
                    _MA_.getAddonInfo('path'))
                sys.path.append(BASE_MOVIEQUIZ_PATH)
                try:
                    import quizlib.question as question
                    log("Loaded question module", xbmc.LOGNOTICE)
                except ImportError:
                    traceback.print_exc()
                    log("Failed to Load question module", xbmc.LOGNOTICE)
                except:
                    traceback.print_exc()
                try:
                    import quizlib.mq_ce_play as moviequiz
                    log("Loaded mq_ce_play module", xbmc.LOGNOTICE)
                except ImportError:
                    traceback.print_exc()
                    log("Failed to Load mq_ce_play module", xbmc.LOGNOTICE)
                except:
                    traceback.print_exc()

    #            pDialog.close()
                self.trivia_intro()
                if playlist.size() > 0:
                    self._wait_until_end()
                xbmc.sleep(500)  # wait .5 seconds
                xbmc.Player().stop()
                path = _MA_.getAddonInfo('path')
                question_type = 1
                mode = (True, False)[trivia_settings["trivia_moviequiz_mode"]]
                mpaa = (
                    trivia_settings["trivia_rating"],
                    equivalent_mpaa,
                )[trivia_settings["trivia_limit_query"]]
                question_limit = trivia_settings["trivia_moviequiz_qlimit"]
                completion = moviequiz.runCinemaExperience(
                    question_type, mode, mpaa, genre, question_limit)
                if completion:
                    log("Completed script.moviequiz", xbmc.LOGNOTICE)
                else:
                    log("Failed in script.moviequiz", xbmc.LOGNOTICE)
            except:
                traceback.print_exc()
                log("Failed to start script.moviequiz", xbmc.LOGNOTICE)
            _rebuild_playlist(plist)
            import xbmcscript_player as script
            script.Main()
            xbmc.executebuiltin("XBMC.ActivateWindow(fullscreenvideo)")
            #xbmc.sleep(500) # wait .5 seconds
            #xbmc.Player().play( playlist )
        elif trivia_settings["trivia_folder"] and trivia_settings[
                "trivia_mode"] == 1:  # Start Slide Show
            self.start_downloader(mpaa, genre, equivalent_mpaa)
            if not trivia_settings["trivia_music"] == 0:
                build_music_playlist()
            # set the proper mpaa rating user preference
            mpaa = (
                trivia_settings["trivia_rating"],
                equivalent_mpaa,
            )[trivia_settings["trivia_limit_query"]]
            log("Slide MPAA Rating: %s" % equivalent_mpaa, xbmc.LOGNOTICE)
            # import trivia module and execute the gui
            slide_playlist = _fetch_slides(equivalent_mpaa)
            self.trivia_intro()
            if playlist.size() > 0:
                Launch_automation().launch_automation(
                    triggers[1])  # Trivia Intro
                xbmc.sleep(500)  # wait .5 seconds
                self._wait_until_end()
            #xbmc.sleep(500) # wait .5 seconds
            xbmc.Player().stop()
            __builtin__.plist = plist
            __builtin__.slide_playlist = slide_playlist
            __builtin__.movie_mpaa = mpaa
            __builtin__.movie_genre = genre
            from xbmcscript_trivia import Trivia
            log("Starting Trivia script", xbmc.LOGNOTICE)
            Launch_automation().launch_automation(triggers[2])  # Trivia Start
            ui = Trivia("script-CExperience-trivia.xml",
                        __addon__.getAddonInfo('path'), "Default", "720p")
            ui.doModal()
            del ui
            # we need to activate the video window
            #xbmc.sleep(5) # wait .005 seconds
            xbmc.executebuiltin("XBMC.ActivateWindow(fullscreenvideo)")
            #xbmc.Player().play( playlist )
        elif trivia_settings["trivia_mode"] == 0:  # No Trivia
            # no trivia slide show so play the video
            self.start_downloader(mpaa, genre, equivalent_mpaa)
            _rebuild_playlist(plist)
            # play the video playlist
            import xbmcscript_player as script
            script.Main()
            xbmc.executebuiltin("XBMC.ActivateWindow(fullscreenvideo)")
            xbmc.sleep(500)  # wait .5 seconds
def _play_trivia( mpaa, genre, plist, equivalent_mpaa ):
    activate_ha( _L_( 32613 ) ) # Script Start - Or where it seems to be
    # if trivia path and time to play the trivia slides
    pDialog = xbmcgui.DialogProgress()
    pDialog.create( __script__, _L_( 32520 )  )
    pDialog.update( 0 )
    if int( _S_( "trivia_mode" ) ) == 2: # Start Movie Quiz Script
        xbmc.log( "[ script.cinema.experience ] - Starting script.moviequiz", level=xbmc.LOGNOTICE )
        start_downloader( mpaa, genre, equivalent_mpaa )
        try:
            _MA_= xbmcaddon.Addon( "script.moviequiz" )
            BASE_MOVIEQUIZ_PATH = xbmc.translatePath( _MA_.getAddonInfo('path') )
            sys.path.append( BASE_MOVIEQUIZ_PATH )
            try:
                import quizlib.question as question
                xbmc.log( "[ script.cinema.experience ] - Loaded question module", level=xbmc.LOGNOTICE )
            except ImportError:
                traceback.print_exc()
                xbmc.log( "[ script.cinema.experience ] - Failed to Load question module", level=xbmc.LOGNOTICE )
            except:
                traceback.print_exc()
            try:
                import quizlib.mq_ce_play as moviequiz
                xbmc.log( "[ script.cinema.experience ] - Loaded mq_ce_play module", level=xbmc.LOGNOTICE )
            except ImportError:
                traceback.print_exc()
                xbmc.log( "[ script.cinema.experience ] - Failed to Load mq_ce_play module", level=xbmc.LOGNOTICE )
            except:
                traceback.print_exc()
            pDialog.close()
            activate_ha( _L_( 32613 ) ) # Script Start - Or where it seems to be
            trivia_intro()        
            if playlist.size() > 0:
                _wait_until_end()
            xbmc.sleep(500) # wait .5 seconds
            path = _MA_.getAddonInfo('path')
            question_type = 1
            mode = ( True, False )[int( _S_( "trivia_moviequiz_mode" ) ) ]
            mpaa = (  _S_( "trivia_rating" ), equivalent_mpaa, )[ _S_( "trivia_limit_query" ) == "true" ]
            question_limit = int( float( _S_( "trivia_moviequiz_qlimit" ) ) )
            completion = moviequiz.runCinemaExperience( question_type, mode, mpaa, genre, question_limit )
            if completion:
                xbmc.log( "[ script.cinema.experience ] - Completed script.moviequiz", level=xbmc.LOGNOTICE )
            else:
                xbmc.log( "[ script.cinema.experience ] - Failed in script.moviequiz", level=xbmc.LOGNOTICE )
        except:
            traceback.print_exc()
            xbmc.log( "[ script.cinema.experience ] - Failed to start script.moviequiz", level=xbmc.LOGNOTICE )
        _rebuild_playlist( plist )
        import xbmcscript_player as script
        script.Main()
        xbmc.sleep(500) # wait .5 seconds
        xbmc.Player().play( playlist )
    elif _S_( "trivia_folder" ) and int( _S_( "trivia_mode" ) ) == 1:  # Start Slide Show
        start_downloader( mpaa, genre, equivalent_mpaa )
        ## update dialog with new message
        pDialog.update( -1, _L_( 32510 ) )        
        # trivia settings, grab them here so we don't need another _S_() object
        if not int( _S_( "trivia_music" ) )== 0:
            pDialog.update( -1, _L_( 32511 )  )
            build_music_playlist()
        # set the proper mpaa rating user preference
        mpaa = (  _S_( "trivia_rating" ), equivalent_mpaa, )[ _S_( "trivia_limit_query" ) == "true" ]
        xbmc.log( "[ script.cinema.experience ] - Slide MPAA Rating: %s" % equivalent_mpaa, level=xbmc.LOGNOTICE )
        # import trivia module and execute the gui
        pDialog.update( 50 )
        slide_playlist = _fetch_slides( equivalent_mpaa )
        pDialog.close()
        trivia_intro()
        if playlist.size() > 0:
            activate_ha( _L_( 32609 ) ) # Trivia Intro
            _wait_until_end()
        xbmc.sleep(1500) # wait 1.5 seconds 
        from xbmcscript_trivia import Trivia
        xbmc.log( "[ script.cinema.experience ] - Starting Trivia script", level=xbmc.LOGNOTICE )
        activate_ha( _L_( 32615 ) ) # Trivia Start
        __builtin__.plist = plist
        __builtin__.slide_playlist = slide_playlist
        __builtin__.movie_mpaa = mpaa
        __builtin__.movie_genre = genre
        ui = Trivia( "script-CExperience-trivia.xml", _A_.getAddonInfo('path'), "default", "720p" )
        ui.doModal()
        del ui
        # we need to activate the video window
        xbmc.sleep(500) # wait .5 seconds
        xbmc.executebuiltin( "XBMC.ActivateWindow(2005)" )
        xbmc.Player().play( playlist )
    elif int( _S_( "trivia_mode" ) ) == 0: # No Trivia
        # no trivia slide show so play the video
        pDialog.close()
        start_downloader( mpaa, genre, equivalent_mpaa )
        _rebuild_playlist( plist )
        # play the video playlist
        import xbmcscript_player as script
        script.Main()
        activate_ha( _L_( 32613 ) ) # Script Start - Or where it seems to be
        xbmc.sleep(500) # wait .5 seconds
        xbmc.Player().play( playlist )