Expand description
Rdio API upload queue processor.
Polls the streams table for completed voice recordings with
upload_status = 'pending' and uploads them to an SDRTrunk-compatible
Rdio Scanner API server using the POST /api/call-upload
multipart/form-data protocol.
The protocol wire format — field names, the User-Agent: sdrtrunk
header, the "Call imported successfully." success marker — lives in
rdio. This module is the orchestrator: it drains the database
queue, maps StreamRow fields onto the Rdio field set, calls
rdio::upload_stream for each row, and transitions the row through
the upload lifecycle.
§Lifecycle transitions
For every pending row returned by crate::db::uploads::get_pending
the processor:
- on success — calls
crate::db::uploads::mark_uploaded. - on failure with attempts below
max_retries— callscrate::db::uploads::increment_attemptsto bump the counter and leave the row inpendingso the next tick retries. - on failure with attempts at or above
max_retries— callscrate::db::uploads::mark_failedto transition to the terminalfailedstate.
§System id scheme
Rdio Scanner expects every system to be numeric, but D-STAR reflector
names are alphabetic with a numeric suffix (REF030, DCS030, …).
To disambiguate reflectors that share a numeric suffix across protocol
families we prefix the numeric suffix with a protocol tag:
| Protocol | Base | Example | Resulting id |
|---|---|---|---|
dplus (REF) | 10_000 | REF030 | 10030 |
dextra (XLX) | 20_000 | XLX030 | 20030 |
dcs (DCS) | 30_000 | DCS030 | 30030 |
dextra (XRF) | 40_000 | XRF030 | 40030 |
Pi-Star labels XLX and XRF reflectors identically as dextra; we
distinguish them by the 3-letter prefix on the reflector callsign.
§Talkgroup scheme
Rdio Scanner talkgroups are numeric; D-STAR modules are letters A-Z.
We map A → 1, B → 2, …, Z → 26. Unknown module letters fall
back to 0.
Modules§
- rdio 🔒
SDRTrunk-compatible Rdio API multipart upload client.
Constants§
- BATCH_
SIZE 🔒 - Maximum number of pending rows to drain per tick.
Functions§
- compute_
system_ 🔒id - Returns the Rdio Scanner
systemid for a given D-STAR reflector. - handle_
upload_ 🔒failure - Handles an upload failure by deciding whether to retry or mark the row as permanently failed, based on the attempts-so-far counter.
- make_
audio_ 🔒name - Builds the
audiopart’s filename. - make_
talker_ 🔒alias - Builds the
talkerAliasfield from a callsign and optional suffix. - module_
to_ 🔒talkgroup - Returns the Rdio Scanner
talkgroupid for a D-STAR module letter. - numeric_
suffix 🔒 - Extracts the trailing numeric suffix of a reflector callsign.
- process_
one 🔒 - Uploads a single stream and records the outcome.
- process_
pending 🔒 - Drains one batch of pending uploads.
- protocol_
label 🔒 - Returns the human-readable protocol label used in
systemLabel. - reflector_
prefix 🔒 - Returns the first three ASCII-uppercase letters of a reflector name, or
Noneif the prefix is shorter than three bytes or contains non-ASCII. - run 🔒
- Runs the upload queue processor loop.