pipeline

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 19 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  `flagger.usage:"input directory"`
	ProfileName string  `flagger.name:"profile" flagger.usage:"conversion profile"`
	Profile     Profile `flagger.skip:"true"`
	Active      bool    `flagger.usage:"start processor in active mode"`
	Remove      bool    `flagger.usage:"remove source files after successful conversion"`
	Overwrite   bool    `flagger.usage:"overwrite existing files"`
}

func GetConfigurationFromViper

func GetConfigurationFromViper(v *viper.Viper) (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
}

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) List

func (q *Queue) List() []*WorkItem

List returns all items in the queue. This clones the contained slice. For performance reasons, this should only be used for testing. Use All(), which returns an iterator, instead.

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

func (*Queue) ToggleActive

func (q *Queue) ToggleActive()

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