Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: add initial support for streaming torrent files #3657

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6378462
locate stream for streaming API by identifier
shyba Sep 1, 2022
8212e73
stream torrent from file
shyba Sep 1, 2022
7828041
stream type independent stream_url
shyba Sep 1, 2022
8ee5cee
update flags, set sequential as a flag
shyba Sep 5, 2022
6efd4dd
fix save path, fix prio, update deprecated calls
shyba Sep 5, 2022
b3bff39
stream from torrent pieces, holding the response until the piece is c…
shyba Sep 5, 2022
b2f8207
piece prioritization and deadlines
shyba Sep 7, 2022
df680e7
fix tests and off by one error
shyba Sep 9, 2022
7410991
save resume data on stop, remove/replace deprecated calls
shyba Sep 9, 2022
dd103d0
save file-torrent association for file list
shyba Sep 16, 2022
7746ded
add test case for restart, fix torrent file update
shyba Sep 16, 2022
37adc59
add tests for streaming, fix bugs
shyba Sep 23, 2022
7c7e185
refactor add_torrent, lints
shyba Sep 23, 2022
f650e8f
test and bugfixes for streaming multifile in a subfolder case
shyba Sep 29, 2022
e862c99
generate 3 files, check that streamed is the largest, add method to l…
shyba Sep 29, 2022
c8f2502
start the stream after adding
shyba Sep 30, 2022
af0ad41
generalize DownloadSDTimeout to DownloadMetadata timeout + fix usages
shyba Oct 12, 2022
b39971b
fix tests for changed error msg
shyba Oct 12, 2022
77d2c81
fix missing added_on for torrent files
shyba Oct 27, 2022
2bf0ca6
fix mime_type for torrent on json encoder
shyba Oct 27, 2022
732b7e7
fix suggested_file_name for torrent on json encoder
shyba Oct 27, 2022
31c6e0e
fix stream_name for torrent on json encoder
shyba Oct 27, 2022
651348f
fix status for completed torrents
shyba Oct 28, 2022
1041a19
deserialize torrent fields properly
shyba Oct 28, 2022
39da718
remove dead code
shyba Oct 28, 2022
8ce5306
fix filtering for fields missing on torrents
shyba Oct 28, 2022
2bea8f5
fix duplicated file entry on startup
shyba Oct 28, 2022
9dc617f
use a non-default port for streaming test so it can run with a live i…
shyba Oct 28, 2022
5cf63fa
restore torrent rowid on restart
shyba Nov 1, 2022
9d86982
test picking file from claim file name
shyba Nov 5, 2022
64aad14
pick file from file name, fallback to largest
shyba Nov 5, 2022
636b7ed
tests: enable logging lbry.torrent when verbosity changes
shyba Nov 5, 2022
dbe3ace
pylint
shyba Dec 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests for changed error msg
  • Loading branch information
shyba committed Dec 15, 2022
commit b39971bf05240409842b61bdd5e287156c24c425
4 changes: 2 additions & 2 deletions tests/integration/datanetwork/test_file_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ async def test_download_different_timeouts(self):
await self.server.blob_manager.delete_blobs(all_except_sd)
resp = await self.daemon.jsonrpc_get('lbry://foo', timeout=2, save_file=True)
self.assertIn('error', resp)
self.assertEqual('Failed to download data blobs for sd hash %s within timeout.' % sd_hash, resp['error'])
self.assertEqual('Failed to download data blobs for %s within timeout.' % sd_hash, resp['error'])
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='foo'), "data timeout didn't create a file")
await self.server.blob_manager.delete_blobs([sd_hash])
resp = await self.daemon.jsonrpc_get('lbry://foo', timeout=2, save_file=True)
self.assertIn('error', resp)
self.assertEqual('Failed to download sd blob %s within timeout.' % sd_hash, resp['error'])
self.assertEqual('Failed to download metadata for %s within timeout.' % sd_hash, resp['error'])

async def wait_files_to_complete(self):
while await self.file_list(status='running'):
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/stream/test_stream_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def check_post(event):
self.assertFalse(event['properties']['added_fixed_peers'])
self.assertEqual(event['properties']['connection_failures_count'], 1)
self.assertEqual(
event['properties']['error_message'], f'Failed to download sd blob {self.sd_hash} within timeout.'
event['properties']['error_message'], f'Failed to download metadata for {self.sd_hash} within timeout.'
)

await self._test_time_to_first_bytes(check_post, DownloadMetadataTimeoutError, after_setup=after_setup)
Expand Down Expand Up @@ -273,7 +273,7 @@ def check_post(event):
self.assertFalse(event['properties']['added_fixed_peers'])
self.assertIsNone(event['properties']['fixed_peer_delay'])
self.assertEqual(
event['properties']['error_message'], f'Failed to download sd blob {self.sd_hash} within timeout.'
event['properties']['error_message'], f'Failed to download metadata for {self.sd_hash} within timeout.'
)

start = self.loop.time()
Expand Down Expand Up @@ -387,7 +387,7 @@ async def test_download_sd_timeout(self):
self.server.stop_server()
await self.setup_stream_manager()
await self._test_download_error_analytics_on_start(
DownloadMetadataTimeoutError, f'Failed to download sd blob {self.sd_hash} within timeout.', timeout=1
DownloadMetadataTimeoutError, f'Failed to download metadata for {self.sd_hash} within timeout.', timeout=1
)

async def test_download_data_timeout(self):
Expand All @@ -396,7 +396,7 @@ async def test_download_data_timeout(self):
head_blob_hash = json.loads(sdf.read())['blobs'][0]['blob_hash']
self.server_blob_manager.delete_blob(head_blob_hash)
await self._test_download_error_analytics_on_start(
DownloadDataTimeoutError, f'Failed to download data blobs for sd hash {self.sd_hash} within timeout.', timeout=1
DownloadDataTimeoutError, f'Failed to download data blobs for {self.sd_hash} within timeout.', timeout=1
)

async def test_unexpected_error(self):
Expand Down