GithubHelp home page GithubHelp logo

janeczku / calibre-web Goto Github PK

View Code? Open in Web Editor NEW
11.5K 171.0 1.2K 90.52 MB

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database

License: GNU General Public License v3.0

Python 41.26% CSS 1.08% JavaScript 40.19% HTML 17.48%
calibre epub mobi ebook ebook-manager

calibre-web's Introduction

Short Notice from the maintainer

After 6 years of more or less intensive programming on Calibre-Web, I need a break. The last few months, maintaining Calibre-Web has felt more like work than a hobby. I felt pressured and teased by people to solve "their" problems and merge PRs for "their" Calibre-Web. I have turned off all notifications from Github/Discord and will now concentrate undisturbed on the development of โ€œmyโ€ Calibre-Web over the next few weeks/months.
I will look into the issues and maybe also the PRs from time to time, but don't expect a quick response from me.

Calibre-Web

Calibre-Web is a web app that offers a clean and intuitive interface for browsing, reading, and downloading eBooks using a valid Calibre database.

License Commit Activity All Releases PyPI PyPI - Downloads Discord

Table of Contents (click to expand)
  1. About
  2. Features
  3. Installation
  4. Docker Images
  5. Contributor Recognition
  6. Contact
  7. Contributing to Calibre-Web

This software is a fork of library and licensed under the GPL v3 License.

Main screen

Features

  • Modern and responsive Bootstrap 3 HTML5 interface
  • Full graphical setup
  • Comprehensive user management with fine-grained per-user permissions
  • Admin interface
  • Multilingual user interface supporting 20+ languages (supported languages)
  • OPDS feed for eBook reader apps
  • Advanced search and filtering options
  • Custom book collection (shelves) creation
  • eBook metadata editing and deletion support
  • Metadata download from various sources (extensible via plugins)
  • eBook conversion through Calibre binaries
  • eBook download restriction to logged-in users
  • Public user registration support
  • Send eBooks to E-Readers with a single click
  • Sync Kobo devices with your Calibre library
  • In-browser eBook reading support for multiple formats
  • Upload new books in various formats, including audio formats
  • Calibre Custom Columns support
  • Content hiding based on categories and Custom Column content per user
  • Self-update capability
  • "Magic Link" login for easy access on eReaders
  • LDAP, Google/GitHub OAuth, and proxy authentication support

Installation

Installation via pip (recommended)

  1. Create a virtual environment for Calibre-Web to avoid conflicts with existing Python dependencies
  2. Install Calibre-Web via pip: pip install calibreweb (or pip3 depending on your OS/distro)
  3. Install optional features via pip as needed, see this page for details
  4. Start Calibre-Web by typing cps

Note: Raspberry Pi OS users may encounter issues during installation. If so, please update pip (./venv/bin/python3 -m pip install --upgrade pip) and/or install cargo (sudo apt install cargo) before retrying the installation.

Refer to the Wiki for additional installation examples: manual installation, Linux Mint, Cloud Provider.

Quick Start

  1. Open your browser and navigate to http://localhost:8083 or http://localhost:8083/opds for the OPDS catalog
  2. Log in with the default admin credentials
  3. If you don't have a Calibre database, you can use this database (move it out of the Calibre-Web folder to prevent overwriting during updates)
  4. Set Location of Calibre database to the path of the folder containing your Calibre library (metadata.db) and click "Save"
  5. Optionally, use Google Drive to host your Calibre library by following the Google Drive integration guide
  6. Configure your Calibre-Web instance via the admin page, referring to the Basic Configuration and UI Configuration guides

Default Admin Login:

  • Username: admin
  • Password: admin123

Requirements

  • Python 3.5+
  • Imagemagick for cover extraction from EPUBs (Windows users may need to install Ghostscript for PDF cover extraction)
  • Optional: Calibre desktop program for on-the-fly conversion and metadata editing (set "calibre's converter tool" path on the setup page)
  • Optional: Kepubify tool for Kobo device support (place the binary in /opt/kepubify on Linux or C:\Program Files\kepubify on Windows)

