From 6f82852e9ab0fee81d7526764cbd684f026ea944 Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 12 Apr 2013 15:15:30 +1200 Subject: [PATCH 1/4] Add TVNZ series/episodes --- epgsnoop/processors.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/epgsnoop/processors.py b/epgsnoop/processors.py index d74c6a7..94871b5 100644 --- a/epgsnoop/processors.py +++ b/epgsnoop/processors.py @@ -485,3 +485,19 @@ def postProcess(self): log.debug('Inserting program %s', program) self.programs.append(program) + +class TVNZSeriesEpisode(BaseProcessor): + regex = re.compile( + r's\.?(?P\d+).?\s+ep\.?\s*(?P\d+)', + re.VERBOSE + ) + + def process(self, program): + if program['channel'].xmltvid.startswith('tv1.') or program['channel'].xmltvid.startswith('tv2.'): + if not 'series' in program and not 'episode' in program: + matched = self.regex.match(program['description']) + if matched: + log.debug("Found series/episode from description in '%s'", program['title']) + program['series'] = int(matched.group("series")) + program['episode'] = int(matched.group("episode")) + From b09a781a805c67459468efd81ce14b76c0d89b6f Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 12 Apr 2013 16:27:54 +1200 Subject: [PATCH 2/4] Add Movie Fuzzy Match --- epgsnoop/processors.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/epgsnoop/processors.py b/epgsnoop/processors.py index 94871b5..4e5d5af 100644 --- a/epgsnoop/processors.py +++ b/epgsnoop/processors.py @@ -120,6 +120,7 @@ class MovieTitle(BaseProcessor): def process(self, program): matched = self.regex.match(program['title']) if matched: + print "!!!!!!!MOVIE " + program['title'] log.debug("Found movie from title: '%s'", program['title']) program['category_type'] = 'movie' program['title'] = self.regex.sub('', program['title']) @@ -501,3 +502,22 @@ def process(self, program): program['series'] = int(matched.group("series")) program['episode'] = int(matched.group("episode")) + +class FuzzyMovieMatch(BaseProcessor): + regex = re.compile( + r'''.*(movie|blockbuster|directed\sby|starring|\sstar\s|stars\s|film\s).*''', + re.VERBOSE|re.IGNORECASE + ) + + def process(self, program): + text = program['title'] + if 'subtitle' in program: + text = text + " " + program['subtitle'] + if 'description' in program: + text = text + " " + program['description'] + + matched = self.regex.match(text) + if matched and (program['end']- program['start']).total_seconds() / 60 > 80: + log.debug("Found movie from title: '%s'", program['title']) + program['category_type'] = 'movie' + program['title'] = self.regex.sub('', program['title']) From 4ed94f4c99fbb8787c99ed557d218ae73e855d71 Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 12 Apr 2013 16:39:44 +1200 Subject: [PATCH 3/4] Fix print statment --- epgsnoop/processors.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/epgsnoop/processors.py b/epgsnoop/processors.py index 4e5d5af..17dc7fa 100644 --- a/epgsnoop/processors.py +++ b/epgsnoop/processors.py @@ -120,7 +120,6 @@ class MovieTitle(BaseProcessor): def process(self, program): matched = self.regex.match(program['title']) if matched: - print "!!!!!!!MOVIE " + program['title'] log.debug("Found movie from title: '%s'", program['title']) program['category_type'] = 'movie' program['title'] = self.regex.sub('', program['title']) @@ -517,7 +516,7 @@ def process(self, program): text = text + " " + program['description'] matched = self.regex.match(text) - if matched and (program['end']- program['start']).total_seconds() / 60 > 80: + if matched and (program['end'] - program['start']).total_seconds() / 60 > 80: log.debug("Found movie from title: '%s'", program['title']) program['category_type'] = 'movie' program['title'] = self.regex.sub('', program['title']) From 47e0f957eec72db6e75d75da03b83c19ff59891d Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 12 Apr 2013 17:10:53 +1200 Subject: [PATCH 4/4] Fix title still changing --- epgsnoop/processors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epgsnoop/processors.py b/epgsnoop/processors.py index 17dc7fa..5348e49 100644 --- a/epgsnoop/processors.py +++ b/epgsnoop/processors.py @@ -519,4 +519,4 @@ def process(self, program): if matched and (program['end'] - program['start']).total_seconds() / 60 > 80: log.debug("Found movie from title: '%s'", program['title']) program['category_type'] = 'movie' - program['title'] = self.regex.sub('', program['title']) + #program['title'] = self.regex.sub('', program['title'])