metadata

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertImageForOCR added in v0.0.38

func ConvertImageForOCR(ctx context.Context, path string) (string, error)

ConvertImageForOCR converts images to PNG format for better OCR compatibility. Tesseract and PaddleOCR work best with PNG/TIFF. This function converts problematic formats (webp, bmp, gif, tiff) to PNG using ffmpeg or ImageMagick. Returns the path to the converted image, or the original path if no conversion needed.

func DecodeFullScan

func DecodeFullScan(ctx context.Context, path string) (float64, error)

func DecodeQuickScan

func DecodeQuickScan(ctx context.Context, path string, scans []float64, scanDuration float64) float64

func ExtractImageTextFromComicArchive added in v0.0.38

func ExtractImageTextFromComicArchive(ctx context.Context, path, ocrEngine string) ([]db.InsertCaptionParams, error)

ExtractImageTextFromComicArchive extracts text from images in CBZ/CBR archives using OCR. Returns captions with page numbers as timestamps (page 1 = 0s, page 2 = 1s, etc.)

func ExtractSpeechToText added in v0.0.38

func ExtractSpeechToText(ctx context.Context, path, engine string) ([]db.InsertCaptionParams, error)

ExtractSpeechToText extracts speech-to-text from audio/video files

func ParseFPS added in v0.0.38

func ParseFPS(s string) float64

Types

type Chapter

type Chapter struct {
	ID        int               `json:"id"`
	StartTime string            `json:"start_time"`
	EndTime   string            `json:"end_time"`
	Tags      map[string]string `json:"tags"`
}

type ComicPageParams added in v0.0.38

type ComicPageParams struct {
	Reader      *zip.ReadCloser
	ImageFile   imageFile
	OCREngine   string
	ArchivePath string
}

ComicPageParams contains the context needed to process a single comic page

type ExtractOptions added in v0.0.36

type ExtractOptions struct {
	ScanSubtitles     bool
	ExtractText       bool
	OCR               bool
	OCREngine         string
	SpeechRecognition bool
	SpeechRecEngine   string
	ProbeImages       bool
}

ExtractOptions contains options for metadata extraction

type FFProbeOutput

type FFProbeOutput struct {
	Streams  []Stream  `json:"streams"`
	Format   Format    `json:"format"`
	Chapters []Chapter `json:"chapters"`
}

type Format

type Format struct {
	Filename   string            `json:"filename"`
	Duration   string            `json:"duration"`
	Size       string            `json:"size"`
	BitRate    string            `json:"bit_rate"`
	FormatName string            `json:"format_name"`
	Tags       map[string]string `json:"tags"`
}

type MediaMetadata

type MediaMetadata struct {
	Media           db.UpsertMediaParams
	Captions        []db.InsertCaptionParams
	ContainerFormat *string // From ffprobe format_name, used for transcoding decisions
}

func Extract

func Extract(ctx context.Context, path string, opts ExtractOptions) (*MediaMetadata, error)

type Stream

type Stream struct {
	CodecType    string            `json:"codec_type"`
	CodecName    string            `json:"codec_name"`
	Profile      string            `json:"profile"`
	PixFmt       string            `json:"pix_fmt"`
	Width        int               `json:"width"`
	Height       int               `json:"height"`
	AvgFrameRate string            `json:"avg_frame_rate"`
	RFrameRate   string            `json:"r_frame_rate"`
	SampleRate   string            `json:"sample_rate"`
	Channels     int               `json:"channels"`
	Duration     string            `json:"duration"`
	Tags         map[string]string `json:"tags"`
	Disposition  map[string]int    `json:"disposition"`
}

Jump to

Keyboard shortcuts

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