#! /usr/bin/python3

import xml.etree.ElementTree as ET
import os
import re
import sys

rx = "\.xml$"
path = sys.argv[1]
for r, d, fc in os.walk(path):
    files = [fx for fx in fc if re.search(rx,fx)]
    for f in files :
#        print(f)
        r = ET.parse(path+f).getroot()
#        print( r.tag, r.attrib)
        ch_uuid = ch_uuid_s =""
        ch_uuid = r.attrib['uuid'].lower()
        ch_type = r.attrib['type']
        ch_name = r.attrib['name']
        if(len(ch_uuid) == 4):
            ch_uuid_s = ch_uuid
            ch_uuid = ("0000"+ch_uuid_s+"-0000-1000-8000-00805f9b34fb")
        if(len(ch_uuid) == 36):
            ch_uuid_s = ch_uuid[4:8]

        print('"'+ch_uuid+'","'+ch_uuid_s+'","'+ch_type+'","'+ch_name+"'")