Docker Images

Pre-built Docker images are available in the following Docker Hub repositories (maintained by the LinuxServer team):

LinuxServer - x64, aarch64

  • Docker Hub

  • GitHub

  • GitHub - Optional Calibre layer

    Include the environment variable DOCKER_MODS=linuxserver/mods:universal-calibre in your Docker run/compose file to add the Calibre ebook-convert binary (x64 only). Omit this variable for a lightweight image.

    Both the Calibre-Web and Calibre-Mod images are automatically rebuilt on new releases and updates.

    • Set "path to convertertool" to /usr/bin/ebook-convert
    • Set "path to unrar" to /usr/bin/unrar

Contributor Recognition

We would like to thank all the contributors and maintainers of Calibre-Web for their valuable input and dedication to the project. Your contributions are greatly appreciated.

Contact

Join us on Discord

For more information, How To's, and FAQs, please visit the Wiki

Contributing to Calibre-Web

Check out our Contributing Guidelines

calibre-web's People

Contributors

andy29485 avatar aroberts avatar blitzmann avatar bodybybuddha avatar cbartondock avatar celogeek avatar cervinko avatar elquimm avatar garckaman avatar ghighi3f avatar hexeth avatar idalin avatar irfan-ansari-au28 avatar jkrehm avatar jvoisin avatar knepherbird avatar krakinou avatar kyosfonica avatar leram84 avatar mmonkey avatar nykul avatar ok11 avatar otapi avatar ozzieisaacs avatar pwr avatar radoslawkierznowski avatar shavitmichael avatar subdiox avatar xlivevil avatar xzvb12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calibre-web's Issues

500 Internal Server Error

Hello, thanks for this promising piece of software. I was looking for a more convenient way to access my ebook library from the network, and I think this is just what I was looking for.

Anyway, I often get this error on the browser (Firefox and Chrome):

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the aplication.

While in the command line I can read this:

root@host:~/calibre-web-biblio# python cps.py
ERROR:cps.web:Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/root/calibre-web-biblio/cps/web.py", line 393, in index
    return render_template('index.html', random=random, entries=entries, pagination=pagination, title="Latest Books")
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 128, in render_template
    context, ctx.app)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 110, in _render
    rv = template.render(context)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/root/calibre-web-biblio/cps/templates/index.html", line 1, in top-level template code
    {% extends "layout.html" %}
  File "/root/calibre-web-biblio/cps/templates/layout.html", line 66, in top-level template code
    {% if g.user.is_authenticated() %}
AttributeError: 'bool' object has no attribute '__call__'
ERROR:tornado.access:500 GET / (192.168.1.132) 3776.21ms

Sometimes I can work around it if I first load http://localhost:8083/feed and then enter the main web page, but not all the time. Am I doing something wrong? The script is running on a Debian jessie server which is up to date.

Thank you in advance.

Logging in after logging out after a search results in a 500 error.

The following scenario leads to a thrown exception in the code:

  1. I'm logged in, and perform a normal search. Note that it doesn't happen with an advanced search.
  2. While the search results are still visible, i log out.
  3. I now immedeatly either log in as the same user or another user.
  4. It returns to the search result page, but with an empty query (http:/calibremachine.home/calibre/search for example)

And that results in the followin exception being thrown:

Oct 04 21:35:58 calibremachine python2[343]: ERROR:cps.web:Exception on /search [GET]
Oct 04 21:35:58 calibremachine python2[343]: Traceback (most recent call last):
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1817, in wsgi_app
Oct 04 21:35:58 calibremachine python2[343]:     response = self.full_dispatch_request()
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1477, in full_dispatch_request
Oct 04 21:35:58 calibremachine python2[343]:     rv = self.handle_user_exception(e)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1381, in handle_user_exception
Oct 04 21:35:58 calibremachine python2[343]:     reraise(exc_type, exc_value, tb)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1475, in full_dispatch_request
Oct 04 21:35:58 calibremachine python2[343]:     rv = self.dispatch_request()
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1461, in dispatch_request
Oct 04 21:35:58 calibremachine python2[343]:     return self.view_functions[rule.endpoint](**req.view_args)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask_login.py", line 717, in decorated_view
Oct 04 21:35:58 calibremachine python2[343]:     return func(*args, **kwargs)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/cps/web.py", line 477, in search
Oct 04 21:35:58 calibremachine python2[343]:     term = request.args.get("query").strip()
Oct** 04 21:35:58 calibremachine python2[343]: AttributeError: 'NoneType' object has no attribute 'strip'
Oct 04 21:35:58 calibremachine python2[343]: ERROR:tornado.access:500 GET /calibre/search (10.10.0.100) 50.28ms

The advanced search just returns me to the advanced search page in this case.

If i manually change the url from calibre/search to calibre/ in my example, i'm correctly logged in and it works normally.

Closing the tab or the browser and normally going to the login page doesn't do this as well.

Error when opening advanced search

I'm getting the following error report in the logs.

[2016-10-03 00:43:43,826] {/opt/calibre/vendor/flask/app.py:1423} ERROR - Exception on /advanced_search [GET]
Traceback (most recent call last):
  File "/opt/calibre/vendor/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/calibre/vendor/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/calibre/vendor/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/calibre/vendor/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/calibre/vendor/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/calibre/cps/web.py", line 492, in advanced_search
    author_name = request.args.get("author_name").strip()
AttributeError: 'NoneType' object has no attribute 'strip'

Error: Calibre Database Directory <DB_ROOT> is not configured

Hi
i try to use this calibre-web,
i download it and unzip it to C:\calibre-web-master
I did rename and change the config file
[General]
DB_ROOT = C:\Users\S\Documents\Calibre Library
APP_DB_ROOT =
MAIN_DIR =
LOG_DIR =
PORT = 8083
NEWEST_BOOKS = 60
[Advanced]
TITLE_REGEX = ^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+
DEVELOPMENT = 0
PUBLIC_REG = 0
UPLOADING = 0
ANON_BROWSE = 0

when i run cps.py
C:\Python27>Python C:\calibre-web-master\cps.py
i got an error "Calibre Database Directory <DB_ROOT> is not configured"

what can it put DB_ROOT = C:\Users\S\Documents\Calibre Library
or i need to add any thing
please help

upload?!

is the upload functionality not implemented yet or am I just to blind to find it?

Support for reverse proxy

Maybe this is already available and I'm just missing it.

I have several services running on my domain and I'm using Nginx to reverse proxy them. For example, instead of having to go to example.com:8080 I would go to example.com/calibre.

Calibre's built in web server lets you do this by passing the --url-prefix=/calibre flag. Perhaps something similar could be done here?


Side note: I'm currently using the docker container to run this. Works fine from localhost and it looks beautiful!

Enhancement: Anon permissions

Is there any way that you could extend the permission model under the admin section to anon users? As far as I can tell, a lot of epub readers don't have interfaces for auth through the OPDS feed. Unless I'm missing something.

"Calibre database directory (DB_ROOT) is not configured"

Hi,

When I run /usr/bin/python /opt/calibre-web/cps.py from my home dir I get this error:
Calibre database directory (DB_ROOT) is not configured

When I run /usr/bin/python /opt/calibre-web/cps.py from /opt/calibre-web/ it runs perfectly!

I want to use the command to start the calibre-web instance at boot, but when I add it to crontab I get that same error message.

Can you help me?

Feature : Mark as Read By User

Thanks for this development, it's awesome.
Is there a way or what is the best way to easely implement "mark read/not read" by user ?

Mail Send Problem

From Dockerhub :
is the mail send function up to date?
filled in the smtp settings in the admin menu, but i'll get an error message

Could you open an issue report on GitHub and paste the error log? Thanks!

