Example #1
0
 def getPrevList(self, refresh=0):
     if (len(self.listOfprevList) > 0):
         hostList = self.listOfprevList.pop()
         self.host.setCurrList(hostList)
         convList = self.convertList(hostList)
         return RetHost(RetHost.OK, value=convList)
     else:
         return RetHost(RetHost.ERROR, value=[])
Example #2
0
 def getResolvedURL(self, url):
     #        if url != None and url != '':
     if url is not None and url is not '':
         ret = self.host.up.getVideoLink(url)
         list = []
         if ret:
             list.append(ret)
         return RetHost(RetHost.OK, value=list)
     return RetHost(RetHost.NOT_IMPLEMENTED, value=[])
Example #3
0
    def getLinksForVideo(self, Index = 0, selItem = None):
        retCode = RetHost.ERROR
        retlist = []
        if not self.isValidIndex(Index): return RetHost(retCode, value=retlist)
        
        urlList = self.host.getLinksForVideo(self.host.currList[Index])
        for item in urlList:
            retlist.append(CUrlItem(item["name"], item["url"], item['need_resolve']))

        return RetHost(RetHost.OK, value = retlist)
Example #4
0
 def getLinksForVideo(self, Index=0, selItem=None):
     retCode = RetHost.ERROR
     retlist = []
     if not self.isValidIndex(Index): return RetHost(retCode, value=retlist)
     urlList = self.host.Search_videoclip(self.host.currList[Index].get(
         'page', ''))
     for item in urlList:
         need_resolve = 0
         retlist.append(CUrlItem(item["name"], item["url"], need_resolve))
     return RetHost(RetHost.OK, value=retlist)
Example #5
0
 def getPrevList(self, refresh = 0):
     if(len(self.listOfprevList) > 0):
         subProviderList = self.listOfprevList.pop()
         subProviderCurrItem = self.listOfprevItems.pop()
         self.subProvider.setCurrList(subProviderList)
         self.subProvider.setCurrItem(subProviderCurrItem)
         
         convList = self.convertList(subProviderList)
         return RetHost(RetHost.OK, value = convList)
     else:
         return RetHost(RetHost.ERROR, value = [])
 def getPrevList(self, refresh=0):
     printDBG("getPrevList begin")
     if (len(self.prevList) > 0):
         self.prevIndex.pop()
         self.currList = self.prevList.pop()
         self.host.setCurrList(self.currList)
         printDBG("getPrevList end OK")
         return RetHost(RetHost.OK, value=self.currList)
     else:
         printDBG("getPrevList end ERROR")
         return RetHost(RetHost.ERROR, value=[])
    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)
Example #8
0
 def getResolvedURL(self, url):
     # resolve url to get direct url to video file
     url = self.host.resolveLink(url)
     urlTab = []
     if isinstance(url, basestring) and url.startswith('http'):
         urlTab.append(url)
     return RetHost(RetHost.OK, value=urlTab)
 def getResolvedURL(self, url):
     printDBG("getResolvedURL begin")
     if url != None and url != '':
         ret = self.host.getResolvedURL(url)
         if ret != None and ret != '':
             printDBG("getResolvedURL ret: " + ret)
             list = []
             list.append(ret)
             printDBG("getResolvedURL end OK")
             return RetHost(RetHost.OK, value=list)
         else:
             printDBG("getResolvedURL end")
             return RetHost(RetHost.NOT_IMPLEMENTED, value=[])
     else:
         printDBG("getResolvedURL end")
         return RetHost(RetHost.NOT_IMPLEMENTED, value=[])
 def getInitList(self):
     printDBG("getInitList begin")
     self.prevIndex = []
     self.currList = self.host.getInitList()
     self.host.setCurrList(self.currList)
     self.prevList = []
     printDBG("getInitList end")
     return RetHost(RetHost.OK, value=self.currList)
 def getListForItem(self, Index=0, refresh=0, selItem=None):
     printDBG("getListForItem begin")
     self.prevIndex.append(Index)
     self.prevList.append(self.currList)
     self.currList = self.host.getListForItem(Index, refresh, selItem)
     #self.currList = [ self.prevList[-1][Index] ]
     printDBG("getListForItem end")
     return RetHost(RetHost.OK, value=self.currList)
