reading

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package reading centralizes ebook format detection, safe virtual naming, and media-class predicates shared by frontends that expose books for reading (Vela /read and Jellyfin/Emby /Items/{id}/Download & /File).

Index

Constants

This section is empty.

Variables

View Source
var AcceptPatterns = []string{"range", "download", "container", "release", "file"}

AcceptPatterns lists the kindstream retrieval patterns readable book endpoints can serve as byte-addressable streams.

View Source
var Formats = []string{"epub", "pdf", "cbz"}

Formats lists the canonical reading formats Ether serves to reader clients.

Functions

func CanonicalFormat

func CanonicalFormat(raw string) (format, mimeType string, ok bool)

CanonicalFormat normalizes a format name, file extension, or MIME type into a supported reading format ("epub", "pdf", or "cbz") and canonical MIME type.

func ContextReaderAt

func ContextReaderAt(ctx context.Context, r io.ReaderAt) io.ReaderAt

ContextReaderAt binds a request context to a ReaderAt that supports core.ContextReaderAt so client disconnects cancel blocked upstream reads.

func DetectFormat

func DetectFormat(media *frontend.KindMedia, title frontend.Title) (format, mimeType string, ok bool)

DetectFormat identifies the canonical reading format and MIME type from an opened KindMedia stream, falling back to title metadata and magic bytes.

func Filename

func Filename(mediaName, fallbackTitle, format string) string

Filename returns a safe download filename ending with "."+format.

func IsBookTitle

func IsBookTitle(t frontend.Title) bool

IsBookTitle reports whether t represents a book/ebook item that must open via reading/download paths rather than A/V playback.

func TitleFormat

func TitleFormat(t frontend.Title) (format, mimeType string)

TitleFormat returns the projected reading format and MIME type for a book title from its metadata, defaulting to EPUB when unspecified.

func VirtualPath

func VirtualPath(t frontend.Title) (virtualPath, container, mimeType string)

VirtualPath builds a deterministic, O(1) virtual book path, container name, and MIME type for a book title without scanning any library.

Types

This section is empty.

Jump to

Keyboard shortcuts

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