示例#1
0
    def queueAllVideos(self, item):
        dia = DialogProgress()
        dia.create('ViendoKodiStreaming', 'Get videos...' + item['title'])
        dia.update(0)

        items = self.getVideos(item, dia)
        if items:
            for it in items:
                item = self.createXBMCListItem(it)
                queries = {
                    'mode': str(Mode.PLAY),
                    'url': self.addon.build_plugin_url(it.infos)
                }
                uc = self.addon.build_plugin_url(queries)
                xbmc.PlayList(xbmc.PLAYLIST_VIDEO).add(uc, item)
            resultLen = len(items)
            msg = 'Queued ' + str(resultLen) + ' video'
            if resultLen > 1:
                msg += 's'
            dia.update(100, msg)
            xbmc.sleep(500)
            dia.update(100, msg, ' ', ' ')
        else:
            dia.update(0, 'No items found', ' ')

        xbmc.sleep(700)
        dia.close()
示例#2
0
 def download(self, url, destination=PACKAGE_DIR):
     try:
         dlg = DialogProgress()
         dlg.create('ViendoKodiStreaming - Installing external addon')
         destination = xbmc.translatePath(destination) + os.path.basename(url)
         def _report_hook(count, blocksize, totalsize):
             percent = int(float(count * blocksize * 100) / totalsize)
             dlg.update(percent, url, destination)
         fp, _ = urllib.urlretrieve(url, destination, _report_hook)
         return fp
     except:
         print_exc()
     dlg.close()
     return ""
示例#3
0
        def doUpdates(typeName, updates):
            count = len(updates)

            head = "SportsDevil Updates - %s" % typeName

            msg = common.translate(30277)
            if count == 1:
                msg = common.translate(30276)

            question = ("%s %s: " % (count, msg)) + ', '.join(
                map(lambda u: u.split('/')[-1], updates.keys())) + '\n'
            question += common.translate(30278)

            updates = updates.values()

            countFailed = 0

            dlg = DialogQuestion()
            dlg.head = head
            if dlg.ask(question):
                dlg = DialogProgress()
                firstline = common.translate(30279)
                dlg.create(head, firstline, " ")

                for i in range(0, count):
                    update = updates[i]
                    percent = int((i + 1.0) * 100 / count)
                    dlg.update(percent, firstline, update.name)
                    if not update.do():
                        countFailed += 1

                msg = " "
                if countFailed > 0:
                    msg = "%s %s" % (countFailed, common.translate(30280))

                dlg.update(100, msg, " ")
                xbmc.sleep(500)
                dlg.close()