Skip to content

Commit

Permalink
Merge pull request #514 from jaydom28/jdom/fix/audioroute
Browse files Browse the repository at this point in the history
fixed audioroute code
  • Loading branch information
jzohrab authored Nov 10, 2024
2 parents b47c592 + c2914b4 commit 28d50f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lute/useraudio/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

import os
from flask import Blueprint, send_file, current_app
from lute.models.book import Book
from lute.db import db
from lute.models.repositories import BookRepository

bp = Blueprint("useraudio", __name__, url_prefix="/useraudio")

Expand All @@ -15,6 +16,7 @@
def stream(bookid):
"Serve the audio, no caching."
dirname = current_app.env_config.useraudiopath
b = Book.find(bookid)
fname = os.path.join(dirname, b.audio_filename)
br = BookRepository(db.session)
book = br.find(bookid)
fname = os.path.join(dirname, book.audio_filename)
return send_file(fname, as_attachment=True, max_age=0)

0 comments on commit 28d50f0

Please sign in to comment.