Skip to content

Commit

Permalink
closes #10: allow apostrophe in filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtr committed Mar 10, 2020
1 parent f614010 commit b842463
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ lint: ## lint
test: ## run tests
@go test ./...

build: #vendor ## build
build: ## build
$(GO_BUILD_ENV_VARS) \
go build \
-tags selinux \
$(GCFLAGS) \
-o bin/$(MODULE) ./

container: clean build ## container
buildah bud -t rbtr/pachinko:latest .

clean: ## clean workspace
@rm -rf ./bin ./$(MODULE)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ outputs: []
processors: {}
```
the full, current list of options is available by running `./pachinko config` on the commandline.
the full, current list of options is available by running `./pachinko genconf` on the commandline.
the core pachinko options are:

| option | inputs | usage |
Expand Down
21 changes: 20 additions & 1 deletion internal/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var TV []*Test = []*Test{
},
},
{
"dir multimathc SSxEE",
"dir multimatch SSxEE",
[]string{
"/src/Broad City (2014) S01-03 Season 01-03 (1080p HEVC AAC 2.0)/Broad City 03x09 Getting There.mkv",
},
Expand Down Expand Up @@ -84,6 +84,25 @@ var TV []*Test = []*Test{
},
},
},
{
"special characters in title",
[]string{
"/src/Tom Clancy's Jack Ryan S01E01.mkv",
},
types.Media{
Category: types.Video,
Type: tv.TV,
TVMetadata: tv.Metadata{
Name: "Tom Clancy's Jack Ryan",
Episode: tv.Episode{
Number: 1,
Season: tv.Season{
Number: 1,
},
},
},
},
},
}

var Movies []*Test = []*Test{
Expand Down
8 changes: 4 additions & 4 deletions plugin/processor/pre/tv.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
)

var defaultTVMatchers = []string{
`(?i)\b([\s\w.-]*)[\s.\/-]+(?:\((\d+)\))?[\s.\/-]?(\d{1,3})[x-](\d{1,3})`, // matches 1x1 and 1/1 patterns
`(?i)\b([\s\w.-]*?)?(?:[\s\(.\/-](\d{4})[\s\).\/-])?[\s\w.-]?(?:s+(\d+))(?:\.|\s|-|_|x)*(?:e+(\d+))`, // matches S00E00 patterns
`(?i)\b([\s\w.-]*)[\s.\/-]+(?:\((\d+)\))?[\s.\/-]?(?:season|series).?(\d+).?(?:episode)?[^\d(]?(\d+)`, // matches Season 00 patterns
`(?i)\b([\s\w'.-]*)[\s.\/-]+(?:\((\d+)\))?[\s.\/-]?(\d{1,3})[x-](\d{1,3})`, // matches 1x1 and 1/1 patterns
`(?i)\b([\s\w'.-]*?)?(?:[\s\(.\/-](\d{4})[\s\).\/-])?[\s\w.-]?(?:s+(\d+))(?:\.|\s|-|_|x)*(?:e+(\d+))`, // matches S00E00 patterns
`(?i)\b([\s\w'.-]*)[\s.\/-]+(?:\((\d+)\))?[\s.\/-]?(?:season|series).?(\d+).?(?:episode)?[^\d(]?(\d+)`, // matches Season 00 patterns
}

var sanitizer = regexp.MustCompile(`[^\w]`)
var sanitizer = regexp.MustCompile(`[^'\w]`)

type TVPreProcessor struct {
MatcherStrings []string `mapstructure:"matchers"`
Expand Down

0 comments on commit b842463

Please sign in to comment.