示例#1
0
 def get_mpd(self):
     logger.debug("Start dowlnoading MPD: {}".format(self.mpd_path))
     # Adjust the timestamp. In order to prevent time shift due to the processing time in callbacks,
     # keep last_update time to be exactly aligned to the next segment start
     if self.last_update is None or self.mpd_int is None:
         self.last_update = datetime.now()
     else:
         self.last_update = self.last_update + timedelta(seconds=self.mpd_int.segmentDuration)
     # trigger async download
     d = getResource(self.mpd_path)
     d.addCallbacks(self.on_mpd, self.on_mpd_error)
示例#2
0
 def __init__(self, path, sink, file_list):
     self.path = path
     self.sink = sink
     self.count = len(file_list)
     self.error_count = 0
     self.downloaded_list = []
     logger.debug("Initiate group downloading: %s files", len(file_list))
     for filename in file_list:
         url = urljoin(self.path, filename)
         logger.debug("Start downloading segments: %s", url)
         d = getResource(url)
         d.addCallbacks(partial(self.on_download, filename), partial(self.on_err, filename))