Python xbmc.LOGWARNING Examples
The following are 30
code examples of xbmc.LOGWARNING().
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: main_module.py From script.skin.helper.service with GNU General Public License v2.0 | 6 votes |
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)
Example #2
Source File: debug.py From plugin.audio.tidal2 with GNU General Public License v3.0 | 6 votes |
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])
Example #3
Source File: koditidal.py From plugin.audio.tidal2 with GNU General Public License v3.0 | 6 votes |
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
Example #4
Source File: main.py From script.skin.helper.widgets with GNU General Public License v2.0 | 6 votes |
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()
Example #5
Source File: webservice.py From script.skin.helper.service with GNU General Public License v2.0 | 6 votes |
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)
Example #6
Source File: webservice.py From script.skin.helper.service with GNU General Public License v2.0 | 6 votes |
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
Example #7
Source File: plugin_content.py From script.skin.helper.service with GNU General Public License v2.0 | 6 votes |
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)
Example #8
Source File: main.py From plugin.video.areena with GNU General Public License v2.0 | 6 votes |
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)
Example #9
Source File: kodiutils.py From screensaver.kaster with GNU General Public License v2.0 | 6 votes |
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
Example #10
Source File: reporting.py From script.artwork.beef with MIT License | 6 votes |
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
Example #11
Source File: kodi.py From plugin.program.indigo with GNU General Public License v3.0 | 5 votes |
def i18n(string_id): try: return addon.getLocalizedString(strings.STRINGS[string_id]).encode('utf-8', 'ignore') except Exception as e: xbmc.log('%s: Failed String Lookup: %s (%s)' % (get_name(), string_id, e), xbmc.LOGWARNING) return string_id
Example #12
Source File: service.py From plugin.video.netflix with MIT License | 5 votes |
def _update_running(self): update = self.nx_common.get_setting('update_running') or 'false' if update != 'false': starttime = strp(update, '%Y-%m-%d %H:%M') if (starttime + timedelta(hours=6)) <= datetime.now(): self.nx_common.set_setting('update_running', 'false') self.nx_common.log( 'Canceling previous library update - duration > 6 hours', xbmc.LOGWARNING) else: self.nx_common.log('DB Update already running') return True return False
Example #13
Source File: utils.py From plugin.video.bdyun with GNU General Public License v3.0 | 5 votes |
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)
Example #14
Source File: log_utils.py From filmkodi with Apache License 2.0 | 5 votes |
def log_warning(msg): log(msg, level=LOGWARNING)
Example #15
Source File: screensaver.py From screensaver.kaster with GNU General Public License v2.0 | 5 votes |
def onScreensaverDeactivated(self): try: self.exit_callback() except AttributeError: xbmc.log( msg="exit_callback method not yet available", level=xbmc.LOGWARNING )
Example #16
Source File: addon.py From filmkodi with Apache License 2.0 | 5 votes |
def log(self, msg, level=xbmc.LOGDEBUG): ''' 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)
Example #17
Source File: mrknow_pLog.py From filmkodi with Apache License 2.0 | 5 votes |
def warn(self, msg, *args): self._log(msg, args=args, level=LOGWARNING)
Example #18
Source File: addon.py From filmkodi with Apache License 2.0 | 5 votes |
def log(self, msg, level=xbmc.LOGDEBUG): ''' 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)
Example #19
Source File: webservice.py From script.skin.helper.service with GNU General Public License v2.0 | 5 votes |
def default(self, path): '''all other requests go here''' log_msg("Webservice: Unknown method called ! (%s)" % path, xbmc.LOGWARNING) raise cherrypy.HTTPError(404, "Unknown method called")
Example #20
Source File: main.py From plugin.video.areena with GNU General Public License v2.0 | 5 votes |
def get_color(setting): color = _addon.getSetting(setting) colors = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "grey", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "none", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"] if _addon.getSetting('randomColors') == 'true': import random return random.choice(colors) if color not in colors: log('Unknown color "{0}."'.format(color), xbmc.LOGWARNING) log('Available colors: {0}'.format(colors)) return 'black' return color
Example #21
Source File: main.py From plugin.video.areena with GNU General Public License v2.0 | 5 votes |
def get_app_key(): app_key = _addon.getSetting("appKey") if app_key == '': try: import credentials app_key = credentials._appKey except ImportError: credentials = None log('Could not find the app_key. Either set it from the setting menu or create credentials.py file.', xbmc.LOGWARNING) return app_key
Example #22
Source File: debug.py From plugin.audio.tidal2 with GNU General Public License v3.0 | 5 votes |
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)
Example #23
Source File: utils.py From script.skin.helper.service with GNU General Public License v2.0 | 5 votes |
def log_exception(modulename, exceptiondetails): '''helper to properly log an exception''' log_msg(format_exc(sys.exc_info()), xbmc.LOGWARNING) log_msg("Exception in %s ! --> %s" % (modulename, exceptiondetails), xbmc.LOGERROR)
Example #24
Source File: main.py From plugin.video.areena with GNU General Public License v2.0 | 5 votes |
def get_app_id(): app_id = _addon.getSetting("appID") if app_id == '': try: import credentials app_id = credentials._appId except ImportError: credentials = None log('Could not find the app_id. Either set it from the setting menu or create credentials.py file.', xbmc.LOGWARNING) return app_id
Example #25
Source File: guideTypes.py From FTV-Guide-Repo with GNU General Public License v2.0 | 5 votes |
def __init__(self): guideTypes = [] defaultGuideId = 0 # fallback to the first guide in case no default is actually set in the ini file try: fetcher = FileFetcher('guides.ini', ADDON) if fetcher.fetchFile() < 0: xbmcgui.Dialog().ok(strings(FETCH_ERROR_TITLE), strings(FETCH_ERROR_LINE1), strings(FETCH_ERROR_LINE2)) self.guideParser.read(self.filePath) for section in self.guideParser.sections(): sectMap = self.SectionMap(section) id = int(sectMap['id']) fName = sectMap['file'] sortOrder = int(sectMap['sort_order']) default = False if 'default' in sectMap and sectMap['default'] == 'true': default = True defaultGuideId = id guideTypes.append((id, sortOrder, section, fName, default)) self.guideTypes = sorted(guideTypes, key=itemgetter(self.GUIDE_SORT)) xbmc.log('[script.ftvguide] GuideTypes collected: %s' % str(self.guideTypes), xbmc.LOGDEBUG) except: xbmc.log('[script.ftvguide] unable to parse guides.ini', xbmc.LOGWARNING) if len(guideTypes) == 0: self.guideTypes.append((self.CUSTOM_FILE_ID, 9000, "Custom File", "CUSTOM", True)) defaultGuideId = self.CUSTOM_FILE_ID if str(ADDON.getSetting('xmltv.type')) == '': ADDON.setSetting('xmltv.type', str(defaultGuideId))
Example #26
Source File: main.py From plugin.video.areena with GNU General Public License v2.0 | 5 votes |
def get_image_url_for_series(series_id): series_items = get_items(0, series=series_id, limit=1) if series_items: series_item = series_items[0] if 'partOfSeries' in series_item: if 'available' in series_item['partOfSeries']['image']: if series_item['partOfSeries']['image']['available']: image_url = '{0}/{1}/{2}.{3}'.format( _image_cdn_url, _image_transformation, series_item['partOfSeries']['image']['id'], 'png') return image_url else: return 'NO_ITEMS' log('Could not find image URL for series {0}'.format(series_id), xbmc.LOGWARNING) return None
Example #27
Source File: advancedsettings.py From script.artwork.beef with MIT License | 5 votes |
def restore_backup(): if xbmcvfs.exists(FILENAME_BAK): xbmcvfs.copy(FILENAME_BAK, FILENAME) xbmcvfs.delete(FILENAME_BAK) result = xbmcvfs.exists(FILENAME) if result: xbmcgui.Dialog().notification("Artwork Beef", L(RESTORE_SUCCESSFUL)) else: xbmcgui.Dialog().notification("Artwork Beef", L(RESTORE_UNSUCCESSFUL), xbmc.LOGWARNING) return result log("advancedsettings.xml.beef.bak doesn't exist, can't restore backup", xbmc.LOGWARNING) return False
Example #28
Source File: log.py From bugatsinho.github.io with GNU General Public License v3.0 | 5 votes |
def log_warning(msg): log(msg, level=LOGWARNING)
Example #29
Source File: logging.py From plugin.video.netflix with MIT License | 5 votes |
def warn(msg, *args, **kwargs): """Log a warning message.""" if get_log_level() == 'Disabled': return _log(msg, xbmc.LOGWARNING, *args, **kwargs)
Example #30
Source File: addon.py From plugin.video.sparkle with GNU General Public License v3.0 | 5 votes |
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)