# Ticket: YouTube audio capture ingestion MVP

## Metadata
- Type: Ticket
- Status: Done
- Project: YouTube-to-Obsidian Knowledge Capture
- Created: 2026-05-14
- Updated: 2026-05-17
- Priority: Medium

## Goal

Create the first server-side MVP that accepts uploaded Android voice recordings through Nextcloud, detects new files, transcribes them with Whisper on the Nextcloud host, and writes safe staging output without touching the live Obsidian vault.

## Why

The user needs a reliable offline capture workflow: record audio on Android at work, upload/sync automatically when connectivity returns, then process the captures into text and later Obsidian-ready notes.

## Scope

Included:
- Create or use an assistant-controlled Nextcloud user/service account if appropriate.
- Create a Nextcloud folder for audio captures and share it with user `deeso`.
- Define the expected upload path for Android audio files.
- Implement a simple listener/poller for new audio files.
- Copy new files into a server-side processing/staging area.
- Run Whisper transcription for each new audio file.
- Store raw transcript and processing metadata.
- Avoid duplicate processing of the same source file while preserving repeated watch/capture events.
- Write Markdown/JSON staging records only; do not write to the real Obsidian vault yet.
- Document install/run/rollback steps.

Not included:
- Writing directly into the user's Obsidian vault.
- Automatic Google/YouTube activity import.
- YouTube video matching beyond placeholder/manual metadata.
- Production daemon hardening beyond a safe MVP.

## Acceptance Criteria

This ticket is done when:
- [x] Capture folder exists in Nextcloud and is shared with `deeso`.
- [x] A test audio file uploaded by `deeso` is visible to the server-side process.
- [x] A test audio file uploaded by `piagent` through WebDAV was visible to the server-side process.
- [x] New audio files are detected by a script/job.
- [x] Whisper successfully transcribes at least one test audio file.
- [x] Output is written to a staging area with original filename, checksum, timestamps, transcript, and processing status.
- [x] Re-running the process does not duplicate processing of the same file.
- [x] No writes are made to the live Obsidian vault.
- [x] Operational changes are logged in `docs/server-change-log.md` after server work is performed.

## Questions

- What Nextcloud username should the assistant/service use?
- Should the capture folder be owned by the assistant account and shared to `deeso`, or owned by `deeso` and shared to the assistant?
- What is the exact path to Whisper on the Nextcloud host, and which model should be used for MVP?
- Should the listener be a cron/systemd timer polling job first, rather than a long-running daemon?
- Where should server-side staging data live on the Nextcloud host?
- What audio formats will the Android recorder produce: m4a, opus, mp3, wav?

## Plan / Next Actions

- [x] Review and approve the MVP scope.
- [x] Confirm Nextcloud/service account and folder ownership model.
- [x] Confirm server staging paths and Whisper command.
- [x] Implement a poller script that scans the capture folder and records processed files by checksum.
- [x] Test with one manually uploaded audio file from `piagent`; still needs a real `deeso` upload test.
- [x] Add runbook documentation.
- [ ] Only after MVP works, create separate tickets for YouTube history import, matching, and Obsidian integration.

## 2026-05-17 Spec Advancement

Confidence level: high that MVP acceptance criteria are satisfied.

Decisions now stable:
- The MVP is a systemd timer/poller on the Nextcloud VM.
- Android/Fossify upload into the shared Nextcloud folder is viable.
- Server-side staging and per-file error isolation are the correct safety boundary before Obsidian writes.

Refined next milestone:
- Treat follow-up work as separate tickets: watch-history matching, daily note enrichment, and Obsidian integration.

Updated next actions:
- [ ] Move this ticket to `tickets/done/` after review.
- [ ] Keep operational changes in `docs/server-change-log.md` and `projects/youtube-to-obsidian/runbook.md`.

## Notes

- Prefer a polling job for the MVP because it is simpler and easier to debug than filesystem event watching through Nextcloud storage internals.
- The first version should stage data and require review before any Obsidian writes.

## Implementation Notes

- Deployed on 2026-05-14.
- Nextcloud folder: `YouTube Voice Captures`, owned by `piagent`, shared with `deeso`.
- Timer: `youtube-capture-ingest.timer`, hourly.
- Staging output: `/var/lib/youtube-capture-ingest/`.
- Runbook: `projects/youtube-to-obsidian/runbook.md`.
- User-side Android/Fossify upload test succeeded: five `.m4a` files appeared in the shared folder; four transcribed successfully and one was marked failed/unreadable.

## 2026-05-15 Test Notes

- `deeso` Android/Fossify upload path works; files appeared in Nextcloud.
- Ingest initially crashed on one unreadable `.m4a`; script was hardened to continue per-file and save state after each file.
- Current MVP is functional enough for further user testing.

## Archive Note

Archived because the YouTube-to-Obsidian project is dead in the water for now. Retained for future reference if requirements change.
