Exemple #1
0
 def _shuffle_trailers( self ):
     # randomize the groups and create our play list
     log( "%s - Shuffling Trailers" % logmessage, xbmc.LOGNOTICE )
     shuffle( self.tmp_trailers )
     # reset counter
     count = 0
     # now create our final playlist
     for trailer in self.tmp_trailers:
         # user preference to skip watch trailers
         if ( self.settings[ "trailer_unwatched_only" ] and xbmc.getCacheThumbName( trailer ) in self.watched ):
             continue
         # add trailer to our final list
         trailer_info = _set_trailer_info( trailer )
         trailer_genre = trailer_info[ 9 ].split(" / ")
         trailer_rating = trailer_info[ 6 ].replace("Rated ", "")
         if self.settings[ "trailer_limit_genre" ] and ( not list(set(trailer_genre) & set(self.genre) ) ):
             log( "%s - Genre Not Matched - Skipping Trailer" % logmessage )
             continue
         if self.settings[ "trailer_limit_mpaa" ] and ( not trailer_rating or not trailer_rating == self.mpaa ):
             log( "%s - MPAA Not Matched - Skipping Trailer" % logmessage )
             continue
         self.trailers += [ trailer_info ]
         # add id to watched file TODO: maybe don't add if not user preference
         self.watched += [ xbmc.getCacheThumbName( trailer ) ]
         # increment counter
         count += 1
         # if we have enough exit
         if ( count == self.settings[ "trailer_count" ] ):
             break
     if ( len(self.trailers) == 0 and self.settings[ "trailer_unwatched_only" ] and len( self.watched ) > 0 ):
         self._reset_watched()
         #attempt to load our playlist again
         self._shuffle_trailers()
 def _shuffle_trailers( self ):
     # randomize the groups and create our play list
     utils.log( "Shuffling Trailers", xbmc.LOGNOTICE )
     shuffle( self.tmp_trailers )
     count = 0
     # now create our final playlist
     for trailer in self.tmp_trailers:
         # user preference to skip watch trailers
         if ( self.settings[ "trailer_unwatched_only" ] and xbmc.getCacheThumbName( trailer ) in self.watched ):
             continue
         # add trailer to our final list
         trailer_info = _set_trailer_info( trailer )
         trailer_genre = trailer_info[ 9 ].split(" / ")
         trailer_rating = trailer_info[ 6 ].replace("Rated ", "")
         if self.settings[ "trailer_limit_genre" ]:
             if len( set( trailer_genre ).intersection( self.genre ) ) < 1:
                 utils.log("Genre Not Matched - Skipping Trailer: %s != %s" % (trailer_genre, self.genre) )
                 continue
         if self.settings[ "trailer_limit_mpaa" ]:
             trailer_mpaa = self.mpaa_ratings.index( trailer_rating )
             if trailer_mpaa > self.mpaa:
                 utils.log("MPAA too high - Skipping Trailer: %s > %s" % ( trailer_rating, self.mpaa_ratings[ self.mpaa ] ) )
                 continue 
         self.trailers += [ trailer_info ]
         # add id to watched file TODO: maybe don't add if not user preference
         self.watched += [ xbmc.getCacheThumbName( trailer ) ]
         # increment counter
         count += 1
         # if we have enough exit
         if ( count == self.settings[ "trailer_count" ] ):
             break
     if ( len( self.trailers ) == 0 and self.settings[ "trailer_unwatched_only" ] and len( self.watched ) > 0 ):
         self._reset_watched()
         #attempt to load our playlist again
         self._shuffle_trailers()
 def _check_trailers( self ):
     if trailer_settings[ "trailer_play_mode" ] == 1:
         path = os.path.join( BASE_CURRENT_SOURCE_PATH, "downloaded_trailers.txt" )
         if xbmcvfs.exists( path ):
             log( "File Exists: downloaded_trailers.txt" )
             trailer_list = self._load_trailer_list()
             if trailer_list:
                 for trailer in trailer_list:
                     trailer_detail = _set_trailer_info( trailer )
                     self.downloaded_trailers += trailer_detail
             else:
                 # Change trailer play mode to stream if no download 
                 log( "Empty File: downloaded_trailers.txt" )
                 _A_.setSetting( id='trailer_play_mode', value='%d' % 0 )
         else:
             # Change trailer play mode to stream if no download 
             log( "File Does Not Exists: downloaded_trailers.txt" )
             _A_.setSetting( id='trailer_play_mode', value='%d' % 0 )
     else:
         pass
 def _check_trailers( self ):
     if int( _S_( "trailer_play_mode" ) ) == 1:
         path = os.path.join( BASE_CURRENT_SOURCE_PATH, "downloaded_trailers.txt" )
         if xbmc.executehttpapi( "FileExists(%s)" % ( path, ) )== "<li>True":
             xbmc.log( "[script.cinema.experience] - File Exists: downloaded_trailers.txt", level=xbmc.LOGDEBUG )
             trailer_list = self._load_trailer_list()
             if trailer_list:
                 for trailer in trailer_list:
                     trailer_detail = _set_trailer_info( trailer )
                     self.downloaded_trailers += trailer_detail
             else:
                 # Change trailer play mode to stream if no download 
                 xbmc.log( "[script.cinema.experience] - Empty File: downloaded_trailers.txt", level=xbmc.LOGDEBUG )
                 _A_.setSetting( id='trailer_play_mode', value='%d' % 0 )
         else:
             # Change trailer play mode to stream if no download 
             xbmc.log( "[script.cinema.experience] - File Does Not Exists: downloaded_trailers.txt", level=xbmc.LOGDEBUG )
             _A_.setSetting( id='trailer_play_mode', value='%d' % 0 )
     else:
         pass
 def _check_trailers(self):
     if trailer_settings["trailer_play_mode"] == 1:
         path = os.path.join(BASE_CURRENT_SOURCE_PATH,
                             "downloaded_trailers.txt")
         if xbmcvfs.exists(path):
             log("File Exists: downloaded_trailers.txt")
             trailer_list = self._load_trailer_list()
             if trailer_list:
                 for trailer in trailer_list:
                     trailer_detail = _set_trailer_info(trailer)
                     self.downloaded_trailers += trailer_detail
             else:
                 # Change trailer play mode to stream if no download
                 log("Empty File: downloaded_trailers.txt")
                 _A_.setSetting(id='trailer_play_mode', value='%d' % 0)
         else:
             # Change trailer play mode to stream if no download
             log("File Does Not Exists: downloaded_trailers.txt")
             _A_.setSetting(id='trailer_play_mode', value='%d' % 0)
     else:
         pass
