diff --git a/bemani/backend/ddr/common.py b/bemani/backend/ddr/common.py index d6b5769..a7ba5e9 100644 --- a/bemani/backend/ddr/common.py +++ b/bemani/backend/ddr/common.py @@ -198,7 +198,7 @@ class DDRGameTraceHandler(DDRBase): game = Node.void("game") # Rival trace loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: # Nothing to load return game @@ -254,7 +254,7 @@ class DDRGameLoadDailyHandler(DDRBase): if extid is not None: # Rival daily loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) else: # Self daily loading userid = self.data.remote.user.from_refid(self.game, self.version, refid) @@ -329,7 +329,7 @@ class DDRGameFriendHandler(DDRBase): if extid is not None: # Rival score loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: friend = self.get_profile(userid) play_stats = self.get_play_statistics(userid) @@ -394,7 +394,7 @@ class DDRGameLoadCourseHandler(DDRBase): if extid is not None: # Rival score loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) else: # Self score loading userid = self.data.remote.user.from_refid(self.game, self.version, refid) diff --git a/bemani/backend/ddr/ddr2013.py b/bemani/backend/ddr/ddr2013.py index cc8de16..fd0585a 100644 --- a/bemani/backend/ddr/ddr2013.py +++ b/bemani/backend/ddr/ddr2013.py @@ -185,7 +185,7 @@ class DDR2013( if extid is not None: # Rival score loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) else: # Self score loading userid = self.data.remote.user.from_refid(self.game, self.version, refid) @@ -670,7 +670,7 @@ class DDR2013( newfriends[pos] = None else: # Try looking up the userid - newfriends[pos] = self.data.remote.user.from_extid(self.game, self.version, code) + newfriends[pos] = self.data.remote.user.from_extid(self.game, code) # Diff the set of links to determine updates for i in range(10): diff --git a/bemani/backend/ddr/ddr2014.py b/bemani/backend/ddr/ddr2014.py index 2f0489e..d8e2357 100644 --- a/bemani/backend/ddr/ddr2014.py +++ b/bemani/backend/ddr/ddr2014.py @@ -196,7 +196,7 @@ class DDR2014( if extid is not None: # Rival score loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) else: # Self score loading userid = self.data.remote.user.from_refid(self.game, self.version, refid) @@ -300,7 +300,7 @@ class DDR2014( game = Node.void("game") # Rival trace loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: # Nothing to load return game @@ -731,7 +731,7 @@ class DDR2014( newfriends[pos] = None else: # Try looking up the userid - newfriends[pos] = self.data.remote.user.from_extid(self.game, self.version, code) + newfriends[pos] = self.data.remote.user.from_extid(self.game, code) # Diff the set of links to determine updates for i in range(10): diff --git a/bemani/backend/ddr/ddrace.py b/bemani/backend/ddr/ddrace.py index 475d5a4..2054cbc 100644 --- a/bemani/backend/ddr/ddrace.py +++ b/bemani/backend/ddr/ddrace.py @@ -574,7 +574,7 @@ class DDRAce( ]: # Load up this user's highscores, format the way the below code expects it extid = requestdata.child_value("ddrcode") - otherid = self.data.remote.user.from_extid(self.game, self.version, extid) + otherid = self.data.remote.user.from_extid(self.game, extid) userscores = self.data.remote.music.get_scores(self.game, self.music_version, otherid) scores = [(otherid, score) for score in userscores] else: @@ -665,7 +665,7 @@ class DDRAce( userid = self.data.remote.user.from_refid(self.game, self.version, refid) if userid is None: # Possibly look up by extid instead - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if mode == "userload": self.__handle_userload(userid, request.child("data"), playerdata) diff --git a/bemani/backend/ddr/ddrx2.py b/bemani/backend/ddr/ddrx2.py index 47a229a..0d97828 100644 --- a/bemani/backend/ddr/ddrx2.py +++ b/bemani/backend/ddr/ddrx2.py @@ -213,7 +213,7 @@ class DDRX2( if extid is not None: # Rival score loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) else: # Self score loading userid = self.data.remote.user.from_refid(self.game, self.version, refid) @@ -729,7 +729,7 @@ class DDRX2( newfriends[pos] = None else: # Try looking up the userid - newfriends[pos] = self.data.remote.user.from_extid(self.game, self.version, code) + newfriends[pos] = self.data.remote.user.from_extid(self.game, code) # Diff the set of links to determine updates for i in range(10): diff --git a/bemani/backend/ddr/ddrx3.py b/bemani/backend/ddr/ddrx3.py index a70af73..4391a1f 100644 --- a/bemani/backend/ddr/ddrx3.py +++ b/bemani/backend/ddr/ddrx3.py @@ -179,7 +179,7 @@ class DDRX3( if extid is not None: # Rival score loading - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) else: # Self score loading userid = self.data.remote.user.from_refid(self.game, self.version, refid) @@ -746,7 +746,7 @@ class DDRX3( newfriends[pos] = None else: # Try looking up the userid - newfriends[pos] = self.data.remote.user.from_extid(self.game, self.version, code) + newfriends[pos] = self.data.remote.user.from_extid(self.game, code) # Diff the set of links to determine updates for i in range(10): diff --git a/bemani/backend/iidx/base.py b/bemani/backend/iidx/base.py index ab8f59f..7c8439b 100644 --- a/bemani/backend/iidx/base.py +++ b/bemani/backend/iidx/base.py @@ -182,7 +182,7 @@ class IIDXBase(CoreHandler, CardManagerHandler, PASELIHandler, Base): """ Given an ExtID and a request node, unformat the profile and save it. """ - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: return @@ -672,7 +672,7 @@ class IIDXBase(CoreHandler, CardManagerHandler, PASELIHandler, Base): if ghost_type == self.GHOST_TYPE_RIVAL: rival_extid = int(parameter) - rival_userid = self.data.remote.user.from_extid(self.game, self.version, rival_extid) + rival_userid = self.data.remote.user.from_extid(self.game, rival_extid) if rival_userid is not None: rival_profile = self.get_profile(rival_userid) rival_score = self.data.remote.music.get_score( @@ -827,9 +827,7 @@ class IIDXBase(CoreHandler, CardManagerHandler, PASELIHandler, Base): if ghost_type == self.GHOST_TYPE_RIVAL_TOP or ghost_type == self.GHOST_TYPE_RIVAL_AVERAGE: rival_extids = [int(e[1:-1]) for e in parameter.split(",")] - rival_userids = [ - self.data.remote.user.from_extid(self.game, self.version, rival_extid) for rival_extid in rival_extids - ] + rival_userids = [self.data.remote.user.from_extid(self.game, rival_extid) for rival_extid in rival_extids] all_scores = sorted( [ diff --git a/bemani/backend/iidx/cannonballers.py b/bemani/backend/iidx/cannonballers.py index 4665261..ca8551e 100644 --- a/bemani/backend/iidx/cannonballers.py +++ b/bemani/backend/iidx/cannonballers.py @@ -506,7 +506,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase): else: raise Exception("Unknown registration type for course entry!") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: # Update achievement to track course statistics self.update_course( @@ -534,7 +534,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase): pgreats = int(request.attribute("pgnum")) greats = int(request.attribute("gnum")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: # Update achievement to track course statistics self.update_course( @@ -595,7 +595,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase): except Exception: # Invalid extid continue - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: scores = self.data.remote.music.get_scores(self.game, self.music_version, userid) @@ -631,7 +631,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase): chart = self.game_to_db_chart(int(request.attribute("clid"))) ghost_type = int(request.attribute("ctype")) extid = int(request.attribute("iidxid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("IIDX25music") @@ -679,7 +679,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase): def handle_IIDX25music_breg_request(self, request: Node) -> Node: extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: clear_status = self.game_to_db_status(int(request.attribute("cflg"))) @@ -705,7 +705,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase): extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) chart = self.game_to_db_chart(int(request.attribute("clid"))) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) # See if we need to report global or shop scores if self.machine_joined_arcade(): @@ -966,7 +966,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase): cltype = int(request.attribute("gtype")) rank = self.game_to_db_rank(int(request.attribute("gid")), cltype) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: percent = int(request.attribute("achi")) stages_cleared = int(request.attribute("cstage")) diff --git a/bemani/backend/iidx/copula.py b/bemani/backend/iidx/copula.py index d61dc85..9117961 100644 --- a/bemani/backend/iidx/copula.py +++ b/bemani/backend/iidx/copula.py @@ -481,7 +481,7 @@ class IIDXCopula(IIDXCourse, IIDXBase): else: raise Exception("Unknown registration type for course entry!") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: # Update achievement to track course statistics self.update_course( @@ -547,7 +547,7 @@ class IIDXCopula(IIDXCourse, IIDXBase): except Exception: # Invalid extid continue - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: scores = self.data.remote.music.get_scores(self.game, self.music_version, userid) @@ -582,7 +582,7 @@ class IIDXCopula(IIDXCourse, IIDXBase): extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) chart = self.game_to_db_chart(int(request.attribute("clid"))) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) # See if we need to report global or shop scores if self.machine_joined_arcade(): @@ -765,7 +765,7 @@ class IIDXCopula(IIDXCourse, IIDXBase): def handle_IIDX23music_breg_request(self, request: Node) -> Node: extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: clear_status = self.game_to_db_status(int(request.attribute("cflg"))) @@ -829,7 +829,7 @@ class IIDXCopula(IIDXCourse, IIDXBase): chart = self.game_to_db_chart(int(request.attribute("clid"))) ghost_type = int(request.attribute("ctype")) extid = int(request.attribute("iidxid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("IIDX23music") @@ -878,7 +878,7 @@ class IIDXCopula(IIDXCourse, IIDXBase): extid = int(request.attribute("iidxid")) cltype = int(request.attribute("gtype")) rank = self.game_to_db_rank(int(request.attribute("gid")), cltype) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: percent = int(request.attribute("achi")) stages_cleared = int(request.attribute("cstage")) @@ -1388,7 +1388,7 @@ class IIDXCopula(IIDXCourse, IIDXBase): extid = int(request.child_value("iidx_id")) location = ID.parse_machine_id(request.child_value("location_id")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) if profile is None: diff --git a/bemani/backend/iidx/pendual.py b/bemani/backend/iidx/pendual.py index e1092d9..3d59df3 100644 --- a/bemani/backend/iidx/pendual.py +++ b/bemani/backend/iidx/pendual.py @@ -362,7 +362,7 @@ class IIDXPendual(IIDXCourse, IIDXBase): else: raise Exception("Unknown registration type for course entry!") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: # Update achievement to track course statistics self.update_course( @@ -550,7 +550,7 @@ class IIDXPendual(IIDXCourse, IIDXBase): except Exception: # Invalid extid continue - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: scores = self.data.remote.music.get_scores(self.game, self.music_version, userid) @@ -585,7 +585,7 @@ class IIDXPendual(IIDXCourse, IIDXBase): extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) chart = self.game_to_db_chart(int(request.attribute("clid"))) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) # See if we need to report global or shop scores if self.machine_joined_arcade(): @@ -768,7 +768,7 @@ class IIDXPendual(IIDXCourse, IIDXBase): def handle_IIDX22music_breg_request(self, request: Node) -> Node: extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: clear_status = self.game_to_db_status(int(request.attribute("cflg"))) @@ -832,7 +832,7 @@ class IIDXPendual(IIDXCourse, IIDXBase): chart = self.game_to_db_chart(int(request.attribute("clid"))) ghost_type = int(request.attribute("ctype")) extid = int(request.attribute("iidxid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("IIDX22music") @@ -882,7 +882,7 @@ class IIDXPendual(IIDXCourse, IIDXBase): cltype = int(request.attribute("gtype")) rank = self.game_to_db_rank(int(request.attribute("gid")), cltype) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: percent = int(request.attribute("achi")) stages_cleared = int(request.attribute("cflg")) @@ -1352,7 +1352,7 @@ class IIDXPendual(IIDXCourse, IIDXBase): extid = int(request.child_value("iidx_id")) location = ID.parse_machine_id(request.child_value("location_id")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) if profile is None: diff --git a/bemani/backend/iidx/rootage.py b/bemani/backend/iidx/rootage.py index 33a44ea..c81d85e 100644 --- a/bemani/backend/iidx/rootage.py +++ b/bemani/backend/iidx/rootage.py @@ -451,7 +451,7 @@ class IIDXRootage(IIDXCourse, IIDXBase): except Exception: # Invalid extid continue - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: scores = self.data.remote.music.get_scores(self.game, self.music_version, userid) @@ -487,7 +487,7 @@ class IIDXRootage(IIDXCourse, IIDXBase): chart = self.game_to_db_chart(int(request.attribute("clid"))) ghost_type = int(request.attribute("ctype")) extid = int(request.attribute("iidxid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("IIDX26music") @@ -535,7 +535,7 @@ class IIDXRootage(IIDXCourse, IIDXBase): def handle_IIDX26music_breg_request(self, request: Node) -> Node: extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: clear_status = self.game_to_db_status(int(request.attribute("cflg"))) @@ -561,7 +561,7 @@ class IIDXRootage(IIDXCourse, IIDXBase): extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) chart = self.game_to_db_chart(int(request.attribute("clid"))) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) # See if we need to report global or shop scores if self.machine_joined_arcade(): @@ -822,7 +822,7 @@ class IIDXRootage(IIDXCourse, IIDXBase): cltype = int(request.attribute("gtype")) rank = self.game_to_db_rank(int(request.attribute("gid")), cltype) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: percent = int(request.attribute("achi")) stages_cleared = int(request.attribute("cstage")) diff --git a/bemani/backend/iidx/sinobuz.py b/bemani/backend/iidx/sinobuz.py index d00a40e..5d80200 100644 --- a/bemani/backend/iidx/sinobuz.py +++ b/bemani/backend/iidx/sinobuz.py @@ -505,7 +505,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): else: raise Exception("Unknown registration type for course entry!") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: # Update achievement to track course statistics self.update_course( @@ -533,7 +533,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): pgreats = int(request.attribute("pgnum")) greats = int(request.attribute("gnum")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: # Update achievement to track course statistics self.update_course( @@ -594,7 +594,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): except Exception: # Invalid extid continue - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: scores = self.data.remote.music.get_scores(self.game, self.music_version, userid) @@ -630,7 +630,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): chart = self.game_to_db_chart(int(request.attribute("clid"))) ghost_type = int(request.attribute("ctype")) extid = int(request.attribute("iidxid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("IIDX24music") @@ -678,7 +678,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): def handle_IIDX24music_breg_request(self, request: Node) -> Node: extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: clear_status = self.game_to_db_status(int(request.attribute("cflg"))) @@ -704,7 +704,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) chart = self.game_to_db_chart(int(request.attribute("clid"))) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) # See if we need to report global or shop scores if self.machine_joined_arcade(): @@ -925,7 +925,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): cltype = int(request.attribute("gtype")) rank = self.game_to_db_rank(int(request.attribute("gid")), cltype) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: percent = int(request.attribute("achi")) stages_cleared = int(request.attribute("cstage")) @@ -1324,7 +1324,7 @@ class IIDXSinobuz(IIDXCourse, IIDXBase): extid = int(request.child_value("iidx_id")) location = ID.parse_machine_id(request.child_value("location_id")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) if profile is None: diff --git a/bemani/backend/iidx/spada.py b/bemani/backend/iidx/spada.py index 2cb8503..d3631fd 100644 --- a/bemani/backend/iidx/spada.py +++ b/bemani/backend/iidx/spada.py @@ -494,7 +494,7 @@ class IIDXSpada(IIDXBase): except Exception: # Invalid extid continue - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: scores = self.data.remote.music.get_scores(self.game, self.music_version, userid) @@ -529,7 +529,7 @@ class IIDXSpada(IIDXBase): extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) chart = self.game_to_db_chart(int(request.attribute("clid"))) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) # See if we need to report global or shop scores if self.machine_joined_arcade(): @@ -712,7 +712,7 @@ class IIDXSpada(IIDXBase): def handle_IIDX21music_breg_request(self, request: Node) -> Node: extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: clear_status = self.game_to_db_status(int(request.attribute("cflg"))) @@ -776,7 +776,7 @@ class IIDXSpada(IIDXBase): chart = self.game_to_db_chart(int(request.attribute("clid"))) ghost_type = int(request.attribute("ctype")) extid = int(request.attribute("iidxid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("IIDX21music") @@ -984,7 +984,7 @@ class IIDXSpada(IIDXBase): extid = int(request.child_value("iidx_id")) location = ID.parse_machine_id(request.child_value("location_id")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) if profile is None: @@ -1000,7 +1000,7 @@ class IIDXSpada(IIDXBase): cltype = int(request.attribute("gtype")) rank = self.game_to_db_rank(int(request.attribute("gid")), cltype) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: percent = int(request.attribute("achi")) stages_cleared = int(request.attribute("cflg")) diff --git a/bemani/backend/iidx/tricoro.py b/bemani/backend/iidx/tricoro.py index 6cf2208..fddbc34 100644 --- a/bemani/backend/iidx/tricoro.py +++ b/bemani/backend/iidx/tricoro.py @@ -474,7 +474,7 @@ class IIDXTricoro(IIDXBase): # Invalid extid continue - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: scores = self.data.remote.music.get_scores(self.game, self.music_version, userid) @@ -509,7 +509,7 @@ class IIDXTricoro(IIDXBase): extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) chart = self.game_to_db_chart(int(request.attribute("clid"))) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) # See if we need to report global or shop scores if self.machine_joined_arcade(): @@ -690,7 +690,7 @@ class IIDXTricoro(IIDXBase): def handle_music_breg_request(self, request: Node) -> Node: extid = int(request.attribute("iidxid")) musicid = int(request.attribute("mid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: clear_status = self.game_to_db_status(int(request.attribute("cflg"))) @@ -754,7 +754,7 @@ class IIDXTricoro(IIDXBase): chart = self.game_to_db_chart(int(request.attribute("clid"))) ghost_type = int(request.attribute("ctype")) extid = int(request.attribute("iidxid")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("music") @@ -940,7 +940,7 @@ class IIDXTricoro(IIDXBase): extid = int(request.child_value("iidx_id")) location = ID.parse_machine_id(request.child_value("location_id")) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) if profile is None: @@ -955,7 +955,7 @@ class IIDXTricoro(IIDXBase): extid = int(request.attribute("iidxid")) cltype = int(request.attribute("gtype")) rank = self.game_to_db_rank(int(request.attribute("gid")), cltype) - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: percent = int(request.attribute("achi")) stages_cleared = int(request.attribute("cflg")) diff --git a/bemani/backend/jubeat/base.py b/bemani/backend/jubeat/base.py index 38345b3..280eb79 100644 --- a/bemani/backend/jubeat/base.py +++ b/bemani/backend/jubeat/base.py @@ -160,7 +160,7 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base): if extid is None: return None - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) profile = self.get_profile(userid) if profile is None: return None diff --git a/bemani/backend/jubeat/prop.py b/bemani/backend/jubeat/prop.py index b6546eb..773b1cf 100644 --- a/bemani/backend/jubeat/prop.py +++ b/bemani/backend/jubeat/prop.py @@ -744,7 +744,7 @@ class JubeatProp( music_index = music_index + 1 # Look up profile so we can load the last course played - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) profile = self.get_profile(userid) if profile is None: profile = Profile(self.game, self.version, "", extid) @@ -788,7 +788,7 @@ class JubeatProp( extid = player.child_value("jid") # Look up profile so we can load the last course played - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) profile = self.get_profile(userid) if profile is None: profile = Profile(self.game, self.version, "", extid) diff --git a/bemani/backend/jubeat/saucerfulfill.py b/bemani/backend/jubeat/saucerfulfill.py index 32feb83..a4fb25e 100644 --- a/bemani/backend/jubeat/saucerfulfill.py +++ b/bemani/backend/jubeat/saucerfulfill.py @@ -245,7 +245,7 @@ class JubeatSaucerFulfill( music_index = music_index + 1 # Look up profile so we can load the last course played - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) profile = self.get_profile(userid) if profile is None: profile = Profile(self.game, self.version, "", extid) diff --git a/bemani/backend/reflec/colette.py b/bemani/backend/reflec/colette.py index d2a0e89..8fb8755 100644 --- a/bemani/backend/reflec/colette.py +++ b/bemani/backend/reflec/colette.py @@ -200,7 +200,7 @@ class ReflecBeatColette(ReflecBeatBase): extid = request.child_value("uid") teamid = request.child_value("tid") limit = request.child_value("limit") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) comments = [ achievement @@ -262,7 +262,7 @@ class ReflecBeatColette(ReflecBeatBase): def handle_info_pzlcmt_write_request(self, request: Node) -> Node: extid = request.child_value("uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: # Anonymous comment userid = UserID(0) @@ -348,7 +348,7 @@ class ReflecBeatColette(ReflecBeatBase): # Create a lobby entry for this user extid = request.child_value("e/uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) self.data.local.lobby.put_lobby( @@ -416,7 +416,7 @@ class ReflecBeatColette(ReflecBeatBase): mg = request.child_value("m_grade") # noqa: F841 extid = request.child_value("uid") limit = request.child_value("max") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: lobbies = self.data.local.lobby.get_all_lobbies(self.game, self.version) for user, lobby in lobbies: diff --git a/bemani/backend/reflec/groovin.py b/bemani/backend/reflec/groovin.py index 4167c34..63a229e 100644 --- a/bemani/backend/reflec/groovin.py +++ b/bemani/backend/reflec/groovin.py @@ -127,7 +127,7 @@ class ReflecBeatGroovin(ReflecBeatBase): # Create a lobby entry for this user extid = request.child_value("e/uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) info = self.data.local.lobby.get_play_session_info(self.game, self.version, userid) @@ -196,7 +196,7 @@ class ReflecBeatGroovin(ReflecBeatBase): mg = request.child_value("m_grade") # noqa: F841 extid = request.child_value("uid") limit = request.child_value("max") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: lobbies = self.data.local.lobby.get_all_lobbies(self.game, self.version) for user, lobby in lobbies: @@ -471,7 +471,7 @@ class ReflecBeatGroovin(ReflecBeatBase): extid = request.child_value("uid") locid = ID.parse_machine_id(request.child_value("lid")) limit = request.child_value("limit") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) comments = [ achievement @@ -532,7 +532,7 @@ class ReflecBeatGroovin(ReflecBeatBase): def handle_info_rb4pzlcmt_write_request(self, request: Node) -> Node: extid = request.child_value("uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: # Anonymous comment userid = UserID(0) @@ -619,7 +619,7 @@ class ReflecBeatGroovin(ReflecBeatBase): def handle_player_rb4readepisode_request(self, request: Node) -> Node: extid = request.child_value("user_id") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: achievements = self.data.local.user.get_achievements(self.game, self.version, userid) else: @@ -691,7 +691,7 @@ class ReflecBeatGroovin(ReflecBeatBase): extid = request.child_value("uid") songid = request.child_value("music_id") chart = request.child_value("note_grade") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: score = None profile = None @@ -1456,7 +1456,7 @@ class ReflecBeatGroovin(ReflecBeatBase): continue extid = child.child_value("id") - other_userid = self.data.remote.user.from_extid(self.game, self.version, extid) + other_userid = self.data.remote.user.from_extid(self.game, extid) if other_userid is None: continue diff --git a/bemani/backend/reflec/limelight.py b/bemani/backend/reflec/limelight.py index ba2effe..3093e90 100644 --- a/bemani/backend/reflec/limelight.py +++ b/bemani/backend/reflec/limelight.py @@ -260,7 +260,7 @@ class ReflecBeatLimelight(ReflecBeatBase): def handle_event_w_add_comment_request(self, request: Node) -> Node: extid = request.child_value("uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: # Anonymous comment userid = UserID(0) @@ -296,7 +296,7 @@ class ReflecBeatLimelight(ReflecBeatBase): def handle_event_w_update_status_request(self, request: Node) -> Node: # Update user status so puzzle comments can show it extid = request.child_value("uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: customize = request.child_value("customize") status = request.child_value("status") @@ -329,7 +329,7 @@ class ReflecBeatLimelight(ReflecBeatBase): # Create a lobby entry for this user extid = request.child_value("e/uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) self.data.local.lobby.put_lobby( @@ -394,7 +394,7 @@ class ReflecBeatLimelight(ReflecBeatBase): mg = request.child_value("m_grade") # noqa: F841 extid = request.child_value("uid") limit = request.child_value("max") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: lobbies = self.data.local.lobby.get_all_lobbies(self.game, self.version) for user, lobby in lobbies: diff --git a/bemani/backend/reflec/reflecbeat.py b/bemani/backend/reflec/reflecbeat.py index 6da1a78..4194174 100644 --- a/bemani/backend/reflec/reflecbeat.py +++ b/bemani/backend/reflec/reflecbeat.py @@ -152,7 +152,7 @@ class ReflecBeat(ReflecBeatBase): # Create a lobby entry for this user extid = request.child_value("e/uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) self.data.local.lobby.put_lobby( @@ -203,7 +203,7 @@ class ReflecBeat(ReflecBeatBase): mg = request.child_value("m_grade") # noqa: F841 extid = request.child_value("uid") limit = request.child_value("max") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: lobbies = self.data.local.lobby.get_all_lobbies(self.game, self.version) for user, lobby in lobbies: diff --git a/bemani/backend/reflec/volzza.py b/bemani/backend/reflec/volzza.py index 665f307..1fa2ce5 100644 --- a/bemani/backend/reflec/volzza.py +++ b/bemani/backend/reflec/volzza.py @@ -99,7 +99,7 @@ class ReflecBeatVolzza(ReflecBeatVolzzaBase): extid = request.child_value("uid") songid = request.child_value("music_id") chart = request.child_value("note_grade") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: score = None profile = None @@ -121,7 +121,7 @@ class ReflecBeatVolzza(ReflecBeatVolzzaBase): def handle_player_rb5_player_read_rival_ranking_data_request(self, request: Node) -> Node: extid = request.child_value("uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("player") rival_data = Node.void("rival_data") @@ -783,7 +783,7 @@ class ReflecBeatVolzza(ReflecBeatVolzzaBase): continue extid = child.child_value("id") - other_userid = self.data.remote.user.from_extid(self.game, self.version, extid) + other_userid = self.data.remote.user.from_extid(self.game, extid) if other_userid is None: continue diff --git a/bemani/backend/reflec/volzza2.py b/bemani/backend/reflec/volzza2.py index c80bf4d..0189e7a 100644 --- a/bemani/backend/reflec/volzza2.py +++ b/bemani/backend/reflec/volzza2.py @@ -118,7 +118,7 @@ class ReflecBeatVolzza2(ReflecBeatVolzzaBase): extid = request.child_value("uid") songid = request.child_value("music_id") chart = request.child_value("note_grade") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is None: score = None profile = None @@ -140,7 +140,7 @@ class ReflecBeatVolzza2(ReflecBeatVolzzaBase): def handle_player_rb5_player_read_rival_ranking_data_5_request(self, request: Node) -> Node: extid = request.child_value("uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) root = Node.void("player") rival_data = Node.void("rival_data") @@ -890,7 +890,7 @@ class ReflecBeatVolzza2(ReflecBeatVolzzaBase): continue extid = child.child_value("id") - other_userid = self.data.remote.user.from_extid(self.game, self.version, extid) + other_userid = self.data.remote.user.from_extid(self.game, extid) if other_userid is None: continue diff --git a/bemani/backend/reflec/volzzabase.py b/bemani/backend/reflec/volzzabase.py index cad12a8..cd2d182 100644 --- a/bemani/backend/reflec/volzzabase.py +++ b/bemani/backend/reflec/volzzabase.py @@ -258,7 +258,7 @@ class ReflecBeatVolzzaBase(ReflecBeatBase): # Create a lobby entry for this user extid = request.child_value("e/uid") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: profile = self.get_profile(userid) info = self.data.local.lobby.get_play_session_info(self.game, self.version, userid) @@ -325,7 +325,7 @@ class ReflecBeatVolzzaBase(ReflecBeatBase): mg = request.child_value("m_grade") # noqa: F841 extid = request.child_value("uid") limit = request.child_value("max") - userid = self.data.remote.user.from_extid(self.game, self.version, extid) + userid = self.data.remote.user.from_extid(self.game, extid) if userid is not None: lobbies = self.data.local.lobby.get_all_lobbies(self.game, self.version) for user, lobby in lobbies: diff --git a/bemani/data/api/user.py b/bemani/data/api/user.py index d451699..03aa472 100644 --- a/bemani/data/api/user.py +++ b/bemani/data/api/user.py @@ -142,8 +142,8 @@ class GlobalUserData(BaseGlobalData): def from_refid(self, game: GameConstants, version: int, refid: str) -> Optional[UserID]: return self.user.from_refid(game, version, refid) - def from_extid(self, game: GameConstants, version: int, extid: int) -> Optional[UserID]: - return self.user.from_extid(game, version, extid) + def from_extid(self, game: GameConstants, extid: int) -> Optional[UserID]: + return self.user.from_extid(game, extid) def get_profile(self, game: GameConstants, version: int, userid: UserID) -> Optional[Profile]: if RemoteUser.is_remote(userid): diff --git a/bemani/data/mysql/user.py b/bemani/data/mysql/user.py index 7a0943f..45322ea 100644 --- a/bemani/data/mysql/user.py +++ b/bemani/data/mysql/user.py @@ -240,7 +240,7 @@ class UserData(BaseData): result = cursor.mappings().fetchone() # type: ignore return UserID(result["userid"]) - def from_extid(self, game: GameConstants, version: int, extid: int) -> Optional[UserID]: + def from_extid(self, game: GameConstants, extid: int) -> Optional[UserID]: """ Given a generated ExtID, look up a user ID. @@ -249,7 +249,6 @@ class UserData(BaseData): Parameters: game - Enum value identifier of the game looking up the user. - version - Integer version of the game looking up the user. extid - ExtID in question, most likely previously generated by this class. Returns: diff --git a/bemani/frontend/admin/admin.py b/bemani/frontend/admin/admin.py index afcdfd5..c3486e4 100644 --- a/bemani/frontend/admin/admin.py +++ b/bemani/frontend/admin/admin.py @@ -1,5 +1,5 @@ import random -from typing import Dict, Tuple, Any, Optional +from typing import Dict, List, Tuple, Any, Optional from flask import Blueprint, request, Response, render_template, url_for from bemani.backend.base import Base @@ -853,21 +853,52 @@ def addcard() -> Dict[str, Any]: def searchusers() -> Dict[str, Any]: # Grab card, convert it searchdetails = request.get_json()["user_search"] + actual_users: Optional[List[UserID]] = None + if len(searchdetails["card"]) > 0: + card = searchdetails["card"] + if " " in card: + card = card.replace(" ", "") + if "-" in card: + card = card.replace("-", "") + + # First, try by ciphered card ID. try: - cardid = CardCipher.decode(searchdetails["card"]) + cardid = CardCipher.decode(card) actual_userid = g.data.local.user.from_cardid(cardid) - if actual_userid is None: - # Force a non-match below - actual_userid = UserID(-1) + if actual_userid is not None: + actual_users = [actual_userid] + except CardCipherException: - actual_userid = UserID(-1) - else: - actual_userid = None + pass + + # Now try by raw card ID. + if actual_users is None: + actual_userid = g.data.local.user.from_cardid(card) + if actual_userid is not None: + actual_users = [actual_userid] + + # Now try by extid. + if actual_users is None: + try: + extid = int(card) + actual_users = [] + + for game in GameConstants: + actual_userid = g.data.local.user.from_extid(game, extid) + if actual_userid is not None: + actual_users.append(actual_userid) + + except ValueError: + pass + + # Finally, give up and return no results. + if actual_users is None: + actual_users = [] def match(user: User) -> bool: - if actual_userid is not None: - return user.id == actual_userid + if actual_users is not None: + return user.id in actual_users else: return True diff --git a/bemani/frontend/static/controllers/admin/users.react.js b/bemani/frontend/static/controllers/admin/users.react.js index 7e799b5..1b5f5dc 100644 --- a/bemani/frontend/static/controllers/admin/users.react.js +++ b/bemani/frontend/static/controllers/admin/users.react.js @@ -75,7 +75,7 @@ var card_management = createReactClass({

User Search

- +