Exemple #1
0
  def __init__(self, sales, prevsales):
    # sales: list of tuples of (Title, base price, sale price, link url)
    BaseItem.__init__(self)
    self.title = "Steam sale update!"
    self.link = SteamSaleReader.SPECIALS_URL
    self.html = ""

    # Generate diff information
    if prevsales is not None:
      newsales = self.getDiffSales(sales, prevsales)
      endsales = self.getDiffSales(prevsales, sales)
      if newsales or endsales:
        self.html += "Update<br/>\n"
        for item in newsales:
          self.html += self.formatItem(item, "#00CC00")
        self.html += "</span><br/>\n"
        for item in endsales:
          self.html += self.formatItem(item, "#CC0000")
        self.html += "</span><br/>\n"

    # Full summary
    self.html += "Full Summary<br/>\n"
    for item in sales:
      self.html += self.formatItem(item)

    self.content = self.html
Exemple #2
0
 def __init__(self, data, metadata):
   BaseItem.__init__(self, metadata)
   #self.subj = re.search("[Ss]ubject: ([\w\W]*?)\r\n(\r\n|[Dd]ate: )",
                         #data).group(1)
   #self.date = re.search("[Dd]ate: ([\w\W]*?)\r\n(\r\n|[Ss]ubject: )",
                         #data).group(1)
   self.title = "New email for %s" % self.metadata['email']
   self.content = "%s now has %d emails" % (self.metadata['email'], data[1][0])
   self.html = self.content
Exemple #3
0
 def __init__(self, xml, metadata):
   BaseItem.__init__(self, metadata)
   self.title = xml.getElementsByTagName("title")[0].firstChild.data
   self.link = xml.getElementsByTagName("link")[0].firstChild.data
   if xml.getElementsByTagName("description"):
     self.html =  xml.getElementsByTagName("description")[0].firstChild.data
   else:
     self.html = ""
   self.content = self.html
Exemple #4
0
 def __init__(self, xml, metadata):
   BaseItem.__init__(self, metadata)
   self.title = xml.getElementsByTagName("title")[0].firstChild.data
   self.link = xml.getElementsByTagName("link")[0].getAttribute("href")
   self.html = xml.getElementsByTagName("content")[0].firstChild.data
   self.content = self.html
 def __init__(self, source):
   BaseItem.__init__(self)
   self.set_all_content("Update found in %s" % source)
   self.link = source
Exemple #6
0
 def __init__(self, filename):
     BaseItem.__init__(self)
     self.set_all_content("Update found in %s" % filename)
     # This will probably not work, but better than nothing
     self.link = "file://%s" % filename