コード例 #1
0
def switch_channel_tv_channelid(AssetId,
                                ChannelId,
                                ExternalId,
                                ChannelName='Onbekende zender',
                                Genre='Onbekend',
                                Windowed=False,
                                showInformation=False):
    if func.string_isnullorempty(AssetId) or func.string_isnullorempty(
            ChannelId) or func.string_isnullorempty(ExternalId):
        notificationIcon = path.resources(
            'resources/skins/default/media/common/television.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Ongeldige zender informatie.',
                                      notificationIcon, 2500, False)
        return

    if func.string_isnullorempty(ChannelName):
        ChannelName = 'Onbekende zender'

    if func.string_isnullorempty(Genre):
        Genre = 'Onbekend'

    listitem = xbmcgui.ListItem()
    listitem.setProperty('AssetId', AssetId)
    listitem.setProperty('ChannelId', ChannelId)
    listitem.setProperty('ExternalId', ExternalId)
    listitem.setProperty('ChannelName', ChannelName)
    listitem.setInfo('video', {'Genre': Genre})
    play_stream_television(listitem, Windowed)

    if showInformation and var.guiPlayer != None:
        var.guiPlayer.show_epg(True)
コード例 #2
0
def moonlight_stream(appName=''):
    #Check the current settings
    set_host = var.addon.getSetting('host')
    if set_host.endswith('.') or set_host.endswith('0') or not set_host[-1].isdigit():
        notificationIcon = func.path_resources('resources/skins/default/media/common/settings.png')
        xbmcgui.Dialog().notification(var.addonname, 'Please check the ip address.', notificationIcon, 2500, False)
        return
    
    #Check the application name
    if func.string_isnullorempty(appName) == True:
        notificationIcon = func.path_resources('resources/skins/default/media/common/close.png')
        xbmcgui.Dialog().notification(var.addonname, 'Invalid launch application.', notificationIcon, 2500, False)
        return

    #Load the stream settings
    setwidth = var.addon.getSetting('width')
    setheight = var.addon.getSetting('height')
    setbitrate = var.addon.getSetting('bitrate')
    setfps = var.addon.getSetting('fps')
    if var.addon.getSetting('localaudio') == 'true':
        setlocalaudio = '-localaudio'
    else:
        setlocalaudio = '-unsupported'
    if var.addon.getSetting('surroundsound') == 'true':
        setsurroundsound = '-surround'
    else:
        setsurroundsound = '-unsupported'

    #Launch the moonlight stream
    scriptRun = [var.addonpath + '/scripts/script-run.sh']
    scriptCode = [var.addonpath + '/scripts/moonlight-stream.sh']
    scriptVars = [set_host, appName, setwidth, setheight, setbitrate, setfps, setlocalaudio, setsurroundsound]

    process = subprocess.Popen(scriptRun + scriptCode + scriptVars)
    process.wait()
コード例 #3
0
def set_remote_number(_self, ZapNumberPress, selectMode, clickOnSelection):
    var.ZapDelayDateTime = datetime.now()
    var.ZapNumberString += ZapNumberPress
    var.ZapHintString = ''

    #Set channel string
    listcontainer = _self.getControl(var.ZapControlId)
    listitemcount = listcontainer.size()
    for itemNum in range(0, listitemcount):
        try:
            channelNameProp = listcontainer.getListItem(itemNum).getProperty(
                'ChannelName')
            channelNumberProp = listcontainer.getListItem(itemNum).getProperty(
                'ChannelNumber')
            if channelNumberProp.startswith(var.ZapNumberString):
                var.ZapHintString += func.get_provider_color_string(
                ) + channelNumberProp + '[/COLOR] [COLOR white]' + channelNameProp + '[/COLOR] '
        except:
            continue

    #Check if channel is found
    if func.string_isnullorempty(var.ZapHintString):
        var.ZapHintString = 'Zender ' + func.get_provider_color_string(
        ) + var.ZapNumberString + '[/COLOR] niet gevonden.'
        var.ZapNumberString = ''

    #Start zap wait thread
    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()
コード例 #4
0
ファイル: dialog.py プロジェクト: dumbie/KodiAddons
    def update_dialogSize(self, dialogFooter, dialogAnswers):
        #Check if maximum answers reached
        dialogAnswerCount = len(dialogAnswers)
        if dialogAnswerCount > 8:
            dialogAnswerCount = 8

        #Calculate the dialog height
        dialogHeight = 130
        dialogHeight += (dialogAnswerCount * 45) + 5

        #Check if maximum height reached
        if dialogHeight > 600:
            dialogHeight = 600

        #Update the dialog panel height
        dialogControl = self.getControl(4000)
        dialogControl.setHeight(dialogHeight)
        dialogControl = self.getControl(1000)
        dialogControl.setHeight(dialogHeight - 130)

        #Set the footer text position
        if func.string_isnullorempty(dialogFooter) == False:
            dialogControl = self.getControl(3002)
            dialogControl.setPosition(10, dialogHeight)
            dialogHeight += 40

        #Update the dialog background height
        dialogControl = self.getControl(5000)
        dialogControl.setHeight(dialogHeight)

        #Update the dialog border height
        dialogControl = self.getControl(5001)
        dialogControl.setHeight(dialogHeight + 3)
コード例 #5
0
ファイル: search.py プロジェクト: dumbie/KodiAddons
    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)
コード例 #6
0
def episodetitle_from_json_metadata(metaData,
                                    returnEmpty=False,
                                    programTitle=''):
    try:
        #Get the episode title
        if 'episodeTitle' in metaData['metadata']:
            EpisodeTitle = metaData['metadata']['episodeTitle']
        elif 'title' in metaData['metadata']:
            EpisodeTitle = metaData['metadata']['title']

        #Check same episode title
        if EpisodeTitle == programTitle:
            if returnEmpty:
                return ''
            else:
                return 'Titelloos'

        #Check empty episode title
        if func.string_isnullorempty(EpisodeTitle):
            if returnEmpty:
                return ''
            else:
                return 'Titel onbekend'

        return EpisodeTitle
    except:
        if returnEmpty:
            return ''
        else:
            return 'Titel onbekend'
