Plexboxd is a Discord bot that automatically tracks movies watched on Plex and integrates with Letterboxd to log and rate them. It monitors your Plex server for watched content and sends an embed with all necessary information to a Discord channel, allowing you to rate films directly from Discord - which then automatically adds them to your Letterboxd diary.
- π¬ Plex Integration: Monitors your Plex server for newly watched movies
- π€ Discord Notifications: Sends an embed with all necessary movie information to a Discord channel when you finish watching a film
- β Letterboxd Integration: Rate movies directly from Discord with seamless Letterboxd logging
- π Watch History: Keeps track of your viewing history with timestamps and rating data
- π Date Threshold: Configurable time threshold to determine if late-night watches count for the current or previous day
- π Multi-Library Support: Correctly identifies which library a movie was played from, even with duplicates across libraries
- π« Library Exclusion: Exclude specific libraries from notifications (e.g., 4K or Kids libraries)
- Python 3.7+
- A Discord account and a Discord server where you have admin permissions
- A Plex Media Server
- A Letterboxd account
- Clone the repository
git clone https://github.com/nichtlegacy/plexboxd.git
cd plexboxd- Install the required dependencies
pip install -r requirements.txt- Create a
.envfile based on the provided.env.example
cp .env.example .env-
Fill in the required environment variables in the
.envfile (see Configuration section) -
Start the bot
python src/plex_bot.pyPlexboxd now supports running in a Docker container, making it easier to deploy and manage on any system that supports Docker. The official image is available on GitHub Container Registry (GHCR) at ghcr.io/nichtlegacy/plexboxd:latest.
You can run Plexboxd using Docker in two ways: via the docker run command or with a docker-compose.yml file (recommended for easier configuration and persistence).
- Docker installed on your system (Install Docker)
- (Optional) Docker Compose installed for using
docker-compose.yml(Install Docker Compose)
Pull the latest image and run it with your environment variables:
docker run -d \
--name plexboxd \
--restart unless-stopped \
-e DISCORD_TOKEN="your-discord-token" \
-e DISCORD_LOGGING_WEBHOOK_URL="your-webhook-url" \
-e DISCORD_USER_ID="your-user-id" \
-e PLEX_USERNAME="your-plex-username" \
-e PLEX_TOKEN="your-plex-token" \
-e PLEX_SERVER_URL="http://your-plex-server:32400" \
-e EXCLUDED_LIBRARIES="" \
-e NOTIFY_CHANNEL_ID="your-channel-id" \
-e GUILD_ID="your-guild-id" \
-e LETTERBOXD_USERNAME="your-letterboxd-username" \
-e LETTERBOXD_PASSWORD="your-letterboxd-password" \
-e DATE_THRESHOLD_HOUR="7" \
-v /path/to/your/logs:/app/logs \
-v /path/to/your/data:/app/data \
ghcr.io/nichtlegacy/plexboxd:latestReplace /path/to/your/logs and /path/to/your/data with actual paths on your host system (e.g., /mnt/user/appdata/plexboxd/logs and /mnt/user/appdata/plexboxd/data).
Using docker-compose simplifies configuration by allowing you to use a .env file and manage persistent volumes more easily. Below is an example docker-compose.yml:
version: '3.8'
services:
plexboxd:
image: ghcr.io/nichtlegacy/plexboxd:latest
container_name: plexboxd
restart: unless-stopped
env_file:
- .env
volumes:
- ./logs:/app/logs
- ./data:/app/data-
Save the above content in a file named
docker-compose.yml. -
Create a
.envfile in the same directory with the following variables (see Configuration for details):DISCORD_TOKEN=your-discord-token DISCORD_LOGGING_WEBHOOK_URL=your-webhook-url DISCORD_USER_ID=your-user-id PLEX_USERNAME=your-plex-username PLEX_TOKEN=your-plex-token PLEX_SERVER_URL=http://your-plex-server:32400 EXCLUDED_LIBRARIES= NOTIFY_CHANNEL_ID=your-channel-id GUILD_ID=your-guild-id LETTERBOXD_USERNAME=your-letterboxd-username LETTERBOXD_PASSWORD=your-letterboxd-password DATE_THRESHOLD_HOUR=7
-
(Optional, but recommended) Create the
logsanddatadirectories for persistence:mkdir logs data
-
Start the container:
docker-compose up -d
-
To stop it:
docker-compose down
To ensure logs and data (like movie_data.db) persist across container restarts, map the following volumes:
- Logs: Host path (e.g.,
./logs) to container path/app/logs - Data: Host path (e.g.,
./data) to container path/app/data
These mappings are included in the docker-compose.yml example above. Adjust the host paths to suit your system (e.g., /mnt/user/appdata/plexboxd/logs on Unraid).
The .env file contains all the necessary configuration parameters:
DISCORD_TOKEN: Your Discord bot token from the Discord Developer PortalDISCORD_LOGGING_WEBHOOK_URL: Webhook URL for sending logs to a Discord channelNOTIFY_CHANNEL_ID: ID of the Discord channel where movie notifications will be sentGUILD_ID: ID of your Discord serverDISCORD_USER_ID: Your Discord user ID to be notified when a movie is watched
PLEX_USERNAME: Your Plex account usernamePLEX_TOKEN: Your Plex authentication tokenPLEX_SERVER_URL: URL of your Plex server (e.g.,http://192.168.1.100:32400)EXCLUDED_LIBRARIES: Comma-separated list of library names to exclude from notifications (e.g.,4K Movies,Kids Movies)
LETTERBOXD_USERNAME: Your Letterboxd usernameLETTERBOXD_PASSWORD: Your Letterboxd passwordDATE_THRESHOLD_HOUR: Hour (in 24-hour format) to determine the cutoff for assigning movie watch dates (default: 7)
- Go to the Discord Developer Portal
- Create a new application
- Go to the "Bot" tab and create a bot
- Copy the token and add it to your
.envfile
- Enable Developer Mode in Discord (User Settings > Advanced > Developer Mode)
- Right-click on your server icon and select "Copy ID" for the Guild ID
- Right-click on the notification channel and select "Copy ID" for the Channel ID
- Log in to your Plex Web App
- Play any media item
- Right-click anywhere and choose "View Page Source"
- Search for "X-Plex-Token" and copy the token value
π¦ Plexboxd
ββ /data # Stores persistent data
β ββ movie_data.db # Cached movie data and watch history
ββ /logs # Log files directory
β ββ letterboxd_integration.log # Letterboxd integration logs
β ββ plex_bot.log # Main bot logs
ββ /src # Source code
β ββ letterboxd_integration.py # Letterboxd API interaction and logging
β ββ logging_config.py # Logging configuration for the bot
β ββ plex_bot.py # Main bot code and Plex monitoring
β ββ utils.py # Utility functions for Discord embeds
β ββ views.py # Discord UI components (buttons, selects)
ββ .env # Environment variables (sensitive data)
ββ .env.example # Example environment variables file
ββ .gitignore # Git ignore configuration
ββ requirements.txt # Python dependencies
-
Plex Monitoring: The bot connects to your Plex server and periodically checks for recently watched movies.
-
Discord Notifications: When a movie is watched, the bot sends an embed with all necessary movie information to the configured Discord channel.
-
Rating Interface: Each notification includes a dropdown menu to rate the movie directly from Discord.
-
Letterboxd Integration: When you rate a movie, the bot:
- Logs into your Letterboxd account using
requests - Searches for the movie using Selenium (headless)
- Adds it to your diary with the correct date and rating via
requests - Confirms the action with a success message
- Logs into your Letterboxd account using
-
Date Assignment Logic: The bot uses the
DATE_THRESHOLD_HOURsetting to determine if late-night watches count for the current or previous day in your Letterboxd diary.
The bot maintains two primary log files:
-
plex_bot.log
- Bot startup and initialization
- Plex connection status
- Movie detection events
- Discord notification events
- Error messages
-
letterboxd_integration.log
- Letterboxd login attempts
- Movie search operations
- Diary entry creation
- Date assignment decisions
Both logs can also be forwarded to a Discord channel using the DISCORD_LOGGING_WEBHOOK_URL for easier monitoring.
-
Bot can't connect to Plex
- Verify your Plex server is running
- Check your
PLEX_SERVER_URLandPLEX_TOKENin the.envfile - Ensure your firewall allows connections to your Plex server
-
Letterboxd integration fails
- Verify your Letterboxd credentials
- Check if Letterboxd is experiencing downtime
- Ensure you have Chrome installed for Selenium (used for movie search)
-
Discord notifications aren't showing up
- Verify your bot has proper permissions in the Discord server
- Check if the
NOTIFY_CHANNEL_IDis correct - Make sure the bot has access to the notification channel
- Review the log files in the
/logsdirectory for detailed error information - If you've configured Discord logging, check the logging channel for real-time updates
- Your Letterboxd credentials and other sensitive information are stored in the
.envfile. Keep this file secure and never commit it to version control.
Contributions are welcome! Please feel free to submit a Pull Request.
- Plex for providing an excellent media server platform that makes tracking watched movies possible.
- Letterboxd for their movie logging and rating service, which inspired the core integration of this bot.
- Discord for their robust API and bot framework, enabling seamless notifications and interactions.
- PlexAPI - A Python library for interacting with Plex servers, heavily utilized in this project for movie tracking.
- Selenium - Used for headless browser automation to search for movies on Letterboxd.
- discord.py - The backbone of the Discord bot functionality, making embeds and interactive components possible.
This project is not affiliated with or endorsed by Plex, Letterboxd, or Discord. It is an independent tool built for personal use and shared for educational purposes. Use it at your own risk and be respectful of the respective APIs by avoiding excessive requests. The developers are not responsible for any issues arising from misuse, including potential account restrictions by the integrated services.
This project is licensed under the MIT License - see the LICENSE file for details.



