mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Remove unicode strings
This commit is contained in:
parent
1c18e72539
commit
c279057f91
28 changed files with 834 additions and 847 deletions
|
@ -142,9 +142,9 @@ class API2:
|
|||
self._api_kwargs = kwargs
|
||||
|
||||
if self._api_msg:
|
||||
logger.api_debug(u'Tautulli APIv2 :: %s.' % self._api_msg)
|
||||
logger.api_debug('Tautulli APIv2 :: %s.' % self._api_msg)
|
||||
|
||||
logger.api_debug(u'Tautulli APIv2 :: Cleaned kwargs: %s' % self._api_kwargs)
|
||||
logger.api_debug('Tautulli APIv2 :: Cleaned kwargs: %s' % self._api_kwargs)
|
||||
|
||||
return self._api_kwargs
|
||||
|
||||
|
@ -182,7 +182,7 @@ class API2:
|
|||
end = int(end)
|
||||
|
||||
if regex:
|
||||
logger.api_debug(u"Tautulli APIv2 :: Filtering log using regex '%s'" % regex)
|
||||
logger.api_debug("Tautulli APIv2 :: Filtering log using regex '%s'" % regex)
|
||||
reg = re.compile(regex, flags=re.I)
|
||||
|
||||
with open(logfile, 'r') as f:
|
||||
|
@ -218,15 +218,15 @@ class API2:
|
|||
templog = templog[::-1]
|
||||
|
||||
if end > 0 or start > 0:
|
||||
logger.api_debug(u"Tautulli APIv2 :: Slicing the log from %s to %s" % (start, end))
|
||||
logger.api_debug("Tautulli APIv2 :: Slicing the log from %s to %s" % (start, end))
|
||||
templog = templog[start:end]
|
||||
|
||||
if sort:
|
||||
logger.api_debug(u"Tautulli APIv2 :: Sorting log based on '%s'" % sort)
|
||||
logger.api_debug("Tautulli APIv2 :: Sorting log based on '%s'" % sort)
|
||||
templog = sorted(templog, key=lambda k: k[sort])
|
||||
|
||||
if search:
|
||||
logger.api_debug(u"Tautulli APIv2 :: Searching log values for '%s'" % search)
|
||||
logger.api_debug("Tautulli APIv2 :: Searching log values for '%s'" % search)
|
||||
tt = [d for d in templog for k, v in d.items() if search.lower() in v.lower()]
|
||||
|
||||
if len(tt):
|
||||
|
@ -235,7 +235,7 @@ class API2:
|
|||
if regex:
|
||||
tt = []
|
||||
for l in templog:
|
||||
stringdict = ' '.join(u'{}{}'.format(k, v) for k, v in l.items())
|
||||
stringdict = ' '.join('{}{}'.format(k, v) for k, v in l.items())
|
||||
if reg.search(stringdict):
|
||||
tt.append(l)
|
||||
|
||||
|
@ -440,7 +440,7 @@ class API2:
|
|||
self._api_result_type = 'error'
|
||||
return
|
||||
|
||||
logger.api_debug(u'Tautulli APIv2 :: Sending notification.')
|
||||
logger.api_debug('Tautulli APIv2 :: Sending notification.')
|
||||
success = notification_handler.notify(notifier_id=notifier_id,
|
||||
notify_action='api',
|
||||
subject=subject,
|
||||
|
@ -484,7 +484,7 @@ class API2:
|
|||
self._api_result_type = 'error'
|
||||
return
|
||||
|
||||
logger.api_debug(u'Tautulli APIv2 :: Sending newsletter.')
|
||||
logger.api_debug('Tautulli APIv2 :: Sending newsletter.')
|
||||
success = newsletter_handler.notify(newsletter_id=newsletter_id,
|
||||
notify_action='api',
|
||||
subject=subject,
|
||||
|
@ -628,7 +628,7 @@ General optional parameters:
|
|||
out = self._api_callback + '(' + out + ');'
|
||||
# if we fail to generate the output fake an error
|
||||
except Exception as e:
|
||||
logger.api_exception(u'Tautulli APIv2 :: ' + traceback.format_exc())
|
||||
logger.api_exception('Tautulli APIv2 :: ' + traceback.format_exc())
|
||||
self._api_response_code = 500
|
||||
out['message'] = traceback.format_exc()
|
||||
out['result'] = 'error'
|
||||
|
@ -638,7 +638,7 @@ General optional parameters:
|
|||
try:
|
||||
out = xmltodict.unparse(out, pretty=True)
|
||||
except Exception as e:
|
||||
logger.api_error(u'Tautulli APIv2 :: Failed to parse xml result')
|
||||
logger.api_error('Tautulli APIv2 :: Failed to parse xml result')
|
||||
self._api_response_code = 500
|
||||
try:
|
||||
out['message'] = e
|
||||
|
@ -646,7 +646,7 @@ General optional parameters:
|
|||
out = xmltodict.unparse(out, pretty=True)
|
||||
|
||||
except Exception as e:
|
||||
logger.api_error(u'Tautulli APIv2 :: Failed to parse xml result error message %s' % e)
|
||||
logger.api_error('Tautulli APIv2 :: Failed to parse xml result error message %s' % e)
|
||||
out = '''<?xml version="1.0" encoding="utf-8"?>
|
||||
<response>
|
||||
<message>%s</message>
|
||||
|
@ -661,7 +661,7 @@ General optional parameters:
|
|||
""" handles the stuff from the handler """
|
||||
|
||||
result = {}
|
||||
logger.api_debug(u'Tautulli APIv2 :: API called with kwargs: %s' % kwargs)
|
||||
logger.api_debug('Tautulli APIv2 :: API called with kwargs: %s' % kwargs)
|
||||
|
||||
self._api_validate(**kwargs)
|
||||
|
||||
|
@ -679,7 +679,7 @@ General optional parameters:
|
|||
|
||||
result = call(**self._api_kwargs)
|
||||
except Exception as e:
|
||||
logger.api_error(u'Tautulli APIv2 :: Failed to run %s with %s: %s' % (self._api_cmd, self._api_kwargs, e))
|
||||
logger.api_error('Tautulli APIv2 :: Failed to run %s with %s: %s' % (self._api_cmd, self._api_kwargs, e))
|
||||
self._api_response_code = 500
|
||||
if self._api_debug:
|
||||
cherrypy.request.show_tracebacks = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue