Example #1
0
 def check_msg(self, channame, chan, user, msg):
   #if chan.is_oper(user) or chan.is_voiced(user):
   if any(map(lambda x: x.search(user) is not None, usernameFilters)):
     for r in msgFilters:
       m = r.match(msg)
       if m:
         src = m.group(1)
         url = m.group(2)
         try:
           show, ep = showdb.splitShowEp(src)
           showdb.add(show, ep, src, url, method="IRC:%s" % channame)
           return
         except Exception, e:
           showdb.parseFailed('IRC', src, url, channame)
     for r in msgFiltersIgnore:
       m = r.match(msg)
       if m:
         return
     print "IRC: NOMATCH", channame, user, msg
Example #2
0
  links = list(show['links'])
  links.sort(key=grade_link)
  return showdb.add(name, ep, show['title'] + " " + feed_url, links[0]['href'],
                    method='RSS')


#attempt to convert an rss feed entry into an Episode() instance
def parseEpisode(show, feed_url):
  errs = []
  for parser in [parseSummaryBased, parseTitleBased]:
    try:
      return parser(show, feed_url)
    except Exception, e:
      errs.append(e)
  try:
    showdb.parseFailed("RSS", show['title'], show['link'], feed_url)
  except:
    pass
  return None


def parseFeed(feed_url, feed):
  existing = 0
  found = 0
  errors = 0
  for e in feed['entries']:
    rv = parseEpisode(e, feed_url)
    if rv is True:
      found += 1
    if rv is False:
      existing += 1