From 0a49b27d7f91e48d093b9aa2da6d9d11e77b9f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?GOLDERWEB=20=E2=80=93=20Jonathan=20Golder?= Date: Sat, 7 Nov 2015 16:50:26 +0100 Subject: [PATCH] Use param "-always" to run without any interactiv requests --- charts.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/charts.py b/charts.py index 0eb86a6..60a8d0a 100644 --- a/charts.py +++ b/charts.py @@ -46,7 +46,7 @@ class Charts: Class for handling chart lists """ - def __init__( self, generator, dry ): + def __init__( self, generator, always, dry ): """ Constructor. @@ -60,6 +60,7 @@ class Charts: self.generator = generator self.dry = dry + self.always = always # Set the edit summary message self.site = pywikibot.Site() @@ -119,7 +120,7 @@ class Charts: pywikibot.showDiff(page.get(), text) pywikibot.output(u'Comment: %s' % comment) if not self.dry: - if True or pywikibot.input_yn( + if self.always or pywikibot.input_yn( u'Do you want to accept these changes?', default=False, automatic_quit=False): try: @@ -416,10 +417,15 @@ def main(*args): # what would have been changed. dry = False + # If always is True, bot won't ask for confirmation of edit (automode) + always = False + # Parse command line arguments for arg in local_args: if arg.startswith("-dry"): dry = True + elif arg.startswith("-always"): + always = True else: genFactory.handleArg(arg) @@ -429,7 +435,7 @@ def main(*args): # The preloading generator is responsible for downloading multiple # pages from the wiki simultaneously. gen = pagegenerators.PreloadingGenerator(gen) - bot = Charts(gen, dry) + bot = Charts(gen, always, dry) bot.run() else: pywikibot.showHelp()