aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README28
-rwxr-xr-xrun.py3
2 files changed, 28 insertions, 3 deletions
diff --git a/README b/README
index cef6721..e1db59f 100644
--- a/README
+++ b/README
@@ -6,14 +6,38 @@ iOS podcast app: https://demo.jordan.im/audiobook-rss/apple-podcasts.png
installation
------------
-a) copy and populate app.cfg and uwsgi.ini (if using UWSGI)
+a) copy and populate app.cfg and uwsgi.ini from examples
-b) create venv, install flask and uwsgi
+ $ cp app.cfg.example app.cfg
+ $ cp uwsgi.ini.example uwsgi.ini
+ $ cat app.cfg
+
+ ROOT_PATH = '/path/to/audiobooks'
+ USERNAME = 'username'
+ PASSWORD = 'password'
+
+ $ cat uwsgi.ini
+
+ [uwsgi]
+ http = 127.0.0.1:8085
+ processes = 2
+ threads = 4
+ wsgi-file = run.py
+ callable = app
+ master = true
+
+b) install python dependencies flask and uwsgi
+
+ $ pip install --user flask uwsgi
c) execute rebuild.py to populate audiobook JSON cache
+ $ ./rebuild.py
+
d) execute uwsgi.sh to start the server
+ $ ./uwsgi.sh
+
design decisions
----------------
diff --git a/run.py b/run.py
index 8d3bed8..e48f19f 100755
--- a/run.py
+++ b/run.py
@@ -31,7 +31,6 @@ def list_books():
return 'book or file not found', 404
f_path = books[a]['files'][f]['path']
-
return send_file(f_path, conditional=True)
# serve up audiobook RSS feed; only audiobook hash provided
@@ -41,11 +40,13 @@ def list_books():
rss = generate_rss(request, books)
return Response(rss, mimetype='text/xml')
+
else:
auth = request.authorization
if not auth or not check_auth(app, auth.username, auth.password):
form = {'WWW-Authenticate': 'Basic realm="o/"'}
return Response('unauthorized', 401, form)
+
return render_template('index.html', books=books)
if __name__ == '__main__':