From 157a2e6e4aae63853133d873dbb486890ca44d44 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Wed, 28 Dec 2016 15:51:58 +0100 Subject: [PATCH] Renamed feed to opds for better compatibility with some readers added clickable links to feed (should hopefully solve #79) updated readme --- cps/templates/feed.xml | 12 ++++++----- cps/templates/index.xml | 20 ++++++++++------- cps/templates/osd.xml | 15 ------------- cps/templates/search.xml | 11 ---------- cps/web.py | 46 ++++++++++++++++++++-------------------- readme.md | 7 +++--- 6 files changed, 46 insertions(+), 65 deletions(-) diff --git a/cps/templates/feed.xml b/cps/templates/feed.xml index 84d03493..6e5575c0 100644 --- a/cps/templates/feed.xml +++ b/cps/templates/feed.xml @@ -61,23 +61,25 @@ {% for author in authors %} {{author.name}} - {{ url_for('feed_author', name=author.name) }} - + + {% endfor %} {% for entry in categorys %} {{entry.name}} {{ url_for('feed_category', name=entry.name) }} - + + {% endfor %} {% for entry in series %} {{entry.name}} {{ url_for('feed_series', name=entry.name) }} - - + + + {% endfor %} diff --git a/cps/templates/index.xml b/cps/templates/index.xml index d315ffd1..118f5481 100644 --- a/cps/templates/index.xml +++ b/cps/templates/index.xml @@ -21,51 +21,55 @@ {{_('Hot Books')}} - + + {{url_for('feed_hot')}} {{_('Popular publications from this catalog based on Rating.')}} {{_('New Books')}} + + type="application/atom+xml;profile=opds-catalog;type=feed;kind=acquisition"/> {{url_for('feed_new')}} {{_('The latest Books')}} {{_('Random Books')}} + + type="application/atom+xml;profile=opds-catalog;type=feed;kind=acquisition"/> {{url_for('feed_discover')}} {{_('Show Random Books')}} {{_('Authors')}} + + type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/> {{url_for('feed_authorindex')}} {{_('Books ordered by Author')}} {{_('Category list')}} + + type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/> {{url_for('feed_categoryindex')}} {{_('Books ordered by category')}} {{_('Series list')}} + + type="application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"/> {{url_for('feed_seriesindex')}} {{_('Books ordered by series')}} diff --git a/cps/templates/osd.xml b/cps/templates/osd.xml index c569712b..ddbb3e91 100644 --- a/cps/templates/osd.xml +++ b/cps/templates/osd.xml @@ -13,21 +13,6 @@ - - - - - - Search Data Copyright 1971-2012, Project Gutenberg, All Rights Reserved. open de-DE UTF-8 diff --git a/cps/templates/search.xml b/cps/templates/search.xml index 95f5c58a..ddbb3e91 100644 --- a/cps/templates/search.xml +++ b/cps/templates/search.xml @@ -13,17 +13,6 @@ - - - - - - open de-DE UTF-8 diff --git a/cps/web.py b/cps/web.py index 4458700f..527781af 100755 --- a/cps/web.py +++ b/cps/web.py @@ -416,7 +416,7 @@ def before_request(): g.allow_upload = config.UPLOADING -@app.route("/feed") +@app.route("/opds") @requires_basic_auth_if_no_ano def feed_index(): if current_user.filter_language() != "all": @@ -429,7 +429,7 @@ def feed_index(): return response -@app.route("/feed/osd") +@app.route("/opds/osd") @requires_basic_auth_if_no_ano def feed_osd(): xml = render_template('osd.xml') @@ -438,7 +438,7 @@ def feed_osd(): return response -@app.route("/feed/search", methods=["GET"]) +@app.route("/opds/search", methods=["GET"]) @requires_basic_auth_if_no_ano def feed_search(): term = request.args.get("query").strip() @@ -459,7 +459,7 @@ def feed_search(): return response -@app.route("/feed/new") +@app.route("/opds/new") @requires_basic_auth_if_no_ano def feed_new(): off = request.args.get("start_index") @@ -472,13 +472,13 @@ def feed_new(): entries = db.session.query(db.Books).filter(filter).order_by(db.Books.timestamp.desc()).offset(off).limit( config.NEWEST_BOOKS) xml = render_template('feed.xml', entries=entries, - next_url="/feed/new?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/new?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/discover") +@app.route("/opds/discover") @requires_basic_auth_if_no_ano def feed_discover(): off = request.args.get("start_index") @@ -490,13 +490,13 @@ def feed_discover(): off = 0 entries = db.session.query(db.Books).filter(filter).order_by(func.random()).offset(off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', entries=entries, - next_url="/feed/discover?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/discover?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/hot") +@app.route("/opds/hot") @requires_basic_auth_if_no_ano def feed_hot(): off = request.args.get("start_index") @@ -510,13 +510,13 @@ def feed_hot(): off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', entries=entries, - next_url="/feed/hot?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/hot?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/author") +@app.route("/opds/author") @requires_basic_auth_if_no_ano def feed_authorindex(): off = request.args.get("start_index") @@ -528,13 +528,13 @@ def feed_authorindex(): off = 0 authors = db.session.query(db.Authors).order_by(db.Authors.sort).offset(off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', authors=authors, - next_url="/feed/author?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/author?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/author/") +@app.route("/opds/author/") @requires_basic_auth_if_no_ano def feed_author(name): off = request.args.get("start_index") @@ -547,13 +547,13 @@ def feed_author(name): entries = db.session.query(db.Books).filter(db.Books.authors.any(db.Authors.name.like("%" + name + "%"))).filter( filter).offset(off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', entries=entries, - next_url="/feed/author?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/author?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/category") +@app.route("/opds/category") @requires_basic_auth_if_no_ano def feed_categoryindex(): off = request.args.get("start_index") @@ -561,13 +561,13 @@ def feed_categoryindex(): off = 0 entries = db.session.query(db.Tags).order_by(db.Tags.name).offset(off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', categorys=entries, - next_url="/feed/category?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/category?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/category/") +@app.route("/opds/category/") @requires_basic_auth_if_no_ano def feed_category(name): off = request.args.get("start_index") @@ -580,13 +580,13 @@ def feed_category(name): entries = db.session.query(db.Books).filter(db.Books.tags.any(db.Tags.name.like("%" + name + "%"))).order_by( db.Books.timestamp.desc()).filter(filter).offset(off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', entries=entries, - next_url="/feed/category?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/category?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/series") +@app.route("/opds/series") @requires_basic_auth_if_no_ano def feed_seriesindex(): off = request.args.get("start_index") @@ -594,13 +594,13 @@ def feed_seriesindex(): off = 0 entries = db.session.query(db.Series).order_by(db.Series.name).offset(off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', series=entries, - next_url="/feed/series?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/series?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/series/") +@app.route("/opds/series/") @requires_basic_auth_if_no_ano def feed_series(name): off = request.args.get("start_index") @@ -613,13 +613,13 @@ def feed_series(name): entries = db.session.query(db.Books).filter(db.Books.series.any(db.Series.name.like("%" + name + "%"))).order_by( db.Books.timestamp.desc()).filter(filter).offset(off).limit(config.NEWEST_BOOKS) xml = render_template('feed.xml', entries=entries, - next_url="/feed/series?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) + next_url="/opds/series?start_index=%d" % (int(config.NEWEST_BOOKS) + int(off))) response = make_response(xml) response.headers["Content-Type"] = "application/xml" return response -@app.route("/feed/download//") +@app.route("/opds/download//") @requires_basic_auth_if_no_ano @download_required def get_opds_download_link(book_id, format): @@ -1036,7 +1036,7 @@ def get_cover(cover_path): return send_from_directory(os.path.join(config.DB_ROOT, cover_path), "cover.jpg") -@app.route("/feed/cover/") +@app.route("/opds/cover/") @requires_basic_auth_if_no_ano def feed_get_cover(cover_path): return send_from_directory(os.path.join(config.DB_ROOT, cover_path), "cover.jpg") diff --git a/readme.md b/readme.md index d23b0cdd..1bcdf784 100755 --- a/readme.md +++ b/readme.md @@ -10,7 +10,8 @@ Calibre Web is a web app providing a clean interface for browsing, reading and d - Bootstrap 3 HTML5 interface - User management - Admin interface -- OPDS feed for eBook reader apps +- User Interface in english, german and french +- OPDS feed for eBook reader apps - Filter and search by titles, authors, tags, series and language - Create custom book collection (shelves) - Support for editing eBook metadata @@ -18,7 +19,7 @@ Calibre Web is a web app providing a clean interface for browsing, reading and d - Restrict eBook download to logged-in users - Support for public user registration - Send eBooks to Kindle devices with the click of a button -- Support for reading eBooks directly in the browser +- Support for reading eBooks directly in the browser (.txt, .epub, .pdf) - Upload new books in PDF format - Support for Calibre custom columns - Fine grained per-user permissions @@ -27,7 +28,7 @@ Calibre Web is a web app providing a clean interface for browsing, reading and d 1. Rename `config.ini.example` to `config.ini` and set `DB_ROOT` to the path of the folder where your Calibre library (metadata.db) lives 2. Execute the command: `python cps.py` -3. Point your browser to `http://localhost:8083` or `http://localhost:8083/feed` for the OPDS catalog +3. Point your browser to `http://localhost:8083` or `http://localhost:8083/opds` for the OPDS catalog **Default admin login:** *Username:* admin