add 'mtime' option
This commit is contained in:
@@ -25,6 +25,7 @@ class HttpDownloader(DownloaderBase):
|
||||
self.retries = self.config("retries", extractor._retries)
|
||||
self.timeout = self.config("timeout", extractor._timeout)
|
||||
self.verify = self.config("verify", extractor._verify)
|
||||
self.mtime = self.config("mtime", True)
|
||||
self.rate = self.config("rate")
|
||||
self.downloading = False
|
||||
self.chunk_size = 16384
|
||||
@@ -151,9 +152,10 @@ class HttpDownloader(DownloaderBase):
|
||||
self.downloading = False
|
||||
if adj_ext:
|
||||
pathfmt.set_extension(adj_ext)
|
||||
filetime = response.headers.get("Last-Modified")
|
||||
if filetime:
|
||||
pathfmt.keywords["_filetime"] = filetime
|
||||
if self.mtime:
|
||||
filetime = response.headers.get("Last-Modified")
|
||||
if filetime:
|
||||
pathfmt.keywords["_filetime"] = filetime
|
||||
return True
|
||||
|
||||
def receive(self, response, file):
|
||||
|
||||
@@ -27,6 +27,7 @@ class YoutubeDLDownloader(DownloaderBase):
|
||||
"socket_timeout": self.config("timeout", extractor._timeout),
|
||||
"nocheckcertificate": not self.config("verify", extractor._verify),
|
||||
"nopart": not self.part,
|
||||
"updatetime": self.config("mtime", True),
|
||||
}
|
||||
options.update(self.config("raw-options") or {})
|
||||
|
||||
|
||||
@@ -182,6 +182,12 @@ def build_parser():
|
||||
dest="part", nargs=0, action=ConfigConstAction, const=False,
|
||||
help="Do not use .part files",
|
||||
)
|
||||
downloader.add_argument(
|
||||
"--no-mtime",
|
||||
dest="mtime", nargs=0, action=ConfigConstAction, const=False,
|
||||
help=("Do not set file modification times according to "
|
||||
"Last-Modified HTTP response headers")
|
||||
)
|
||||
downloader.add_argument(
|
||||
"--no-check-certificate",
|
||||
dest="verify", nargs=0, action=ConfigConstAction, const=False,
|
||||
|
||||
Reference in New Issue
Block a user