makemkvcon

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnhandledLine = fmt.Errorf("unhandled line")
	ErrNotFound      = fmt.Errorf("not found")
)

Functions

func Maximums

func Maximums[S []E, E any, V constraints.Ordered](s S, f func(E) (V, error)) S

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

func ParseLines

func ParseLines(r io.Reader) iter.Seq2[Line, error]

Types

type CurrentProgressLine

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

func ParseCurrentProgressLine

func ParseCurrentProgressLine(s string) (*CurrentProgressLine, error)

func (*CurrentProgressLine) Kind

func (l *CurrentProgressLine) Kind() LineKind

type Disc

type Disc struct {
	Info

	Titles []*Title
}

func (*Disc) TitleCount

func (d *Disc) TitleCount() int

func (*Disc) TitlesWithAngle

func (d *Disc) TitlesWithAngle(targetAngle int) []*Title

func (*Disc) TitlesWithLongestDuration

func (d *Disc) TitlesWithLongestDuration() []*Title

func (*Disc) TitlesWithMostChapters

func (d *Disc) TitlesWithMostChapters() []*Title

func (*Disc) TitlesWithMostStreams

func (d *Disc) TitlesWithMostStreams() []*Title

type DiscInfoLine

type DiscInfoLine struct {
	*InfoLine
}

func ParseDiscInfoLine

func ParseDiscInfoLine(s string) (*DiscInfoLine, error)

func (*DiscInfoLine) Kind

func (l *DiscInfoLine) Kind() LineKind

type DriveScanLine

type DriveScanLine struct {
	Index      int    `json:"index"`
	Field1     int    `json:"visible"`
	Field2     int    `json:"enabled"`
	Field3     int    `json:"flags"`
	DriveName  string `json:"drive_name"`
	DiscTitle  string `json:"disc_title"`
	VolumeName string `json:"volume_name"`
}

From https://makemkv.com/developers/usage.txt:

DRV:index,visible,enabled,flags,drive name,disc name index - drive index visible - set to 1 if drive is present enabled - set to 1 if drive is accessible flags - media flags, see AP_DskFsFlagXXX in apdefs.h drive name - drive name string disc name - disc name string

Errata:

  • Field 1 (visible?) is not boolean (e.g., 0, 1, 2)
  • Field 2 (enabled?) is not boolean (e.g., 999)
  • Undocumented title field between drive and disc name

func ParseDriveScanLine

func ParseDriveScanLine(s string) (*DriveScanLine, error)

func (*DriveScanLine) Kind

func (l *DriveScanLine) Kind() LineKind

type Info

type Info []*InfoLine

func (Info) GetAttr

func (info Info) GetAttr(id defs.Attr) (string, error)

func (Info) GetAttrDefault added in v0.2.0

func (info Info) GetAttrDefault(id defs.Attr, defaultValue string) string

func (Info) GetAttrDuration

func (info Info) GetAttrDuration(id defs.Attr) (time.Duration, error)

func (Info) GetAttrInt

func (info Info) GetAttrInt(id defs.Attr) (int, error)

type InfoLine

type InfoLine struct {
	ID    defs.Attr `json:"id"`
	Code  int       `json:"code"`
	Value string    `json:"value"`
	// contains filtered or unexported fields
}

From https://makemkv.com/developers/usage.txt:

CINFO:id,code,value TINFO:id,code,value SINFO:id,code,value id - attribute id, see AP_ItemAttributeId in apdefs.h code - message code if attribute value is a constant string value - attribute value

func (*InfoLine) String

func (l *InfoLine) String() string

type Line

type Line interface {
	Kind() LineKind
}

func ParseLine

func ParseLine(s string) (Line, error)

type LineIterator

type LineIterator[T any] struct {
	Seq iter.Seq2[Line, error]
	// contains filtered or unexported fields
}

func (*LineIterator[T]) GetResult

func (li *LineIterator[T]) GetResult() (T, error)

type LineKind

type LineKind int
const (
	LineKindUnknown LineKind = iota
	LineKindMessage
	LineKindDriveScan
	LineKindTitleCount
	LineKindDiscInfo
	LineKindTitleInfo
	LineKindStreamInfo
	LineKindCurrentProgress
	LineKindTotalProgress
	LineKindProgressBar
)

