diff --git a/lbry/extras/daemon/json_response_encoder.py b/lbry/extras/daemon/json_response_encoder.py index 777154f6b..7b5f60840 100644 --- a/lbry/extras/daemon/json_response_encoder.py +++ b/lbry/extras/daemon/json_response_encoder.py @@ -293,7 +293,7 @@ class JSONResponseEncoder(JSONEncoder): 'points_paid': 0.0, 'stopped': not managed_stream.running, 'stream_hash': None, - 'stream_name': None, + 'stream_name': managed_stream.stream_name, 'suggested_file_name': managed_stream.suggested_file_name, 'sd_hash': None, 'mime_type': managed_stream.mime_type, @@ -327,7 +327,6 @@ class JSONResponseEncoder(JSONEncoder): if is_stream: result.update({ 'stream_hash': managed_stream.stream_hash, - 'stream_name': managed_stream.stream_name, 'sd_hash': managed_stream.descriptor.sd_hash, 'key': managed_stream.descriptor.key, 'blobs_completed': managed_stream.blobs_completed, diff --git a/lbry/file/source.py b/lbry/file/source.py index b44576dd2..63ddc6a40 100644 --- a/lbry/file/source.py +++ b/lbry/file/source.py @@ -96,6 +96,10 @@ class ManagedDownloadSource: def suggested_file_name(self): return self._file_name + @property + def stream_name(self): + return self.suggested_file_name + @property def status(self) -> str: return self._status diff --git a/tests/integration/datanetwork/test_file_commands.py b/tests/integration/datanetwork/test_file_commands.py index 25d87166d..7c1178f0e 100644 --- a/tests/integration/datanetwork/test_file_commands.py +++ b/tests/integration/datanetwork/test_file_commands.py @@ -87,6 +87,7 @@ class FileCommands(CommandTestCase): self.assertAlmostEqual(time.time(), file['added_on'], delta=2) self.assertEqual("application/octet-stream", file['mime_type']) self.assertEqual("tmp1", file['suggested_file_name']) + self.assertEqual("tmp1", file['stream_name']) self.assertIn(btih, self.client_session._handles) # stream over streaming API (full range of the largest file)