cache

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "cache <path...>",
	Short: "Generate color cache from images or videos",
	Example: `
# Cache from a video
rong cache path/to/video.mkv

# Cache from a image
rong cache path/to/image.webp

# Cache all png in a directory
rong cache path/to/*.png

# Recursively cache all image and video in a directory
rong cache path/to/directory
  `,
	Args: cobra.MinimumNArgs(1),
	PreRun: func(cmd *cobra.Command, _ []string) {
		viper.BindPFlags(cmd.Flags())
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		ctx := cmd.Context()
		frames, _ := cmd.Flags().GetInt("frames")
		workers, _ := cmd.Flags().GetInt("workers")

		paths, err := ScanPaths(ctx, args)
		if err != nil {
			return err
		}

		if len(paths) == 0 {
			fmt.Println("No files found to process")
			return nil
		}

		model := newModel(ctx, paths, frames, workers)
		p := tea.NewProgram(model)
		if _, err := p.Run(); err != nil {
			return fmt.Errorf("error running program: %w", err)
		}

		return nil
	},
}

Command is cache command

Functions

func ScanPaths

func ScanPaths(ctx context.Context, paths []string) ([]string, error)

ScanPaths scans the given paths and returns absolute paths of image/video files

Types

This section is empty.

Jump to

Keyboard shortcuts

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