Revision: 5190
Author: avar
Date: 2008-04-07 16:44:11 +0000 (Mon, 07 Apr 2008)
Log Message:
-----------
Implemneted a -new option that uses the NewpagesPageGenerator to
iterate over the newest pages on the wiki. Useful for having the
interwiki bot (on a small wiki) go over the N latest pages every X
hours.
Modified Paths:
--------------
trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py 2008-04-07 12:28:23 UTC (rev 5189)
+++ trunk/pywikipedia/interwiki.py 2008-04-07 16:44:11 UTC (rev 5190)
@@ -29,6 +29,11 @@
This implies -noredirect.
+ -new: Work on the 100 newest pages. If given as -new:x, will work
+ on the x newest pages.
+
+ This implies -noredirect.
+
-restore: restore a set of "dumped" pages the robot was working on
when it terminated.
@@ -1598,6 +1603,13 @@
else:
startMonth = 1
hintlessPageGen = pagegenerators.DayPageGenerator(startMonth)
+ elif arg.startswith('-new'):
+ if len(arg) > 5 and arg[4] == ':' and arg[5:].isdigit():
+ # Looks as if the user gave a specific number of pages
+ newPages = int(arg[5:])
+ else:
+ newPages = 100
+ hintlessPageGen = pagegenerators.NewpagesPageGenerator(newPages)
elif arg.startswith('-skipfile:'):
skipfile = arg[10:]
skipPageGen = pagegenerators.TextfilePageGenerator(skipfile)
Show replies by date