Documentation
¶
Index ¶
- type ExtractedFileInfo
- type FirstSegmentData
- type NzbType
- type ParseOptions
- type ParsedFile
- type ParsedNzb
- type Parser
- func (p *Parser) GetMetadata(nzbXML *nzbparser.Nzb) map[string]string
- func (p *Parser) ParseFile(ctx context.Context, r io.Reader, nzbPath string, ...) (*ParsedNzb, error)
- func (p *Parser) ParseNzb(ctx context.Context, n *nzbparser.Nzb, nzbPath string, ...) (*ParsedNzb, error)
- func (p *Parser) ValidateNzb(parsed *ParsedNzb) error
- type StrmParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtractedFileInfo ¶
type FirstSegmentData ¶
type FirstSegmentData struct {
File *nzbparser.NzbFile // Reference to the NZB file (for groups, subject, metadata)
Headers nntppool.YEncMeta // yEnc headers (FileName, FileSize, PartSize)
RawBytes []byte // Up to 16KB of raw data for PAR2 detection (may be less if segment is smaller)
MissingFirstSegment bool // True if first segment download failed (article not found, etc.)
IsArticleNotFound bool // True only when 430 Not Found (permanent); false for timeouts/transient
SkippedFirstSegment bool // True when the fetch was intentionally skipped (clean-named multipart file); Headers/RawBytes are empty by design, not by failure
OriginalIndex int // Original position in the parsed NZB file list
}
FirstSegmentData holds cached data from the first segment of an NZB file This avoids redundant fetching when both PAR2 extraction and file parsing need the same data
type ParseOptions ¶ added in v0.2.1
type ParseOptions struct {
// BrokenFileIndexes contains the 0-based positions (in the Nzb.Files slice)
// of files whose sampled segments failed a pre-parse Stat check. Their first
// segments are short-circuited to MissingFirstSegment=true without a Body call.
BrokenFileIndexes map[int]struct{}
// KnownMissingSegmentIDs seeds notFoundIDs so yEnc normalisation and 16KB
// completion never re-issue Stat/Body calls for already-known-missing IDs.
KnownMissingSegmentIDs map[string]struct{}
}
ParseOptions carries pre-parse knowledge into ParseNzb, allowing the processor to skip Body fetches for files whose segments are already known to be missing (identified by a pre-parse Stat check).
type ParsedFile ¶
type ParsedFile struct {
Subject string
Filename string
Size int64
Segments []*metapb.SegmentData
Groups []string
IsRarArchive bool
Is7zArchive bool
IsPar2Archive bool
Encryption metapb.Encryption // Encryption type (e.g., "rclone"), nil if not encrypted
Password string // Password from NZB meta, nil if not encrypted
Salt string // Salt from NZB meta, nil if not encrypted
ReleaseDate time.Time // Release date from the Usenet post
OriginalIndex int // Original position in the parsed NZB file list
NzbdavID string // Original ID from nzbdav (for backward compatibility)
AesKey []byte // AES encryption key (for nzbdav compatibility)
AesIv []byte // AES initialization vector (for nzbdav compatibility)
}
ParsedFile represents a file extracted from the NZB
type ParsedNzb ¶
type ParsedNzb struct {
Path string
Filename string
TotalSize int64
Type NzbType
Files []ParsedFile
SegmentsCount int
ExtractedFiles []ExtractedFileInfo
// contains filtered or unexported fields
}
ParsedNzb contains the parsed NZB data and extracted metadata
func (*ParsedNzb) GetPassword ¶
GetPassword returns the password for this NZB
func (*ParsedNzb) SetPassword ¶
SetPassword sets the password for this NZB
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser handles NZB file parsing
func NewParser ¶
func NewParser(poolManager pool.Manager, getConfig config.ConfigGetter) *Parser
NewParser creates a new NZB parser
func (*Parser) GetMetadata ¶
GetMetadata extracts metadata from the NZB head section
func (*Parser) ParseFile ¶
func (p *Parser) ParseFile(ctx context.Context, r io.Reader, nzbPath string, progressTracker progress.ProgressTracker) (*ParsedNzb, error)
ParseFile parses an NZB file from a reader. progressTracker, if non-nil, receives incremental updates as first segments are fetched (the longest phase). It is safe to pass nil — updates are skipped.
func (*Parser) ParseNzb ¶ added in v0.2.1
func (p *Parser) ParseNzb(ctx context.Context, n *nzbparser.Nzb, nzbPath string, progressTracker progress.ProgressTracker, opts ParseOptions) (*ParsedNzb, error)
ParseNzb processes an already-parsed *nzbparser.Nzb, performing all network operations (first-segment fetches, PAR2 extraction, yEnc normalisation). opts carries knowledge collected before the network phase, e.g. file indexes whose segments are already known to be missing from a pre-parse Stat check.
func (*Parser) ValidateNzb ¶
ValidateNzb performs basic validation on the parsed NZB
type StrmParser ¶
type StrmParser struct {
// contains filtered or unexported fields
}
StrmParser handles STRM file parsing containing NXG links
func (*StrmParser) ParseStrmFile ¶
ParseStrmFile parses a STRM file containing an NXG link
func (*StrmParser) ValidateStrmFile ¶
func (p *StrmParser) ValidateStrmFile(parsed *ParsedNzb) error
ValidateStrmFile performs basic validation on the parsed STRM file