Documentation
¶
Overview ¶
Package synchandlers provides HTTP handlers for subtitle sync operations (audio-based sync and manual offset adjustment).
Index ¶
Constants ¶
const MaxSyncSubSize = httputil.MaxDownloadBytes
MaxSyncSubSize caps subtitle file reads for sync operations.
Variables ¶
This section is empty.
Functions ¶
func ShiftAndFilterCues ¶
func ShiftAndFilterCues(cues []api.SubtitleCue, totalShift time.Duration) []api.SubtitleCue
ShiftAndFilterCues applies a timing shift to all cues and removes cues that end before time zero. Cue start times are clamped to zero.
Types ¶
type Deps ¶
type Deps struct {
Store SyncStore
SubtitleProc api.SubtitleProcessor
Activity *activity.Log
Resolve *resolve.Resolver
}
Deps holds all dependencies for the sync handler family. Resolve is the S7 typed-reference resolver: sync verbs address the subtitle by FileRef and the server resolves both the subtitle path (store row) and the video path (same media) — no client-supplied paths.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler holds all dependencies for the sync handler family.
func (*Handler) HandleSyncAudio ¶
func (h *Handler) HandleSyncAudio(w http.ResponseWriter, r *http.Request)
HandleSyncAudio handles POST /api/sync/audio.
func (*Handler) HandleSyncOffset ¶
func (h *Handler) HandleSyncOffset(w http.ResponseWriter, r *http.Request)
HandleSyncOffset handles POST /api/sync/offset.
type SyncAudioRequest ¶ added in v0.1.148
type SyncAudioRequest struct {
MediaType api.MediaType `json:"media_type"`
MediaID string `json:"media_id"`
Language string `json:"language"`
Variant string `json:"variant,omitempty"`
Source string `json:"source,omitempty"`
Ordinal int `json:"ordinal,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
}
SyncAudioRequest is the typed body for POST /api/sync/audio: the FileRef of the subtitle to align (the server resolves the subtitle path from the store row and the video path from the same media) plus the dry-run flag.
type SyncAudioResponse ¶ added in v0.1.148
type SyncAudioResponse struct {
Method string `json:"method"`
OffsetMs int64 `json:"offset_ms"`
Confidence float64 `json:"confidence"`
Applied bool `json:"applied"`
}
SyncAudioResponse is the typed response for POST /api/sync/audio.
type SyncOffsetRequest ¶ added in v0.1.148
type SyncOffsetRequest struct {
MediaType api.MediaType `json:"media_type"`
MediaID string `json:"media_id"`
Language string `json:"language"`
Variant string `json:"variant,omitempty"`
Source string `json:"source,omitempty"`
Ordinal int `json:"ordinal,omitempty"`
OffsetMs int64 `json:"offset_ms"`
}
SyncOffsetRequest is the typed body for POST /api/sync/offset: the FileRef of the subtitle plus the absolute cumulative offset to apply.