tool

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFFmeta

func ExtractFFmeta(input string) *ffmpeg.Cmd

func FindFilesByExt

func FindFilesByExt(ext, dir string) []file.File

func InitConfig

func InitConfig(v *viper.Viper)

func TmpFile

func TmpFile(d []byte) string

func Write

func Write(file *os.File, data []byte) *os.File

func WriteFile

func WriteFile(name, ext string, data []byte) string

Types

type ArgFlag

type ArgFlag struct {
	Profile string
	Start   string
	End     string
	Output  string
	ChapNo  int
	Input   string
	Cover   string
	Meta    string
	Cue     string
}

type BoolFlag

type BoolFlag struct {
	Meta      bool
	Cover     bool
	Cue       bool
	Chap      bool
	Json      bool
	Overwrite bool
	Verbose   bool
}

type Cmd

type Cmd struct {
	Profile   Profile
	Start     string
	End       string
	Output    file.File
	Input     file.File
	Cover     file.File
	Meta      file.File
	Cue       file.File
	Media     *Media
	Num       int
	PadOutput bool
	Padding   string
	ChapNo    int

	Batch []Command
	// contains filtered or unexported fields
}

func NewCmd

func NewCmd() *Cmd

func (*Cmd) Add

func (c *Cmd) Add(cmd Command) *Cmd

func (*Cmd) Bin

func (c *Cmd) Bin(bin string) *Cmd

func (Cmd) Build

func (c Cmd) Build() (*exec.Cmd, error)

func (*Cmd) Command

func (c *Cmd) Command(bin string, args []string) *Cmd

func (*Cmd) FFmpeg

func (c *Cmd) FFmpeg() *ffmpeg.Cmd

func (Cmd) HasChapNo

func (c Cmd) HasChapNo() bool

func (Cmd) HasCover

func (c Cmd) HasCover() bool

func (Cmd) HasCue

func (c Cmd) HasCue() bool

func (Cmd) HasEnd

func (c Cmd) HasEnd() bool

func (Cmd) HasInput

func (c Cmd) HasInput() bool

func (Cmd) HasMeta

func (c Cmd) HasMeta() bool

func (Cmd) HasOutput

func (c Cmd) HasOutput() bool

func (Cmd) HasStart

func (c Cmd) HasStart() bool

func (*Cmd) MkTmp

func (cmd *Cmd) MkTmp() *os.File

func (Cmd) ParseArgs

func (c Cmd) ParseArgs() ([]string, error)

func (*Cmd) ParseFlags

func (c *Cmd) ParseFlags(f Flag) *Cmd

func (Cmd) Run

func (c Cmd) Run() ([]byte, error)

func (Cmd) RunBatch

func (c Cmd) RunBatch() []byte

func (*Cmd) SetArgs

func (c *Cmd) SetArgs(args ...string) *Cmd

func (*Cmd) SetChapFlag

func (c *Cmd) SetChapFlag() *Cmd

func (*Cmd) SetCover

func (c *Cmd) SetCover(f string) *Cmd

func (*Cmd) SetCoverFlag

func (c *Cmd) SetCoverFlag() *Cmd

func (*Cmd) SetCue

func (c *Cmd) SetCue(f string) *Cmd

func (*Cmd) SetCueFlag

func (c *Cmd) SetCueFlag() *Cmd

func (*Cmd) SetInput

func (c *Cmd) SetInput(i string) *Cmd

func (*Cmd) SetMeta

func (c *Cmd) SetMeta(f string) *Cmd

func (*Cmd) SetMetaFlag

func (c *Cmd) SetMetaFlag() *Cmd

func (*Cmd) SetOutput

func (c *Cmd) SetOutput(o string) *Cmd

func (Cmd) String

func (c Cmd) String() string

func (*Cmd) Verbose

func (c *Cmd) Verbose() *Cmd

type Command

type Command interface {
	Build() (*exec.Cmd, error)
	String() string
	ParseArgs() ([]string, error)
	Run() ([]byte, error)
}

type Config

type Config struct {
	Defaults Defaults           `mapstructure:"default"`
	Profiles map[string]Profile `toml:"profile",mapstructure:"profiles"`
}

func Cfg

func Cfg() Config

func (Config) GetProfile

func (c Config) GetProfile(p string) Profile

func (Config) ListProfiles

func (c Config) ListProfiles() []string

type CutCmd

type CutCmd struct {
	*Cmd
}

func Cut

func Cut() *CutCmd

func (CutCmd) Chap

func (c CutCmd) Chap(no int) *ffmpeg.Cmd

func (*CutCmd) FFmpegCmd

