Files
doge_cogs/README.md
T
ziadarafatandClaude Opus 5.5 aaa287d753 Add the watch cog: preload media through media-preload
`[p]watch <title>` asks the home lab's media-preload service to cache a
movie, a season, some episodes or the next N unwatched episodes, and
keeps a progress message (with a Cancel button) updated until done.
`link`/`unlink` store a Jellyfin user name for "next"; `status` and
`cancel` work on request ids.

The API client in clients/media-preload-client is generated from the
service's OpenAPI spec with openapi-python-client (`mise run
generate-client`); the cog installs it from this repo via info.json.

Also: ruff target py311 (Red 3.5's Python), a dev group with the client,
pytest, ruff and ty, and mise tasks. Lint and type checks cover the new
cog; doge_alignment is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
2026-11-05 09:37:45 -07:00

2.3 KiB

doge_cogs

Red-DiscordBot cogs for dogebot.

Cogs

Cog What it does
doge_alignment Alignment chart manager
watch Preload a movie or episodes into the home lab's media cache before you watch

watch

[p]watch <title> asks the home lab's media-preload service to fetch a movie or episodes into the VPS media cache, so they stream quickly from webdav, and keeps a progress message updated until it's done.

Command
[p]watch The Matrix a movie
[p]watch Dark Matter s2e8-10 episodes 8 to 10 of season 2 (s2e8, s2e1,3,5 work too)
[p]watch Dark Matter s2 a whole season
[p]watch Dark Matter next 4 your next 4 unwatched episodes (needs link)
[p]watch Dark Matter a series without episodes: buttons for "next 3" or a season/episodes form
[p]watch link <jellyfin name> / unlink link your Jellyfin user, for "next"
[p]watch status [id] the latest requests, or one request's progress
[p]watch cancel <id> cancel the files that haven't started (requester or moderators)

When several titles match, a menu asks which one. The progress message has a Cancel button.

Configuration, read when each command runs:

  • token: the PRELOAD_BOT_TOKEN environment variable, or [p]set api media_preload token,<token>;
  • URL: PRELOAD_API_URL, or the url key of the same API tokens, defaulting to http://host.containers.internal:8125. That is the host as seen from a rootless podman container. Inside such a container the host's LAN address points back at the container itself.

The client library

clients/media-preload-client is generated from media-preload's OpenAPI spec with openapi-python-client, so don't edit it by hand. The cog's info.json installs it from this repo with pip. To regenerate it after the API changes:

mise run generate-client   # fetches the live spec into clients/media-preload.openapi.json and regenerates
mise run check             # ruff, ty and pytest for the watch cog

Development

mise installs uv, and uv installs Python 3.11 (what Red 3.5 needs) and the dependencies, including the generated client in editable mode. Lint and type checks cover the watch cog and its tests.

mise install && mise run sync
mise run fmt && mise run check