def parse_uri(uri):
    """Parse a gogdownloader:// URI into a list of (game,file_id) tuples"""
    scheme_prefix = 'gogdownloader://'

    if not uri.lower().startswith(scheme_prefix):
        raise ValueError("Not a valid GOGDownloader URI: %s" % uri)

    results = []
    for filepath in uri[len(scheme_prefix):].strip().split(','):
        filepath = filepath.strip()
        if '/' not in filepath:
            filepath += '/'
        results.append(tuple(filepath.split('/', 1)))
    return results