def calc_filename(self, redirected_url): try: disposition = self.headers['content-disposition'] except KeyError: pass else: filename = self.find_value_from_header(disposition, 'filename') if filename is not None: return download_utils.clean_filename(filename) return download_utils.filename_from_url(util.unicodify(redirected_url), clean=True)
def __init__(self, url, dlid): self.dlid = dlid self.url = url self.startTime = clock() self.endTime = self.startTime self.shortFilename = filename_from_url(url) self.pick_initial_filename() self.state = u"downloading" self.currentSize = 0 self.totalSize = -1 self.shortReasonFailed = self.reasonFailed = u"No Error" self.retryTime = None self.retryCount = -1