cmd

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathFromTemplate

func PathFromTemplate(template string, args ...any) string

func WalkFS

func WalkFS(ctx context.Context, root string, fn func(context.Context, string, string, fs.DirEntry, *Templater) error, opts ...WalkOpt) error

Types

type ArtworkCmd

type ArtworkCmd struct {
	BaseCmd
	Path      string   `arg:"" name:"path" type:"path" help:"File to extract artwork from." default:"."`
	Out       string   `flag:"" name:"out" help:"Output template for artwork files." required:""`
	Recursive bool     `flag:"" name:"recursive" short:"r" help:"Recursively extract artwork from files in a directory." negatable:""`
	Exclude   []string `flag:"" name:"exclude" help:"Exclude files with these extensions (e.g. .jpg, .png)."`
}

func (*ArtworkCmd) Run

func (c *ArtworkCmd) Run(ctx server.Cmd) error

type AudioSegmentCmd

type AudioSegmentCmd struct {
	BaseCmd
	File             string        `arg:"" name:"file" type:"existingfile" help:"File to segment."`
	Out              string        `flag:"" name:"out" help:"Output directory for encoded segment M4A files." default:"." type:"path"`
	Duration         time.Duration `flag:"" name:"duration" help:"Target segment duration (e.g. 30s). Use 0s to disable fixed-size splits."`
	Silence          bool          `flag:"" name:"silence" help:"Enable silence-based segmentation." negatable:"" default:"true"`
	SilenceDuration  time.Duration `` /* 150-byte string literal not displayed */
	SilenceThreshold float64       `` /* 157-byte string literal not displayed */
}

func (*AudioSegmentCmd) Run

func (c *AudioSegmentCmd) Run(ctx server.Cmd) error

type BaseCmd

type BaseCmd struct {
	ChromaprintKey string `name:"chromaprint-key" env:"CHROMAPRINT_KEY" help:"AcoustID API key for chromaprint lookups"`
}

func (*BaseCmd) IsJSONOutput

func (runner *BaseCmd) IsJSONOutput(ctx server.Cmd) (bool, int)

func (*BaseCmd) WithManager

func (runner *BaseCmd) WithManager(ctx server.Cmd, fn func(*manager.Media) error) error

type CapabilitiesCLICommands

type CapabilitiesCLICommands struct {
	Codecs  CodecCmd   `cmd:"" name:"codecs" help:"List codecs." group:"CAPABILITIES"`
	Filters FiltersCmd `cmd:"" name:"filters" help:"List filters." group:"CAPABILITIES"`
	Formats FormatsCmd `cmd:"" name:"formats" help:"List formats and devices." group:"CAPABILITIES"`
}

type CodecCmd

type CodecCmd struct {
	BaseCmd
	schema.ListCodecRequest
}

func (*CodecCmd) Run

func (c *CodecCmd) Run(ctx server.Cmd) error

type EncodingCLICommands

type EncodingCLICommands struct {
	AudioSegment AudioSegmentCmd `cmd:"" name:"audio-segment" help:"Segment audio and log segments." group:"ENCODING"`
}

type FiltersCmd

type FiltersCmd struct {
	BaseCmd
	schema.ListFilterRequest
}

func (*FiltersCmd) Run

func (c *FiltersCmd) Run(ctx server.Cmd) error

type FormatsCmd

type FormatsCmd struct {
	BaseCmd
	schema.ListFormatRequest
}

func (*FormatsCmd) Run

func (c *FormatsCmd) Run(ctx server.Cmd) error

type MetadataCLICommands

type MetadataCLICommands struct {
	Metadata MetadataCmd `cmd:"" name:"metadata" help:"Extract metadata." group:"METADATA"`
	Artwork  ArtworkCmd  `cmd:"" name:"artwork" help:"Extract artwork." group:"METADATA"`
	Probe    ProbeCmd    `cmd:"" name:"probe" help:"Probe media file." group:"METADATA"`
	MetadataChromaprintCLICommands
}

type MetadataChromaprintCLICommands

type MetadataChromaprintCLICommands struct{}

MetadataChromaprintCLICommands is empty unless built with -tags chromaprint.

type MetadataCmd

type MetadataCmd struct {
	BaseCmd
	Path      string   `arg:"" name:"path" type:"path" help:"File to extract metadata from." default:"."`
	Out       string   `flag:"" name:"out" help:"Output template for metadata files."`
	Recursive bool     `flag:"" name:"recursive" short:"r" help:"Recursively extract metadata from files in a directory." negatable:""`
	Exclude   []string `flag:"" name:"exclude" help:"Exclude files with these extensions (e.g. .jpg, .png)."`
	Namespace string   `flag:"" name:"namespace" help:"Namespace to extract." default:""`
}

func (*MetadataCmd) Run

func (c *MetadataCmd) Run(ctx server.Cmd) error

type ProbeCmd

type ProbeCmd struct {
	BaseCmd
	File string `arg:"" name:"path" type:"path" help:"File to probe."`
	schema.ProbeRequest
}

func (*ProbeCmd) Run

func (c *ProbeCmd) Run(ctx server.Cmd) error

type RunServer

type RunServer struct {
	BaseCmd
	servercmd.RunServer
}

func (*RunServer) Run

func (runner *RunServer) Run(ctx server.Cmd) error

type ServerCommands

type ServerCommands struct {
	RunServer RunServer `cmd:"" name:"run" help:"Run the gomedia server." group:"SERVER"`
	servercmd.OpenAPICommands
}

type Templater

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

func NewTemplater

func NewTemplater(t string) (*Templater, error)

func (*Templater) Create

func (t *Templater) Create(data map[string]any, fn func(w io.Writer) error) error

Create any directories needed for the given path, then create the file, and return the writer for the file.

func (*Templater) Path

func (t *Templater) Path(data map[string]any) (string, error)

Return the path generated from the template and the given data.

type WalkOpt

type WalkOpt func(*opt) error

func WithExcludeExt

func WithExcludeExt(exts ...string) WalkOpt

func WithRecursive

func WithRecursive() WalkOpt

func WithTemplate

func WithTemplate(t string) WalkOpt

Jump to

Keyboard shortcuts

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