コード例 #7
0
    def open_stream(self, listItem):
        StreamUrl = listItem.getProperty('StreamUrl')
        StreamTokenUrl = listItem.getProperty('StreamTokenUrl')

        if func.string_isnullorempty(StreamTokenUrl) == False:
            DownloadToken = download.download_token(StreamTokenUrl)
            DownloadToken = DownloadToken.replace('|', '%7C')
            StreamUrl += '&' + DownloadToken

        xbmc.Player().play(item=StreamUrl, listitem=listItem)
コード例 #8
0
    def add_program_vod(self, listcontainersort):
        for program in var.ChannelsDataJsonSeriesKids['resultObj'][
                'containers']:
            try:
                #Load program basics
                ProgramName = metadatainfo.programtitle_from_json_metadata(
                    program)

                #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
                PictureUrl = metadatainfo.pictureUrl_from_json_metadata(
                    program)
                ProgramId = metadatainfo.contentId_from_json_metadata(program)
                ProgramYear = metadatainfo.programyear_from_json_metadata(
                    program)
                ProgramStarRating = metadatainfo.programstarrating_from_json_metadata(
                    program)
                ProgramAgeRating = metadatainfo.programagerating_from_json_metadata(
                    program)

                #Combine program details
                stringJoin = [ProgramYear, ProgramStarRating, ProgramAgeRating]
                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', 'load_episodes_vod')
                listitem.setProperty('PictureUrl', PictureUrl)
                listitem.setProperty('ProgramId', ProgramId)
                listitem.setProperty("ProgramName", ProgramName)
                listitem.setProperty('ProgramDetails', ProgramDetails)
                listitem.setInfo('video', {
                    'Genre': 'Series',
                    'Plot': ProgramDetails
                })
                iconProgramType = "common/series.png"
                iconStreamType = "common/vod.png"
                iconProgram = path.icon_vod(PictureUrl)
                listitem.setArt({
                    'thumb': iconProgram,
                    'icon': iconProgram,
                    'image1': iconStreamType,
                    'image2': iconProgramType
                })
                listcontainersort.append(listitem)
            except:
                continue
コード例 #9
0
def channelName_from_json_metadata(metaData):
    try:
        channelNameString = metaData['metadata']['channelName']
        channelNameString = hybrid.unicode_to_string(channelNameString)
        channelNameString = hybrid.htmlparser_unescape(channelNameString)

        #Check the channel name
        if func.string_isnullorempty(channelNameString):
            channelNameString = "Onbekende zender"

        return channelNameString
    except:
        return "Onbekende zender"
コード例 #10
0
ファイル: search.py プロジェクト: dumbie/KodiAddons
    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)
コード例 #11
0
ファイル: zap.py プロジェクト: dumbie/KodiAddons
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, '')
コード例 #12
0
def programtitle_from_json_metadata(metaData, stripTitle=False):
    try:
        programNameString = metaData['metadata']['title']
        programNameString = hybrid.unicode_to_string(programNameString)
        programNameString = hybrid.htmlparser_unescape(programNameString)

        #Check the program name
        if func.string_isnullorempty(programNameString):
            programNameString = 'Onbekend programma'

        #Strip the program name
        if stripTitle:
            for stripString in var.ProgramTitleStripStrings:
                programNameString = func.string_replace_insensitive(
                    stripString, '', programNameString)
            for stripRegEx in var.ProgramTitleStripRegEx:
                programNameString = func.string_replace_regex(
                    stripRegEx, '', programNameString)

        return programNameString
    except:
        return 'Onbekend programma'
コード例 #13
0
    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)
コード例 #14
0
    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)
コード例 #15
0
ファイル: search.py プロジェクト: dumbie/KodiAddons
    def search_list(self, downloadResult=None):
        #Get and check the list container
        listcontainer = self.getControl(1000)
        listcontainer.reset()

        #Add programs to the list
        for program in downloadResult['resultObj']['containers']:
            try:
                #Load program basics
                ProgramName = metadatainfo.programtitle_from_json_metadata(program)
                ProgramNameRaw = ProgramName
                EpisodeTitle = metadatainfo.episodetitle_from_json_metadata(program, True, ProgramNameRaw)

                #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

                #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]'
                ProgramAvailability = metadatainfo.vod_week_available_time(program)

                #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]\n' + ProgramAvailability

                #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': 'Zoeken', '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)
