def _start( self ): mpaa = audio = genre = movie = equivalent_mpaa = "" try: # create the playlist self.playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO ) # Check to see if multiple features have been set in settings # if multiple features is greater than 1(not a single feature) # add the intermission videos and audio files for the 2, third, etc movies if self.playlistsize > 1: if feature_settings[ "intermission_video" ] > 0 or feature_settings[ "intermission_audio" ] or feature_settings[ "intermission_ratings" ]: mpaa, audio, genre, movie, equivalent_mpaa = self._add_intermission_videos() # otherwise just build for a single video else: mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( feature = 0 ) self._create_playlist( mpaa, audio, genre, movie, equivalent_mpaa ) # play the trivia slide show except: traceback.print_exc()
def _start(self): mpaa = audio = genre = movie = equivalent_mpaa = "" try: # create the playlist self.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) # Check to see if multiple features have been set in settings # if multiple features is greater than 1(not a single feature) # add the intermission videos and audio files for the 2, third, etc movies if self.playlistsize > 1: if feature_settings[ "intermission_video"] > 0 or feature_settings[ "intermission_audio"] or feature_settings[ "intermission_ratings"]: mpaa, audio, genre, movie, equivalent_mpaa = self._add_intermission_videos( ) # otherwise just build for a single video else: mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( feature=0) self._create_playlist(mpaa, audio, genre, movie, equivalent_mpaa) # play the trivia slide show except: traceback.print_exc()
def start_script(self, library_view="oldway"): messy_exit = False log("Library_view: %s" % library_view, xbmc.LOGNOTICE) early_exit = False movie_next = False prev_trigger = None if library_view != "oldway": xbmc.executebuiltin("ActivateWindow(videolibrary,%s,return)" % library_view) # wait until Video Library shows while not xbmc.getCondVisibility("Container.Content(movies)"): pass if feature_settings["enable_notification"]: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % (header, __language__(32546), 300000, image)) # wait until playlist is full to the required number of features log( "Waiting for queue to be filled with %s Feature films" % number_of_features, xbmc.LOGNOTICE) count = 0 while playlist.size() < number_of_features: if playlist.size() > count: log( "User queued %s of %s Feature films" % (playlist.size(), number_of_features), xbmc.LOGNOTICE) header1 = header + " - Feature " + "%d" % playlist.size() message = __language__(32543) + playlist[ playlist.size() - 1].getdescription() if feature_settings["enable_notification"]: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image)) count = playlist.size() xbmc.sleep(time_delay * 2) if not xbmc.getCondVisibility("Container.Content(movies)"): early_exit = True break log("User queued %s Feature films" % playlist.size(), xbmc.LOGNOTICE) if not early_exit: header1 = header + " - Feature " + "%d" % playlist.size() message = __language__(32543) + playlist[playlist.size() - 1].getdescription() if feature_settings["enable_notification"]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image)) early_exit = False # If for some reason the limit does not get reached and the window changed, cancel script if playlist.size() < number_of_features and library_view != "oldway": if feature_settings["enable_notification"]: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % (header, __language__(32544), time_delay, image)) _clear_playlists() else: mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( feature=0) plist = _store_playlist() # need to store movie playlist self._play_trivia(mpaa, genre, plist, equivalent_mpaa) mplaylist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) mplaylist.clear() trigger_list = self.load_trigger_list() self.player.play(playlist) count = -1 stop_check = 0 paused = False # wait until fullscreen video is shown while not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)"): pass while not playlist.getposition() == (playlist.size() - 1): if playlist.getposition() > count: try: log( "Item From Trigger List: %s" % trigger_list[playlist.getposition()], xbmc.LOGNOTICE) except: log("Problem With Trigger List", xbmc.LOGNOTICE) log( "Playlist Position: %s Playlist Size: %s " % ((playlist.getposition() + 1), (playlist.size())), xbmc.LOGNOTICE) if not playlist.getposition() == (playlist.size() - 1): prev_trigger = Launch_automation().launch_automation( trigger_list[playlist.getposition()], prev_trigger) count = playlist.getposition() else: break # Reached the last item in the playlist try: #if not self.player.isPlayingVideo() and not is_paused: if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)"): log("Video may have stopped", xbmc.LOGNOTICE) xbmc.sleep( 5000 ) # wait 5 seconds for fullscreen video to show up(during playback) if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): # if fullscreen video does not show up, break and exit script messy_exit = True break except: if xbmc.getCondVisibility("Container.Content(movies)"): log("Video Definitely Stopped", xbmc.LOGNOTICE) messy_exit = True break if not playlist.size( ) < 1 and not messy_exit: # To catch an already running script when a new instance started log( "Playlist Position: %s Playlist Size: %s " % (playlist.getposition() + 1, (playlist.size())), xbmc.LOGNOTICE) prev_trigger = Launch_automation().launch_automation( trigger_list[playlist.getposition()], prev_trigger) if trigger_list[playlist.getposition()] == "Movie": log( "Item From Trigger List: %s" % trigger_list[playlist.getposition()], xbmc.LOGNOTICE) else: log( "Item From Trigger List: %s" % trigger_list[playlist.getposition()], xbmc.LOGNOTICE) messy_exit = False xbmc.sleep(1000) self._wait_until_end() else: log("User might have pressed stop", xbmc.LOGNOTICE) log("Stopping Script", xbmc.LOGNOTICE) messy_exit = False return messy_exit
def start_script( self, library_view = "oldway" ): messy_exit = False utils.log( "Library_view: %s" % library_view, xbmc.LOGNOTICE ) early_exit = False movie_next = False prev_trigger = None if library_view != "oldway": xbmc.executebuiltin( "ActivateWindow(videolibrary,%s,return)" % library_view ) # wait until Video Library shows while not xbmc.getCondVisibility( "Container.Content(movies)" ): pass if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, __language__( 32546 ), 300000, image) ) # wait until playlist is full to the required number of features utils.log( "Waiting for queue to be filled with %s Feature films" % number_of_features, xbmc.LOGNOTICE ) count = 0 while playlist.size() < number_of_features: if playlist.size() > count: utils.log( "User queued %s of %s Feature films" % (playlist.size(), number_of_features), xbmc.LOGNOTICE ) header1 = header + " - Feature " + "%d" % playlist.size() message = __language__( 32543 ) + playlist[playlist.size() -1].getdescription() if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image) ) count = playlist.size() xbmc.sleep(time_delay*2) if not xbmc.getCondVisibility( "Container.Content(movies)" ): early_exit = True break utils.log( "User queued %s Feature films" % playlist.size(), xbmc.LOGNOTICE ) if not early_exit: header1 = header + " - Feature " + "%d" % playlist.size() message = __language__( 32543 ) + playlist[playlist.size() -1].getdescription() if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image) ) early_exit = False # If for some reason the limit does not get reached and the window changed, cancel script if playlist.size() < number_of_features and library_view != "oldway": if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, __language__( 32544 ), time_delay, image) ) _clear_playlists() else: mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info( feature = 0 ) plist = _store_playlist() # need to store movie playlist self._play_trivia( mpaa, genre, plist, equivalent_mpaa ) mplaylist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) mplaylist.clear() trigger_list = self.load_trigger_list() self.player.play( playlist ) count = -1 stop_check = 0 paused = False # wait until fullscreen video is shown while not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): pass while not playlist.getposition() == ( playlist.size() - 1 ): if playlist.getposition() > count: try: utils.log( "Item From Trigger List: %s" % trigger_list[ playlist.getposition() ], xbmc.LOGNOTICE ) except: utils.log( "Problem With Trigger List", xbmc.LOGNOTICE ) utils.log( "Playlist Position: %s Playlist Size: %s " % ( ( playlist.getposition() + 1 ), ( playlist.size() ) ), xbmc.LOGNOTICE ) if not playlist.getposition() == ( playlist.size() - 1 ): prev_trigger = Launch_automation().launch_automation( trigger_list[ playlist.getposition() ], prev_trigger ) count = playlist.getposition() else: break # Reached the last item in the playlist try: #if not self.player.isPlayingVideo() and not is_paused: if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): utils.log( "Video may have stopped", xbmc.LOGNOTICE ) xbmc.sleep( 5000 ) # wait 5 seconds for fullscreen video to show up(during playback) if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): # if fullscreen video does not show up, break and exit script messy_exit = True break except: if xbmc.getCondVisibility( "Container.Content(movies)" ): utils.log( "Video Definitely Stopped", xbmc.LOGNOTICE ) messy_exit = True break if not playlist.size() < 1 and not messy_exit: # To catch an already running script when a new instance started utils.log( "Playlist Position: %s Playlist Size: %s " % ( playlist.getposition() + 1, ( playlist.size() ) ), xbmc.LOGNOTICE ) prev_trigger = Launch_automation().launch_automation( trigger_list[ playlist.getposition() ], prev_trigger ) if trigger_list[ playlist.getposition() ] == "Movie": utils.log( "Item From Trigger List: %s" % trigger_list[ playlist.getposition() ], xbmc.LOGNOTICE ) else: utils.log( "Item From Trigger List: %s" % trigger_list[ playlist.getposition() ], xbmc.LOGNOTICE ) messy_exit = False xbmc.sleep(1000) self._wait_until_end() else: utils.log( "User might have pressed stop", xbmc.LOGNOTICE ) utils.log( "Stopping Script", xbmc.LOGNOTICE ) messy_exit = False return messy_exit
def _add_intermission_videos( self ): log( "Adding intermission Video(s)", xbmc.LOGNOTICE ) count = 0 index_count = 1 for feature in range( 1, self.playlistsize ): mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( feature = index_count ) #count = index_count # add intermission video if feature_settings[ "intermission_video" ] > 0: log( "Inserting intermission Video(s): %s" % feature_settings[ "intermission_video" ], xbmc.LOGNOTICE ) log( " playlist Position: %d" % index_count ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() log( " p_size: %d" % p_size ) _get_special_items( playlist=self.playlist, items=feature_settings[ "intermission_video" ], path=( feature_settings[ "intermission_video_file" ], feature_settings[ "intermission_video_folder" ], )[ feature_settings[ "intermission_video_type" ] == "folder" ], genre="Intermission", writer="Intermission", index=index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Intermission Label into Trigger List self.trigger_list.insert( index_count, "Intermission" ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size and feature_settings[ "intermission_video" ] > 1: index_count += feature_settings[ "intermission_video" ] - 1 elif xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size and feature_settings[ "intermission_video" ] == 1: index_count += feature_settings[ "intermission_video" ] # get rating video if video_settings[ "enable_ratings" ] and feature_settings[ "intermission_ratings" ] and video_settings[ "rating_videos_folder" ] != "": log( "Inserting Intermission Rating Video", xbmc.LOGNOTICE ) log( " playlist Position: %d" % index_count ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() log( " p_size: %d" % p_size ) _get_special_items( playlist=self.playlist, items=1 * ( video_settings[ "rating_videos_folder" ] != "" ), path=video_settings[ "rating_videos_folder" ] + mpaa + ".avi", genre="MPAA Rating", writer="MPAA Rating", index = index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Rating Label into Trigger List self.trigger_list.insert( index_count, "MPAA Rating" ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 # get Dolby/DTS videos if video_settings[ "enable_audio" ] and feature_settings[ "intermission_audio" ] and video_settings[ "audio_videos_folder" ]: log( "Inserting Intermission Audio Format Video", xbmc.LOGNOTICE ) log( " playlist Position: %d" % index_count ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() log( " p_size: %d" % p_size ) _get_special_items( playlist=self.playlist, items=1 * ( video_settings[ "audio_videos_folder" ] != "" ), path = video_settings[ "audio_videos_folder" ] + audio_formats.get( audio, "Other" ) + video_settings[ "audio_videos_folder" ][ -1 ], genre="Audio Format", writer="Audio Format", index = index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Audio Format Label into Trigger List self.trigger_list.insert( index_count, "Audio Format" ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 index_count += 1 # return info from first movie in playlist mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( 0 ) return mpaa, audio, genre, movie, equivalent_mpaa
def start_script( self, library_view = "oldway", original_autorefresh = 0 ): messy_exit = False utils.log( "Library_view: %s" % library_view, xbmc.LOGNOTICE ) early_exit = False movie_next = False prev_trigger = None self.video_window = xbmcgui.WindowXML( "script_CExperience-video.xml", __addon__.getAddonInfo('path'), "Default", "720p" ) self.video_window.show() autorefresh_movie = False self.autorefresh = original_autorefresh self.original_autorefresh = original_autorefresh if library_view != "oldway": xbmc.executebuiltin( "ActivateWindow(videolibrary,%s,return)" % library_view ) # wait until Video Library shows while not xbmc.getCondVisibility( "Container.Content(movies)" ): pass if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, __language__( 32546 ), 300000, image) ) # wait until playlist is full to the required number of features utils.log( "Waiting for queue to be filled with %s Feature films" % number_of_features, xbmc.LOGNOTICE ) count = 0 while playlist.size() < number_of_features: if playlist.size() > count: utils.log( "User queued %s of %s Feature films" % (playlist.size(), number_of_features), xbmc.LOGNOTICE ) header1 = header + " - Feature " + "%d" % playlist.size() message = __language__( 32543 ) + playlist[playlist.size() -1].getdescription() if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image) ) count = playlist.size() xbmc.sleep(time_delay*2) if not xbmc.getCondVisibility( "Container.Content(movies)" ): early_exit = True break utils.log( "User queued %s Feature films" % playlist.size(), xbmc.LOGNOTICE ) if not early_exit: header1 = header + " - Feature " + "%d" % playlist.size() message = __language__( 32543 ) + playlist[playlist.size() -1].getdescription() if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image) ) early_exit = False # If for some reason the limit does not get reached and the window changed, cancel script if playlist.size() < number_of_features and library_view != "oldway": if extra_settings[ "enable_notification" ]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, __language__( 32544 ), time_delay, image) ) _clear_playlists() else: mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info( feature = 0 ) plist = _store_playlist() # need to store movie playlist self._play_trivia( mpaa, genre, plist, equivalent_mpaa ) mplaylist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) mplaylist.clear() jsonquery = '''{"jsonrpc": "2.0", "method": "Settings.SetSettingValue", "params": { "setting": "screensaver.mode", "value": "None" }, "id": 1}''' jsonresponse = xbmc.executeJSONRPC( jsonquery ) trigger_list = self.load_trigger_list() self.player.play( playlist ) count = -1 stop_check = 0 paused = False # wait until fullscreen video is shown while not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): pass while ( not playlist.getposition() == ( playlist.size() - 1 ) or xbmcgui.Window( 10025 ).getProperty( "CinemaExperienceRunning" ) == "True" ): if playlist.getposition() > count: try: utils.log( "Item From Trigger List: %s" % trigger_list[ playlist.getposition() ], xbmc.LOGNOTICE ) except: utils.log( "Problem With Trigger List", xbmc.LOGNOTICE ) utils.log( "Playlist Position: %s Playlist Size: %s " % ( ( playlist.getposition() + 1 ), ( playlist.size() ) ), xbmc.LOGNOTICE ) if not playlist.getposition() == ( playlist.size() - 1 ): prev_trigger = Launch_automation().launch_automation( trigger_list[ playlist.getposition() ], prev_trigger ) if trigger_list[ playlist.getposition() ] == "Movie": if extra_settings[ "autorefresh" ] and extra_settings[ "autorefresh_movie" ]: self.auto_refresh( "enable" ) autorefresh_movie = True else: if extra_settings[ "autorefresh" ]: self.auto_refresh( "disable" ) autorefresh_movie = False utils.log( "[ script.cinema.experience ] - autorefresh_movie: %s" % autorefresh_movie ) count = playlist.getposition() else: break # Reached the last item in the playlist try: #if not self.player.isPlayingVideo() and not is_paused: if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): utils.log( "Video may have stopped", xbmc.LOGNOTICE ) xbmc.sleep( 5000 ) # wait 5 seconds for fullscreen video to show up(during playback) if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): # if fullscreen video does not show up, break and exit script messy_exit = True break except: if xbmc.getCondVisibility( "Container.Content(movies)" ): utils.log( "Video Definitely Stopped", xbmc.LOGNOTICE ) messy_exit = True break if not playlist.size() < 1 and not messy_exit: # To catch an already running script when a new instance started utils.log( "Playlist Position: %s Playlist Size: %s " % ( playlist.getposition() + 1, ( playlist.size() ) ), xbmc.LOGNOTICE ) prev_trigger = Launch_automation().launch_automation( trigger_list[ playlist.getposition() ], prev_trigger ) if trigger_list[ playlist.getposition() ] == "Movie": utils.log( "Item From Trigger List: %s" % trigger_list[ playlist.getposition() ], xbmc.LOGNOTICE ) if extra_settings[ "autorefresh" ] and extra_setting[ "autorefresh_movie" ]: self.auto_refresh( "enable" ) autorefresh_movie = True else: utils.log( "Item From Trigger List: %s" % trigger_list[ playlist.getposition() ], xbmc.LOGNOTICE ) if extra_settings[ "autorefresh" ]: self.auto_refresh( "disable" ) autorefresh_movie = False messy_exit = False xbmc.sleep(1000) self._wait_until_end() if extra_settings[ "autorefresh" ] and self.original_autorefresh > 0: self.auto_refresh( "enable" ) else: if extra_settings[ "autorefresh" ] and self.original_autorefresh > 0: self.auto_refresh( "enable" ) utils.log( "User might have pressed stop", xbmc.LOGNOTICE ) utils.log( "Stopping Script", xbmc.LOGNOTICE ) messy_exit = False return messy_exit
def _add_intermission_videos( self ): utils.log( "Adding intermission Video(s)", xbmc.LOGNOTICE ) count = 0 index_count = 1 for feature in range( 1, self.playlistsize ): mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info( feature = index_count ) if is_3d_movie and _3d_settings[ "enable_3d_intro" ]: if _3d_settings[ "3d_audio_videos_folder" ] and video_settings[ "enable_audio" ]: audio_videos_folder = _3d_settings[ "3d_audio_videos_folder" ] elif video_settings[ "enable_audio" ]: audio_videos_folder = video_settings[ "audio_videos_folder" ] if _3d_settings[ "3d_ratings_videos_folder" ] and video_settings[ "enable_ratings" ]: rating_videos_folder = _3d_settings[ "3d_rating_videos_folder" ] elif video_settings[ "enable_ratings" ]: rating_videos_folder = video_settings[ "rating_videos_folder" ] if _3d_settings[ "3d_intermission_video" ]: intermission_video_file = _3d_settings[ "3d_intermission_video_file" ] intermission_video_folder = _3d_settings[ "3d_intermission_video_folder" ] intermission_video = _3d_settings[ "3d_intermission_video" ] intermission_video_type = _3d_settings[ "3d_intermission_video_type" ] else: intermission_video_file = extra_settings[ "intermission_video_file" ] intermission_video_folder = extra_settings[ "intermission_video_folder" ] intermission_video = extra_settings[ "intermission_video" ] intermission_video_type = extra_settings[ "intermission_video_type" ] else: audio_videos_folder = video_settings[ "audio_videos_folder" ] rating_videos_folder = video_settings[ "rating_videos_folder" ] intermission_video_file = extra_settings[ "intermission_video_file" ] intermission_video_folder = extra_settings[ "intermission_video_folder" ] intermission_video = extra_settings[ "intermission_video" ] intermission_video_type = extra_settings[ "intermission_video_type" ] #count = index_count # add intermission video if extra_settings[ "intermission_video" ] > 0: utils.log( "Inserting intermission Video(s): %s" % intermission_video, xbmc.LOGNOTICE ) utils.log( " playlist Position: %d" % index_count ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() utils.log( " p_size: %d" % p_size ) _get_special_items( playlist=self.playlist, items=intermission_video, path=( intermission_video_file, intermission_video_folder, )[ intermission_video_type == "folder" ], genre="Intermission", writer="Intermission", index=index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Intermission Label into Trigger List self.trigger_list.insert( index_count, "Intermission" ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size and intermission_video > 1: index_count += extra_settings[ "intermission_video" ] - 1 elif xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size and intermission_video == 1: index_count += extra_settings[ "intermission_video" ] # get rating video if video_settings[ "enable_ratings" ] and extra_settings[ "intermission_ratings" ] and rating_videos_folder != "": utils.log( "Inserting Intermission Rating Video", xbmc.LOGNOTICE ) utils.log( " playlist Position: %d" % index_count ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() utils.log( " p_size: %d" % p_size ) _get_special_items( playlist=self.playlist, items=1 * ( rating_videos_folder != "" ), path=rating_videos_folder + mpaa + ".avi", genre="Movie Rating", writer="Movie Rating", index = index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Rating Label into Trigger List self.trigger_list.insert( index_count, "MPAA Rating" ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 # get Dolby/DTS videos if video_settings[ "enable_audio" ] and extra_settings[ "intermission_audio" ] and audio_videos_folder: utils.log( "Inserting Intermission Audio Format Video", xbmc.LOGNOTICE ) utils.log( " playlist Position: %d" % index_count ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() utils.log( " p_size: %d" % p_size ) _get_special_items( playlist=self.playlist, items=1 * ( audio_videos_folder != "" ), path = audio_videos_folder + audio_formats.get( audio, "Other" ) + audio_videos_folder[ -1 ], genre="Audio Format", writer="Audio Format", index = index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Audio Format Label into Trigger List self.trigger_list.insert( index_count, "Audio Format" ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 index_count += 1 # return info from first movie in playlist mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info( 0 ) return mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie
def _add_intermission_videos(self): log("Adding intermission Video(s)", xbmc.LOGNOTICE) count = 0 index_count = 1 for feature in range(1, self.playlistsize): mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( feature=index_count) #count = index_count # add intermission video if feature_settings["intermission_video"] > 0: log( "Inserting intermission Video(s): %s" % feature_settings["intermission_video"], xbmc.LOGNOTICE) log(" playlist Position: %d" % index_count) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() log(" p_size: %d" % p_size) _get_special_items( playlist=self.playlist, items=feature_settings["intermission_video"], path=( feature_settings["intermission_video_file"], feature_settings["intermission_video_folder"], )[feature_settings["intermission_video_type"] == "folder"], genre="Intermission", writer="Intermission", index=index_count) for count in range( 0, (xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size)): # Insert Intermission Label into Trigger List self.trigger_list.insert(index_count, "Intermission") if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size( ) > p_size and feature_settings["intermission_video"] > 1: index_count += feature_settings["intermission_video"] - 1 elif xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size( ) > p_size and feature_settings["intermission_video"] == 1: index_count += feature_settings["intermission_video"] # get rating video if video_settings["enable_ratings"] and feature_settings[ "intermission_ratings"] and video_settings[ "rating_videos_folder"] != "": log("Inserting Intermission Rating Video", xbmc.LOGNOTICE) log(" playlist Position: %d" % index_count) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() log(" p_size: %d" % p_size) _get_special_items( playlist=self.playlist, items=1 * (video_settings["rating_videos_folder"] != ""), path=video_settings["rating_videos_folder"] + mpaa + ".avi", genre="MPAA Rating", writer="MPAA Rating", index=index_count) for count in range( 0, (xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size)): # Insert Rating Label into Trigger List self.trigger_list.insert(index_count, "MPAA Rating") if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 # get Dolby/DTS videos if video_settings["enable_audio"] and feature_settings[ "intermission_audio"] and video_settings[ "audio_videos_folder"]: log("Inserting Intermission Audio Format Video", xbmc.LOGNOTICE) log(" playlist Position: %d" % index_count) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() log(" p_size: %d" % p_size) _get_special_items( playlist=self.playlist, items=1 * (video_settings["audio_videos_folder"] != ""), path=video_settings["audio_videos_folder"] + audio_formats.get(audio, "Other") + video_settings["audio_videos_folder"][-1], genre="Audio Format", writer="Audio Format", index=index_count) for count in range( 0, (xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size)): # Insert Audio Format Label into Trigger List self.trigger_list.insert(index_count, "Audio Format") if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 index_count += 1 # return info from first movie in playlist mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info(0) return mpaa, audio, genre, movie, equivalent_mpaa
def _add_intermission_videos(self): utils.log("Adding intermission Video(s)", xbmc.LOGNOTICE) count = 0 index_count = 1 for feature in range(1, self.playlistsize): mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info( feature=index_count) if is_3d_movie and _3d_settings["enable_3d_intro"]: if _3d_settings["3d_audio_videos_folder"] and video_settings[ "enable_audio"]: audio_videos_folder = _3d_settings[ "3d_audio_videos_folder"] elif video_settings["enable_audio"]: audio_videos_folder = video_settings["audio_videos_folder"] if _3d_settings["3d_ratings_videos_folder"] and video_settings[ "enable_ratings"]: rating_videos_folder = _3d_settings[ "3d_rating_videos_folder"] elif video_settings["enable_ratings"]: rating_videos_folder = video_settings[ "rating_videos_folder"] if _3d_settings["3d_intermission_video"]: intermission_video_file = _3d_settings[ "3d_intermission_video_file"] intermission_video_folder = _3d_settings[ "3d_intermission_video_folder"] intermission_video = _3d_settings["3d_intermission_video"] intermission_video_type = _3d_settings[ "3d_intermission_video_type"] else: intermission_video_file = extra_settings[ "intermission_video_file"] intermission_video_folder = extra_settings[ "intermission_video_folder"] intermission_video = extra_settings["intermission_video"] intermission_video_type = extra_settings[ "intermission_video_type"] else: audio_videos_folder = video_settings["audio_videos_folder"] rating_videos_folder = video_settings["rating_videos_folder"] intermission_video_file = extra_settings[ "intermission_video_file"] intermission_video_folder = extra_settings[ "intermission_video_folder"] intermission_video = extra_settings["intermission_video"] intermission_video_type = extra_settings[ "intermission_video_type"] #count = index_count # add intermission video if extra_settings["intermission_video"] > 0: utils.log( "Inserting intermission Video(s): %s" % intermission_video, xbmc.LOGNOTICE) utils.log(" playlist Position: %d" % index_count) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() utils.log(" p_size: %d" % p_size) _get_special_items(playlist=self.playlist, items=intermission_video, path=( intermission_video_file, intermission_video_folder, )[intermission_video_type == "folder"], genre="Intermission", writer="Intermission", index=index_count) for count in range( 0, (xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size)): # Insert Intermission Label into Trigger List self.trigger_list.insert(index_count, "Intermission") if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size( ) > p_size and intermission_video > 1: index_count += extra_settings["intermission_video"] - 1 elif xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size( ) > p_size and intermission_video == 1: index_count += extra_settings["intermission_video"] # get rating video if video_settings["enable_ratings"] and extra_settings[ "intermission_ratings"] and rating_videos_folder != "": utils.log("Inserting Intermission Rating Video", xbmc.LOGNOTICE) utils.log(" playlist Position: %d" % index_count) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() utils.log(" p_size: %d" % p_size) _get_special_items(playlist=self.playlist, items=1 * (rating_videos_folder != ""), path=rating_videos_folder + mpaa + ".avi", genre="Movie Rating", writer="Movie Rating", index=index_count) for count in range( 0, (xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size)): # Insert Rating Label into Trigger List self.trigger_list.insert(index_count, "MPAA Rating") if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 # get Dolby/DTS videos if video_settings["enable_audio"] and extra_settings[ "intermission_audio"] and audio_videos_folder: utils.log("Inserting Intermission Audio Format Video", xbmc.LOGNOTICE) utils.log(" playlist Position: %d" % index_count) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() utils.log(" p_size: %d" % p_size) _get_special_items(playlist=self.playlist, items=1 * (audio_videos_folder != ""), path=audio_videos_folder + audio_formats.get(audio, "Other") + audio_videos_folder[-1], genre="Audio Format", writer="Audio Format", index=index_count) for count in range( 0, (xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size)): # Insert Audio Format Label into Trigger List self.trigger_list.insert(index_count, "Audio Format") if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 index_count += 1 # return info from first movie in playlist mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info( 0) return mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie
def _add_intermission_videos( self ): xbmc.log( "[script.cinema.experience] - Adding intermission Video(s)", level=xbmc.LOGNOTICE ) count = 0 index_count = 1 for feature in range( 1, self.playlistsize ): mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( index_count ) #count = index_count # add intermission video if int( _S_( "intermission_video") ) > 0: xbmc.log( "[script.cinema.experience] - Inserting intermission Video(s): %s" % (0, 1, 1, 2, 3, 4, 5,)[ int( _S_( "intermission_video" ) ) ], level=xbmc.LOGNOTICE ) xbmc.log( "[script.cinema.experience] - playlist Position: %d" % index_count, level=xbmc.LOGDEBUG ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() xbmc.log( "[script.cinema.experience] - p_size: %d" % p_size, level=xbmc.LOGDEBUG ) _get_special_items( playlist=self.playlist, items=( 0, 1, 1, 2, 3, 4, 5, )[ int( _S_( "intermission_video" ) ) ], path=( xbmc.translatePath( _S_( "intermission_video_file" ) ), xbmc.translatePath( _S_( "intermission_video_folder" ) ), )[ int( _S_( "intermission_video" ) ) > 1 ], genre=_L_( 32612 ), writer=_L_( 32612 ), index=index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Intermission Label into Trigger List self.trigger_list.insert( index_count, _L_( 32612 ) ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size and int( _S_( "intermission_video" ) ) > 1: index_count += int( _S_( "intermission_video" ) ) - 1 elif xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size and int( _S_( "intermission_video" ) ) == 1: index_count += int( _S_( "intermission_video" ) ) # get rating video if ( _S_( "enable_ratings" ) ) == "true" and (_S_( "intermission_ratings") ) == "true": xbmc.log( "[script.cinema.experience] - Inserting Intermission Rating Video",level=xbmc.LOGNOTICE ) xbmc.log( "[script.cinema.experience] - playlist Position: %d" % index_count, level=xbmc.LOGDEBUG ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() xbmc.log( "[script.cinema.experience] - p_size: %d" % p_size, level=xbmc.LOGDEBUG ) _get_special_items( playlist=self.playlist, items=1 * ( _S_( "rating_videos_folder" ) != "" ), path=xbmc.translatePath( _S_( "rating_videos_folder" ) ) + mpaa + ".avi", genre=_L_( 32603 ), writer=_L_( 32603 ), index = index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Rating Label into Trigger List self.trigger_list.insert( index_count, _L_( 32603 ) ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 # get Dolby/DTS videos if ( _S_( "enable_audio" ) ) == "true" and (_S_( "intermission_audio") ) == "true": xbmc.log( "[script.cinema.experience] - Inserting Intermission Audio Format Video",level=xbmc.LOGNOTICE ) xbmc.log( "[script.cinema.experience] - playlist Position: %d" % index_count, level=xbmc.LOGDEBUG ) p_size = xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() xbmc.log( "[script.cinema.experience] - p_size: %d" % p_size, level=xbmc.LOGDEBUG ) _get_special_items( playlist=self.playlist, items=1 * ( _S_( "audio_videos_folder" ) != "" ), path = xbmc.translatePath( _S_( "audio_videos_folder" ) ) + { "dca": "DTS", "ac3": "Dolby", "dtsma": "DTSHD-MA", "dtshd_ma": "DTSHD-MA", "a_truehd": "Dolby TrueHD", "truehd": "Dolby TrueHD" }.get( audio, "Other" ) + xbmc.translatePath( _S_( "audio_videos_folder" ) )[ -1 ], genre=_L_( 32606 ), writer=_L_( 32606 ), index = index_count ) for count in range( 0, ( xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() - p_size ) ): # Insert Audio Format Label into Trigger List self.trigger_list.insert( index_count, _L_( 32606 ) ) if xbmc.PlayList(xbmc.PLAYLIST_VIDEO).size() > p_size: index_count += 1 index_count += 1 # return info from first movie in playlist mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( 0 ) return mpaa, audio, genre, movie, equivalent_mpaa
def start_script(self, library_view="oldway", original_autorefresh=0): messy_exit = False utils.log("Library_view: %s" % library_view, xbmc.LOGNOTICE) early_exit = False movie_next = False prev_trigger = None self.video_window = xbmcgui.WindowXML("script_CExperience-video.xml", __addon__.getAddonInfo('path'), "Default", "720p") self.video_window.show() autorefresh_movie = False self.autorefresh = original_autorefresh self.original_autorefresh = original_autorefresh if library_view != "oldway": xbmc.executebuiltin("ActivateWindow(videolibrary,%s,return)" % library_view) # wait until Video Library shows while not xbmc.getCondVisibility("Container.Content(movies)"): pass if extra_settings["enable_notification"]: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % (header, __language__(32546), 300000, image)) # wait until playlist is full to the required number of features utils.log( "Waiting for queue to be filled with %s Feature films" % number_of_features, xbmc.LOGNOTICE) count = 0 while playlist.size() < number_of_features: if playlist.size() > count: utils.log( "User queued %s of %s Feature films" % (playlist.size(), number_of_features), xbmc.LOGNOTICE) header1 = header + " - Feature " + "%d" % playlist.size() message = __language__(32543) + playlist[ playlist.size() - 1].getdescription() if extra_settings["enable_notification"]: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image)) count = playlist.size() xbmc.sleep(time_delay * 2) if not xbmc.getCondVisibility("Container.Content(movies)"): early_exit = True break utils.log("User queued %s Feature films" % playlist.size(), xbmc.LOGNOTICE) if not early_exit: header1 = header + " - Feature " + "%d" % playlist.size() message = __language__(32543) + playlist[playlist.size() - 1].getdescription() if extra_settings["enable_notification"]: xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image)) early_exit = False # If for some reason the limit does not get reached and the window changed, cancel script if playlist.size() < number_of_features and library_view != "oldway": if extra_settings["enable_notification"]: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % (header, __language__(32544), time_delay, image)) _clear_playlists() else: mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info( feature=0) plist = _store_playlist() # need to store movie playlist self._play_trivia(mpaa, genre, plist, equivalent_mpaa) mplaylist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) mplaylist.clear() jsonquery = '''{"jsonrpc": "2.0", "method": "Settings.SetSettingValue", "params": { "setting": "screensaver.mode", "value": "None" }, "id": 1}''' jsonresponse = xbmc.executeJSONRPC(jsonquery) trigger_list = self.load_trigger_list() self.player.play(playlist) count = -1 stop_check = 0 paused = False # wait until fullscreen video is shown while not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)"): pass while (not playlist.getposition() == (playlist.size() - 1) or xbmcgui.Window(10025).getProperty("CinemaExperienceRunning") == "True"): if playlist.getposition() > count: try: utils.log( "Item From Trigger List: %s" % trigger_list[playlist.getposition()], xbmc.LOGNOTICE) except: utils.log("Problem With Trigger List", xbmc.LOGNOTICE) utils.log( "Playlist Position: %s Playlist Size: %s " % ((playlist.getposition() + 1), (playlist.size())), xbmc.LOGNOTICE) if not playlist.getposition() == (playlist.size() - 1): prev_trigger = Launch_automation().launch_automation( trigger_list[playlist.getposition()], prev_trigger) if trigger_list[playlist.getposition()] == "Movie": if extra_settings["autorefresh"] and extra_settings[ "autorefresh_movie"]: self.auto_refresh("enable") autorefresh_movie = True else: if extra_settings["autorefresh"]: self.auto_refresh("disable") autorefresh_movie = False utils.log( "[ script.cinema.experience ] - autorefresh_movie: %s" % autorefresh_movie) count = playlist.getposition() else: break # Reached the last item in the playlist try: #if not self.player.isPlayingVideo() and not is_paused: if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)"): utils.log("Video may have stopped", xbmc.LOGNOTICE) xbmc.sleep( 5000 ) # wait 5 seconds for fullscreen video to show up(during playback) if not xbmc.getCondVisibility( "Window.IsActive(fullscreenvideo)" ): # if fullscreen video does not show up, break and exit script messy_exit = True break except: if xbmc.getCondVisibility("Container.Content(movies)"): utils.log("Video Definitely Stopped", xbmc.LOGNOTICE) messy_exit = True break if not playlist.size( ) < 1 and not messy_exit: # To catch an already running script when a new instance started utils.log( "Playlist Position: %s Playlist Size: %s " % (playlist.getposition() + 1, (playlist.size())), xbmc.LOGNOTICE) prev_trigger = Launch_automation().launch_automation( trigger_list[playlist.getposition()], prev_trigger) if trigger_list[playlist.getposition()] == "Movie": utils.log( "Item From Trigger List: %s" % trigger_list[playlist.getposition()], xbmc.LOGNOTICE) if extra_settings["autorefresh"] and extra_setting[ "autorefresh_movie"]: self.auto_refresh("enable") autorefresh_movie = True else: utils.log( "Item From Trigger List: %s" % trigger_list[playlist.getposition()], xbmc.LOGNOTICE) if extra_settings["autorefresh"]: self.auto_refresh("disable") autorefresh_movie = False messy_exit = False xbmc.sleep(1000) self._wait_until_end() if extra_settings[ "autorefresh"] and self.original_autorefresh > 0: self.auto_refresh("enable") else: if extra_settings[ "autorefresh"] and self.original_autorefresh > 0: self.auto_refresh("enable") utils.log("User might have pressed stop", xbmc.LOGNOTICE) utils.log("Stopping Script", xbmc.LOGNOTICE) messy_exit = False return messy_exit