delay enabling .part files when 'http-metadata' is set
otherwise 'build_path' gets called before all metadata is collected
This commit is contained in:
@@ -91,11 +91,12 @@ class HttpDownloader(DownloaderBase):
|
|||||||
tries = 0
|
tries = 0
|
||||||
msg = ""
|
msg = ""
|
||||||
|
|
||||||
|
metadata = self.metadata
|
||||||
kwdict = pathfmt.kwdict
|
kwdict = pathfmt.kwdict
|
||||||
adjust_extension = kwdict.get(
|
adjust_extension = kwdict.get(
|
||||||
"_http_adjust_extension", self.adjust_extension)
|
"_http_adjust_extension", self.adjust_extension)
|
||||||
|
|
||||||
if self.part:
|
if self.part and not metadata:
|
||||||
pathfmt.part_enable(self.partdir)
|
pathfmt.part_enable(self.partdir)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@@ -194,15 +195,19 @@ class HttpDownloader(DownloaderBase):
|
|||||||
build_path = True
|
build_path = True
|
||||||
|
|
||||||
# set metadata from HTTP headers
|
# set metadata from HTTP headers
|
||||||
if self.metadata:
|
if metadata:
|
||||||
kwdict[self.metadata] = util.extract_headers(response)
|
kwdict[metadata] = util.extract_headers(response)
|
||||||
build_path = True
|
build_path = True
|
||||||
|
|
||||||
|
# build and check file path
|
||||||
if build_path:
|
if build_path:
|
||||||
pathfmt.build_path()
|
pathfmt.build_path()
|
||||||
if pathfmt.exists():
|
if pathfmt.exists():
|
||||||
pathfmt.temppath = ""
|
pathfmt.temppath = ""
|
||||||
return True
|
return True
|
||||||
|
if self.part and metadata:
|
||||||
|
pathfmt.part_enable(self.partdir)
|
||||||
|
metadata = False
|
||||||
|
|
||||||
content = response.iter_content(self.chunk_size)
|
content = response.iter_content(self.chunk_size)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user