コード例 #16
0
def enable_widevine_support(forceUpdate=False):
    #Check if Widevine is already updating
    if var.WidevineUpdating == True: return
    var.WidevineUpdating = True

    #Get InputStream adaptive Widevine path
    input_addon = xbmcaddon.Addon('inputstream.adaptive')
    decrypter_path = input_addon.getSetting('DECRYPTERPATH')
    if func.string_isnullorempty(decrypter_path):
        widevine_path = hybrid.string_decode_utf8(
            hybrid.xbmc_translate_path('special://home/cdm'))
        input_addon.setSetting('DECRYPTERPATH', 'special://home/cdm')
    else:
        widevine_path = hybrid.string_decode_utf8(
            hybrid.xbmc_translate_path(decrypter_path))

    #Set the download headers
    DownloadHeaders = {"User-Agent": var.addon.getSetting('CustomUserAgent')}

    #Check if newer Widevine version is available
    RequestUrl = str(path.requirements()) + 'version.txt'
    DownloadRequest = hybrid.urllib_request(RequestUrl,
                                            headers=DownloadHeaders)
    DownloadDataHttp = hybrid.urllib_urlopen(DownloadRequest)
    DownloadDataString = DownloadDataHttp.read().decode()
    if DownloadDataString != var.addon.getSetting('WidevineVersion'):
        var.addon.setSetting('WidevineVersion', DownloadDataString)
        forceUpdate = True

    #Check if Widevine support is installed
    if forceUpdate == False:
        for aRoot, aDirs, aFiles in os.walk(widevine_path):
            for fileName in aFiles:
                if 'widevinecdm' in fileName:
                    var.WidevineUpdating = False
                    return

    #Check the system processor architecture
    downloadArchitecture = ''
    systemArchitecture = platform.machine().lower()
    systemBits = platform.architecture()[0].lower()
    if 'arm' in systemArchitecture: downloadArchitecture = 'armv7'
    elif systemBits == '32bit': downloadArchitecture = 'ia32'
    elif systemBits == '64bit': downloadArchitecture = 'x64'

    #Check if operating system is supported
    downloadOperatingSystem = ''
    if xbmc.getCondVisibility('System.Platform.Android'):
        var.WidevineUpdating = False
        return
    elif xbmc.getCondVisibility('System.Platform.IOS'):
        var.WidevineUpdating = False
        return
    elif xbmc.getCondVisibility('System.Platform.Linux'):
        downloadOperatingSystem = 'linux'
    elif xbmc.getCondVisibility('System.Platform.OSX'):
        downloadOperatingSystem = 'mac'
    elif xbmc.getCondVisibility('System.Platform.Windows'):
        downloadOperatingSystem = 'win'
    else:
        var.WidevineUpdating = False
        xbmcgui.Dialog().notification(
            var.addonname, 'Besturing systeem wordt niet ondersteund.',
            var.addonicon, 2500, False)
        return

    #Notify the user Widevine is installing
    xbmcgui.Dialog().notification(var.addonname,
                                  'Widevine wordt geinstalleerd.',
                                  var.addonicon, 2500, False)

    #Stop the current playback of any media
    if xbmc.Player().isPlaying():
        xbmc.Player().stop()
        xbmc.sleep(1000)

    #Create the Widevine decrypter directory
    if os.path.exists(widevine_path) == False:
        os.mkdir(widevine_path)

    try:
        #Download the required Widevine files
        RequestUrl = str(path.requirements()) + 'widevine-' + str(
            downloadOperatingSystem) + '-' + str(downloadArchitecture) + '.zip'
        DownloadRequest = hybrid.urllib_request(RequestUrl,
                                                headers=DownloadHeaders)
        DownloadDataHttp = hybrid.urllib_urlopen(DownloadRequest)
        DownloadDataBytes = DownloadDataHttp.read()

        #Write the downloaded Widevine zip file
        download_filename = widevine_path + '/widevine.zip'
        filewrite = open(download_filename, 'wb')
        filewrite.write(DownloadDataBytes)
        filewrite.close()
    except:
        var.WidevineUpdating = False
        notificationIcon = path.resources(
            'resources/skins/default/media/common/error.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Mislukt om Widevine te downloaden.',
                                      notificationIcon, 2500, False)
        return

    try:
        #Extract the downloaded Widevine zip file
        downloadZip = ZipFile(download_filename)
        downloadZip.extractall(widevine_path)
        downloadZip.close()
    except:
        var.WidevineUpdating = False
        notificationIcon = path.resources(
            'resources/skins/default/media/common/error.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Mislukt om Widevine te installeren.',
                                      notificationIcon, 2500, False)
        return

    #Remove the downloaded Widevine zip file
    os.remove(download_filename)

    var.WidevineUpdating = False
    xbmcgui.Dialog().notification(var.addonname,
                                  'Widevine is succesvol geinstalleerd.',
                                  var.addonicon, 2500, False)
コード例 #17
0
ファイル: recordings.py プロジェクト: dumbie/KodiAddons
    def list_update_recordings(self, forceUpdate):
        if var.busy_recordings == True:
            notificationIcon = func.path_resources(
                'resources/skins/default/media/common/refresh.png')
            xbmcgui.Dialog().notification(var.addonname, 'Already refreshing.',
                                          notificationIcon, 2500, False)
            return
        var.busy_recordings = True

        listcontainer = self.getControl(1001)

        #Check if update is needed
        if not forceUpdate:
            if listcontainer.size() > 0:
                var.busy_recordings = False
                return

        #Clear recordings from the list
        listcontainer.reset()

        #Update the load status
        func.updateLabelText(self, 1, 'Loading recordings')

        #Get recordings from enigma
        try:
            list_items = enigma.enigma_list_recordings()
        except:
            func.updateLabelText(self, 1, 'Load failed')
            var.busy_recordings = False
            return

        #Update the load status
        func.updateLabelText(self, 1, 'Checking recordings')

        #Check recordings list
        if list_items == None:
            func.updateLabelText(self, 1, 'No recordings')
            var.busy_recordings = False
            return

        #List enigma recordings
        ChannelNumber = 0
        controls = list_items.findall('e2movie')
        for control in controls:
            e2title = control.find('e2title').text
            e2title = hybrid.urllib_unquote(e2title)
            e2filename = control.find('e2filename').text
            e2filename = hybrid.urllib_quote(e2filename)

            e2servicename = control.find('e2servicename').text
            if func.string_isnullorempty(e2servicename):
                e2servicename = 'Unknown'

            e2description = control.find('e2description').text
            if func.string_isnullorempty(e2description):
                e2description = 'Unknown'

            e2descriptionextended = control.find('e2descriptionextended').text
            if func.string_isnullorempty(e2descriptionextended):
                e2descriptionextended = 'Unknown'

            e2time = int(control.find('e2time').text)
            e2length = control.find('e2length').text + 'min'

            ChannelNumber += 1
            ChannelName = '[COLOR grey]' + str(
                ChannelNumber) + '[/COLOR] ' + e2title

            #Get the recording time
            ProgramRecordedDateTime = time.localtime(e2time)
            ProgramRecordedDate = time.strftime("%a %d %b %Y",
                                                ProgramRecordedDateTime)
            ProgramRecordedTime = time.strftime("%H:%M",
                                                ProgramRecordedDateTime)
            ProgramRecordedString = e2servicename + ' on ' + ProgramRecordedDate + ' at ' + ProgramRecordedTime + ' duration ' + e2length

            #Set the recording description
            ProgramDescription = '[COLOR dimgrey]' + ProgramRecordedString + '[/COLOR]\n\n' + e2descriptionextended + '\n\n[COLOR dimgrey]' + e2description + '[/COLOR]'

            listitem = xbmcgui.ListItem()
            listitem.setProperty('ChannelNumber', str(ChannelNumber))
            listitem.setProperty('ChannelName', ChannelName)
            listitem.setProperty('ProgramNameNow', ProgramRecordedString)
            listitem.setProperty('ProgramDescription', ProgramDescription)
            listitem.setProperty('e2title', e2title)
            listitem.setProperty('e2filename', e2filename)
            listitem.setInfo('video', {'Genre': 'Recording'})
            listcontainer.addItem(listitem)

        #Update the total list count
        total_items = listcontainer.size()
        func.updateLabelText(self, 1, str(total_items) + ' recordings')

        #Focus on the item list
        if total_items > 0:
            self.setFocus(listcontainer)
            xbmc.sleep(200)

        var.busy_recordings = False
