Exemplo n.º 1
0
def record_series_remove(SeriesId, KeepRecordings=True):
    #Check if user is logged in
    if var.ApiLoggedIn == False:
        apilogin.ApiLogin(False)

    try:
        DownloadHeaders = {
            "User-Agent": var.addon.getSetting('CustomUserAgent'),
            "Content-Type": "application/json",
            "Cookie": var.ApiLoginCookie,
            "X-Xsrf-Token": var.ApiLoginToken
        }

        DownloadData = json.dumps({
            "seriesIds": [int(SeriesId)],
            "isKeepRecordingsEnabled": KeepRecordings
        }).encode('ascii')
        DownloadRequest = hybrid.urllib_request(
            path.recording_series_add_remove(),
            data=DownloadData,
            headers=DownloadHeaders)
        DownloadRequest.get_method = lambda: 'DELETE'
        DownloadDataHttp = hybrid.urllib_urlopen(DownloadRequest)
        DownloadDataJson = json.load(DownloadDataHttp)

        #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/recordseries.png')
                xbmcgui.Dialog().notification(
                    var.addonname,
                    'Serie seizoen annulering mislukt: ' + resultMessage,
                    notificationIcon, 2500, False)
                return False

        notificationIcon = path.resources(
            'resources/skins/default/media/common/recordseries.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Serie seizoen opname is geannuleerd.',
                                      notificationIcon, 2500, False)

        #Download the recording series
        download_recording_series(True)

        #Download the recording event
        download_recording_event(True)

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

        return True
    except:
        notificationIcon = path.resources(
            'resources/skins/default/media/common/recordseries.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Serie seizoen annulering mislukt.',
                                      notificationIcon, 2500, False)
        return False
Exemplo n.º 2
0
    def buttons_add_sidebar(self):
        #Get and check the list container
        listcontainer = self.getControl(1002)
        if listcontainer.size() > 0: return True

        listitem = xbmcgui.ListItem('Ga naar vorige scherm')
        listitem.setProperty('Action', 'media_previousscreen')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/back.png'),
            'icon':
            path.resources('resources/skins/default/media/common/back.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Afspelen of pauzeren')
        listitem.setProperty('Action', 'media_playpause')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/playpause.png'),
            'icon':
            path.resources(
                'resources/skins/default/media/common/playpause.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Stop met het afspelen')
        listitem.setProperty('Action', 'media_stop')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/stop.png'),
            'icon':
            path.resources('resources/skins/default/media/common/stop.png')
        })
        listcontainer.addItem(listitem)

        if xbmc.getCondVisibility(
                'System.Platform.Android') == False and xbmc.getCondVisibility(
                    'System.Platform.IOS') == False:
            listitem = xbmcgui.ListItem('Schakel tussen scherm modus')
            listitem.setProperty('Action', 'media_fullscreen')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/fullscreen.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/fullscreen.png')
            })
            listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Zap naar vorige zender')
        listitem.setProperty('Action', 'media_lastchannel')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/last.png'),
            'icon':
            path.resources('resources/skins/default/media/common/last.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Volgend programma alarm')
        listitem.setProperty('Action', 'media_alarmnext')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/alarm.png'),
            'icon':
            path.resources('resources/skins/default/media/common/alarm.png')
        })
        listcontainer.addItem(listitem)

        if var.RecordingAccess == True:
            listitem = xbmcgui.ListItem('Programma opnemen of annuleren')
            listitem.setProperty('Action', 'media_record_event')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/record.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/record.png')
            })
            listcontainer.addItem(listitem)

            listitem = xbmcgui.ListItem('Serie seizoen opnemen of annuleren')
            listitem.setProperty('Action', 'media_record_series')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/recordseries.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/recordseries.png')
            })
            listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Beheer de slaap timer')
        listitem.setProperty('Action', 'media_sleep')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/sleep.png'),
            'icon':
            path.resources('resources/skins/default/media/common/sleep.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Stream achteruit spoelen')
        listitem.setProperty('Action', 'media_seekback')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/seekback.png'),
            'icon':
            path.resources('resources/skins/default/media/common/seekback.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Stream vooruit spoelen')
        listitem.setProperty('Action', 'media_seekforward')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/seekforward.png'),
            'icon':
            path.resources(
                'resources/skins/default/media/common/seekforward.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Spoel naar live stream')
        listitem.setProperty('Action', 'media_seeklive')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/seeklive.png'),
            'icon':
            path.resources('resources/skins/default/media/common/seeklive.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Spoel naar programma begin')
        listitem.setProperty('Action', 'media_seekbegin')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/rerun.png'),
            'icon':
            path.resources('resources/skins/default/media/common/rerun.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Geluid volume omhoog')
        listitem.setProperty('Action', 'media_volumeup')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/volumeup.png'),
            'icon':
            path.resources('resources/skins/default/media/common/volumeup.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Geluid volume omlaag')
        listitem.setProperty('Action', 'media_volumedown')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/volumedown.png'),
            'icon':
            path.resources(
                'resources/skins/default/media/common/volumedown.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Demp of ondemp geluid')
        listitem.setProperty('Action', 'media_togglemute')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/volumemute.png'),
            'icon':
            path.resources(
                'resources/skins/default/media/common/volumemute.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Ondertiteling aan of uit')
        listitem.setProperty('Action', 'media_subtitlesonoff')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/subtitles.png'),
            'icon':
            path.resources(
                'resources/skins/default/media/common/subtitles.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Geluids instellingen')
        listitem.setProperty('Action', 'settings_audio')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/settingsaudio.png'),
            'icon':
            path.resources(
                'resources/skins/default/media/common/settingsaudio.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Video instellingen')
        listitem.setProperty('Action', 'settings_video')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/settingsvideo.png'),
            'icon':
            path.resources(
                'resources/skins/default/media/common/settingsvideo.png')
        })
        listcontainer.addItem(listitem)

        #Focus on the list
        self.setFocus(listcontainer)
        xbmc.sleep(100)

        #Select list item
        listcontainer.selectItem(0)
        xbmc.sleep(100)
Exemplo n.º 3
0
def record_series_add(ChannelId, liveSeriesId):
    #Check if user is logged in
    if var.ApiLoggedIn == False:
        apilogin.ApiLogin(False)

    try:
        DownloadHeaders = {
            "User-Agent": var.addon.getSetting('CustomUserAgent'),
            "Content-Type": "application/json",
            "Cookie": var.ApiLoginCookie,
            "X-Xsrf-Token": var.ApiLoginToken
        }

        DownloadData = json.dumps({
            "channelId": ChannelId,
            "seriesId": liveSeriesId,
            "isAutoDeletionEnabled": True,
            "episodeScope": "ALL",
            "isChannelBoundEnabled": True
        }).encode('ascii')
        DownloadRequest = hybrid.urllib_request(
            path.recording_series_add_remove(),
            data=DownloadData,
            headers=DownloadHeaders)
        DownloadDataHttp = hybrid.urllib_urlopen(DownloadRequest)
        DownloadDataJson = json.load(DownloadDataHttp)

        #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/recordseries.png')
                xbmcgui.Dialog().notification(
                    var.addonname,
                    'Serie seizoen planning mislukt: ' + resultMessage,
                    notificationIcon, 2500, False)
                return False

        notificationIcon = path.resources(
            'resources/skins/default/media/common/recordseries.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Serie seizoen wordt opgenomen.',
                                      notificationIcon, 2500, False)

        #Download the recording series
        download_recording_series(True)

        #Download the recording event
        download_recording_event(True)

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

        return True
    except:
        notificationIcon = path.resources(
            'resources/skins/default/media/common/recordseries.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Serie seizoen planning mislukt.',
                                      notificationIcon, 2500, False)
        return False
