Integrations

Stash and TraDoc

Connect Stash over GraphQL for personal video libraries and HLS playback, and connect TraDoc to translate EPUB, PDF, and DOCX books inside Kavita.

Bunko connects to two specialized companion servers: Stash for personal video collections and TraDoc for automated book and document translation.

Stash (GraphQL & HLS playback)

Configure Stash under Settings › Connections › Stash with your server URL (stashUrl) and API key (stashApiKey, or env seeds STASH_URL / STASH_API_KEY for account 1).

Indexing and linking

  • Every 15 minutes (or immediately via POST /api/stash/sync), Bunko queries Stash's /graphql endpoint using the ApiKey header to index scenes (title, code, date, studio, performers, duration, play count, group order) and groups (findGroups, falling back to findMovies on Stash servers older than 0.27).
  • Unlinked groups and scenes appear in Library › Unlinked. Turn a group into a multi-episode work (stash:g<id>) or a single scene into a film (stash:s<id>), or link an existing catalog work to Stash via stashLink.
  • Thumbnails and group covers are served through Bunko's authenticated image proxy (/api/stash/image?id=) so your Stash API key never reaches the browser.

Direct and HLS streaming

When playing a Stash item (/api/stash/streams), Bunko automatically ranks the best playback mode for your browser:

  1. Direct stream (mode=direct) — Served first when the original file is browser-ready MP4/WebM (H.264, VP8/9, or AV1), forwarding HTTP Range requests.
  2. Stash HLS (stream.m3u8) — Prioritized automatically when the original codec is not browser-ready; Bunko rewrites HLS playlists to route segments back through Bunko without exposing the Stash API key.
  3. Converted MP4 (mode=mp4) — Kept as a final fallback.

Played state syncs bidirectionally: Stash play counts advance Bunko's watched progress, and updating watched progress in Bunko triggers sceneAddPlay / sceneIncrementPlayCount or sceneResetPlayCount in Stash.

TraDoc (EPUB, PDF & DOCX book translation)

Configure TraDoc under Settings › Connections › Translation with the TraDoc integration API URL (for example http://tradoc:2507/api/v1) and API key (tdk_…, or env seeds TRADOC_URL / TRADOC_API_KEY). Members need the translate permission (enabled by default).

How book translation works

  1. Open any followed book, novel, light novel, or web novel that holds files in Kavita (EPUB, PDF, DOCX, TXT, or Markdown).
  2. Open the Translate action (GET /api/translations/files and GET /api/translations/models), choose the files, target language, provider/model, and output mode, and submit (POST /api/translations).
  3. Bunko validates every file path with realpath containment inside your account's /library media root, uploads the source file to TraDoc with a deterministic external_ref (bunko:<account>:<job> so restarts adopt in-flight jobs without re-uploading), and polls status every 30 seconds.
  4. You can pause, resume, cancel, retry, restore, or remove jobs from the translation panel (POST /api/translations/control). Bunko never deletes your project inside TraDoc.

Output modes: Replace vs. Separate

ModeBehavior on completion
replaceCopies the original file to /data/users/<id>/translation-backups/<job>/ (outside /library so Kavita never indexes duplicates), atomically replaces the file in place, and lets you restore the original at any time.
separateWrites the translated book into a sibling series folder named <series> [<LANG>] inside your Kavita library without modifying the original series.

After installing the translated file, Bunko triggers a Kavita folder scan and index refresh so the translated edition is immediately readable in both Bunko's book reader and Kavita.

Safe recovery on errors

If TraDoc is temporarily unreachable, Bunko preserves job state and retries every two minutes. Deleting a completed replace job with remove cleans up its stored original backup under /data/users/<id>/translation-backups/.