コード例 #18
0
ファイル: television.py プロジェクト: dumbie/KodiAddons
    def list_update_epg(self):
        #Get and check the list container
        listcontainer = self.getControl(1001)
        listitemcount = listcontainer.size()

        #Set the current channel id
        for channelNum in range(0, listitemcount):
            updateItem = listcontainer.getListItem(channelNum)

            #Get the stream reference
            ProgramNameNow = updateItem.getProperty('ProgramNameNow')
            e2servicereference = updateItem.getProperty('e2servicereference')

            if not func.string_isnullorempty(ProgramNameNow):
                if enigma.enigma_check_webstream(e2servicereference):
                    streamUrl = enigma.enigma_get_webstreamurl(e2servicereference)
                    ProgramDescription = '[COLOR dimgrey]Webstream[/COLOR]'
                    ProgramProgressPercent = '0'
                    ProgramProgressPercentVisible = 'false'
                    ProgramNameNow = streamUrl
                else:
                    #Get epg info from enigma
                    try:
                        epg_data = enigma.enigma_epg_information(e2servicereference)
                    except:
                        updateItem.setProperty('ProgramNameNow', 'Information not available')
                        continue

                    #Check epg data
                    if epg_data == None:
                        updateItem.setProperty('ProgramNameNow', 'Information not available')
                        continue

                    #Get program information
                    controls = epg_data.findall('e2event')
                    for control in controls:
                        ProgramDurationNow = control.find('e2eventduration').text
                        ProgramStartTimeNow = control.find('e2eventstart').text
                        ProgramProgressPercent = '0'
                        ProgramProgressPercentVisible = 'false'

                        e2eventtitle = control.find('e2eventtitle').text
                        if e2eventtitle == None: e2eventtitle = 'Unknown program'

                        e2eventdescription = control.find('e2eventdescription').text
                        if e2eventdescription == None: e2eventdescription = ''

                        e2eventdescriptionextended = control.find('e2eventdescriptionextended').text
                        if e2eventdescriptionextended == None: e2eventdescriptionextended = ''

                        if not func.string_isnullorempty(e2eventdescriptionextended):
                            ProgramDescription = e2eventdescriptionextended + '\n\n'
                        else:
                            ProgramDescription = 'Description is not available.\n\n'

                        if not func.string_isnullorempty(e2eventdescription):
                            ProgramDescription = ProgramDescription + '[COLOR grey]' + e2eventdescription + '[/COLOR]'

                        if ProgramStartTimeNow != '0' and ProgramDurationNow != '0':
                            ProgramStartTimeNow = datetime.fromtimestamp(int(ProgramStartTimeNow))
                            ProgramEndTimeNow = ProgramStartTimeNow + timedelta(seconds=int(ProgramDurationNow))
                            ProgramNameNow = '(' + ProgramStartTimeNow.strftime('%H:%M') + '/' + ProgramEndTimeNow.strftime('%H:%M') + ') '
                            ProgramProgressPercentVisible = 'true'

                            ProgramProgressPercent = func.number_to_single_string(((datetime.now() - ProgramStartTimeNow).total_seconds() / 60) * 100 / ((ProgramEndTimeNow - ProgramStartTimeNow).total_seconds() / 60))
                            ProgramTimeLeftMin = func.number_to_single_string((ProgramEndTimeNow - datetime.now()).total_seconds() / 60)
                            ProgramDurationMin = func.number_to_single_string(int(ProgramDurationNow) / 60)

                            if ProgramTimeLeftMin == '0':
                                ProgramDescription = '[COLOR gray]Almost ending, was ' + ProgramDurationMin + ' minutes long and started around ' + ProgramStartTimeNow.strftime('%H:%M') + '[/COLOR]\n\n' + ProgramDescription
                            else:
                                ProgramDescription = '[COLOR gray]' + ProgramTimeLeftMin + ' min remaining from the ' + ProgramDurationMin + ' minutes, started around ' + ProgramStartTimeNow.strftime('%H:%M') + ' and ends at ' + ProgramEndTimeNow.strftime('%H:%M') + '[/COLOR]\n\n' + ProgramDescription

                        ProgramNameNow += e2eventtitle
                        ProgramNameNowLower = ProgramNameNow.lower()
                        if 'n/a' in ProgramNameNowLower or '<n/a>' in ProgramNameNowLower:
                            ProgramNameNow = 'Information not available'

                updateItem.setProperty('ProgramDescription', ProgramDescription)
                updateItem.setProperty('ProgramProgressPercent', ProgramProgressPercent)
                updateItem.setProperty('ProgramProgressPercentVisible', ProgramProgressPercentVisible)
                updateItem.setProperty('ProgramNameNow', ProgramNameNow)
コード例 #19
0
def play_stream_recorded(listItem, Windowed):
    #Check if user is logged in
    if var.ApiLoggedIn == False:
        apilogin.ApiLogin(False)

    #Download the program stream url
    try:
        DownloadHeaders = {
            "User-Agent": var.addon.getSetting('CustomUserAgent'),
            "Cookie": var.ApiLoginCookie,
            "X-Xsrf-Token": var.ApiLoginToken
        }

        #Get and set the stream asset id
        ProgramAssetId = listItem.getProperty('ProgramAssetId')
        ProgramRecordEventId = listItem.getProperty('ProgramRecordEventId')

        #Check the set stream asset id
        if func.string_isnullorempty(
                ProgramAssetId) or func.string_isnullorempty(
                    ProgramRecordEventId):
            notificationIcon = path.resources(
                'resources/skins/default/media/common/recorddone.png')
            xbmcgui.Dialog().notification(
                var.addonname,
                'Opname is niet speelbaar, wegens stream rechten.',
                notificationIcon, 2500, False)
            return

        DownloadRequest = hybrid.urllib_request(path.stream_url_recording(
            ProgramRecordEventId, ProgramAssetId),
                                                headers=DownloadHeaders)
        DownloadDataHttp = hybrid.urllib_urlopen(DownloadRequest)
        DownloadDataJson = json.load(DownloadDataHttp)
    except:
        notificationIcon = path.resources(
            'resources/skins/default/media/common/recorddone.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Opname is niet gevonden.',
                                      notificationIcon, 2500, False)
        return

    #Check if connection is successful
    if DownloadDataJson['resultCode'] and DownloadDataJson['errorDescription']:
        resultCode = DownloadDataJson['resultCode']
        resultMessage = DownloadDataJson['message']
        if resultCode == 'KO':
            var.ApiLoggedIn = False
            notificationIcon = path.resources(
                'resources/skins/default/media/common/recorddone.png')
            xbmcgui.Dialog().notification(
                var.addonname, 'Opname is niet beschikbaar: ' + resultMessage,
                notificationIcon, 2500, False)
            return

    #Check the target resolution
    if var.addon.getSetting('StreamResolution') == '2160p':
        targetResolution = '10000000'
    elif var.addon.getSetting('StreamResolution') == '1080p':
        targetResolution = '6000000'
    elif var.addon.getSetting('StreamResolution') == '720p':
        targetResolution = '4000000'
    elif var.addon.getSetting('StreamResolution') == '576p':
        targetResolution = '2500000'
    elif var.addon.getSetting('StreamResolution') == '432p':
        targetResolution = '1600000'
    elif var.addon.getSetting('StreamResolution') == '360p':
        targetResolution = '1200000'

    #Set stream headers dictionary
    StreamHeadersDict = {"User-Agent": var.addon.getSetting('CustomUserAgent')}

    #Create stream headers string
    StreamHeaders = ''
    for name, value in StreamHeadersDict.items():
        StreamHeaders += '&' + name + '=' + hybrid.urllib_quote(value)
    StreamHeaders = StreamHeaders.replace('&', '', 1)

    #Get and adjust the stream url
    try:
        StreamUrl = DownloadDataJson['resultObj']['src']['sources']['src']
        StreamUrl = StreamUrl.replace('&max_bitrate=1200000',
                                      '&max_bitrate=' + targetResolution)
        StreamUrl = StreamUrl.replace('&max_bitrate=1600000',
                                      '&max_bitrate=' + targetResolution)
        StreamUrl = StreamUrl.replace('&max_bitrate=2500000',
                                      '&max_bitrate=' + targetResolution)
        StreamUrl = StreamUrl.replace('&max_bitrate=4000000',
                                      '&max_bitrate=' + targetResolution)
        StreamUrl = StreamUrl.replace('&max_bitrate=6000000',
                                      '&max_bitrate=' + targetResolution)
        StreamUrl = StreamUrl.replace('&max_bitrate=10000000',
                                      '&max_bitrate=' + targetResolution)
        StreamUrl += '&drm=clear'
    except:
        notificationIcon = path.resources(
            'resources/skins/default/media/common/recorddone.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Stream is niet beschikbaar.',
                                      notificationIcon, 2500, False)
        return

    #Set input adaptive stream
    listItem.setProperty(hybrid.inputstreamname, 'inputstream.adaptive')
    listItem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
    listItem.setProperty('inputstream.adaptive.stream_headers', StreamHeaders)

    #Get and set stream license key
    try:
        AdaptiveLicenseUrl = DownloadDataJson['resultObj']['src']['sources'][
            'contentProtection']['widevine']['licenseAcquisitionURL']
        AdaptivePostData = 'R{SSM}'
        AdaptiveResponse = ''
        listItem.setProperty('inputstream.adaptive.license_type',
                             'com.widevine.alpha')
        listItem.setProperty(
            'inputstream.adaptive.license_key', AdaptiveLicenseUrl + "|" +
            StreamHeaders + "|" + AdaptivePostData + "|" + AdaptiveResponse)
    except:
        pass

    #Update the list item name label
    listItem.setLabel(listItem.getProperty('ProgramName'))

    #Set stream start offset in seconds
    listItem.setProperty('StartOffset', '120')

    #Set internet stream property
    listItem.setProperty("get_stream_details_from_player", 'true')

    #Start playing the media
    var.PlayerCustom.PlayCustom(StreamUrl, listItem, Windowed, False)
