From: nyov Date: Tue, 5 Jun 2012 18:22:36 +0000 (+0200) Subject: Dummy json views X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonstat.git;a=commitdiff_plain;h=79b98c49aeeac72946eedbaa2e686a08ce997fa1 Dummy json views --- diff --git a/xonstat/views/game.py b/xonstat/views/game.py index 70bbd58..6147c5f 100644 --- a/xonstat/views/game.py +++ b/xonstat/views/game.py @@ -31,7 +31,7 @@ def _game_index_data(request): order_by(PlayerGameStat.rank).\ order_by(PlayerGameStat.score).all() - return {'games':games, + return {'games':games, 'pgstats':pgstats} @@ -44,6 +44,15 @@ def game_index(request): return _game_index_data(request) +def game_index_json(request): + """ + Provides a list of current games, with the associated game stats. + These games are ordered by game_id, with the most current ones first. + Paginated. JSON. + """ + return [{'status':'not implemented'}] + + def _game_info_data(request): game_id = request.matchdict['id'] try: @@ -103,6 +112,13 @@ def game_info(request): return _game_info_data(request) +def game_info_json(request): + """ + List the game stats (scoreboard) for a particular game. Paginated. JSON. + """ + return [{'status':'not implemented'}] + + def _rank_index_data(request): if request.params.has_key('page'): current_page = request.params['page'] @@ -131,3 +147,10 @@ def rank_index(request): Provide a list of gametype ranks, paginated. """ return _rank_index_data(request) + + +def rank_index_json(request): + """ + Provide a list of gametype ranks, paginated. JSON. + """ + return [{'status':'not implemented'}] diff --git a/xonstat/views/main.py b/xonstat/views/main.py index 5a8bad4..05496e9 100644 --- a/xonstat/views/main.py +++ b/xonstat/views/main.py @@ -133,3 +133,10 @@ def main_index(request): mainindex_data['recent_games'].append(('-', '-', '-', '-')) return mainindex_data + + +def main_index_json(request): + """ + JSON output of the main page information. + """ + return [{'status':'not implemented'}] diff --git a/xonstat/views/map.py b/xonstat/views/map.py index df64122..a74a220 100644 --- a/xonstat/views/map.py +++ b/xonstat/views/map.py @@ -30,7 +30,7 @@ def _map_index_data(request): def map_index(request): """ - Provides a list of all the current maps. + Provides a list of all the current maps. """ return _map_index_data(request) @@ -39,7 +39,7 @@ def map_index_json(request): """ Provides a JSON-serialized list of all the current maps. """ - view_data = _map_index_data(request) + view_data = _map_index_data(request) maps = [m.to_dict() for m in view_data['maps']] @@ -146,3 +146,10 @@ def map_info(request): mapinfo_data['top_servers'].append(('-', '-', '-')) return mapinfo_data + + +def map_info_json(request): + """ + List the information stored about a given map. JSON. + """ + return [{'status':'not implemented'}] diff --git a/xonstat/views/player.py b/xonstat/views/player.py index 02e3cd3..c130dbc 100644 --- a/xonstat/views/player.py +++ b/xonstat/views/player.py @@ -45,6 +45,13 @@ def player_index(request): return _player_index_data(request) +def player_index_json(request): + """ + Provides a list of all the current players. JSON. + """ + return [{'status':'not implemented'}] + + def _get_games_played(player_id): """ Provides a breakdown by gametype of the games played by player_id. @@ -224,6 +231,13 @@ def player_info(request): return _player_info_data(request) +def player_info_json(request): + """ + Provides detailed information on a specific player. JSON. + """ + return [{'status':'not implemented'}] + + def _player_game_index_data(request): player_id = request.matchdict['player_id'] @@ -267,6 +281,15 @@ def player_game_index(request): return _player_game_index_data(request) +def player_game_index_json(request): + """ + Provides an index of the games in which a particular + player was involved. This is ordered by game_id, with + the most recent game_ids first. Paginated. JSON. + """ + return [{'status':'not implemented'}] + + def _player_accuracy_data(request): player_id = request.matchdict['id'] allowed_weapons = ['nex', 'rifle', 'shotgun', 'uzi', 'minstanex'] @@ -304,6 +327,13 @@ def _player_accuracy_data(request): } +def player_accuracy(request): + """ + Provides the accuracy for the given weapon. (JSON only) + """ + return _player_accuracy_data(request) + + def player_accuracy_json(request): """ Provides a JSON response representing the accuracy for the given weapon. diff --git a/xonstat/views/search.py b/xonstat/views/search.py index 2a791f3..13700b6 100644 --- a/xonstat/views/search.py +++ b/xonstat/views/search.py @@ -149,3 +149,7 @@ def _search_data(request): def search(request): return _search_data(request) + + +def search_json(request): + return [{'status':'not implemented'}] diff --git a/xonstat/views/server.py b/xonstat/views/server.py index 93e5fec..b2d7c6d 100644 --- a/xonstat/views/server.py +++ b/xonstat/views/server.py @@ -37,6 +37,13 @@ def server_index(request): return _server_index_data(request) +def server_index_json(request): + """ + Provides a list of all the current servers. JSON. + """ + return [{'status':'not implemented'}] + + def _server_info_data(request): server_id = request.matchdict['id'] @@ -142,6 +149,13 @@ def server_info(request): return serverinfo_data +def server_info_json(request): + """ + List the stored information about a given server. JSON. + """ + return [{'status':'not implemented'}] + + def _server_game_index_data(request): server_id = request.matchdict['server_id'] current_page = request.matchdict['page'] @@ -170,3 +184,10 @@ def server_game_index(request): List the games played on a given server. Paginated. """ return _server_game_index_data(request) + + +def server_game_index_json(request): + """ + List the games played on a given server. Paginated. JSON. + """ + return [{'status':'not implemented'}]