示例#1
0
def main():
	files = []
	temp  = []

	temp = os.listdir(os.getcwd())

	for f in temp:
		if os.path.isfile(f):
			f = FileName(f)
			if f.getFileExt() in '.gmx':
				files.append(f)
				#print(f.getName())

	for f in files:
		tree = ET.parse(f.getName())
		root = tree.getroot()
		orig = root.find('origname')
		strg = orig.text
		pos = 0
		for i  in range(1, len(strg)):
			if strg[-i] == '\\':
				pos = i
				break
		if pos != 0:
			strg = strg[-pos:]
		strg = strCheck(strg, f)
		orig.text = strg
		tree.write(f.getName())
示例#2
0
def main():
    audioFiles = []
    audioDirs = []
    temp = []

    temp = os.listdir(os.getcwd())

    for f in temp:
        f = FileName(f)
        if f.getFileExt() == ".gmx":
            audioDirs.append(f)

    newDir = os.getcwd() + os.sep + "audio"

    if os.path.isdir(newDir):
        audioFiles = os.listdir(newDir)
    else:
        print(newDir + " Does not exist program will now die")
        sys.exit()

    temp = []
    for i in audioDirs:
        temp.append(i)
    audioDirs = []

    for i in temp:
        audioDirs.append(SoundFile(i))

    for i in audioDirs:
        i.addTree(ET.parse(i.fileName.getName()))
        i.orig = i.root.find("origname")
        i.fileDir = i.orig.text

    notFound = []
    for i in audioDirs:
        found = False
        for j in audioFiles:
            if i.fileDir == j:
                found = True
        if not found:
            notFound.append(i)

    for i in notFound:
        print(i.fileName.getName())
        print(i.fileDir)
        print("===")