remove unused data from the stream API
parent
7aa81e7bac
commit
5b9eda1265
26
README.md
26
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
|
||||
-------
|
||||
|
||||
|
|
|
@ -135,8 +135,7 @@ case class MoveEvent(
|
|||
gameId: String,
|
||||
fen: String,
|
||||
move: String,
|
||||
ip: String,
|
||||
meta: String) // x, +, #, +x, #x
|
||||
ip: String)
|
||||
}
|
||||
|
||||
package bookmark {
|
||||
|
|
|
@ -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) =
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue