From 9496df9e9d09b3b3ea01813281e69ce67a3e4c62 Mon Sep 17 00:00:00 2001 From: Dean Gardiner Date: Fri, 6 Dec 2013 22:13:17 +1300 Subject: [PATCH] Fixed a bug where matching show names with a year would fail --- couchpotato/core/plugins/matcher/main.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/matcher/main.py b/couchpotato/core/plugins/matcher/main.py index 2260f9f..30f679d 100644 --- a/couchpotato/core/plugins/matcher/main.py +++ b/couchpotato/core/plugins/matcher/main.py @@ -89,11 +89,24 @@ class Matcher(Plugin): log.info('Wrong: missing show name in parsed result') return False + # Get the lower-case parsed show name from the chain chain_words = [x.lower() for x in chain.info['show_name']] + # Build a list of possible titles of the media we are searching for + titles = root_library['info']['titles'] + + # Add year suffix titles (will result in ['', ' ', '', ...]) + suffixes = [None, root_library['info']['year']] + + titles = [ + title + ((' %s' % suffix) if suffix else '') + for title in titles + for suffix in suffixes + ] + # Check show titles match # TODO check xem names - for title in root_library['info']['titles']: + for title in titles: for valid_words in [x.split(' ') for x in possibleTitles(title)]: if valid_words == chain_words: