From Wikipedia, the free encyclopedia
import re
import subprocess
rawfilename="00CFDmoves.txt"
fi=open(rawfilename,'r')
regex=re.compile(r".*[Cc]ategory:(?P<oldcat>.*) to [Cc]ategory:(?P<newcat>.*)$")
cfdregex=re.compile(r".*Wikipedia:Categories for discussion/Log/(?P<dat>.*)$")
#CFDbase="-summary:\"Wikipedia:Categories for deletion/Working\": "
CFDbase="-summary:\"CFD Speedy moves\": "
for line in fi:
cfdd=cfdregex.findall(line)
if cfdd:
print
CFDbase="-summary:\"Wikipedia:Categories for discussion/Log/"+cfdd[0]+"\""
print "******* SETTING CFD page to: Wikipedia:Categories for deletion/Log/" + cfdd[0]
print
print
m=regex.findall(line)
if m:
oldcat= m[0][0]
newcat =m[0][1]
print "MOVING <"+oldcat+"> -> <"+newcat+">"
fromarg="-from:"+str(oldcat)
toarg="-to:"+str(newcat)
summary = CFDbase + ":" + oldcat +" -> " + newcat
l=["python","category.py","-putthrottle:2", "-batch",summary, "move", fromarg, toarg]
subprocess.call(l)
fromarg2=fromarg.replace(" ","_")
l=["python","category.py", "-putthrottle:2","-batch", summary, "move", fromarg2, toarg]
subprocess.call(l)
fi.close()