python类LOGERROR的实例源码

simpleplugin.py 文件源码 项目:plugin.video.auvio 作者: rickybiscus 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def log_error(self, message):
        """
        Add ERROR message to the Kodi log

        :param message: message to write to the Kodi log
        :type message: str
        """
        self.log(message, xbmc.LOGERROR)
logging.py 文件源码 项目:script.module.python.twitch 作者: MrSprigster 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def error(self, message):
        message = prep_log_message(message)
        if xbmc:
            self._log(message, xbmc.LOGERROR)
        else:
            self._log.error(message)
lulzscraperfunctions.py 文件源码 项目:forthelulz 作者: munchycool 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def showError(addonId, errorMessage):
    """
    Shows an error to the user and logs it

    Parameters:
    addonId: the current addon id
    message: the message to be shown
    """
    notify(addonId, errorMessage)
    xbmc.log(errorMessage, xbmc.LOGERROR)
hlsdownloader.py 文件源码 项目:plugin.video.brplay 作者: olavopeixoto 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def log_error(msg):
    if is_standalone:
        print msg
    else:
        xbmc.log(msg, level=xbmc.LOGERROR)
hlswriter.py 文件源码 项目:plugin.video.brplay 作者: olavopeixoto 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def log_error(msg):
    if is_standalone:
        print msg
    else:
        xbmc.log(msg, level=xbmc.LOGERROR)
kodilogging.py 文件源码 项目:plugin.kogumi 作者: XIAZY 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def emit(self, record):
        levels = {
            logging.CRITICAL: xbmc.LOGFATAL,
            logging.ERROR: xbmc.LOGERROR,
            logging.WARNING: xbmc.LOGWARNING,
            logging.INFO: xbmc.LOGINFO,
            logging.DEBUG: xbmc.LOGDEBUG,
            logging.NOTSET: xbmc.LOGNONE,
        }
        if get_setting_as_bool('debug'):
            try:
                xbmc.log(self.format(record), levels[record.levelno])
            except UnicodeEncodeError:
                xbmc.log(self.format(record).encode(
                    'utf-8', 'ignore'), levels[record.levelno])
koditidal.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def add_list_items(self, items, content=None, end=True, withNextPage=False):
        if content:
            xbmcplugin.setContent(plugin.handle, content)
        list_items = []
        for item in items:
            if isinstance(item, Category):
                category_items = item.getListItems()
                for url, li, isFolder in category_items:
                    if url and li:
                        list_items.append((url, li, isFolder))
            elif isinstance(item, BrowsableMedia):
                url, li, isFolder = item.getListItem()
                if url and li:
                    list_items.append((url, li, isFolder))
        if withNextPage and len(items) > 0:
            # Add folder for next page
            try:
                totalNumberOfItems = items[0]._totalNumberOfItems
                nextOffset = items[0]._offset + self._config.pageSize
                if nextOffset < totalNumberOfItems and len(items) >= self._config.pageSize:
                    path = urlsplit(sys.argv[0]).path or '/'
                    path = path.split('/')[:-1]
                    path.append(str(nextOffset))
                    url = '/'.join(path)
                    self.add_directory_item(_T(30244).format(pos1=nextOffset, pos2=min(nextOffset+self._config.pageSize, totalNumberOfItems)), plugin.url_for_path(url))
            except:
                log('Next Page for URL %s not set' % sys.argv[0], xbmc.LOGERROR)
        if len(list_items) > 0:
            xbmcplugin.addDirectoryItems(plugin.handle, list_items)
        if end:
            xbmcplugin.endOfDirectory(plugin.handle)
debug.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, pluginName, detailLevel=0, enableTidalApiLog=False):
        ''' Initialize Error Logging with a given Log Level
            detailLevel = 0 : xbmc.LOGERROR and xbmc.LOGNOTICE
            detailLevel = 1 : as level 0 plus xbmc.LOGWARNING
            detailLevel = 2 : as level 1 plus xbmc.LOGDEBUG
            detailLevel = 3 : as level 2 plus xbmc.LOGSEVERE
        '''
        self.pluginName = pluginName
        self.detailLevel = detailLevel
        self.debugServer = 'localhost'
        # Set Log Handler for tidalapi
        self.addTidalapiLogger(pluginName, enableDebug=enableTidalApiLog)
debug.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def logException(self, e, txt=''):
        ''' Logs an Exception as Error Message '''
        try:
            if txt:
                if isinstance(txt, unicode):
                    txt = unidecode(txt)
                xbmc.log(b"[%s] %s\n%s" % (self.pluginName, txt, str(e)), level=xbmc.LOGERROR) 
            logging.exception(str(e))
        except:
            pass