where is the error log located?

No cover images displayed

With my Calibre library, no cover image can be displayed. From the traceback shown below, I guess you should use unicode encoding when constructing the file system path for serving an image:

ERROR:cps.web:Exception on /cover/Ellen Porath/Der Bund der Drachenlanze 9 - Stahl (165) [GET]
Traceback (most recent call last):
  File "C:\Program Files\Calibre2\calibre-web-master\vendor\flask\app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Program Files\Calibre2\calibre-web-master\vendor\flask\app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Program Files\Calibre2\calibre-web-master\vendor\flask\app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Program Files\Calibre2\calibre-web-master\vendor\flask\app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Program Files\Calibre2\calibre-web-master\vendor\flask\app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Program Files\Calibre2\calibre-web-master\vendor\flask_login.py", line 717, in decorated_view
    return func(*args, **kwargs)
  File "C:\Program Files\Calibre2\calibre-web-master\cps\web.py", line 529, in get_cover
    return send_from_directory(os.path.join(config.DB_ROOT, cover_path), "cover.jpg")
  File "C:\Python27\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)
ERROR:tornado.access:500 GET /cover/Ellen%20Porath/Der%20Bund%20der%20Drachenlanze%209%20-%20Stahl%20%28165%29 (::1) 5.00ms

Note that the image URLs referenced in the generated HTML looked normal to me.

"No such table" error when clicking on a book

After starting calibre-web with python cps.py I can navigate around the site and all of the books in my library are properly displayed. If I click on a book I get a 500 error.

I believe I'm getting the same error in docker, though I'm not getting any traceback output when attaching to the container. The webpage shows the same 500 error.

OS: 64bit Mac OS X 10.11.4 15E65
Kernel: x86_64 Darwin 15.4.0
Calibre: 2.53
Python: 2.7.11

ERROR:cps.web:Exception on /book/125 [GET]
Traceback (most recent call last):
  File "/Users/jgillman/Code/calibre-web/vendor/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/jgillman/Code/calibre-web/vendor/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/jgillman/Code/calibre-web/vendor/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/jgillman/Code/calibre-web/vendor/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/jgillman/Code/calibre-web/vendor/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/jgillman/Code/calibre-web/vendor/flask_login.py", line 717, in decorated_view
    return func(*args, **kwargs)
  File "/Users/jgillman/Code/calibre-web/cps/web.py", line 381, in show_book
    return render_template('detail.html', entry=entries,  cc=cc, title=entries.title, books_shelfs=book_in_shelfs)
  File "/Users/jgillman/Code/calibre-web/vendor/flask/templating.py", line 128, in render_template
    context, ctx.app)
  File "/Users/jgillman/Code/calibre-web/vendor/flask/templating.py", line 110, in _render
    rv = template.render(context)
  File "/Users/jgillman/Code/calibre-web/vendor/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/jgillman/Code/calibre-web/vendor/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/jgillman/Code/calibre-web/cps/templates/detail.html", line 1, in top-level template code
    {% extends "layout.html" %}
  File "/Users/jgillman/Code/calibre-web/cps/templates/layout.html", line 136, in top-level template code
    {% block body %}{% endblock %}
  File "/Users/jgillman/Code/calibre-web/cps/templates/detail.html", line 66, in block "body"
    {% if entry['custom_column_' ~ c.id]|length > 0 %}
  File "/Users/jgillman/Code/calibre-web/vendor/jinja2/environment.py", line 387, in getitem
    return getattr(obj, attr)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/orm/attributes.py", line 316, in __get__
    return self.impl.get(instance_state(instance), dict_)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/orm/attributes.py", line 613, in get
    value = self.callable_(state, passive)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/orm/strategies.py", line 524, in _load_for_state
    return self._emit_lazyload(session, state, ident_key, passive)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/orm/strategies.py", line 585, in _emit_lazyload
    result = q.all()
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/orm/query.py", line 2241, in all
    return list(self)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/orm/query.py", line 2353, in __iter__
    return self._execute_and_instances(context)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/orm/query.py", line 2368, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/engine/base.py", line 662, in execute
    params)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/engine/base.py", line 761, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/engine/base.py", line 874, in _execute_context
    context)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
    exc_info
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/util/compat.py", line 196, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/engine/base.py", line 867, in _execute_context
    context)
  File "/Users/jgillman/Code/calibre-web/vendor/sqlalchemy/engine/default.py", line 324, in do_execute
    cursor.execute(statement, parameters)
OperationalError: (OperationalError) no such table: books_custom_column_1_link u'SELECT custom_column_1.id AS custom_column_1_id, custom_column_1.value AS custom_column_1_value \
nFROM custom_column_1, books_custom_column_1_link \nWHERE ? = books_custom_column_1_link.book AND custom_column_1.id = books_custom_column_1_link.value' (125,)
ERROR:tornado.access:500 GET /book/125 (::1) 89.60ms

refresh library?

I have some new books in the calibre db but I don't see them in calibre-web until I restart the script.

Is there some kind of cache inside calibre-web?

language filter

could you implement a section for books in different languages similar to authors and categories on the left side?

OPDS Catalogs

Hello,
everything works fine, but have a question. Is it possible to expand the list of items in OPDS catalog? It is very difficult to find a book when there is only hot books, new books, and random books.

send to kindle error

send to kindle throws an error:

ERROR:cps.web:Exception on /send/2853 [GET]
Traceback (most recent call last):
  File "/opt/calibre-web/vendor/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/calibre-web/vendor/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/calibre-web/vendor/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/calibre-web/vendor/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/calibre-web/vendor/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/calibre-web/vendor/flask_login.py", line 717, in decorated_view
    return func(*args, **kwargs)
  File "/opt/calibre-web/cps/web.py", line 179, in inner
    return f(*args, **kwargs)
  File "/opt/calibre-web/cps/web.py", line 611, in send_to_kindle
    result = helper.send_mail(book_id, current_user.kindle_mail)
  File "/opt/calibre-web/cps/helper.py", line 131, in send_mail
    except (socket.error, smtplib.SMTPRecipientsRefused, smtplib.SMTPException), e:
NameError: global name 'socket' is not defined
ERROR:tornado.access:500 GET /send/2853 (1.2.3.4) 1213.13ms

Book description html is broken

Hi,

In the webview the html is stripped and all text is appended after each other. It looks like there
is something wrong with loading/displaying the description in the webui.

screen shot 2015-10-11 at 12 49 47

screen shot 2015-10-11 at 12 49 37

make "Discover (Random Books)" optional

this maybe a good category if you sell books but for my personal library it is quite unnecessary, so I think especially in the "new books" area this should at least be optional?

remove menu from login page

maybe I am missing something, but as the menu (hot/new/discover) doesn't work before login, I think it should be removed from the login page..

Remove trailing spaces

on Mobile devices often times trailing spaces are put behind words by the keyboards auto suggest. in the search box these spaces should be removed before initiating the search as for instance "Douglas Adams " won't yield a result although "Douglas Adams" does.

Reverse proxy subdirectory: Logout-Issue

Hi there,

the Reverse proxy subdirectory-Support was exactly what I need and it works quiete well. But when I click on Logout, the page redirects to its base-url (without the prefix).

EDIT: Seems that is also true for login/register?

Regards

Enhancement: Support Calibre Custom-Columns

For my use case i will need custom columns. As i am not very familiar with SqlAlchemy i would like to discuss which is a good way to implement it.
what i tried so far is this:

cc = conn.execute("SELECT id FROM custom_columns")
cc_ids = []
books_custom_column_links = {}
for row in cc:
    cc_link=Table('books_custom_column_' + str(row.id) + '_link', Base.metadata,
        Column('book', Integer, ForeignKey('books.id'), primary_key=True),
        Column('custom_column', Integer, ForeignKey('custom_column_' + str(row.id) + '.id'), primary_key=True)
        )
    books_custom_column_links[row.id] = cc_link
    cc_ids.append(row.id)
