summaryrefslogtreecommitdiff
path: root/helpcontent2/to-wiki/convall.py
blob: afc510e3dcdadaf2895d62e6f447a6448d3acd2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python

import os, sys

titles = [[]]

def loadallfiles(filename):
    global titles
    file=open(filename,"r")
    for line in file:
        title = line.split(";", 2)
        titles.append(title)

loadallfiles("alltitles.csv")

for title in titles:
    command = ""
    outfile = ""
    infile  = ""
    if len(title) > 1:
        outfile = "wiki/"+title[1].strip()
        infile  = title[0].strip()
        command = "python to-wiki/wikiconv2.py "+infile+" "+title[1].strip()+" > "+outfile

    try:
        file = open(outfile,"r")
    except:
        #print "Processing: "+infile
        if os.system(command) != 0:
            print "Failed: "+command
            sys.exit(1)
        continue
    print "Warning: Skipping: "+command
    file.close()
    sys.exit(1)