Merge pull request #2127 from lbryio/add-streaming-url

add `streaming_url` field to `File` api response type
This commit is contained in:
Jack Robison 2019-05-13 21:05:52 -04:00 committed by GitHub
commit 46ee65c8f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -67,6 +67,7 @@ def encode_account_doc():
def encode_file_doc():
return {
'streaming_url': '(str) url to stream the file using range requests',
'completed': '(bool) true if download is completed',
'file_name': '(str) name of file',
'download_directory': '(str) download directory',

View file

@ -213,6 +213,7 @@ class ManagedStream:
download_directory = None
written_bytes = None
return {
'streaming_url': f"http://{self.config.api_host}:{self.config.api_port}/stream/{self.sd_hash}",
'completed': (self.output_file_exists and self.status in ('stopped', 'finished')) or all(
self.blob_manager.is_blob_verified(b.blob_hash) for b in self.descriptor.blobs[:-1]),
'file_name': file_name,