Example #1
0
def searchrivals() -> Dict[str, Any]:
    frontend = SoundVoltexFrontend(g.data, g.config, g.cache)
    version = int(request.get_json()['version'])
    name = request.get_json()['term']

    # Try to treat the term as an extid
    extid = ID.parse_extid(name)

    matches = set()
    profiles = g.data.remote.user.get_all_profiles(GameConstants.SDVX, version)
    for (userid, profile) in profiles:
        if profile.get_int('extid') == extid or profile.get_str('name').lower() == name.lower():
            matches.add(userid)

    playerinfo = frontend.get_all_player_info(list(matches), allow_remote=True)
    return {
        'results': playerinfo,
    }
Example #2
0
 def test_format_extid(self) -> None:
     self.assertEqual(ID.format_extid(12345678), '1234-5678')
     self.assertEqual(ID.parse_extid('1234-5678'), 12345678)
     self.assertEqual(ID.parse_extid('bla'), None)
     self.assertEqual(ID.parse_extid('blah-blah'), None)