commands

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cut = cli.Command{
	Name: "cut",
	Usage: `Removes a certain range of time frames.

   If no file name is specified as a positional argument, a cast is
   expected to be served via stdin.

   Once the transformation has been performed, the resulting cast is
   either written to a file specified in the '--out' flag or to stdout
   (default).

EXAMPLES:
   Remove frames from 12.2s to 16.3s from the cast passed in the commands
   stdin.

     cat 1234.cast | \
       asciinema-edit cut \
         --start=12.2 --end=15.3

   Remove the exact frame at timestamp 12.2 from the cast file named
   1234.cast.

     asciinema-edit cut \
       --start=12.2 --end=12.2 \
       1234.cast`,
	ArgsUsage: "[filename]",
	Action:    cutAction,
	Flags: []cli.Flag{
		cli.Float64Flag{
			Name:  "start",
			Usage: "initial frame timestamp (required)",
		},
		cli.Float64Flag{
			Name:  "end",
			Usage: "final frame timestamp (required)",
		},
		cli.StringFlag{
			Name:  "out",
			Usage: "file to write the modified contents to",
		},
	},
}
View Source
var Quantize = cli.Command{
	Name: "quantize",
	Usage: `Updates the cast delays following quantization ranges.

   The command acts on the delays between the frames, reducing such
   timings to the lowest value defined in a given range that they
   lie in.

   For instance, consider the following timestamps:

      1  2  5  9 10 11

   Assuming that we quantize over [2,6), we'd cut any delays between 2 and
   6 seconds to 2 second:

      1  2  4  6  7  8

   This can be more easily visualized by looking at the delay quantization:

      delta = 1.000000 | qdelta = 1.000000
      delta = 3.000000 | qdelta = 2.000000
      delta = 4.000000 | qdelta = 2.000000
      delta = 1.000000 | qdelta = 1.000000
      delta = 1.000000 | qdelta = 1.000000

   If no file name is specified as a positional argument, a cast is
   expected to be serverd via stdin.

   Once the transformation has been performed, the resulting cast is
   either written to a file specified in the '--out' flag or to stdout
   (default).

EXAMPLES:
   Make the whole cast have a maximum delay of 1s:

     asciinema-edit quantize --range 2 ./123.cast

   Make the whole cast have time delays between 300ms and 1s cut to
   300ms, delays between 1s and 2s cut to 1s and any delays bigger
   than 2s, cut down to 2s:

     asciinema-edit quantize \
       --range 0.3,1 \
       --range 1,2 \
       --range 2 \
       ./123.cast`,
	ArgsUsage: "[filename]",
	Action:    quantizeAction,
	Flags: []cli.Flag{
		cli.StringSliceFlag{
			Name:  "range",
			Usage: "quantization ranges (comma delimited)",
		},
		cli.StringFlag{
			Name:  "out",
			Usage: "file to write the modified contents to",
		},
	},
}
View Source
var Speed = cli.Command{
	Name: "speed",
	Usage: `Updates the cast speed by a certain factor.

   If no file name is specified as a positional argument, a cast is
   expected to be serverd via stdin.

   If no range is specified (start=0, end=0), the whole event stream
   is processed.

   Once the transformation has been performed, the resulting cast is
   either written to a file specified in the '--out' flag or to stdout
   (default).

EXAMPLES:
   Make the whole cast ("123.cast") twice as slow:

     asciinema-edit speed --factor 2 ./123.cast

   Cut the duration in half:

     asciinema-edit speed --factor 0.5 ./123.cast

   Make only a certain part of the video twice as slow:

     asciinema-edit speed \
        --factor 2 \
        --start 12.231 \
        --factor 45.333 \
        ./123.cast`,
	ArgsUsage: "[filename]",
	Action:    speedAction,
	Flags: []cli.Flag{
		cli.Float64Flag{
			Name:  "factor",
			Usage: "number by which delays are multiplied by",
		},
		cli.Float64Flag{
			Name:  "start",
			Usage: "initial frame timestamp",
		},
		cli.Float64Flag{
			Name:  "end",
			Usage: "final frame timestamp",
		},
		cli.StringFlag{
			Name:  "out",
			Usage: "file to write the modified contents to",
		},
	},
}

Functions

func ParseQuantizeRange

func ParseQuantizeRange(input string) (res editor.QuantizeRange, err error)

ParseQuantizeRange takes an input string that represents a quantization range and converts it into a QuantizeRange instance.

It allows both bounded and unbounded ranges.

For instance: - bounded: 1,2 - unbounded: 1

Fails if the input can't be converted to a QuantizeRange.

Types

This section is empty.

Directories

Path Synopsis
Package transformer is an utility package designed to aid the process of taking a cast from a given input, applying a transformation to it and then outputting the transformed cast to somewhere.
Package transformer is an utility package designed to aid the process of taking a cast from a given input, applying a transformation to it and then outputting the transformed cast to somewhere.

Jump to

Keyboard shortcuts

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