Skip to content

Repository files navigation

Installation

npm install -g libroadcast-cli

Usage

Usage: <command> [options]


Commands:
  login [--logout]
     Save your Lichess token and domain for future use.
     This allows you to use the CLI without setting environment variables.
     Options:
       --logout (-lo)   Clear saved credentials and log out.

  delay <broadcastId> <delayInSeconds> [--onlyDelay] [--noDelay] [--rounds <roundsToFix>] 
     Sets the delay for all rounds in the specified broadcast.
     Note:  The delay is specified in seconds. (max 3600 seconds = 1 hour)
     Options:
       --onlyDelay   Set only the delay without changing the start time.
       --noDelay     Do not modify the delay, only adjust the start time.
       --rounds <roundsToFix>   Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  setPGN <broadcastId> <sourcePGNUrl> [--withFilter] [--slice <sliceFilter>] [--rounds <roundsToFix>]
     Sets the source PGN URL for all rounds in the specified broadcast.
     (optional) Use "{}" in the URL as a placeholder for the round number.
     Note: For livechesscloud URLs, please ensure it ends with "/{}".
     Options:
       --withFilter             Apply round number filtering based on round number.
       --slice <sliceFilter>    Apply slice filtering using the provided filter string.
       --rounds <roundsToFix>   Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  setPGNMulti <broadcastId> <sourcePGNUrl> <gamesNum> [--withFilter] [--onlyGames <sliceFilter>] [--rounds <roundsToFix>]
     Sets the source PGN URLs for all rounds in the specified broadcast.
     Use {r} in the URL as a placeholder for the round number and {g} for the game number.
     Use the gamesNum parameter to specify how many games per round.
     Note: For broadcasts with multiple rounds, the source PGN URLs must include the "{g}" placeholder for round numbers.
     Options:
       --withFilter                Apply round number filtering based on round number.
       --onlyGames <sliceFilter>   Apply slice filtering using the provided filter string.
       --rounds <roundsToFix>      Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  setForward <broadcastId> <broadcastToForward> [--withFilter] [--slice <sliceFilter>] [--rounds <roundsToFix>]
     Sets the other Broadcast to foward for all rounds in the specified broadcast.
     Required: Your Lichess token needs the web:mod scope to use this command. (Broadcast/Study Admin perm required)
     Options:
       --withFilter             Apply round number filtering based on round number.
       --slice <sliceFilter>    Apply slice filtering using the provided filter string.
       --rounds <roundsToFix>   Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  setLichessGames <broadcastRoundId> <gameIds...>
     Sets the games for the specified broadcast round using Lichess game IDs.
     Note: Maximum of 64 game IDs can be provided.

  setLichessGamesMulti "<broadcastRoundIds...>" "<gameIds...>"
     Sets the games for multiple broadcast rounds using Lichess game IDs.
     The first argument is a space-separated list of broadcast round IDs, and the second argument is a space-separated list of game IDs.
     The command will distribute the provided game IDs across the specified broadcast round IDs.
     Note: Maximum of 64 game IDs can be provided. The number of game IDs should ideally be a multiple of the number of broadcast round IDs for even distribution.

  fixSchedule <broadcastId> <timeDiff> [--rounds <roundsToFix>]
     Fixes the schedule of rounds in the specified broadcast by applying a time difference.
     Note: The time difference should be in a format like "1h", "30m", "15s", etc.
     Options:
       --rounds <roundsToFix>   Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  startsPrevious <broadcastId> <startsPrevious>
     Sets the startsAfterPrevious flag for all rounds in the specified broadcast.

  period <broadcastId> <periodInSeconds>
     Sets the period between polling for all rounds in the specified broadcast.
     Required: Your Lichess token needs the web:mod scope to use this command. (Broadcast/Study Admin perm required)
     Note: The period is specified in seconds.
     Options:
       --rounds <roundsToFix>   Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  score <broadcastId> <whiteWin> <whiteDraw> <blackWin> <blackDraw> [--rounds <roundsToFix>]
     Sets the custom scoring for all rounds in the specified broadcast.
     Note: Scores must be numbers between 0 and 10.
     Options:
       --rounds <roundsToFix>   Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  teamScore <broadcastId> <teamWin> <teamDraw> [--rounds <roundsToFix>]
     Sets the custom team scoring for all rounds in the specified broadcast.
     Note: Scores for team win and team draw must be numbers between 0 and 10.
     Options:
       --rounds <roundsToFix>   Specify which rounds to fix using formats like '1-4', '8+', '3,5,7', etc.

  push <roundId> <PGNFromPathOrUrl> [--loop <intervalInSeconds>] [--validate-moves]
     Upload a PGN file from a local path or URL to the specified broadcast round.
     Note: The PGN file must be accessible from the provided path or URL.
     Options:
       --loop <intervalInSeconds>   Continuously push the PGN file at the specified interval in seconds.
       --validate-moves   Validate the moves in the PGN file.

  pushLCC <roundId> <LCCid> [--loop <intervalInSeconds>] [--permit-illegal]
     Upload a LiveChessCloud to the specified broadcast round.
     Note: The PGN file must be accessible from the provided path or URL.
     Options:
       --loop <intervalInSeconds>   Continuously push the PGN file at the specified interval in seconds.
       --permit-illegal   Permit illegal moves in the PGN file.

  pushFilterID <roundId> <PGNFromPathOrUrl> <FideIds...> [--loop <intervalInSeconds>]
     Upload a PGN file from a local path or URL to the specified broadcast round, filtering games by FIDE ID.
     Note: The PGN file must be accessible from the provided path or URL.
     Options:
       --loop <intervalInSeconds>   Continuously push the PGN file at the specified interval in seconds.
       --validate-moves   Validate the moves in the PGN file.

  convertNamesToID <roundId>
     Convert Lichess Usernames source to Lichess Game IDs source for the specified broadcast round.
     Note: This command will fetch the source PGN, extract Lichess Game IDs from the PGN headers, and update the broadcast round to use these game IDs as the source.

  pushReorder <roundId> <PGNFromPathOrUrl> [--loop <intervalInSeconds>] [--validate-moves]
     Upload a PGN file from a local path or URL to the specified broadcast round, reordering games by round number.
     Note: The PGN file must be accessible from the provided path or URL. Games will be reordered based on the 'Round' header in the PGN.
     Options:
       --loop <intervalInSeconds>   Continuously push the PGN file at the specified interval in seconds.
       --validate-moves   Validate the moves in the PGN file.

  bulkIDsMulti <bulkID> <broadcastRoundIds...>
     Sets Lichess Game IDs for multiple broadcast rounds using a Bulk Pairing ID.
     The command will fetch game IDs from the specified Bulk Pairing and distribute them across the provided broadcast round IDs.


