Пример #1
0
    def getResolvedURL(self, url):
        # resolve url to get direct url to video file
        url = self.host.up.getVideoLink(url)
        urlTab = []

        if isinstance(url, basestring):
            urlTab.append(url)

        return RetHost(RetHost.OK, value=urlTab)
Пример #2
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)
Пример #3
0
    def getLinksForVideo(self, Index=0, selItem=None):
        if self.host.isQuestMode():
            return self.host.getCurrentGuestHost().getLinksForVideo(Index)
        else:
            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"] not in [
                    'audio', 'video', 'picture'
            ]:
                printDBG(
                    "ERROR getLinksForVideo - current item has wrong type")
                return RetHost(RetHost.ERROR, value=[])
            return self.host.getLinksForVideo(self.host.currList[Index])
Пример #4
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 = [])
        
        if self.host.currList[Index]["type"] != 'video':
            printDBG( "ERROR getLinksForVideo - current item has wrong type" )
            return RetHost(RetHost.ERROR, value = [])

        retlist = []
        uri = self.host.currList[Index].get('url', '')
        if not self._isPicture(uri):
            urlList = self.host.getLinksForVideo(self.host.currList[Index])
            for item in urlList:
                retlist.append(CUrlItem(item["name"], item["url"], 0))
        else: retlist.append(CUrlItem('picture link', urlparser.decorateParamsFromUrl(uri, True), 0))

        return RetHost(RetHost.OK, value = retlist)
Пример #5
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 = [])
        
        if self.host.currList[Index]["type"] != 'video':
            printDBG( "ERROR getLinksForVideo - current item has wrong type" )
            return RetHost(RetHost.ERROR, value = [])

        linkTab = []
        if True == self.host.loggedIn:
            linkTab.extend( self.host.getHostTable(self.host.currList[Index]["page"], True) )
        linkTab.extend( self.host.getHostTable(self.host.currList[Index]["page"]) )
        retlist = []
        for item in linkTab:
            retlist.append(CUrlItem(item['name'], item['url'], 0))

        return RetHost(RetHost.OK, value = retlist)
Пример #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)
Пример #7
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=[])

        if self.host.currList[Index]["type"] != '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
            retlist.append(CUrlItem(item["name"], item["url"], need_resolve))

        return RetHost(RetHost.OK, value=retlist)
Пример #8
0
    def getInitList(self):
        self.isSearch = False
        self.host = serialeo()
        self.currIndex = -1
        self.listOfprevList = []

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

        return RetHost(RetHost.OK, value=convList)
    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)
Пример #10
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)
Пример #11
0
 def getMoreForItem(self, Index=0):
     ret = RetHost(RetHost.ERROR, value=[])
     if not self.host.isQuestMode():
         ret = CHostBase.getMoreForItem(self, Index)
     if self.host.isQuestMode():
         ret = self.host.getCurrentGuestHost().getMoreForItem(Index)
         for idx in range(len(ret.value)):
             ret.value[idx].isGoodForFavourites = False
     self.fixWatchedFlag(ret)
     return ret
Пример #12
0
 def getPrevList(self, refresh = 0):
     ret = RetHost(RetHost.ERROR, value = [])
     if not self.host.isQuestMode() or len(self.host.getCurrentGuestHost().listOfprevList) <= 1:
         if self.host.isQuestMode(): self.host.clearQuestMode()
         ret = CHostBase.getPrevList(self, refresh)
     else:
         ret = self.host.getCurrentGuestHost().getPrevList(refresh)
         for idx in range(len(ret.value)):
             ret.value[idx].isGoodForFavourites = False
     self.fixWatchedFlag(ret)
     return ret
Пример #13
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['category'] != 'list_seasons':
            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)
Пример #14
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)
Пример #15
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)
Пример #16
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]

        hList = self.host.getArticleContent(cItem)
        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)
Пример #17
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)])
Пример #18
0
 def getArticleContent(self, Index = 0):
     retCode = RetHost.ERROR
     retlist = []
     guestIndex = Index
     callQuestHost = True
     if not self.host.isQuestMode():
         callQuestHost = self.host.prepareGuestHostItem(Index)
         guestIndex = 0
     if callQuestHost:
         return self.host.getCurrentGuestHost().getArticleContent(guestIndex)
     return RetHost(retCode, value = retlist)
Пример #19
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=[])

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

        retlist = []
        tab = self.host.getPlayTable(self.host.currList[Index].page)
        for item in tab:
            nameLink = item[1]
            url = item[0]
            retlist.append(CUrlItem(nameLink, url, 1))

        return RetHost(RetHost.OK, value=retlist)
Пример #20
0
 def getPrevList(self, refresh = 0):
     self.host.setCurrDir('')
     if(len(self.listOfprevList) > 0):
         hostList = self.listOfprevList.pop()
         hostCurrItem = self.listOfprevItems.pop()
         self.host.setCurrList(hostList)
         self.host.setCurrItem(hostCurrItem)
         
         convList = None
         if '' != self.needRefresh: 
             path = hostCurrItem.get('path', '')
             if '' != path and os_path.realpath(path) == os_path.realpath(self.needRefresh):
                 self.needRefresh = ''
                 self.host.handleService(self.currIndex, 1, self.searchPattern, self.searchType)
                 convList = self.convertList(self.host.getCurrList())
         if None == convList:
             convList = self.convertList(hostList)
         return RetHost(RetHost.OK, value = convList)
     else:
         return RetHost(RetHost.ERROR, value = [])
