Documentation
¶
Index ¶
- Variables
- func Has7zMagic(data []byte) bool
- func HasRar4Magic(data []byte) bool
- func HasRar5Magic(data []byte) bool
- func HasRarMagic(data []byte) bool
- func HasValidExtensionLength(filename string) bool
- func Is7zFile(filename string) bool
- func IsImportantFileType(filename string) bool
- func IsMultipartMkv(filename string) bool
- func IsPar2File(filename string) bool
- func IsProbablyObfuscated(filename string) bool
- func IsRarFile(filename string) bool
- func IsVideoFile(filename string) bool
- type FileInfo
- type NzbFileWithFirstSegment
Constants ¶
This section is empty.
Variables ¶
var ( // Rar4Magic is the magic signature for RAR 4.x archives Rar4Magic = []byte{0x52, 0x61, 0x72, 0x21, 0x1A, 0x07, 0x00} // Rar5Magic is the magic signature for RAR 5.x archives Rar5Magic = []byte{0x52, 0x61, 0x72, 0x21, 0x1A, 0x07, 0x01, 0x00} // SevenZipMagic is the magic signature for 7-Zip archives SevenZipMagic = []byte{0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C} )
RAR magic byte signatures
Functions ¶
func Has7zMagic ¶
Has7zMagic checks if the data contains 7-Zip magic bytes
func HasRar4Magic ¶
HasRar4Magic checks if the data contains RAR 4.x magic bytes
func HasRar5Magic ¶
HasRar5Magic checks if the data contains RAR 5.x magic bytes
func HasRarMagic ¶
HasRarMagic checks if the data contains any RAR magic bytes (4.x or 5.x)
func HasValidExtensionLength ¶
HasValidExtensionLength checks if the extension length is between 2 and 4 characters (considered a valid/common extension length)
func IsImportantFileType ¶
IsImportantFileType checks if the filename is an important file type (video, RAR, 7z, or multipart MKV)
func IsMultipartMkv ¶
IsMultipartMkv checks if the filename is a multipart MKV file
func IsPar2File ¶
IsPar2File checks if a filename is a PAR2 archive
func IsProbablyObfuscated ¶ added in v0.3.0
IsProbablyObfuscated reports whether a filename is likely obfuscated. It is the exported form of isProbablyObfuscated, used by the parser to decide — before any network fetch — whether a file's NZB subject name is trustworthy enough to skip downloading its first segment.
func IsVideoFile ¶
IsVideoFile checks if the filename is a video file based on extension
Types ¶
type FileInfo ¶
type FileInfo struct {
NzbFile nzbparser.NzbFile // The original NZB file
Filename string // Selected filename (using priority system)
ReleaseDate time.Time // Release date from NZB metadata
FileSize *int64 // File size (from PAR2 or yEnc headers, nil if unknown)
IsRar bool // Whether this is a RAR archive (detected by magic or extension)
Is7z bool // Whether this is a 7z archive (detected by extension)
IsPar2Archive bool // Whether this is a PAR2 archive (detected by extension)
YencHeaders *nntppool.YEncMeta // yEnc headers from first segment
First16KB []byte // First 16KB of the file (for magic byte detection)
OriginalIndex int // Original position in the parsed NZB file list
}
FileInfo represents parsed information about an NZB file Similar to C# GetFileInfosStep.FileInfo
func GetFileInfos ¶
func GetFileInfos( files []*NzbFileWithFirstSegment, par2Descriptors map[[16]byte]*par2.FileDescriptor, nzbFilename string, ) []*FileInfo
GetFileInfos extracts file information from NZB files with first segment data Similar to C# GetFileInfosStep.GetFileInfos
type NzbFileWithFirstSegment ¶
type NzbFileWithFirstSegment struct {
NzbFile *nzbparser.NzbFile
Headers *nntppool.YEncMeta
First16KB []byte
ReleaseDate time.Time
SubjectHeader string // Release name prefix from the subject line (before the filename)
OriginalIndex int // Original position in the parsed NZB file list
}
NzbFileWithFirstSegment represents an NZB file with its first segment data Similar to C# FetchFirstSegmentsStep.NzbFileWithFirstSegment