Export Trakt 4 Letterboxd

π¬ Seamlessly export your Trakt.tv movie data to Letterboxd-compatible CSV files
A robust, modern Go application that enables you to migrate your Trakt.tv movie ratings, watchlist, and viewing history to Letterboxd with ease. Built with enterprise-grade reliability and featuring comprehensive internationalization support.
β¨ Key Features
- π― Complete Data Export: Export ratings, watchlist, watch history, and collections
- π Letterboxd Optimized: Native support for Letterboxd's import format
- π Automatic Scheduling: Set up cron-based automated exports
- π Internationalization: Full i18n support (English, French, German, Spanish)
- π³ Docker Ready: Multi-platform Docker images (amd64, arm64, armv7)
- π High Performance: Built with Go 1.22+ for optimal speed and reliability
- π Security First: Token-based authentication with secure credential handling
- π Comprehensive Logging: Detailed logging with configurable levels
- π§ͺ Well Tested: 78%+ test coverage across all core packages
- βοΈ Highly Configurable: Extensive configuration options via TOML
π Quick Start
Option 1: Docker (Recommended)
Simple one-time export:
# Pull and run directly from Docker Hub
docker run --rm -it \
-v $(pwd)/config:/app/config \
-v $(pwd)/logs:/app/logs \
-v $(pwd)/exports:/app/exports \
johandevl/export-trakt-4-letterboxd:latest
Using Docker Compose:
# Clone the repository
git clone https://github.com/JohanDevl/Export_Trakt_4_Letterboxd.git
cd Export_Trakt_4_Letterboxd
# Interactive setup (first time)
docker compose --profile setup up
# Run export
docker compose --profile run-all up
# For scheduled exports (every 6 hours)
docker compose --profile schedule-6h up -d
Option 2: Local Installation
Prerequisites:
Installation:
# Clone and build
git clone https://github.com/JohanDevl/Export_Trakt_4_Letterboxd.git
cd Export_Trakt_4_Letterboxd
go build -o export_trakt ./cmd/export_trakt/
# Copy and configure
cp config/config.example.toml config/config.toml
# Edit config/config.toml with your Trakt.tv credentials
# Run
./export_trakt --run --export all --mode complete
βοΈ Configuration
1. Trakt.tv API Setup
- Go to Trakt.tv API Applications
- Create a new application
- Note your
Client ID and Client Secret
- Generate an access token
2. Configuration File
Copy the example configuration and customize:
cp config/config.example.toml config/config.toml
Essential settings:
[trakt]
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
access_token = "YOUR_ACCESS_TOKEN"
extended_info = "letterboxd" # For optimal Letterboxd compatibility
[export]
format = "csv"
date_format = "2006-01-02"
[logging]
level = "info"
file = "logs/export.log"
π― Usage Examples
Command Line Interface
# Complete export of all data
./export_trakt --run --export all --mode complete
# Export only watched movies
./export_trakt --run --export watched --mode normal
# Validate configuration
./export_trakt validate
# Schedule automated exports (every 6 hours)
./export_trakt --schedule "0 */6 * * *" --export all --mode complete
Docker Compose Profiles
# PRODUCTION WORKFLOWS
# Daily automated exports at 2:30 AM
docker compose --profile schedule-daily up -d
# Every 6 hours (recommended for active users)
docker compose --profile schedule-6h up -d
# One-time complete export
docker compose --profile run-all up
# DEVELOPMENT/TESTING
# Test with local build (every 2 minutes)
docker compose --profile dev --profile schedule-test up -d --build
# Run watched movies only (testing)
docker compose --profile dev --profile run-watched up --build
# Interactive setup
docker compose --profile dev --profile setup up --build
Environment Variables
# Custom scheduling
SCHEDULE="0 4 * * *" docker compose --profile schedule-custom up -d
# Different export types
EXPORT_TYPE="watched" EXPORT_MODE="normal" docker compose --profile schedule-custom up -d
# Timezone configuration
TZ="America/New_York" docker compose --profile schedule-daily up -d
π Project Structure
Export_Trakt_4_Letterboxd/
βββ cmd/export_trakt/ # π― Main application entry point
βββ pkg/ # π¦ Core packages
β βββ api/ # π Trakt.tv API client
β βββ config/ # βοΈ Configuration management
β βββ export/ # π Export functionality
β βββ i18n/ # π Internationalization
β βββ logger/ # π Logging system
β βββ scheduler/ # β° Cron scheduler
βββ internal/ # π Private application code
β βββ models/ # ποΈ Data models
β βββ utils/ # π οΈ Private utilities
βββ locales/ # π£οΈ Translation files
βββ config/ # π Configuration files
βββ scripts/ # π Build and utility scripts
βββ .github/workflows/ # π€ CI/CD workflows
βββ docker/ # π³ Docker configurations
π Export Modes
| Mode |
Description |
Use Case |
normal |
Basic export with essential data |
Quick exports, testing |
complete |
Full export with all metadata |
Production use, complete migration |
initial |
First-time setup export |
Initial Letterboxd migration |
π Export Types
| Type |
Content |
Letterboxd Import |
watched |
Rated movies and viewing dates |
β
Ratings & History |
watchlist |
Movies in your watchlist |
β
Watchlist |
collection |
Collected movies |
β
Custom Lists |
shows |
TV show data |
β οΈ Limited support |
all |
Everything above |
β
Complete migration |
π― Watch History Modes
The watched export type supports two distinct modes:
| Mode |
Behavior |
CLI Usage |
aggregated |
One entry per movie (original behavior) |
--history-mode aggregated |
individual |
One entry per viewing event |
--history-mode individual |
Individual Mode Benefits:
- π
Complete viewing history with all dates
- π Accurate rewatch tracking (chronological order)
- π Multiple entries for rewatched movies
- β° Preserves exact viewing timestamps
Example:
# Get complete viewing history (all watch events)
./export_trakt --run --export watched --history-mode individual
# Standard export (one entry per movie)
./export_trakt --run --export watched --history-mode aggregated
π Internationalization
Supported languages:
- πΊπΈ English (
en) - Default
- π«π· French (
fr)
- π©πͺ German (
de)
- πͺπΈ Spanish (
es)
Configure in config.toml:
[i18n]
language = "fr" # Change to your preferred language
π
Scheduling
Cron Schedule Examples
# Every 5 minutes (testing)
*/5 * * * *
# Every hour
0 * * * *
# Daily at 4 AM
0 4 * * *
# Weekly on Sunday at 4 AM
0 4 * * 0
# Monthly on the 1st at 4 AM
0 4 1 * *
Production Recommendations
- Active users: Every 6 hours (
0 */6 * * *)
- Regular users: Daily (
0 4 * * *)
- Occasional users: Weekly (
0 4 * * 0)
π§ͺ Testing
Running Tests
# Run all tests
go test -v ./...
# Generate coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Run coverage script
./scripts/coverage.sh
Test Coverage
| Package |
Coverage |
| API Client |
73.3% |
| Config Management |
85.4% |
| Export Functionality |
78.3% |
| Internationalization |
81.6% |
| Logging System |
97.7% |
| Overall |
78%+ |
π³ Docker
Available Images
- GitHub Container Registry:
ghcr.io/johandevl/export_trakt_4_letterboxd
- Docker Hub:
johandevl/export-trakt-4-letterboxd
linux/amd64 (x86_64)
linux/arm64 (ARM 64-bit)
linux/arm/v7 (ARM 32-bit)
latest - Latest stable release
v2.x.x - Specific version tags
main - Latest development build
π οΈ Development
Building from Source
# Development build
go build -o export_trakt ./cmd/export_trakt/
# Production build with optimization
go build -ldflags "-w -s" -o export_trakt ./cmd/export_trakt/
# Cross-compilation
GOOS=linux GOARCH=amd64 go build -o export_trakt-linux ./cmd/export_trakt/
Docker Development
# Build local image
docker build -t export-trakt-dev .
# Run development container
docker compose --profile dev --profile run-all up --build
π§ Troubleshooting
Common Issues
Authentication Errors
# Check your credentials
./export_trakt validate
# Test API connection
curl -H "Authorization: Bearer YOUR_TOKEN" https://api.trakt.tv/users/me
Docker Issues
# Check logs
docker compose logs -f
# Reset everything
docker compose down -v
docker system prune -f
Export Problems
# Enable debug logging
# In config.toml: level = "debug"
# Check export directory permissions
ls -la exports/
# Verify Trakt.tv profile is public
Log Analysis
# View recent logs
tail -f logs/export.log
# Search for errors
grep "ERROR" logs/export.log
# Monitor in real-time
docker compose --profile schedule-6h logs -f | grep ERROR
π Documentation
Complete documentation available in our Wiki:
π€ Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Fork and clone
git clone https://github.com/YOUR_USERNAME/Export_Trakt_4_Letterboxd.git
cd Export_Trakt_4_Letterboxd
# Create feature branch
git checkout -b feature/amazing-feature
# Make changes and test
go test ./...
docker compose --profile dev --profile run-all up --build
# Commit and push
git commit -m "feat: add amazing feature"
git push origin feature/amazing-feature
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgements
This project is based on the original work by u2pitchjami. Special thanks to the original author for creating the foundation that made this project possible.
Original repository: https://github.com/u2pitchjami/Export_Trakt_4_Letterboxd
π¨βπ» Author
JohanDevl
π Support
If you find this project helpful, please consider:
- β Starring the repository
- π Reporting bugs or requesting features
- π€ Contributing code or documentation
- π¬ Sharing with the community