Skip to content

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 …
  1. Desktop UI (ui/): Tauri 2 window rendering vanilla HTML, CSS, and JavaScript with no bundler, no external network fonts, and script-src 'self' CSP.
  2. Rust layer (src/main.rs): Manages configuration, portable/fallback paths, runtime/python provisioning (uv or python -m venv), single-instance locking (data/instance.lock), and embeds tg_send.py via include_str!. On invocation it writes tg_send.py to <tmp>/voicedrop/tg_send.py and spawns the managed Python interpreter.
  3. Sender backend (tg_send.py): Drives Telethon and ffmpeg:
    • Audio is transcoded to 48 kHz mono Opus (-application voip) and uploaded with voice_note=True (already-Opus .ogg/.oga/.opus files pass through without re-encoding).
    • Video is center-cropped to 480×480, encoded as H.264 baseline + AAC, trimmed to 59 s, and uploaded with video_note=True.
    • Everything else is sent as a regular document.
    • Each Telethon call acquires <session>.lock and retries transient database is locked SQLite errors.

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 from data/config.json, writes the JSON summary to <result.json> and stdout, and exits 0 on success (1 on send failure, 2 on usage or setup error). Passing "" as <chat> sends to the active account's currently saved recipient.
  • --doctor: Prints a JSON report with detected python, ffmpeg, uv, app_dir, and data_dir paths, then exits. Useful when diagnosing stale GUI PATH issues.

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 ​

FlagPurpose
--session <path>Telethon SQLite session path (required)
--api-id N / --api-hash HTelegram 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 / --circleForce voice note, force document, or enable round video notes for videos
--list-targetsPrint recent chats as JSON (--limit defaults to 40)
--whoamiPrint 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-2faComplete 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 ​

VariablePurposeDefault
VOICEDROP_API_IDTelegram app api_id—
VOICEDROP_API_HASHTelegram app api_hash—
VOICEDROP_2FATelegram 2FA password for --login-2fa—
VOICEDROP_UPLOAD_TIMEOUTUpload timeout in seconds (0 disables)900
VOICEDROP_LOCK_TIMEOUTSession file lock wait timeout in seconds90
VOICEDROP_SEND_TIMEOUTOverall process timeout enforced by the Rust wrapper—