diff options
author | Jordan <me@jordan.im> | 2021-06-16 03:04:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-16 03:04:08 -0700 |
commit | 90e0edf9865fab9822864d1f00d36c4e28a91847 (patch) | |
tree | 2cad90e05483e1b9eeeff827739b41244266938b /lib/util.py | |
parent | 4cd0884b307e28bd9f2e531c41fb7b41600b02a4 (diff) | |
parent | e7f4b527e2ee2cbae9f7a53f2a8100fa40bc9138 (diff) | |
download | roka-90e0edf9865fab9822864d1f00d36c4e28a91847.tar.gz roka-90e0edf9865fab9822864d1f00d36c4e28a91847.zip |
Merge pull request #3 from dgarrett/static-generation
Static generation
Diffstat (limited to 'lib/util.py')
-rw-r--r-- | lib/util.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/util.py b/lib/util.py index 1eb6af6..4693ef1 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' } |