Example #1
0
 def getFullThread(self, Index = 0):
     if Index > len(self.CURRENT_TAB):
         Index = Index - len(self.CURRENT_TAB)
     if len(self.CURRENT_TAB) <= Index or Index < 0:
         printDBG("[BoardsClient] ERROR: .hostdvhk.BoardsClientHost.getFullThread there is no item with index: %d, self.CURRENT_TAB.len: %d" % (Index, len(self.CURRENT_TAB)))
         return ""
     else:
         printDBG('[BoardsClient] zwroc Thread "' + self.CURRENT_TAB[Index]['Name'] + '" url=' + self.CURRENT_TAB[Index]['catURL'])
         self.WebPage = GetWebPage(self.mainurl,self.CURRENT_TAB[Index]['catURL'] + self.threadLastPage,self.username,self.password)
         return vb_GetFullThread(self.WebPage) , self.mainurl, self.CURRENT_TAB[Index]['catURL']
Example #2
0
    def ListTREETOHostList(self, Cat_URL = ''):
        self.TREE_LEVEL_IDs[self.TREE_LEVEL] = Cat_URL
        self.CURRENT_TAB = []
        TheList = []
        for item in self.TREE_TAB:
            if self.TREE_LEVEL == 0:
                self.PARRENT_ID_L1 = 0
                self.PARRENT_ID_L2 = 0
                if item['ForumLevel'] == 0:
                    print '[BoardsClient] hostdvhk.ListTREETOHostList.Cat_URPoziom 0:' + item['Name']
                    Item = CDisplayListItem(item['Name'], item['Desc'], CDisplayListItem.TYPE_CATEGORY)
                    TheList.append(Item)
                    self.CURRENT_TAB.append({'Name': item['Name'], 'Desc': item['catURL'], 'IMG': '', 'catURL':item['catURL'], 'CatLIST': [], 'ForumLevel': item['ForumLevel'], 'ParentID': item['ParentID'] })
            else:
                if item['ParentID'] == Cat_URL and item['ForumLevel'] == self.TREE_LEVEL:
                    print '[BoardsClient] hostdvhk.ListTREETOHostList.Cat_URPoziom %i :' %item['ForumLevel'] + item['Name']
                    Item = CDisplayListItem(item['Name'], item['Desc'], CDisplayListItem.TYPE_CATEGORY)
                    self.CURRENT_TAB.append({'Name': item['Name'], 'Desc': item['catURL'], 'IMG': '', 'catURL':item['catURL'], 'CatLIST': [], 'ForumLevel': item['ForumLevel'], 'ParentID': item['ParentID'] })
                    TheList.append(Item)
              
        self.Lista_Threads = [] # za kazdym razem wypelniamy liste threads od nowa
        #teraz pobierzmy posty
        if self.TREE_LEVEL == 0:
            #Cat_URL = self.mainurl
            self.Lista_Threads = GetThreadsList(self.StartWebPage)
        else:
            printDBG("ListTREETOHostList:" + self.mainurl + self.forumurl + str(Cat_URL))
            self.WebPage = GetDVHKforumContent(GetWebPage(self.mainurl,self.forumurl + str(Cat_URL),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]
                printDBG("JPG link: " + iconimage)
            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 TheList
Example #3
0
    def getListForItem(self, Index=0, refresh=0, selItem=None):
        print "[BoardsClient] hostxunil.IPTVHost.getListForItem index: %d" % Index

        if len(self.CURRENT_TAB) <= Index or Index < 0:
            printDBG(
                "[BoardsClient] ERROR: .hostxunil.IPTVHost.getListForItem there is no item with index: %d, TREE_TAB.len: %d"
                % (Index, len(self.TREE_TAB))
            )
            return RetHost(RetHost.ERROR, value=[])
        else:
            printDBG(
                "[BoardsClient] 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
            printDBG("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=[])
Example #4
0
    def ListTREETOHostList(self, Cat_URL=""):
        self.TREE_LEVEL_IDs[self.TREE_LEVEL] = Cat_URL
        self.CURRENT_TAB = []
        TheList = []
        for item in self.TREE_TAB:
            if self.TREE_LEVEL == 0:
                self.PARRENT_ID_L1 = 0
                self.PARRENT_ID_L2 = 0
                if item["ForumLevel"] == 0:
                    print "[IPTV] hostxunil.ListTREETOHostList.Cat_URPoziom 0:" + item["Name"]
                    Item = CDisplayListItem(item["Name"], item["Desc"], CDisplayListItem.TYPE_CATEGORY)
                    TheList.append(Item)
                    self.CURRENT_TAB.append(
                        {
                            "Name": item["Name"],
                            "Desc": item["catURL"],
                            "IMG": "",
                            "catURL": item["catURL"],
                            "CatLIST": [],
                            "ForumLevel": item["ForumLevel"],
                            "ParentID": item["ParentID"],
                        }
                    )
            else:
                if item["ParentID"] == Cat_URL and item["ForumLevel"] == self.TREE_LEVEL:
                    print "[IPTV] hostxunil.ListTREETOHostList.Cat_URPoziom %i :" % item["ForumLevel"] + item["Name"]
                    Item = CDisplayListItem(item["Name"], item["Desc"], CDisplayListItem.TYPE_CATEGORY)
                    self.CURRENT_TAB.append(
                        {
                            "Name": item["Name"],
                            "Desc": item["catURL"],
                            "IMG": "",
                            "catURL": item["catURL"],
                            "CatLIST": [],
                            "ForumLevel": item["ForumLevel"],
                            "ParentID": item["ParentID"],
                        }
                    )
                    TheList.append(Item)

        self.Lista_Threads = []  # za kazdym razem wypelniamy liste threads od nowa
        # teraz pobierzmy posty
        if self.TREE_LEVEL == 0:
            # Cat_URL = self.mainurl
            printDBG("GetThreadsList(self.StartWebPage)")
            self.Lista_Threads = GetThreadsList(self.StartWebPage)
        else:
            printDBG("ListTREETOHostList:" + self.mainurl + self.forumurl + str(Cat_URL) + ".0")
            self.WebPage = GetWebPage(self.mainurl, self.forumurl + str(Cat_URL) + ".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
                ]
                printDBG("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 TheList