def add_movies_week(self, listcontainersort): for program in var.MovieSearchDataJson['resultObj']['containers']: try: #Load program basics ProgramName = metadatainfo.programtitle_from_json_metadata( program, True) #Check if there are search results if var.SearchFilterTerm != '': searchMatch = func.search_filter_string(ProgramName) searchResultFound = var.SearchFilterTerm in searchMatch if searchResultFound == False: continue #Load program details ExternalId = metadatainfo.externalChannelId_from_json_metadata( program) PictureUrl = metadatainfo.pictureUrl_from_json_metadata( program) ProgramId = metadatainfo.contentId_from_json_metadata(program) ProgramYear = metadatainfo.programyear_from_json_metadata( program) ProgramSeason = metadatainfo.programseason_from_json_metadata( program) ProgramStarRating = metadatainfo.programstarrating_from_json_metadata( program) ProgramAgeRating = metadatainfo.programagerating_from_json_metadata( program) ProgramDuration = metadatainfo.programdurationstring_from_json_metadata( program) ProgramDescription = metadatainfo.programdescription_from_json_metadata( program) ProgramAvailability = metadatainfo.vod_week_available_time( program) #Combine program details stringJoin = [ ProgramYear, ProgramSeason, ProgramStarRating, ProgramAgeRating, ProgramDuration ] ProgramDetails = ' '.join(filter(None, stringJoin)) if func.string_isnullorempty(ProgramDetails): ProgramDetails = '(?)' ProgramDetails = '[COLOR gray]' + ProgramDetails + '[/COLOR]' #Add week program listitem = xbmcgui.ListItem() listitem.setProperty('Action', 'play_stream_week') listitem.setProperty('ProgramId', ProgramId) listitem.setProperty("ProgramName", ProgramName) listitem.setProperty("ProgramWeek", 'true') listitem.setProperty("ProgramDetails", ProgramDetails) listitem.setProperty("ProgramAvailability", ProgramAvailability) listitem.setProperty('ProgramDescription', ProgramDescription) listitem.setInfo('video', { 'Genre': 'Films', 'Plot': ProgramDescription }) iconStreamType = "common/calendarweek.png" iconProgram = path.icon_epg(PictureUrl) iconChannel = path.icon_television(ExternalId) listitem.setArt({ 'thumb': iconProgram, 'icon': iconProgram, 'image1': iconStreamType, 'image2': iconChannel }) listcontainersort.append(listitem) except: continue
def load_episodes_week(self, listItem, selectList=False): #Get the selected parentid selectedSeriesName = listItem.getProperty('ProgramName') selectedPictureUrl = listItem.getProperty('PictureUrl') #Get and check the list container listcontainer = self.getControl(1002) listcontainer.reset() listcontainersort = [] #Update the episodes status func.updateLabelText(self, 2, 'Afleveringen laden') #Process all the episodes for program in var.SeriesSearchDataJson["resultObj"]["containers"]: try: #Load program basics ProgramName = metadatainfo.programtitle_from_json_metadata( program, True) #Check if program matches serie checkSerie1 = ProgramName.lower() checkSerie2 = selectedSeriesName.lower() if checkSerie1 != checkSerie2: continue #Load program details ProgramId = metadatainfo.contentId_from_json_metadata(program) ProgramSeasonInt = metadatainfo.programseason_from_json_metadata( program, False) ProgramEpisodeInt = metadatainfo.episodenumber_from_json_metadata( program, False) EpisodeTitle = metadatainfo.episodetitle_from_json_metadata( program, False, ProgramName) ProgramYear = metadatainfo.programyear_from_json_metadata( program) ProgramSeason = metadatainfo.programseason_from_json_metadata( program) ProgramEpisode = metadatainfo.episodenumber_from_json_metadata( program) ProgramDuration = metadatainfo.programdurationstring_from_json_metadata( program) ProgramDescription = metadatainfo.programdescription_from_json_metadata( program) ProgramAvailability = metadatainfo.vod_week_available_time( program) #Combine program details stringJoin = [ ProgramYear, ProgramSeason, ProgramEpisode, ProgramDuration ] ProgramDetails = ' '.join(filter(None, stringJoin)) if func.string_isnullorempty(ProgramDetails): ProgramDetails = '(?)' ProgramDetails = '[COLOR gray]' + ProgramDetails + '[/COLOR]' #Add vod program listitem = xbmcgui.ListItem() listitem.setProperty('Action', 'play_episode_week') listitem.setProperty('ProgramId', ProgramId) listitem.setProperty("ProgramName", EpisodeTitle) listitem.setProperty("ProgramSeasonInt", ProgramSeasonInt) listitem.setProperty("ProgramEpisodeInt", ProgramEpisodeInt) listitem.setProperty('ProgramDetails', ProgramDetails) listitem.setProperty("ProgramAvailability", ProgramAvailability) listitem.setProperty('ProgramDescription', ProgramDescription) listitem.setInfo('video', { 'Genre': selectedSeriesName, 'Plot': ProgramDescription }) listitem.setArt({ 'thumb': path.icon_epg(selectedPictureUrl), 'icon': path.icon_epg(selectedPictureUrl) }) listcontainersort.append(listitem) except: continue #Sort and add episodes listcontainersort.sort( key=lambda x: (int(x.getProperty('ProgramSeasonInt')), int(x.getProperty('ProgramEpisodeInt')))) listcontainer.addItems(listcontainersort) #Update the episodes status func.updateLabelText( self, 2, selectedSeriesName + ' (' + str(listcontainer.size()) + ' afleveringen)') #Select the list container if selectList == True and listcontainer.size() > 0: self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100)