diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 5d16812bf..ac8782d7f 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -639,7 +639,7 @@ class Daemon(metaclass=JSONRPCServerType): stream = await self.jsonrpc_get(uri) if isinstance(stream, dict): raise web.HTTPServerError(text=stream['error']) - raise web.HTTPFound(f"/stream/{stream.sd_hash}") + raise web.HTTPFound(f"/stream/{stream.identifier}") async def handle_stream_range_request(self, request: web.Request): try: @@ -658,12 +658,13 @@ class Daemon(metaclass=JSONRPCServerType): log.debug("finished handling /stream range request") async def _handle_stream_range_request(self, request: web.Request): - sd_hash = request.path.split("/stream/")[1] + identifier = request.path.split("/stream/")[1] if not self.file_manager.started.is_set(): await self.file_manager.started.wait() - if sd_hash not in self.file_manager.streams: + stream = self.file_manager.get_filtered(identifier=identifier) + if not stream: return web.HTTPNotFound() - return await self.file_manager.stream_partial_content(request, sd_hash) + return await self.file_manager.stream_partial_content(request, identifier) async def _process_rpc_call(self, data): args = data.get('params', {}) diff --git a/lbry/file/file_manager.py b/lbry/file/file_manager.py index 6ab943907..cb5d8684a 100644 --- a/lbry/file/file_manager.py +++ b/lbry/file/file_manager.py @@ -290,8 +290,10 @@ class FileManager: ) ) - async def stream_partial_content(self, request: Request, sd_hash: str): - return await self.source_managers['stream'].stream_partial_content(request, sd_hash) + async def stream_partial_content(self, request: Request, identifier: str): + for source_manager in self.source_managers.values(): + if source_manager.get_filtered(identifier=identifier): + return await source_manager.stream_partial_content(request, identifier) def get_filtered(self, *args, **kwargs) -> typing.List[ManagedDownloadSource]: """ diff --git a/lbry/file/source_manager.py b/lbry/file/source_manager.py index 72c1709dd..c6af4fac6 100644 --- a/lbry/file/source_manager.py +++ b/lbry/file/source_manager.py @@ -23,6 +23,7 @@ COMPARISON_OPERATORS = { class SourceManager: filter_fields = { + 'identifier', 'rowid', 'status', 'file_name',