Example #1
0
def parse_data(game_name, data_files=None):

    if not data_files:
        data_files_location = "{0}/resources/data_files.txt".format(game_name)
        try:
            with resource.open_file('data_files.txt') as f:
                lines = f.readlines()
                data_files = [x.strip() + '.csv' for x in lines if bool(x.strip())]
        except IOError:
            data_files = ('data.csv',)

    searchable_rows = []
    logging.debug("data_files:{0}".format(data_files))
    for data_file in data_files:
        logging.debug("data_file:{0}".format(data_file))
        file_location = "{0}/resources/{1}".format(game_name, data_file)
        searchable_rows += parse_data_file(file_location)

    return searchable_rows
Example #2
0
 def get_text_config(self, file_name):
     with resource.open_file(file_name) as f:
         lines = f.readlines()
         config = [x.strip() for x in lines if bool(x.strip())]
         return config
         self.icons = icons