def check_for_file(game, file_id): for source in read_sources(): if source.startswith("file://"): source = source[7:] else: protocol = source[:7] logger.warn( "PGA source protocol {} not implemented".format(protocol)) continue if not os.path.exists(source): logger.info("PGA source {} unavailable".format(source)) continue game_dir = os.path.join(source, game) if not os.path.exists(game_dir): continue game_files = os.listdir(game_dir) for game_file in game_files: game_base, _ext = os.path.splitext(game_file) if game_base == file_id: return os.path.join(game_dir, game_file) return False
def check_for_file(game, file_id): for source in read_sources(): if source.startswith("file://"): source = source[7:] else: protocol = source[:7] logger.warn( "PGA source protocol {} not implemented".format(protocol) ) continue if not os.path.exists(source): logger.info("PGA source {} unavailable".format(source)) continue game_dir = os.path.join(source, game) if not os.path.exists(game_dir): continue game_files = os.listdir(game_dir) for game_file in game_files: game_base, _ext = os.path.splitext(game_file) if game_base == file_id: return os.path.join(game_dir, game_file) return False