* feat(scanner): capture audio stream profile metadata Store ffprobe audio stream profiles in the existing audio track metadata JSON. This mirrors the video track profile field and is additive for clients that want to display or inspect codec profile details. * feat(catalogseed): carry audio profile in seed export records Keep AudioTrackRecord in parity with VideoTrackRecord, which already mirrors the video profile field, so seed exports do not drop the new audio profile metadata. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Silo Contributor <silo-contributor@example.invalid> Co-authored-by: Quick <31828688+Quick104@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
164 lines
4.4 KiB
Go
164 lines
4.4 KiB
Go
package scanner
|
|
|
|
// ScanResult contains the outcome of scanning a media folder.
|
|
type ScanResult struct {
|
|
New int
|
|
Updated int
|
|
Unchanged int
|
|
Missing int
|
|
FilesDeleted int
|
|
MembershipsRemoved int
|
|
ItemsDeleted int
|
|
Errors int
|
|
EmptyRootGuarded bool
|
|
RootObservations []RootObservation
|
|
}
|
|
|
|
// FileHints contains the OSHash gathered during scanning.
|
|
type FileHints struct {
|
|
FileHash string // OSHash from xattr or computed
|
|
}
|
|
|
|
// ProbeData contains media file technical information from ffprobe.
|
|
type ProbeData struct {
|
|
CodecVideo string
|
|
CodecAudio string
|
|
Resolution string // 1080p, 2160p, etc.
|
|
AudioChannels int
|
|
HDR bool
|
|
Container string
|
|
Duration int // seconds
|
|
Bitrate int // kbps
|
|
VideoTracks []VideoTrackInfo
|
|
AudioTracks []AudioTrackInfo
|
|
SubtitleTracks []SubtitleTrackInfo
|
|
Chapters []ChapterInfo
|
|
FormatTags map[string]string // format-level tags from ffprobe (title, artist, album, date, etc.)
|
|
}
|
|
|
|
// VideoTrackInfo describes a probed video track.
|
|
type VideoTrackInfo struct {
|
|
Title string
|
|
Codec string
|
|
DolbyVision string
|
|
DVProfile int
|
|
DVBLCompatID int
|
|
DVELPresent bool
|
|
HDR10Plus bool
|
|
Profile string
|
|
Level int
|
|
Width int
|
|
Height int
|
|
AspectRatio string
|
|
Interlaced bool
|
|
FrameRate string
|
|
Bitrate int
|
|
VideoRange string
|
|
VideoRangeType string
|
|
ColorPrimaries string
|
|
ColorSpace string
|
|
ColorTransfer string
|
|
BitDepth int
|
|
PixelFormat string
|
|
ReferenceFrames int
|
|
}
|
|
|
|
// AudioTrackInfo describes a probed audio track.
|
|
type AudioTrackInfo struct {
|
|
Title string
|
|
EmbeddedTitle string
|
|
Language string
|
|
Codec string
|
|
Profile string
|
|
Layout string
|
|
Channels int
|
|
Bitrate int
|
|
SampleRate int
|
|
BitDepth int
|
|
Default bool
|
|
}
|
|
|
|
// SubtitleTrackInfo describes an embedded subtitle track from probing.
|
|
type SubtitleTrackInfo struct {
|
|
Index int
|
|
Language string
|
|
Codec string
|
|
Title string
|
|
EmbeddedTitle string
|
|
Resolution string
|
|
Forced bool
|
|
Default bool
|
|
HearingImpaired bool
|
|
}
|
|
|
|
// ExternalSubtitleInfo describes a discovered sidecar subtitle file.
|
|
type ExternalSubtitleInfo struct {
|
|
Path string
|
|
Language string
|
|
Format string // srt, vtt, ass, ssa, sub
|
|
Title string
|
|
Forced bool
|
|
}
|
|
|
|
// ChapterInfo describes an embedded chapter extracted from ffprobe.
|
|
type ChapterInfo struct {
|
|
Index int
|
|
Title string
|
|
StartSeconds float64
|
|
EndSeconds float64
|
|
Source string
|
|
}
|
|
|
|
// IntroCreditsMarkers contains intro/credits timing from S3 markers.
|
|
type IntroCreditsMarkers struct {
|
|
IntroStart *float64
|
|
IntroEnd *float64
|
|
CreditsStart *float64
|
|
CreditsEnd *float64
|
|
}
|
|
|
|
// MarkerUpdate is the narrow marker-only update payload shared by scanner and analyzers.
|
|
type MarkerUpdate struct {
|
|
IntroStart *float64
|
|
IntroEnd *float64
|
|
CreditsStart *float64
|
|
CreditsEnd *float64
|
|
RecapStart *float64
|
|
RecapEnd *float64
|
|
PreviewStart *float64
|
|
PreviewEnd *float64
|
|
MarkersSource string
|
|
MarkersProvider *string
|
|
MarkersConfidence *float64
|
|
MarkersAlgorithm string
|
|
|
|
// Optional per-segment provenance overrides. When set for a segment,
|
|
// UpsertMarkers writes these source/provider/confidence/algorithm values
|
|
// for that segment instead of the shared Markers* fields above. Used by
|
|
// merged multi-provider results where each segment may come from a
|
|
// different provider/source class; left nil for single-source writes
|
|
// (scanner/s3/local).
|
|
IntroProvenance *SegmentProvenance
|
|
CreditsProvenance *SegmentProvenance
|
|
RecapProvenance *SegmentProvenance
|
|
PreviewProvenance *SegmentProvenance
|
|
}
|
|
|
|
// SegmentProvenance is a per-segment attribution override for MarkerUpdate.
|
|
// When Source is empty, the shared MarkerUpdate.MarkersSource applies.
|
|
type SegmentProvenance struct {
|
|
Source string
|
|
Provider *string
|
|
Confidence *float64
|
|
Algorithm string
|
|
}
|
|
|
|
// HasAnySegment reports whether the update would write at least one segment.
|
|
// An update with no segment bounds set is a no-op and skipped by UpsertMarkers.
|
|
func (u MarkerUpdate) HasAnySegment() bool {
|
|
return u.IntroStart != nil || u.IntroEnd != nil ||
|
|
u.CreditsStart != nil || u.CreditsEnd != nil ||
|
|
u.RecapStart != nil || u.RecapEnd != nil ||
|
|
u.PreviewStart != nil || u.PreviewEnd != nil
|
|
}
|