Example #12
0
    def getListForItem(self, Index=0, refresh=0, selItem=None):
        self.listOfprevList.append(self.host.getCurrList())

        self.currIndex = Index
        self.host.handleService(Index, refresh, self.searchPattern)
        convList = self.convertList(self.host.getCurrList())

        return RetHost(RetHost.OK, value=convList)
 def getCurrentList(self, refresh=0):
     printDBG("getCurrentList begin")
     #if refresh == 1
     #self.prevIndex[-1] #ostatni element prevIndex
     #self.prevList[-1]  #ostatni element prevList
     #tu pobranie listy dla dla elementu self.prevIndex[-1] z listy self.prevList[-1]
     printDBG("getCurrentList end")
     return RetHost(RetHost.OK, value=self.currList)
Example #14
0
    def getResolvedURL(self, url):
        # resolve url to get direct url to video file
        retlist = []
        urlList = self.host.getVideoLinks(url)
        for item in urlList:
            need_resolve = 0
            retlist.append(CUrlItem(item["name"], item["url"], need_resolve))

        return RetHost(RetHost.OK, value=retlist)
    def getLinksForVideo(self, Index=0, selItem=None):
        listLen = len(self.host.currList)
        if listLen < Index and listLen > 0:
            printDBG(
                "ERROR getLinksForVideo - current list is to short len: %d, Index: %d"
                % (listLen, Index))
            return RetHost(RetHost.ERROR, value=[])

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

        retlist = []
        urlList = self.host.getHostingTable(self.host.currList[Index]["url"])
        for item in urlList:
            retlist.append(CUrlItem(item["name"], item["url"], 0))

        return RetHost(RetHost.OK, value=retlist)
Example #16
0
 def getInitList(self):
     self.currIndex = -1
     self.listOfprevList = [] 
     self.listOfprevItems = []
     
     self.subProvider.handleService(self.currIndex)
     convList = self.convertList(self.subProvider.getCurrList())
     
     return RetHost(RetHost.OK, value = convList)
Example #17
0
 def getListForItem(self, Index = 0, refresh = 0, selItem = None):
     self.listOfprevList.append(self.subProvider.getCurrList())
     self.listOfprevItems.append(self.subProvider.getCurrItem())
     
     self.currIndex = Index
     
     self.subProvider.handleService(Index, refresh)
     convList = self.convertList(self.subProvider.getCurrList())
     
     return RetHost(RetHost.OK, value = convList)
    def getLinksForVideo(self, Index = 0, selItem = None):
        listLen = len(self.host.currList)
        if listLen <= Index or Index < 0:
            printDBG( "ERROR getLinksForVideo - current list is to short len: %d, Index: %d" % (listLen, Index) )
            return RetHost(RetHost.ERROR, value = [])
        
        if self.host.currList[Index]["type"] not in ['audio', 'video']:
            printDBG( "ERROR getLinksForVideo - current item has wrong type" )
            return RetHost(RetHost.ERROR, value = [])

        retlist = []
        urlList = self.host.getLinksForVideo(self.host.currList[Index])
        for item in urlList:
            need_resolve = 0
            name = self.host._getStr( item["name"] )
            url  = item["url"]
            retlist.append(CUrlItem(name, url, need_resolve))

        return RetHost(RetHost.OK, value = retlist)
Example #19
0
    def getInitList(self):
        self.host = Spryciarze()
        self.currIndex = -1
        self.listOfprevList = []

        self.host.handleService(self.currIndex)

        convList = self.convertList(self.host.getCurrList())

        return RetHost(RetHost.OK, value=convList)
    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':
            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)
