当前位置: 首页>>代码示例>>Python>>正文


Python xbmc.LOGWARNING属性代码示例

本文整理汇总了Python中xbmc.LOGWARNING属性的典型用法代码示例。如果您正苦于以下问题:Python xbmc.LOGWARNING属性的具体用法?Python xbmc.LOGWARNING怎么用?Python xbmc.LOGWARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在xbmc的用法示例。


在下文中一共展示了xbmc.LOGWARNING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _rotate_file

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def _rotate_file():
    newdate = ndate = pykodi.get_infolabel('System.Date(yyyy-mm-dd)')
    count = 0
    while _exists(newdate):
        count += 1
        newdate = ndate + '.' + str(count)
    if not xbmcvfs.copy(_get_filepath(), _get_filepath(newdate)):
        log("Could not copy latest report to new filename", xbmc.LOGWARNING, 'reporting')
        return False
    if not xbmcvfs.delete(_get_filepath()):
        log("Could not delete old copy of latest report", xbmc.LOGWARNING, 'reporting')
        return False

    # delete old reports
    _, files = xbmcvfs.listdir(settings.datapath)
    reportfiles = sorted(f[:-4] for f in files if f.startswith(REPORT_NAME))
    while len(reportfiles) > REPORT_COUNT:
        filename = reportfiles[0] + '.txt'
        if not xbmcvfs.delete(settings.datapath + filename):
            log("Could not delete old report '{0}'".format(filename), xbmc.LOGWARNING, 'reporting')
            return False
        del reportfiles[0]
    report_startup()
    return True 
开发者ID:rmrector,项目名称:script.artwork.beef,代码行数:26,代码来源:reporting.py

示例2: __init__

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def __init__(self):
        ''' Initialization '''

        self.metadatautils = MetadataUtils()
        self.addon = xbmcaddon.Addon(ADDON_ID)
        self.win = xbmcgui.Window(10000)
        self.options = self.get_options()

        # skip if shutdown requested
        if self.win.getProperty("SkinHelperShutdownRequested"):
            log_msg("Not forfilling request: Kodi is exiting!", xbmc.LOGWARNING)
            xbmcplugin.endOfDirectory(handle=ADDON_HANDLE)

        elif not "mediatype" in self.options or not "action" in self.options:
            # we need both mediatype and action, so show the main listing
            self.mainlisting()
        else:
            # we have a mediatype and action so display the widget listing
            self.show_widget_listing()

        self.close() 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.widgets,代码行数:23,代码来源:main.py

示例3: get_track_url

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def get_track_url(self, track_id, quality=None, cut_id=None, fallback=True):
        oldSessionId = self.session_id
        self.session_id = self.stream_session_id
        soundQuality = quality if quality else self._config.quality
        #if soundQuality == Quality.lossless and self._config.codec == 'MQA' and not cut_id:
        #    soundQuality = Quality.hi_res
        media = Session.get_track_url(self, track_id, quality=soundQuality, cut_id=cut_id)
        if fallback and soundQuality == Quality.lossless and (media == None or media.isEncrypted):
            log(media.url, level=xbmc.LOGWARNING)
            if media:
                log('Got encryptionKey "%s" for track %s, trying HIGH Quality ...' % (media.encryptionKey, track_id), level=xbmc.LOGWARNING)
            else:
                log('No Lossless stream for track %s, trying HIGH Quality ...' % track_id, level=xbmc.LOGWARNING)
            media = self.get_track_url(track_id, quality=Quality.high, cut_id=cut_id, fallback=False)
        if media:
            if quality == Quality.lossless and media.codec not in ['FLAC', 'ALAC', 'MQA']:
                xbmcgui.Dialog().notification(plugin.name, _T(30504) , icon=xbmcgui.NOTIFICATION_WARNING)
            log('Got stream with soundQuality:%s, codec:%s' % (media.soundQuality, media.codec))
        self.session_id = oldSessionId
        return media 
开发者ID:arnesongit,项目名称:plugin.audio.tidal2,代码行数:22,代码来源:koditidal.py

