Documentation
¶
Index ¶
Constants ¶
const ( // PatternExplicit indicates explicit multipart patterns (pt1, part2, -1, -2) // These are always considered multipart without directory context validation. PatternExplicit = "explicit" // PatternLetter indicates ambiguous single-letter patterns (A, B, C) // These need directory context validation to confirm multipart status. PatternLetter = "letter" // PatternNone indicates no multipart pattern detected PatternNone = "" )
Pattern type constants for multipart detection
Variables ¶
This section is empty.
Functions ¶
func DetectPartSuffix ¶
DetectPartSuffix parses the portion of filename after the first occurrence of id and returns (number, suffix, patternType) where:
- number: 0 for single-part, 1..N for part index
- suffix: normalized string to append to base name (including leading dash)
- patternType: "explicit" for unambiguous patterns, "letter" for ambiguous single-letter, "" for no pattern detected
func GroupByID ¶
func GroupByID(results []MatchResult) map[string][]MatchResult
GroupByID groups match results by their ID
Types ¶
type MatchResult ¶
type MatchResult struct {
File scanner.FileInfo
ID string // Extracted JAV ID (e.g., "IPX-535")
PartNumber int // 0 = single-part, 1..N = part index
PartSuffix string // "-A", "-pt1", "-part2" (always with leading dash)
IsMultiPart bool // Whether this is a multi-part file
MatchedBy string // "regex" or "builtin"
MultipartPattern string // Pattern type: "explicit", "letter", or "" (see PatternExplicit, PatternLetter, PatternNone)
}
MatchResult represents a matched file with extracted ID
func FilterMultiPart ¶
func FilterMultiPart(results []MatchResult) []MatchResult
FilterMultiPart filters results to only include multi-part files
func FilterSinglePart ¶
func FilterSinglePart(results []MatchResult) []MatchResult
FilterSinglePart filters results to only include single-part files
func ValidateMultipartInDirectory ¶
func ValidateMultipartInDirectory(results []MatchResult) []MatchResult
ValidateMultipartInDirectory validates letter-based multipart patterns by checking for sibling files in the same directory with the same ID. Files with ambiguous letter patterns (-A, -B, -C) are only marked as multipart if multiple files with the same movie ID exist in the same directory. This prevents false positives for files like "ABW-121-C.mp4" where -C means Chinese subtitles, not part 3.
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher identifies JAV IDs from filenames
func NewMatcher ¶
func NewMatcher(cfg *config.MatchingConfig) (*Matcher, error)
NewMatcher creates a new file matcher
func (*Matcher) Match ¶
func (m *Matcher) Match(files []scanner.FileInfo) []MatchResult
Match extracts JAV IDs from a list of files
func (*Matcher) MatchFile ¶
func (m *Matcher) MatchFile(file scanner.FileInfo) *MatchResult
MatchFile attempts to extract a JAV ID from a single file
func (*Matcher) MatchString ¶
MatchString is a helper to extract ID from a string directly
type ParsedInput ¶
type ParsedInput struct {
ID string // Extracted movie ID
ScraperHint string // Suggested scraper ("dmm", "r18dev", or "")
IsURL bool // true if input was a URL
}
ParsedInput represents the result of parsing user input
func ParseInput ¶
func ParseInput(input string) (*ParsedInput, error)
ParseInput determines if input is a URL or ID and extracts the movie ID