mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-23 17:27:25 +00:00
stream type independent stream_url
This commit is contained in:
parent
8212e73c2e
commit
7828041786
3 changed files with 4 additions and 13 deletions
|
@ -285,7 +285,7 @@ class JSONResponseEncoder(JSONEncoder):
|
||||||
else:
|
else:
|
||||||
total_bytes_lower_bound = total_bytes = managed_stream.torrent_length
|
total_bytes_lower_bound = total_bytes = managed_stream.torrent_length
|
||||||
result = {
|
result = {
|
||||||
'streaming_url': None,
|
'streaming_url': managed_stream.stream_url,
|
||||||
'completed': managed_stream.completed,
|
'completed': managed_stream.completed,
|
||||||
'file_name': None,
|
'file_name': None,
|
||||||
'download_directory': None,
|
'download_directory': None,
|
||||||
|
@ -326,7 +326,6 @@ class JSONResponseEncoder(JSONEncoder):
|
||||||
}
|
}
|
||||||
if is_stream:
|
if is_stream:
|
||||||
result.update({
|
result.update({
|
||||||
'streaming_url': managed_stream.stream_url,
|
|
||||||
'stream_hash': managed_stream.stream_hash,
|
'stream_hash': managed_stream.stream_hash,
|
||||||
'stream_name': managed_stream.stream_name,
|
'stream_name': managed_stream.stream_name,
|
||||||
'suggested_file_name': managed_stream.suggested_file_name,
|
'suggested_file_name': managed_stream.suggested_file_name,
|
||||||
|
@ -340,10 +339,6 @@ class JSONResponseEncoder(JSONEncoder):
|
||||||
'reflector_progress': managed_stream.reflector_progress,
|
'reflector_progress': managed_stream.reflector_progress,
|
||||||
'uploading_to_reflector': managed_stream.uploading_to_reflector
|
'uploading_to_reflector': managed_stream.uploading_to_reflector
|
||||||
})
|
})
|
||||||
else:
|
|
||||||
result.update({
|
|
||||||
'streaming_url': f'file://{managed_stream.full_path}',
|
|
||||||
})
|
|
||||||
if output_exists:
|
if output_exists:
|
||||||
result.update({
|
result.update({
|
||||||
'file_name': managed_stream.file_name,
|
'file_name': managed_stream.file_name,
|
||||||
|
|
|
@ -99,9 +99,9 @@ class ManagedDownloadSource:
|
||||||
def completed(self):
|
def completed(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
# @property
|
@property
|
||||||
# def stream_url(self):
|
def stream_url(self):
|
||||||
# return f"http://{self.config.streaming_host}:{self.config.streaming_port}/stream/{self.sd_hash}
|
return f"http://{self.config.streaming_host}:{self.config.streaming_port}/stream/{self.identifier}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def finished(self) -> bool:
|
def finished(self) -> bool:
|
||||||
|
|
|
@ -104,10 +104,6 @@ class ManagedStream(ManagedDownloadSource):
|
||||||
def completed(self):
|
def completed(self):
|
||||||
return self.written_bytes >= self.descriptor.lower_bound_decrypted_length()
|
return self.written_bytes >= self.descriptor.lower_bound_decrypted_length()
|
||||||
|
|
||||||
@property
|
|
||||||
def stream_url(self):
|
|
||||||
return f"http://{self.config.streaming_host}:{self.config.streaming_port}/stream/{self.sd_hash}"
|
|
||||||
|
|
||||||
async def update_status(self, status: str):
|
async def update_status(self, status: str):
|
||||||
assert status in [self.STATUS_RUNNING, self.STATUS_STOPPED, self.STATUS_FINISHED]
|
assert status in [self.STATUS_RUNNING, self.STATUS_STOPPED, self.STATUS_FINISHED]
|
||||||
self._status = status
|
self._status = status
|
||||||
|
|
Loading…
Add table
Reference in a new issue