pipeline

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecoderArguments

func DecoderArguments(videoStats ffmpeg.VideoStats) []string

func Inspect

func Inspect(ctx context.Context, ch <-chan *WorkItem, cfg Configuration, probe func(string) (ffmpeg.VideoStats, error), f fileChecker, logger *slog.Logger)

func Run

func Run(subCtx context.Context, cfg Configuration, queue *Queue, l *slog.Logger) error

func Scan

func Scan(ctx context.Context, baseDir string, queue *Queue, ch chan<- *WorkItem, logger *slog.Logger) error

func ScanFS

func ScanFS(ctx context.Context, fileSystem fs.FS, baseDir string, queue *Queue, ch chan<- *WorkItem, logger *slog.Logger) error

func SupportedProfiles

func SupportedProfiles() []string

func Transcode

func Transcode(ctx context.Context, queue *Queue, cfg Configuration, logger *slog.Logger)

Types

type Configuration

type Configuration struct {
	Log
	Input       string
	ProfileName string
	Profile     Profile
	Active      bool
	Remove      bool
	Overwrite   bool
}

func GetConfigurationFromViper

func GetConfigurationFromViper(v *viper.Viper, args []string) (cfg Configuration, err error)

type Decoder

type Decoder interface {
	Scan(ctx context.Context, path string) (ffmpeg.VideoStats, error)
}

type Log added in v0.6.0

type Log struct {
	Level  string
	Format string
}

func (Log) Logger added in v0.6.1

func (l Log) Logger(w io.Writer, opts *slog.HandlerOptions) *slog.Logger

Logger returns a new logger with the given options, writing to w. If w is nil, it defaults to os.Stderr.

type MediaFile

type MediaFile struct {
	Path       string
	VideoStats ffmpeg.VideoStats
}

type Profile

type Profile struct {
	TargetCodec string
	Rules       []Rule
	CapBitrate  bool
}

func GetProfile

func GetProfile(name string) (Profile, error)

GetProfile returns the profile associated with name.

func (*Profile) Inspect

func (p *Profile) Inspect(item *WorkItem) (*ffmpeg.FFMPEG, error)

type Progress

type Progress struct {
	Duration time.Duration
	// contains filtered or unexported fields
}

func (*Progress) Completed

func (p *Progress) Completed() float64

func (*Progress) Remaining

func (p *Progress) Remaining() time.Duration

func (*Progress) Update

func (p *Progress) Update(progress ffmpeg.Progress)

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func (*Queue) Active

func (q *Queue) Active() bool

func (*Queue) Add

func (q *Queue) Add(filename string) *WorkItem

func (*Queue) All

func (q *Queue) All() iter.Seq[*WorkItem]

func (*Queue) NextToConvert

func (q *Queue) NextToConvert() *WorkItem

func (*Queue) Queue

func (q *Queue) Queue(item *WorkItem)

Queue adds an item ready to be converted. This item will be processed, regardless of whether the queue is active or not.

func (*Queue) SetActive

func (q *Queue) SetActive(active bool)

func (*Queue) Size

func (q *Queue) Size() int

func (*Queue) Stats added in v0.6.0

func (q *Queue) Stats() map[Status]int

type Rule

type Rule func(profile *Profile, sourceStats ffmpeg.VideoStats) error

func RejectBitrateTooLow

func RejectBitrateTooLow() Rule

func RejectVideoHeightTooLow

func RejectVideoHeightTooLow(height int) Rule

func SkipTargetCodec

func SkipTargetCodec() Rule

type SourceRejectedError

type SourceRejectedError struct {
	Reason string
}

func (*SourceRejectedError) Error

func (e *SourceRejectedError) Error() string

func (*SourceRejectedError) Is

func (e *SourceRejectedError) Is(e2 error) bool

type SourceSkippedError

type SourceSkippedError struct {
	Reason string
}

func (*SourceSkippedError) Error

func (e *SourceSkippedError) Error() string

func (*SourceSkippedError) Is

func (e *SourceSkippedError) Is(e2 error) bool

type Status

type Status int
const (
	Waiting Status = iota
	Inspecting
	Skipped
	Rejected
	Inspected
	Converting
	Converted
	Failed
)

func (Status) String

func (s Status) String() string

type WorkItem

type WorkItem struct {
	Source   MediaFile
	Target   MediaFile
	Progress Progress
	// contains filtered or unexported fields
}

func (*WorkItem) CompletedFormatted

func (w *WorkItem) CompletedFormatted() string

func (*WorkItem) RemainingFormatted

func (w *WorkItem) RemainingFormatted() string

func (*WorkItem) SetWorkStatus

func (w *WorkItem) SetWorkStatus(workStatus WorkStatus)

func (*WorkItem) SourceVideoStats

func (w *WorkItem) SourceVideoStats() ffmpeg.VideoStats

func (*WorkItem) TargetVideoStats

func (w *WorkItem) TargetVideoStats() ffmpeg.VideoStats

func (*WorkItem) WorkStatus

func (w *WorkItem) WorkStatus() WorkStatus

type WorkStatus

type WorkStatus struct {
	Err    error
	Status Status
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL