Documentation
¶
Overview ¶
Package media localises a record set's media: it collects every distinct reference, downloads each through the shared x.Client (so media rides the one rate limiter and cache), picks a video rendition, and maps each item to a deterministic local file. name.go and plan.go are pure (no network); only download.go touches the wire.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
Key string // media key, or a derived key for avatar/banner
Type string // photo|video|gif|avatar|banner
Source string // the URL to fetch (the picked rendition for video/gif)
Path string // repo-relative destination (empty until named)
AltErr string // when non-empty, why this item cannot be localised (e.g. stream-only)
}
Item is one media reference to fetch and where it will land. The Path is the deterministic repo-relative destination; Kind classifies it for the manifest.
func Plan ¶
Plan walks the profile and a record set and returns every distinct media item to localise under the policy, deduped by destination path and ordered deterministically (TP5). Video/gif renditions are picked here; each item's local Path is computed now so the downloader only fetches. Quoted-tweet media and author avatars are included so an embedded card and the author row render offline (spec §8).
type Result ¶
type Result struct {
Assets []repo.Asset
Downloaded int // newly fetched this run
Reused int // already on disk, skipped
Failed int // fetch errored, recorded unavailable
StreamOnly int // no progressive rendition, recorded with master URL
}
Result summarises a localisation pass for the manifest and the progress line.
func Download ¶
Download localises every planned item through the shared x.Client (TP1), so media rides the one rate limiter, retry/backoff, and disk cache the record reads use. An item already on disk is skipped (incremental, TP6); a fetch failure is recorded as unavailable and never aborts the capture (spec §8).