Beispiel #1
0
    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)
Beispiel #2
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
Beispiel #3
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()
Beispiel #4
0
    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()
Beispiel #5
0
    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)