songjongdevsecops/dsh-midia ↗★ 0
dsh-midia
个人音视频库语义搜索与安全保护工具 适合需要对媒体库进行带时间戳的语义搜索,并防止文件被改删。
安裝
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:songjongdevsecops/dsh-midia說明文件
閱讀完整 README ↗Configuration
Precedence is profile config → environment variable → default. ~ is
expanded to your home directory. Defaults follow the reference layout under your
home directory; set yours to match where your media and engine actually live.
| Key | Environment variable | Default | Meaning |
|---|---|---|---|
musicas | DSH_MIDIA_MUSICAS | ~/workspaces/midia/musicas | music library root (guard and returned paths) |
videos | DSH_MIDIA_VIDEOS | ~/workspaces/midia/videos | video library root |
gemma | DSH_MIDIA_GEMMA | ~/workspaces/tools/embeddinggemma/bin/embeddinggemma | EmbeddingGemma binary |
estado | DSH_MIDIA_ESTADO | ~/workspaces/harness/global/scripts/embeddings/.estado | optional index state sidecars (granularity note) |
memsearch | DSH_MIDIA_MEMSEARCH | ~/.local/bin/memsearch | memsearch CLI, for -bgem3-v1 |
colecao | — | midia-gemma-v1 | collection searched by default |
n | — | 10 | items returned when the model does not pass n |
guarda | — | true | library guard on/off |
Override by id in your profile patch (~/.dsh/profiles/web/cordis.patch.yml).
A patch replaces the whole config of the line, so restate every key you want to
keep:
- id: midia
config:
colecao: mymusic-gemma-v1
n: 10
guarda: true
musicas: ~/Media/music
videos: ~/Media/video
gemma: ~/tools/embeddinggemma/bin/embeddinggemma
Environment variables are handy when the engine lives outside the default place:
export DSH_MIDIA_GEMMA="$HOME/tools/embeddinggemma/bin/embeddinggemma"
export DSH_MIDIA_MUSICAS="$HOME/Media/music"
Usage
In the chat:
/midia slow jazz for studying -n 5
/midia --mais calm --menos drums
/midia-parecidas "/home/you/Media/music/kind-of-blue.flac"
/midia-duplicatas --camada todas --propor
Or let the agent call midia_buscar with a description. Each returned item has a
name, an absolute path when it can be resolved, a score, a type (faixa,
trecho, quadro) and, for slices, the timecode (HH:MM:SS plus the start in
seconds).
The direction arithmetic (--mais / --menos) is not normalized by the engine:
only the order is meaningful there, not the absolute scores.
/midia-duplicatas runs three layers: identical bytes (md5), same recording in
another format (SimHash over strings), and near-duplicate vectors (cosine). It
writes a proposal under
${XDG_STATE_HOME:-~/.local/state}/dsh-midia/-duplicatas/ and never
touches the media. The optional model verdict (--llm) is not implemented; the
three mechanical layers are.
The guard
While guarda is true, the plugin listens on tools/pre-execute and denies a
bash command whose verb is destructive (rm, mv, rename, unlink,
shred, truncate, dd) when it targets a media file under musicas or
videos. Read-only commands (ffprobe, ls, find, indexers) pass. The guard
covers the bash tool only — other tools are not inspected — and paths outside
the configured roots are not its business.