Python xbmc 模块,LOGNOTICE 实例源码

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

项目:konsodi    作者:kharts    | 项目源码 | 文件源码
def log(msg, level=xbmc.LOGNOTICE):
    """
    Outputs message to log file
    :param msg: message to output
    :param level: debug levelxbmc. Values:
    xbmc.LOGDEBUG = 0
    xbmc.LOGERROR = 4
    xbmc.LOGFATAL = 6
    xbmc.LOGINFO = 1
    xbmc.LOGNONE = 7
    xbmc.LOGNOTICE = 2
    xbmc.LOGSEVERE = 5
    xbmc.LOGWARNING = 3
    """

    log_message = u'{0}: {1}'.format(addonID, msg)
    xbmc.log(log_message.encode("utf-8"), level)
项目:Python-GoogleDrive-VideoStream    作者:ddurdle    | 项目源码 | 文件源码
def PlayStream(self, url, item, seek, startPlayback=True, package=None):

        self.currentURL = url
        if startPlayback:
            self.play(url, item)
            if self.service.settings:
                xbmc.log(self.service.addon.getAddonInfo('name') + ': Playback url ' + str(url), xbmc.LOGNOTICE)

        if package is not None:
            self.package = package

        if seek != '':
            self.seek = float(seek)
            if self.service.settings:
                xbmc.log(self.service.addon.getAddonInfo('name') + ': Seek ' + str(seek), xbmc.LOGNOTICE)

#        self.tvScheduler.setVideoWatched(self.worksheet, self.content[self.current][0])
#        if seek > 0 and seek !='':
#            while not self.isPlaying(): #<== The should be    while self.isPlaying():
#                xbmc.sleep(500)
#            xbmc.sleep(2000)
#            self.time = float(seek)
#            self.seekTime(float(seek))
项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
def log(self, txt = '', level=xbmc.LOGDEBUG):
        ''' Log a text into the Kodi-Logfile '''
        try:
            if self.detailLevel > 0 or level == xbmc.LOGERROR:
                if self.detailLevel == 2 and level == xbmc.LOGDEBUG:
                    # More Logging
                    level = xbmc.LOGNOTICE
                elif self.detailLevel == 3 and (level == xbmc.LOGDEBUG or level == xbmc.LOGSEVERE):
                    # Complex Logging
                    level = xbmc.LOGNOTICE
                if level != xbmc.LOGSEVERE:
                    if isinstance(txt, unicode):
                        txt = unidecode(txt)
                    xbmc.log(b"[%s] %s" % (self.pluginName, txt), level) 
        except:
            xbmc.log(b"[%s] Unicode Error in message text" % self.pluginName, xbmc.LOGERROR)
项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
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])
项目:script.tvguide.fullscreen    作者:primaeval    | 项目源码 | 文件源码
def onCachesUpdated(self):
        #BUG doesn't work on login (maybe always?)
        if ADDON.getSetting('notifications.enabled') == 'true':
            n = notification.Notification(self.database, ADDON.getAddonInfo('path'))
            #n.scheduleNotifications()
        if ADDON.getSetting('autoplays.enabled') == 'true':
            n = autoplay.Autoplay(self.database, ADDON.getAddonInfo('path'))
            #n.scheduleAutoplays()
        if ADDON.getSetting('autoplaywiths.enabled') == 'true':
            n = autoplaywith.Autoplaywith(self.database, ADDON.getAddonInfo('path'))
            #n.scheduleAutoplaywiths()
        self.database.close(None)
        xbmc.log("[script.tvguide.fullscreen] Background Update Finished", xbmc.LOGNOTICE)
        if ADDON.getSetting('background.notify') == 'true':
            d = xbmcgui.Dialog()
            d.notification("TV Guide Fullscreen", "Finished Updating")
项目:plex-for-kodi-mod    作者:mrclemds    | 项目源码 | 文件源码
def __getattr__(self, method):
        def handler(*args, **kwargs):
            args = [str(a).replace(',', '\,') for a in args]
            for k, v in kwargs.items():
                args.append('{0}={v}'.format(k, str(v).replace(',', '\,')))

            if args:
                command = '{0}.{1}({2})'.format(self.module, method, ','.join(args))
            else:
                command = '{0}.{1}'.format(self.module, method)

            xbmc.log(command, xbmc.LOGNOTICE)

            xbmc.executebuiltin(command)

        return handler
