Пример #1
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=[])
        urlItem = self.host.getVideoUrl(self.host.currList[Index]["page"])
        urlsTab = self.host.getVideoUrlforYTube(
            self.host.currList[Index]["page"])
        if config.plugins.iptvplayer.ytUseDF.value:

            def __getLinkQuality(itemLink):
                tab = itemLink['name'].split('x')
                return int(tab[0])

            urlsTab = urlsTab
        retlist = []
        if '' != urlItem:
            retlist.append(CUrlItem("diffanime", urlItem, 0))
        else:
            for urlItem in urlsTab:
                retlist.append(CUrlItem(urlItem['name'], urlItem['url'], 0))
        return RetHost(RetHost.OK, value=retlist)
Пример #2
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']]

        printDBG(">>>>>>>>>>>>>>>>>>>>>>>>>>>> [%s]" % item.resolver)

        if CFavItem.RESOLVER_URLLPARSER == item.resolver:
            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)
        elif CFavItem.RESOLVER_DIRECT_LINK == item.resolver:
            self.host = None
            self.hostName = None
            retlist = []
            retlist.append(CUrlItem('direct link', item.data, 0))
            ret = RetHost(RetHost.OK, value=retlist)
        else:
            if self._setHost(item.resolver):
                ret = self.host.getLinksForFavourite(item)
        return ret
Пример #3
0
    def convertList(self, cList):
        hostList = []

        for cItem in cList:
            hostLinks = []
            type = CDisplayListItem.TYPE_UNKNOWN

            if cItem['type'] == 'category':
                type = CDisplayListItem.TYPE_CATEGORY
            elif cItem['type'] == 'video':
                type = CDisplayListItem.TYPE_VIDEO
                url = cItem.get('url', '')
                if url.endswith(".jpeg") or url.endswith(
                        ".jpg") or url.endswith(".png"):
                    type = CDisplayListItem.TYPE_PICTURE
                else:
                    type = CDisplayListItem.TYPE_VIDEO
                if '' != url:
                    hostLinks.append(CUrlItem("Link", url, 1))

            title = self.host._cleanHtmlStr(cItem.get('title', ''))
            description = self.host._cleanHtmlStr(cItem.get('desc', ''))
            icon = self.host._cleanHtmlStr(cItem.get('icon', ''))

            hostItem = CDisplayListItem(name=title,
                                        description=description,
                                        type=type,
                                        urlItems=hostLinks,
                                        urlSeparateRequest=1,
                                        iconimage=icon,
                                        possibleTypesOfSearch=[])
            hostList.append(hostItem)

        return hostList
    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', ''))
            if config.plugins.iptvplayer.ekstraklasa_usedf.value:
                maxRes = int(config.plugins.iptvplayer.
                             ekstraklasa_defaultformat.value) * 1.1

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

                tab = CSelOneLink(tab, _getLinkQuality, maxRes).getOneLink()

            for item in tab:
                if item[0] == Ekstraklasa.ETV_FORMAT:
                    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)
Пример #5
0
    def converItem(self, cItem):
        hostList = []
        hostLinks = []
        type = CDisplayListItem.TYPE_UNKNOWN

        url = ''
        desc = ''
        if cItem['type'] in ['category']:
            if cItem.get('title', '') == 'Wyszukaj':
                type = CDisplayListItem.TYPE_SEARCH
            else:
                type = CDisplayListItem.TYPE_CATEGORY
        elif cItem['type'] == 'video':
            type = CDisplayListItem.TYPE_VIDEO
            url = cItem.get('page', '')
            hostLinks.append(CUrlItem('', url, 0))

        name = cItem.get('title', '')
        icon = cItem.get('icon', '')
        desc = ' ' + cItem.get('page', '')

        return CDisplayListItem(name=name,
                                description=desc,
                                type=type,
                                urlItems=hostLinks,
                                urlSeparateRequest=1,
                                iconimage=icon,
                                possibleTypesOfSearch=[])