Пример #21
0
    def getLinksForVideo(self, cItem):
        printDBG("Favourites.getLinksForVideo idx[%r]" % cItem)
        ret = RetHost(RetHost.ERROR, value=[])
        sts, data = self.helper.getGroupItems(cItem['group_id'])
        if not sts: return ret
        item = data[cItem['item_idx']]

        if CFavItem.RESOLVER_URLLPARSER != item.resolver:
            if self._setHost(item.resolver):
                ret = self.host.getLinksForFavourite(item)
        else:
            self.host = None
            self.hostName = None
            retlist = []
            urlList = self.up.getVideoLinkExt(item.data)
            for item in urlList:
                name = self.host.cleanHtmlStr(item["name"])
                url = item["url"]
                retlist.append(CUrlItem(name, url, 0))
            ret = RetHost(RetHost.OK, value=retlist)
        return ret
Пример #22
0
    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)
Пример #23
0
 def markItemAsViewed(self, Index = 0):
     retCode = RetHost.ERROR
     retlist = []
     if self.useWatchedFlag:
         ret = self.cachedRet
         if ret.value[Index].isWatched != True and ret.value[Index].type in [CDisplayListItem.TYPE_VIDEO, CDisplayListItem.TYPE_AUDIO]:
             hashData = self.getItemHashData(Index, ret.value[Index])
             if self._createViewedFile(hashData):
                 self.cachedRet.value[Index].isWatched = True
                 retCode = RetHost.OK
                 retlist = ['refresh']
                 self.refreshAfterWatchedFlagChange = True
     return RetHost(retCode, value = retlist)
Пример #24
0
 def getListForItem(self, Index = 0, refresh = 0, selItem = None):
     guestIndex = Index
     ret = RetHost(RetHost.ERROR, value = [])
     if not self.host.isQuestMode(): 
         ret = CHostBase.getListForItem(self, Index, refresh)
         guestIndex = 0
     if self.host.isQuestMode(): 
         ret = self.host.getCurrentGuestHost().getListForItem(guestIndex, refresh)
         for idx in range(len(ret.value)):
             ret.value[idx].isGoodForFavourites = False
     
     self.fixWatchedFlag(ret)
     return ret
Пример #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)
Пример #26
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', ''))

            def __getLinkQuality( itemLink ):
                return int(itemLink['bitrate'])

            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 len(tab):
                tab = [tab[0]]

            for item in tab:
                retlist.append(CUrlItem(item['name'], item['url'], 0))
        elif 'ekstraklasa.org' in self.host.currList[Index].get('host', ''):
            pass
        return RetHost(RetHost.OK, value = retlist)
Пример #27
0
 def getResolvedURL(self, url):
     printDBG("yousee.getResolvedURL: %s" % url)
     list = []
     if url not in [None, '']:
         if url.startswith('yousee-channel-id:'):
             id = url.split(':')[1]
             ret = self.host.api_ys.streamUrl(id)
             rtmpUrl = ret['url'].encode('UTF-8')
             printDBG(rtmpUrl)
             if rtmpUrl:
                 printDBG("yousee.getResolvedurl.append: %s" % rtmpUrl)
             if rtmpUrl.find('://') >= 0:
                 list.append(rtmpUrl)
     return RetHost(RetHost.OK, value=list)
Пример #28
0
 def getCurrentList(self, refresh=0):
     if refresh == 1 and self.refreshAfterWatchedFlagChange and self.cachedRet != None:
         ret = self.cachedRet
     else:
         ret = RetHost(RetHost.ERROR, value=[])
         if not self.host.isQuestMode():
             ret = CHostBase.getCurrentList(self, refresh)
         if self.host.isQuestMode():
             ret = self.host.getCurrentGuestHost().getCurrentList(refresh)
             for idx in range(len(ret.value)):
                 ret.value[idx].isGoodForFavourites = False
         self.fixWatchedFlag(ret)
     self.refreshAfterWatchedFlagChange = False
     return ret
Пример #29
0
    def getSearchResults(self, searchpattern, searchType=None):
        self.isSearch = True
        retList = []
        self.searchPattern = searchpattern

        # Find 'Wyszukaj' item
        list = self.host.getCurrList()
        try:
            for i in range(len(list)):
                if list[i]['title'] == 'Wyszukaj':
                    return self.getListForItem(i)
        except:
            printDBG('getSearchResults EXCEPTION')

        return RetHost(RetHost.ERROR, value=[])
Пример #30
0
 def getCustomActions(self, Index = 0):
     retCode = RetHost.ERROR
     retlist = []
     if self.useWatchedFlag:
         ret = self.cachedRet
         if ret.value[Index].type in [CDisplayListItem.TYPE_VIDEO, CDisplayListItem.TYPE_AUDIO]:
             tmp = self.getItemHashData(Index, ret.value[Index])
             if tmp != '':
                 if self.cachedRet.value[Index].isWatched:
                     params = IPTVChoiceBoxItem(_('Unset watched'), "", {'action':'unset_watched_flag', 'item_index':Index, 'hash_data':tmp})
                 else:
                     params = IPTVChoiceBoxItem(_('Set watched'), "", {'action':'set_watched_flag', 'item_index':Index, 'hash_data':tmp})
                 retlist.append(params)
             retCode = RetHost.OK
     return RetHost(retCode, value = retlist)