def thread_channel_delay_timer(self): while var.thread_channel_delay_timer != None and var.addonmonitor.abortRequested( ) == False and func.check_addon_running() == True: xbmc.sleep(100) interactSecond = 3 lastInteractSeconds = int( (datetime.now() - var.ChannelDelayDateTime).total_seconds()) #Channel information listcontainer = self.getControl(1001) listItemSelected = listcontainer.getSelectedItem() channelNameProp = listItemSelected.getProperty("ChannelName") channelNumberProp = listItemSelected.getProperty("ChannelNumber") #Countdown string delayCountInt = interactSecond - lastInteractSeconds delayCountString = '[COLOR gray]' + str( delayCountInt ) + '[/COLOR] ' + func.get_provider_color_string( ) + channelNumberProp + '[/COLOR] [COLOR white]' + channelNameProp + '[/COLOR]' #Show remaining time func.updateLabelText(self, 7001, delayCountString) self.setProperty('ZapVisible', 'true') #Change the channel if lastInteractSeconds >= interactSecond: #Reset channel wait variables var.thread_channel_delay_timer = None self.setProperty('ZapVisible', 'false') #Switch to selected channel stream.switch_channel_tv_listitem(listItemSelected, False, False)
def thread_zap_wait_timer(_self, selectMode, clickOnSelection): while var.thread_zap_wait_timer != None and var.addonmonitor.abortRequested( ) == False and func.check_addon_running() == True: xbmc.sleep(100) interactSecond = 3 lastInteractSeconds = int( (datetime.now() - var.ZapDelayDateTime).total_seconds()) if var.ZapTimerForce or lastInteractSeconds >= interactSecond or len( var.ZapNumberString) == 4: #Handle remote action if selectMode: select_remote_number(_self, clickOnSelection) else: zap_remote_number(_self) #Hide remote number popup _self.setProperty('ZapVisible', 'false') func.updateLabelText(_self, 7001, '') #Reset remote variables var.ZapControlId = 0 var.ZapNumberString = '' var.ZapHintString = '' var.ZapTimerForce = False var.thread_zap_wait_timer = None else: #Countdown string zapCountInt = interactSecond - lastInteractSeconds zapCountDownString = '[COLOR gray]' + str( zapCountInt) + '[/COLOR] ' + var.ZapHintString #Show remote number popup func.updateLabelText(_self, 7001, zapCountDownString) _self.setProperty('ZapVisible', 'true')
def onInit(self): #Set the schedule window text func.updateLabelText(self, 3000, 'Geplande Opnames') func.updateLabelText(self, 4001, 'Opnames vernieuwen') func.updateVisibility(self, 4001, True) #Load all current set recording self.load_recording(False)
def load_recording_series(self, forceUpdate=False, silentUpdate=False): if silentUpdate == False: func.updateLabelText(self, 1, 'Series downloaden') func.updateLabelText( self, 2, 'Series worden gedownload, nog even geduld...') #Download the recording programs downloadResult = download.download_recording_series(forceUpdate) if downloadResult == False: return False
def onInit(self): func.updateLabelText(self, 2, "Gister Gemist") self.buttons_add_navigation() #Check if the day has changed dateTimeNowString = datetime.now().strftime('%Y-%m-%d') dateTimeYesterdayString = var.YesterdaySearchLastUpdate.strftime('%Y-%m-%d') ForceDownloadUpdate = dateTimeYesterdayString != dateTimeNowString self.load_program(False, ForceDownloadUpdate)
def set_remote_number(_self, ZapNumberPress, selectMode, clickOnSelection): var.ZapDelayDateTime = datetime.now() var.ZapNumber += str(ZapNumberPress) func.updateLabelText(_self, 7001, str(var.ZapNumber)) _self.setProperty('ZapVisible', 'true') if var.thread_zap_wait_timer == None: var.thread_zap_wait_timer = Thread(target=thread_zap_wait_timer, args=(_self, selectMode, clickOnSelection)) var.thread_zap_wait_timer.start()
def onInit(self): #Load search history searchhistory.search_json_load() #Prepare the search page func.updateLabelText(self, 2, "Zoeken") self.buttons_add_navigation() listcontainer = self.getControl(1000) if listcontainer.size() == 0: if var.SearchDownloadResultJson == []: self.search_program() else: self.search_list(var.SearchDownloadResultJson)
def search_program(self): #Keyboard enter search term keyboard = xbmc.Keyboard('default', 'heading') keyboard.setHeading('Zoek programma') keyboard.setDefault('') keyboard.setHiddenInput(False) keyboard.doModal() if keyboard.isConfirmed() == True: searchProgramName = keyboard.getText() else: func.updateLabelText(self, 1, 'Geen zoek term') listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(1) xbmc.sleep(100) return False #Check the search term if func.string_isnullorempty(searchProgramName) == True: func.updateLabelText(self, 1, 'Leeg zoek term') listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(1) xbmc.sleep(100) return False #Add search history to Json searchhistory.search_add(searchProgramName) #Download the search programs func.updateLabelText(self, 1, "Zoek resultaat downloaden") downloadResult = download.download_search_program(searchProgramName) if downloadResult == None: func.updateLabelText(self, 1, 'Zoeken mislukt') listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) return False #Update the search result var.SearchDownloadSearchTerm = searchProgramName var.SearchDownloadResultJson = downloadResult #List the search results func.updateLabelText(self, 1, "Zoek resultaat laden") self.search_list(var.SearchDownloadResultJson)
def count_radio(self, resetSelect=False): listcontainer = self.getControl(1000) if listcontainer.size() > 0: if var.SearchFilterTerm != '': func.updateLabelText( self, 1, str(listcontainer.size()) + ' gevonden zenders') else: func.updateLabelText(self, 1, str(listcontainer.size()) + ' zenders') if resetSelect == True: func.focus_on_channel_list( self, 1000, 0, True, var.addon.getSetting('CurrentRadioId')) else: listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) if var.SearchFilterTerm != '': func.updateLabelText(self, 1, 'Geen zenders gevonden') listcontainer.selectItem(1) else: func.updateLabelText(self, 1, 'Geen zenders') listcontainer.selectItem(0) xbmc.sleep(100)
def set_channel_epg(self): #Set the currently selected channel listcontainer = self.getControl(1001) listItemSelected = listcontainer.getSelectedItem() if listItemSelected == None: func.updateLabelText(self, 1, 'Selecteer zender') func.updateLabelText( self, 2, "Selecteer een zender om de programma's voor weer te geven.") return self.EpgCurrentAssetId = listItemSelected.getProperty('AssetId') self.EpgCurrentChannelId = listItemSelected.getProperty('ChannelId') self.EpgCurrentExternalId = listItemSelected.getProperty('ExternalId') self.EpgCurrentChannelName = listItemSelected.getProperty( 'ChannelName')
def thread_zap_wait_timer(_self, selectMode, clickOnSelection): while var.thread_zap_wait_timer != None and var.addonmonitor.abortRequested( ) == False: xbmc.sleep(200) lastinteractseconds = int( (datetime.now() - var.ZapDelayDateTime).total_seconds()) if (var.ZapTimerForce or lastinteractseconds >= 3 or len(var.ZapNumber) == 4) and func.string_isnullorempty(var.ZapNumber) == False: #Handle remote action if selectMode: select_remote_number(_self, clickOnSelection) else: zap_remote_number(_self) #Reset remote variables var.ZapControlId = 0 var.ZapNumber = '' var.ZapTimerForce = False var.thread_zap_wait_timer = None #Hide remote number popup _self.setProperty('ZapVisible', 'false') func.updateLabelText(_self, 7001, '')
def search_history(self): #Get search term searchProgramName = searchhistory.search_dialog() #Check search term if func.string_isnullorempty(searchProgramName) == True: return #Add search history to Json searchhistory.search_add(searchProgramName) #Download the search programs func.updateLabelText(self, 1, "Zoek resultaat downloaden") downloadResult = download.download_search_program(searchProgramName) if downloadResult == None: func.updateLabelText(self, 1, 'Zoeken mislukt') listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) return False #Update the search result var.SearchDownloadSearchTerm = searchProgramName var.SearchDownloadResultJson = downloadResult #List the search results func.updateLabelText(self, 1, "Zoek resultaat laden") self.search_list(var.SearchDownloadResultJson)
def count_epg(self, ChannelName): #Set the epg day string epgLoadDayString = self.string_day_number(self.EpgCurrentLoadDayInt) #Update the label texts listcontainer = self.getControl(1002) if listcontainer.size() == 0: func.updateLabelText(self, 1, "Geen programma's") func.updateLabelText( self, 2, "Geen programma's beschikbaar voor " + epgLoadDayString + " op " + ChannelName + '.') else: func.updateLabelText(self, 1, str(listcontainer.size()) + " programma's") func.updateLabelText( self, 2, "Alle programma's voor " + epgLoadDayString + " op " + ChannelName + '.')
def count_alarm(self, resetSelect=False): listcontainer = self.getControl(1000) alarmcount = len(var.AlarmDataJson) if alarmcount > 0: func.updateLabelText(self, 3000, 'Geplande Alarmen (' + str(alarmcount) + ')') func.updateLabelText(self, 3001, 'Huidig geplande programma alarmen, u kunt een alarm annuleren door er op te klikken.') if resetSelect == True: self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) else: func.updateLabelText(self, 3000, 'Geplande Alarmen (0)') func.updateLabelText(self, 3001, 'Er zijn geen programma alarmen gezet, u kunt een nieuw alarm zetten in de tv gids, op de televisie pagina of tijdens het tv kijken.') closeButton = self.getControl(4000) self.setFocus(closeButton) xbmc.sleep(100)
def list_add_streams(self): #Check if addon is busy if var.busy_main == True: return var.busy_main = True #Clear streams from the list listcontainer = self.getControl(1001) listcontainer.reset() #Update the load status func.updateLabelText(self, 1, 'Loading streams') #Open streams json file string_streams = download.download_streams() json_streams = json.loads(string_streams) #Update the load status func.updateLabelText(self, 1, 'Adding streams') #Add streams to the list for channel in json_streams: try: #Load stream information StreamName = channel['name'] StreamLocation = channel['location'] StreamSource = channel['source'] StreamUrl = channel['stream'] StreamTokenUrl = channel['token'] StreamName += ' [COLOR ff71c6fe]' + StreamLocation + '[/COLOR]' StreamName += ' [COLOR ff26671e]' + StreamSource + '[/COLOR]' StreamImage = 'https://raw.githubusercontent.com/dumbie/kodirepo/master/plugin.video.vogelspot/streams/' + channel[ 'id'] + '.png' #Add stream to the list listitem = xbmcgui.ListItem(StreamName) listitem.setProperty('StreamUrl', StreamUrl) listitem.setProperty('StreamTokenUrl', StreamTokenUrl) listitem.setArt({'thumb': StreamImage, 'icon': StreamImage}) listcontainer.addItem(listitem) except: continue #Update the total stream count func.updateLabelText(self, 1, str(listcontainer.size()) + ' streams') #Focus on the stream list self.setFocus(listcontainer) xbmc.sleep(200) listcontainer.selectItem(0) xbmc.sleep(200) var.busy_main = False
def count_program(self, resetSelect=False): listcontainer = self.getControl(1000) if listcontainer.size() > 0: func.updateLabelText(self, 1, str(listcontainer.size()) + " zoek resultaten") func.updateLabelText(self, 3, "Zoek resultaten voor " + var.SearchDownloadSearchTerm + " [COLOR gray]" + var.SearchFilterTerm + "[/COLOR]") if resetSelect == True: self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) else: func.updateLabelText(self, 1, "Geen zoek resultaten") func.updateLabelText(self, 3, "Geen zoek resultaten voor " + var.SearchDownloadSearchTerm + " [COLOR gray]" + var.SearchFilterTerm + "[/COLOR]") listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) if var.SearchFilterTerm != '': listcontainer.selectItem(3) else: listcontainer.selectItem(1) xbmc.sleep(100)
def count_recording(self, resetSelect=False): listcontainer = self.getControl(1000) if listcontainer.size() > 0: func.updateLabelText( self, 3000, 'Geplande Series (' + str(listcontainer.size()) + ')') func.updateLabelText( self, 3001, 'U kunt een serie seizoen annuleren door er op te klikken.') if resetSelect == True: self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) else: func.updateLabelText(self, 3000, 'Geplande Series (0)') func.updateLabelText( self, 3001, 'Er zijn geen serie seizoen opnames gepland, u kunt een nieuwe serie seizoen opnemen vanuit de TV Gids.' ) closeButton = self.getControl(4000) self.setFocus(closeButton) xbmc.sleep(100)
def load_series(self, forceLoad=False, forceUpdate=False): if forceUpdate == True: notificationIcon = path.resources( 'resources/skins/default/media/common/series.png') xbmcgui.Dialog().notification(var.addonname, "Series worden vernieuwd.", notificationIcon, 2500, False) #Get and check the list container listcontainer = self.getControl(1000) if forceLoad == False and forceUpdate == False: if listcontainer.size() > 0: return True else: listcontainer.reset() #Download the series func.updateLabelText(self, 1, "Series downloaden") downloadResult = download.download_vod_series(forceUpdate) downloadResultWeek = download.download_search_series(forceUpdate) if downloadResult == False or downloadResultWeek == False: func.updateLabelText(self, 1, 'Niet beschikbaar') listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) return False #Add series to the list func.updateLabelText(self, 1, "Series laden") listcontainersort = [] self.add_series_week(listcontainersort) self.add_series_vod(listcontainersort) listcontainersort.sort(key=lambda x: x.getProperty('ProgramName')) listcontainer.addItems(listcontainersort) #Update the status self.count_series(True) #Load selected episodes listItemSelected = listcontainer.getSelectedItem() listItemAction = listItemSelected.getProperty('Action') if listItemAction == 'load_episodes_vod': self.load_episodes_vod(listItemSelected, False) elif listItemAction == 'load_episodes_week': self.load_episodes_week(listItemSelected, False)
def count_recording(self, resetSelect=False): listcontainer = self.getControl(1000) if listcontainer.size() > 0: func.updateLabelText( self, 3000, 'Geplande Opnames (' + str(listcontainer.size()) + ')') func.updateLabelText( self, 3001, 'Huidig geplande programma opnames, u kunt een opname annuleren door er op te klikken.' ) if resetSelect == True: self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) else: func.updateLabelText(self, 3000, 'Geplande Opnames (0)') func.updateLabelText( self, 3001, 'Er zijn geen programma opnames gepland, u kunt een nieuwe opname plannen in de TV Gids of op de Televisie pagina.' ) closeButton = self.getControl(4000) self.setFocus(closeButton) xbmc.sleep(100)
def onInit(self): #Set the schedule window text func.updateLabelText(self, 3000, 'Geplande Alarmen') func.updateLabelText(self, 4001, 'Alle alarmen annuleren') func.updateLabelText(self, 3002, '* Programma alarm werkt alleen als Kodi geopend is.') func.updateVisibility(self, 4001, True) #Update the alarm panel height dialogControl = self.getControl(8000) dialogControl.setHeight(590) dialogControl = self.getControl(8001) dialogControl.setHeight(592) #Clear expired alarms from Json alarm_clean_expired() #Load all current set alarms self.load_alarm()
def update_dialogFooter(self, dialogFooter): func.updateLabelText(self, 3002, dialogFooter)
def count_program(self, resetSelect=False): listcontainer = self.getControl(1000) if listcontainer.size() > 0: if var.SearchFilterTerm != '': func.updateLabelText(self, 1, str(listcontainer.size()) + " programma's gevonden") func.updateLabelText(self, 3, "Zoek resultaten voor " + var.SearchFilterTerm) else: func.updateLabelText(self, 1, str(listcontainer.size()) + " programma's") func.updateLabelText(self, 3, "") if resetSelect == True: self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) else: listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) if var.SearchFilterTerm != '': func.updateLabelText(self, 1, "Geen programma's gevonden") func.updateLabelText(self, 3, "Geen zoek resultaten voor " + var.SearchFilterTerm) listcontainer.selectItem(1) else: func.updateLabelText(self, 1, "Geen programma's") func.updateLabelText(self, 3, "") listcontainer.selectItem(0) xbmc.sleep(100)
def load_program(self, forceLoad=False, forceUpdate=False, silentUpdate=True): if forceUpdate == True and silentUpdate == False: notificationIcon = path.resources('resources/skins/default/media/common/vod.png') xbmcgui.Dialog().notification(var.addonname, "Programma's worden vernieuwd.", notificationIcon, 2500, False) #Get and check the list container listcontainer = self.getControl(1000) if forceLoad == False and forceUpdate == False: if listcontainer.size() > 0: return True else: listcontainer.reset() #Download the programs func.updateLabelText(self, 1, "Programma's downloaden") downloadResult = download.download_vod_yesterday(forceUpdate) if downloadResult == False: func.updateLabelText(self, 1, 'Niet beschikbaar') listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) return False #Add programs to the list func.updateLabelText(self, 1, "Programma's laden") for program in var.YesterdaySearchDataJson['resultObj']['containers']: try: #Load program basics ProgramName = metadatainfo.programtitle_from_json_metadata(program) ProgramNameRaw = ProgramName EpisodeTitle = metadatainfo.episodetitle_from_json_metadata(program, True, ProgramNameRaw) ProgramTimeEndDateTime = metadatainfo.programenddatetime_from_json_metadata(program) #Check if there are search results if var.SearchFilterTerm != '': searchMatch1 = func.search_filter_string(ProgramName) searchMatch2 = func.search_filter_string(EpisodeTitle) searchResultFound = var.SearchFilterTerm in searchMatch1 or var.SearchFilterTerm in searchMatch2 if searchResultFound == False: continue #Check if program has finished airing and processing if datetime.now() < (ProgramTimeEndDateTime + timedelta(minutes=var.RecordingProcessMinutes)): continue #Load program details ExternalId = metadatainfo.externalChannelId_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) ProgramEpisode = metadatainfo.episodenumber_from_json_metadata(program) ProgramAgeRating = metadatainfo.programagerating_from_json_metadata(program) ProgramDuration = metadatainfo.programdurationstring_from_json_metadata(program, False) ProgramDescription = metadatainfo.programdescription_from_json_metadata(program) ProgramTimeStartDateTime = metadatainfo.programstartdatetime_from_json_metadata(program) ProgramTimeStartDateTime = func.datetime_remove_seconds(ProgramTimeStartDateTime) ProgramTimeStartStringTime = ProgramTimeStartDateTime.strftime('%H:%M') ProgramTimeStartStringDate = ProgramTimeStartDateTime.strftime('%a, %d %B %Y') ProgramTime = '[COLOR gray]Begon om ' + ProgramTimeStartStringTime + ' op ' + ProgramTimeStartStringDate + ' en duurde ' + ProgramDuration + '[/COLOR]' #Combine program details stringJoin = [ EpisodeTitle, ProgramYear, ProgramSeason, ProgramEpisode, ProgramAgeRating ] ProgramDetails = ' '.join(filter(None, stringJoin)) if func.string_isnullorempty(ProgramDetails): ProgramDetails = '(?)' #Update program name string ProgramName = ProgramNameRaw + ' [COLOR gray]' + ProgramDetails + '[/COLOR]' ProgramNameDesc = ProgramNameRaw + '\n[COLOR gray]' + ProgramDetails + '[/COLOR]' #Add program listitem = xbmcgui.ListItem() listitem.setProperty('Action', 'play_stream') listitem.setProperty('ProgramId', ProgramId) listitem.setProperty("ProgramName", ProgramName) listitem.setProperty("ProgramNameDesc", ProgramNameDesc) listitem.setProperty("ProgramNameRaw", ProgramNameRaw) listitem.setProperty("ProgramDetails", ProgramTime) listitem.setProperty('ProgramDescription', ProgramDescription) listitem.setInfo('video', {'Genre': 'Gister Gemist', 'Plot': ProgramDescription}) listitem.setArt({'thumb': path.icon_television(ExternalId), 'icon': path.icon_television(ExternalId)}) listcontainer.addItem(listitem) except: continue #Update the status self.count_program(True)
def load_recording(self, forceUpdate=False): listcontainer = self.getControl(1000) listcontainer.reset() #Download the recording programs func.updateLabelText(self, 3001, "Geplande opnames worden gedownload.") downloadResult = download.download_recording_event(forceUpdate) if downloadResult == False: func.updateLabelText(self, 3001, 'Geplande opnames zijn niet beschikbaar') closeButton = self.getControl(4000) self.setFocus(closeButton) xbmc.sleep(100) return False #Sort recording by upcoming time func.updateLabelText(self, 3001, "Geplande opnames worden geladen.") RecordingEvents = var.ChannelsDataJsonRecordingEvent["resultObj"][ "containers"] RecordingEvents = sorted( RecordingEvents, key=lambda x: x['metadata']['programStartTime'], reverse=False) #Process all the planned recording for program in RecordingEvents: try: #Load program basics ProgramTimeEndDateTime = metadatainfo.programenddatetime_generate_from_json_metadata( program) #Check if recording is planned or already recorded if ProgramTimeEndDateTime < datetime.now(): continue #Load program details ExternalId = metadatainfo.externalChannelId_from_json_metadata( program) ProgramRecordEventId = metadatainfo.contentId_from_json_metadata( program) ProgramStartDeltaTime = str( metadatainfo.programstartdeltatime_from_json_metadata( program)) ProgramName = metadatainfo.programtitle_from_json_metadata( program) ProgramTimeStartDateTime = metadatainfo.programstartdatetime_from_json_metadata( program) ProgramYear = metadatainfo.programyear_from_json_metadata( program) ProgramSeason = metadatainfo.programseason_from_json_metadata( program) ProgramEpisode = metadatainfo.episodenumber_from_json_metadata( program) ProgramDescription = 'Van ' + ProgramTimeStartDateTime.strftime( '%H:%M') + ' tot ' + ProgramTimeEndDateTime.strftime( '%H:%M') + ' op ' + ProgramTimeStartDateTime.strftime( '%a, %d %B %Y') #Combine program details stringJoin = [ProgramYear, ProgramSeason, ProgramEpisode] ProgramDetails = ' '.join(filter(None, stringJoin)) if func.string_isnullorempty(ProgramDetails): ProgramDetails = '(?)' #Update program name string ProgramName += ' [COLOR gray]' + ProgramDetails + '[/COLOR]' #Add recording event to the list listitem = xbmcgui.ListItem() listitem.setProperty('ProgramRecordEventId', ProgramRecordEventId) listitem.setProperty('ProgramStartDeltaTime', ProgramStartDeltaTime) listitem.setProperty('ProgramName', ProgramName) listitem.setProperty('ProgramDescription', ProgramDescription) listitem.setArt({ 'thumb': path.icon_television(ExternalId), 'icon': path.icon_television(ExternalId) }) listcontainer.addItem(listitem) except: continue #Update the status self.count_recording(True) #Update the main page count if var.guiMain != None: var.guiMain.count_recorded_event() var.guiMain.count_recording_event()
def list_add_apps(self): #Check if addon is busy if var.busy_main == True: return var.busy_main = True #Clear apps from the list listcontainer = self.getControl(1001) listcontainer.reset() #Update the load status func.updateLabelText(self, 1, 'Loading apps') #Get apps from moonlight try: list_apps = str(moonlight.moonlight_list()) except: func.updateLabelText(self, 1, 'Load failed') var.busy_main = False return #Update the load status func.updateLabelText(self, 1, 'Checking apps') #Check moonlight apps if func.string_isnullorempty(list_apps) == True: func.updateLabelText(self, 1, 'No connection') var.busy_main = False return elif "You must pair" in list_apps: func.updateLabelText(self, 1, 'Not paired') var.busy_main = False return elif "Can't connect" in list_apps: func.updateLabelText(self, 1, 'Connect error') var.busy_main = False return #List moonlight apps for appName in list_apps.split('\n'): if func.string_isnullorempty(appName) == False and appName[0].isdigit() == True: appName = appName.lstrip('0123456789. ') listitem = xbmcgui.ListItem(appName) listcontainer.addItem(listitem) #Update the total app count total_apps = listcontainer.size() func.updateLabelText(self, 1, str(total_apps) + ' apps') #Focus on the apps list or menu if total_apps > 0: self.setFocus(listcontainer) xbmc.sleep(200) listcontainer.selectItem(0) xbmc.sleep(200) else: listcontainer = self.getControl(1000) self.setFocus(listcontainer) xbmc.sleep(200) listcontainer.selectItem(0) xbmc.sleep(200) var.busy_main = False
def count_series(self, resetSelect=False): listcontainer = self.getControl(1000) if listcontainer.size() > 0: func.updateVisibility(self, 2, True) func.updateVisibility(self, 3002, True) if var.SearchFilterTerm != '': func.updateLabelText( self, 1, str(listcontainer.size()) + " gevonden series") func.updateLabelText( self, 4, "Zoek resultaten voor " + var.SearchFilterTerm) else: func.updateLabelText(self, 1, str(listcontainer.size()) + " series") func.updateLabelText(self, 4, "") if resetSelect == True: self.setFocus(listcontainer) xbmc.sleep(100) listcontainer.selectItem(0) xbmc.sleep(100) else: func.updateVisibility(self, 2, False) func.updateVisibility(self, 3002, False) listcontainer = self.getControl(1001) self.setFocus(listcontainer) xbmc.sleep(100) if var.SearchFilterTerm != '': func.updateLabelText(self, 1, "Geen series gevonden") func.updateLabelText( self, 4, "Geen zoek resultaten voor " + var.SearchFilterTerm) listcontainer.selectItem(1) else: func.updateLabelText(self, 1, "Geen series") func.updateLabelText(self, 4, "") listcontainer.selectItem(0) xbmc.sleep(100)
def onInit(self): func.updateLabelText(self, 3, "Series") self.buttons_add_navigation() self.load_series(False, False)
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)
def load_episodes_vod(self, listItem, selectList=False): #Get the selected parentid selectedParentId = listItem.getProperty('ProgramId') selectedSeriesName = listItem.getProperty('ProgramName') selectedPictureUrl = listItem.getProperty('PictureUrl') #Get and check the list container listcontainer = self.getControl(1002) listcontainer.reset() #Update the episodes status func.updateLabelText(self, 2, 'Afleveringen downloaden') #Download the series episodes seasonDownloaded = download.download_series_season(selectedParentId) if seasonDownloaded == None: func.updateLabelText(self, 2, 'Afleveringen niet beschikbaar') return False #Update the episodes status func.updateLabelText(self, 2, 'Afleveringen laden') #Process all the episodes for program in seasonDownloaded["resultObj"]["containers"]: try: #Load program basics TechnicalPackageIds = metadatainfo.technicalPackageIds_from_json_metadata( program) #Check if content is pay to play if metadatainfo.program_check_paytoplay(TechnicalPackageIds): continue #Load program details ProgramId = metadatainfo.contentId_from_json_metadata(program) ProgramName = metadatainfo.programtitle_from_json_metadata( program) 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_ondemand_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_vod') listitem.setProperty('ProgramId', ProgramId) listitem.setProperty("ProgramName", ProgramName) listitem.setProperty('ProgramDetails', ProgramDetails) listitem.setProperty("ProgramAvailability", ProgramAvailability) listitem.setProperty('ProgramDescription', ProgramDescription) listitem.setInfo('video', { 'Genre': selectedSeriesName, 'Plot': ProgramDescription }) listitem.setArt({ 'thumb': path.icon_vod(selectedPictureUrl), 'icon': path.icon_vod(selectedPictureUrl) }) listcontainer.addItem(listitem) except: continue #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)
def update_dialogHeader(self, dialogHeader): func.updateLabelText(self, 3000, dialogHeader)