def getPrevList(self, refresh = 1): if self.TREE_LEVEL == 0: TREE_LEVEL_IDs = [0,0,0,0,0] return RetHost(RetHost.OK, value = self.ListTREETOHostList()) else: self.TREE_LEVEL = self.TREE_LEVEL - 1 if self.TREE_LEVEL < 0: self.TREE_LEVEL=0 TREE_LEVEL_IDs = [0,0,0,0,0] return RetHost(RetHost.OK, value = self.ListTREETOHostList( self.TREE_LEVEL_IDs[self.TREE_LEVEL] ))
def getSearchResults(self, Index = 0, refresh = 0, selItem = None): print "[BoardsReader] hostxunil.IHost.getSearchResults index: %d" % Index self.Lista_Threads = [] # za kazdym razem wypelniamy liste threads od nowa TheList = [] #teraz pobierzmy posty print("getSearchResults:" + self.mainurl + '/index.php?action=unread;all;start=0') self.WebPage = GetWebPage(self.mainurl,'/index.php?action=unread;all;start=0',self.username,self.password) self.Lista_Threads = GetThreadsList(self.WebPage) #i wypelnijmy liste postami for item in self.Lista_Threads: #'threadID:' 'threadICON:' 'threadTITLE:' 'threadDESCR:' #linkList = [] #link = CUrlItem(item['Tytul'], self.mainurl + item['Link'], urlNeedsResolve = 1) #linkList.append(link) urlItems = [] urlItems.append(self.threadurl + str(item['threadID'])) curCAT = CDisplayListItem.TYPE_NEWTHREAD if item['threadICON'] != 'thread_new' and item['threadICON'] != 'thread_lock_new': curCAT = CDisplayListItem.TYPE_OLDTHREAD iconimage = '' if item['threadDESCR'].find('http:') > 0 and item['threadDESCR'].find('.jpg') > 0: iconimage = item['threadDESCR'][item['threadDESCR'].find('http:'):item['threadDESCR'].find('.jpg')+4] print("JPG link: " + iconimage) print ("########" + item['threadTITLE']) Item = CDisplayListItem(item['threadTITLE'], item['threadDESCR'], curCAT, urlItems, 0, iconimage) TheList.append(Item) self.CURRENT_TAB.append({'Name': item['threadTITLE'], 'Desc': item['threadDESCR'], 'IMG': iconimage, 'catURL':self.threadurl + str(item['threadID']), 'CatLIST': [], 'ForumLevel': -1, 'ParentID': -1 }) return RetHost(RetHost.OK, value = TheList)
def getListForItem(self, Index = 0, refresh = 0, selItem = None): print "[BoardsReader] hostxunil.IHost.getListForItem index: %d" % Index if len(self.CURRENT_TAB) <= Index or Index < 0: print("[BoardsReader] ERROR: .hostxunil.IHost.getListForItem there is no item with index: %d, TREE_TAB.len: %d" % (Index, len(self.TREE_TAB))) return RetHost(RetHost.ERROR, value = []) else: print("[BoardsReader] zwroc kategorie " + self.CURRENT_TAB[Index]['Name'] + " id=" + str(self.CURRENT_TAB[Index]['catURL']) + ' parrentID=' + str(self.CURRENT_TAB[Index]['ParentID'])) self.currentLevel = Index self.currIndex = Index print("Aktualny poziom:" + str(self.CURRENT_TAB[Index]['ForumLevel'])) retList = [] self.TREE_LEVEL = self.TREE_LEVEL + 1 retList = self.ListTREETOHostList( self.CURRENT_TAB[Index]['catURL']) return RetHost(RetHost.OK, value = retList) return RetHost(RetHost.ERROR, value = [])
def getInitList(self): #self.__init__() self.TREE_LEVEL = 0 TREE_LEVEL_IDs = [0, 0, 0, 0, 0] if self.StartWebPage == '': self.StartWebPage = GetDVHKforumContent( GetWebPage(self.mainurl, self.dailyURL, self.username, self.password)) if self.StartWebPage != -1: if len(self.Lista_Forums) == 0: self.Lista_Forums = GetForumsList(self.StartWebPage) if len(self.TREE_TAB) == 0: for forum in self.Lista_Forums: if str(forum['ID']) not in self.BlockedIDs.split(','): self.TREE_TAB.append({ 'Name': forum['NAME'], 'Desc': self.forumurl + str(forum['ID']), 'IMG': '', 'catURL': forum['ID'], 'CatLIST': [], 'ForumLevel': forum['LEVEL'], 'ParentID': forum['ParenID'] }) else: self.TREE_TAB.append({ 'Name': str(_('Error logging to %s forum!!!') % "DVHK"), 'Desc': str(_('Check forum settings. ;)')), 'IMG': '', 'catURL': '', 'CatLIST': [], 'ForumLevel': 0, 'ParentID': 0 }) #print self.TREE_TAB return RetHost(RetHost.OK, value=self.ListTREETOHostList())
def getInitList(self): #self.__init__() self.TREE_LEVEL = 0 TREE_LEVEL_IDs = [0,0,0,0,0] if len(self.Lista_Forums) == 0: self.Lista_Forums = GetForumsList(GetWebPage(self.mainurl,"/index.php",self.username,self.password)) if len(self.TREE_TAB) == 0: self.TREE_TAB.append({'Name': str(_('Display unread threads')), 'Desc': '', 'IMG': '', 'catURL':'/index.php?action=unread', 'CatLIST': [], 'ForumLevel': 999, 'ParentID': 0 }) for forum in self.Lista_Forums: if str(forum['ID']) not in self.BlockedIDs.split(','): self.TREE_TAB.append({'Name': forum['NAME'], 'Desc': self.forumurl + str(forum['ID']) + '.0', 'IMG': '', 'catURL':forum['ID'], 'CatLIST': [], 'ForumLevel': forum['LEVEL'], 'ParentID': forum['ParenID'] }) else: self.TREE_TAB.append({'Name': str(_('Error logging to %s forum!!!') % "XUNIL"), 'Desc': str(_('Check forum settings. ;)')), 'IMG': '', 'catURL':'', 'CatLIST': [], 'ForumLevel': 0, 'ParentID': 0 }) #print self.TREE_TAB return RetHost(RetHost.OK, value = self.ListTREETOHostList())
def getLogoPath(self): return RetHost(RetHost.OK, value = [self.PATH_TO_LOGO])