forked from Tribler/tribler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_seeding_vod.py
39 lines (29 loc) · 1.2 KB
/
test_seeding_vod.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Written by Arno Bakker, heavily modified by Niels Zeilemaker
# see LICENSE.txt for license information
import sys
import threading
from Tribler.Test.API.test_seeding import TestSeeding
from Tribler.Core.simpledefs import dlstatus_strings, DLMODE_VOD
class TestVODSeeding(TestSeeding):
"""
Testing seeding via new tribler API:
"""
def setUp(self):
super(TestVODSeeding, self).setUp()
self.vod_event = threading.Event()
def setup_seeder(self, filename='video.avi'):
super(TestVODSeeding, self).setup_seeder(filename)
def subtest_download(self):
self.dscfg2.set_mode(DLMODE_VOD)
super(TestVODSeeding, self).subtest_download()
assert self.vod_event.wait(60)
def downloader_state_callback(self, ds):
d = ds.get_download()
self._logger.debug("download: %s %s %s %s", repr(d.get_def().get_name()),
dlstatus_strings[ds.get_status()], ds.get_progress(),
ds.get_vod_prebuffering_progress())
if ds.get_progress() > 0:
self.downloading_event.set()
if ds.get_vod_prebuffering_progress() == 1.0:
self.vod_event.set()
return 1.0, False