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