lila icon indicating copy to clipboard operation
lila copied to clipboard

Generate GIFs with user's board theme and set piece

Open brollin opened this issue 2 years ago • 3 comments

Resolves https://github.com/lichess-org/lila/issues/11308. For now, we only have a subset of board themes implemented, just those that are SVGs. In lila-gif we fall back in most cases to the standard brown theme if a given theme is not implemented. Unfortunately this will give an inconsistent experience when users change their theme and attempt to make GIFs. One day we can extend lila-gif to support all board themes, although it will take a bit of effort.

brollin avatar Aug 30 '22 16:08 brollin

image

Example: blue theme, california piece set. Github doesn't seem to allow adding animated GIFs, so just a board image.

brollin avatar Aug 30 '22 16:08 brollin

Great to see everything come together!

Manually editing the query parameters to invalid values currently causes:

! @7onpo92i8 - Internal server error, for (GET) [/game/export/gif/black/qCKLuk34.gif?theme=purple2&piece=reillycraig] ->

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[: Unprocessable Entity]]
	at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:327)
	at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:246)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:400)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:392)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:490)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
	at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100)
Caused by: lila.base.LilaException$$anon$1: Unprocessable Entity
	at lila.base.LilaException$.apply(LilaException.scala:16)
	at lila.base.LilaTypes.fufail(LilaTypes.scala:30)
	at lila.base.LilaTypes.fufail$(LilaTypes.scala:30)
	at lila.game.package$.fufail(package.scala:3)
	at lila.game.GifExport.$anonfun$fromPov$4(GifExport.scala:50)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
	at scala.concurrent.BatchingExecutor$AbstractBatch.runN(BatchingExecutor.scala:134)
	at scala.concurrent.BatchingExecutor$AsyncBatch.apply(BatchingExecutor.scala:163)
	at scala.concurrent.BatchingExecutor$AsyncBatch.apply(BatchingExecutor.scala:146)
	at scala.concurrent.BlockContext$.usingBlockContext(BlockContext.scala:107)
[error] http - ERROR 500 Export.gif

So invalid requests need to be handled better at some level.

niklasf avatar Aug 31 '22 17:08 niklasf

Good catch. 👍 Think I'll have time to get to this tomorrow.

brollin avatar Sep 01 '22 05:09 brollin

🥳 thanks forgetting this over the finish line. I created an issue to capture Niklas' bug find: https://github.com/lichess-org/lila/issues/11606. Been a little busy lately, otherwise I would make the fix. Maybe this weekend if no one has gotten to it by then.

brollin avatar Sep 23 '22 18:09 brollin