class Custom_Column(object):
    def __init__(self, value):
        self.value = value

def get_cc_table(id):
    custom_column = Custom_Column
    table_name = 'custom_column_' + str(id)
    table_object = Table(table_name, Base.metadata,
        Column('id', Integer, primary_key=True, autoincrement=True),
        Column('value', String)
    )
    clear_mappers()
    mapper(custom_column, table_object, properties={'books' + str(id): relationship(Books, secondary=books_custom_column_links[id] , backref='custom_column_' + str(id))})
    return custom_column

cc_classes={}
for id in cc_ids:
    cc_classes[id] = get_cc_table(id)
print cc_classes

but mixing classical mapping with declarative mapping only led to errors due to my lack of SqlAlchemy experience.
Does anyone have a good solution for this or hints for me where i can learn about mixing classical and declarative mapping. Or even someone who would like to help me with sqlalchemy? in the last case i would commit my first experiments to my development branch

An other approach would be to use plain sql through conn.execute and write helper.get_custom_columns and helper.set_custom_columns functions.

Unable to create Admin user

Just stumbled upon your fork of this project.
What is the reason you decided to fork it, if I may ask?

When I start the cps.py I never get the option to create a admin user.

Enhancement: enhanced rights management

for my usecase i would need an enhanced right mangagement.
my suggestion: use more different numbers in the role field for the different rights:
1=admin
0=download books
2=download and edit books
3=download, edit and upload books

moreover i would add an option in the config to show books only to authenticated users an redirect others to the login page.

@janeczku would you support such an Implementation?

Errors at startup/access

When I start the application and try to access the webpage the following error is logged (and the page is not loaded). Could you please advise what might be wrong?

Config:
root@nas:/opt/calibre-web# cat config.ini
[General]
DB_ROOT = /dikkert/Server/Books/Library
APP_DB_ROOT = /opt/calibre-web
MAIN_DIR = /opt/calibre-web
LOG_DIR = /opt/calibre-web
PORT = 8282
NEWEST_BOOKS = 60
[Advanced]
TITLE_REGEX = ^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+
DEVELOPMENT = 0
PUBLIC_REG = 0
UPLOADING = 1
ANON_BROWSE = 0

Debug: debug.txt
Normal log below

root@nas:/opt/calibre-web# python --version Python 2.7.9 root@nas:/opt/calibre-web# python cps.py ERROR:cps.web:Exception on / [GET] Traceback (most recent call last): File "/opt/calibre-web/vendor/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/opt/calibre-web/vendor/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/opt/calibre-web/vendor/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/opt/calibre-web/vendor/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/opt/calibre-web/vendor/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/opt/calibre-web/vendor/flask_login.py", line 715, in decorated_view elif not current_user.is_authenticated(): File "/opt/calibre-web/vendor/werkzeug/local.py", line 338, in __getattr__ return getattr(self._get_current_object(), name) File "/opt/calibre-web/vendor/werkzeug/local.py", line 297, in _get_current_object return self.__local() File "/opt/calibre-web/vendor/flask_login.py", line 46, in <lambda> current_user = LocalProxy(lambda: _get_user() or File "/opt/calibre-web/vendor/flask_login.py", line 753, in _get_user current_app.login_manager._load_user() File "/opt/calibre-web/vendor/flask_login.py", line 335, in _load_user return self._load_from_header(request.headers[header_name]) File "/opt/calibre-web/vendor/flask_login.py", line 393, in _load_from_header user = self.header_callback(header) File "/opt/calibre-web/cps/web.py", line 116, in load_user_from_header basic_password = header_val.split(':')[1] IndexError: list index out of range ERROR:tornado.access:500 GET / (::1) 22.11ms WARNING:tornado.access:404 GET /favicon.ico (::1) 1.59ms

Control-C:
^CTraceback (most recent call last): File "cps.py", line 25, in <module> IOLoop.instance().start() File "/opt/calibre-web/vendor/tornado/ioloop.py", line 646, in start event_pairs = self._impl.poll(poll_timeout) KeyboardInterrupt

Error When Launching From Other Directory

Good Afternoon -

Thanks for your work on this - much better than the OEM server! I have a potential issue or question, please. I have multiple Calibre libraries - each dedicated to specific content (Magazines, Technical Reference, Books, etc.) I found that I could run multiple instances of this script at once - each set to a different port, of course.

When I attempt to launch them using a string like
python "C:\Program Files (x86)\Calibre Web Servers\Books\cps.py"
, I get the error
python: can't open file 'C:\Program': [Errno 2] No such file or directory.
However, changing to that directory then executing "python cps.py" works.

I'm not a Python expert so really don't know if this is a script or Python thing, but is there a way to launch without first changing directory? Python is in my path.

Thanks!

error when reading book in browser (config problem?)

when I try to read a book in the browser I get things like below.

It may be a problem in the config.ini (it needs some documentation). I simply filled the db_root = line...

WARNING:tornado.access:404 GET /cover/bookname (1.2.3.4) 8.70ms
ERROR:cps.web:Exception on /read/2853 [GET]
Traceback (most recent call last):
  File "/opt/calibre-web/vendor/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/calibre-web/vendor/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/calibre-web/vendor/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/calibre-web/vendor/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/calibre-web/vendor/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/calibre-web/vendor/flask_login.py", line 717, in decorated_view
    return func(*args, **kwargs)
  File "/opt/calibre-web/cps/web.py", line 507, in read_book
    os.mkdir(newDir)
OSError: [Errno 2] No such file or directory: '/opt/calibre-web/cps/static/2853/OEBPS/images/diagram'
ERROR:tornado.access:500 GET /read/2853 (87.157.53.113) 860.93ms

Browse by series

Would be nice to be able to browse by series, like the Calibre Content Server.

Download as PDF

Hi, I have Calibre running on Debian Jessie (v.8.5).
Also installed calibre-web. I really enjoy it.

I was wondering how can I integrate "ebook-convert" tool (from Calibre) to allow downloading epub as PDF?
Thanks!

layout of book page makes download on Kindle hard

the single book page (with the download buttons below the cover) is almost unusable on the kindle. to download a book the dropdown for epub/kindle opens and the kindle entry is very close to the bottom of the page, so you need a lot of trial and error before you hit the entry. I think the screen on the kindle is not very sensitive so close to the frame.

40 pixel margin-bottom should solve this problem..

add shebang to cps.py

could you add

!/usr/bin/env python

on top of cps.py so that we can create an init.d/systemd startup script?

Enhancement: add license to calibre-web

as far as i can see calibre-web and the original calibreserver do not use any license.
i think we should contact Raphael Mutschler and ask him to add a 'free' license

or do we already have a license and i didn't find it?

Suggestion: display number of books in each category/tag

It would be nice to show how many books are under each category in the category list. This way, you can easily spot the most popular categories and find out which is the right one when there are duplicates. It's also the default behaviour of the official calibre web interface.

send to kindle without authentication?

It looks like I cannot send to kindle via SMTP without authentication.

I have a smart host which authenticates via IP and brings me

There was an error sending this book: Failed to send mail: (435, 'Unable to authenticate at present')

