Revision: 5830
Author: multichill
Date: 2008-08-21 19:49:47 +0000 (Thu, 21 Aug 2008)
Log Message:
-----------
category_blacklist at
http://commons.wikimedia.org/wiki/User:Multichill/Category_blacklist
Modified Paths:
--------------
trunk/pywikipedia/imagerecat.py
Modified: trunk/pywikipedia/imagerecat.py
===================================================================
--- trunk/pywikipedia/imagerecat.py 2008-08-21 16:06:39 UTC (rev 5829)
+++ trunk/pywikipedia/imagerecat.py 2008-08-21 19:49:47 UTC (rev 5830)
@@ -20,20 +20,24 @@
import pagegenerators, StringIO
import socket
-category_blacklist = [u'Hidden categories',
- u'Stub pictures']
-
+category_blacklist = []
countries = []
-def getCountries():
+def initLists():
'''
- Get the list of countries from Commons.
+ Get the list of countries & the blacklist from Commons.
'''
- result = []
+ global category_blacklist
+ global countries
+
+ blacklistPage = wikipedia.Page(wikipedia.getSite(),
u'User:Multichill/Category_blacklist')
+ for cat in blacklistPage.linkedPages():
+ category_blacklist.append(cat.titleWithoutNamespace())
+
countryPage = wikipedia.Page(wikipedia.getSite(),
u'User:Multichill/Countries')
for country in countryPage.linkedPages():
- result.append(country.titleWithoutNamespace())
- return result
+ countries.append(country.titleWithoutNamespace())
+ return
def categorizeImages(generator, onlyfilter):
'''
@@ -241,8 +245,8 @@
generator = genFactory.handleArg(arg)
if not generator:
generator = pagegenerators.CategorizedPageGenerator(catlib.Category(site,
u'Category:Media needing categories'), recurse=True)
- global countries
- countries = getCountries()
+
+ initLists()
categorizeImages(generator, onlyfilter)
wikipedia.output(u'All done')