reAudioPlayer / one

The open source audio player with the most extensive catalogue
https://reaudioplayer.github.io/one/
GNU General Public License v3.0
4 stars 0 forks source link

return res? #61

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

https://github.com/reAudioPlayer/one/blob/7073c8ee7ff9c4f4dfe9d93431016cbfd28e0ba0/src/server/handler/download.py#L58


        res = web.FileResponse(pathAndName,
            headers=MultiDict({"Content-Disposition": f"Attachment;filename={filename}.mp3"}))

        # TODO return res?

        await res.prepare(request)
        await res.write_eof()
        os.remove(pathAndName)
        return web.Response()

    @withObjectPayload(Object({
        "id": Integer(),
    }), inBody = True)
    async def streamFromCache(self, payload: Dict[str, Any]) -> Union[web.FileResponse,
                                                                      web.Response]:
        """get(/api/player/stream/{id})"""
        id_: int = payload["id"]
        pathAndName = f"./_cache/{id_}.mp3"
        if os.path.exists(pathAndName):
            return web.FileResponse(pathAndName)
        return web.Response(status = 404)
github-actions[bot] commented 1 year ago

Closed in c35ab939a48aeb27d69ff44a4a342888038d1cc1