Examples:
   # Login with your Lichess token (interactive)
     $ login
   # Login with token as argument
     $ login lip_yourtoken https://lichess.org
   # Logout and clear saved credentials
     $ login --logout
   # Set a 5-minute delay without changing start time
     $ delay bcast123 300 --onlyDelay
   # Set source PGN URL with round and slice filters
     $ setPGN bcast123 https://example.com/pgns/round-{}/game.pgn --withFilter --slice "1-5,7,9-12"
   # Set source PGN URLs for multiple games per round
     $ setPGNMulti bcast123 https://example.com/pgns/round-{r}/game-{g}.pgn 12 --withFilter --onlyGames "1-5,7,9-12"
   # Set Lichess games for a broadcast round
     $ setLichessGames round456 gameId1 gameId2 gameId3
   # Set Lichess games for multiple broadcast rounds
     $ setLichessGamesMulti "roundId1 roundId2 roundId3" "gameId1 gameId2 gameId3"
   # Fix schedule of rounds 1 to 4 and all rounds after 8 by adding 15 minutes
     $ fixSchedule bcast123 15m --rounds 1-4,8+
   # Set startsAfterPrevious to true for all rounds in a broadcast
     $ startsPrevious bcast123 true
   # Set polling period to 10 seconds for all rounds in a broadcast
     $ period bcast123 10
   # Set custom scoring for all rounds in a broadcast
     $ score bcast123 1.0 0.5 1.0 0.5
   # Push a PGN file in loop mode every 60 seconds
     $ push round456 /path/to/localfile.pgn --loop 60
   # Push a PGN file from URL filtering by FIDE IDs in loop mode every 120 seconds
     $ pushFilterID round456 https://example.com/games.pgn 12345 67890 --loop 120
   # Convert Lichess Usernames source to Lichess Game IDs source for a broadcast round
     $ convertNamesToID round456
   # Set Lichess Game IDs from Bulk Parings for multiple rounds (roundId1, roundId2, roundId3) in a broadcast
     $ bulkIDsMulti bulk123 roundId1 roundId2 roundId3

Test Docker Build Locally

docker build -t broadcast-cli .

docker run --rm -it broadcast-cli bash
# then
$ libroadcast

About

CLI to help with broadcast maintenance on Lichess

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages