diff options
Diffstat (limited to 'gallery_dl/extractor/oauth.py')
| -rw-r--r-- | gallery_dl/extractor/oauth.py | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/gallery_dl/extractor/oauth.py b/gallery_dl/extractor/oauth.py index c07c4b7..6d7b27a 100644 --- a/gallery_dl/extractor/oauth.py +++ b/gallery_dl/extractor/oauth.py @@ -180,16 +180,11 @@ class OAuthBase(Extractor): self.send(msg) def _generate_message(self, names, values): - if len(names) == 1: - _vh = "This value has" - _is = "is" - _it = "it" - _va = "this value" - else: - _vh = "These values have" - _is = "are" - _it = "them" - _va = "these values" + _vh, _va, _is, _it = ( + ("This value has", "this value", "is", "it") + if len(names) == 1 else + ("These values have", "these values", "are", "them") + ) msg = "\nYour {} {}\n\n{}\n\n".format( " and ".join("'" + n + "'" for n in names), @@ -197,23 +192,21 @@ class OAuthBase(Extractor): "\n".join(values), ) - if self.cache: - opt = self.oauth_config(names[0]) - if opt is None or opt == "cache": - msg += _vh + " been cached and will automatically be used." - else: - msg += ( - "Set 'extractor.{}.{}' to \"cache\" to use {}.".format( - self.subcategory, names[0], _it, - ) - ) + opt = self.oauth_config(names[0]) + if self.cache and (opt is None or opt == "cache"): + msg += _vh + " been cached and will automatically be used." else: msg += "Put " + _va + " into your configuration file as \n" msg += " and\n".join( "'extractor." + self.subcategory + "." + n + "'" for n in names ) - msg += "." + if self.cache: + msg += ( + "\nor set\n'extractor.{}.{}' to \"cache\"" + .format(self.subcategory, names[0]) + ) + msg += "\nto use {}.".format(_it) return msg |