Пример #6
0
    def convertList(self, cList):
        hostList = []
        searchTypesOptions = [] 
        for cItem in cList:
            hostLinks = []
            type = CDisplayListItem.TYPE_UNKNOWN
            possibleTypesOfSearch = None
            if cItem['type'] == 'category':
                if cItem['title'] == 'Wyszukaj':
                    type = CDisplayListItem.TYPE_SEARCH
                    possibleTypesOfSearch = searchTypesOptions
                else:
                    type = CDisplayListItem.TYPE_CATEGORY
            elif cItem['type'] == 'video':
                type = CDisplayListItem.TYPE_VIDEO
                url = cItem.get('url', '')
                if self._isPicture(url):
                    type = CDisplayListItem.TYPE_PICTURE
                else:
                    type = CDisplayListItem.TYPE_VIDEO
                if '' != url:
                    hostLinks.append(CUrlItem('Link', url, 1))
            title = cItem.get('title', '')
            description = ph.clean_html(cItem.get('desc', ''))
            icon = cItem.get('icon', '')
            hostItem = CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch)
            hostList.append(hostItem)

        return hostList
    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.org' 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)
Пример #8
0
    def converItem(self, cItem):
        hostList = []
        searchTypesOptions = []
        hostLinks = []
        type = CDisplayListItem.TYPE_UNKNOWN
        possibleTypesOfSearch = None

        if 'category' == cItem['type']:
            if cItem.get('search_item', False):
                type = CDisplayListItem.TYPE_SEARCH
                possibleTypesOfSearch = searchTypesOptions
            else:
                type = CDisplayListItem.TYPE_CATEGORY
        elif cItem['type'] == 'video':
            type = CDisplayListItem.TYPE_VIDEO
        elif 'more' == cItem['type']:
            type = CDisplayListItem.TYPE_MORE
        elif 'audio' == cItem['type']:
            type = CDisplayListItem.TYPE_AUDIO

        if type in [CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO]:
            url = cItem.get('url', '')
            if '' != url:
                hostLinks.append(CUrlItem('Link', url, 1))
        title = cItem.get('title', '')
        description = cItem.get('desc', '')
        icon = cItem.get('icon', '')
        return CDisplayListItem(name=title,
                                description=description,
                                type=type,
                                urlItems=hostLinks,
                                urlSeparateRequest=1,
                                iconimage=icon,
                                possibleTypesOfSearch=possibleTypesOfSearch)
Пример #9
0
    def converItem(self, cItem):
        hostLinks = []
        type = CDisplayListItem.TYPE_UNKNOWN
        possibleTypesOfSearch = None

        if cItem['type'] == 'category':
            if cItem['title'] == 'Wyszukaj':
                type = CDisplayListItem.TYPE_SEARCH
            else:
                type = CDisplayListItem.TYPE_CATEGORY
        elif cItem['type'] == 'video':
            type = CDisplayListItem.TYPE_VIDEO
        elif 'audio' == cItem['type']:
            type = CDisplayListItem.TYPE_AUDIO
        elif 'picture' == cItem['type']:
            type = CDisplayListItem.TYPE_PICTURE
        
        if type in [CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO, CDisplayListItem.TYPE_PICTURE]:
            url = cItem.get('url', '')
            if '' != url:
                hostLinks.append(CUrlItem("Link", url, 1))
            
        title       =  clean_html( cItem.get('title', '') )
        description =  clean_html( cItem.get('plot', '') )
        icon        =  cItem.get('icon', '')
        
        return CDisplayListItem(name = title,
                                    description = description,
                                    type = type,
                                    urlItems = hostLinks,
                                    urlSeparateRequest = 1,
                                    iconimage = icon,
                                    possibleTypesOfSearch = possibleTypesOfSearch)
