TMDb-async-client

Actions Status codecov.io Maven Central

About

TMDb-async-client is a native Scala SDK that provides asynchronous access to The Movie Database (TMDb) API.
It is built heavily on akka-http for async non-blocking HTTP I/O and spray-json for parsing JSON responses into Scala case classes.
akka-stream is used to allow limitation of client request frequency and number of parallel requests in respect of TMDb policies.

TMDb-async-client is an EDLA project.

The purpose of edla.org is to promote the state of the art in various domains.

API Key

You will need an API key to The Movie Database to access the API. To obtain a key, follow these steps:

  1. Register for and verify an account.
  2. Log into your account
  3. Select the API section on left side of your account page.
  4. Click on the link to generate a new API key and follow the instructions.

Usage

See Usage.scala for a runnable example.

Each function returns a Future of the response from the TMDb API, parsed into a convenient case class.

  val apiKey = "REPLACE_THIS_WITH_YOUR_OWN_API_KEY"

  val tmdbClient = TmdbClient(apiKey)

  val movie = tmdbClient.getMovie(54181)

  val movies = tmdbClient.searchMovie("shark")

  tmdbClient.downloadPoster(movie, Paths.get("/tmp/poster.jpg"))

  tmdbClient.shutdown

Developers

API Key need to be available as an environment variable named apiKey if you want to run sbt test

Related Projects

JavaFX client for TMDb (The Movie Database)

License

© 2014-2021 Olivier ROLAND. Distributed under the GPLv3 License.