Skip to content

notactuallytreyanastasio/archive_tv

Repository files navigation

Archive TV Station

A 24/7 TV station that broadcasts Archive.org content with OBS Studio integration, automatic scheduling, commercial breaks, and a satirical news ticker.

Built for the markpines collection - rare Ron Wood footage and rock history archives.

Features

  • Video Browser - Search and browse 1,344 videos from Archive.org
  • Playlist Management - Create playlists and generate broadcast schedules
  • OBS Integration - WebSocket control for seamless video playback
  • Commercial Breaks - Automatic breaks between videos with custom video support
  • News Ticker (Chyron) - Scrolling satirical headlines from The Onion
  • Twitch/YouTube Streaming - One-click streaming to your platform
  • Download Manager - Queue and manage video downloads
  • Schedule Generator - Auto-generate schedules with configurable commercial intervals

Quick Start

# Clone and setup
git clone https://github.com/yourusername/archive_tv.git
cd archive_tv
make setup

# Start the web UI and API
make dev

# Open http://localhost:5173

Prerequisites

  • Node.js >= 20.0.0
  • pnpm >= 9.0.0
  • OBS Studio 28+ (includes WebSocket server)

Installation

# Install dependencies and sync video metadata
make setup

This syncs metadata for 1,344 videos from Archive.org (~2 minutes). Video files download on-demand.

Usage

1. Browse Videos

Open http://localhost:5173 to browse and search videos.

2. Create a Playlist

  1. Navigate to Playlists in the web UI
  2. Create a new playlist
  3. Add videos from the browse page

3. Generate a Schedule

# Via API
curl -X POST http://localhost:3001/api/schedules \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Schedule",
    "playlistId": "your-playlist-id",
    "config": {
      "commercialInterval": 30,
      "commercialDuration": 60
    }
  }'

4. Setup OBS

See docs/OBS_SETUP.md for detailed instructions.

Quick setup:

  1. Enable WebSocket Server in OBS (Tools → WebSocket Server Settings)
  2. Create a Main scene with a Video Player media source
  3. Optionally add a Chyron text source for news ticker

5. Run the Station

# Set your schedule ID and start
SCHEDULE_ID=your-schedule-id make station

6. Start Streaming

The station will play videos through OBS. To stream to Twitch/YouTube:

  1. Configure your stream key in OBS Settings → Stream
  2. Set AUTO_STREAM=true in .env, or
  3. Use the web UI at http://localhost:5173/station

Architecture

archive_tv/
├── packages/
│   ├── database/         # SQLite + Drizzle ORM
│   ├── archive-client/   # Archive.org API client
│   ├── downloader/       # Video download manager
│   ├── scheduler/        # Playlist + schedule generation
│   ├── obs-controller/   # OBS WebSocket integration
│   └── chyron/           # Headline scraper (The Onion)
├── apps/
│   ├── server/           # Hono REST API (port 3001)
│   ├── web/              # React SPA (port 5173)
│   └── station-runner/   # Orchestration daemon
└── data/
    ├── archive-tv.db     # SQLite database
    └── videos/           # Downloaded videos

Configuration

Copy .env.example to .env and configure:

# Server
PORT=3001
DB_PATH=./data/archive-tv.db

# OBS Connection
OBS_HOST=localhost
OBS_PORT=4455
OBS_PASSWORD=your-password

# OBS Sources (must match your OBS setup)
OBS_MAIN_SCENE=Main
OBS_MEDIA_SOURCE=Video Player

# Commercial Video (optional)
COMMERCIAL_VIDEO_PATH=/path/to/commercial.mkv

# Chyron (optional)
CHYRON_SOURCE_NAME=Chyron
CHYRON_INTERVAL=10

API Reference

Method Endpoint Description
GET /api/videos List/search videos
GET /api/videos/:id Video detail
POST /api/downloads Queue download
GET /api/playlists List playlists
POST /api/playlists Create playlist
POST /api/schedules Generate schedule
GET /api/chyron/headlines Get headlines
POST /api/station/stream/start Start streaming

See full API documentation in docs/API.md.

Development

# Start dev servers
make dev

# Run tests
make test

# Lint and format
make lint
make format

# Build all packages
make build

Documentation

Troubleshooting

OBS Connection Failed

  • Ensure OBS is running with WebSocket server enabled
  • Check port 4455 is not blocked
  • Verify password matches (if set)

Video Won't Play

  • Ensure video is downloaded: ls data/videos/
  • Check media source name matches exactly: "Video Player"
  • Review OBS logs: View → Logs

Chyron Not Showing

  • Source name must match exactly (case-sensitive)
  • Ensure headlines exist: curl http://localhost:3001/api/chyron/headlines
  • Load classic headlines: curl -X POST http://localhost:3001/api/chyron/load-classics

Tech Stack

  • Runtime: Node.js 20+
  • Package Manager: pnpm + Turborepo
  • Database: SQLite + Drizzle ORM
  • API: Hono
  • Frontend: React + Vite + Tailwind CSS + React Query
  • OBS: obs-websocket-js v5
  • Streaming: Twitch/YouTube via OBS

License

MIT

Credits

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors