broadcast lichess game IDs - done
parent
2ec45ec15e
commit
dd72e0ded0
|
@ -74,8 +74,12 @@ object form {
|
||||||
else form3.hidden(form("official")),
|
else form3.hidden(form("official")),
|
||||||
form3.group(
|
form3.group(
|
||||||
form("syncUrl"),
|
form("syncUrl"),
|
||||||
sourceUrl(),
|
sourceUrlOrGameIds(),
|
||||||
help = sourceUrlHelp().some
|
help = frag(
|
||||||
|
sourceUrlHelp(),
|
||||||
|
br,
|
||||||
|
gameIdsHelp()
|
||||||
|
).some
|
||||||
)(form3.input(_)),
|
)(form3.input(_)),
|
||||||
form("syncUrl").value.exists(LccRegex.matches) option {
|
form("syncUrl").value.exists(LccRegex.matches) option {
|
||||||
form3.group(form("syncUrlRound"), roundNumber())(
|
form3.group(form("syncUrlRound"), roundNumber())(
|
||||||
|
|
|
@ -1375,8 +1375,9 @@ val `eventName` = new I18nKey("broadcast:eventName")
|
||||||
val `eventDescription` = new I18nKey("broadcast:eventDescription")
|
val `eventDescription` = new I18nKey("broadcast:eventDescription")
|
||||||
val `fullDescription` = new I18nKey("broadcast:fullDescription")
|
val `fullDescription` = new I18nKey("broadcast:fullDescription")
|
||||||
val `fullDescriptionHelp` = new I18nKey("broadcast:fullDescriptionHelp")
|
val `fullDescriptionHelp` = new I18nKey("broadcast:fullDescriptionHelp")
|
||||||
val `sourceUrl` = new I18nKey("broadcast:sourceUrl")
|
val `sourceUrlOrGameIds` = new I18nKey("broadcast:sourceUrlOrGameIds")
|
||||||
val `sourceUrlHelp` = new I18nKey("broadcast:sourceUrlHelp")
|
val `sourceUrlHelp` = new I18nKey("broadcast:sourceUrlHelp")
|
||||||
|
val `gameIdsHelp` = new I18nKey("broadcast:gameIdsHelp")
|
||||||
val `roundNumber` = new I18nKey("broadcast:roundNumber")
|
val `roundNumber` = new I18nKey("broadcast:roundNumber")
|
||||||
val `startDate` = new I18nKey("broadcast:startDate")
|
val `startDate` = new I18nKey("broadcast:startDate")
|
||||||
val `startDateHelp` = new I18nKey("broadcast:startDateHelp")
|
val `startDateHelp` = new I18nKey("broadcast:startDateHelp")
|
||||||
|
|
|
@ -14,6 +14,7 @@ final class Env(
|
||||||
chapterRepo: lila.study.ChapterRepo,
|
chapterRepo: lila.study.ChapterRepo,
|
||||||
gameRepo: lila.game.GameRepo,
|
gameRepo: lila.game.GameRepo,
|
||||||
pgnDump: lila.game.PgnDump,
|
pgnDump: lila.game.PgnDump,
|
||||||
|
gameProxy: lila.round.GameProxyRepo,
|
||||||
cacheApi: lila.memo.CacheApi,
|
cacheApi: lila.memo.CacheApi,
|
||||||
slackApi: lila.irc.SlackApi,
|
slackApi: lila.irc.SlackApi,
|
||||||
baseUrl: BaseUrl
|
baseUrl: BaseUrl
|
||||||
|
|
|
@ -15,6 +15,7 @@ import lila.memo.CacheApi
|
||||||
import lila.study.MultiPgn
|
import lila.study.MultiPgn
|
||||||
import lila.tree.Node.Comments
|
import lila.tree.Node.Comments
|
||||||
import lila.game.{ Game, GameRepo, PgnDump }
|
import lila.game.{ Game, GameRepo, PgnDump }
|
||||||
|
import lila.round.GameProxyRepo
|
||||||
|
|
||||||
final private class RelayFetch(
|
final private class RelayFetch(
|
||||||
sync: RelaySync,
|
sync: RelaySync,
|
||||||
|
@ -23,6 +24,7 @@ final private class RelayFetch(
|
||||||
formatApi: RelayFormatApi,
|
formatApi: RelayFormatApi,
|
||||||
gameRepo: GameRepo,
|
gameRepo: GameRepo,
|
||||||
pgnDump: PgnDump,
|
pgnDump: PgnDump,
|
||||||
|
gameProxy: GameProxyRepo,
|
||||||
ws: StandaloneWSClient
|
ws: StandaloneWSClient
|
||||||
) extends Actor {
|
) extends Actor {
|
||||||
|
|
||||||
|
@ -143,11 +145,13 @@ final private class RelayFetch(
|
||||||
private def fetchGames(relay: Relay): Fu[RelayGames] =
|
private def fetchGames(relay: Relay): Fu[RelayGames] =
|
||||||
relay.sync.upstream ?? {
|
relay.sync.upstream ?? {
|
||||||
case UpstreamIds(ids) =>
|
case UpstreamIds(ids) =>
|
||||||
gameRepo.gamesFromSecondary(ids) flatMap gameRepo.withInitialFens flatMap {
|
gameRepo.gamesFromSecondary(ids) flatMap
|
||||||
_.map { case (game, fen) =>
|
gameProxy.upgradeIfPresent flatMap
|
||||||
pgnDump(game, fen, gameIdsUpstreamPgnFlags).dmap(_.render)
|
gameRepo.withInitialFens flatMap {
|
||||||
}.sequenceFu dmap MultiPgn.apply
|
_.map { case (game, fen) =>
|
||||||
} flatMap RelayFetch.multiPgnToGames.apply
|
pgnDump(game, fen, gameIdsUpstreamPgnFlags).dmap(_.render)
|
||||||
|
}.sequenceFu dmap MultiPgn.apply
|
||||||
|
} flatMap RelayFetch.multiPgnToGames.apply
|
||||||
case url: UpstreamUrl =>
|
case url: UpstreamUrl =>
|
||||||
cache.asMap
|
cache.asMap
|
||||||
.compute(
|
.compute(
|
||||||
|
|
|
@ -30,6 +30,9 @@ final class GameProxyRepo(
|
||||||
def upgradeIfPresent(pov: Pov): Fu[Pov] =
|
def upgradeIfPresent(pov: Pov): Fu[Pov] =
|
||||||
upgradeIfPresent(pov.game).dmap(_ pov pov.color)
|
upgradeIfPresent(pov.game).dmap(_ pov pov.color)
|
||||||
|
|
||||||
|
def upgradeIfPresent(games: List[Game]): Fu[List[Game]] =
|
||||||
|
games.map(upgradeIfPresent).sequenceFu
|
||||||
|
|
||||||
// update the proxied game
|
// update the proxied game
|
||||||
def updateIfPresent = roundSocket.updateIfPresent _
|
def updateIfPresent = roundSocket.updateIfPresent _
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
<string name="eventDescription">Short event description</string>
|
<string name="eventDescription">Short event description</string>
|
||||||
<string name="fullDescription">Full event description</string>
|
<string name="fullDescription">Full event description</string>
|
||||||
<string name="fullDescriptionHelp">Optional long description of the broadcast. %1$s is available. Length must be less than %2$s characters.</string>
|
<string name="fullDescriptionHelp">Optional long description of the broadcast. %1$s is available. Length must be less than %2$s characters.</string>
|
||||||
<string name="sourceUrl">Source URL</string>
|
<string name="sourceUrlOrGameIds">Source URL, or game IDs</string>
|
||||||
<string name="sourceUrlHelp">URL that Lichess will check to get PGN updates. It must be publicly accessible from the Internet.</string>
|
<string name="sourceUrlHelp">URL that Lichess will check to get PGN updates. It must be publicly accessible from the Internet.</string>
|
||||||
|
<string name="gameIdsHelp">Alternatively, you can enter up to 64 lichess game IDs, separated by spaces.</string>
|
||||||
<string name="roundNumber">Round number</string>
|
<string name="roundNumber">Round number</string>
|
||||||
<string name="startDate">Start date in your own timezone</string>
|
<string name="startDate">Start date in your own timezone</string>
|
||||||
<string name="startDateHelp">Optional, if you know when the event starts</string>
|
<string name="startDateHelp">Optional, if you know when the event starts</string>
|
||||||
|
|
Loading…
Reference in New Issue