aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDylan Garrett <dylan.garrett@gmail.com>2021-06-06 15:12:58 -0700
committerDylan Garrett <dylan.garrett@gmail.com>2021-06-06 15:12:58 -0700
commite92870d42beaa1a01ab48a60cb322efa95e399bc (patch)
tree8a2a204a411f4077954d3b634039eeea28fc9388 /lib
parent53d8bcb0c29f5e7a8492ad715ca25930f997f352 (diff)
downloadroka-e92870d42beaa1a01ab48a60cb322efa95e399bc.tar.gz
roka-e92870d42beaa1a01ab48a60cb322efa95e399bc.zip
Some hacks. But generates some static rss feeds
Diffstat (limited to 'lib')
-rw-r--r--lib/util.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/util.py b/lib/util.py
index a2f982d..4a884af 100644
--- a/lib/util.py
+++ b/lib/util.py
@@ -78,9 +78,7 @@ def escape(s):
return s
-def generate_rss(request, books):
- book = request.args.get('a') # audiobook hash
-
+def generate_rss(base_url, book, books, static=False):
# we only make use of the itunes ns, others provided for posterity
namespaces = {
'itunes':'http://www.itunes.com/dtds/podcast-1.0.dtd',
@@ -156,8 +154,9 @@ def generate_rss(request, books):
pub_format = '%a, %d %b %Y %H:%M:%S %z'
pub_date.text = (date(2000, 12, 31) - timedelta(days=idx)).strftime(
pub_format)
+ url_format = '{}{}/{}.mp3' if static else '{}?a={}&f={}'
enc_attr = {
- 'url': '{}?a={}&f={}'.format(request.base_url, book, f),
+ 'url': url_format.format(base_url, book, f),
'length': str(books[book]['files'][f]['size_bytes']),
'type': 'audio/mpeg'
}