def lookup_series(self, series_name): t = TVRage() apiseries = t.lookup(series_name) if len(apiseries) > 1: pub.sendMessage('CONFLICT_RESOLVER', apiseries) elif not apiseries: pub.sendMessage('STD_OUT', 'NOT FOUND: %s, skipping' % series_name) self.series = None elif apiseries: pub.sendMessasge('SET_SERIES', apiseries)
def lookup_tv(self, episode_info): try: episode_data = re.match(TITLE_PARSER, episode_info).groups() except AttributeError: pub.sendMessage('STD_OUT', 'TV Show titles must match SHOW SXXXEXXX') return False else: if not series_in_db(episode_data[0]): lookup_series(episode_data[0]) if self.series: t = TVRage() try: episode = t.lookup(**episode_data) m = Media() m.fromAPIMedia(episode) return m except APIError: pub.sendMessage('STD_OUT', 'NOT FOUND: %s S%sE%s' % **episode_data) return False