An CLI application to use TMDB API to fetch movie information and display it in the terminal.
The TMDB CLI Tool is a simple command-line interface (CLI) application that interacts with the TMDB API to fetch and display movie information directly in your terminal. This project allows users to explore popular, top-rated, upcoming, and now-playing movies with ease.
- Fetch and display lists of movies:
- Popular Movies
- Top Rated Movies
- Upcoming Movies
- Now Playing Movies
- Command-line interface for quick and seamless interaction.
- Graceful handling of errors such as API failures or network issues.
- Clear and intuitive command-line arguments.
- C++ Compiler (e.g., GCC or Clang)
- CMake (Optional but recommended for build automation)
- cURL Library (Required for HTTP requests)
- JSON Library for parsing JSON responses (e.g., nlohmann/json)
-
Clone the repository:
git clone https://github.com/yourusername/tmdb-cli-tool.git cd tmdb-cli-tool -
Build the application:
mkdir build cd build cmake .. make -
Obtain an API key from The Movie Database API and note it down.
-
Set your API key as an environment variable:
export TMDB_API_KEY=your_api_key_here
Run the application from the command line with the desired movie type:
./tmdb-app --type "popular"| Argument | Description |
|---|---|
--type |
Specify the type of movies to display. Possible values: playing, popular, top, upcoming. |
--help |
Display help information about the CLI tool. |
-
Fetch now playing movies:
./tmdb-app --type "playing" -
Fetch popular movies:
./tmdb-app --type "popular"
- Network Issues: Displays a message indicating a failure to connect to the API.
- Invalid API Key: Prompts the user to verify their API key.
- Invalid Command: Guides the user on the correct usage of the CLI tool with
--help.
The project depends on the following libraries:
- cURL: For making HTTP requests.
- nlohmann/json: For parsing JSON responses.
Ensure these are installed before building the project.
main.cpp: Entry point of the application.tmdb_api.cpp/h: Handles API interactions.cli_parser.cpp/h: Handles command-line argument parsing.utils.cpp/h: Utility functions for error handling and output formatting.