video

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const LangUnknown = "00"

to be used for captions without a language code in the filename ISO 639-1 uses 2 or 3 a-z chars for codes so 00 is a safe non valid choise https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

Variables

View Source
var CaptionExts = []string{"vtt", "srt"} // in a case where vtt and srt files are both provided prioritize vtt file due to native support

Functions

func AssociateCaptions

func AssociateCaptions(ctx context.Context, captionPath string, txnMgr txn.Manager, fqb models.FileFinder, w CaptionUpdater)

associates captions to scene/s with the same basename

func CleanCaptions

func CleanCaptions(ctx context.Context, f *models.VideoFile, txnMgr txn.Manager, w CaptionUpdater) error

CleanCaptions removes non existent/accessible language codes from captions

func GetCaptionPath

func GetCaptionPath(path, lang, suffix string) string

GetCaptionPath generates the path of a caption from a given file path, wanted language and caption sufffix

func GetFunscriptPath

func GetFunscriptPath(path string) string

GetFunscriptPath returns the path of a file with the extension changed to .funscript

func IsLangInCaptions

func IsLangInCaptions(lang string, ext string, captions []*models.VideoCaption) bool

IsLangInCaptions returns true if lang is present in the captions

func IsValidLanguage

func IsValidLanguage(lang string) bool

IsValidLanguage checks whether the given string is a valid ISO 639 language code

func ReadSubs

func ReadSubs(path string) (*astisub.Subtitles, error)

ReadSubs reads a captions file

Types

type CaptionUpdater

type CaptionUpdater interface {
	GetCaptions(ctx context.Context, fileID models.FileID) ([]*models.VideoCaption, error)
	UpdateCaptions(ctx context.Context, fileID models.FileID, captions []*models.VideoCaption) error
}

type Decorator

type Decorator struct {
	FFProbe ffmpeg.FFProbe
}

Decorator adds video specific fields to a File.

func (*Decorator) Decorate

func (d *Decorator) Decorate(ctx context.Context, fs models.FS, f models.File) (models.File, error)

func (*Decorator) IsMissingMetadata

func (d *Decorator) IsMissingMetadata(ctx context.Context, fs models.FS, f models.File) bool

Jump to

Keyboard shortcuts

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