Example #21
0
    def getCurrentList(self, refresh=0):
        if refresh == 1:
            if len(self.listOfprevList) > 0:
                hostList = self.listOfprevList.pop()
                self.host.setCurrList(hostList)
                return self.getListForItem(self.currIndex)
            else:
                return self.getInitList()

        convList = self.convertList(self.host.getCurrList())
        return RetHost(RetHost.OK, value=convList)
Example #22
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 'ekstraklasa.tv' in self.host.currList[Index].get('host', ''):
            content = self.host.getDescription_ETV(
                self.host.currList[Index]['url'])
        elif 'ekstraklasa.org' in self.host.currList[Index].get('host', ''):
            content = {}

        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)])
Example #23
0
    def getLinksForVideo(self, Index=0, selItem=None):
        listLen = len(self.host.currList)
        if listLen < Index and listLen > 0:
            print "ERROR getLinksForVideo - current list is to short len: %d, Index: %d" % (
                listLen, Index)
            return RetHost(RetHost.ERROR, value=[])

        selItem = self.host.currList[Index]
        if selItem['type'] != 'video':
            print "ERROR getLinksForVideo - current item has wrong type"
            return RetHost(RetHost.ERROR, value=[])

        retlist = []

        if None != selItem and 'url' in selItem and 1 < len(selItem['url']):
            tmpList = self.host.getVideoLinks(selItem['url'])

            for item in tmpList:
                retlist.append(CUrlItem(item['name'], item['url'], 0))

        return RetHost(RetHost.OK, value=retlist)
Example #24
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)
Example #25
0
    def getLinksForVideo(self, Index=0, selItem=None):
        listLen = len(self.host.currList)
        if listLen < Index and listLen > 0:
            printDBG(
                "ERROR getLinksForVideo - current list is to short len: %d, Index: %d"
                % (listLen, Index))
            return RetHost(RetHost.ERROR, value=[])
        retlist = []
        if 'ekstraklasa.tv' in self.host.currList[Index].get('host', ''):
            tab = self.host.getLinks_ETV(self.host.currList[Index].get(
                'url', ''))

            tmp = tab
            tab = []
            for item in tmp:
                if item[0] == Ekstraklasa.ETV_FORMAT:
                    tab.append(item)

            def __getLinkQuality(itemLink):
                return int(itemLink[2])

            maxRes = int(config.plugins.iptvplayer.ekstraklasa_defaultformat.
                         value) * 1.1
            tab = CSelOneLink(tab, __getLinkQuality, maxRes).getSortedLinks()
            printDBG(
                ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. tab[%s]" %
                tab)
            if config.plugins.iptvplayer.ekstraklasa_usedf.value and 0 < len(
                    tab):
                tab = [tab[0]]

            for item in tab:
                nameLink = "type: %s \t bitrate: %s" % (item[0], item[2])
                url = item[1]
                retlist.append(
                    CUrlItem(nameLink.encode('utf-8'), url.encode('utf-8'), 0))
        elif 'ekstraklasa.org' in self.host.currList[Index].get('host', ''):
            pass
        return RetHost(RetHost.OK, value=retlist)
Example #26
0
 def getLogoPath(self):
     return RetHost(RetHost.OK, value=[GetLogoDir('tvn24logo.png')])
Example #27
0
 def getLogoPath(self):
     return RetHost(RetHost.OK, value = [GetLogoDir('librestreamlogo.png')])
Example #28
0
 def getLogoPath(self):
     return RetHost(RetHost.OK, value=[GetLogoDir('laola1tvlogo.png')])
Example #29
0
 def getLogoPath(self):
     return RetHost(RetHost.OK, value=[GetLogoDir('musicboxlogo.png')])
 def getLinksForVideo(self, Index=0, item=None):
     return RetHost(RetHost.NOT_IMPLEMENTED, value=[])