コード例 #1
0
ファイル: autoCategory.py プロジェクト: nullzero/wprobot
def main():
    title = u"ผู้ใช้:Nullzerobot/บริการจัดหมวดหมู่/หมวดหมู่ที่รอการจัด"
    confpage = u"ผู้ใช้:Nullzerobot/บริการจัดหมวดหมู่/"
    header, table, disable = lservice.service(
        page=wp.Page(title),
        confpage=wp.Page(confpage),
        operation="major",
        verify=lambda x: True,
        summary=summaryWithTime,
        # debug=True,
    )

    for line in table:
        try:
            doall(lre.pats["name"].find(line[1], 1), lre.pats["name"].find(line[2], 1))
        except:
            wp.error()
コード例 #2
0
ファイル: moveCategory.py プロジェクト: nullzero/wprobot
def main():
    """Main function"""
    if wp.handlearg("pending", args):
        pywikibot.output("move pending entry")
        title = conf.pageMinor
        operation = "minor"
    else:
        title = conf.pageMajor
        operation = "major"

    header, table, disable = lservice.service(page=wp.Page(title),
                                              confpage=wp.Page(conf.datwiki),
                                              operation=operation,
                                              verify=verify,
                                              summary=summaryWithTime,
                                              #debug=True,
                                              )

    report = []
    pending = []

    for i, line in enumerate(table):
        putline = "|-\n| " + " || ".join(line)
        if (operation == "minor") or (not disable[i]):
            templateStat = conf.notDoneTemplate

            try:
                domove(lre.pats["name"].find(line[1], 1),
                       lre.pats["name"].find(line[2], 1))
            except:
                wp.error()
            else:
                templateStat = conf.doneTemplate

            putline += " || %s %s" % (templateStat, wp.getTime())
            report.append(putline)
        else:
            pending.append(putline)

    appendTable(conf.pageReport, report)
    appendTable(conf.pageMinor, pending)