Metadata-Version: 2.4
Name: myplaylist
Version: 0.1.0
Summary: Generate and play music playlists from natural language prompts or seed songs
Author: eddie
License: MIT
Project-URL: Homepage, https://github.com/eddie/autoplaylist
Project-URL: Repository, https://github.com/eddie/autoplaylist
Keywords: music,playlist,cli,youtube,lastfm,mpv
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: typer>=0.12
Requires-Dist: rich>=13
Requires-Dist: yt-dlp>=2024.1.1
Requires-Dist: pylast>=5.2
Provides-Extra: gemini
Requires-Dist: google-generativeai>=0.8; extra == "gemini"

# myplaylist

[![PyPI version](https://img.shields.io/pypi/v/myplaylist.svg)](https://pypi.org/project/myplaylist/)
[![Python versions](https://img.shields.io/pypi/pyversions/myplaylist.svg)](https://pypi.org/project/myplaylist/)

Generate and play music playlists in your terminal from natural language prompts or seed songs.

## Features

- **Natural language prompts**: `myplaylist new "下雨天的 lo-fi jazz"`
- **Seed songs**: `myplaylist new --seed "Norah Jones - Come Away With Me"`
- **Terminal playback** via mpv with a rich TUI (pause / skip / lyrics marquee)
- **Local persistence** at `~/.myplaylist/playlists/`
- **Export** to `.m3u`, `.csv`, or `.json`
- **Zero-config LLM**: uses your existing Claude subscription via `claude -p`

## Requirements

- Python 3.9+
- [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) (`claude`) — for natural language mode
- macOS or Linux

## Installation

### Option 1 — curl one-liner (recommended)

```bash
curl -fsSL https://raw.githubusercontent.com/eddie/autoplaylist/main/install.sh | bash
```

The script will:
1. Detect macOS / Linux
2. Check for Python 3.9+
3. Install `pipx` if missing (and guide PATH setup)
4. Install `myplaylist` via `pipx`
5. Install `mpv` (Homebrew on macOS, apt on Linux)

### Option 2 — Homebrew tap

```bash
brew tap eddie/myplaylist
brew install myplaylist
```

### Option 3 — pipx (manual)

```bash
pipx install myplaylist
```

> mpv is required for playback. Install it separately if needed:
> - macOS: `brew install mpv`
> - Linux: `sudo apt-get install mpv`

On first run, `myplaylist` will walk you through the optional Last.fm API key setup.

## Quick Start

```bash
# Natural language prompt
myplaylist new "rainy day lo-fi jazz for working"

# Seed song
myplaylist new --seed "Norah Jones - Come Away With Me"

# Seed from YouTube URL
myplaylist new --seed "https://www.youtube.com/watch?v=..."

# Custom track count and name
myplaylist new "chill beats" --count 20 --name my-chill-list
```

## Commands

| Command | Description |
|---|---|
| `myplaylist new "<prompt>"` | Generate playlist from natural language |
| `myplaylist new --seed "<song>"` | Generate playlist from seed song |
| `myplaylist list` | List all saved playlists |
| `myplaylist show <name>` | Show track listing |
| `myplaylist play <name>` | Play in terminal |
| `myplaylist export <name> --format m3u\|csv\|json` | Export playlist |
| `myplaylist delete <name>` | Delete a playlist |
| `myplaylist setup` | Re-run first-time setup |

## Playback Controls

| Key | Action |
|---|---|
| `p` | Pause / resume |
| `n` | Skip to next track |
| `↑ / ↓` | Move cursor up / down |
| `← / →` | Page up / page down |
| `Enter` | Jump to selected track |
| `q` | Quit |

## Last.fm (optional)

Last.fm integration improves similar-song quality. Get a free API key at <https://www.last.fm/api/account/create> and enter it during first-run setup. You can skip this and run in yt-dlp-only mode.

## Data Storage

```
~/.myplaylist/
  config.json          # API keys and settings
  playlists/
    <name>.json        # Saved playlists
```

## Uninstall

```bash
# If installed via pipx or the install.sh script:
pipx uninstall myplaylist

# If installed via Homebrew tap:
brew uninstall myplaylist
brew untap eddie/myplaylist
```

## Running Tests

```bash
pip install pytest
pytest tests/                     # smoke tests (no network)
pytest tests/ -m slow             # include integration tests (requires network)
```
