def _login(self):
        creds = Credentials()

        if not creds.are_filled_in():
            KodiWrapper.dialog_ok(KodiWrapper.get_localized_string(32014),
                                  KodiWrapper.get_localized_string(32015))
            KodiWrapper.open_settings()
            creds.reload()

        resp = self.session.post(
            "https://login.prd.telenet.be/openid/login.do",
            data=login_payload(creds.username, creds.password))

        last_response = resp.history[-1]

        try:
            self.auth_tries += 1

            if "Location" in last_response.headers:
                token = self.extract_auth_token(
                    last_response.headers.get('Location'))
                if not token:
                    raise NotAuthorizedException()
                PluginCache.set_data({"auth_token": token})
                return True
        except NotAuthorizedException:
            KodiWrapper.dialog_ok(KodiWrapper.get_localized_string(32006),
                                  KodiWrapper.get_localized_string(32007))

            if self.auth_tries < 2:
                KodiWrapper.open_settings()
                self._execute_required_steps()

        return False
def refresh_epg():
    KodiWrapper.dialog_ok(
        KodiWrapper.get_localized_string(40001),  # Info
        KodiWrapper.get_localized_string(40003))  # This can take a while
    BackgroundService.cache_channel_epg()
    KodiWrapper.dialog_ok(
        KodiWrapper.get_localized_string(40001),  # Info
        KodiWrapper.get_localized_string(40002))  # EPG has been renewed
Beispiel #3
0
def refresh_epg():
    KodiWrapper.dialog_ok(KodiWrapper.get_localized_string(40001),
                          KodiWrapper.get_localized_string(40003))
    BackgroundService.cache_channel_epg()
    KodiWrapper.dialog_ok(KodiWrapper.get_localized_string(40001),
                          KodiWrapper.get_localized_string(40002))