Пример #10
0
    def converItem(self, cItem):
        searchTypesOptions = []  # ustawione alfabetycznie
        hostLinks = []
        type = CDisplayListItem.TYPE_UNKNOWN
        possibleTypesOfSearch = None

        if cItem['type'] == 'category':
            if cItem['title'] == 'Wyszukaj':
                type = CDisplayListItem.TYPE_SEARCH
                possibleTypesOfSearch = searchTypesOptions
            else:
                type = CDisplayListItem.TYPE_CATEGORY
        elif cItem['type'] == 'video':
            type = CDisplayListItem.TYPE_VIDEO
            urls = cItem.get('urls', [])
            for urlItem in urls:
                hostLinks.append(CUrlItem(urlItem['name'], urlItem['url'], 0))

        title = clean_html(cItem.get('title', ''))
        description = clean_html(cItem.get('plot', ''))
        icon = cItem.get('icon', '')
        hostItem = CDisplayListItem(
            name=title,
            description=description,
            type=type,
            urlItems=hostLinks,
            urlSeparateRequest=0,
            iconimage=icon,
            possibleTypesOfSearch=possibleTypesOfSearch)
        return hostItem
Пример #11
0
    def convertList(self, cList):
        hostList = []
        
        for cItem in cList:
            hostLinks = []
            type = CDisplayListItem.TYPE_UNKNOWN

            if cItem['type'] == 'category':
                if cItem['title'] == 'Wyszukaj':
                    type = CDisplayListItem.TYPE_SEARCH
                else:
                    type = CDisplayListItem.TYPE_CATEGORY
            elif cItem['type'] == 'video':
                type = CDisplayListItem.TYPE_VIDEO
                page = cItem.get('page', '')
                if '' != page:
                    hostLinks.append(CUrlItem("Link", page, 1))
                
            title       =  cItem.get('title', '')
            description =  cItem.get('plot', '')
            icon        =  cItem.get('icon', '')
            
            hostItem = CDisplayListItem(name = title,
                                        description = description,
                                        type = type,
                                        urlItems = hostLinks,
                                        urlSeparateRequest = 1,
                                        iconimage = icon )
            hostList.append(hostItem)

        return hostList
Пример #12
0
    def convertList(self, cList):
        hostList = []
        searchTypesOptions = []
    
        for cItem in cList:
            hostLinks = []
            type = CDisplayListItem.TYPE_UNKNOWN
            possibleTypesOfSearch = None
            

            if 'category' == cItem['type']:
                if cItem.get('search_item', False):
                    type = CDisplayListItem.TYPE_SEARCH
                    possibleTypesOfSearch = searchTypesOptions
                else:
                    type = CDisplayListItem.TYPE_CATEGORY
            elif cItem['type'] == 'video':
                type = CDisplayListItem.TYPE_VIDEO
                url = cItem.get('url', '')
                if '' != url:
                    hostLinks.append(CUrlItem("Link", url, 0))
                
            title       =  cItem.get('title', '')
            description =  self.host.cleanHtmlStr(cItem.get('desc', ''))
            icon        =  cItem.get('icon', '')
            
            hostItem = CDisplayListItem(name = title,
                                        description = description,
                                        type = type,
                                        urlItems = hostLinks,
                                        urlSeparateRequest = 1,
                                        iconimage = icon,
                                        possibleTypesOfSearch = possibleTypesOfSearch)
            hostList.append(hostItem)
        return hostList
Пример #13
0
 def getResolvedURL(self, url):
     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)
Пример #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'])
            if config.plugins.iptvplayer.wpUseDF.value:
                maxRes = int(config.plugins.iptvplayer.wpDefaultformat.value)
                tmpList = CSelOneLink(tmpList, _getLinkQuality,
                                      maxRes).getOneLink()

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

        return RetHost(RetHost.OK, value=retlist)
Пример #15
0
    def converItem(self, cItem):
        hostList = []
        searchTypesOptions = []
        
        hostLinks = []
        type = CDisplayListItem.TYPE_UNKNOWN
        possibleTypesOfSearch = None

        if cItem['type'] == 'category':
            if cItem['title'] == 'Wyszukaj':
                type = CDisplayListItem.TYPE_SEARCH
                possibleTypesOfSearch = searchTypesOptions
            else:
                type = CDisplayListItem.TYPE_CATEGORY
        elif cItem['type'] == 'video':
            type = CDisplayListItem.TYPE_VIDEO
            url = cItem.get('url', '')
            if '' != url:
                hostLinks.append(CUrlItem("Link", url, 1))
            
        title       =  cItem.get('title', '')
        description =  clean_html(cItem.get('desc', ''))
        icon        =  cItem.get('icon', '')
        
        return CDisplayListItem(name = title,
                                description = description,
                                type = type,
                                urlItems = hostLinks,
                                urlSeparateRequest = 1,
                                iconimage = icon,
                                possibleTypesOfSearch = possibleTypesOfSearch)
