From 0277d08706c4c72634df97f29da3a11fb283f8ed Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Thu, 23 Feb 2017 19:06:52 +0100 Subject: [PATCH 1/3] Merged #123. Thanks @idalin. I think this solves permanently sending to kindle issues like (#94) --- cps/web.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index 69cefe1a..b256ad87 100755 --- a/cps/web.py +++ b/cps/web.py @@ -2136,7 +2136,6 @@ def upload(): db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort) db.session.connection().connection.connection.create_function('uuid4', 0, lambda: str(uuid4())) if request.method == 'POST' and 'btn-upload' in request.files: - file = request.files['btn-upload'] file = request.files['btn-upload'] if '.' in file.filename: file_ext = file.filename.rsplit('.', 1)[-1].lower() From 41a20fe3e13e3c801626341036d0e601bed5eb98 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Thu, 23 Feb 2017 19:58:56 +0100 Subject: [PATCH 2/3] Added version info of dependencys in about section --- cps/static/js/main.js | 5 +-- cps/templates/stats.html | 66 ++++++++++++++++++++++++++++++---------- cps/web.py | 22 ++++++++++++-- 3 files changed, 72 insertions(+), 21 deletions(-) diff --git a/cps/static/js/main.js b/cps/static/js/main.js index 74e1a1d8..0a184530 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -36,7 +36,7 @@ $(function() { success: function(data) { $('#spinner').show(); displaytext=data.text; - window.setTimeout(restartTimer, 3000);} + setTimeout(restartTimer, 3000);} }); }); $("#shutdown").click(function() { @@ -110,7 +110,8 @@ function updateTimer() { $('#UpdateprogressDialog #updateFinished').removeClass('hidden'); $("#check_for_update").removeClass('hidden'); $("#perform_update").addClass('hidden'); - } + }, + timeout:2000 }); } diff --git a/cps/templates/stats.html b/cps/templates/stats.html index 22826003..7ab72092 100644 --- a/cps/templates/stats.html +++ b/cps/templates/stats.html @@ -1,7 +1,27 @@ {% extends "layout.html" %} {% block body %} +

{{_('Calibre library statistics')}}

+ + + + + + + + + + + + + + + + + + + +
{{bookcounter}}{{_('Books in this Library')}}
{{authorcounter}}{{_('Authors in this Library')}}
{{categorycounter}}{{_('Categories in this Library')}}
{{seriecounter}}{{_('Series in this Library')}}

{{_('Linked libraries')}}

- @@ -24,30 +44,44 @@ - + - -
PyPDF2{{versions['PyPdfVersion']}}v{{versions['PyPdfVersion']}}
- -

{{_('Calibre library statistics')}}

- - - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + +
{{bookcounter}}{{_('Books in this Library')}}Babelv{{versions['babel']}}
{{authorcounter}}{{_('Authors in this Library')}}SqlAlchemyv{{versions['sqlalchemy']}}
{{categorycounter}}{{_('Categories in this Library')}}Flaskv{{versions['flask']}}
{{seriecounter}}{{_('Series in this Library')}}Flask Loginv{{versions['flasklogin']}}
Flask Principalv{{versions['flask_principal']}}
Tornado web serverv{{versions['tornado']}}
ISO639 Languagesv{{versions['iso639']}}
Requestsv{{versions['requests']}}
+ {% endblock %} + + diff --git a/cps/web.py b/cps/web.py index b256ad87..06930901 100755 --- a/cps/web.py +++ b/cps/web.py @@ -4,8 +4,9 @@ import mimetypes import logging from logging.handlers import RotatingFileHandler import textwrap -from flask import Flask, render_template, session, request, Response, redirect, url_for, send_from_directory, \ +from flask import Flask, render_template, request, Response, redirect, url_for, send_from_directory, \ make_response, g, flash, abort +from flask import __version__ as flaskVersion import ub from ub import config import helper @@ -14,9 +15,12 @@ import errno from sqlalchemy.sql.expression import func from sqlalchemy.sql.expression import false from sqlalchemy.exc import IntegrityError +from sqlalchemy import __version__ as sqlalchemyVersion from math import ceil from flask_login import LoginManager, login_user, logout_user, login_required, current_user +from flask_login import __version__ as flask_loginVersion from flask_principal import Principal, Identity, AnonymousIdentity, identity_changed +from flask_login import __version__ as flask_principalVersion from flask_babel import Babel from flask_babel import gettext as _ import requests @@ -24,6 +28,7 @@ import zipfile from werkzeug.security import generate_password_hash, check_password_hash from babel import Locale as LC from babel import negotiate_locale +from babel import __version__ as babelVersion from babel.dates import format_date from functools import wraps import base64 @@ -32,16 +37,16 @@ import json import urllib import datetime from iso639 import languages as isoLanguages +from iso639 import __version__ as iso639Version from uuid import uuid4 import os.path import sys import subprocess import re import db -import thread from shutil import move, copyfile from tornado.ioloop import IOLoop - +from tornado import version as tornadoVersion try: from wand.image import Image @@ -1042,6 +1047,15 @@ def stats(): if re.search('Amazon kindlegen\(', lines): versions['KindlegenVersion'] = lines versions['PythonVersion'] = sys.version + versions['babel'] = babelVersion + versions['sqlalchemy'] = sqlalchemyVersion + versions['flask'] = flaskVersion + versions['flasklogin'] = flask_loginVersion + versions['flask_principal'] = flask_principalVersion + versions['tornado'] = tornadoVersion + versions['iso639'] = iso639Version + versions['requests'] = requests.__version__ + return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=versions, categorycounter=categorys, seriecounter=series, title=_(u"Statistics")) @@ -1796,6 +1810,8 @@ def edit_mailsettings(): category="success") else: flash(_(u"There was an error sending the Test E-Mail: %(res)s", res=result), category="error") + else: + flash(_(u"E-Mail settings updated"), category="success") return render_title_template("email_edit.html", content=content, title=_(u"Edit mail settings")) From 2f1fdab9de713e2050de19e12667621fd03cfdc7 Mon Sep 17 00:00:00 2001 From: idalin Date: Fri, 24 Feb 2017 14:34:08 +0800 Subject: [PATCH 3/3] delete douban_meta.js in master.(This is for Chinese user only) --- cps/static/js/douban_meta.js | 87 ------------------------------------ 1 file changed, 87 deletions(-) delete mode 100644 cps/static/js/douban_meta.js diff --git a/cps/static/js/douban_meta.js b/cps/static/js/douban_meta.js deleted file mode 100644 index 773939f9..00000000 --- a/cps/static/js/douban_meta.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Get Metadata from Douban api - * Created by idalin - */ - -$(document).ready(function () { - var get_meta_btn = '
  • ' + - '' + - '获取Meta
  • '; - $('#main-nav').prepend(get_meta_btn); - var douban = 'https://api.douban.com'; - var search = '/v2/book/search'; - var get_info = '/v2/book/'; - var get_info_by_isbn = '/v2/book/isbn/ '; - - $.ajaxSetup({ - type: "GET", - dataType: "jsonp", - jsonp: 'callback', - async: false - }); - - get_meta = function (id) { - var url = douban + get_info + id; - console.log('getting book meta:' + id); - $.ajax({ - url: url, - success: function (meta) { - console.log(meta); - //$('#metaModal').modal('hide'); - $('#description').val(meta.summary); - $('#bookAuthor').val(meta.author.join(' & ')); - $('#book_title').val(meta.title); - var tags = ''; - for (var i = 0; i < meta.tags.length; i++) { - tags = tags + meta.tags[i].title + ','; - } - $('#tags').val(tags); - $('#rating').val(Math.round(meta.rating.average / 4)); - } - }); - } - - get_meta_by_isbn = function (isbn) { - var url = douban + get_info_by_isbn + isbn; - } - - search_book = function (title) { - var url = douban + search + '?q=' + title + '&fields=id,title,author,publisher,isbn13,image,summary'; - $.ajax({ - url: url, - success: function (data) { - if (data.books.length < 1) { - $('#meta-info').html('

    搜索不到对应的书籍

    '); - } else { - $('#meta-info').html('
      '); - for (var i = 0; i < data.books.length; i++) { - var book = '
    • ' + - 'Cover' + - '
      ' + - '

      ' + data.books[i].title + '

      ' + - '

      作者:' + data.books[i].author + '

      ' + - '

      出版社:' + data.books[i].publisher + '

      ' + - '

      简介:' + data.books[i].summary + '

      ' + - '
      ' + - '
    • '; - $("#book-list").append(book); - } - } - }, - error: function () { - $('#meta-info').html('

      搜索出错

      '); - } - }); - } - - $('#get_meta').click(function () { - var book_title = $('#book_title').val(); - if (book_title) { - // console.log(book_title); - search_book(book_title); - } - }); -}); \ No newline at end of file