From 5b9eda12659433ee9d4804f50d0716da04cfda36 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sun, 20 Apr 2014 18:25:04 +0200 Subject: [PATCH] remove unused data from the stream API --- README.md | 26 +++++++--------------- modules/hub/src/main/actorApi.scala | 3 +-- modules/round/src/main/MoveBroadcast.scala | 2 +- modules/round/src/main/Player.scala | 9 ++------ 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 439119191a..74270945a0 100644 --- a/README.md +++ b/README.md @@ -249,18 +249,10 @@ name | type | default | description Lichess streams all played moves on http://en.lichess.org/stream using chunked HTTP response and the following format: ```sh -ChunkSize # size of the next chunk, in hexadecimal -GameId UciMove IpAddress # actual chunk of data +ChunkSize # size of the next chunk, in hexadecimal +GameId IpAddress # actual chunk of data ``` -#### UciMove format - -```regex -([a-h][1-8]){2}x?(+|#)? -``` - -where `x` indicates a capture, `+` a check and `#` a checkmate. - #### Try it with netcat ```sh @@ -275,23 +267,21 @@ Connection: keep-alive Vary: Accept-Encoding 1a -4om0thb7 d1e1 91.121.7.111 +4om0thb7 91.121.7.111 1b -o2eg9xu3 c8c2x 89.77.165.159 +o2eg9xu3 89.77.165.159 18 -g3ag6xm6 g7f7+ 83.149.8.9 +g3ag6xm6 83.149.8.9 1b -hl0zbh3g c4c5# 109.237.157.8 +hl0zbh3g 109.237.157.8 1a -g3ag6xm6 c2c3x+ 91.121.7.111 +g3ag6xm6 91.121.7.111 1c -tj2u3hus a7a6x# 117.199.47.140 +tj2u3hus 117.199.47.140 ``` By comparing game IDs, you can guess who plays against who. -> Note that `91.121.7.111` and `198.50.141.73` are AI servers. - Credits ------- diff --git a/modules/hub/src/main/actorApi.scala b/modules/hub/src/main/actorApi.scala index 03ad88d851..8e0d2bdf11 100644 --- a/modules/hub/src/main/actorApi.scala +++ b/modules/hub/src/main/actorApi.scala @@ -135,8 +135,7 @@ case class MoveEvent( gameId: String, fen: String, move: String, - ip: String, - meta: String) // x, +, #, +x, #x + ip: String) } package bookmark { diff --git a/modules/round/src/main/MoveBroadcast.scala b/modules/round/src/main/MoveBroadcast.scala index 87a71fcdef..1c33c4b4e5 100644 --- a/modules/round/src/main/MoveBroadcast.scala +++ b/modules/round/src/main/MoveBroadcast.scala @@ -14,7 +14,7 @@ private final class MoveBroadcast extends Actor { } private val format = Enumeratee.map[MoveEvent] { move => - s"${move.gameId} ${move.move}${move.meta} ${move.ip}" + s"${move.gameId} ${move.ip}" } private val (enumerator, channel) = diff --git a/modules/round/src/main/Player.scala b/modules/round/src/main/Player.scala index 517394556c..ac3dc9a219 100644 --- a/modules/round/src/main/Player.scala +++ b/modules/round/src/main/Player.scala @@ -64,17 +64,12 @@ private[round] final class Player( private def notifyProgress(move: chess.Move, progress: Progress, ip: String) { val game = progress.game val chess = game.toChess - val meta = { - if (move.captures) "x" else "" - } + { - if (game.finished) "#" else if (chess.situation.check) "+" else "" - } bus.publish(MoveEvent( ip = ip, gameId = game.id, fen = Forsyth exportBoard chess.board, - move = move.keyString, - meta = meta), 'moveEvent) + move = move.keyString + ), 'moveEvent) } private def moveFinish(game: Game, color: Color): Fu[Events] = game.status match {