Architecture & CLI
How VoiceDrop works
text
voice-drop ──▶ <tmp>/voicedrop/tg_send.py (embedded copy of tg_send.py)
└─▶ <app>/runtime/python/… python tg_send.py --session … --chat …- Desktop UI (
ui/): Tauri 2 window rendering vanilla HTML, CSS, and JavaScript with no bundler, no external network fonts, andscript-src 'self'CSP. - Rust layer (
src/main.rs): Manages configuration, portable/fallback paths,runtime/pythonprovisioning (uvorpython -m venv), single-instance locking (data/instance.lock), and embedstg_send.pyviainclude_str!. On invocation it writestg_send.pyto<tmp>/voicedrop/tg_send.pyand spawns the managed Python interpreter. - Sender backend (
tg_send.py): Drives Telethon andffmpeg:- Audio is transcoded to 48 kHz mono Opus (
-application voip) and uploaded withvoice_note=True(already-Opus.ogg/.oga/.opusfiles pass through without re-encoding). - Video is center-cropped to
480×480, encoded as H.264 baseline + AAC, trimmed to 59 s, and uploaded withvideo_note=True. - Everything else is sent as a regular document.
- Each Telethon call acquires
<session>.lockand retries transientdatabase is lockedSQLite errors.
- Audio is transcoded to 48 kHz mono Opus (
voice-drop CLI modes
VoiceDrop exposes two non-GUI CLI entry points:
sh
voice-drop --oneshot <chat> <result.json> <file> [file...]
voice-drop --doctor--oneshot <chat> <result.json> <file> [file...]: Sends the listed files using the active account fromdata/config.json, writes the JSON summary to<result.json>and stdout, and exits0on success (1on send failure,2on usage or setup error). Passing""as<chat>sends to the active account's currently saved recipient.--doctor: Prints a JSON report with detectedpython,ffmpeg,uv,app_dir, anddata_dirpaths, then exits. Useful when diagnosing stale GUIPATHissues.
tg_send.py CLI & environment
tg_send.py can also be run directly with the runtime's Python interpreter:
sh
python tg_send.py --session <path> --api-id N --api-hash H --list-targets
python tg_send.py --session <path> --api-id N --api-hash H --whoami
python tg_send.py --session <path> --api-id N --api-hash H --login-send-code +380...Supported flags
| Flag | Purpose |
|---|---|
--session <path> | Telethon SQLite session path (required) |
--api-id N / --api-hash H | Telegram credentials (falls back to VOICEDROP_API_ID / VOICEDROP_API_HASH) |
--chat <target> | Username, @username, phone/invite link, or numeric chat ID |
--caption <text> | Optional message caption |
--ffmpeg <path> | Explicit ffmpeg binary path |
--voice / --document / --circle | Force voice note, force document, or enable round video notes for videos |
--list-targets | Print recent chats as JSON (--limit defaults to 40) |
--whoami | Print current session account metadata as JSON |
--login-send-code <phone> | Request a login code |
--login-code <code> | Complete code login (with --login-send-code and --phone-hash) |
--login-2fa | Complete 2FA login using VOICEDROP_2FA |
--login-password <password> | Complete 2FA login with password passed on argv (manual CLI use) |
--timeout <seconds> | Per-file upload timeout (0 disables; defaults to VOICEDROP_UPLOAD_TIMEOUT or 900) |
Environment variables
| Variable | Purpose | Default |
|---|---|---|
VOICEDROP_API_ID | Telegram app api_id | — |
VOICEDROP_API_HASH | Telegram app api_hash | — |
VOICEDROP_2FA | Telegram 2FA password for --login-2fa | — |
VOICEDROP_UPLOAD_TIMEOUT | Upload timeout in seconds (0 disables) | 900 |
VOICEDROP_LOCK_TIMEOUT | Session file lock wait timeout in seconds | 90 |
VOICEDROP_SEND_TIMEOUT | Overall process timeout enforced by the Rust wrapper | — |