Python xbmc.LOGDEBUG Examples
The following are 30
code examples of xbmc.LOGDEBUG().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
xbmc
, or try the search function
.
Example #1
Source File: log_utils.py From script.module.urlresolver with GNU General Public License v2.0 | 6 votes |
def log(self, msg, level=LOGDEBUG): # if debug isn't on, skip disabled loggers unless addon_debug is on if not self.__debug_on: if self in self.__disabled: return elif level == LOGDEBUG: if self.__addon_debug: level = LOGNOTICE else: return try: if isinstance(msg, six.text_type) and six.PY2: msg = '%s (ENCODED)' % (msg.encode('utf-8')) xbmc.log('%s: %s' % (self.__name, msg), level) except Exception as e: try: xbmc.log('Logging Failure: %s' % (e), level) except: pass # just give up
Example #2
Source File: logging.py From plugin.program.openwizard with GNU General Public License v3.0 | 6 votes |
def log(msg, level=xbmc.LOGDEBUG): if CONFIG.DEBUGLEVEL == '0': # No Logging return False if CONFIG.DEBUGLEVEL == '1': # Normal Logging pass if CONFIG.DEBUGLEVEL == '2': # Full Logging level = xbmc.LOGNOTICE xbmc.log('{0}: {1}'.format(CONFIG.ADDONTITLE, msg), level) if CONFIG.ENABLEWIZLOG == 'true': if not os.path.exists(CONFIG.WIZLOG): with open(CONFIG.WIZLOG, 'w+') as f: f.close() lastcheck = CONFIG.NEXTCLEANDATE if not CONFIG.NEXTCLEANDATE == 0 else tools.get_date() if CONFIG.CLEANWIZLOG == 'true' and time.mktime(time.strptime(lastcheck, "%Y-%m-%d %H:%M:%S")) <= tools.get_date(): check_log() line = "[{0}] {1}".format(tools.get_date(formatted=True), msg) line = line.rstrip('\r\n') + '\n' tools.write_to_file(CONFIG.WIZLOG, line, mode='a')
Example #3
Source File: pykodi.py From script.artwork.beef with MIT License | 6 votes |
def log(message, level=xbmc.LOGDEBUG, tag=None): if is_addon_watched() and level < xbmc.LOGNOTICE: # Messages from this add-on are being watched, elevate to NOTICE so Kodi logs it level_tag = _log_level_tag_lookup[level] + ': ' if level in _log_level_tag_lookup else '' level = xbmc.LOGNOTICE else: level_tag = '' if isinstance(message, (dict, list)) and len(message) > 300: message = str(message) elif isinstance(message, unicode): message = message.encode('utf-8') elif not isinstance(message, str): message = json.dumps(message, cls=UTF8PrettyJSONEncoder) addontag = ADDONID if not tag else ADDONID + ':' + tag file_message = '%s[%s] %s' % (level_tag, addontag, scrub_message(message)) xbmc.log(file_message, level)
Example #4
Source File: vpnapi.py From service.vpn.manager with GNU General Public License v2.0 | 6 votes |
def __init__(self): # Class initialisation. Fails with a RuntimeError exception if add-on is not available, or too old self.filtered_addons = [] self.filtered_windows = [] self.primary_vpns = [] self.last_updated = 0 self.addon_name = "" self.timeout = 30 if xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"): self.addon_name = "service.vpn.manager" elif xbmc.getCondVisibility("System.HasAddon(service.nord.vpn)"): self.addon_name = "service.nord.vpn" if self.addon_name == "": xbmc.log("VPN API : A VPN add-on is not installed, cannot use filtering", level=xbmc.LOGERROR) raise RuntimeError("VPN add-on is not installed") else: v = int((xbmcaddon.Addon(self.addon_name).getAddonInfo("version").strip()).replace(".","")) if v < 310: raise RuntimeError("VPN add-on version " + str(v) + " installed, but needs to be v3.1.0 or later") self.refreshLists() self.default = self.getConnected() xbmc.log("VPN API : Default is " + self.default, level=xbmc.LOGDEBUG)
Example #5
Source File: vpnapi.py From service.vpn.manager with GNU General Public License v2.0 | 6 votes |
def connectToValidated(self, connection, wait): # Given the number of a validated connection, connect to it. Return True when the connection has happened # or False if there's a problem connecting (or there's not a VPN connection available for this connection # number). Return True without messing with the connection if the current VPN is the same as the VPN being # requested. The wait parameter will determine if the function returns once the connection has been made, # or if it's fire and forget (in which case True will be returned regardless) if not self.isVPNSetUp(): return False if connection < 1 or connection > 10: return False connection = connection - 1 self.refreshLists() if self.primary_vpns[connection] == "": return False if self.getConnected() == self.primary_vpns[connection]: return True xbmc.log(msg="VPN API : Connecting to " + self.primary_vpns[connection], level=xbmc.LOGDEBUG) self.setAPICommand(self.primary_vpns[connection]) if wait: return self.waitForConnection(self.primary_vpns[connection]) return True
Example #6
Source File: vpnapi.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def connectToValidated(self, connection, wait): # Given the number of a validated connection, connect to it. Return True when the connection has happened # or False if there's a problem connecting (or there's not a VPN connection available for this connection # number). Return True without messing with the connection if the current VPN is the same as the VPN being # requested. The wait parameter will determine if the function returns once the connection has been made, # or if it's fire and forget (in which case True will be returned regardless) if not self.isVPNSetUp(): return False if connection < 1 or connection > 10: return False connection = connection - 1 self.refreshLists() if self.primary_vpns[connection] == "": return False if self.getConnected() == self.primary_vpns[connection]: return True xbmc.log(msg="VPN Mgr API : Connecting to " + self.primary_vpns[connection], level=xbmc.LOGDEBUG) self.setAPICommand(self.primary_vpns[connection]) if wait: return self.waitForConnection(self.primary_vpns[connection]) return True
Example #7
Source File: vpnapi.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def __init__(self): # Class initialisation. Fails with a RuntimeError exception if VPN Manager add-on is not available, or too old self.filtered_addons = [] self.filtered_windows = [] self.primary_vpns = [] self.last_updated = 0 self.refreshLists() self.default = self.getConnected() xbmc.log("VPN Mgr API : Default is " + self.default, level=xbmc.LOGDEBUG) self.timeout = 30 if not xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"): xbmc.log("VPN Mgr API : VPN Manager is not installed, cannot use filtering", level=xbmc.LOGERROR) raise RuntimeError("VPN Manager is not installed") else: v = int((xbmcaddon.Addon("service.vpn.manager").getAddonInfo("version").strip()).replace(".","")) if v < 310: raise RuntimeError("VPN Manager " + str(v) + " installed, but needs to be v3.1.0 or later")
Example #8
Source File: source.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def __init__(self, addon, force): self.needReset = False self.fetchError = False self.start = True self.force = force ''' self.xmltvInterval = int(addon.getSetting('sd.interval')) self.logoSource = int(addon.getSetting('logos.source')) self.addonsType = int(addon.getSetting('addons.ini.type')) # make sure the folder in the user's profile exists or create it! if not os.path.exists(self.PLUGIN_DATA): os.makedirs(self.PLUGIN_DATA) # make sure the ini file is fetched as well if necessary if self.addonsType != self.INI_TYPE_DEFAULT: customFile = str(addon.getSetting('addons.ini.file')) if os.path.exists(customFile): # uses local file provided by user! xbmc.log('[%s] Use local file: %s' % (ADDON.getAddonInfo('id'), customFile), xbmc.LOGDEBUG) else: # Probably a remote file xbmc.log('[%s] Use remote file: %s' % (ADDON.getAddonInfo('id'), customFile), xbmc.LOGDEBUG) self.updateLocalFile(customFile, addon, True, force=force) '''
Example #9
Source File: ResetDatabase.py From script.tvguide.fullscreen with GNU General Public License v2.0 | 6 votes |
def deleteDB(): try: xbmc.log("[script.tvguide.fullscreen] Deleting database...", xbmc.LOGDEBUG) dbPath = xbmc.translatePath(xbmcaddon.Addon(id = 'script.tvguide.fullscreen').getAddonInfo('profile')) dbPath = os.path.join(dbPath, 'source.db') delete_file(dbPath) passed = not os.path.exists(dbPath) if passed: xbmc.log("[script.tvguide.fullscreen] Deleting database...PASSED", xbmc.LOGDEBUG) else: xbmc.log("[script.tvguide.fullscreen] Deleting database...FAILED", xbmc.LOGDEBUG) return passed except Exception, e: xbmc.log('[script.tvguide.fullscreen] Deleting database...EXCEPTION', xbmc.LOGDEBUG) return False
Example #10
Source File: service.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def log(module, msg): xbmc.log((u"%s::%s - %s" % (__scriptname__, module, msg,) ).encode('utf-8'), level=xbmc.LOGDEBUG)
Example #11
Source File: splayer.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def log(module, msg): xbmc.log((u"%s::%s - %s" % (__scriptname__, module, msg,) ).encode('utf-8'), level=xbmc.LOGDEBUG)
Example #12
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def log(txt): message = '%s: %s' % (__addonname__, txt) xbmc.log(msg=message, level=xbmc.LOGDEBUG) ########################################################################
Example #13
Source File: default.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def log(txt): message = '%s: %s' % (__addonname__, txt) xbmc.log(msg=message, level=xbmc.LOGDEBUG)
Example #14
Source File: service.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def log(module, msg): if isinstance(msg, unicode): msg = msg.encode("utf-8") xbmc.log("{0}::{1} - {2}".format(__scriptname__,module,msg) ,level=xbmc.LOGDEBUG )
Example #15
Source File: utils.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def log(txt): if isinstance (txt,str): txt = txt.decode("utf-8") message = u'%s: %s' % (__addon__id__, txt) xbmc.log(msg=message.encode("utf-8"), level=xbmc.LOGDEBUG)
Example #16
Source File: atv.py From screensaver.atv4 with GNU General Public License v2.0 | 5 votes |
def __init__(self, *args, **kwargs): self.DPMStime = json.loads(xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Settings.GetSettingValue","params":{"setting":"powermanagement.displaysoff"},"id":2}'))['result']['value'] * 60 self.isDPMSactive = bool(self.DPMStime > 0) self.active = True self.videoplaylist = AtvPlaylist().getPlaylist() xbmc.log(msg="kodi dpms time:" + str(self.DPMStime), level=xbmc.LOGDEBUG) xbmc.log(msg="kodi dpms active:" + str(self.isDPMSactive), level=xbmc.LOGDEBUG)
Example #17
Source File: menu.py From plugin.program.openwizard with GNU General Public License v3.0 | 5 votes |
def run_speed_test(): from resources.libs.common import logging from resources.libs import speedtest try: found = speedtest.speedtest() if not os.path.exists(CONFIG.SPEEDTEST): os.makedirs(CONFIG.SPEEDTEST) urlsplits = found[0].split('/') dest = os.path.join(CONFIG.SPEEDTEST, urlsplits[-1]) urlretrieve(found[0], dest) view_speed_test(urlsplits[-1]) except Exception as e: logging.log("[Speed Test] Error Running Speed Test: {0}".format(e), level=xbmc.LOGDEBUG) pass
Example #18
Source File: router.py From plugin.program.openwizard with GNU General Public License v3.0 | 5 votes |
def _log_params(self, paramstring): _url = sys.argv[0] self.params = dict(parse_qsl(paramstring)) logstring = '{0}: '.format(_url) for param in self.params: logstring += '[ {0}: {1} ] '.format(param, self.params[param]) logging.log(logstring, level=xbmc.LOGDEBUG) return self.params
Example #19
Source File: service.py From xbmc-addons-chinese with GNU General Public License v2.0 | 5 votes |
def log(module, msg): if isinstance(msg,str): msg = msg.decode('utf-8') xbmc.log((u"%s::%s - %s" % (__scriptname__,module,msg,)).encode('utf-8'),level=xbmc.LOGDEBUG )
Example #20
Source File: speedtest.py From plugin.program.openwizard with GNU General Public License v3.0 | 5 votes |
def main(): try: speedtest() except KeyboardInterrupt: logging.log('\nCancelling...', level=xbmc.LOGDEBUG) dp = xbmcgui.DialogProgress() dp.close() sys.exit()
Example #21
Source File: speedtest.py From plugin.program.openwizard with GNU General Public License v3.0 | 5 votes |
def get_config(): request = build_request('http://www.speedtest.net/speedtest-config.php') uh = catch_request(request) if uh is False: logging.log('Could not retrieve speedtest.net configuration: {0}'.format(uh), level=xbmc.LOGDEBUG) sys.exit(1) configxml = [] while 1: configxml.append(uh.read(10240)) if len(configxml[-1]) == 0: break if int(uh.code) != 200: return None uh.close() try: try: root = ET.fromstring(''.encode('utf-8').join(configxml)) config = { 'client': root.find('client').attrib, 'times': root.find('times').attrib, 'download': root.find('download').attrib, 'upload': root.find('upload').attrib, } except Exception: root = DOM.parseString(''.join(configxml)) config = { 'client': get_attributes_by_tag_name(root, 'client'), 'times': get_attributes_by_tag_name(root, 'times'), 'download': get_attributes_by_tag_name(root, 'download'), 'upload': get_attributes_by_tag_name(root, 'upload'), } except SyntaxError: logging.log('Failed to parse speedtest.net configuration', level=xbmc.LOGDEBUG) sys.exit(1) del root del configxml return config
Example #22
Source File: speedtest.py From plugin.program.openwizard with GNU General Public License v3.0 | 5 votes |
def catch_request(request): try: uh = urlopen(request) return uh except (HTTPError, URLError, socket.error): e = sys.exc_info()[1] logging.log("Speedtest Error: {0}".format(e), level=xbmc.LOGDEBUG) return None, e
Example #23
Source File: advanced.py From plugin.program.openwizard with GNU General Public License v3.0 | 5 votes |
def _write_setting(category, tag, value): from xml.etree import ElementTree exists = os.path.exists(CONFIG.ADVANCED) if exists: root = ElementTree.parse(CONFIG.ADVANCED).getroot() else: root = ElementTree.Element('advancedsettings') tree_category = root.find('./{0}'.format(category)) if tree_category is None: tree_category = ElementTree.SubElement(root, category) category_tag = tree_category.find(tag) if category_tag is None: category_tag = ElementTree.SubElement(tree_category, tag) category_tag.text = '{0}'.format(value) tree = ElementTree.ElementTree(root) logging.log('Writing {0} - {1}: {2} to advancedsettings.xml'.format(category, tag, value), level=xbmc.LOGDEBUG) tree.write(CONFIG.ADVANCED) xbmc.executebuiltin('Container.Refresh()')
Example #24
Source File: plugin_content.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
def _fetch(self): log_msg("Spotify radio track buffer invoking recommendations() via spotipy", xbmc.LOGDEBUG) try: auth_token = xbmc.getInfoLabel("Window(Home).Property(spotify-token)").decode("utf-8") client = spotipy.Spotify(auth_token) tracks = client.recommendations( seed_tracks=[t["id"] for t in self._buffer[0: 5]], limit=self.FETCH_SIZE)["tracks"] log_msg("Spotify radio track buffer got %d results back" % len(tracks)) return tracks except Exception: log_exception("SpotifyRadioTrackBuffer", "Failed to fetch recommendations, returning empty result") return []
Example #25
Source File: plugin_content.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
def _fill_buffer(self): while self._running: self._buffer_lock.acquire() if len(self._buffer) <= self.MIN_BUFFER_SIZE: log_msg("Spotify radio track buffer was %d, below minimum size of %d - filling" % (len(self._buffer), self.MIN_BUFFER_SIZE), xbmc.LOGDEBUG) self._buffer += self._fetch() self._buffer_lock.release() else: self._buffer_lock.release() time.sleep(self.CHECK_BUFFER_PERIOD)
Example #26
Source File: httpproxy.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
def track(self, track_id, duration, **kwargs): # Check sanity of the request self._check_request() # Calculate file size, and obtain the header duration = int(duration) wave_header, filesize = create_wave_header(duration) request_range = cherrypy.request.headers.get('Range', '') # response timeout must be at least the duration of the track: read/write loop # checks for timeout and stops pushing audio to player if it occurs cherrypy.response.timeout = int(math.ceil(duration * 1.5)) range_l = 0 range_r = filesize # headers if request_range and request_range != "bytes=0-": # partial request cherrypy.response.status = '206 Partial Content' cherrypy.response.headers['Content-Type'] = 'audio/x-wav' range = cherrypy.request.headers["Range"].split("bytes=")[1].split("-") log_msg("request header range: %s" % (cherrypy.request.headers['Range']), xbmc.LOGDEBUG) range_l = int(range[0]) try: range_r = int(range[1]) except: range_r = filesize cherrypy.response.headers['Accept-Ranges'] = 'bytes' cherrypy.response.headers['Content-Length'] = filesize cherrypy.response.headers['Content-Range'] = "bytes %s-%s/%s" % (range_l, range_r, filesize) log_msg("partial request range: %s, length: %s" % (cherrypy.response.headers['Content-Range'], cherrypy.response.headers['Content-Length']), xbmc.LOGDEBUG) else: # full file cherrypy.response.headers['Content-Type'] = 'audio/x-wav' cherrypy.response.headers['Accept-Ranges'] = 'bytes' cherrypy.response.headers['Content-Length'] = filesize # If method was GET, write the file content if cherrypy.request.method.upper() == 'GET': return self.send_audio_stream(track_id, filesize, wave_header, range_l)
Example #27
Source File: utils.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
def log_exception(modulename, exceptiondetails): '''helper to properly log an exception''' log_msg(format_exc(sys.exc_info()), xbmc.LOGDEBUG) log_msg("Exception in %s ! --> %s" % (modulename, exceptiondetails), xbmc.LOGWARNING)
Example #28
Source File: utils.py From plugin.audio.spotify with GNU General Public License v3.0 | 5 votes |
def log_msg(msg, loglevel=xbmc.LOGDEBUG): '''log message to kodi log''' if isinstance(msg, unicode): msg = msg.encode('utf-8') if DEBUG: loglevel = xbmc.LOGNOTICE xbmc.log("%s --> %s" % (ADDON_ID, msg), level=loglevel)
Example #29
Source File: logger.py From kodi.kino.pub with BSD 3-Clause "New" or "Revised" License | 5 votes |
def debug(self, message): self._log(message, xbmc.LOGDEBUG)
Example #30
Source File: log_utils.py From script.module.urlresolver with GNU General Public License v2.0 | 5 votes |
def log_debug(self, msg): self.log(msg, level=LOGDEBUG)