Ejemplo n.º 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
Ejemplo n.º 2
0
def parseSummaryBased(show, feed_url):
  showinfo = dict()
  for e in show['summary'].split(';'):
    try:
      k, v = e.split(':', 1)
      showinfo[k.lower().strip()] = v.strip()
    except:
      pass
  if showinfo.has_key('show name'):
    if showinfo.has_key('season') and showinfo.has_key('episode'):
      ep = showdb.makeSeEpStr(showinfo['season'], showinfo['episode'])
    elif showinfo.has_key('episode date'):
      ep = showdb.makeDateStr(showinfo['episode date'])
    else:
      raise Exception("invalid episode number" + str(showinfo))
    return showdb.add(showinfo['show name'], ep, show['title'] + " " + feed_url,
                      show['link'], method='RSS')
  raise Exception("invalid summary")
Ejemplo n.º 3
0
def parseTitleBased(show, feed_url):
  name, ep = showdb.splitShowEp(show['title'])
  links = list(show['links'])
  links.sort(key=grade_link)
  return showdb.add(name, ep, show['title'] + " " + feed_url, links[0]['href'],
                    method='RSS')