From e9d0bff559da192f94c77336584b48655bcaf37d Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Sat, 28 Jan 2017 20:54:31 +0100 Subject: [PATCH] - added statistics for Tags and series - Loglevel is displayed as text instead of value --- cps/templates/admin.html | 2 +- cps/templates/stats.html | 8 ++++++++ cps/ub.py | 13 +++++++++++-- cps/web.py | 4 +++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cps/templates/admin.html b/cps/templates/admin.html index 9ac1c858..4f5c67ec 100644 --- a/cps/templates/admin.html +++ b/cps/templates/admin.html @@ -66,7 +66,7 @@ {{config.config_calibre_dir}} - {{config.config_log_level}} + {{config.get_Log_Level()}} {{config.config_port}} {{config.config_books_per_page}} {% if config.config_uploading %}{% else %}{% endif %} diff --git a/cps/templates/stats.html b/cps/templates/stats.html index 49c13fc4..630039ab 100644 --- a/cps/templates/stats.html +++ b/cps/templates/stats.html @@ -40,6 +40,14 @@ {{authorcounter}} {{_('Authors in this Library')}} + + {{categorycounter}} + {{_('Categories in this Library')}} + + + {{seriecounter}} + {{_('Series in this Library')}} + {% endblock %} diff --git a/cps/ub.py b/cps/ub.py index d5612fdb..29d42fc0 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -288,8 +288,17 @@ class Config: def get_main_dir(self): return self.config_main_dir - #def is_Calibre_Configured(self): - # return self.db_configured + def get_Log_Level(self): + ret_value="" + if self.config_log_level == logging.INFO: + ret_value='INFO' + elif self.config_log_level == logging.DEBUG: + ret_value='DEBUG' + elif self.config_log_level == logging.WARNING: + ret_value='WARNING' + elif self.config_log_level == logging.ERROR: + ret_value='ERROR' + return ret_value # Migrate database to current version, has to be updated after every database change. Currently migration from diff --git a/cps/web.py b/cps/web.py index 035e3631..a37497ef 100755 --- a/cps/web.py +++ b/cps/web.py @@ -973,6 +973,8 @@ def admin_forbidden(): def stats(): counter = len(db.session.query(db.Books).all()) authors = len(db.session.query(db.Authors).all()) + categorys = len(db.session.query(db.Tags).all()) + series = len(db.session.query(db.Series).all()) versions = uploader.book_formats.get_versions() vendorpath = os.path.join(config.get_main_dir + "vendor" + os.sep) if sys.platform == "win32": @@ -989,7 +991,7 @@ def stats(): versions['KindlegenVersion'] = lines versions['PythonVersion'] = sys.version return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=versions, - title=_(u"Statistics")) + categorycounter=categorys, seriecounter=series, title=_(u"Statistics")) @app.route("/shutdown")