Documentation
¶
Index ¶
- func CollectVideoFiles(ctx context.Context, source string, preferLargest bool) (string, []string, error)
- func CopyFile(src, dst string) error
- func DetectDiscType(ctx context.Context, root string) (string, error)
- func FormatDuration(seconds float64) string
- func GatherQueuePaths(ctx context.Context, root string) ([]string, error)
- func IsVideoFile(name string) bool
- func LimitQueuePaths(paths []string, limit int) []string
- func SourceSize(ctx context.Context, sourcePath, discType string, fileList []string, ...) (int64, error)
- func SupportedVideoExtensions() []string
- type MoviePlaylistHeader
- type PlaylistData
- type PlaylistInfo
- type PlaylistItem
- type PlaylistItemInfo
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectVideoFiles ¶
func CollectVideoFiles(ctx context.Context, source string, preferLargest bool) (string, []string, error)
CollectVideoFiles returns a selected video and candidate list for a non-disc source. A file source is returned regardless of extension. A directory scan is non-recursive, includes recognized video extensions, excludes sample-like names except !sample, and sorts candidates by path. Selection uses the first candidate unless preferLargest is set.
func CopyFile ¶
CopyFile copies src to dst, creating or truncating dst without creating its parent directory. It applies the source mode when available; copy failures may leave a partial destination.
func DetectDiscType ¶
DetectDiscType recursively scans root for disc folder markers and returns "BDMV", "DVD", "HDDVD", or "" when none is found. BDMV matching is case-insensitive; VIDEO_TS and HVDVD_TS matching is exact.
func FormatDuration ¶
FormatDuration truncates fractional seconds and formats the result as HH:MM:SS; hours are not capped at 24.
func GatherQueuePaths ¶
GatherQueuePaths returns sorted absolute host paths for first-level upload candidates. A file root is returned directly; directory children are kept only when they are video files or directories containing video or disc data.
func IsVideoFile ¶
IsVideoFile reports whether name has a recognized extension, ignoring case.
func LimitQueuePaths ¶
LimitQueuePaths returns a defensive copy capped at limit. A non-positive limit returns all paths.
func SourceSize ¶
func SourceSize(ctx context.Context, sourcePath, discType string, fileList []string, videoPath string) (int64, error)
SourceSize returns content size in bytes. Disc sources walk the full tree and report traversal errors. Other sources prefer nonblank fileList entries, fall back to videoPath when none remain, and silently skip missing, inaccessible, or non-regular files.
func SupportedVideoExtensions ¶
func SupportedVideoExtensions() []string
SupportedVideoExtensions returns a sorted copy of recognized lowercase extensions.
Types ¶
type MoviePlaylistHeader ¶
type MoviePlaylistHeader struct {
TypeIndicator string
VersionNumber string
PlaylistStartAddress uint32
PlaylistMarkStartAddress uint32
ExtensionDataStartAddress uint32
}
MoviePlaylistHeader represents the MPLS file header.
type PlaylistData ¶
type PlaylistData struct {
Length uint32
NbPlayItems uint16
NbSubPaths uint16
PlayItems []PlaylistItem
}
PlaylistInfo represents a parsed playlist structure.
type PlaylistInfo ¶
type PlaylistInfo struct {
File string
Duration float64
Items []PlaylistItem
Score float64
Edition string
}
PlaylistInfo describes one MPLS candidate. File and item names are basenames, Duration is seconds, item sizes are bytes, and Score ranks main-feature likelihood. Edition is currently left empty by discovery.
func DiscoverPlaylists ¶
func DiscoverPlaylists(ctx context.Context, bdmvRoot string) ([]PlaylistInfo, error)
DiscoverPlaylists discovers and scores all MPLS files in a BDMV folder. It returns candidates ordered by descending score.
type PlaylistItem ¶
PlaylistItem identifies one referenced stream basename and its size in bytes.
type PlaylistItemInfo ¶
PlaylistItemInfo represents a single play item in a playlist with timing info.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator() *Validator