示例4: emit

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def emit(self, record):
        if record.levelno < logging.WARNING and self._modules and not record.name in self._modules:
            # Log INFO and DEBUG only with enabled modules
            return
        levels = {
            logging.CRITICAL: xbmc.LOGFATAL,
            logging.ERROR: xbmc.LOGERROR,
            logging.WARNING: xbmc.LOGWARNING,
            logging.INFO: xbmc.LOGNOTICE,
            logging.DEBUG: xbmc.LOGSEVERE,
            logging.NOTSET: xbmc.LOGNONE,
        }
        try:
            xbmc.log(self.format(record), levels[record.levelno])
        except:
            try:
                xbmc.log(self.format(record).encode('utf-8', 'ignore'), levels[record.levelno])
            except:
                xbmc.log(b"[%s] Unicode Error in message text" % self.pluginName, levels[record.levelno]) 
开发者ID:arnesongit,项目名称:plugin.audio.tidal2,代码行数:21,代码来源:debug.py

示例5: getvarimage

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def getvarimage(self, **kwargs):
        '''get image from kodi variable/resource addon'''
        log_msg("webservice.getvarimage called with args: %s" % kwargs)
        preferred_types, is_json_request, fallback = self.get_common_params(kwargs)
        title = kwargs.get("title", "")
        title = title.replace("{", "[").replace("}", "]")
        image = xbmc.getInfoLabel(title)
        if not xbmcvfs.exists(image):
            if "resource.images" in image:
                log_msg(
                    "Texture packed resource addons are not supported by the webservice! - %s" %
                    image, xbmc.LOGWARNING)
            image = ""
        if not image:
            image = fallback
        return self.handle_image(image) 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.service,代码行数:18,代码来源:webservice.py

示例6: get_common_params

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def get_common_params(params):
        '''parse the common parameters from the arguments'''
        preferred_types = params.get("type")
        if preferred_types:
            preferred_types = preferred_types.split(",")
        else:
            preferred_types = []
        fallback = params.get("fallback", "")
        is_json_request = params.get("json", "") == "true"
        if fallback and not xbmcvfs.exists(fallback):
            fallback = "special://skin/media/" + fallback
            if not xbmcvfs.exists(fallback):
                fallback = ""
                log_msg(
                    "Webservice --> Non existent fallback image detected - "
                    "please use a full path to the fallback image!",
                    xbmc.LOGWARNING)
        return preferred_types, is_json_request, fallback 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.service,代码行数:20,代码来源:webservice.py

示例7: deprecated_method

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def deprecated_method(self, newaddon):
        '''
            used when one of the deprecated methods is called
            print warning in log and call the external script with the same parameters
        '''
        action = self.params.get("action")
        log_msg("Deprecated method: %s. Please call %s directly" % (action, newaddon), xbmc.LOGWARNING)
        paramstring = ""
        for key, value in self.params.iteritems():
            paramstring += ",%s=%s" % (key, value)
        if getCondVisibility("System.HasAddon(%s)" % newaddon):
            xbmc.executebuiltin("RunAddon(%s%s)" % (newaddon, paramstring))
        else:
            # trigger install of the addon
            if KODI_VERSION > 16:
                xbmc.executebuiltin("InstallAddon(%s)" % newaddon)
            else:
                xbmc.executebuiltin("RunPlugin(plugin://%s)" % newaddon) 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.service,代码行数:20,代码来源:main_module.py

示例8: load_widget

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def load_widget(self):
        '''legacy entrypoint called (widgets are moved to seperate addon), start redirect...'''
        action = self.params.get("action", "")
        newaddon = "script.skin.helper.widgets"
        log_msg("Deprecated method: %s. Please reassign your widgets to get rid of this message. -"
                "This automatic redirect will be removed in the future" % (action), xbmc.LOGWARNING)
        paramstring = ""
        for key, value in self.params.iteritems():
            paramstring += ",%s=%s" % (key, value)
        if getCondVisibility("System.HasAddon(%s)" % newaddon):
            # TEMP !!! for backwards compatability reasons only - to be removed in the near future!!
            import imp
            addon = xbmcaddon.Addon(newaddon)
            addon_path = addon.getAddonInfo('path').decode("utf-8")
            imp.load_source('plugin', os.path.join(addon_path, "plugin.py"))
            from plugin import main
            main.Main()
            del addon
        else:
            # trigger install of the addon
            if KODI_VERSION > 16:
                xbmc.executebuiltin("InstallAddon(%s)" % newaddon)
            else:
                xbmc.executebuiltin("RunPlugin(plugin://%s)" % newaddon) 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.service,代码行数:26,代码来源:plugin_content.py

