Skip to content

A simple Java library for basic queries on The Movie Database (themoviedb.org)

Notifications You must be signed in to change notification settings

tmrd993/quickquerytmdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

quickquerytmdb

Small library for basic queries on The Movie Database (themoviedb.org)

To get an API-Key, read this:
https://developers.themoviedb.org/3/getting-started/introduction

Features

  • Get movie details (Title, Genre, Release date, Runtime ...)
  • Get tv-show details (Title, Genre, Number of seasons, Last air date ...)
  • Get movie/tv-show poster
  • Get collection of movies based on query
  • Get collection of tv-shows based on query

How-to

Note that this library can't be used without an API-Key. Use the link above to get one. This is also still a WIP (it's still fully functional right now) so you'll have to clone the project and package it yourself.

Searching for specific movies/TV-shows

To search for a specific movie, simply create a MovieDataRetriever object, pass your API-Key in the constructor and call the searchExact method. A few examples on how it works can be seen below.

MovieDataRetriever retriever = new MovieDataRetriever("<YOUR_API_KEY_HERE>");
Movie someMovie = retriever.searchExact("<EXACT_MOVIE_TITLE_HERE>");

The searchExact Method returns the actual data. More specifically, it returns an immutable Movie object with methods to access the data. Calling the overridden toString() method returns the String representation of the Movie object. If we search for "Hereditary", this representation looks like this

Title: Hereditary
Status: Released
Genres: [Horror, Mystery, Thriller]
US release date: 2018-06-07
Runtime: 127 mins
Revenue (USD): 79336821
Budget (USD): 10000000
TMdb vote count: 4076
TMdb vote average: 7.1
Poster file path: /lHV8HHlhwNup2VbpiACtlKzaGIQ.jpg

Which is just a summary of all fields containing movie data in the Movie class. It's also possible to access the fields separately (using getters).

Note that searching for a TV-show using the MovieDataRetriever will not work. Use the TvDataRetriever class for TV-shows.

TvShowDataRetriever retriever = new TvShowDataRetriever("YOUR_API_KEY_HERE");
TvShow show = retriever.searchExact("EXACT_SHOW_TITLE_HERE");

Also note that TvShows do not have the same fields as movies.

For queries using the searchExact method, the search term (title of the movie/show) has to be exact. The searchExact method isn't case-sensitive however, so the following queries would return the same movie.

retriever.searchExact("hereditary");
retriever.searchExact("heReDitaRy");
retriever.searchExact("HEREDITARY");

Non-exact search

Using a query string, it is possible to conduct non exact queries. Use the searchByQuery method for this.

public List<Movie> searchByQuery(String query)

The method returns a list of Movie objects based on the query string.

An example query looks like this

MovieDataRetriever retriever = new MovieDataRetriever("YOUR_API_KEY_HERE);
List<Movie> movies = retriever.searchByQuery("QUERY_HERE");

Which would return a maximum of 20 movies based on the given query.

The same process can be repeated for TV-shows

TvShowDataRetriever retriever = new TvShowDataRetriever("YOUR_API_KEY_HERE);
List<TvShow> tvShows = retriever.searchByQuery("QUERY_HERE");

Example client with GUI

moviequery

Links

About

A simple Java library for basic queries on The Movie Database (themoviedb.org)

Topics

Resources

Stars

Watchers

Forks

Languages