addon.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def user_playlist_clear(playlist_id):
    dialog = xbmcgui.Dialog()
    playlist = session.get_playlist(playlist_id)
    ok = dialog.yesno(_T(30258), _T(30259).format(name=playlist.title, count=playlist.numberOfItems))
    if ok:
        xbmc.executebuiltin('ActivateWindow(busydialog)')
        try:
            session.user.remove_all_playlist_entries(playlist_id)
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            traceback.print_exc()
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        xbmc.executebuiltin('Container.Refresh()')
addon.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def user_playlist_add_item(item_type, item_id):
    if item_type == 'playlist':
        srcPlaylist = session.get_playlist(item_id)
        if not srcPlaylist:
            return
        items = session.get_playlist_items(playlist=srcPlaylist)
        # Sort Items by Artist, Title
        sortMode = 'ALBUM' if ALBUM_PLAYLIST_TAG in srcPlaylist.description else 'LABEL'
        items.sort(key=lambda line: line.getSortText(mode=sortMode).upper(), reverse=False)
        items = ['%s' % item.id for item in items]
    elif item_type.startswith('album'):
        # Add First Track of the Album
        tracks = session.get_album_items(item_id)
        for track in tracks:
            if track.available:
                item_id = track.id
                break
        items = ['%s' % item_id]
    else:
        items = [item_id]
    playlist = session.user.selectPlaylistDialog(allowNew=True)
    if playlist:
        xbmc.executebuiltin('ActivateWindow(busydialog)')
        try:
            session.user.add_playlist_entries(playlist=playlist, item_ids=items)
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            traceback.print_exc()
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        xbmc.executebuiltin('Container.Refresh()')
addon.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def user_playlist_remove_item(playlist_id, entry_no):
    item_no = int('0%s' % entry_no) + 1
    playlist = session.get_playlist(playlist_id)
    ok = xbmcgui.Dialog().yesno(_T(30247) % playlist.title, _T(30241) % item_no)
    if ok:
        xbmc.executebuiltin('ActivateWindow(busydialog)')
        try:
            session.user.remove_playlist_entry(playlist, entry_no=entry_no)
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            traceback.print_exc()
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        xbmc.executebuiltin('Container.Refresh()')
addon.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def user_playlist_remove_id(playlist_id, item_id):
    playlist = session.get_playlist(playlist_id)
    ok = xbmcgui.Dialog().yesno(_T(30247) % playlist.title, _T(30246))
    if ok:
        xbmc.executebuiltin('ActivateWindow(busydialog)')
        try:
            session.user.remove_playlist_entry(playlist, item_id=item_id)
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            traceback.print_exc()
        xbmc.executebuiltin('Dialog.Close(busydialog)')
        xbmc.executebuiltin('Container.Refresh()')
util.py 文件源码 项目:emulator.tools.retroarch 作者: JoKeRzBoX 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def showError(addonId, errorMessage):
    """
    Shows an error to the user and logs it

    Parameters:
    addonId: the current addon id
    message: the message to be shown
    """
    notify(addonId, errorMessage)
    xbmc.log(errorMessage, xbmc.LOGERROR)
gui.py 文件源码 项目:script.tvguide.fullscreen 作者: primaeval 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def getControl(self, controlId):
        if not controlId:
            return None
        try:
            return super(TVGuide, self).getControl(controlId)
        except Exception as detail:
            #log(traceback.print_stack())
            #xbmc.log("EXCEPTION: (script.tvguide.fullscreen) TVGuide.getControl %s" % detail, xbmc.LOGERROR)
            if controlId in self.ignoreMissingControlIds:
                return None
            if not self.isClosing:
                self.close()
            return None
source.py 文件源码 项目:script.tvguide.fullscreen 作者: primaeval 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def eventLoop(self):
        print 'Database.eventLoop() >>>>>>>>>> starting...'
        while True:
            self.event.wait()
            self.event.clear()

            event = self.eventQueue.pop(0)

            command = event[0]
            callback = event[1]

            print 'Database.eventLoop() >>>>>>>>>> processing command: ' + command.__name__

            try:
                result = command(*event[2:])
                self.eventResults[command.__name__] = result

                if callback:
                    if self._initialize == command:
                        threading.Thread(name='Database callback', target=callback, args=[result]).start()
                    else:
                        threading.Thread(name='Database callback', target=callback).start()

                if self._close == command:
                    del self.eventQueue[:]
                    break

            except Exception as detail:
                xbmc.log('Database.eventLoop() >>>>>>>>>> exception! %s = %s' % (detail,command.__name__), xbmc.LOGERROR)
                xbmc.executebuiltin("ActivateWindow(Home)")

        print 'Database.eventLoop() >>>>>>>>>> exiting...'
simpleplugin.py 文件源码 项目:plugin.video.streamlink 作者: beardypig 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def log_error(self, message):
        """
        Add ERROR message to the Kodi log

        :param message: message to write to the Kodi log
        :type message: str
        """
        self.log(message, xbmc.LOGERROR)
kodilogging.py 文件源码 项目:service.subtitles.brokensubs 作者: iamninja 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def emit(self, record):
        levels = {
            logging.CRITICAL: xbmc.LOGFATAL,
            logging.ERROR: xbmc.LOGERROR,
            logging.WARNING: xbmc.LOGWARNING,
            logging.INFO: xbmc.LOGINFO,
            logging.DEBUG: xbmc.LOGDEBUG,
            logging.NOTSET: xbmc.LOGNONE,
        }
        if get_setting_as_bool('debug'):
            try:
                xbmc.log(self.format(record), levels[record.levelno])
            except UnicodeEncodeError:
                xbmc.log(self.format(record).encode(
                    'utf-8', 'ignore'), levels[record.levelno])
logger.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def error(texto=""):
    texto = "    [" + get_caller() + "] " + encode_log(texto)

    xbmc.log("######## ERROR #########", xbmc.LOGERROR)
    xbmc.log(texto, xbmc.LOGERROR)
plugin.py 文件源码 项目:plugin.video.skystreaming 作者: Ideneal 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def log(msg):
    """log a message"""
    xbmc.log('SKYSTREAMING: %s' % msg, xbmc.LOGERROR)


问题


面经


文章

微信
公众号

扫码关注公众号