项目: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.bdyun    作者:caasiu    | 项目源码 | 文件源码
def log(message,loglevel=xbmc.LOGNOTICE):
    """"save message to kodi.log.

    Args:
        message: has to be unicode, http://wiki.xbmc.org/index.php?title=Add-on_unicode_paths#Logging
        loglevel: xbmc.LOGDEBUG, xbmc.LOGINFO, xbmc.LOGNOTICE, xbmc.LOGWARNING, xbmc.LOGERROR, xbmc.LOGFATAL
    """
    xbmc.log(encode(__addon_id__ + u": " + message), level=loglevel)
项目:plugin.audio.spotify    作者:marcelveldt    | 项目源码 | 文件源码
def __init__(self):
        self.addon = xbmcaddon.Addon(id=ADDON_ID)
        self.kodimonitor = xbmc.Monitor()
        self.spotty = Spotty()

        # spotipy and the webservice are always prestarted in the background
        # the auth key for spotipy will be set afterwards
        # the webserver is also used for the authentication callbacks from spotify api
        self.sp = spotipy.Spotify()
        self.connect_player = ConnectPlayer(sp=self.sp, spotty=self.spotty)

        self.proxy_runner = ProxyRunner(self.spotty)
        self.proxy_runner.start()
        webport = self.proxy_runner.get_port()
        log_msg('started webproxy at port {0}'.format(webport))

        # authenticate
        self.token_info = self.get_auth_token()
        if self.token_info and not self.kodimonitor.abortRequested():

            # initialize spotipy
            self.sp._auth = self.token_info["access_token"]
            me = self.sp.me()
            log_msg("Logged in to Spotify - Username: %s" % me["id"], xbmc.LOGNOTICE)

            # start experimental spotify connect daemon
            if self.addon.getSetting("connect_player") == "true" and self.spotty.playback_supported:
                self.connect_player.start()

        # start mainloop
        self.main_loop()
项目:plugin.audio.spotify    作者:marcelveldt    | 项目源码 | 文件源码
def close(self):
        '''shutdown, perform cleanup'''
        log_msg('Shutdown requested !', xbmc.LOGNOTICE)
        kill_spotty()
        self.proxy_runner.stop()
        self.connect_player.close()
        del self.connect_player
        del self.addon
        del self.kodimonitor
        log_msg('stopped', xbmc.LOGNOTICE)
项目:plugin.audio.spotify    作者:marcelveldt    | 项目源码 | 文件源码
def switch_user(self):
        '''called whenever we switch to a different user/credentials'''
        log_msg("login credentials changed")
        if self.renew_token():
            xbmc.executebuiltin("Container.Refresh")
            me = self.sp.me()
            log_msg("Logged in to Spotify - Username: %s" % me["id"], xbmc.LOGNOTICE)
            # restart daemon
            if self.connect_player.daemon_active:
                self.connect_player.stop_thread()
                audio_device = self.addon.getSetting("audio_device") == "true"
                self.connect_player = ConnectPlayer(sp=self.sp, audio_device=audio_device, spotty=self.spotty)
                self.connect_player.start()
项目:plugin.audio.spotify    作者:marcelveldt    | 项目源码 | 文件源码
def log_msg(msg, loglevel=xbmc.LOGDEBUG):
    '''log message to kodi log'''
    if isinstance(msg, unicode):
        msg = msg.encode('utf-8')
    if DEBUG and loglevel == xbmc.LOGDEBUG:
        loglevel = xbmc.LOGNOTICE
    xbmc.log("%s --> %s" % (ADDON_ID, msg), level=loglevel)
项目:Python-GoogleDrive-VideoStream    作者:ddurdle    | 项目源码 | 文件源码
def playNext(self, service, package):
            (mediaURLs, package) = service.getPlaybackCall(package)

            options = []
            mediaURLs = sorted(mediaURLs)
            for mediaURL in mediaURLs:
                options.append(mediaURL.qualityDesc)
                if mediaURL.qualityDesc == 'original':
                    originalURL = mediaURL.url

            playbackURL = ''
            playbackQuality = ''
            if service.settings.promptQuality:
                if len(options) > 1:
                    ret = xbmcgui.Dialog().select(service.addon.getLocalizedString(30033), options)
                else:
                    ret = 0
            else:
                ret = 0

            playbackURL = mediaURLs[ret].url
            if self.service.settings:
                xbmc.log(self.service.addon.getAddonInfo('name') + ': Play next ' + str(playbackURL), xbmc.LOGNOTICE)

            playbackQuality = mediaURLs[ret].quality
            item = xbmcgui.ListItem(package.file.displayTitle(), iconImage=package.file.thumbnail,
                                thumbnailImage=package.file.thumbnail, path=playbackURL+'|' + service.getHeadersEncoded())
            item.setInfo( type="Video", infoLabels={ "Title": package.file.title } )
            self.PlayStream(playbackURL+'|' + service.getHeadersEncoded(),item,0,package)
