Browse Source

remove files that we do not need

rachels 1 year ago
parent
commit
d9af68b696
3 changed files with 0 additions and 106 deletions
  1. 0 31
      tools/check_consistency.py
  2. 0 36
      tools/check_images.py
  3. 0 39
      tools/check_imageso.py

+ 0 - 31
tools/check_consistency.py

@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-# checks to make sure that mod_wlife.qproj is in sync with the location files
-
-import os
-import sys
-import re
-import io
-import xml.etree.ElementTree as ET
-import os.path
-
-# read the project xml file first
-tree = ET.parse('mod_wlife.qproj')
-root = tree.getroot()
-
-
-xml_locations = []
-os_locations = os.listdir("locations")
-
-print "Locations missing from ./locations/:"
-for location in root.iter('Location'):
-    name = location.attrib['name'].replace("$","_")
-    xml_locations.append(name)
-    
-    if name not in os_locations:
-        print name
-
-
-print "Locations missing from .qproj:"
-for name in os_locations:
-    if name not in xml_locations:
-        print name

+ 0 - 36
tools/check_images.py

@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-
-import io
-import os
-import re
-import sys
-
-#path = os.getcwd()
-#print path
-
-startpattern = """mod/public_WC/"""
-imgFormats = ['jpg','jpeg','gif','png','mp4']
-
-images = []
-
-ifile = io.open(
-    "mod_wlife.txt",
-    mode='rt',
-    encoding='utf-16'
-)
-text = ifile.read()
-for match in re.finditer(r"mod/public_WC/.+?[.](gif|jpg|jpeg|png|mp4)", text, flags=re.U):
-    imgfile = match.group().encode("utf-8")
-    randmatch = re.search(r"'\s*[+]\s*rand\s*[(]\s*(\d+)\s*[,]\s*(\d+)\s*[)]\s*[+]\s*'", imgfile)
-    if randmatch != None:
-        for i in range(int(randmatch.group(1)), 1+int(randmatch.group(2))):
-            images.append(re.sub(r"'\s*[+]\s*rand\s*[(].*?[)]\s*[+]\s*'", str(i), imgfile))
-    else:
-        images.append(imgfile)
-        
-ifile.close()
-
-for image in images:
-    if not re.search(r"[<$]", image) and not os.path.isfile(image):
-        print "Image not found:", image
-

+ 0 - 39
tools/check_imageso.py

@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-import io
-import os
-import re
-
-#path = os.getcwd()
-#print path
-
-startpattern = """images/"""
-imgFormats = ['jpg','gif']
-
-infile = io.open('mod_wlife.txt',mode='r',encoding='utf-16')
-lines = infile.readlines()
-
-images = []
-
-for name in os.listdir("locations"):
-    ifile = io.open(
-        os.path.join("locations", name),
-        mode='rt',
-        encoding='utf-8'
-    )
-    text = ifile.read()
-    for match in re.finditer(r"images.+?[.](gif|jpg|png)", text, flags=re.U):
-        imgfile = match.group().encode("utf-8")
-        randmatch = re.search(r"'\s*[+]\s*rand\s*[(]\s*(\d+)\s*[,]\s*(\d+)\s*[)]\s*[+]\s*'", imgfile)
-        if randmatch != None:
-            for i in range(int(randmatch.group(1)), 1+int(randmatch.group(2))):
-                images.append(re.sub(r"'\s*[+]\s*rand\s*[(].*?[)]\s*[+]\s*'", str(i), imgfile))
-        else:
-            images.append(imgfile)
-    
-    ifile.close()
-
-
-for image in images:
-    if not re.search(r"[<$]", image) and not os.path.isfile(image):
-        print "Image not found:", image