Пример #16
0
    def getLinksForVideo(self, Index=0, selItem=None):
        listLen = len(self.onet.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.onet.currList[Index].name != 'playSelectedMovie':
            printDBG("ERROR getLinksForVideo - current item has wrong type")
            return RetHost(RetHost.ERROR, value=[])

        retlist = []
        videoID = self.onet.currList[Index].category

        subTrackTab, tab = self.onet.api.getVideoTab(
            self.onet.currList[Index].category, True)
        if config.plugins.iptvplayer.onetvodUseDF.value:
            maxRes = int(
                config.plugins.iptvplayer.onetvodDefaultformat.value) * 1.1
            tab = CSelOneLink(tab, _getLinkQuality, maxRes).getOneLink()

        for item in tab:
            if item[0] == vodonet.FORMAT:
                nameLink = "type: %s \t bitrate: %s" % (item[0], item[2])
                url = item[1].encode('utf-8')
                url = strwithmeta(url, {'external_sub_tracks': subTrackTab})
                retlist.append(CUrlItem(nameLink.encode('utf-8'), url, 0))

        return RetHost(RetHost.OK, value=retlist)
Пример #17
0
    def converItem(self, cItem):
        hostList = []
        searchTypesOptions = self.host.SEARCH_TYPES
        hostLinks = []
        type = CDisplayListItem.TYPE_UNKNOWN
        possibleTypesOfSearch = None

        if cItem['type'] == 'category':
            if cItem.get('search_item', False):
                type = CDisplayListItem.TYPE_SEARCH
                possibleTypesOfSearch = searchTypesOptions
            else:
                type = CDisplayListItem.TYPE_CATEGORY
        elif cItem['type'] == 'video':
            type = CDisplayListItem.TYPE_VIDEO
            url = cItem.get('url', '')
            if '' != url:
                hostLinks.append(CUrlItem("Link", url, 1))

        title = cItem.get('title', '')
        description = cItem.get('plot', '')
        if '' == description:
            description = cItem.get('time', '') + ' | ' + cItem.get('desc', '')
        icon = cItem.get('icon', '')
        if icon == '': icon = self.DEFAULT_ICON

        return CDisplayListItem(name=title,
                                description=description,
                                type=type,
                                urlItems=hostLinks,
                                urlSeparateRequest=1,
                                iconimage=icon,
                                possibleTypesOfSearch=possibleTypesOfSearch)
Пример #18
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=[])

        urlsTab = self.host.getVideoUrl(self.host.currList[Index]["page"])
        if config.plugins.iptvplayer.ytUseDF.value:
            maxRes = int(config.plugins.iptvplayer.ytDefaultformat.value) * 1.1

            def __getLinkQuality(itemLink):
                tab = itemLink['name'].split('x')
                return int(tab[0])

            urlsTab = CSelOneLink(urlsTab, __getLinkQuality,
                                  maxRes).getOneLink()
        retlist = []
        for urlItem in urlsTab:
            retlist.append(CUrlItem(urlItem['name'], urlItem['url'], 0))

        return RetHost(RetHost.OK, value=retlist)
Пример #19
0
    def converItem(self, cItem):
        hostList = []
        searchTypesOptions = []  # ustawione alfabetycznie
        #searchTypesOptions.append(("Seriale", "seriale"))
        searchTypesOptions.append(("Filmy", "filmy"))
        searchTypesOptions.append(("Seriale", "seriale"))

        hostLinks = []
        type = CDisplayListItem.TYPE_UNKNOWN
        possibleTypesOfSearch = None

        if cItem['type'] == 'category':
            if cItem['title'] == 'Wyszukaj':
                type = CDisplayListItem.TYPE_SEARCH
                possibleTypesOfSearch = searchTypesOptions
            else:
                type = CDisplayListItem.TYPE_CATEGORY
        elif cItem['type'] == 'video':
            type = CDisplayListItem.TYPE_VIDEO
            url = cItem.get('url', '')
            if '' != url:
                hostLinks.append(CUrlItem("Link", url, 1))

        title = self.host.cleanHtmlStr(cItem.get('title', ''))
        description = cItem.get('plot', '')
        description = self.host.cleanHtmlStr(description)
        icon = cItem.get('icon', '')

        return CDisplayListItem(name=title,
                                description=description,
                                type=type,
                                urlItems=hostLinks,
                                urlSeparateRequest=1,
                                iconimage=icon,
                                possibleTypesOfSearch=possibleTypesOfSearch)