unfortunately, I cannot look into the log of the relayserver (it's antispamcloud.com) but I think you send some bogus authentication when you just should connect to the server without authentication.

I wonder why you not simply use sendmail?

Kindlegen conversation error

kindlegen sometimes fails while converting ebooks but in calibre web "Book successfully send to [email protected]" message is shown and an e-mail is sent without an attachment.

ouz@ns333076:~/cw/calibre-web/vendor$ sudo ./kindlegen /home/ouz/kendal2/library/Joe\ Abercrombie/Sharp\ Ends_\ Stories\ from\ the\ World\ of\ The\ First\ Law\ \(4\)/Sharp\ Ends_\ Stories\ from\ the\ World\ of\ The\ -\ Joe\ Abercrombie.epub

*************************************************************
 Amazon kindlegen(Linux) V2.9 build 1028-0897292 
 A command line e-book compiler 
 Copyright Amazon.com and its Affiliates 2014 
*************************************************************

Info(prcgen):I1047: Added metadata dc:Title        "Sharp Ends: Stories from the World of The First Law"
Info(prcgen):I1047: Added metadata dc:Date         "2016-04-25T22:00:00+00:00"
Info(prcgen):I1047: Added metadata dc:Creator      "Joe Abercrombie"
Info(prcgen):I1047: Added metadata dc:Publisher    "Orion"
Info(prcgen):I1047: Added metadata dc:Contributor  "calibre (2.55.0) [http://calibre-ebook.com]"
Info(prcgen):I1047: Added metadata dc:Rights       "All rights reserved"
Info(prcgen):I1047: Added metadata dc:Description  "The Union army may be full of bastards, but there's only one who thinks he can save the day single-handed when the Gurkish come calling: the incomparable Colonel Sand dan Glokta. Curnden Craw and his dozen are out to recover a mysterious item from beyond the Crinna. Only one small 
Info(cssparser):I10004: @rules other than @import, @charset and @font-face are not supported.
Info(prcgen):I1052: Kindle support cover images but does not support cover HTML. Hence using the cover image specified and suppressing cover HTML in content.     URL: /tmp/mobi-Achwwt/titlepage.xhtml
Info(prcgen):I1002: Parsing files  0000034
Warning(prcfile):W14028: Following file does not exist :   styles/XXXXXXXXXXXXXXXX
Info(cssparser):I10006: Invalid syntax for url(), ignoring the URI. "/tmp/mobi-Achwwt/page_styles.css"
Info(prcgen):I1015: Building PRC file
Info(prcgen):I1006: Resolving hyperlinks
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/kindle:embed:0002?mime=image/jpg
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0000.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0001.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0003.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0005.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0007.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0009.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0011.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0013.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0015.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0017.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0019.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0021.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0023.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0027.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0029.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0031.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0032.html#Sharp-Ends-epub
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-Achwwt/text/part0033.html#Sharp-Ends-epub
Warning(prcgen):W14002: Some hyperlinks could not be resolved.
Info(prcgen):I1049: Building table of content     URL: /tmp/mobi-Achwwt/toc.ncx
Error(prcgen):E24010: Hyperlink not resolved in toc (One possible reason can be that the link points to a tag with style display:none):/tmp/mobi-Achwwt/text/part0000.html#Sharp-Ends-epub
Error(prcgen):E24001: The table of content could not be built.
Info(prcgen):I1016: Building enhanced PRC file
Info(prcgen):I1007: Resolving mediaidlinks
Info(prcgen):I1011: Writing mediaidlinks
Info(prcgen):I1009: Resolving guide items
Info(pagemap):I8000: No Page map found in the book
Info(prcgen):I1045: Computing UNICODE ranges used in the book
Info(prcgen):I1046: Found UNICODE range: Basic Latin [20..7E]
Info(prcgen):I1046: Found UNICODE range: General Punctuation - Windows 1252 [2018..201A]
Info(prcgen):I1046: Found UNICODE range: Latin-1 Supplement [A0..FF]
Info(prcgen):I1017: Building PRC file, record count:   0000182
Info(prcgen):I1039: Final stats - text compressed to (in % of original size):  52.49%
Info(prcgen):I1040: The document identifier is: "Sharp_Ends_S-_The_First_Law"
Info(prcgen):I1041: The file format version is V8
Info(prcgen):I1031: Saving PRC file
Info(prcgen):I1032: PRC built successfully
Info(prcgen):I1038: MOBI file could not be generated because of errors!

`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.