コード例 #20
0
def channel_list_load(listContainer, checkStatus=False):
    var.ChannelIdsPlayable = []
    for channel in var.ChannelsDataJsonTelevision['resultObj']['containers']:
        try:
            #Load channel basics
            AssetId = metadatainfo.get_stream_assetid(channel['assets'])
            ChannelId = metadatainfo.channelId_from_json_metadata(channel)
            ChannelName = metadatainfo.channelName_from_json_metadata(channel)
            ChannelIsAdult = metadatainfo.isAdult_from_json_metadata(channel)

            #Check if channel is streamable
            if func.string_isnullorempty(AssetId): continue

            #Add channelId to playable id list
            var.ChannelIdsPlayable.append(ChannelId)

            #Check if channel is filtered
            if var.addon.getSetting('TelevisionChannelNoErotic'
                                    ) == 'true' and ChannelIsAdult == True:
                continue

            #Check if there are search results
            if var.SearchFilterTerm != '':
                searchMatch = func.search_filter_string(ChannelName)
                searchResultFound = var.SearchFilterTerm in searchMatch
                if searchResultFound == False: continue

            #Check if channel is marked as favorite
            if ChannelId in var.FavoriteTelevisionDataJson:
                ChannelFavorite = 'true'
            else:
                if var.LoadChannelFavoritesOnly == True and var.SearchFilterTerm == '':
                    continue
                ChannelFavorite = 'false'

            #Load channel details
            ExternalId = metadatainfo.externalId_from_json_metadata(channel)
            ChannelNumber = metadatainfo.orderId_from_json_metadata(channel)
            ChannelNumberAccent = func.get_provider_color_string(
            ) + ChannelNumber + '[/COLOR]'
            ChannelRecordEvent = 'false'
            ChannelRecordSeries = 'false'
            ChannelAlarm = 'false'
            ProgramNowName = 'Informatie wordt geladen'
            ProgramNextName = 'Informatie wordt geladen'
            ProgramDescription = 'Programmabeschrijving wordt geladen.'
            ProgramProgressPercent = '100'

            if checkStatus == True:
                #Check if channel has active recording
                if func.search_channelid_jsonrecording_event(ChannelId, True):
                    ChannelRecordEvent = 'true'

                #Check if channel has active recording series
                if func.search_channelid_jsonrecording_series(ChannelId):
                    ChannelRecordSeries = 'true'

                #Check if channel has active alarm
                if alarm.alarm_duplicate_channel_check(ChannelId) == True:
                    ChannelAlarm = 'true'

            #Add normal channel
            listitem = xbmcgui.ListItem()
            listitem.setProperty('Action', 'play_stream')
            listitem.setProperty('AssetId', AssetId)
            listitem.setProperty('ChannelId', ChannelId)
            listitem.setProperty('ChannelNumber', ChannelNumber)
            listitem.setProperty('ChannelNumberAccent', ChannelNumberAccent)
            listitem.setProperty('ChannelFavorite', ChannelFavorite)
            listitem.setProperty('ExternalId', ExternalId)
            listitem.setProperty('ChannelName', ChannelName)
            listitem.setProperty('ChannelRecordEvent', ChannelRecordEvent)
            listitem.setProperty('ChannelRecordSeries', ChannelRecordSeries)
            listitem.setProperty('ChannelAlarm', ChannelAlarm)
            listitem.setProperty("ProgramNowName", ProgramNowName)
            listitem.setProperty("ProgramNextName", ProgramNextName)
            listitem.setProperty("ProgramDescription", ProgramDescription)
            listitem.setProperty("ProgramProgressPercent",
                                 ProgramProgressPercent)
            listitem.setInfo('video', {'Genre': 'Televisie'})
            listitem.setArt({
                'thumb': path.icon_television(ExternalId),
                'icon': path.icon_television(ExternalId)
            })
            listContainer.addItem(listitem)
        except:
            continue
コード例 #21
0
    def add_movies_vod(self, listcontainersort):
        for program in var.ChannelsDataJsonMovies['resultObj']['containers']:
            try:
                #Load program basics
                ProgramName = metadatainfo.programtitle_from_json_metadata(
                    program)
                TechnicalPackageIds = metadatainfo.technicalPackageIds_from_json_metadata(
                    program)

                #Check if there are search results
                if var.SearchFilterTerm != '':
                    searchMatch = func.search_filter_string(ProgramName)
                    searchResultFound = var.SearchFilterTerm in searchMatch
                    if searchResultFound == False: continue

                #Check if content is pay to play
                if metadatainfo.program_check_paytoplay(TechnicalPackageIds):
                    continue

                #Load program details
                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_ondemand_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 vod program
                listitem = xbmcgui.ListItem()
                listitem.setProperty('Action', 'play_stream_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': 'Films',
                    'Plot': ProgramDescription
                })
                iconStreamType = "common/vod.png"
                iconProgram = path.icon_vod(PictureUrl)
                listitem.setArt({
                    'thumb': iconProgram,
                    'icon': iconProgram,
                    'image1': iconStreamType
                })
                listcontainersort.append(listitem)
            except:
                continue
コード例 #22
0
ファイル: main.py プロジェクト: dumbie/KodiAddons
    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
コード例 #23
0
ファイル: recordingevent.py プロジェクト: dumbie/KodiAddons
    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()
コード例 #24
0
ファイル: recordingseries.py プロジェクト: dumbie/KodiAddons
    def load_recording(self, forceUpdate=False):
        listcontainer = self.getControl(1000)
        listcontainer.reset()

        #Download the tv channels
        func.updateLabelText(self, 3001,
                             'Televisie zenders worden gedownload.')
        download.download_channels_tv(False)

        #Download the recording programs
        func.updateLabelText(self, 3001, "Geplande series worden gedownload.")
        downloadResult = download.download_recording_series(forceUpdate)
        if downloadResult == False:
            func.updateLabelText(self, 3001,
                                 'Geplande series zijn niet beschikbaar')
            closeButton = self.getControl(4000)
            self.setFocus(closeButton)
            xbmc.sleep(100)
            return False

        #Process all the planned recording
        func.updateLabelText(self, 3001, "Geplande series worden geladen.")
        for program in var.ChannelsDataJsonRecordingSeries["resultObj"][
                "containers"]:
            try:
                #Load program basics
                ProgramSeriesId = metadatainfo.seriesId_from_json_metadata(
                    program)
                ProgramName = metadatainfo.programtitle_from_json_metadata(
                    program)

                #Check recorded episodes count
                ProgramEpisodeCount = count_recorded_series(ProgramSeriesId)

                #Get first recording event
                RecordingEvent = func.search_seriesid_jsonrecording_event(
                    ProgramSeriesId)

                #Load program details
                ProgramYear = metadatainfo.programyear_from_json_metadata(
                    RecordingEvent)
                ProgramSeason = metadatainfo.programseason_from_json_metadata(
                    RecordingEvent)

                #Combine program details
                stringJoin = [ProgramYear, ProgramSeason, ProgramEpisodeCount]
                ProgramDetails = ' '.join(filter(None, stringJoin))
                if func.string_isnullorempty(ProgramDetails):
                    ProgramDetails = '(?)'

                #Update program name string
                ProgramName += ' [COLOR gray]' + ProgramDetails + '[/COLOR]'

                #Get channel basics
                ChannelId = metadatainfo.channelId_from_json_metadata(program)
                ChannelName = 'Onbekende zender'
                ChannelIcon = path.resources(
                    'resources/skins/default/media/common/unknown.png')
                ChannelDetails = func.search_channelid_jsontelevision(
                    ChannelId)
                if ChannelDetails:
                    ExternalId = metadatainfo.externalId_from_json_metadata(
                        ChannelDetails)
                    ChannelName = metadatainfo.channelName_from_json_metadata(
                        ChannelDetails)
                    ChannelIcon = path.icon_television(ExternalId)

                #Add recording series to the list
                listitem = xbmcgui.ListItem()
                listitem.setProperty('SeriesId', ProgramSeriesId)
                listitem.setProperty('ProgramName', ProgramName)
                listitem.setProperty('ProgramDescription', ChannelName)
                listitem.setArt({'thumb': ChannelIcon, 'icon': ChannelIcon})
                listcontainer.addItem(listitem)
            except:
                continue

        #Update the status
        self.count_recording(True)

        #Update the main page count
        if var.guiMain != None:
            var.guiMain.count_recording_series()
コード例 #25
0
    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
コード例 #26
0
    def load_epg(self, forceUpdate=False):
        #Check if channel has changed
        epgChannelChanged = self.EpgPreviousChannelId != self.EpgCurrentChannelId

        #Check if the day has changed
        dateTimeNow = datetime.now()
        dateTimeNowString = dateTimeNow.strftime('%Y-%m-%d')
        epgDayString = (
            dateTimeNow +
            timedelta(days=self.EpgCurrentLoadDayInt)).strftime('%Y-%m-%d')
        epgDayChanged = self.EpgPreviousLoadDayInt != self.EpgCurrentLoadDayInt
        epgDayTimeChanged = self.EpgPreviousLoadDateTime != dateTimeNowString

        #Check if update is needed
        if forceUpdate or epgChannelChanged or epgDayChanged or epgDayTimeChanged:
            #Get and check the list container
            listcontainer = self.getControl(1002)

            #Clear the current epg items
            listcontainer.reset()

            #Download the epg day information
            func.updateLabelText(self, 1, 'Gids download')
            func.updateLabelText(
                self, 2, 'TV Gids wordt gedownload, nog even geduld...')
            self.EpgCurrentDayJson = download.download_epg_day(
                epgDayString, forceUpdate)
            if self.EpgCurrentDayJson == None:
                func.updateLabelText(self, 1, 'Niet beschikbaar')
                func.updateLabelText(self, 2, 'TV Gids is niet beschikbaar.')
                listcontainer = self.getControl(1000)
                self.setFocus(listcontainer)
                xbmc.sleep(100)
                listcontainer.selectItem(0)
                xbmc.sleep(100)
                return
        else:
            #Load program progress
            self.load_progress()

            #Update the status
            self.count_epg(self.EpgCurrentChannelName)
            return

        #Update epg status
        func.updateLabelText(self, 1, 'Gids laden')
        func.updateLabelText(self, 2,
                             'TV Gids wordt geladen, nog even geduld...')

        ChannelEpg = func.search_channelid_jsonepg(self.EpgCurrentDayJson,
                                                   self.EpgCurrentChannelId)
        if ChannelEpg == None:
            func.updateLabelText(self, 1, 'Zender gids mist')
            func.updateLabelText(
                self, 2, 'Gids is niet beschikbaar voor ' +
                self.EpgCurrentChannelName + '.')
            return

        programSelectIndex = 0
        programCurrentIndex = 0
        for program in ChannelEpg['containers']:
            try:
                #Load program basics
                ProgramTimeStartDateTime = metadatainfo.programstartdatetime_from_json_metadata(
                    program)
                ProgramTimeStartDateTime = func.datetime_remove_seconds(
                    ProgramTimeStartDateTime)
                ProgramTimeEndDateTime = metadatainfo.programenddatetime_from_json_metadata(
                    program)

                #Check if program is starting or ending on target day
                ProgramTimeStartDayString = ProgramTimeStartDateTime.strftime(
                    '%Y-%m-%d')
                ProgramTimeEndDayString = ProgramTimeEndDateTime.strftime(
                    '%Y-%m-%d')
                if ProgramTimeStartDayString != epgDayString and ProgramTimeEndDayString != epgDayString:
                    continue

                #Load program details
                ProgramId = metadatainfo.contentId_from_json_metadata(program)
                ProgramName = metadatainfo.programtitle_from_json_metadata(
                    program)
                ProgramProgressPercent = int(
                    ((dateTimeNow - ProgramTimeStartDateTime).total_seconds() /
                     60) * 100 /
                    ((ProgramTimeEndDateTime -
                      ProgramTimeStartDateTime).total_seconds() / 60))
                ProgramDurationString = metadatainfo.programdurationstring_from_json_metadata(
                    program, False, False)
                EpisodeTitle = metadatainfo.episodetitle_from_json_metadata(
                    program, True, ProgramName)
                ProgramYear = metadatainfo.programyear_from_json_metadata(
                    program)
                ProgramSeason = metadatainfo.programseason_from_json_metadata(
                    program)
                ProgramEpisode = metadatainfo.episodenumber_from_json_metadata(
                    program)
                ProgramStarRating = metadatainfo.programstarrating_from_json_metadata(
                    program)
                ProgramAgeRating = metadatainfo.programagerating_from_json_metadata(
                    program)
                ProgramGenres = metadatainfo.programgenres_from_json_metadata(
                    program)
                ProgramDescriptionRaw = metadatainfo.programdescription_from_json_metadata(
                    program)
                ProgramDescription = 'Programmabeschrijving wordt geladen.'
                ProgramEpgList = 'Programmaduur wordt geladen'

                #Combine program details
                stringJoin = [
                    EpisodeTitle, ProgramYear, ProgramSeason, ProgramEpisode,
                    ProgramStarRating, ProgramAgeRating, ProgramGenres
                ]
                ProgramDetails = ' '.join(filter(None, stringJoin))
                if func.string_isnullorempty(ProgramDetails):
                    ProgramDetails = 'Onbekend seizoen en aflevering'

                #Check if program vod is available for playback
                contentOptionsArray = metadatainfo.contentOptions_from_json_metadata(
                    program)
                if 'CATCHUP' in contentOptionsArray:
                    ProgramAvailable = 'true'
                else:
                    ProgramAvailable = 'false'

                #Check if the program is part of series
                ProgramRecordSeriesId = metadatainfo.seriesId_from_json_metadata(
                    program)

                #Check if current program is a rerun
                programRerunName = any(substring
                                       for substring in var.EpgRerunSearchTerm
                                       if substring in ProgramName.lower())
                programRerunDescription = any(
                    substring for substring in var.EpgRerunSearchTerm
                    if substring in ProgramDescription.lower())
                if programRerunName or programRerunDescription:
                    ProgramRerun = 'true'
                else:
                    ProgramRerun = 'false'

                #Add program to the list container
                listitem = xbmcgui.ListItem()
                listitem.setProperty('ProgramId', ProgramId)
                listitem.setProperty('AssetId', self.EpgCurrentAssetId)
                listitem.setProperty('ChannelId', self.EpgCurrentChannelId)
                listitem.setProperty('ExternalId', self.EpgCurrentExternalId)
                listitem.setProperty('ChannelName', self.EpgCurrentChannelName)
                listitem.setProperty('ProgramName', ProgramName)
                listitem.setProperty('ProgramRerun', ProgramRerun)
                listitem.setProperty('ProgramDuration', ProgramDurationString)
                listitem.setProperty('ProgramRecordSeriesId',
                                     ProgramRecordSeriesId)
                listitem.setProperty('ProgramDescriptionRaw',
                                     ProgramDescriptionRaw)
                listitem.setProperty('ProgramDescription', ProgramDescription)
                listitem.setProperty('ProgramEpgList', ProgramEpgList)
                listitem.setProperty('ProgramDetails', ProgramDetails)
                listitem.setProperty('ProgramTimeStart',
                                     str(ProgramTimeStartDateTime))
                listitem.setProperty('ProgramTimeEnd',
                                     str(ProgramTimeEndDateTime))
                listitem.setInfo('video', {
                    'Genre': 'TV Gids',
                    'Plot': ProgramDescriptionRaw
                })
                listitem.setArt({
                    'thumb':
                    path.icon_television(self.EpgCurrentExternalId),
                    'icon':
                    path.icon_television(self.EpgCurrentExternalId)
                })

                #Check if program finished airing
                if ProgramProgressPercent >= 100:
                    listitem.setProperty('ProgramAvailable', ProgramAvailable)

                #Check if program is still airing
                if ProgramProgressPercent > 0 and ProgramProgressPercent < 100:
                    programSelectIndex = programCurrentIndex

                programCurrentIndex += 1
                listcontainer.addItem(listitem)
            except:
                continue

        #Select program list item
        listcontainer.selectItem(programSelectIndex)
        xbmc.sleep(100)

        #Load program progress
        self.load_progress()

        #Update epg variables
        self.EpgPreviousChannelId = self.EpgCurrentChannelId
        self.EpgPreviousLoadDayInt = self.EpgCurrentLoadDayInt
        self.EpgPreviousLoadDateTime = dateTimeNowString

        #Update the status
        self.count_epg(self.EpgCurrentChannelName)
コード例 #27
0
ファイル: yesterday.py プロジェクト: dumbie/KodiAddons
    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)
コード例 #28
0
    def load_program(self, forceLoad=False, forceUpdate=False):
        if forceUpdate == True:
            notificationIcon = path.resources('resources/skins/default/media/common/recorddone.png')
            xbmcgui.Dialog().notification(var.addonname, 'Opnames 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, "Opnames downloaden")
        downloadResult = download.download_recording_event(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, "Opnames laden")
        for program in var.ChannelsDataJsonRecordingEvent['resultObj']['containers']:
            try:
                #Load program basics
                ProgramName = metadatainfo.programtitle_from_json_metadata(program)
                ProgramNameRaw = ProgramName
                ProgramTimeEndDateTime = metadatainfo.programenddatetime_generate_from_json_metadata(program)

                #Check if there are search results
                if var.SearchFilterTerm != '':
                    searchMatch = func.search_filter_string(ProgramName)
                    searchResultFound = var.SearchFilterTerm in searchMatch
                    if searchResultFound == False: continue

                #Check if program has finished airing and processing
                if datetime.now() < (ProgramTimeEndDateTime + timedelta(minutes=var.RecordingProcessMinutes)): continue

                #Check if program is available for streaming
                AssetsLength = len(program['assets'])
                if AssetsLength > 0:
                    AssetsStatus = str(program['assets'][0]['status'])
                    if AssetsStatus == 'RecordFailed':
                        ProgramName = '(Opname mislukt) ' + ProgramName
                    elif AssetsStatus == 'ScheduleSuccess':
                        ProgramName = '(Geplande opname) ' + ProgramName    
                else:
                    ProgramName = '(Niet speelbaar) ' + ProgramName

                #Load program details
                ExternalId = metadatainfo.externalChannelId_from_json_metadata(program)
                ProgramAssetId = metadatainfo.get_stream_assetid(program['assets'])
                ProgramRecordEventId = metadatainfo.contentId_from_json_metadata(program)
                EpisodeTitle = metadatainfo.episodetitle_from_json_metadata(program, True, ProgramNameRaw)
                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)
                ProgramStartDeltaTime = str(metadatainfo.programstartdeltatime_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]'
                ProgramAvailability = metadatainfo.recording_available_time(program)

                #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]\n' + ProgramAvailability

                #Add program
                listitem = xbmcgui.ListItem()
                listitem.setProperty('Action', 'play_stream')
                listitem.setProperty('ProgramAssetId', ProgramAssetId)
                listitem.setProperty('ProgramRecordEventId', ProgramRecordEventId)
                listitem.setProperty('ProgramStartDeltaTime', ProgramStartDeltaTime)
                listitem.setProperty("ProgramName", ProgramName)
                listitem.setProperty("ProgramNameDesc", ProgramNameDesc)
                listitem.setProperty("ProgramNameRaw", ProgramNameRaw)
                listitem.setProperty("ProgramDetails", ProgramTime)
                listitem.setProperty('ProgramDescription', ProgramDescription)
                listitem.setInfo('video', {'Genre': 'Opname', '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)

        #Update the main page count
        if var.guiMain != None:
            var.guiMain.count_recorded_event()
            var.guiMain.count_recording_event()