def update_lp_table_2 ( self, results, match_group = None ): self.log ( "debug", "results = {}.".format ( results ) ) if len ( results ) == 0: self.log ( "debug", "New entry." ) self.controller.database.add_all ( lp_table, [ lp_table ( player_id = match_group [ 0 ], name = match_group [ 1 ], longitude = match_group [ 2 ], height = match_group [ 3 ], latitude = match_group [ 4 ], rotation_height = match_group [ 5 ], rotation_longitude = match_group [ 6 ], rotation_latitude = match_group [ 7 ], remote = match_group [ 8 ], health = match_group [ 9 ], deaths = match_group [ 10 ], zombies = match_group [ 11 ], players = match_group [ 12 ], score = match_group [ 13 ], level = match_group [ 14 ], steamid = match_group [ 15 ], ip = match_group [ 16 ], ping = match_group [ 17 ] ) ], print ) else: self.log ( "debug", "update entry." ) entry = results [ 0 ] self.log ( "debug", "obtained entry." ) entry [ "name" ] = match_group [ 1 ] entry [ "longitude" ] = match_group [ 2 ] entry [ "height" ] = match_group [ 3 ] entry [ "latitude" ] = match_group [ 4 ] entry [ "rotation_height" ] = match_group [ 5 ] entry [ "rotation_longitude" ] = match_group [ 6 ] entry [ "rotation_latitude" ] = match_group [ 7 ] entry [ "remote" ] = match_group [ 8 ] entry [ "health" ] = match_group [ 9 ] entry [ "deaths" ] = match_group [ 10 ] entry [ "zombies" ] = match_group [ 11 ] entry [ "players" ] = match_group [ 12 ] entry [ "score" ] = match_group [ 13 ] entry [ "level" ] = match_group [ 14 ] entry [ "ip" ] = match_group [ 16 ] entry [ "ping" ] = match_group [ 17 ] table_entry = lp_table ( ) lp_entry = table_entry.create_from_dictionary ( entry ) self.controller.database.add_all ( lp_table, [ lp_entry ], print ) self.log ( "debug", "added entry." ) self.log ( "debug", "returning." )
def update_lp_table ( self, match_group ): self.logger.debug("({})".format (match_group)) if self.online_players_changed: self.controller.database.blocking_delete( lp_table, []) self.online_players_changed = False this_steamid = int ( match_group [ 15 ] ) results = self.controller.database.blocking_consult ( lp_table, [ ( lp_table.steamid, "==", match_group [ 15 ] ) ]) self.logger.debug("results = {}.".format ( results ) ) if len ( results ) == 0: self.logger.debug("New entry." ) self.controller.database.blocking_add( lp_table, [ lp_table ( player_id = match_group [ 0 ], name = match_group [ 1 ], longitude = match_group [ 2 ], height = match_group [ 3 ], latitude = match_group [ 4 ], rotation_height = match_group [ 5 ], rotation_longitude = match_group [ 6 ], rotation_latitude = match_group [ 7 ], remote = match_group [ 8 ], health = match_group [ 9 ], deaths = match_group [ 10 ], zombies = match_group [ 11 ], players = match_group [ 12 ], score = match_group [ 13 ], level = match_group [ 14 ], steamid = match_group [ 15 ], ip = match_group [ 16 ], ping = match_group [ 17 ] ) ]) else: self.logger.debug("Update lp entry." ) entry = results [ 0 ] self.logger.debug("entry before: {}".format(entry)) entry [ "name" ] = match_group [ 1 ] entry [ "longitude" ] = match_group [ 2 ] entry [ "height" ] = match_group [ 3 ] entry [ "latitude" ] = match_group [ 4 ] entry [ "rotation_height" ] = match_group [ 5 ] entry [ "rotation_longitude" ] = match_group [ 6 ] entry [ "rotation_latitude" ] = match_group [ 7 ] entry [ "remote" ] = match_group [ 8 ] entry [ "health" ] = match_group [ 9 ] entry [ "deaths" ] = match_group [ 10 ] entry [ "zombies" ] = match_group [ 11 ] entry [ "players" ] = match_group [ 12 ] entry [ "score" ] = match_group [ 13 ] entry [ "level" ] = match_group [ 14 ] entry["steamid"] = match_group[15] entry [ "ip" ] = match_group [ 16 ] entry [ "ping" ] = match_group [ 17 ] self.logger.debug("Entry after: {}".format(entry)) self.controller.database.blocking_update( lp_table, entry) self.logger.debug("Updated entry." ) self.logger.debug("returning." )
def create_tables ( self ): self.controller.log ( ) self.lp_table = lp_table ( ) self.portals = portals_table ( ) global Base Base.metadata.create_all ( self.engine ) self.log ( "debug", "database.create_tables returning." )
def create_tables(self): self.logger.debug("create_tables()") self.alias_table = AliasTable() self.alias_table.create(self.engine) self.friendships_table = FriendshipsTable() self.friendships_table.create(self.engine) self.lkp_table = lkp_table() self.lkp_table.create(self.engine) self.lp_table = lp_table() self.lp_table.create(self.engine) self.chat_translation = ChatTranslatorTable() self.chat_translation.create(self.engine) self.llp_table = llp_table() self.llp_table.create(self.engine) self.portals = PortalsTable() self.portals.create(self.engine) self.cooldowns = TableCooldowns() self.cooldowns.create(self.engine) global Base Base.metadata.create_all(self.engine) self.logger.debug("self.metadata = {}".format(self.metadata)) self.logger.debug("\create_tables()")