def rip_game():
    while True:
        path = '/RETRODE'
        api_key = os.environ['api-key']
        files = os.listdir(path)
        files.remove('RETRODE.CFG')
        breakout = False
        console = get_console(files[0].split('.')[(- 1)])
        filename = f'{path}/{files[0]}'
        if (console == 'N64'):
            rom_info = n64_info(filename)
        if (console == 'SNES'):
            rom_info = snes_info(filename)
            title = rom_info['title']
            search_results = giant_bomb_request(title, api_key)
            for results in search_results['results']:
                if (breakout is True):
                    break
                aliases = str(results.get('aliases')).lower().splitlines()
                if ((title.lower() in aliases) or (title.lower() == results['name'])):
                    for platform in results['platforms']:
                        if (platform['abbreviation'] == 'SNES'):
                            if (not os.path.exists(f'./{title}')):
                                os.mkdir(f"./{title} - {rom_info['region']}")
                            for file in files:
                                destination_file = f"./{title} - {rom_info['region']}/{title}.{file.split('.')[(- 1)]}"
                                if (not os.path.exists(destination_file)):
                                    copy(filename, destination_file)
                            breakout = True
                            break
        sleep(5)
def rip_game():
    while True:
        path = '/RETRODE'
        api_key = os.environ['api-key']
        files = os.listdir(path)
        files.remove('RETRODE.CFG')
        breakout = False
        console = get_console(files[0].split('.')[(- 1)])
        filename = f'{path}/{files[0]}'
        if (console == 'N64'):
            rom_info = n64_info(filename)
        if (console == 'SNES'):
            rom_info = snes_info(filename)
            title = rom_info['title']
            search_results = giant_bomb_request(title, api_key)
            for results in search_results['results']:
                if (breakout is True):
                    break
                aliases = str(results.get('aliases')).lower().splitlines()
                if ((title.lower() in aliases) or (title.lower() == results['name'])):
                    for platform in results['platforms']:
                        if (platform['abbreviation'] == 'SNES'):
                            if (not os.path.exists(f'./{title}')):
                                os.mkdir(f"./{title} - {rom_info['region']}")
                            for file in files:
                                destination_file = f"./{title} - {rom_info['region']}/{title}.{file.split('.')[(- 1)]}"
                                if (not os.path.exists(destination_file)):
                                    copy(filename, destination_file)
                            breakout = True
                            break
        sleep(5)