mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
add 'mtime' option
This commit is contained in:
parent
ee4d7c3d89
commit
db3f52881a
@ -945,6 +945,16 @@ Description Enable/Disable this downloader module.
|
||||
=========== =====
|
||||
|
||||
|
||||
downloader.*.mtime
|
||||
------------------
|
||||
=========== =====
|
||||
Type ``bool``
|
||||
Default ``true``
|
||||
Description Use |Last-Modified|_ HTTP response headers
|
||||
to set file modification times.
|
||||
=========== =====
|
||||
|
||||
|
||||
downloader.*.part
|
||||
-----------------
|
||||
=========== =====
|
||||
@ -1589,6 +1599,7 @@ Description An object with the ``name`` of a post-processor and its options.
|
||||
.. |webbrowser.open()| replace:: ``webbrowser.open()``
|
||||
.. |datetime.max| replace:: ``datetime.max``
|
||||
.. |Path| replace:: ``Path``
|
||||
.. |Last-Modified| replace:: ``Last-Modified``
|
||||
.. |Logging Configuration| replace:: ``Logging Configuration``
|
||||
.. |Postprocessor Configuration| replace:: ``Postprocessor Configuration``
|
||||
.. |strptime| replace:: strftime() and strptime() Behavior
|
||||
@ -1604,6 +1615,7 @@ Description An object with the ``name`` of a post-processor and its options.
|
||||
.. _requests.request(): https://docs.python-requests.org/en/master/api/#requests.request
|
||||
.. _timeout: https://docs.python-requests.org/en/latest/user/advanced/#timeouts
|
||||
.. _verify: https://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
|
||||
.. _Last-Modified: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29
|
||||
.. _`Requests' proxy documentation`: http://docs.python-requests.org/en/master/user/advanced/#proxies
|
||||
.. _format string: https://docs.python.org/3/library/string.html#formatstrings
|
||||
.. _format strings: https://docs.python.org/3/library/string.html#formatstrings
|
||||
|
@ -152,6 +152,17 @@
|
||||
|
||||
"http":
|
||||
{
|
||||
"mtime": true,
|
||||
"rate": null,
|
||||
"retries": 5,
|
||||
"timeout": 30.0,
|
||||
"verify": true
|
||||
},
|
||||
|
||||
"ytdl":
|
||||
{
|
||||
"format": null,
|
||||
"mtime": true,
|
||||
"rate": null,
|
||||
"retries": 5,
|
||||
"timeout": 30.0,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user