A beautiful command-line interface for The Movie Database (TMDB) API with interactive features
Project description
TMDB CLI Tool
A beautiful command-line interface for The Movie Database (TMDB) API that allows you to search for movies, browse trending content, check upcoming releases, and get detailed movie information.
๐ What's New in v2.0
- ๐ฎ Interactive Movie Browser: Browse movies with a beautiful, interactive interface
- โญ Personal Watchlist: Save, manage, and export your favorite movies
- ๐ฏ Smart Recommendations: Get movie suggestions based on movies you like or by genre
- ๐พ Data Persistence: Your watchlist is saved locally between sessions
- ๐ค Export Functionality: Export your watchlist to shareable text files
- ๐จ Enhanced UI: Rich, colorful interface with intuitive navigation
- โก Improved Performance: Faster API calls and better error handling
Features
- ๐ Search Movies: Search for movies by title with pagination support
- ๐ Trending Movies: Browse trending movies for today or this week
- ๐ฌ Upcoming Releases: View upcoming movie releases
- ๐ Movie Details: Get comprehensive information about specific movies
- ๏ฟฝ Interactive Browser: Browse movies with an interactive interface
- โญ Personal Watchlist: Save and manage your favorite movies
- ๐ฏ Smart Recommendations: Get movie suggestions based on preferences
- ๐พ Data Export: Export your watchlist to text files
- ๏ฟฝ๐จ Rich Terminal Output: Beautiful, colored tables and formatted text
- โก Error Handling: Graceful handling of network issues, invalid input, and API errors
- ๐ง Environment Configuration: Secure API key management with
.envfiles
Installation
Option 1: Install from PyPI (Recommended)
# Install globally
pip install tmdb-cli-enhanced
# Or install in a virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install tmdb-cli-enhanced
Option 2: Install from Source
-
Clone this repository:
git clone https://github.com/hanzadj/tmdb-cli.git cd tmdb-cli
-
Create a virtual environment and install dependencies:
# Create virtual environment python3 -m venv venv # Activate virtual environment source venv/bin/activate # On Windows: venv\Scripts\activate # Install in development mode pip install -e .
Setup Your API Key
- Set up your TMDB API key:
- Get a free API key from The Movie Database
- Copy the
.env.examplefile to.env:cp .env.example .env
- Edit the
.envfile and replaceyour_tmdb_api_key_herewith your actual API key:API_KEY=your_actual_tmdb_api_key_here
Usage
After installation, you can use the CLI tool in several ways:
Method 1: Using the command (recommended for PyPI installs)
tmdb-cli search "inception"
tmdb-cli trending --type week
tmdb-cli upcoming
tmdb-cli details 550
# Or using the shorter alias
tmdb search "inception"
tmdb trending --type week
tmdb upcoming
tmdb details 550
Method 2: Using the wrapper script (for source installs)
./tmdb search "inception"
./tmdb trending --type week
./tmdb upcoming
./tmdb details 550
Method 3: Direct Python module execution
# If installed via pip
python -m tmdb_cli.main search "inception"
# Or if using source install with activated virtual environment
source venv/bin/activate
python -m tmdb_cli.main search "inception"
Basic Commands
Search for Movies
tmdb search "inception"
tmdb search "spider man" --page 2
Get Trending Movies
# Trending today (default)
tmdb trending
# Trending this week
tmdb trending --type week
View Upcoming Releases
tmdb upcoming
Get Movie Details
tmdb details 550 # Fight Club
tmdb details 27205 # Inception
Interactive Movie Browser
# Browse popular movies interactively
tmdb browse
# Browse top rated movies
tmdb browse --category top_rated
# Browse currently playing movies
tmdb browse --category now_playing
Manage Your Watchlist
# View your personal watchlist
tmdb watchlist
# Add movies to watchlist using the browse command
tmdb browse # then use 'w' command to manage watchlist
Get Movie Recommendations
# Get recommendations based on a specific movie
tmdb recommend --movie-id 27205 # Based on Inception
# Get recommendations by genre
tmdb recommend --genre "science fiction"
tmdb recommend --genre "action"
# Get personalized recommendations (requires watchlist)
tmdb recommend
Command Reference
| Command | Description | Options |
|---|---|---|
search <query> |
Search for movies by title | --page, -p: Page number (default: 1) |
trending |
Get trending movies | --type: day or week (default: day) |
upcoming |
Show upcoming movie releases | None |
details <movie_id> |
Get detailed movie information | Movie ID (required) |
browse |
Interactive movie browser | --category: popular, top_rated, now_playing |
watchlist |
Manage personal watchlist | Interactive management options |
recommend |
Get movie recommendations | --movie-id: Based on movie, --genre: By genre |
Help and Version
# Show help
tmdb --help
# Show version
tmdb --version
# Help for specific commands
tmdb search --help
Interactive Features
Movie Browser
The interactive browser (./tmdb browse) provides an immersive way to discover movies:
- Navigation: Use
n(next) andp(previous) to browse pages - Movie Details: Use
d <number>to view detailed information - Watchlist Management: Use
wto add/remove movies from your personal watchlist - Visual Indicators: Movies in your watchlist are marked with โญ
- Clean Exit: Use
qto quit the browser
Watchlist Management
Your personal movie watchlist is stored locally and provides:
- Persistent Storage: Movies are saved between sessions
- Export Functionality: Export your list to text files
- Quick Actions: Add, remove, view details, and clear entire list
- Statistics: Track when movies were added to your list
Smart Recommendations
Get intelligent movie suggestions based on:
- Similar Movies: Find movies like ones you've enjoyed
- Genre Preferences: Discover popular movies in specific genres
- Personal Taste: Recommendations based on your watchlist history
Output Examples
Interactive Browser
๐ฌ Popular Movies (Page 1/4)
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ 1. The Shawshank Redemption โญ โ
โ ๐
1994-09-23 | โญ 8.7/10 โ
โ Two imprisoned mates bond over a number of years, finding... โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Commands: next | prev | watchlist | details <num> | quit
Watchlist Display
๐ Your Watchlist (3 movies)
โโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ # โ Title โ Release Date โ Rating โ Added โ
โโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโค
โ 1 โ Inception โ 2010-07-15 โ 8.4/10 โ 2025-08-07 โ
โ 2 โ The Dark Knight โ 2008-07-16 โ 8.5/10 โ 2025-08-07 โ
โ 3 โ Interstellar โ 2014-11-05 โ 8.5/10 โ 2025-08-07 โ
โโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโโโโ
Search Results
Search Results for 'inception'
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Title โ Release Date โ Rating โ Overview โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Inception โ 2010-07-16 โ 8.4/10 โ Cobb, a skilled thief who commits corporate โ
โ โ โ โ espionage by infiltrating the subconscious... โ
โ Inception: The Cobol Job โ 2010-12-07 โ 7.9/10 โ This Inception prequel unfolds courtesy of a... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Movie Details
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Inception โ
โ Your mind is the scene of the crime โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Release Date July 16, 2010
Rating 8.4/10 (35,275 votes)
Runtime 148 minutes
Budget $160,000,000
Revenue $825,532,764
Genres Action, Science Fiction, Adventure
Production Warner Bros. Pictures, Legendary Entertainment, Syncopy
โญโ Overview โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Cobb, a skilled thief who commits corporate espionage by infiltrating โ
โ the subconscious of his targets, is offered a chance to regain his old โ
โ life as payment for a task considered to be impossible: "inception", โ
โ the implantation of another person's idea into a target's subconscious. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Project Structure
tmdb-cli/
โโโ tmdb_cli/ # Main Python package
โ โโโ __init__.py # Package initialization
โ โโโ main.py # CLI application code
โโโ .env.example # Environment variables template
โโโ .gitignore # Git ignore patterns
โโโ LICENSE # MIT License
โโโ MANIFEST.in # Package manifest for distribution
โโโ pyproject.toml # Modern Python packaging configuration
โโโ tmdb # Wrapper script for development
โโโ demo.sh # Demo script showcasing all features
โโโ publish.sh # PyPI publishing helper script
โโโ requirements.txt # Python dependencies (for development)
โโโ README.md # This file
# User Data (created automatically)
.env # Your personal API key (not in repo)
venv/ # Virtual environment (not in repo)
~/.tmdb_watchlist.json # Personal watchlist storage
tmdb_watchlist_*.txt # Exported watchlist files
Dependencies
- requests: HTTP library for API calls
- python-dotenv: Environment variable management
- rich: Beautiful terminal formatting
- click: Command-line interface framework
Error Handling
The tool gracefully handles various error scenarios:
- Invalid API Key: Clear error message for authentication issues
- Network Problems: Timeout and connection error handling
- Invalid Input: Validation for movie IDs and search queries
- No Results: Friendly messages when searches return empty results
- Rate Limiting: Proper HTTP status code handling
API Information
This tool uses The Movie Database (TMDB) API. You need a free API key to use this application.
Getting an API Key
- Create an account at TMDB
- Go to your API settings
- Request an API key
- Copy the API key to your
.envfile
๐ก Tips & Tricks
Power User Tips
- Quick Movie Lookup: Use
tmdb details <movie_id>for instant movie information - Genre Discovery: Try
tmdb recommend --genre "thriller"to discover new genres - Watchlist Shortcuts: In the browser, use
wto quickly manage your watchlist - Export for Sharing: Use the watchlist export feature to share movie lists with friends
Workflow Suggestions
- Discovery: Start with
tmdb browseto discover popular movies - Curation: Add interesting movies to your watchlist using the browser
- Exploration: Use
tmdb recommendto find similar movies - Organization: Export your watchlist periodically for backup
Troubleshooting
- Virtual Environment: Make sure to activate your virtual environment with
source venv/bin/activate - Missing Dependencies: If commands fail, ensure you've installed requirements with
pip install -r requirements.txt - API Key Issues: Make sure you've copied
.env.exampleto.envand added your actual API key - Network Issues: The tool handles timeouts gracefully - just retry
- Invalid Movie IDs: Use search to find the correct movie ID first
- Empty Watchlist: Start browsing movies to build your personal collection
- API Limits: The free TMDB API has generous limits for personal use
Contributing
Feel free to submit issues, feature requests, or pull requests to improve this tool.
Acknowledgments
This project was inspired by the TMDB CLI project from roadmap.sh - a fantastic resource for learning and building practical development projects. The roadmap.sh community provides excellent project ideas and learning paths for developers of all levels.
License
This project is open source and available under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tmdb_cli_enhanced-2.0.0.tar.gz.
File metadata
- Download URL: tmdb_cli_enhanced-2.0.0.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02b57418f63e913ef8b8836433c928ca6528e5b80bd0cc3354433cf21411f043
|
|
| MD5 |
23d4e6d2a8c539dd3306bf85ea4b93fc
|
|
| BLAKE2b-256 |
761a959b689a652dce811f33699843e7625fca0ffe98019bac706298a4a608d8
|
File details
Details for the file tmdb_cli_enhanced-2.0.0-py3-none-any.whl.
File metadata
- Download URL: tmdb_cli_enhanced-2.0.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df5d716ebd9637631147432df24cbe3c3d59df45af4c482fd87c76f7b0ddac44
|
|
| MD5 |
3229b88229d06871cb2759dfae6071a5
|
|
| BLAKE2b-256 |
af45ad478ab8660cec3bf8c3e2ab2a95c578920301cfdd89eb7505c82cfcc305
|