當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。