Exemplo n.º 4
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()
Exemplo n.º 5
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()
Exemplo n.º 6
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)
Exemplo n.º 7
0
    def load_channels(self, forceLoad=False, forceUpdate=False):
        if forceUpdate == True:
            notificationIcon = path.resources(
                'resources/skins/default/media/common/radio.png')
            xbmcgui.Dialog().notification(var.addonname,
                                          'Zenders 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 channels
        func.updateLabelText(self, 1, 'Zenders downloaden')
        downloadResult = download.download_channels_radio(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 channels to the list
        func.updateLabelText(self, 1, 'Zenders laden')
        ChannelNumberInt = 0
        for channel in var.ChannelsDataJsonRadio['radios']:
            try:
                #Load channel basics
                ChannelName = channel['name']

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

                #Load channel details
                ChannelId = channel['id']
                ChannelStream = channel['stream']

                #Update channel number
                ChannelNumberInt += 1
                ChannelNumberString = str(ChannelNumberInt)
                ChannelNumberAccent = func.get_provider_color_string(
                ) + ChannelNumberString + '[/COLOR]'

                #Add radio channel
                listitem = xbmcgui.ListItem()
                listitem.setProperty('Action', 'play_stream')
                listitem.setProperty('ChannelId', ChannelId)
                listitem.setProperty('ChannelName', ChannelName)
                listitem.setProperty('ChannelNumber', ChannelNumberString)
                listitem.setProperty('ChannelNumberAccent',
                                     ChannelNumberAccent)
                listitem.setProperty('StreamUrl', ChannelStream)
                listitem.setInfo('music', {'Genre': 'Radio'})
                listitem.setArt({
                    'thumb': path.icon_radio(ChannelId),
                    'icon': path.icon_radio(ChannelId)
                })
                listcontainer.addItem(listitem)
            except:
                continue

        #Update the status
        self.count_radio(True)
Exemplo n.º 8
0
def play_stream_television(listItem, Windowed):
    #Get channel settings and variables
    NewAssetId = listItem.getProperty('AssetId')
    NewChannelId = listItem.getProperty('ChannelId')
    NewExternalId = listItem.getProperty('ExternalId')
    NewChannelName = listItem.getProperty('ChannelName')
    CurrentAssetId = var.addon.getSetting('CurrentAssetId')
    CurrentChannelId = var.addon.getSetting('CurrentChannelId')
    CurrentExternalId = var.addon.getSetting('CurrentExternalId')
    CurrentChannelName = var.addon.getSetting('CurrentChannelName')

    #Allow longer back seeking
    DateTimeUtc = datetime.utcnow() - timedelta(
        minutes=int(var.addon.getSetting('StreamSeekMinutes')))
    StartString = '&time=' + str(func.datetime_to_ticks(DateTimeUtc))

    #Check if user is logged in
    if var.ApiLoggedIn == False:
        apilogin.ApiLogin(False)

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

        RequestUrl = path.stream_url_tv(NewChannelId, NewAssetId) + StartString
        DownloadRequest = hybrid.urllib_request(RequestUrl,
                                                headers=DownloadHeaders)
        DownloadDataHttp = hybrid.urllib_urlopen(DownloadRequest)
        DownloadDataJson = json.load(DownloadDataHttp)
    except:
        notificationIcon = path.resources(
            'resources/skins/default/media/common/television.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Zender 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/television.png')
            xbmcgui.Dialog().notification(
                var.addonname, 'Zender 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/television.png')
        xbmcgui.Dialog().notification(var.addonname,
                                      'Stream is niet beschikbaar.',
                                      notificationIcon, 2500, False)
        return

    #Update channel settings and variables
    if CurrentChannelId != NewChannelId:
        var.addon.setSetting('LastAssetId', CurrentAssetId)
        var.addon.setSetting('LastChannelId', CurrentChannelId)
        var.addon.setSetting('LastExternalId', CurrentExternalId)
        var.addon.setSetting('LastChannelName', CurrentChannelName)

    var.addon.setSetting('CurrentAssetId', NewAssetId)
    var.addon.setSetting('CurrentChannelId', NewChannelId)
    var.addon.setSetting('CurrentExternalId', NewExternalId)
    var.addon.setSetting('CurrentChannelName', NewChannelName)

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

    #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(NewChannelName)

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

    #Start playing the media
    var.PlayerCustom.PlayCustom(StreamUrl, listItem, Windowed, True)
Exemplo n.º 9
0
def record_series_television_playergui(listItemSelected, forceRecord=False):
    ChannelId = listItemSelected.getProperty('ChannelId')
    ProgramNowRecordSeries = listItemSelected.getProperty(
        'ProgramNowRecordSeries')
    ProgramNowRecordSeriesId = listItemSelected.getProperty(
        'ProgramNowRecordSeriesId')
    ProgramNextRecordSeriesId = listItemSelected.getProperty(
        'ProgramNextRecordSeriesId')

    if ProgramNowRecordSeriesId == '':
        notificationIcon = path.resources(
            'resources/skins/default/media/common/recordseries.png')
        xbmcgui.Dialog().notification(
            var.addonname, 'Serie seizoen kan niet worden opgenomen.',
            notificationIcon, 2500, False)
        return

    if ProgramNowRecordSeries == 'false' or forceRecord == True:
        seriesAdd = download.record_series_add(ChannelId,
                                               ProgramNowRecordSeriesId)
        if seriesAdd == True:
            listItemSelected.setProperty('ProgramNowRecordEvent', 'true')
            listItemSelected.setProperty('ProgramNowRecordSeries', 'true')
            if ProgramNextRecordSeriesId == ProgramNowRecordSeriesId:
                listItemSelected.setProperty('ProgramNextRecordEvent', 'true')
                listItemSelected.setProperty('ProgramNextRecordSeries', 'true')
    else:
        #Get the removal series id
        recordProgramSeries = func.search_seriesid_jsonrecording_series(
            ProgramNowRecordSeriesId)
        if recordProgramSeries:
            ProgramRecordSeriesIdLive = metadatainfo.seriesId_from_json_metadata(
                recordProgramSeries)
        else:
            notificationIcon = path.resources(
                'resources/skins/default/media/common/recordseries.png')
            xbmcgui.Dialog().notification(var.addonname,
                                          'Serie seizoen annulering mislukt.',
                                          notificationIcon, 2500, False)
            return

        #Ask user to remove recordings
        dialogAnswers = ['Opnames verwijderen', 'Opnames houden']
        dialogHeader = 'Serie opnames verwijderen'
        dialogSummary = 'Wilt u ook alle opnames van deze serie seizoen verwijderen?'
        dialogFooter = ''
        dialogResult = dialog.show_dialog(dialogHeader, dialogSummary,
                                          dialogFooter, dialogAnswers)
        if dialogResult == 'Opnames verwijderen':
            KeepRecording = False
        elif dialogResult == 'Opnames houden':
            KeepRecording = True
        else:
            return

        #Remove record series
        seriesRemove = download.record_series_remove(ProgramRecordSeriesIdLive,
                                                     KeepRecording)
        if seriesRemove == True:
            listItemSelected.setProperty('ProgramNowRecordEvent', 'false')
            listItemSelected.setProperty('ProgramNowRecordSeries', 'false')
            if ProgramNextRecordSeriesId == ProgramNowRecordSeriesId:
                listItemSelected.setProperty('ProgramNextRecordEvent', 'false')
                listItemSelected.setProperty('ProgramNextRecordSeries',
                                             'false')
Exemplo n.º 10
0
    def buttons_add_menu(self):
        #Get and check the main list container
        listcontainer = self.getControl(1000)
        if listcontainer.size() > 0: return True

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('Televisie')
            listitem.setProperty('Action', 'page_television')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/television.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/television.png')
            })
            listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Radio')
        listitem.setProperty('Action', 'page_radio')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/radio.png'),
            'icon':
            path.resources('resources/skins/default/media/common/radio.png')
        })
        listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('Films')
            listitem.setProperty('Action', 'page_movies')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/movies.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/movies.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('Series')
            listitem.setProperty('Action', 'page_series')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/series.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/series.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('TV Gids')
            listitem.setProperty('Action', 'page_epg')
            listitem.setArt({
                'thumb':
                path.resources('resources/skins/default/media/common/epg.png'),
                'icon':
                path.resources('resources/skins/default/media/common/epg.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('Zoeken')
            listitem.setProperty('Action', 'page_search')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/search.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/search.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('Sport Gemist')
            listitem.setProperty('Action', 'page_sport')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/sport.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/sport.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('Gister Gemist')
            listitem.setProperty('Action', 'page_yesterday')
            listitem.setArt({
                'thumb':
                path.resources('resources/skins/default/media/common/vod.png'),
                'icon':
                path.resources('resources/skins/default/media/common/vod.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            if var.addon.getSetting('KidsPageLock') == 'true':
                listitem = xbmcgui.ListItem('Kids met slot')
            else:
                listitem = xbmcgui.ListItem('Kids')
            listitem.setProperty('Action', 'page_kids')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/kids.png'),
                'icon':
                path.resources('resources/skins/default/media/common/kids.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True and var.RecordingAccess == True:
            listitem = xbmcgui.ListItem('Bekijk Opnames (?)')
            listitem.setProperty('Action', 'page_recorded')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/recorddone.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/recorddone.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True and var.RecordingAccess == True:
            listitem = xbmcgui.ListItem('Geplande Opnames (?)')
            listitem.setProperty('Action', 'page_recording_event')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/record.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/record.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True and var.RecordingAccess == True:
            listitem = xbmcgui.ListItem('Geplande Series (?)')
            listitem.setProperty('Action', 'page_recording_series')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/recordseries.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/recordseries.png')
            })
            listcontainer.addItem(listitem)

        if var.ApiLoggedIn == True:
            listitem = xbmcgui.ListItem('Alarmen (?)')
            listitem.setProperty('Action', 'page_alarm')
            listitem.setArt({
                'thumb':
                path.resources(
                    'resources/skins/default/media/common/alarm.png'),
                'icon':
                path.resources(
                    'resources/skins/default/media/common/alarm.png')
            })
            listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Slaap Timer')
        listitem.setProperty('Action', 'page_sleep')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/sleep.png'),
            'icon':
            path.resources('resources/skins/default/media/common/sleep.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Instellingen')
        listitem.setProperty('Action', 'addon_settings')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/settings.png'),
            'icon':
            path.resources('resources/skins/default/media/common/settings.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Help')
        listitem.setProperty('Action', 'page_help')
        listitem.setArt({
            'thumb':
            path.resources('resources/skins/default/media/common/help.png'),
            'icon':
            path.resources('resources/skins/default/media/common/help.png')
        })
        listcontainer.addItem(listitem)

        listitem = xbmcgui.ListItem('Sluiten')
        listitem.setProperty('Action', 'addon_shutdown')
        listitem.setArt({
            'thumb':
            path.resources(
                'resources/skins/default/media/common/shutdown.png'),
            'icon':
            path.resources('resources/skins/default/media/common/shutdown.png')
        })
        listcontainer.addItem(listitem)
Exemplo n.º 11
0
    def buttons_add_media(self, resetButtons):
        #Get and check the media control list container
        listcontainer = self.getControl(1001)
        if resetButtons:
            listcontainer.reset()
            listcontainer = self.getControl(1000)
            self.setFocus(listcontainer)
            xbmc.sleep(100)
            return

        if xbmc.Player().isPlaying():
            #Add stop button
            if listcontainer.size() == 0:
                listitem = xbmcgui.ListItem('Stop met afspelen')
                listitem.setProperty('Action', 'media_stop')
                listitem.setArt({
                    'thumb':
                    path.resources(
                        'resources/skins/default/media/common/stop.png'),
                    'icon':
                    path.resources(
                        'resources/skins/default/media/common/stop.png')
                })
                listcontainer.addItem(listitem)

            #Add mute button
            if listcontainer.size() == 1:
                listitem = xbmcgui.ListItem('On/demp het geluid')
                listitem.setProperty('Action', 'media_togglemute')
                listitem.setArt({
                    'thumb':
                    path.resources(
                        'resources/skins/default/media/common/volumemute.png'),
                    'icon':
                    path.resources(
                        'resources/skins/default/media/common/volumemute.png')
                })
                listcontainer.addItem(listitem)

            #Add fullscreen button
            if xbmc.Player().isPlayingVideo():
                if listcontainer.size() == 2:
                    listitem = xbmcgui.ListItem()
                    listitem.setLabel('Toon video speler')
                    listitem.setProperty('Action', 'media_fullscreen')
                    listitem.setArt({
                        'thumb':
                        path.resources(
                            'resources/skins/default/media/common/fullscreen.png'
                        ),
                        'icon':
                        path.resources(
                            'resources/skins/default/media/common/fullscreen.png'
                        )
                    })
                    listcontainer.addItem(listitem)
                elif listcontainer.size() == 3:
                    updateItem = listcontainer.getListItem(2)
                    updateItem.setLabel('Toon video speler')
                    updateItem.setProperty('Action', 'media_fullscreen')
                    updateItem.setArt({
                        'thumb':
                        path.resources(
                            'resources/skins/default/media/common/fullscreen.png'
                        ),
                        'icon':
                        path.resources(
                            'resources/skins/default/media/common/fullscreen.png'
                        )
                    })
            elif xbmc.Player().isPlayingAudio():
                if listcontainer.size() == 2:
                    listitem = xbmcgui.ListItem()
                    listitem.setLabel('Toon visualisatie')
                    listitem.setProperty('Action', 'show_visualisation')
                    listitem.setArt({
                        'thumb':
                        path.resources(
                            'resources/skins/default/media/common/visualisation.png'
                        ),
                        'icon':
                        path.resources(
                            'resources/skins/default/media/common/visualisation.png'
                        )
                    })
                    listcontainer.addItem(listitem)
                elif listcontainer.size() == 3:
                    updateItem = listcontainer.getListItem(2)
                    updateItem.setLabel('Toon visualisatie')
                    updateItem.setProperty('Action', 'show_visualisation')
                    updateItem.setArt({
                        'thumb':
                        path.resources(
                            'resources/skins/default/media/common/visualisation.png'
                        ),
                        'icon':
                        path.resources(
                            'resources/skins/default/media/common/visualisation.png'
                        )
                    })
            elif listcontainer.size() == 3:
                listcontainer.removeItem(2)
                xbmc.sleep(100)
        else:
            listcontainer.reset()
            listcontainer = self.getControl(1000)
            self.setFocus(listcontainer)
            xbmc.sleep(100)
Exemplo n.º 12
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)