Merge branch 'jogobot-StatusAPI' into test-v6
This commit is contained in:
@@ -62,3 +62,5 @@ target/
|
||||
|
||||
# Test
|
||||
test.py
|
||||
|
||||
disabled
|
||||
|
||||
+28
-12
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# chartsbot.py
|
||||
# charts.py
|
||||
#
|
||||
# original version by:
|
||||
#
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# modified by:
|
||||
#
|
||||
# Copyright 2015 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
||||
# Copyright 2016 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -46,6 +46,8 @@ The following parameters are supported:
|
||||
|
||||
|
||||
import locale
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pywikibot
|
||||
from pywikibot import pagegenerators
|
||||
@@ -99,14 +101,6 @@ class ChartsBot( ):
|
||||
# Set locale to 'de_DE.UTF-8'
|
||||
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
|
||||
|
||||
# provisional-onwiki-activation
|
||||
page_active = pywikibot.Page( self.site, "Benutzer:JogoBot/active" )
|
||||
text_active = page_active.get()
|
||||
|
||||
if "true" not in text_active.lower():
|
||||
pywikibot.output( "Bot ist deaktiviert!" )
|
||||
return False
|
||||
|
||||
def run(self):
|
||||
"""Process each page from the generator."""
|
||||
for page in self.generator:
|
||||
@@ -199,6 +193,27 @@ def main(*args):
|
||||
@param args: command line arguments
|
||||
@type args: list of unicode
|
||||
"""
|
||||
|
||||
# Get the jogobot-task_slug (basename of current file without ending)
|
||||
task_slug = os.path.basename(__file__)[:-len(".py")]
|
||||
|
||||
# Before run, we need to check wether we are currently active or not
|
||||
try:
|
||||
# Will throw Exception if disabled/blocked
|
||||
jogobot.is_active( task_slug )
|
||||
|
||||
except jogobot.jogobot.Blocked:
|
||||
(type, value, traceback) = sys.exc_info()
|
||||
jogobot.output( "\03{lightpurple} %s (%s)" % (value, type ),
|
||||
"CRITICAL" )
|
||||
|
||||
except jogobot.jogobot.Disabled:
|
||||
(type, value, traceback) = sys.exc_info()
|
||||
jogobot.output( "\03{red} %s (%s)" % (value, type ),
|
||||
"ERROR" )
|
||||
|
||||
# Bot/Task is active
|
||||
else:
|
||||
# Process global arguments to determine desired site
|
||||
local_args = pywikibot.handle_args(args)
|
||||
|
||||
@@ -212,8 +227,8 @@ def main(*args):
|
||||
# If always is True, bot won't ask for confirmation of edit (automode)
|
||||
always = False
|
||||
|
||||
# If force_reload is True, bot will always parse Countrylist regardless of
|
||||
# parsing is needed or not
|
||||
# If force_reload is True, bot will always parse Countrylist regardless
|
||||
# if parsing is needed or not
|
||||
force_reload = False
|
||||
|
||||
# Parse command line arguments
|
||||
@@ -223,6 +238,7 @@ def main(*args):
|
||||
elif arg.startswith("-force-reload"):
|
||||
force_reload = True
|
||||
else:
|
||||
pass
|
||||
genFactory.handleArg(arg)
|
||||
|
||||
if not gen:
|
||||
+1
-1
Submodule jogobot updated: 0daf72b625...b0c844b2de
Reference in New Issue
Block a user