Exemple #6
0
 def _shuffle_trailers(self):
     # randomize the groups and create our play list
     utils.log("Shuffling Trailers", xbmc.LOGNOTICE)
     shuffle(self.tmp_trailers)
     count = 0
     # now create our final playlist
     for trailer in self.tmp_trailers:
         # user preference to skip watch trailers
         if (self.settings["trailer_unwatched_only"]
                 and xbmc.getCacheThumbName(trailer) in self.watched):
             continue
         # add trailer to our final list
         trailer_info = _set_trailer_info(trailer)
         trailer_genre = trailer_info[9].split(" / ")
         trailer_rating = trailer_info[6].replace("Rated ", "")
         if self.settings["trailer_limit_genre"]:
             if len(set(trailer_genre).intersection(self.genre)) < 1:
                 utils.log(
                     "Genre Not Matched - Skipping Trailer: %s != %s" %
                     (trailer_genre, self.genre))
                 continue
         if self.settings["trailer_limit_mpaa"]:
             trailer_mpaa = self.mpaa_ratings.index(trailer_rating)
             if trailer_mpaa > self.mpaa:
                 utils.log("MPAA too high - Skipping Trailer: %s > %s" %
                           (trailer_rating, self.mpaa_ratings[self.mpaa]))
                 continue
         self.trailers += [trailer_info]
         # add id to watched file TODO: maybe don't add if not user preference
         self.watched += [xbmc.getCacheThumbName(trailer)]
         # increment counter
         count += 1
         # if we have enough exit
         if (count == self.settings["trailer_count"]):
             break
     if (len(self.trailers) == 0 and self.settings["trailer_unwatched_only"]
             and len(self.watched) > 0):
         self._reset_watched()
         #attempt to load our playlist again
         self._shuffle_trailers()