add option to sleep before each download
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
- Added the ``-r/--limit-rate`` command-line option to set a maximum download rate
|
||||||
|
- Added the ``--sleep`` command-line option to specify the number of seconds to sleep before each download
|
||||||
|
- Updated `gelbooru` to no longer use their now disabled API
|
||||||
|
- Fixed extraction issues for `hentai2read` and `khinsider`
|
||||||
|
- Removed the deprecated `--images` and `--chapters` options
|
||||||
|
- Removed the ``mangazuki`` module
|
||||||
|
|
||||||
## 1.0.2 - 2017-11-24
|
## 1.0.2 - 2017-11-24
|
||||||
- Added an option to set a [custom user-agent string](https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#extractoruser-agent)
|
- Added an option to set a [custom user-agent string](https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#extractoruser-agent)
|
||||||
|
|||||||
@@ -270,6 +270,15 @@ Description Controls the behavior when downloading a file whose filename
|
|||||||
=========== =====
|
=========== =====
|
||||||
|
|
||||||
|
|
||||||
|
extractor.*.sleep
|
||||||
|
----------------
|
||||||
|
=========== =====
|
||||||
|
Type ``float``
|
||||||
|
Default ``0``
|
||||||
|
Description Number of seconds to sleep before each download.
|
||||||
|
=========== =====
|
||||||
|
|
||||||
|
|
||||||
extractor.*.username & .password
|
extractor.*.username & .password
|
||||||
--------------------------------
|
--------------------------------
|
||||||
=========== =====
|
=========== =====
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"base-directory": "/tmp/",
|
"base-directory": "/tmp/",
|
||||||
"netrc": false,
|
"netrc": false,
|
||||||
|
|
||||||
"downloader":
|
"downloader":
|
||||||
{
|
{
|
||||||
"part": true,
|
"part": true,
|
||||||
@@ -15,6 +16,9 @@
|
|||||||
},
|
},
|
||||||
"extractor":
|
"extractor":
|
||||||
{
|
{
|
||||||
|
"skip": true,
|
||||||
|
"sleep": 0,
|
||||||
|
|
||||||
"pixiv":
|
"pixiv":
|
||||||
{
|
{
|
||||||
"user":
|
"user":
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
import json
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
from . import extractor, downloader, config, util, output, exception
|
from . import extractor, downloader, config, util, output, exception
|
||||||
@@ -137,6 +138,7 @@ class DownloadJob(Job):
|
|||||||
def __init__(self, url, parent=None):
|
def __init__(self, url, parent=None):
|
||||||
Job.__init__(self, url, parent)
|
Job.__init__(self, url, parent)
|
||||||
self.pathfmt = util.PathFormat(self.extractor)
|
self.pathfmt = util.PathFormat(self.extractor)
|
||||||
|
self.sleep = self.extractor.config("sleep")
|
||||||
self.downloaders = {}
|
self.downloaders = {}
|
||||||
self.out = output.select()
|
self.out = output.select()
|
||||||
|
|
||||||
@@ -146,6 +148,8 @@ class DownloadJob(Job):
|
|||||||
if self.pathfmt.exists():
|
if self.pathfmt.exists():
|
||||||
self.out.skip(self.pathfmt.path)
|
self.out.skip(self.pathfmt.path)
|
||||||
return
|
return
|
||||||
|
if self.sleep:
|
||||||
|
time.sleep(self.sleep)
|
||||||
dlinstance = self.get_downloader(url)
|
dlinstance = self.get_downloader(url)
|
||||||
dlinstance.download(url, self.pathfmt)
|
dlinstance.download(url, self.pathfmt)
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,11 @@ def build_parser():
|
|||||||
metavar="SECONDS", action=ConfigAction, dest="timeout", type=float,
|
metavar="SECONDS", action=ConfigAction, dest="timeout", type=float,
|
||||||
help="Timeout for HTTP connections (defaut: 30s)",
|
help="Timeout for HTTP connections (defaut: 30s)",
|
||||||
)
|
)
|
||||||
|
downloader.add_argument(
|
||||||
|
"--sleep",
|
||||||
|
metavar="SECONDS", action=ConfigAction, dest="sleep", type=float,
|
||||||
|
help="Number of seconds to sleep before each download",
|
||||||
|
)
|
||||||
downloader.add_argument(
|
downloader.add_argument(
|
||||||
"--no-part",
|
"--no-part",
|
||||||
action=ConfigConstAction, nargs=0, dest="part", const=False,
|
action=ConfigConstAction, nargs=0, dest="part", const=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user