buildmultimapslist.py 521 B

1234567891011121314151617181920212223242526272829
  1. #! python2.7
  2. from soundrts.lib import log
  3. log.add_console_handler()
  4. import os
  5. import os.path
  6. from soundrts.mapfile import Map
  7. DIR = "multi"
  8. def size(m):
  9. return Map(os.path.join(DIR, m)).size()
  10. def add_digest(m):
  11. p = os.path.join(DIR, m)
  12. return "%s %s" % (m, Map(p).get_digest())
  13. f = open("cfg/official_maps.txt", "w")
  14. maps = []
  15. for m in os.listdir(DIR):
  16. if m != "list.txt": # XXX not necessary
  17. maps.append(m)
  18. maps.sort(key=size)
  19. f.write("\n".join([add_digest(m) for m in maps]))
  20. f.close()