Posters (the downloaded bytes, per size, 30 days, at most 200 MB) and casts (people.json, 7 days, at most 2000) are stored in the user's cache directory (os.UserCacheDir()/arr-tui) and used on the next start before asking the servers. Expired posters are pruned at startup, casts are written shortly after new ones arrive and on exit. Tests turn the cache off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
233 lines
30 KiB
Markdown
233 lines
30 KiB
Markdown
# arr-tui — Specification
|
||
|
||
A terminal UI to search for movies and series, add them to Radarr / Sonarr, and watch the downloads progress in SABnzbd.
|
||
|
||
- **Language:** Go
|
||
- **TUI library:** [tview](https://github.com/rivo/tview) (on top of tcell)
|
||
- **License:** MIT
|
||
- **Module:** `git.stinnesbeck.com/nils/arr-tui`
|
||
- **Status:** M10 done
|
||
|
||
## 1. Goals
|
||
|
||
1. Search for movies (Radarr) and series (Sonarr) from one place.
|
||
2. Add a result to Radarr/Sonarr with sensible defaults (quality profile, root folder, monitored) and trigger a search so it gets downloaded.
|
||
3. Show the SABnzbd queue and history with live progress.
|
||
4. Be fast and keyboard-driven; usable over SSH.
|
||
|
||
### Non-goals (for now)
|
||
- Managing indexers, download clients, or Radarr/Sonarr settings.
|
||
- Replacing the Radarr/Sonarr web UIs for library management.
|
||
- Torrent clients (SABnzbd / Usenet only).
|
||
- Multi-user / auth beyond API keys.
|
||
|
||
## 2. How the pieces fit together
|
||
|
||
```
|
||
┌────────────┐ lookup / add / release search ┌──────────┐
|
||
│ │ ────────────────────────────────▶ │ Radarr │──┐
|
||
│ arr-tui │ └──────────┘ │ sends NZB
|
||
│ │ ────────────────────────────────▶ ┌──────────┐ │
|
||
│ │ │ Sonarr │──┤
|
||
└─────┬──────┘ └──────────┘ │
|
||
│ queue / history / pause / resume ▼
|
||
└────────────────────────────────────────▶ ┌──────────────┐
|
||
│ SABnzbd │
|
||
└──────────────┘
|
||
```
|
||
|
||
Radarr/Sonarr are expected to already have SABnzbd configured as their download client. arr-tui talks to all three APIs directly; it does **not** send NZBs to SABnzbd itself, except possibly via the manual-release flow, which still goes through Radarr/Sonarr (see 4.3).
|
||
|
||
## 3. External APIs
|
||
|
||
| Service | API | Auth | Endpoints used |
|
||
|---|---|---|---|
|
||
| Radarr | v3 REST (JSON) | `X-Api-Key` header | `GET /api/v3/movie/lookup?term=`, `GET /api/v3/movie`, `POST /api/v3/movie`, `GET /api/v3/qualityprofile`, `GET /api/v3/rootfolder`, `GET /api/v3/queue`, `GET /api/v3/release?movieId=`, `POST /api/v3/release`, `POST /api/v3/command` (`MoviesSearch`), `GET /api/v3/system/status` |
|
||
| Sonarr | v3 REST (JSON) | `X-Api-Key` header | `GET /api/v3/series/lookup?term=`, `GET /api/v3/series`, `POST /api/v3/series`, `GET /api/v3/qualityprofile`, `GET /api/v3/rootfolder`, `GET /api/v3/queue`, `GET /api/v3/release?episodeId=` / `?seriesId=&seasonNumber=`, `POST /api/v3/release`, `POST /api/v3/command` (`SeriesSearch`, `SeasonSearch`, `EpisodeSearch`), `GET /api/v3/system/status` |
|
||
| SABnzbd | `/api?mode=...&output=json` | `apikey` query param | `mode=queue`, `mode=history`, `mode=pause` / `resume`, `mode=queue&name=delete`, `mode=version` |
|
||
|
||
Notes:
|
||
- Endpoint shapes should be verified against each instance's own Swagger / the official docs when implementing; Radarr and Sonarr occasionally change fields between versions.
|
||
- Lookup results include an `id` of `0` when the item is not yet in the library; a non-zero `id` means it is already added. We use this to show an "in library" badge.
|
||
|
||
## 4. Features
|
||
|
||
### 4.1 MVP (v0.1)
|
||
|
||
- **Config:** load URLs + API keys from a config file; fail with a clear message if missing or unreachable.
|
||
- **Search:** a Movies view (Radarr) and a Series view (Sonarr), each with a search box. Results list with title, year, rating, status, and an "in library" marker. Detail pane with overview, runtime, genres, network/studio.
|
||
- **Add:** from a result, open a small form: quality profile, root folder, monitored (yes/no), "search now" (yes/no); for series also monitor mode (all / future / first season / none). Submit calls `POST /movie` or `POST /series` with `addOptions.searchForMovie` / `searchForMissingEpisodes`.
|
||
- **Interactive release search:** for a movie (or a series' season/episode) in the library, list releases from indexers (`GET /release`) with title, indexer, size, quality, age, and rejection reasons; sort/filter; grab a chosen one (`POST /release`). Rejected releases can be grabbed only after an explicit confirmation. The list can be filtered by quality, codec (x265/x264/AV1), HDR/DV/SDR, audio format and language; releases carry no media info, so codec and HDR are read from the title, quality and custom formats (a release that does not name its codec never matches a codec filter).
|
||
- **Downloads view:** all downloads and queues in one place, auto-refreshing every few seconds:
|
||
- SABnzbd queue (name, size, progress, ETA, speed) and history (completed / failed, with retry).
|
||
- Radarr and Sonarr queues (status, warnings, import errors), so stuck imports are visible.
|
||
- Global speed / pause state in the status bar. Pause/resume and delete a SABnzbd job.
|
||
- **Status bar / help:** the bottom bar lists the keys that work in the current view or panel; the top right shows the connection state of each service; `F9` opens the full key reference.
|
||
- **Posters:** the detail panes show the poster at the top right; the head (title, facts, path) and the plot are one text that flows along the poster's left side and continues at full width below it (text is wrapped by arr-tui itself, with a narrower width for the first lines); on panes too small for the poster, the text simply uses the full width. Two ways to draw the poster, chosen by `ui.cover_style`:
|
||
- **Real images** (`kitty`, and `auto` in kitty/Ghostty): the Kitty graphics protocol with Unicode placeholders. The poster (kept up to 640 px tall) is uploaded as PNG (`a=t,f=100,q=2`, 4096-byte base64 chunks) and placed virtually with the cell footprint (`a=p,U=1,c=,r=`) right away. Every footprint (crop and cell size) is its own image id, placed once and never changed: Ghostty kept showing the old, small placement when the size of an existing one was changed, so a new size uploads under a new id and deletes the old one. The poster is shown by writing U+10EEEE placeholder characters whose combining marks give row and column (the 297-entry table from the protocol) and whose foreground color is the image id. Since it is ordinary text, popups, dialogs and view changes cover it correctly and tcell's diffing keeps it in place. The footprint uses the real cell size in pixels (the window's pixel size divided by its cell count, rounded down to whole pixels so padding around the grid does not skew it; all images are deleted whenever the window or cell size changes, block characters stand in while the size keeps changing, and real images are uploaded afresh once it has been stable for 300 ms, because uploading and placing for every intermediate size of a window drag raced with the terminal's own resizing) and a box whose shape is within 3% of the poster's; the remaining sliver is cropped from the poster's edges before upload (one upload per size, the previous one is deleted), because the terminal letterboxes an image that does not fit its box exactly. As a second safeguard the placeholder cells use the panes' background color, so anything the picture does not cover blends in (without it the terminal's own, slightly different, default background showed as grey bars beside the poster). Writes to the terminal go through the screen's tty on the UI goroutine, so they cannot interleave with drawing. Requires 24-bit color; otherwise, and inside tmux/screen, the block fallback is used. Terminals are recognised from `TERM`/`TERM_PROGRAM`/`KITTY_WINDOW_ID`/`GHOSTTY_RESOURCES_DIR`, and then asked before the screen starts (a Kitty graphics query and a background-color query followed by a device-attributes request, 300 ms timeout, waiting with select(2) because a read deadline does not work on a terminal device on macOS): only a terminal that answers the query gets real images, also with `cover_style: kitty`, because a terminal without the protocol prints the commands as text. The Log says which way posters are drawn. With `ARR_TUI_DEBUG_GFX=1` the Log (F7) lists every window size, the cell shape, every upload (poster size, crop, cells) and every change of what is drawn (image id, position, cells); with a path (`ARR_TUI_DEBUG_GFX=/tmp/arr-gfx.log`) the same lines also go to that file with millisecond timestamps, so they can be read without leaving the view that shows the problem. The go-termimg library was looked at and not used: its placeholder support is marked experimental, its diacritic table does not match the protocol's, and it writes images straight to the terminal instead of through the screen.
|
||
- **Block characters** (`quadrant`, `sextant`, `cells`, and the fallback): every cell shows several pixels in the best two-color split (`quadrant`: 2×2 pixels, glyphs from the Block Elements range every font has; `sextant`: 2×3 pixels, sharper, glyphs from Symbols for Legacy Computing; `cells`: 1 pixel per cell drawn as background color only, because macOS Terminal draws block elements from the font with the halves off the cell's middle). `auto` picks cells in macOS Terminal (`TERM_PROGRAM=Apple_Terminal`), sextants on kitty, WezTerm, foot and Ghostty, and on other terminals (not on macOS, whose terminals do not use fontconfig's fonts) when fontconfig lists a font with the sextant characters (`fc-list :charset=1fb00`, about 20 ms at startup; terminals draw glyphs their font lacks from fallback fonts; skipped over SSH because the installed fonts are the remote machine's), and quadrants otherwise.
|
||
Posters are JPEG, PNG, GIF or WebP (Radarr and Sonarr keep whatever bytes the provider sent under a `.jpg` name, which can be WebP), decoded and downscaled in the process; for any other format the Log says what the data looked like (e.g. AVIF, an HTML error page, or its first bytes). Library items fetch `/MediaCover/<id>/poster-250.jpg` (250×375; `poster-500.jpg` when posters are real images, which otherwise enlarge the small copy) from their Radarr/Sonarr instance with the API key (then the original `poster.jpg`; an instance that answers 200 with an HTML page, i.e. wants a login for `/MediaCover`, is also tried with the key as the `apikey` query parameter; and if the instance has no usable copy, the provider's `remoteUrl`, fetched without credentials); search results fall back to the provider's `remoteUrl` (fetched without credentials). Posters are cached in memory (the terminal's copies are deleted when the cache is dropped and on exit), failed downloads are not retried for two minutes and are written to the Log (F7) with the reason, and the poster shrinks or disappears when the pane is too short. `ui.covers: false` disables it.
|
||
- **Calendar view (F5):** a two-week window (starting today, moved a week at a time with `[`/`]`, `t` returns to today) with the library's movie releases and airing episodes, grouped by day. Radarr `GET /calendar` supplies the cinema, digital and physical release dates (taken as written: midnight UTC means that calendar day) and Sonarr `GET /calendar?includeSeries=true` the episodes with their air time (shown in local time). Unmonitored items are included with `u`. A movie appears once per release date in the window. Each entry shows type, title, episode or release kind and status (downloaded / missing / upcoming); the detail pane shows poster and plot; `Enter`/`i` starts the release search and `s` an automatic search.
|
||
- **Download notifications:** a background poller (independent of the visible view) reads SABnzbd's history every 15 s and announces downloads that reach `Completed` or `Failed` as a popup and log entry; the first poll only records the current state. `ui.notify_downloads` (default true) and `ui.bell` (default false, rings the terminal bell) control it. Connection errors are not reported here, the indicators and the log already do that.
|
||
- **Trakt lists:** while the search box of Movies or Series is empty, the list shows one of Trakt's public lists instead of search results: trending now (`/movies|shows/trending`, "N watching"), most watched this week (`/…/watched/weekly`, "N watched it"), anticipated (`/…/anticipated`, "on N lists"), popular (`/…/popular`), and for movies the US box office of last weekend (`/movies/boxoffice`, "$N last weekend"); 20 titles each (`page=1&limit=20`), with the headers `trakt-api-key` (the client ID, `trakt.client_id` or `ARR_TUI_TRAKT_CLIENT_ID`), `trakt-api-version: 2`, `Content-Type` and `User-Agent`. Every entry is looked up in Radarr (`tmdb:<id>`) or Sonarr (`tvdb:<id>`), at most four at a time, so it behaves like a search result (details, poster, tick when in the library, add, releases); entries without that id or unknown to the service are left out, in list order otherwise. `[` `]` switch lists (also from the empty search box), `r` reloads; a fetched list is shown again for 15 minutes without asking. Without a client ID the list says how to get one. Changing the client ID or a service in the Config view drops the fetched lists. `ARR_TUI_TRAKT_URL` points the client at another server (used by `dev/screenshots`).
|
||
- **Downloading in the Library:** while the Library is visible it reads the Radarr and Sonarr queues (`/queue`, matched to titles by `movieId` / `seriesId`) when it opens, every 10 s, and 3 s after a grab. A title with queue entries gets a blue mark (filled when monitored, hollow when not) instead of the green or grey one, and its details a line "Downloading 45% · 0:06:12 left" (series: "Downloading N episodes"). A queue that cannot be read leaves the marks as they were. After a successful grab the release list closes (if nothing was opened on top of it).
|
||
- **Disk cache:** posters and casts are kept between runs in `os.UserCacheDir()/arr-tui` (`$XDG_CACHE_HOME` or `~/.cache` on Linux, `~/Library/Caches` on macOS; directories `0700`, files written atomically). Posters are the downloaded bytes, one file per poster and size (small copy for block characters, large for real images) under `posters/<hash>.img`; a file is used for 30 days (by its modification time) and dropped when it cannot be decoded; at startup files older than that are deleted, then the oldest until the rest fit 200 MB. Casts are one `people.json` (key = `movie:tmdb:<id>` / `show:tvdb:<id>`, with the time it was fetched); entries are used for 7 days, at most 2000 are kept (the oldest go first), titles Trakt does not know are kept as having no cast; new casts are written 5 s after the last one and when the program quits. Changing the Trakt client ID keeps the casts and only forgets failed lookups.
|
||
- **Season posters:** the series drill-down reads the series with `includeSeasonImages=true` (Sonarr only sends season posters when asked, and keeps no copy of them: they are TheTVDB links, fetched without credentials). A selected season or episode shows its season's poster; seasons without one, or whose poster cannot be loaded, show the series poster.
|
||
- **Cast:** with a Trakt client ID, every details pane (search results, Trakt lists, Library, Calendar, the series drill-down) shows the director(s) of a movie or the "created by" credits of a series and up to 8 cast members with their characters below the plot ("and N more" after that). The title is found on Trakt by its TMDb id (movies) or TVDB id (series), else IMDb id (`/search/<type>/<id>?type=movie|show`), then `/movies|shows/<trakt id>/people` is read. Casts are cached, also on disk (see Disk cache; failures are retried after two minutes) and, like posters, only loaded once the selection has rested for 120 ms, so a held arrow key does not spend Trakt's allowance (500 requests per five minutes).
|
||
- **Config view (F6):** one list with a field for every setting of the config file, one below the other under the headings Radarr, Sonarr, SABnzbd, Trakt and Interface (a single scrolling form; ↑↓ passes over the headings and ↓ after the last field reaches the Save / Revert buttons, so no Tab is needed; Tab jumps between the fields and the buttons). The `Test` button is part of the list, right below the SABnzbd settings; `Save` and `Revert` are centered in a bar below the list. When the config file does not exist, it is created empty (`config.Create`: directory `0700`, file `0600`) and the program opens on this view. A service with neither address nor key is "not configured": allowed by validation (half-filled ones are not), its client answers every call with `ErrNotConfigured` without a request, its indicator stays grey (logged once as information, not as unreachable) and its lists say "not configured (Config view, F6)" instead of an error. The fields start from the settings in use; API keys are masked (a checkbox shows them). The default quality profile and root folder of Radarr and Sonarr are dropdowns filled from the server (`/qualityprofile`, `/rootfolder`) with the address and key currently in the fields: when the view opens, on Revert, and 700 ms after the address or key was last changed; answers for values that have changed since are dropped, a failure is reported once in the result box. "(none)" comes first; a configured value the server does not list stays as an option, marked "(not on the server)", so opening the view never changes a setting. `Test` builds temporary clients from the typed values and reports each service. `Save` validates like startup does (URLs, non-empty keys, refresh 1–3600 s), then writes the file from the file's own contents plus the edits (`config.LoadFile`), so values that only come from `ARR_TUI_*` environment variables are left as the file has them and are shown greyed out; the write is atomic (temp file + rename) and keeps the file's permissions (`0600` when new); defaults such as `covers: true` stay out of the file unless it already named them. Everything then applies without a restart: the Radarr/Sonarr/SABnzbd clients are re-pointed (`Reconfigure`, guarded by a mutex), the connection indicators, add-form defaults and options are refreshed, the library and calendar reload, the Downloads interval, notifications, bell and poster style are switched live.
|
||
- **Notifications and log (F7):** feedback about actions (added, deleted, grabbed, failures) appears as popups in the bottom right that fade away (errors stay longer). Everything is also kept in the Log view; only connection changes of the background polling are logged, not every failed poll.
|
||
|
||
### 4.2 v0.2 (done, M8)
|
||
|
||
- **Library view:** movies (top) and series (below) with the details of the selected item on the right; Tab switches between the two lists. Filters (status: all, missing, downloaded, monitored, unmonitored), a file-property filter (`F`: quality 2160p/1080p/720p/SD, codec x265/x264/AV1, HDR/DV/SDR, audio format Atmos/TrueHD/DTS:X/DTS-HD/DTS/DD+/DD/AAC/FLAC/Opus, audio language; changes apply live to the list behind the dialog, including while moving through an open dropdown, and Esc restores the previous filter; each dropdown only lists options that, together with the other chosen criteria, still match at least one item (series files are read when the dialog opens so this is accurate)) act only on the focused list, and each list keeps its own status filter, property filter and text; the lists show their active filters in their titles. Movie properties come from the movie list; series properties are read per series from `GET /episodefile?seriesId=` only while a property filter is active, cached while a series' file count and size stay the same, and a series matches when any of its files does. `t` toggles monitoring, `s` starts an automatic search, `d` removes the item from the library (a dialog with "Delete files from disk" and "import exclusion" checkboxes, both off by default and Cancel focused first; `DELETE /movie|series/{id}?deleteFiles=&addImport(List)Exclusion=`), `i`/Enter opens the release search (movies) or the drill-down (series).
|
||
- **Series drill-down:** seasons and episodes, toggle monitoring per season/episode, trigger season/episode search and release search. A detail pane on the right shows the series poster, the series and the selected season (download count, monitoring) or episode (air date, status, monitoring, its own plot).
|
||
|
||
### 4.3 Later / ideas
|
||
|
||
- Poster preview via sixel / kitty graphics where supported.
|
||
|
||
## 5. UI Design (tview)
|
||
|
||
Layout sketch (Library view; the other views follow the same frame):
|
||
|
||
```
|
||
┌ arr-tui ───────────────────────────────────────────────────────────┐
|
||
│ 1 Movies 2 Series 3 Library 4 Downloads 5 Log ● Radarr ● Sonarr ● SAB │ ← tab bar + connection state
|
||
│ Library · Movies 12/40 · Series 5/9 · filter: missing │
|
||
│ Filter: ______________________ │
|
||
├─ Movies ───────────────────────┬─ Details ─────────────────────────┤
|
||
│ ● Movie One (2021) missing │ Title (Year) │
|
||
│ ● Movie Two (2019) ✓ WEB-DL │ ★ 7.8 · 142 min · Sci-Fi │
|
||
├─ Series ───────────────────────┤ Overview text wraps here... │
|
||
│ ● Show One (2008) 12/62 │ │
|
||
│ ○ Show Two (2015) 10/10 │ │
|
||
├────────────────────────────────┴───────────────────────────────────┤
|
||
│ Tab movies/series · f filter · / text · t monitor · F9 help · Ctrl+C quit │ ← key hints of the current view
|
||
└────────────────────────────────────────────────────────────────────┘
|
||
```
|
||
|
||
Popups for action feedback appear in the bottom right and fade away; the Log view (F7) keeps the history.
|
||
|
||
Colors: two fixed themes, dark (near-black background, like k9s) and light, chosen with `ui.theme`: `auto` (default) asks the terminal for its background color at startup (OSC 11, in the same round trip as the graphics query) and takes light for a background with luminance above 0.5, dark otherwise or without an answer. The terminal's palette is not used: color themes often make color 0 ("black", tview's default background) a grey that differs from their background (Catppuccin Mocha: `#45475a` on `#1e1e2e`; Latte: `#5c5f77` on `#eff1f5`), which looked washed out, and on light themes dark grey slabs carried white text. Themes switch while the program runs: widgets copy tview's default styles when they are created, so instead of colors they get role tokens, one unique RGB value per role (background, text, border, field, yellow, ...; `0xa517nn`), set as tview's defaults before any widget exists and as the color names used in texts in tcell's table (`[yellow]` is the yellow role, `white` text and `black` background, so the active tab `[black:white]` follows too). The tcell screen is wrapped (`themedScreen`), and every `SetContent` replaces role tokens with the current theme's colors; tview clears and redraws the whole screen each frame, so switching the theme is a change of that table and one draw. Other colors pass unchanged: poster cells (a poster color that equals a token is nudged by one step) and the image-id colors of real-image placeholders. Every theme color is an entry 16-255 of the 256-color table, so terminals without 24-bit color show it exactly, and never one of the first 16 entries that color themes change. The Log says which theme is used and why.
|
||
|
||
tview primitives: `Pages` (views and stacked overlays), `Flex` (layout), `InputField` (search), `List`/`Table` (results, queues, library), `TextView` (details, log), `Form` (add dialog), `Modal` (confirmations). Popups are drawn by a wrapper around the root primitive.
|
||
|
||
Keybindings (the status bar shows the ones that apply to the current view):
|
||
|
||
| Key | Action |
|
||
|---|---|
|
||
| `F1-F7` | Switch view (Movies, Series, Library, Downloads, Calendar, Config, Log); also while typing, and from full-screen views. Dialogs block them. |
|
||
| `Tab` / `Shift+Tab` | Switch panel within the current view (never the view): search box / results, Downloads panels, Library lists |
|
||
| `F9` | Help (works everywhere, also while typing) |
|
||
| `Ctrl+C` | Quit (there is no single-letter quit key, so typing never quits by accident) |
|
||
| `Esc` | Close a dialog or a full-screen view |
|
||
| `/` | Movies, Series, Library: focus the search / text filter |
|
||
| `Enter` | Movies, Series: add the selected result (dialog: ↑↓ move, ←→ change dropdowns) |
|
||
| `i` | Movies, Series, Library: interactive release search (series: seasons and episodes) |
|
||
| `F` | Library and release list: filter by properties (quality, codec, HDR/DV, audio, language) |
|
||
| `f` | Library: cycle the status filter; release list: hide rejected releases |
|
||
| `[` `]` `t` `u` | Calendar: week back / forward, today, include unmonitored |
|
||
| `d` | Library: remove the item from the library (asks first) |
|
||
| `t` | Library, episodes: toggle monitored; Downloads history: retry a failed download |
|
||
| `s` | Library, episodes: automatic search; release list: cycle sort (best / size / age) |
|
||
| `Enter` / `g` | Release list: grab the selected release (rejected ones ask for confirmation) |
|
||
| `Enter` | Library: open; episodes: expand a season or search releases for an episode |
|
||
| `p` / `d` / `b` / `r` | Downloads: pause/resume SABnzbd, delete job / history entry / arr queue item, remove from arr queue + blocklist, refresh |
|
||
| `r` | Library, episodes: reload |
|
||
| `G` / `c` | Log: follow new entries / clear |
|
||
|
||
## 6. Architecture
|
||
|
||
- All network I/O runs in goroutines; UI updates go through `app.QueueUpdateDraw`. Never block the UI thread.
|
||
- Debounced search (e.g. 300 ms) with request cancellation via `context.Context`.
|
||
- A single ticker drives SABnzbd/queue polling, only while the Downloads view (or the status bar) needs it.
|
||
- HTTP client per service with timeouts, and a typed error that the UI can show in the status bar rather than crashing.
|
||
|
||
Proposed layout:
|
||
|
||
```
|
||
arr-tui/
|
||
├── cmd/arr-tui/main.go # entry point, wires config + UI
|
||
├── internal/
|
||
│ ├── config/ # load/validate config
|
||
│ ├── radarr/ # client + types
|
||
│ ├── sonarr/ # client + types
|
||
│ ├── sabnzbd/ # client + types
|
||
│ ├── arr/ # shared bits (HTTP helper, quality profile, root folder types)
|
||
│ └── ui/ # tview views: search, add form, downloads, status bar
|
||
├── SPECS.md
|
||
├── go.mod
|
||
└── README.md
|
||
```
|
||
|
||
Dependencies: `github.com/rivo/tview`, `github.com/gdamore/tcell/v2`. Prefer the standard library `net/http` and `encoding/json` for the API clients — no generated SDKs.
|
||
|
||
## 7. Configuration
|
||
|
||
Format: JSON. Location: `$XDG_CONFIG_HOME/arr-tui/config.json` (fallback `~/.config/arr-tui/config.json`), overridable with `--config`. Environment variables override file values (e.g. `ARR_TUI_RADARR_APIKEY`) so secrets don't have to live in the file. Parsed with the standard library `encoding/json` (unknown fields rejected to catch typos).
|
||
|
||
```json
|
||
{
|
||
"radarr": {
|
||
"url": "http://localhost:7878",
|
||
"apikey": "...",
|
||
"default_quality_profile": "HD-1080p",
|
||
"default_root_folder": "/movies"
|
||
},
|
||
"sonarr": {
|
||
"url": "http://localhost:8989",
|
||
"apikey": "...",
|
||
"default_quality_profile": "HD-1080p",
|
||
"default_root_folder": "/tv"
|
||
},
|
||
"sabnzbd": {
|
||
"url": "http://localhost:8080",
|
||
"apikey": "..."
|
||
},
|
||
"ui": {
|
||
"refresh_seconds": 3
|
||
}
|
||
}
|
||
```
|
||
|
||
The default quality profile / root folder fields are optional.
|
||
|
||
The file should be created with mode `0600`; warn if it is more permissive. API keys are never logged.
|
||
|
||
## 8. Testing
|
||
|
||
- Unit tests for each client using `httptest.Server` with recorded JSON fixtures.
|
||
- Config parsing / validation tests.
|
||
- UI logic (formatting, state) kept out of tview widgets so it can be tested without a terminal.
|
||
- Manual testing against real Radarr/Sonarr/SABnzbd instances (`dev/up.sh` starts pinned Radarr/Sonarr/SABnzbd containers, see `dev/README.md`).
|
||
|
||
## 9. Milestones
|
||
|
||
- [x] **M0** — Project skeleton: `go mod init`, config loading, empty tview app with tabs and status bar.
|
||
- [x] **M1** — Radarr client: system status, lookup, quality profiles, root folders, add movie.
|
||
- [x] **M2** — Movie search + add flow in the UI.
|
||
- [x] **M3** — Sonarr client and series search + add flow.
|
||
- [x] **M4** — SABnzbd client and Downloads view (queue + history) with live updates and pause/resume/delete.
|
||
- [x] **M5** — Radarr/Sonarr queues merged into the Downloads view.
|
||
- [x] **M6** — Interactive release search (movies, then series seasons/episodes) and grab.
|
||
- [x] **M7** — Polish: help screen (F9), per-service connection indicators, README, Makefile release builds, `--version`.
|
||
- [x] **M8** — Library view (movies/series, filters, text filter, monitor toggle, automatic search) and series drill-down (seasons/episodes, monitoring, search, release search).
|
||
- [x] **M9** — Popup notifications, Log view (F7), context-sensitive key hints in the status bar.
|
||
- [x] **M10** — Download completion notifications, remove from library, calendar view (F5; the Log moves to F7, after the Config view on F6). Multiple instances per service are out of scope.
|
||
- [ ] **M11+** — ideas: more library actions (edit quality profile, root folder), history of grabs per title.
|
||
|
||
## 10. Open Questions
|
||
|
||
Open: none.
|
||
|
||
|
||
Decided:
|
||
|
||
- Go module path: `git.stinnesbeck.com/nils/arr-tui`.
|
||
- One instance each of Radarr, Sonarr and SABnzbd (multi-instance is out of scope).
|
||
- Minimum Go version: latest stable.
|
||
- License: MIT (Nils Stinnesbeck). The tool will be published, so keep secrets out of the repo, include a `config.example.json`, and write a proper README.
|
||
- Config format: JSON.
|
||
- Interactive release search: in the MVP.
|
||
- Downloads view: shows SABnzbd and the Radarr/Sonarr queues from the start.
|