diff --git a/epgsnoop/processors.py b/epgsnoop/processors.py index d74c6a7..5348e49 100644 --- a/epgsnoop/processors.py +++ b/epgsnoop/processors.py @@ -485,3 +485,38 @@ 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")) + + +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'])