Python xbmcgui 模块,NOTIFICATION_ERROR 实例源码

我们从Python开源项目中,提取了以下28个代码示例,用于说明如何使用xbmcgui.NOTIFICATION_ERROR

项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
def get_album_json_thread(self):
        try:
            while not xbmc.abortRequested and not self.abortAlbumThreads:
                try:
                    album_id = self.albumQueue.get_nowait()
                except:
                    break
                try:
                    self.get_album(album_id, withCache=False)
                except requests.HTTPError as e:
                    r = e.response
                    msg = _T(30505)
                    try:
                        msg = r.reason
                        msg = r.json().get('userMessage')
                    except:
                        pass
                    log('Error getting Album ID %s' % album_id, xbmc.LOGERROR)
                    if r.status_code == 429 and not self.abortAlbumThreads:
                        self.abortAlbumThreads = True
                        log('Too many requests. Aborting Workers ...', xbmc.LOGERROR)
                        self.albumQueue._init(9999)
                        xbmcgui.Dialog().notification(plugin.name, msg, xbmcgui.NOTIFICATION_ERROR)
        except Exception, e:
            traceback.print_exc()
项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
def user_playlist_move_entry(playlist_id, entry_no, item_id):
    dialog = xbmcgui.Dialog()
    playlist = session.user.selectPlaylistDialog(headline=_T(30248), allowNew=True)
    if playlist and playlist.id <> playlist_id:
        xbmc.executebuiltin( "ActivateWindow(busydialog)" )
        try:
            ok = session.user.add_playlist_entries(playlist=playlist, item_ids=[item_id])
            if ok:
                ok = session.user.remove_playlist_entry(playlist_id, entry_no=entry_no)
            else:
                dialog.notification(plugin.name, _T('API Call Failed'), xbmcgui.NOTIFICATION_ERROR)
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            traceback.print_exc()
        xbmc.executebuiltin( "Dialog.Close(busydialog)" )
        xbmc.executebuiltin('Container.Refresh()')
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def showParentalSettings():
    fsk_list = ['Deaktiviert', '0', '6', '12', '16', '18']
    dlg = xbmcgui.Dialog()
    code = dlg.input('PIN Code', type=xbmcgui.INPUT_NUMERIC)
    if code == xbmcaddon.Addon().getSetting('password'):
        idx = dlg.select('Wähle maximale FSK Alterstufe', fsk_list)
        if idx >= 0:
            fsk_code = fsk_list[idx]
            if fsk_code == 'Deaktiviert':
                xbmcaddon.Addon().setSetting('js_maxrating', '-1')
            else:
                xbmcaddon.Addon().setSetting('js_maxrating', fsk_list[idx])
        if idx > 0:
            if dlg.yesno('Jugendschutz', 'Sollen Inhalte mit einer Alterseinstufung über ', 'FSK ' + fsk_list[idx] + ' angezeigt werden?'):
                xbmcaddon.Addon().setSetting('js_showall', 'true')
            else:
                xbmcaddon.Addon().setSetting('js_showall', 'false')
    else:
        xbmcgui.Dialog().notification('SkyGo - Jugendschutz', 'Fehlerhafte PIN', xbmcgui.NOTIFICATION_ERROR, 2000, True)
项目:plugin.video.exodus    作者:lastship    | 项目源码 | 文件源码
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
    if icon == '': icon = addonIcon()
    elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO
    elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING
    elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading, message, icon, time, sound=sound)
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def log_exception(modulename, exceptiondetails):
    '''helper to properly log exception details'''
    log_msg(format_exc(sys.exc_info()), xbmc.LOGNOTICE)
    log_msg("ERROR in %s ! --> %s" % (modulename, exceptiondetails), xbmc.LOGERROR)
    dialog = xbmcgui.Dialog()
    dialog.notification(
        "Skin Helper Backup",
        "Error while executing, please check your kodi logfile.",
        xbmcgui.NOTIFICATION_ERROR)
    del dialog
项目:plugin.video.telekom-sport    作者:asciidisco    | 项目源码 | 文件源码
def show_login_failed_notification(self):
        """
        Shows login failed notification for 5 sec

        :returns:  bool - Notification shown
        """
        dialog = xbmcgui.Dialog()
        dialog.notification(
            self.utils.get_local_string(string_id=32006),
            self.utils.get_local_string(string_id=32007),
            xbmcgui.NOTIFICATION_ERROR, 5000)
项目:plugin.video.lastship    作者:lastship    | 项目源码 | 文件源码
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
    if icon == '': icon = addonIcon()
    elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO
    elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING
    elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading, message, icon, time, sound=sound)
项目:plugin.video.exodus    作者:huberyhe    | 项目源码 | 文件源码
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
    if icon == '': icon = addonIcon()
    elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO
    elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING
    elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading, message, icon, time, sound=sound)
项目:plugin.video.brplay    作者:olavopeixoto    | 项目源码 | 文件源码
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
    if icon == '':
        icon = addonIcon()
    elif icon == 'INFO':
        icon = xbmcgui.NOTIFICATION_INFO
    elif icon == 'WARNING':
        icon = xbmcgui.NOTIFICATION_WARNING
    elif icon == 'ERROR':
        icon = xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading=heading, message=message, icon=icon, time=time, sound=sound)
项目:plugin.video.netflix    作者:asciidisco    | 项目源码 | 文件源码
def show_login_failed_notify(self):
        """
        Shows notification that the login failed

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30008),
            message=self.get_local_string(string_id=30009),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog
项目:plugin.video.netflix    作者:asciidisco    | 项目源码 | 文件源码
def show_request_error_notify(self):
        """
        Shows notification that a request error occured

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30051),
            message=self.get_local_string(string_id=30052),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog
项目:plugin.video.netflix    作者:asciidisco    | 项目源码 | 文件源码
def show_is_missing_notify(self):
        """
        Shows notification that the inputstream addon couldn't be found

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30028),
            message=self.get_local_string(string_id=30029),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog
项目:plugin.video.netflix    作者:asciidisco    | 项目源码 | 文件源码
def show_is_inactive_notify(self):
        """
        Shows notification that the inputstream addon isn't enabled.

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30028),
            message=self.get_local_string(string_id=30046),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog
项目:plugin.video.netflix    作者:asciidisco    | 项目源码 | 文件源码
def show_invalid_pin_notify(self):
        """
        Shows notification that a wrong adult pin was given

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30006),
            message=self.get_local_string(string_id=30007),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog
项目:plugin.video.stream-cinema    作者:bbaronSVK    | 项目源码 | 文件源码
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
    if icon == '': icon = icon=__addon__.getAddonInfo('icon')
    elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO
    elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING
    elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading, message, icon, time, sound=sound)
项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
def login():
    username = addon.getSetting('username')
    password = addon.getSetting('password')
    subscription_type = [SubscriptionType.hifi, SubscriptionType.premium][int('0' + addon.getSetting('subscription_type'))]

    if not username or not password:
        # Ask for username/password
        dialog = xbmcgui.Dialog()
        username = dialog.input(_T(30008), username)
        if not username:
            return
        password = dialog.input(_T(30009), option=xbmcgui.ALPHANUM_HIDE_INPUT)
        if not password:
            return
        selected = dialog.select(_T(30010), [SubscriptionType.hifi, SubscriptionType.premium])
        if selected < 0:
            return
        subscription_type = [SubscriptionType.hifi, SubscriptionType.premium][selected]

    ok = session.login(username, password, subscription_type)
    if ok and (not addon.getSetting('username') or not addon.getSetting('password')):
        # Ask about remembering username/password
        dialog = xbmcgui.Dialog()
        if dialog.yesno(plugin.name, _T(30209)):
            addon.setSetting('username', username)
            addon.setSetting('password', password)
        else:
            addon.setSetting('password', '')
    if not ok:
        xbmcgui.Dialog().notification(plugin.name, _T(30253) , icon=xbmcgui.NOTIFICATION_ERROR)
    xbmc.executebuiltin('Container.Refresh()')
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def dialog_notification(heading, message, icon=0, time=5000, sound=True):
    dialog = xbmcgui.Dialog()
    try:
        l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR
        dialog.notification(heading, message, l_icono[icon], time, sound)
    except:
        dialog_ok(heading, message)
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def dialog_notification(heading, message, icon=0, time=5000, sound=True):
    dialog = xbmcgui.Dialog()
    l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading, message, l_icono[icon], time, sound)
项目:plugin.video.amazon65    作者:phil65    | 项目源码 | 文件源码
def getFlashVars(url):
    cookie = common.mechanizeLogin()
    showpage = common.getURL(url, useCookie=cookie)
    if not showpage:
        Dialog.notification(common.__plugin__, Error('CDP.InvalidRequest'), xbmcgui.NOTIFICATION_ERROR)
        return False
    values = {}
    search = {'sessionID': "ue_sid='(.*?)'",
              'marketplace': "ue_mid='(.*?)'",
              'customer': '"customerID":"(.*?)"'}
    if 'var config' in showpage:
        flashVars = re.compile('var config = (.*?);', re.DOTALL).findall(showpage)
        flashVars = json.loads(unicode(flashVars[0], errors='ignore'))
        values = flashVars['player']['fl_config']['initParams']
    else:
        for key, pattern in search.items():
            result = re.compile(pattern, re.DOTALL).findall(showpage)
            if result:
                values[key] = result[0]

    for key in values.keys():
        if key not in values:
            Dialog.notification(common.getString(30200), common.getString(30210), xbmcgui.NOTIFICATION_ERROR)
            return False

    values['deviceTypeID'] = DEVICETYPE_ID
    values['asin'] = common.args.asin
    values['userAgent'] = common.UserAgent
    values['deviceID'] = common.gen_id()
    rand = 'onWebToken_' + str(random.randint(0, 484))
    pltoken = common.getURL(common.BASE_URL + "/gp/video/streaming/player-token.json?callback=" + rand, useCookie=cookie)
    try:
        values['token'] = re.compile('"([^"]*).*"([^"]*)"').findall(pltoken)[0][1]
    except Exception:
        Dialog.notification(common.getString(30200), common.getString(30201), xbmcgui.NOTIFICATION_ERROR)
        return False
    return values
项目:plugin.video.zdf_de_2016    作者:generia    | 项目源码 | 文件源码
def sendError(self, message, action=Action()):
        self._sendMessage(xbmcgui.NOTIFICATION_ERROR, self.context._(32039), message, action)
项目:soap4me-proxy    作者:eschava    | 项目源码 | 文件源码
def message_error(message):
        xbmcgui.Dialog().notification("Soap4.me", message, icon=xbmcgui.NOTIFICATION_ERROR, sound=False)
项目:addon    作者:alfa-addon    | 项目源码 | 文件源码
def dialog_notification(heading, message, icon=0, time=5000, sound=True):
    dialog = xbmcgui.Dialog()
    try:
        l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR
        dialog.notification(heading, message, l_icono[icon], time, sound)
    except:
        dialog_ok(heading, message)
项目:plugin.video.9anime    作者:DxCx    | 项目源码 | 文件源码
def get_video_link(self):
        if not self._read_sources():
            dialog = xbmcgui.Dialog()
            dialog.notification(self._strings['notfound'], "", xbmcgui.NOTIFICATION_ERROR)
            return None
        return self._select_source()
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def login(self):

        # If already logged in and active session everything is fine
        if not self.isLoggedIn():
            #remove old cookies
            self.session.cookies.clear_session_cookies()
            response = self.sendLogin(username, password)

            # if login is correct but other session is active ask user if other session should be killed - T_227=SkyGoExtra
            if response['resultCode'] in ['T_206', 'T_227']:
                kill_session = False
                if autoKillSession == 'true':
                    kill_session = True

                if not kill_session:
                    kill_session = xbmcgui.Dialog().yesno('Sie sind bereits eingeloggt!','Sie sind bereits auf einem anderen Geraet oder mit einem anderen Browser eingeloggt. Wollen Sie die bestehende Sitzung beenden und sich jetzt hier neu anmelden?')

                if kill_session:
                    # Kill all Sessions (including ours)
                    self.killSessions()
                    # Session killed so login again
                    self.sendLogin(username, password)
                    # Activate Session
                    self.isLoggedIn()
                    # Save the cookies
                    with open(self.cookiePath, 'w') as f:
                        pickle.dump(requests.utils.dict_from_cookiejar(self.session.cookies), f)
                    return True
                return False
            elif response['resultMessage'] == 'KO':
                xbmcgui.Dialog().notification('Login Fehler', 'Login fehlgeschlagen. Bitte Login Daten ueberpruefen', icon=xbmcgui.NOTIFICATION_ERROR)
                return False
            elif response['resultCode'] == 'T_100':
                # Activate Session with new test if user is logged in
                self.isLoggedIn()
                return True
        else:
            return True

        # If any case is not matched return login failed
        return False
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def play(self, manifest_url, package_code, parental_rating=0, info_tag=None, apix_id=None):
        # Inputstream settings
        is_addon = getInputstreamAddon()
        if not is_addon:
            xbmcgui.Dialog().notification('SkyGo Fehler', 'Addon "inputstream.adaptive" fehlt!', xbmcgui.NOTIFICATION_ERROR, 2000, True)
            return False

        #Jugendschutz
        if not self.parentalCheck(parental_rating, play=True):
            xbmcgui.Dialog().notification('SkyGo - FSK ' + str(parental_rating), 'Keine Berechtigung zum Abspielen dieses Eintrages', xbmcgui.NOTIFICATION_ERROR, 2000, True)
            return False

        if self.login():
            if self.may_play(package_code):
                init_data = None
                # create init data for license acquiring
                if apix_id:
                    init_data = self.get_init_data(self.sessionId, apix_id)
                # Prepare new ListItem to start playback
                li = xbmcgui.ListItem(path=manifest_url)
                if info_tag:
                    li.setInfo('video', info_tag)

                li.setProperty('inputstream.adaptive.license_type', self.license_type)
                li.setProperty('inputstream.adaptive.manifest_type', 'ism')
                if init_data:
                    li.setProperty('inputstream.adaptive.license_key', self.license_url)
                    li.setProperty('inputstream.adaptive.license_data', init_data)
                li.setProperty('inputstreamaddon', 'inputstream.adaptive')
                # Start Playing
                xbmcplugin.setResolvedUrl(addon_handle, True, listitem=li)
            else:
                xbmcgui.Dialog().notification('SkyGo Fehler', 'Keine Berechtigung zum Abspielen dieses Eintrages', xbmcgui.NOTIFICATION_ERROR, 2000, True)
        else:
            xbmcgui.Dialog().notification('SkyGo Fehler', 'Fehler bei Login', xbmcgui.NOTIFICATION_ERROR, 2000, True)
            print 'Fehler beim Einloggen'
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def addToWatchlist(asset_id, asset_type):
    skygo.login()
    url = base_url + 'add?assetId=' + asset_id + '&type=' + asset_type + '&version=12354&platform=web&product=SG&catalog=sg'
    r = skygo.session.get(url)
    res = json.loads(r.text[3:len(r.text)-1])
    if res['resultMessage'] == 'OK':
        xbmcgui.Dialog().notification('SkyGo ', asset_type + ' zur Merkliste hinzugefügt', xbmcgui.NOTIFICATION_INFO, 2000, True)
    else:
        xbmcgui.Dialog().notification('SkyGo ', asset_type + ' konnte nicht zur Merkliste hinzugefügt werden', xbmcgui.NOTIFICATION_ERROR, 2000, True)
项目:plugin.video.skygo    作者:trummerjo    | 项目源码 | 文件源码
def deleteFromWatchlist(asset_id):
    url = base_url + 'delete?assetId=' + asset_id + '&version=12354&platform=web&product=SG&catalog=sg'
    r = skygo.session.get(url)
    res = json.loads(r.text[3:len(r.text)-1])
    if res['resultMessage'] == 'OK':
        xbmc.executebuiltin('Container.Refresh')
    else:
        xbmcgui.Dialog().notification('SkyGo', 'Fehler: Merkliste', xbmcgui.NOTIFICATION_ERROR, 2000, True)
项目:script.tvguide.fullscreen    作者:primaeval    | 项目源码 | 文件源码
def waitForPlayBackStopped(self,title):
        time.sleep(0.5)
        self._showOsd()
        self.osdActive = False
        time.sleep(int(ADDON.getSetting('playback.osd.timeout')))

        countdown = int(ADDON.getSetting('playback.timeout'))
        while countdown:
            time.sleep(1)
            countdown = countdown - 1
            if self.player.isPlaying():
                if self.mode == MODE_OSD and not self.osdActive:
                    self._hideOsd()
                return
            if self.tryingToPlay == False:
                return
        dialog = xbmcgui.Dialog()
        dialog.notification('Stream Failed', title, xbmcgui.NOTIFICATION_ERROR, 5000, sound=True)

        finish = False
        if ADDON.getSetting('play.alt.continue') == 'true':
            if self.alt_urls:
                url = self.alt_urls.pop(0)
                #dialog.notification('Trying', url, xbmcgui.NOTIFICATION_ERROR, 5000, sound=True)
                #TODO meta
                if url.startswith('@'):
                    if self.vpnswitch: self.api.filterAndSwitch(url[1:], 0, self.vpndefault, True)
                    xbmc.executebuiltin('XBMC.RunPlugin(%s)' % url[1:])
                elif url[0:14] == "ActivateWindow":
                    xbmc.executebuiltin(url)
                elif url[0:9] == 'plugin://':
                    if self.vpnswitch: self.api.filterAndSwitch(url, 0, self.vpndefault, True)
                    if self.alternativePlayback:
                        xbmc.executebuiltin('XBMC.RunPlugin(%s)' % url)
                    else:
                        self.player.play(item=url, windowed=self.osdEnabled)
                else:
                    if self.vpndefault: self.api.defaultVPN(True)
                    if ADDON.getSetting('m3u.read') == 'true':
                        if url.startswith('http') and url.split('?')[0].split('.')[-1].startswith('m3u'):
                            m3u = xbmcvfs.File(url,'rb').read()
                            match = re.findall('EXT-X-STREAM-INF.*?BANDWIDTH=(.*?),.*?\n(http.*?)\n',m3u,re.M)
                            streams = [[m[0],m[1]] for m in sorted(match, key=lambda x: int(x[0]), reverse=True)]
                            if streams:
                                url = streams[0][1]
                    self.player.play(item=url, windowed=self.osdEnabled)
                self.tryingToPlay = True
                if ADDON.getSetting('play.minimized') == 'false':
                    self._hideEpg()
                    self._hideQuickEpg()
                threading.Timer(1, self.waitForPlayBackStopped, [title]).start()
            else:
                finish = True
        else:
            finish = True

        if finish:
            if not self.osdActive:
                self._hideOsd()
            self.onRedrawEPG(self.channelIdx, self.viewStartDate)