项目:Python-GoogleDrive-VideoStream    作者:ddurdle    | 项目源码 | 文件源码
def playList(self, service):
        while self.current < len(self.mediaItems) and not self.isExit:
            self.playNext(service, self.mediaItems[self.current])
            current = self.current
            while current == self.current and not self.isExit:
                xbmc.sleep(3000)

        if self.service.settings:
            xbmc.log(self.service.addon.getAddonInfo('name') + ': Exit play list', xbmc.LOGNOTICE)

#    def onPlayBackSeek(self,offset):
项目:Python-GoogleDrive-VideoStream    作者:ddurdle    | 项目源码 | 文件源码
def seekTo(self, seek):
        if seek != '':
            self.seek = float(seek)
#        self.tvScheduler.setVideoWatched(self.worksheet, self.content[self.current][0])
        if seek > 0 and seek !='':
            while not self.isPlaying(): #<== The should be    while self.isPlaying():
                xbmc.sleep(500)
            xbmc.sleep(2000)
            self.time = float(seek)
            self.seekTime(float(seek))
            if self.service.settings:
                xbmc.log(self.service.addon.getAddonInfo('name') + ': Seek ' + str(self.time), xbmc.LOGNOTICE)
项目:plugin.video.auvio    作者:rickybiscus    | 项目源码 | 文件源码
def log_notice(self, message):
        """
        Add NOTICE message to the Kodi log

        :param message: message to write to the Kodi log
        :type message: str
        """
        self.log(message, xbmc.LOGNOTICE)
项目:plugin.video.telekom-sport    作者:asciidisco    | 项目源码 | 文件源码
def log(self, msg, level=xbmc.LOGNOTICE):
        """
        Logs a message to the Kodi log (default debug)

        :param msg: Message to be logged
        :type msg: mixed
        :param level: Log level
        :type level: int
        """
        addon_data = self.get_addon_data()
        xbmc.log('[' + addon_data.get('plugin') + '] ' + str(msg), level)
项目:script.module.python.twitch    作者:MrSprigster    | 项目源码 | 文件源码
def info(self, message):
        message = prep_log_message(message)
        if xbmc:
            self._log(message, xbmc.LOGNOTICE)
        else:
            self._log.info(message)
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def log(message):
    if application_log_enabled:
        xbmc.log(message, xbmc.LOGNOTICE)

# Write this module messages on XBMC log
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def _log(message):
    if module_log_enabled:
        xbmc.log("plugintools."+message, xbmc.LOGNOTICE)

# Parse XBMC params - based on script.module.parsedom addon
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def info(texto=""):
    if loggeractive:
        xbmc.log(get_caller(encode_log(texto)), xbmc.LOGNOTICE)
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def debug(texto=""):
    if loggeractive:
        texto = "    [" + get_caller() + "] " + encode_log(texto)

        xbmc.log("######## DEBUG #########", xbmc.LOGNOTICE)
        xbmc.log(texto, xbmc.LOGNOTICE)
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def error(texto=""):
    if loggeractive:
        texto = "    [" + get_caller() + "] " + encode_log(texto)

        xbmc.log("######## ERROR #########", xbmc.LOGNOTICE)
        xbmc.log(texto, xbmc.LOGNOTICE)
项目:plugin.video.brplay    作者:olavopeixoto    | 项目源码 | 文件源码
def log(msg):
    pass
    # if is_standalone:
    #     print msg
    # else:
    #     import threading
    #     xbmc.log("%s - %s" % (threading.currentThread(), msg),level=xbmc.LOGNOTICE)
项目:plugin.video.brplay    作者:olavopeixoto    | 项目源码 | 文件源码
def log(msg):
    pass
    # if is_standalone:
    #     print msg
    # else:
    #     import threading
    #     xbmc.log("%s - %s" % (threading.currentThread(), msg), level=xbmc.LOGNOTICE)
