analyzer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnableToAnalyzeAudioStream    = errUnableToAnalyzeStream(datatype.Codec_Audio)
	ErrUnableToAnalyzeVideoStream    = errUnableToAnalyzeStream(datatype.Codec_Video)
	ErrUnableToAnalyzeSubtitleStream = errUnableToAnalyzeStream(datatype.Codec_Subtitle)
)

Functions

This section is empty.

Types

type AnalyzeResult

type AnalyzeResult[P AnalyzerPath] struct {
	StreamIndex int
	Stream      *datatype.Stream
	Path        P
}

type Analyzer

type Analyzer interface {
	// Subtitle will return the subtitle stream, after numerous of checks it'll
	// return the stream index, the stream and an error if we weren't able
	// to analyze what stream to use. If the index is -1 and there are no errors, it means
	// that this video has no subtitle stream and it's either hardsubbed or raw.
	Subtitle(ctx context.Context) (result AnalyzeResult[SubtitleAnalyzerPath], err error)

	Video(ctx context.Context) (result AnalyzeResult[VideoAnaylzerPath], err error)

	Audio(ctx context.Context) (result AnalyzeResult[AudioAnalyzerPath], err error)

	// Duration will attempt to retrieve the correct duration for a media file.
	// There are some cases where the video's duration is set to an hour but the actual
	// episode's duration is set to 24 minutes.
	Duration(ctx context.Context) (duration float64, err error)
}

func Analyze

func Analyze(ctx context.Context, source string) (Analyzer, error)

Analyze will return an analyzer

type AnalyzerPath

type AnalyzerPath interface {
	SubtitleAnalyzerPath | VideoAnaylzerPath | AudioAnalyzerPath
}

type AudioAnalyzerPath

type AudioAnalyzerPath int
const (
	AudioAnalyzerPath_Japanese AudioAnalyzerPath = iota << 1
	AudioAnalyzerPath_OnlyOne
	AudioAnalyzerPath_DefaultDisposition
)

type SubtitleAnalyzerPath

type SubtitleAnalyzerPath int
const (
	SubtitleAnalyzerPath_None SubtitleAnalyzerPath = iota << 1
	SubtitleAnalyzerPath_OnlyOne
	SubtitleAnalyzerPath_SingleEnglish
	SubtitleAnalyzerPath_FullSubtitles
	SubtitleAnalyzerPath_StartPts
	SubtitleAnalyzerPath_StreamSize
	SubtitleAnalyzerPath_PacketCount
	SubtitleAnalyzerPath_Unlocalised
	SubtitleAnalyzerPath_FirstEnglish
	SubtitleAnalyzerPath_FirstJapanese
)

type VideoAnaylzerPath

type VideoAnaylzerPath int
const (
	VideoAnaylzerPath_Default VideoAnaylzerPath = iota << 1
)

Jump to

Keyboard shortcuts

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