type MakeMKVCon

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

func New

func New(cfg *MakeMKVConConfig) (*MakeMKVCon, error)

func (*MakeMKVCon) BackupTitle

func (c *MakeMKVCon) BackupTitle(ctx context.Context, driveIndex, titleIndex int, dstDir string) (iter.Seq2[Line, error], error)

func (*MakeMKVCon) ListDrives

func (c *MakeMKVCon) ListDrives(ctx context.Context) (*LineIterator[[]*DriveScanLine], error)

func (*MakeMKVCon) ScanDrive

func (c *MakeMKVCon) ScanDrive(ctx context.Context, driveIndex int) (*LineIterator[*Disc], error)

type MakeMKVConConfig

type MakeMKVConConfig struct {
	ExePath          string ``                 // path to makemkvcon executable
	ProfilePath      string ``                 // path to makemkv profile XML
	ReadCacheSizeMB  int64  `validate:"min=1"` // --cache argument
	MinLengthSeconds int64  `validate:"min=1"` // --minlength argument
}

func (*MakeMKVConConfig) Validate

func (cfg *MakeMKVConConfig) Validate() error

type MessageLine

type MessageLine struct {
	Code      int      `json:"code"`
	Flags     int      `json:"flags"`
	NumParams int      `json:"num_params"`
	Message   string   `json:"message"`
	Format    string   `json:"format"`
	Params    []string `json:"params"`
}

From https://makemkv.com/developers/usage.txt:

MSG:code,flags,count,message,format,param0,param1,... code - unique message code, should be used to identify particular string in language-neutral way. flags - message flags, see AP_UIMSG_xxx flags in apdefs.h count - number of parameters message - raw message string suitable for output format - format string used for message. This string is localized and subject to change, unlike message code. paramX - parameter for message

func ParseMessageLine

func ParseMessageLine(s string) (*MessageLine, error)

func (*MessageLine) Kind

func (l *MessageLine) Kind() LineKind

type ProgressBarLine

type ProgressBarLine struct {
	Current int `json:"current"`
	Total   int `json:"total"`
	Max     int `json:"max"`
}

From https://makemkv.com/developers/usage.txt:

Progress bar values for current and total progress PRGV:current,total,max current - current progress value total - total progress value max - maximum possible value for a progress bar, constant

func ParseProgressBarLine

func ParseProgressBarLine(s string) (*ProgressBarLine, error)

func (*ProgressBarLine) CurrentProgress

func (l *ProgressBarLine) CurrentProgress() float64

func (*ProgressBarLine) Kind

func (l *ProgressBarLine) Kind() LineKind

func (*ProgressBarLine) TotalProgress

func (l *ProgressBarLine) TotalProgress() float64

type Stream

type Stream struct {
	Index int

	Info
}

type StreamInfoLine

type StreamInfoLine struct {
	TitleIndex  int `json:"title_index"`
	StreamIndex int `json:"stream_index"`

	*InfoLine
}

func ParseStreamInfoLine

func ParseStreamInfoLine(s string) (*StreamInfoLine, error)

func (*StreamInfoLine) Kind

func (l *StreamInfoLine) Kind() LineKind

type Title

type Title struct {
	Index int

	Info

	Streams []*Stream
}

type TitleCountLine

type TitleCountLine struct {
	Count int `json:"count"`
}

From https://makemkv.com/developers/usage.txt:

TCOUT:count count - titles count

func ParseTitleCountLine

func ParseTitleCountLine(s string) (*TitleCountLine, error)

func (*TitleCountLine) Kind

func (l *TitleCountLine) Kind() LineKind

type TitleInfoLine

type TitleInfoLine struct {
	TitleIndex int `json:"title_index"`

	*InfoLine
}

func ParseTitleInfoLine

func ParseTitleInfoLine(s string) (*TitleInfoLine, error)

func (*TitleInfoLine) Kind

func (l *TitleInfoLine) Kind() LineKind

type TotalProgressLine

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

func ParseTotalProgressLine

func ParseTotalProgressLine(s string) (*TotalProgressLine, error)

func (*TotalProgressLine) Kind

func (l *TotalProgressLine) Kind() LineKind

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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