项目:plugin.video.brplay    作者:olavopeixoto    | 项目源码 | 文件源码
def log(msg):
        xbmc.log(msg, level=xbmc.LOGNOTICE)
项目:plugin.video.brplay    作者:olavopeixoto    | 项目源码 | 文件源码
def log(msg):
    # pass
    xbmc.log(msg, level=xbmc.LOGNOTICE)
项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
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)
项目:specto    作者:mrknow    | 项目源码 | 文件源码
def log(msg, level=xbmc.LOGNOTICE):
    #return
    level = xbmc.LOGNOTICE
    print('[SPECTO]: %s' % (msg))

    try:
        if isinstance(msg, unicode):
            msg = msg.encode('utf-8')
        xbmc.log('[SPECTO]: %s' % (msg), level)
    except Exception as e:
        try:
            #xbmc.log('Logging Failure: %s' % (e), level)
            a=1
        except: pass  # just give up
项目:script.tvguide.fullscreen    作者:primaeval    | 项目源码 | 文件源码
def onInit(self, success):
        if success:
            xbmc.log("[script.tvguide.fullscreen] Background Update Starting...", xbmc.LOGNOTICE)
            self.database.updateChannelAndProgramListCaches(self.onCachesUpdated)
        else:
            self.database.close()
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def info(texto=""):
    if loggeractive:
        xbmc.log(get_caller(encode_log(texto)), xbmc.LOGNOTICE)
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def debug(texto=""):
    if loggeractive:
        texto = "    [" + get_caller() + "] " + encode_log(texto)

        xbmc.log("######## DEBUG #########", xbmc.LOGNOTICE)
        xbmc.log(texto, xbmc.LOGNOTICE)
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def log(message):
    if application_log_enabled:
        xbmc.log(message, xbmc.LOGNOTICE)

# Write this module messages on XBMC log
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def _log(message):
    if module_log_enabled:
        xbmc.log("plugintools."+message, xbmc.LOGNOTICE)

# Parse XBMC params - based on script.module.parsedom addon
项目:script.module.metadatautils    作者:marcelveldt    | 项目源码 | 文件源码
def log_msg(msg, loglevel=xbmc.LOGDEBUG):
    '''log message to kodi logfile'''
    if isinstance(msg, unicode):
        msg = msg.encode('utf-8')
    if loglevel == xbmc.LOGDEBUG and FORCE_DEBUG_LOG:
        loglevel = xbmc.LOGNOTICE
    xbmc.log("%s --> %s" % (ADDON_ID, msg), level=loglevel)
项目:script.module.metadatautils    作者:marcelveldt    | 项目源码 | 文件源码
def rate_limiter(rl_params):
    ''' A very basic rate limiter which limits to 1 request per X seconds to the api'''
    # Please respect the parties providing these free api's to us and do not modify this code.
    # If I suspect any abuse I will revoke all api keys and require all users
    # to have a personal api key for all services.
    # Thank you
    if not rl_params:
        return
    monitor = xbmc.Monitor()
    win = xbmcgui.Window(10000)
    rl_name = rl_params[0]
    rl_delay = rl_params[1]
    cur_timestamp = int(time.mktime(datetime.datetime.now().timetuple()))
    prev_timestamp = try_parse_int(win.getProperty("ratelimiter.%s" % rl_name))
    if (prev_timestamp + rl_delay) > cur_timestamp:
        sec_to_wait = (prev_timestamp + rl_delay) - cur_timestamp
        log_msg(
            "Rate limiter active for %s - delaying request with %s seconds - "
            "Configure a personal API key in the settings to get rid of this message and the delay." %
            (rl_name, sec_to_wait), xbmc.LOGNOTICE)
        while sec_to_wait and not monitor.abortRequested():
            monitor.waitForAbort(1)
            # keep setting the timestamp to create some sort of queue
            cur_timestamp = int(time.mktime(datetime.datetime.now().timetuple()))
            win.setProperty("ratelimiter.%s" % rl_name, "%s" % cur_timestamp)
            sec_to_wait -= 1
    # always set the timestamp
    cur_timestamp = int(time.mktime(datetime.datetime.now().timetuple()))
    win.setProperty("ratelimiter.%s" % rl_name, "%s" % cur_timestamp)
    del monitor
    del win
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def info(texto=""):
    if loggeractive:
        xbmc.log(get_caller(encode_log(texto)), xbmc.LOGNOTICE)
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def debug(texto=""):
    if loggeractive:
        texto = "    [" + get_caller() + "] " + encode_log(texto)

        xbmc.log("######## DEBUG #########", xbmc.LOGNOTICE)
        xbmc.log(texto, xbmc.LOGNOTICE)
项目:plugin.video.amazon65    作者:phil65    | 项目源码 | 文件源码
def Log(msg, level=xbmc.LOGNOTICE):
    if level == xbmc.LOGDEBUG and verbLog:
        level = xbmc.LOGNOTICE
    if isinstance(msg, unicode):
        msg = msg.encode('utf-8')
    WriteLog(msg)
    xbmc.log('[%s] %s' % (__plugin__, msg.__str__()), level)
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def log(msg, level=xbmc.LOGNOTICE):
    # override message level to force logging when addon logging turned on
    if addon.getSetting('debug') == 'true' and level == xbmc.LOGDEBUG:
        level = xbmc.LOGNOTICE

    try: xbmc.log('%s: %s' % (name, msg), level)
    except:
        try: xbmc.log('Logging Failure', level)
        except: pass  # just give up
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def log(msg, level=xbmc.LOGNOTICE):
    name = str(AddonTitle) + ' NOTICE'
    # override message level to force logging when addon logging turned on
    level = xbmc.LOGNOTICE

    try:
        xbmc.log('%s: %s' % (name, msg), level)
    except:
        try:
            xbmc.log('Logging Failure', level)
        except:
            pass  # just give up
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def logInfo(msg, level=xbmc.LOGNOTICE):
    name = AddonTitle + ' INFORMATION'
    # override message level to force logging when addon logging turned on
    level = xbmc.LOGNOTICE

    try:
        xbmc.log('%s: %s' % (name, msg), level)
    except:
        try:
            xbmc.log('Logging Failure', level)
        except:
            pass  # just give up
项目:script.reddit.reader    作者:gedisony    | 项目源码 | 文件源码
def log(message):
    import threading
    t=threading.currentThread()
    show_debug_messages=addon.getSetting("show_debug_messages") == "true"
    if show_debug_messages:
        level=xbmc.LOGNOTICE
    else:
        level=xbmc.LOGDEBUG
    try:
        xbmc.log("reddit_reader {0}:{1}".format(t.name, message), level=level)
    except TypeError as e:
        xbmc.log("reddit_reader error:{0}".format(e), level=level)
项目:plugin.video.zdf_de_2016    作者:generia    | 项目源码 | 文件源码
def info(self, message, *args):
        self._log(xbmc.LOGNOTICE, message, *args)
项目:plugin.video.giraffe.seasonvar    作者:weirdgiraffe    | 项目源码 | 文件源码
def info(s):
        xbmc.log(s, xbmc.LOGNOTICE)
项目:Bassdrive-Kodi-Plugin    作者:geudrik    | 项目源码 | 文件源码
def log(self, msg):
        xbmc.log("[Bassdrive Plugin] %s" % (msg), xbmc.LOGNOTICE)
项目:Kodi-Launches-EmulationStation-Addon    作者:BrosMakingSoftware    | 项目源码 | 文件源码
def log(message, level=xbmc.LOGNOTICE):
    xbmc.log('[%s:v%s] %s' % (__addonId__, __version__, message.encode('utf-8')), level)
# end of log

# Starting the Addon
项目:plex-for-kodi-mod    作者:mrclemds    | 项目源码 | 文件源码
def __call__(self, *args, **kwargs):
        args = [str(a).replace(',', '\,') for a in args]
        for k, v in kwargs.items():
            args.append('{0}={v}'.format(k, str(v).replace(',', '\,')))

        if args:
            command = '{0}({1})'.format(self.module, ','.join(args))
        else:
            command = '{0}'.format(self.module)

        xbmc.log(command, xbmc.LOGNOTICE)

        xbmc.executebuiltin(command)
项目:plex-for-kodi-mod    作者:mrclemds    | 项目源码 | 文件源码
def realExit():
    xbmc.log('script.plex: REALLY FINISHED', xbmc.LOGNOTICE)
项目:plex-for-kodi-mod    作者:mrclemds    | 项目源码 | 文件源码
def LOG(msg, level=xbmc.LOGNOTICE):
    xbmc.log('script.plex: {0}'.format(msg), level)