Пример #20
0
 def getLinksForVideo(self, Index=0, selItem=None):
     retCode = RetHost.ERROR
     retlist = []
     if not self.isValidIndex(Index): RetHost(retCode, value=retlist)
     urlList = self.host.getVideoLinks(self.host.currList[Index]["page"])
     for item in urlList:
         retlist.append(CUrlItem(item["name"], item["url"], 0))
     return RetHost(RetHost.OK, value=retlist)
Пример #21
0
    def convertList(self, cList):
        hostList = []
        searchTypesOptions = []  # ustawione alfabetycznie
        #searchTypesOptions.append(("Seriale", "seriale"))
        searchTypesOptions.append(("Filmy", "filmy"))

        for cItem in cList:
            hostLinks = []
            type = CDisplayListItem.TYPE_UNKNOWN
            possibleTypesOfSearch = None

            if cItem['type'] == 'category':
                if cItem['title'] == 'Wyszukaj':
                    type = CDisplayListItem.TYPE_SEARCH
                    possibleTypesOfSearch = searchTypesOptions
                else:
                    type = CDisplayListItem.TYPE_CATEGORY
            elif cItem['type'] == 'video':
                type = CDisplayListItem.TYPE_VIDEO
                url = cItem.get('url', '')
                if '' != url:
                    hostLinks.append(CUrlItem("Link", url, 1))
            elif cItem['type'] == 'article':
                type = CDisplayListItem.TYPE_ARTICLE
                url = cItem.get('url', '')
                if '' != url:
                    hostLinks.append(CUrlItem("Link", url, 1))

            title = clean_html(cItem.get('title',
                                         '').decode("utf-8")).encode("utf-8")
            description = clean_html(cItem.get(
                'plot', '').decode("utf-8")).encode("utf-8")
            icon = cItem.get('icon', '')

            hostItem = CDisplayListItem(
                name=title,
                description=description,
                type=type,
                urlItems=hostLinks,
                urlSeparateRequest=1,
                iconimage=icon,
                possibleTypesOfSearch=possibleTypesOfSearch)
            hostList.append(hostItem)

        return hostList
Пример #22
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)
Пример #23
0
    def getResolvedURL(self, url):
        # resolve url to get direct url to video file
        retlist = []
        urlList = self.host.getResolvedURL(url)
        for item in urlList:
            need_resolve = 0
            retlist.append(CUrlItem(item["name"], item["url"], need_resolve))

        return RetHost(RetHost.OK, value=retlist)
Пример #24
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)
Пример #25
0
    def getLinksForVideo(self, Index = 0, selItem = None):
        retCode = RetHost.ERROR
        retlist = []
        if not self.isValidIndex(Index): RetHost(retCode, value=retlist)
        
        urlsTab = self.host.anyfiles.getVideoUrl(self.host.currList[Index]["page"])
        for urlItem in urlsTab:
            retlist.append(CUrlItem(urlItem['name'], urlItem['url'], 0))

        return RetHost(RetHost.OK, value = retlist)
Пример #26
0
    def getLinksForVideo(self, Index=0, selItem=None):
        retCode = RetHost.ERROR
        retlist = []
        if not self.isValidIndex(Index): RetHost(retCode, value=retlist)

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

        return RetHost(RetHost.OK, value=retlist)
