From d5ae56bd241225eb9f483f9abb6381838c8901ec Mon Sep 17 00:00:00 2001 From: emijrp Date: Mon, 6 Aug 2012 15:57:11 +0000 Subject: [PATCH] uploader git-svn-id: https://wikiteam.googlecode.com/svn/trunk@745 31edc4fc-5e31-b4c4-d58b-c8bc928bcb95 --- uploader.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/uploader.py b/uploader.py index 33eb90c..ad904e3 100644 --- a/uploader.py +++ b/uploader.py @@ -30,14 +30,20 @@ import urllib2 import dumpgenerator -listfile = sys.argv[1] - # Configuration goes here # You need a file named keys.txt with access and secret keys, in two different lines accesskey = open('keys.txt', 'r').readlines()[0].strip() secretkey = open('keys.txt', 'r').readlines()[1].strip() collection = 'wikiteam' # Replace with "opensource" if you are not an admin of the collection +listfile = sys.argv[1] +uploadeddumps = [] +try: + uploadeddumps = [l.split(';')[1] for l in open('uploader-%s.log' % (listfile), 'r').read().strip().splitlines()] +except: + pass +print '%d dumps uploaded previously' % (len(uploadeddumps)) + # Nothing to change below def log(wiki, dump, msg): f = open('uploader-%s.log' % (listfile), 'a') @@ -63,6 +69,10 @@ def upload(wikis): c = 0 for dump in dumps: + if dump in uploadeddumps: + print '%s was uploaded before, skiping...' % (dump) + continue + time.sleep(0.1) wikidate = dump.split('-')[1] wikidate_text = wikidate[0:4]+'-'+wikidate[4:6]+'-'+wikidate[6:8] @@ -173,6 +183,7 @@ def upload(wikis): curlline = ' '.join(curl) os.system(curlline) c += 1 + uploadeddumps.append(dump) log(wiki, dump, 'ok') def main():