User:Fetofs/aicarchive.py


 * 1) aicarchive.py
 * 2) Archives an AfC page on the current day page

from wikipedia import * import time

currenttime = time.gmtime(time.time) times = map(str, currenttime)

def add0(string): if len(string) == 1: return '0' + string else: return string

day = add0(times[2]) month = add0(times[1]) hour = add0(times[3]) minute = add0(times[4])

year = times[0]

archivepage = 'Wikipedia:Articles for creation/%s-%s-%s' % (year, month, day) Today = 'Wikipedia:Articles for creation/Today'

Movelink = 'http://en.wikipedia.org/w/index.php?title=Special:Movepage&wpOldTitle=' + Today + '&wpNewTitle=' + archivepage + '&wpReason=Archiving%20WP:AFC%20page'

print 'Follow the following link:' print print Movelink print raw_input("Once you're done, type any key")

Today = Page('en', 'Wikipedia:Articles for creation/Today') setAction('Replacing redirect with generic header') Today.put('Please now follow the link back to Articles for creation.')
 * 1) step 2; replacing with generic header

List = Page('en', 'Wikipedia:Articles for creation/List') Listtext = Page.get(List)
 * 1) step 3; adding archive to List

if Listtext[41:43] != month: print 'REMINDER: different months detected. Month archival is likely to be possible!'

newtext = '* ' + archivepage + ' &mdash; Archive made at' + hour + minute + ' UTC on ' + year + '-' + month + '-' + day + '\n' + Listtext setAction('Listing archive page') List.put(newtext)