From be4e47ef0d4d2d6c4f13514f038e1373bbfe5667 Mon Sep 17 00:00:00 2001 From: Phil Borman Date: Sat, 2 Jun 2018 09:50:26 +0200 Subject: [PATCH] Message changes --- lazylibrarian/formatter.py | 2 +- lazylibrarian/qbittorrent.py | 14 +++++++------- lazylibrarian/rssfeed.py | 5 +++-- lazylibrarian/webServe.py | 3 +++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lazylibrarian/formatter.py b/lazylibrarian/formatter.py index 7986fdfbb..046d55aa4 100644 --- a/lazylibrarian/formatter.py +++ b/lazylibrarian/formatter.py @@ -111,7 +111,7 @@ def next_run(when_run): td = when_run - timenow diff = td.seconds # time difference in seconds except ValueError as e: - logger.error("Error getting next run for [%s] %s" % (when_run, str(e))) + lazylibrarian.logger.error("Error getting next run for [%s] %s" % (when_run, str(e))) diff = 0 # calculate whole units, plus round up by adding 1(true) if remainder >= half diff --git a/lazylibrarian/qbittorrent.py b/lazylibrarian/qbittorrent.py index b098e8c8e..dffecaf51 100644 --- a/lazylibrarian/qbittorrent.py +++ b/lazylibrarian/qbittorrent.py @@ -11,7 +11,6 @@ # along with Lazylibrarian. If not, see . -import json import mimetypes import os import platform @@ -19,18 +18,19 @@ import string import time -import lazylibrarian -from lazylibrarian import logger -from lazylibrarian.common import USER_AGENT -from lazylibrarian.formatter import check_int, getList, makeBytestr, makeUnicode # noinspection PyUnresolvedReferences from lib.six.moves import http_cookiejar # noinspection PyUnresolvedReferences +from lib.six.moves.urllib_error import URLError +# noinspection PyUnresolvedReferences from lib.six.moves.urllib_parse import urlencode # noinspection PyUnresolvedReferences from lib.six.moves.urllib_request import HTTPCookieProcessor, build_opener, Request -# noinspection PyUnresolvedReferences -from lib.six.moves.urllib_error import URLError + +import lazylibrarian +from lazylibrarian import logger +from lazylibrarian.common import USER_AGENT +from lazylibrarian.formatter import check_int, getList, makeBytestr, makeUnicode class qbittorrentclient(object): diff --git a/lazylibrarian/rssfeed.py b/lazylibrarian/rssfeed.py index cd8749c58..9143ac51a 100644 --- a/lazylibrarian/rssfeed.py +++ b/lazylibrarian/rssfeed.py @@ -16,6 +16,7 @@ import datetime from lazylibrarian import logger, database +from lazylibrarian.formatter import plural from lib.rfeed import Item, Guid, Feed @@ -38,7 +39,7 @@ def genFeed(ftype, limit=10, user=0, baseurl=''): myDB = database.DBConnection() results = myDB.select(cmd) items = [] - logger.debug("Found %s %s results" % (len(results), ftype)) + # logger.debug("Found %s %s results" % (len(results), ftype)) for res in results: link = '' @@ -87,5 +88,5 @@ def genFeed(ftype, limit=10, user=0, baseurl=''): language="en-US", lastBuildDate=datetime.datetime.now(), items=items) - logger.debug("Returning %s feed items" % len(items)) + logger.debug("Returning %s %s%s" % (len(items), ftype, plural(len(items)))) return feed.rss() diff --git a/lazylibrarian/webServe.py b/lazylibrarian/webServe.py index 769f54486..a795aac56 100644 --- a/lazylibrarian/webServe.py +++ b/lazylibrarian/webServe.py @@ -3406,6 +3406,7 @@ def importAlternate(self): @cherrypy.expose def rssFeed(self, **kwargs): + self.label_thread('RSSFEED') if 'type' in kwargs: ftype = kwargs['type'] else: @@ -3438,6 +3439,8 @@ def rssFeed(self, **kwargs): pass path = path.replace('rssFeed', '').rstrip('/') baseurl = urlunsplit((scheme, netloc, path, qs, anchor)) + remote_ip = cherrypy.request.remote.ip + logger.info("RSS Feed request %s %s%s for %s" % (limit, ftype, plural(limit), remote_ip)) return genFeed(ftype, limit=limit, user=userid, baseurl=baseurl) @cherrypy.expose