Migration Guide - JohanDevl/Export_Trakt_4_Letterboxd GitHub Wiki
Migration Guide: From Bash to Go (Version 2.0)
This guide helps users prepare for the migration from the current Bash implementation (v1.x) to the upcoming Go implementation (v2.0) of Export_Trakt_4_Letterboxd.
Note: The Go implementation is currently in development for version 2.0. This guide serves as a preview of the changes and improvements that will be available in the new version.
Key Differences (Planned for v2.0)
| Feature | Bash Version (v1.x) | Go Version (v2.0) |
|---|---|---|
| Performance | Good for small datasets | Significantly faster, especially for large datasets |
| Error Handling | Basic | Comprehensive with detailed logging |
| Configuration | .env file | TOML-based configuration |
| Internationalization | Basic with shell scripts | Full support with structured message catalogs |
| API Support | Basic endpoints | Extended API with TV shows, ratings, collections |
| Testing | Bats test suite | Go native testing with high coverage |
| Dependencies | jq, curl, bash | Standalone binary |
| Docker Support | Basic | Multi-platform, CI/CD integrated |
Migration Steps (When v2.0 is Released)
1. Installation
Current Bash Version (v1.x)
git clone https://github.com/JohanDevl/Export_Trakt_4_Letterboxd.git
cd Export_Trakt_4_Letterboxd
chmod +x Export_Trakt_4_Letterboxd.sh setup_trakt.sh
Future Go Version (v2.0)
# Option 1: Download pre-built binary
curl -L https://github.com/JohanDevl/Export_Trakt_4_Letterboxd/releases/latest/download/export-trakt-[platform].tar.gz -o export-trakt.tar.gz
tar -xzf export-trakt.tar.gz
chmod +x export-trakt
# Option 2: Build from source
git clone https://github.com/JohanDevl/Export_Trakt_4_Letterboxd.git
cd Export_Trakt_4_Letterboxd
git checkout v2.0 # Switch to Go implementation branch
go build -o export-trakt ./cmd/export_trakt
2. Configuration
Current Bash Version (v1.x)
Configuration is stored in a .config.cfg file:
# Trakt.tv API credentials
CLIENT_ID="your_trakt_client_id"
CLIENT_SECRET="your_trakt_client_secret"
# Export settings
EXPORT_DIR="./copy"
BACKUP_DIR="./backup"
Future Go Version (v2.0)
Configuration will be stored in a TOML file (config/config.toml):
# Trakt.tv API Configuration
[trakt]
client_id = "your_trakt_client_id"
client_secret = "your_trakt_client_secret"
redirect_uri = "urn:ietf:wg:oauth:2.0:oob"
token_file = "./config/token.json"
timeout = 30
max_retries = 3
rate_limit = 60
extended_info = "full"
# Export Configuration
[export]
output_dir = "./exports"
mode = "normal" # normal, complete, initial
include_watchlist = true
include_collections = false
include_ratings = true
min_rating = 0
keep_temp_files = false
# Letterboxd Export Configuration
[letterboxd]
export_dir = "./exports"
watched_filename = "" # Optional, uses auto-generated filename if empty
collection_filename = "" # Optional, uses auto-generated filename if empty
# Logging Configuration
[logging]
level = "info" # debug, info, warn, error
file = "./logs/export.log"
max_size = 10
max_files = 3
console = true
color = true
# Internationalization Settings
[i18n]
language = "en" # en, fr
locales_dir = "./locales"
3. Running the Application
Current Bash Version (v1.x)
./Export_Trakt_4_Letterboxd.sh [option]
# Options: normal (default), initial, complete
Future Go Version (v2.0)
# Run with default settings
./export-trakt
# Run with specific options
./export-trakt export --mode complete --include-collections
4. Docker Usage
Current Bash Version (v1.x)
docker run -it --name trakt-export \
-v $(pwd)/config:/app/config \
-v $(pwd)/copy:/app/copy \
-v $(pwd)/backup:/app/backup \
johandevl/export-trakt-4-letterboxd:latest
Future Go Version (v2.0)
docker run -it --name trakt-export \
-v $(pwd)/config:/app/config \
-v $(pwd)/logs:/app/logs \
-v $(pwd)/exports:/app/exports \
johandevl/export-trakt-4-letterboxd:v2.0
Breaking Changes (Expected in v2.0)
1. Command-line Interface
The Go version will use a more structured command-line interface with commands and flags:
# Current Bash version (v1.x)
./Export_Trakt_4_Letterboxd.sh complete
# Future Go version (v2.0)
./export-trakt export --mode complete
2. Authentication Flow
The Go version will use a standard OAuth 2.0 flow:
# Initialize authentication
./export-trakt auth init
# Check auth status
./export-trakt auth status
# Refresh token
./export-trakt auth refresh
3. Output Directory Structure
The Go version will use a more organized output directory structure, with exports going to the configured export directory by default.
4. Configuration Format
The TOML configuration format will be more structured and provide more options.
New Features Planned for v2.0
1. Extended Export Options
The Go version will add support for:
- Exporting movie collections
- Exporting TV shows (for reference)
- Filtering by rating threshold
- More detailed export formats
2. Command Structure
The Go version will include several commands:
# Run the export
./export-trakt export
# Set up configuration
./export-trakt setup
# Manage authentication
./export-trakt auth [init|status|refresh|revoke]
# Validate configuration
./export-trakt validate
# Display information
./export-trakt info [account|stats|system|version]
3. Internationalization
The Go version will support more languages and use a structured message catalog system:
# Run with specific language
./export-trakt --language fr
4. Enhanced Logging
The Go version will include better logging with different levels and file rotation:
# Run with debug logging
./export-trakt --log-level debug
Migration FAQ
Q: Can I use my existing Trakt.tv credentials?
A: Yes, you can use the same Client ID and Client Secret, but you'll need to re-authenticate with the new flow.
Q: Are the export files compatible?
A: Yes, both versions produce Letterboxd-compatible CSV files. The Go version includes more metadata and additional export types.
Q: Do I need to install Go to use the Go version?
A: No, you can download the pre-built binary or use the Docker image.
Q: What happened to my existing tokens?
A: The Go version uses a different token storage format. You'll need to re-authenticate.
Q: How do I migrate my customizations?
A: The Go version will offer more configuration options in the TOML file. Review the Configuration documentation.
Getting Help
If you encounter issues during migration:
- Check the detailed logs in the
logsdirectory - Run with
--log-level debugfor more information - Check the Trakt API Guide for API details
- Open an issue on GitHub with details about your problem