Ejemplo n.º 1
0
def search_channelid_jsonepg(jsonEpg, searchChannelId):
    if jsonEpg == []: return None
    for Epg in jsonEpg["resultObj"]["containers"]:
        try:
            if metadatainfo.channelId_from_json_metadata(
                    Epg) == searchChannelId:
                return Epg
        except:
            continue
    return None
Ejemplo n.º 2
0
def search_channelid_jsontelevision(searchChannelId):
    if var.ChannelsDataJsonTelevision == []: return None
    for Channel in var.ChannelsDataJsonTelevision["resultObj"]["containers"]:
        try:
            if metadatainfo.channelId_from_json_metadata(
                    Channel) == searchChannelId:
                return Channel
        except:
            continue
    return None
Ejemplo n.º 3
0
def search_channelid_jsonrecording_series(searchChannelId):
    if var.ChannelsDataJsonRecordingSeries == []: return None
    for Record in var.ChannelsDataJsonRecordingSeries["resultObj"][
            "containers"]:
        try:
            if metadatainfo.channelId_from_json_metadata(
                    Record) == searchChannelId:
                return Record
        except:
            continue
    return None
Ejemplo n.º 4
0
def search_channelid_jsonrecording_event(searchChannelId, filterTime=False):
    if var.ChannelsDataJsonRecordingEvent == []: return None
    for Record in var.ChannelsDataJsonRecordingEvent["resultObj"][
            "containers"]:
        try:
            if filterTime == True:
                ProgramTimeEndDateTime = metadatainfo.programenddatetime_generate_from_json_metadata(
                    Record)
                if datetime.now() > ProgramTimeEndDateTime: continue
            if metadatainfo.channelId_from_json_metadata(
                    Record) == searchChannelId:
                return Record
        except:
            continue
    return None
Ejemplo n.º 5
0
    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()
Ejemplo n.º 6
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