Exemple #1
0
    def endElement(self, name):
        if name == "title":
            self.title = self.chars.encode('utf8')
        elif name == "link":
            self.href = self.chars.encode('utf8')
        elif name == "ephy:smartlink":
            self.smarthref = self.chars.encode('utf8')
        elif name == "dc:subject":
            self.tags.append(self.chars.encode('utf8'))
        elif name == "item":
            if self.href.startswith("javascript:"):
                return
            
            icon = None
            host = get_url_host(self.href)
            if host in self._cache:
                icon = self._cache[host]

            bookmark = BrowserMatch(self.title, self.href, icon=icon)
            if self.smarthref != None:
                bookmark = BrowserSmartMatch(self.title, self.smarthref, icon=icon, bookmark=bookmark)
                self._smart_bookmarks.append(bookmark)
            else:
                tags = " ".join(self.tags)
                self._indexer.add("%s %s %s" % (self.title, self.href, tags), bookmark)
Exemple #2
0
    def endElement(self, name):
        if name == "title":
            self.title = self.chars.encode('utf8')
        elif name == "link":
            self.href = self.chars.encode('utf8')
        elif name == "ephy:smartlink":
            self.smarthref = self.chars.encode('utf8')
        elif name == "dc:subject":
            self.tags.append(self.chars.encode('utf8'))
        elif name == "item":
            if self.href.startswith("javascript:"):
                return
            
            icon = None
            host = get_url_host(self.href)
            if host in self._cache:
                icon = self._cache[host]

            bookmark = BrowserMatch(self.title, self.href, icon=icon)
            if self.smarthref != None:
                bookmark = BrowserSmartMatch(self.title, self.smarthref, icon=icon, bookmark=bookmark)
                self._smart_bookmarks.append(bookmark)
            else:
                tags = " ".join(self.tags)
                self._indexer.add("%s %s %s" % (self.title, self.href, tags), bookmark)
Exemple #3
0
 def endElement(self, name):
     if name == "property":
         if self.url == None:
             self.url = self.chars
         elif self.name == None:
             self.name = self.chars
     elif name == "node":
         # Splithost requires //xxxx[:port]/xxxx, so we remove "http:"
         host = get_url_host(self.url)
         self.cache[host] = join(self.ephy_dir, "favicon_cache", self.name.encode('utf8'))
Exemple #4
0
 def endElement(self, name):
     if name == "property":
         if self.url == None:
             self.url = self.chars
         elif self.name == None:
             self.name = self.chars
     elif name == "node":
         # Splithost requires //xxxx[:port]/xxxx, so we remove "http:"
         host = get_url_host(self.url)
         self.cache[host] = join(self.ephy_dir, "favicon_cache", self.name.encode('utf8'))