fix some smaller stuff
- remove support for old windows config paths - catch exception if cache-database can't be opened - fix username/password settings for unit tests - rename variable 'max_tries' to 'retries'
This commit is contained in:
@@ -213,6 +213,6 @@ memcache = build_cache_decorator(MEMCACHE)
|
||||
try:
|
||||
DBCACHE = DatabaseCache()
|
||||
cache = build_cache_decorator(MEMCACHE, DBCACHE)
|
||||
except RuntimeError():
|
||||
except (RuntimeError, sqlite3.OperationalError):
|
||||
DBCACHE = None
|
||||
cache = memcache
|
||||
|
||||
@@ -23,9 +23,7 @@ _config = {}
|
||||
|
||||
if os.name == "nt":
|
||||
_default_configs = [
|
||||
r"~\.config\gallery-dl\config.json",
|
||||
r"%USERPROFILE%\gallery-dl\config.json",
|
||||
r"~\.gallery-dl.conf",
|
||||
r"%USERPROFILE%\gallery-dl.conf",
|
||||
]
|
||||
else:
|
||||
|
||||
@@ -18,7 +18,7 @@ from .. import config
|
||||
|
||||
class Downloader(BasicDownloader):
|
||||
|
||||
max_tries = config.interpolate(("downloader", "http", "retries",), 5)
|
||||
retries = config.interpolate(("downloader", "http", "retries",), 5)
|
||||
timeout = config.interpolate(("downloader", "http", "timeout",), None)
|
||||
|
||||
def __init__(self, output):
|
||||
@@ -32,8 +32,8 @@ class Downloader(BasicDownloader):
|
||||
while True:
|
||||
tries += 1
|
||||
if tries > 1:
|
||||
self.out.error(pathfmt.path, msg, tries-1, self.max_tries)
|
||||
if tries > self.max_tries:
|
||||
self.out.error(pathfmt.path, msg, tries-1, self.retries)
|
||||
if tries > self.retries:
|
||||
return
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ class TestExtractors(unittest.TestCase):
|
||||
name = "gallerydl"
|
||||
email = "gallerydl@openaliasbox.org"
|
||||
config.set(("cache", "file"), ":memory:")
|
||||
config.set(("username",), name)
|
||||
config.set(("password",), name)
|
||||
config.set(("extractor", "username"), name)
|
||||
config.set(("extractor", "password"), name)
|
||||
config.set(("extractor", "nijie", "username"), email)
|
||||
config.set(("extractor", "seiga", "username"), email)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user