import os
import xml.etree.ElementTree as ET

def main():
    corpus = "<teiCorpus></teiCorpus>"
    corpusTree = ET.parse(corpus)
    corpusRoot = ET.fromstring(corpus)
    path = "/home/spassova/BGCorpusExamples/"
    files = os.listdir(path)
    for j in range(len(files)):
        processing(path + files[j]) 

    ET.indent(corpusTree, "  ")
    corpusTree.write(f"{j:02}" + "_" + "output.xml", encoding="utf-8", xml_declaration=True, method="xml", short_empty_elements=True)
    

def processing(file):
# Parse tree and get root
    tree = ET.parse(file)
    root = tree.getroot()
# Store metadata and texts in lists
    titles = root.findall(".//*[@type='title']")
    domains = root.findall(".//*[@type='domain']")
    pageURLs = root.findall(".//*[@type='pageURL']")
    ids = root.findall(".//*[@type='id']")
    mainImageURLs = root.findall(".//*[@type='mainImageURL']")
    mainImageTexts = root.findall(".//*[@type='mainImageTexts']")
    mainImageSources = root.findall(".//*[@type='mainImageSources']")
    authors = root.findall(".//*[@type='authors']")
    authorURLs = root.findall(".//*[@type='authorURLs']")
    categories = root.findall(".//*[@type='category']")
    subCategories = root.findall(".//*[@type='subCategory']")
    tags = root.findall(".//*[@type='tags']")
    datesPublished = root.findall(".//*[@type='datePublished']")
    timesPublished = root.findall(".//*[@type='timePublished']")
    datesModified = root.findall(".//*[@type='dateModified']")
    timesModified = root.findall(".//*[@type='timeModified']")
    mainImageWidths = root.findall(".//*[@type='mainImageWidth']")
    mainImageHeights = root.findall(".//*[@type='mainImageHeight']")
    mainImageThumbnailURLs = root.findall(".//*[@type='mainImageThumbnailURL']")
    texts = []
# Count text elements and remove metadata
    number_of_texts = 0
    for text in root.iter("{http://www.tei-c.org/ns/1.0}text"):
        number_of_texts+=1
        for body in text:
            for div1 in body:
                for div2 in div1:
                    for div3 in div2:
                        if div3.get('type') == "metadata":
                            div2.remove(div3)

                        texts.append(div2)
# Remove all elements from root
    for elem in root.findall("*"):
        root.remove(elem)
# Rename root
    root.tag = "teiDoc"
# Create i5 structure
    for i in range(number_of_texts):
        tei = ET.SubElement(root, "TEI")
        teiHeader = ET.SubElement(tei, "teiHeader")
        fileDesc = ET.SubElement(teiHeader, "fileDesc")
        titleStmt = ET.SubElement(fileDesc, "titleStmt")
        textSigle = ET.SubElement(titleStmt, "textSigle")
        textSigle.text = "BNC/" + f"{j:02}" + "." + f"{i:05}"
        sourceDesc = ET.SubElement(fileDesc, "sourceDesc")
        analytic = ET.SubElement(sourceDesc, "analytic")
        htitle = ET.SubElement(analytic, "h.title")
        htitle.text = titles[i].text
        hauthor = ET.SubElement(analytic, "h.author")
        hauthor.text = authors[i].text
        imprint = ET.SubElement(sourceDesc, "imprint")
        pubDateYear = ET.SubElement(imprint, "pubDate")
        pubDateYear.set("type", "year")
        pubDateYear.text = datesPublished[i].text[0:4]
        pubDateMonth = ET.SubElement(imprint, "pubDate")
        pubDateMonth.set("type", "month")
        pubDateMonth.text = datesPublished[i].text[5:7]
        pubDateDay = ET.SubElement(imprint, "pubDate")
        pubDateDay.set("type", "day")
        pubDateDay.text = datesPublished[i].text[8:10]
        pubDateTime = ET.SubElement(imprint, "pubDate")
        pubDateTime.set("type", "time")
        pubDateTime.text = timesPublished[i].text
        pubPlace = ET.SubElement(imprint, "pubPlace")
        ref = ET.SubElement(pubPlace, "ref")
        ref.set("type", "page_url")
        ref.set("target", pageURLs[i].text)
        text = ET.SubElement(tei, "text")
        body = ET.SubElement(text, "body")
        for p in texts[i]:
            body.append(p)


    corpusRoot.append(root)    
    ET.register_namespace("", "http://www.tei-c.org/ns/1.0")

    return 
    

