def get_matches_metadata(infile):
    """
    Reads match IDs and metadata from a filename.
    Args:
        infile: Filename where match IDs and metadata are stored (string).
    Returns:
        List of dicts with IDs and metadata for each match.
    """
    out = []
    with open(infile, "r") as file:
        lines = file.read().split("\n")
        # First two lines are column names and types.
        header = lines[0].split(",")
        types = lines[1].split(",")
        for line in filter(lambda x: len(x) > 0, lines[2:]):
            data = line.split(",")
            row = {}
            for i in range(len(data)):
                if types[i] == "int":
                    row[header[i]] = int(data[i])
                elif types[i] == "float":
                    row[header[i]] = float(data[i])
                elif types[i] == "str":
                    row[header[i]] = data[i]
                else:
                    err = "Unsupported column type: {}".format(types[i])
                    raise ValueError(err)
            out.append(row)
    return out