def matchup_finder(directories): print("processing {0} directories".format(len(directories))) matches = [] for path in directories: if not os.path.exists(path): continue meta_options = replays_in_dir(path) if meta_options != None: print("processing matchup...") matches.append(replay_parser.parse_matchup(path, tags_from_path(path), meta_options)) return matches
def matchup_finder(directories): print("processing {0} directories".format(len(directories))) matches = [] for path in directories: if not os.path.exists(path): continue meta_options = replays_in_dir(path) if meta_options != None: print("processing matchup...") matches.append( replay_parser.parse_matchup(path, tags_from_path(path), meta_options)) return matches
def rec_dir(dir, tags=()): objects = os.listdir(dir) regex = re.compile("(.SC2Replay$)|(.yaml$)", re.I) replays_here = False meta_options = {} matches = () for a in objects: cd = os.path.join(dir, a) if (os.path.isdir(cd)): matches += rec_dir(cd, tags + (a, )) else: if (regex.search(a)): if (a == "meta.yaml"): stream = open(cd, 'r') meta_options = yaml.load(stream) replays_here = True if (replays_here): matches += (replay_parser.parse_matchup(dir, tags, meta_options), ) return matches
def rec_dir(dir, tags=()): objects = os.listdir(dir) regex = re.compile("(.SC2Replay$)|(.yaml$)", re.I) replays_here = False meta_options = {} matches = () for a in objects: cd = os.path.join(dir, a) if(os.path.isdir(cd)): matches += rec_dir(cd, tags + (a,)) else: if(regex.search(a)): if(a == "meta.yaml"): stream = open(cd, 'r') meta_options = yaml.load(stream) replays_here = True if(replays_here): matches += (replay_parser.parse_matchup(dir, tags, meta_options),) return matches