Exemplo n.º 1
0
 def keyOK(self):
     if not self.autoStart and None == self.status:
         self.doStart()
     else:
         currItem = self["list"].getCurrent()
         if self.status not in [None, 'working']:
             artItem = ArticleContent(title=currItem['title'],
                                      text=currItem['info'],
                                      images=[])
             self.session.open(ArticleView, artItem)
Exemplo n.º 2
0
    def getArticleContent(self, Index = 0):
        retCode = RetHost.ERROR
        retlist = []
        if not self.isValidIndex(Index): return RetHost(retCode, value=retlist)

        hList = self.host.getArticleContent(self.host.currList[Index])
        for item in hList:
            title  = item.get('title', '')
            text   = item.get('text', '')
            images = item.get("images", [])
            retlist.append( ArticleContent(title = title, text = text, images =  images) )
        return RetHost(RetHost.OK, value = retlist)
Exemplo n.º 3
0
    def getArticleContent(self, Index = 0):
        retCode = RetHost.ERROR
        retlist = []
        if not self.isValidIndex(Index): return RetHost(retCode, value=retlist)

        hList = self.host.getArticleContent(self.host.currList[Index])
        if 0 == len(hList): return RetHost(retCode, value=retlist)
        for item in hList:
            title      = item.get('title', '')
            text       = item.get('text', '')
            images     = item.get("images", [])
            othersInfo = item.get('other_info', '')
            retlist.append( ArticleContent(title = title, text = text, images =  images, richDescParams = othersInfo) )
        return RetHost(RetHost.OK, value = retlist)
Exemplo n.º 4
0
 def getArticleContent(self, Index = 0):
     retCode = RetHost.ERROR
     retlist = []
     if not self.isValidIndex(Index): return RetHost(retCode, value=retlist)
     cItem = self.host.currList[Index]
     
     if cItem['type'] != 'video' and cItem.get('category', '') != 'explore_item':
         return RetHost(retCode, value=retlist)
     hList = self.host.getArticleContent(cItem)
     for item in hList:
         title      = item.get('title', '')
         text       = item.get('text', '')
         images     = item.get("images", [])
         othersInfo = item.get('other_info', '')
         retlist.append( ArticleContent(title = title, text = text, images =  images, richDescParams = othersInfo) )
     return RetHost(RetHost.OK, value = retlist)
Exemplo n.º 5
0
    def getArticleContent(self, Index=0):
        listLen = len(self.host.currList)
        if listLen < Index and listLen > 0:
            printDBG(
                "ERROR getArticleContent - current list is to short len: %d, Index: %d"
                % (listLen, Index))
            return RetHost(RetHost.ERROR, value=[])

        content = self.host.getDescription(self.host.currList[Index]['url'])
        title = content.get('title', '')
        text = content.get('desc' '')
        images = [{'title': '', 'author': '', 'url': content.get('icon', '')}]

        return RetHost(
            RetHost.OK,
            value=[ArticleContent(title=title, text=text, images=images)])
Exemplo n.º 6
0
    def getArticleContent(self, Index=0):
        listLen = len(self.host.currList)
        if listLen < Index and listLen > 0:
            printDBG("ERROR getArticleContent - current list is to short len: %d, Index: %d" % (listLen, Index))
            return RetHost(RetHost.ERROR, value=[])

        if self.host.currList[Index]["type"] != 'article':
            printDBG("ERROR getArticleContent - current item has wrong type")
            return RetHost(RetHost.ERROR, value=[])

        retlist = []
        hList = self.host.getArticleContent(Index)
        for item in hList:
            title = clean_html(item.get('title', ''))
            text = clean_html(item.get('text', ''))
            images = item.get("images", [])
            retlist.append(ArticleContent(title=title, text=text, images=images))

        return RetHost(RetHost.OK, value=retlist)