272 lines
5.8 KiB
Markdown
272 lines
5.8 KiB
Markdown
# Blog Scripts
|
|
|
|
Automation scripts for The Double Lunch Dispatch blog.
|
|
|
|
## Quick Start
|
|
|
|
### Install Dependencies
|
|
|
|
```bash
|
|
# Create virtual environment (if not already done)
|
|
python3 -m venv .venv
|
|
|
|
# Activate it
|
|
source .venv/bin/activate
|
|
|
|
# Install dependencies
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### Required: TMDB API Key
|
|
|
|
All movie scripts require a TMDB API key.
|
|
|
|
```bash
|
|
# Copy the example config
|
|
cp scripts/config.example.py scripts/config.py
|
|
|
|
# Edit and add your TMDB API key
|
|
# Get one at: https://www.themoviedb.org/settings/api
|
|
```
|
|
|
|
## Scripts Overview
|
|
|
|
### National Film Registry (NFR) Series
|
|
|
|
**"Found in the Darkroom"** - A series covering the National Film Registry
|
|
|
|
#### Setup NFR Data (New!)
|
|
|
|
Automatically fetch and setup data for any NFR year:
|
|
|
|
```bash
|
|
# Setup data for a specific year
|
|
python3 scripts/setup_nfr.py 2023
|
|
|
|
# With a known URL
|
|
python3 scripts/setup_nfr.py 2015 --url "https://newsroom.loc.gov/news/..."
|
|
|
|
# See full documentation
|
|
cat scripts/NFR_AUTOMATION.md
|
|
```
|
|
|
|
#### Create NFR Movie Post
|
|
|
|
Create a blog post for an NFR movie:
|
|
|
|
```bash
|
|
# List 2024 NFR films
|
|
python3 scripts/new_nfr.py --list-2024
|
|
|
|
# Create post by title
|
|
python3 scripts/new_nfr.py "No Country for Old Men"
|
|
|
|
# Create post by IMDB ID
|
|
python3 scripts/new_nfr.py tt0477348
|
|
|
|
# Specify NFR year
|
|
python3 scripts/new_nfr.py "Terminator 2" --nfr-year 2023
|
|
```
|
|
|
|
### Regular Movie Posts
|
|
|
|
**"Frank's Couch"** - Owen's dad from TV Glow who watches TV
|
|
|
|
#### Create Movie Post
|
|
|
|
Create a new movie post from IMDB ID:
|
|
|
|
```bash
|
|
# From IMDB ID
|
|
python3 scripts/new_movie.py tt1234567
|
|
|
|
# From IMDB URL
|
|
python3 scripts/new_movie.py https://www.imdb.com/title/tt1234567/
|
|
```
|
|
|
|
#### Import from Letterboxd
|
|
|
|
Import movies from your Letterboxd diary:
|
|
|
|
```bash
|
|
# Interactive mode - pick from recent
|
|
python3 scripts/import_letterboxd.py
|
|
|
|
# Import most recent entry
|
|
python3 scripts/import_letterboxd.py --latest
|
|
|
|
# Just list recent entries
|
|
python3 scripts/import_letterboxd.py --list
|
|
|
|
# Skip to theater/home questions
|
|
python3 scripts/import_letterboxd.py --theater
|
|
python3 scripts/import_letterboxd.py --home
|
|
```
|
|
|
|
#### Update Movie Metadata
|
|
|
|
Fetch and update movie metadata (poster, director, runtime, etc.):
|
|
|
|
```bash
|
|
# Update all posts with IMDB IDs
|
|
python3 scripts/fetch_movie_data.py
|
|
|
|
# Dry run (preview changes)
|
|
python3 scripts/fetch_movie_data.py --dry-run
|
|
|
|
# Force re-fetch even if data exists
|
|
python3 scripts/fetch_movie_data.py --force
|
|
```
|
|
|
|
### Beer Posts
|
|
|
|
#### Add Beer Call Entry
|
|
|
|
Add entries to the beer call yearly log:
|
|
|
|
```bash
|
|
# Interactive mode
|
|
python3 scripts/new_beercall.py
|
|
|
|
# Specific date
|
|
python3 scripts/new_beercall.py --date 2024-12-19
|
|
|
|
# List recent Untappd checkins
|
|
python3 scripts/new_beercall.py --list
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
### Ollama (for NFR automation)
|
|
|
|
```bash
|
|
# Ollama server (default: http://192.168.0.109:11434)
|
|
export OLLAMA_HOST=http://localhost:11434
|
|
|
|
# Model to use (default: llama3.2)
|
|
export OLLAMA_MODEL=llama3.2
|
|
```
|
|
|
|
## Common Workflows
|
|
|
|
### Creating an NFR Movie Post
|
|
|
|
```bash
|
|
# 1. Create the post
|
|
python3 scripts/new_nfr.py "Beverly Hills Cop"
|
|
|
|
# 2. Update metadata (director, runtime, etc.)
|
|
python3 scripts/fetch_movie_data.py
|
|
|
|
# 3. Edit the post
|
|
# - Add viewing details (format, rating)
|
|
# - Write your thoughts
|
|
# - Add Letterboxd URL
|
|
|
|
# 4. Build and preview
|
|
hugo server -D
|
|
|
|
# 5. Publish (remove draft: true)
|
|
```
|
|
|
|
### Importing Theater Movie from Letterboxd
|
|
|
|
```bash
|
|
# 1. Import from Letterboxd
|
|
python3 scripts/import_letterboxd.py --theater
|
|
|
|
# 2. Script will:
|
|
# - Fetch recent Letterboxd entries
|
|
# - Let you pick one
|
|
# - Ask for theater details (venue, time, crew, etc.)
|
|
# - Download poster from TMDB
|
|
# - Create draft post
|
|
|
|
# 3. Edit and publish
|
|
```
|
|
|
|
### Setting Up a New NFR Year
|
|
|
|
```bash
|
|
# 1. Find the LOC announcement URL for the year
|
|
# Example: https://newsroom.loc.gov/news/...
|
|
|
|
# 2. Run setup script (with ollama for best results)
|
|
python3 scripts/setup_nfr.py 2023 --url "https://newsroom.loc.gov/..."
|
|
|
|
# 3. Review generated file
|
|
cat scripts/nfr_data/nfr_2023.py
|
|
|
|
# 4. Integrate into new_nfr.py
|
|
# (Copy the dictionary into the main script)
|
|
|
|
# 5. Start creating posts!
|
|
python3 scripts/new_nfr.py "Terminator 2" --nfr-year 2023
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### "Module not found" errors
|
|
|
|
```bash
|
|
# Make sure venv is activated
|
|
source .venv/bin/activate
|
|
|
|
# Install/reinstall dependencies
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### "TMDB API key" errors
|
|
|
|
```bash
|
|
# Check config exists
|
|
ls scripts/config.py
|
|
|
|
# If not, copy example and edit
|
|
cp scripts/config.example.py scripts/config.py
|
|
# Then add your API key
|
|
```
|
|
|
|
### Ollama connection errors
|
|
|
|
```bash
|
|
# Test ollama server
|
|
curl http://192.168.0.109:11434/api/tags
|
|
|
|
# Use --no-ollama flag to skip
|
|
python3 scripts/setup_nfr.py 2023 --no-ollama
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- **NFR Automation**: `scripts/NFR_AUTOMATION.md` - Detailed guide for NFR automation with ollama
|
|
- **Config Example**: `scripts/config.example.py` - Template for API keys
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
scripts/
|
|
├── README.md # This file
|
|
├── NFR_AUTOMATION.md # NFR automation guide
|
|
├── config.example.py # Config template
|
|
├── config.py # Your config (gitignored)
|
|
├── nfr_data/ # Generated NFR data
|
|
│ ├── nfr_2023.py
|
|
│ └── nfr_2024.py
|
|
├── venues.json # Beer venue database
|
|
│
|
|
├── setup_nfr.py # Setup NFR year data
|
|
├── new_nfr.py # Create NFR movie post
|
|
├── new_movie.py # Create movie post
|
|
├── import_letterboxd.py # Import from Letterboxd
|
|
├── fetch_movie_data.py # Update movie metadata
|
|
├── new_beercall.py # Add beer call entry
|
|
└── new_techpost.py # Create tech post
|
|
```
|
|
|
|
## Getting Help
|
|
|
|
- Check the specific script's `--help`: `python3 scripts/new_nfr.py --help`
|
|
- Read `NFR_AUTOMATION.md` for NFR details
|
|
- Check error messages - they usually point to the issue
|