From 497bbd17054a2f36758fc05bb34ce6c6080a3b0e Mon Sep 17 00:00:00 2001 From: Evan Baker Date: Sun, 5 Apr 2020 15:12:09 -0500 Subject: [PATCH] update mov regex for year in title --- internal/testing/testing.go | 17 ++++++++++++++++- plugin/processor/pre/movie.go | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/internal/testing/testing.go b/internal/testing/testing.go index 5d5682b..83bd6ee 100644 --- a/internal/testing/testing.go +++ b/internal/testing/testing.go @@ -145,9 +145,10 @@ var TV []*Test = []*Test{ var Movies []*Test = []*Test{ { - "year as title", + "year in title", []string{ "/src/Blade Runner 2049 (2017)/Blade Runner 2049.mkv", + "/src/Blade Runner 2049 (2017).mkv", }, types.Item{ Category: types.Video, @@ -158,6 +159,20 @@ var Movies []*Test = []*Test{ }, }, }, + { + "year as title", + []string{ + "/movies/1917 (2020).mkv", + }, + types.Item{ + Category: types.Video, + MediaType: movie.Movie, + MovieMetadata: movie.Metadata{ + Title: "1917", + ReleaseYear: 2020, + }, + }, + }, { "typical", []string{ diff --git a/plugin/processor/pre/movie.go b/plugin/processor/pre/movie.go index c2a5fc8..5df7416 100644 --- a/plugin/processor/pre/movie.go +++ b/plugin/processor/pre/movie.go @@ -20,7 +20,7 @@ import ( ) var defaultMovieMatchers = []string{ - `(?i)\b([\s\w.-]*)[\s.\/-]+[\s.\/-]?(?:[\s\(.\/-]?(\d{4})[\s\).\/-]?)(?:\s*[\(\[].*[\)\]])?(?:\/|.[A-Za-z]{3})`, // matches "Name (YEAR)." + `(?i)\b([\s\w.-]*)[\s.-]?(?:[\s\(.-]?(\d{4})[\s\).-]?)(?:\s*[\(\[].*[\)\]])?(?:\/|.[A-Za-z]{3})`, // matches "Name (YEAR)." } type MoviePreProcessor struct {