utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentLengthKey          = contextKey("contentLength")
	RangeKey                  = contextKey("rangeKey")
	IsCopy                    = contextKey("isCopy")
	Origin                    = contextKey("origin")
	ShowCorrupted             = contextKey("showCorrupted")
	ActiveStreamKey           = contextKey("activeStream")
	StreamIDKey               = contextKey("streamID")
	StreamSourceKey           = contextKey("streamSource")
	StreamUserNameKey         = contextKey("streamUserName")
	ClientIPKey               = contextKey("clientIP")
	UserAgentKey              = contextKey("userAgent")
	MaxPrefetchKey            = contextKey("maxPrefetch")
	SuppressStreamTrackingKey = contextKey("suppressStreamTracking")
)

Context keys for passing WebDAV request metadata through context

Variables

This section is empty.

Functions

func CopyWithCtx

func CopyWithCtx(ctx context.Context, dst io.Writer, src io.Reader) (int64, error)

Types

type LibraryItemFinder

type LibraryItemFinder struct {
	// contains filtered or unexported fields
}

LibraryItemFinder handles finding library items (symlinks and STRM files) with caching

func NewLibraryItemFinder

func NewLibraryItemFinder() *LibraryItemFinder

NewLibraryItemFinder creates a new library item finder

func (*LibraryItemFinder) FindLibraryItem

func (lif *LibraryItemFinder) FindLibraryItem(ctx context.Context, filePath string, cfg *config.Config) (string, error)

FindLibraryItem searches for a library item (symlink or .strm file) based on import strategy It checks the cache first, and if not found, performs a recursive search through the library directory Returns the library item path if found, empty string otherwise

func (lif *LibraryItemFinder) FindLibrarySymlink(ctx context.Context, filePath string, cfg *config.Config) (string, error)

FindLibrarySymlink searches for a symlink in the library directory that points to the given file path Deprecated: Use FindLibraryItem instead, which handles both symlinks and STRM files based on import strategy Returns the library symlink path if found, empty string otherwise

type RangeHeader

type RangeHeader struct {
	Start int64
	End   int64
}

func FixRangeHeader

func FixRangeHeader(rh *RangeHeader, size int64) *RangeHeader

FixRangeHeader looks through the slice of options and adjusts any RangeHeader~s found that request a fetch from the end into an absolute fetch using the size passed in and makes sure the range does not exceed filesize.

func ParseRangeHeader

func ParseRangeHeader(s string) (po *RangeHeader, err error)

ParseRangeHeader parses a RangeHeader from a Range: header. It only accepts single ranges.

func (*RangeHeader) Decode

func (o *RangeHeader) Decode(size int64) (offset, limit int64)

Decode interprets the RangeOption into an offset and a limit

The offset is the start of the stream and the limit is how many bytes should be read from it. If the limit is -1 then the stream should be read to the end.

Jump to

Keyboard shortcuts

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