示例9: log

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def log(txt, log_level=xbmc.LOGDEBUG):
    """
    Log something to the kodi.log file
    :param txt: Text to write to the log
    :param log_level: Severity of the log text
    :return: None
    """
    if (_addon.getSetting("debug") == "true") or (log_level != xbmc.LOGDEBUG):
        if isinstance(txt, str):
            try:
                txt = txt.decode("utf-8")
            except UnicodeDecodeError:
                xbmc.log('Could not decode to Unicode: {0}'.format(txt), level=xbmc.LOGWARNING)
                return
        message = u'%s: %s' % (_addonid, txt)
        xbmc.log(msg=message.encode("utf-8"), level=log_level) 
开发者ID:hirsivaja,项目名称:plugin.video.areena,代码行数:18,代码来源:main.py

示例10: kodi_json_request

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def kodi_json_request(params):
    data = json.dumps(params)
    request = xbmc.executeJSONRPC(data)

    try:
        response = json.loads(request)
    except UnicodeDecodeError:
        response = json.loads(request.decode('utf-8', 'ignore'))

    try:
        if 'result' in response:
            return response['result']
        return None
    except KeyError:
        log("[%s] %s" %
                    (params['method'], response['error']['message']),level=xbmc.LOGWARNING)
        return None 
开发者ID:enen92,项目名称:screensaver.kaster,代码行数:19,代码来源:kodiutils.py

示例11: handle_request

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def handle_request(self, headers_only=False):

        '''Send headers and reponse
        '''
        try:
            if 'extrafanart' in self.path or 'extrathumbs' in self.path or 'Extras/' in self.path:
                raise Exception("unsupported artwork request")

            if '/Audio' in self.path:
                params = self.get_params()

                self.send_response(301)
                path = Redirect(self.path, params.get('server'))
                path.start()
                path.join() # Block until the thread exits.
                self.send_header('Location', path.path)
                self.end_headers()

            elif headers_only:

                self.send_response(200)
                self.send_header('Content-type', 'text/html')
                self.end_headers()

            elif 'file.strm' not in self.path:
                self.images()
            elif 'file.strm' in self.path:
                self.strm()
            else:
                xbmc.log(str(self.path), xbmc.LOGWARNING)
                raise Exception("UnknownRequest")

        except Exception as error:
            self.send_error(500, "[ webservice ] Exception occurred: %s" % error)

        xbmc.log("<[ webservice/%s/%s ]" % (str(id(self)), int(not headers_only)), xbmc.LOGWARNING)

        return 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:40,代码来源:webservice.py

示例12: log_warning

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def log_warning(msg):
    log(msg, level=LOGWARNING) 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:4,代码来源:log.py

示例13: warn

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def warn(msg, *args, **kwargs):
    """Log a warning message."""
    if get_log_level() == 'Disabled':
        return
    _log(msg, xbmc.LOGWARNING, *args, **kwargs) 
开发者ID:CastagnaIT,项目名称:plugin.video.netflix,代码行数:7,代码来源:logging.py

示例14: log

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def log(self, msg, level=xbmc.LOGNOTICE):
        '''
        Writes a string to the XBMC log file. The addon name is inserted into 
        the beginning of the message automatically to help you find relevent 
        messages in the log file.
        
        The available log levels are defined in the :mod:`xbmc` module and are
        currently as follows::
        
            xbmc.LOGDEBUG = 0
            xbmc.LOGERROR = 4
            xbmc.LOGFATAL = 6
            xbmc.LOGINFO = 1
            xbmc.LOGNONE = 7
            xbmc.LOGNOTICE = 2
            xbmc.LOGSEVERE = 5
            xbmc.LOGWARNING = 3
        
        Args:
            msg (str or unicode): The message to be written to the log file.
        
        Kwargs:
            level (int): The XBMC log level to write at.
        '''
        #msg = unicodedata.normalize('NFKD', unicode(msg)).encode('ascii',
        #                                                         'ignore')
        xbmc.log('%s: %s' % (self.get_name(), msg), level) 
开发者ID:iwannabelikemike,项目名称:plugin.video.sparkle,代码行数:29,代码来源:addon.py

示例15: log_warning

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGWARNING [as 别名]
def log_warning(self, message):
        """
        Add WARNING message to the Kodi log

        :param message: message to write to the Kodi log
        :type message: str
        """
        self.log(message, xbmc.LOGWARNING) 
开发者ID:rickybiscus,项目名称:plugin.video.auvio,代码行数:10,代码来源:simpleplugin.py


注:本文中的xbmc.LOGWARNING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。