# Drive folder audio import audit for Cosmos Luminosity encyclopedia

Use when Margarita points to a Google Drive folder and asks whether a specific audio was imported/transcribed, especially after a prior batch import.

## Pattern learned

A previous import of Drive folder `1iK7Ccje8_HEQ9-KWVnFfMrPQh00HsPbY` processed several audio files but missed `вопросы мои объяснения.m4a` (~37m42s). The durable lesson is not the specific file; it is to audit the live Drive folder against local `downloads/` and `out/` artifacts before assuming the batch is complete.

## Workflow

1. **Inspect the live Drive folder listing first** when accessible.
   - For public folders, fetch the folder HTML anonymously with a browser user-agent.
   - Extract file IDs/names from `data-id="..."` and `data-tooltip="..."`.
   - This often works without Google OAuth.

2. **Compare against local import artifacts.**
   - Local import root usually follows:
     `/home/spazio/cosmos_luminosity_encyclopedia/audio_imports/drive_<FOLDER_ID>_<DATE>/`
   - Check both:
     - `downloads/` for original media/docs;
     - `out/` for `_transcript.txt`, `_transcript.srt`, `_segments.json`.
   - A file in Drive with no matching download/transcript likely needs processing.

3. **Search by exact filename and fuzzy content.**
   - Exact filename may include Russian spaces and extensions: `вопросы мои объяснения.m4a`.
   - Also search transcripts/content for key phrases such as `энергетические вопросы`, `вопросы`, `функционировать из пространства вопросов`.

4. **If missing, download the specific file by ID.**
   - Use `gdown.download(id=FILE_ID, output=...)` when the public link is accessible.
   - Verify duration with `ffprobe` before claiming it is the expected audio.
   - Example confirmation: 2261 sec ≈ 37m42s matches “about 40 minutes”.

5. **Report clearly.**
   - Say which file exists in Drive.
   - Say whether a transcript was found.
   - List what *was* previously transcribed from the folder.
   - Offer the next concrete action: transcribe and extract theory/tools/questions into encyclopedia pages.

## Pitfall

Do not rely on the existence of a prior Drive import directory as evidence that every file in the folder was processed. Batch imports can skip or miss individual files.