示例#1
0
 def getLinksForVideo(self, cItem):
     printDBG("StreamLiveTo.getLinksForVideo [%s]" % cItem)
     urlTab = []
     videoUrl = cItem['url']
     if videoUrl.startswith('http'):
         '''
         httpParams = dict(self.defaultParams)
         httpParams['header'] = dict(self.HTTP_HEADER)
         httpParams['header']['Referer'] = videoUrl
         
         _url_re = re.compile("http(s)?://(\w+\.)?(ilive.to|streamlive.to)/.*/(?P<channel>\d+)")
         channel = _url_re.match(videoUrl).group("channel")
         
         sts, data = self.getPage('http://www.streamlive.to/view/%s' % channel, httpParams)
         
         sts, data = self.getPage(videoUrl, self.defaultParams)
         if not sts: []
         '''
         while True:
             urlTab = self.up.getVideoLinkExt(videoUrl)
             for idx in range(len(urlTab)):
                 urlTab[idx]['need_resolve'] = 0
             if 0 == len(
                     urlTab
             ) and 'get more FREE credits' in GetIPTVPlayerLastHostError(
                     False):
                 ret = -1
                 while ret == -1:
                     ret = self.listGetFreeCredits()
                 if ret == 1:
                     continue
             break
     return urlTab
示例#2
0
    def subtitleFileDownloaded(self, params):
        printDBG("IPTVSubDownloaderWidget.subtitleFileDownloaded")
        self["statustext"].setText("")
        self["list"].show()
        ret = params['ret']

        if ret.status != RetHost.OK or 1 != len(ret.value):
            disMessage = _('Download subtiles failed.') + '\n'
            if ret.message and ret.message != '':
                disMessage += ret.message
            lastErrorMsg = GetIPTVPlayerLastHostError()
            if lastErrorMsg != '':
                disMessage += "\n" + _('Last error: "%s"') % lastErrorMsg
            self.session.open(MessageBox,
                              disMessage,
                              type=MessageBox.TYPE_ERROR)
        else:
            # subtitle downloaded, ask for finish
            ret = ret.value[0]
            self.downloadedSubItems.append(ret)
            message = _('Subtitles \"%s\" downloaded correctly.') % ret.path
            message += '\n' + _('Do you want to finish?')
            self.session.openWithCallback(self.askFinishCallback,
                                          MessageBox,
                                          text=message,
                                          type=MessageBox.TYPE_YESNO)
示例#3
0
    def reloadList(self, params):
        printDBG("IPTVSubDownloaderWidget.reloadList")
        refresh = params['add_param'].get('refresh', 0)
        selIndex = params['add_param'].get('selIndex', 0)
        ret = params['ret']
        printDBG(
            "IPTVSubDownloaderWidget.reloadList refresh[%s], selIndex[%s]" %
            (refresh, selIndex))
        if 0 < refresh and 0 < selIndex:
            self.nextSelIndex = selIndex

        if ret.status != RetHost.OK:
            printDBG("++++++++++++++++++++++ reloadList ret.status = %s" %
                     ret.status)

        self.currList = ret.value
        self["list"].setList([(x, ) for x in self.currList])

        self["headertext"].setText(self.getCategoryPath())
        if len(self.currList) <= 0:
            disMessage = _("No item to display. \nPress OK to refresh.\n")
            if ret.message and ret.message != '':
                disMessage += ret.message
            lastErrorMsg = GetIPTVPlayerLastHostError()
            if lastErrorMsg != '':
                disMessage += "\n" + _('Last error: "%s"') % lastErrorMsg
            disMessage += '\n\n' + _('Simplify the title and try again.')

            self["statustext"].setText(disMessage)
            self["list"].hide()
        else:
            #restor previus selection
            if len(self.currList) > self.nextSelIndex:
                self["list"].moveToIndex(self.nextSelIndex)
            #else:
            #selection will not be change so manualy call
            self.changeBottomPanel()

            self["statustext"].setText("")
            self["list"].show()