func (c *CutCmd) FFmpegCmd() *ffmpeg.Cmd

func (*CutCmd) Parse

func (c *CutCmd) Parse() *Cmd

type Defaults

type Defaults struct {
	Profile   string
	Padding   string
	Output    string
	LogLevel  string
	Overwrite bool
}

func (Defaults) HasLogLevel

func (d Defaults) HasLogLevel() bool

func (Defaults) HasOutput

func (d Defaults) HasOutput() bool

func (Defaults) HasPadding

func (d Defaults) HasPadding() bool

func (Defaults) HasProfile

func (d Defaults) HasProfile() bool

type ExtractCmd

type ExtractCmd struct {
	*Cmd
}

func Extract

func Extract() *ExtractCmd

func (*ExtractCmd) Parse

func (e *ExtractCmd) Parse() *Cmd

type Flag

type Flag struct {
	Args ArgFlag
	Bool BoolFlag
}

type JoinCmd

type JoinCmd struct {
	*Cmd
	// contains filtered or unexported fields
}

func Join

func Join(ext, dir string) *JoinCmd

func (JoinCmd) CalculateChapters

func (j JoinCmd) CalculateChapters() chap.Chapters

func (*JoinCmd) Parse

func (j *JoinCmd) Parse() *Cmd

type Media

type Media struct {
	Input MediaFile
	Files RelatedFiles

	*ffmeta.Meta
	// contains filtered or unexported fields
}

func NewMedia

func NewMedia(i string) *Media

func (*Media) AddFile

func (m *Media) AddFile(name, path string) *Media

func (Media) AudioCodec

func (m Media) AudioCodec() string

func (Media) EachChapter

func (m Media) EachChapter() []*chap.Chapter

func (Media) EmbeddedCoverExt

func (m Media) EmbeddedCoverExt() string

func (Media) HasCue

func (m Media) HasCue() bool

func (Media) HasEmbeddedCover

func (m Media) HasEmbeddedCover() bool

func (Media) HasFFmeta

func (m Media) HasFFmeta() bool

func (*Media) ReadCueSheet

func (m *Media) ReadCueSheet() chap.Chapters

func (*Media) ReadEmbeddedMeta

func (m *Media) ReadEmbeddedMeta() *ffmeta.Meta

func (*Media) ReadFFmeta

func (m *Media) ReadFFmeta() *ffmeta.Meta

func (*Media) SetCue

func (m *Media) SetCue(c string) *Media

func (*Media) SetFFmeta

func (m *Media) SetFFmeta(ff string) *Media

func (*Media) SetMeta

func (m *Media) SetMeta() *Media

type MediaFile

type MediaFile struct {
	file.File
}

func (MediaFile) IsAudio

func (f MediaFile) IsAudio() bool

func (MediaFile) IsFFmeta

func (f MediaFile) IsFFmeta() bool

func (MediaFile) IsImage

func (f MediaFile) IsImage() bool

func (MediaFile) IsPlainText

func (f MediaFile) IsPlainText() bool

type Output

type Output struct {
	Padding string

	file.File
	// contains filtered or unexported fields
}

func NewOutput

func NewOutput(o string) *Output

func (Output) String

func (o Output) String() string

type Profile

type Profile struct {
	PreInput     []string
	PostInput    []string
	VideoCodec   string
	VideoParams  map[string]string
	VideoFilters map[string]string
	AudioCodec   string
	AudioParams  map[string]string
	AudioFilters map[string]string
	Filters      map[string]string
	Ext          string
}

func (Profile) FFmpegCmd

func (p Profile) FFmpegCmd() *ffmpeg.Cmd

type RelatedFiles

type RelatedFiles map[string]MediaFile

func (RelatedFiles) Get

func (r RelatedFiles) Get(name string) MediaFile

func (RelatedFiles) Has

func (r RelatedFiles) Has(name string) bool

type RmCmd

type RmCmd struct {
	*Cmd
}

func Rm

func Rm() *RmCmd

func (*RmCmd) Parse

func (rm *RmCmd) Parse() *Cmd

type SplitCmd

type SplitCmd struct {
	*Cmd
}

func Split

func Split() *SplitCmd

func (*SplitCmd) Parse

func (s *SplitCmd) Parse() *Cmd

type Update

type Update struct {
	*Cmd
	FFmpeg *ffmpeg.Cmd
	// contains filtered or unexported fields
}

func NewUpdateCmd

func NewUpdateCmd() *Update

func (*Update) Parse

func (u *Update) Parse() *Cmd

Jump to

Keyboard shortcuts

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