Пример #27
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)
Пример #28
0
    def convertList(self, cList):
        hostList = []

        for cItem in cList:
            hostLinks = []

            urlSeparateRequest = 0
            type = CDisplayListItem.TYPE_UNKNOWN
            if cItem.type == CListItem.TYPE_CATEGORY:
                type = CDisplayListItem.TYPE_CATEGORY
            elif cItem.type == CListItem.TYPE_VIDEO:
                type = CDisplayListItem.TYPE_VIDEO
                hostLinks.append(CUrlItem('', cItem.videoUrl, 1))
            elif cItem.type == CListItem.TYPE_VIDEO_RES:
                type = CDisplayListItem.TYPE_VIDEO
                hostLinks.append(CUrlItem('', cItem.videoUrl, 1))
                urlSeparateRequest = 1
            elif cItem.type == CListItem.TYPE_CHANNEL:
                type = CDisplayListItem.TYPE_VIDEO
                links = cItem.videoUrl
                if isinstance(links, list):
                    for link in links:
                        name = link[0]
                        urls = link[1]
                        if isinstance(urls, list):
                            for url in urls:
                                hostLinks.append(CUrlItem(name, url, 0))
                        else:
                            hostLinks.append(CUrlItem(name, urls, 0))
                else:
                    hostLinks.append(CUrlItem('', links, 0))

            hostItem = CDisplayListItem(name=cItem.title,
                                        description=cItem.description,
                                        type=type,
                                        urlItems=hostLinks,
                                        urlSeparateRequest=urlSeparateRequest,
                                        iconimage='')
            hostList.append(hostItem)

        return hostList
Пример #29
0
    def convertList(self, cList):
        hostList = []
        possibleTypesOfSearch = []

        for cItem in cList:
            hostLinks = []
            type = CDisplayListItem.TYPE_UNKNOWN

            if cItem['type'] in ['main', 'sub', 'subSub', 'subSubPage']:
                type = CDisplayListItem.TYPE_CATEGORY
            elif cItem['type'] == 'video':
                type = CDisplayListItem.TYPE_VIDEO
                videoID = ''
                if 'url' in cItem:
                    url = cItem['url']
                hostLinks.append(CUrlItem('', url, 0))
            elif cItem['type'] == 'search':
                type = CDisplayListItem.TYPE_SEARCH

            name = ' '
            if 'name' in cItem:
                name = cItem['name']
            opis = ''
            if 'opis' in cItem:
                opis = cItem['opis']
            ilosc = ''
            if 'ilosc' in cItem:
                ilosc = '(' + cItem['ilosc'] + ')'
            ico = ''
            if 'ico' in cItem:
                ico = cItem['ico']
            if ico == '':
                ico = 'http://mamrodzine.pl/wp-content/uploads/2011/06/logo_transparent.png'

            hostItem = CDisplayListItem(
                name=name + ' ' + ilosc,
                description=opis,
                type=type,
                urlItems=hostLinks,
                urlSeparateRequest=1,
                iconimage=ico,
                possibleTypesOfSearch=possibleTypesOfSearch)
            hostList.append(hostItem)
        # end for

        return hostList


#host = Spryciarze()
#host.getMainCategory()
#host.getVideoList('http://kulinaria.spryciarze.pl/kategorie/dania-miesne')
#host.getVideoLinks('58763')
Пример #30
0
    def getLinksForVideo(self, Index=0, item=None):
        hostLinks = []
        try:
            url = item.urlItems[0].url
            if url.startswith('http://www.dr.dk/handlers/GetResource.ashx'):
                resources = self.host.api._call_api(url)
                links = sorted(resources['links'],
                               key=lambda link: link['bitrateKbps'],
                               reverse=True)
                for link in links:
                    uri = link['uri'].encode('UTF-8')
                    fileType = link['fileType'].encode('UTF-8')
                    bitrate = str(link['bitrateKbps'])
                    linkType = link['linkType'].encode('UTF-8')
                    resolution = str(link['width']) + ' x ' + str(
                        link['height'])
                    name = resolution + ", " + bitrate + " Kbps, " + fileType
                    hostLinks.append(CUrlItem(name, uri, 1))
            else:
                hostLinks.append(CUrlItem('', url, 1))
        except:
            return RetHost(RetHost.NOT_IMPLEMENTED, value=[])

        return RetHost(RetHost.OK, hostLinks)