fix stream_name for torrent on json encoder
This commit is contained in:
parent
732b7e79d7
commit
31c6e0e835
3 changed files with 6 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue