示例#1
0
文件: player.py 项目: pqncy/filmkodi
    def run(self, name, url, meta, service):
        control.log("###URL %s" % url)

        if control.window.getProperty('PseudoTVRunning') == 'True':
            return control.player.play(url, control.item(path=url))
        #client.mystat('http://'+service+'.tv')
        if service == 'telewizjadanet':
            self._service = service
            self._playing = True
        if service == 'pierwsza':
            self._service = service
            self._playing = True

        poster, thumb, meta = self.getMeta(meta)
        control.log("###META %s" % meta)

        item = control.item(path=url)
        item.setArt({
            'icon': thumb,
            'thumb': thumb,
            'poster': poster,
            'tvshow.poster': poster,
            'season.poster': poster
        })
        #item.setInfo(type='Video', infoLabels=meta)
        #item.setInfo(type='Video', infoLabels={ "Title": meta['title']})
        control.log("###URL %s | %s | %s" % (url, name, int(sys.argv[1])))

        control.resolve(int(sys.argv[1]), True, item)

        for i in range(0, 240):
            if self.isPlayingVideo(): break
            xbmc.sleep(1000)
示例#2
0
文件: player.py 项目: mrknow/filmkodi
    def run(self, name, url, meta, service):
        control.log("###URL %s" % url)

        if control.window.getProperty('PseudoTVRunning') == 'True':
            return control.player.play(url, control.item(path=url))
        #client.mystat('http://'+service+'.tv')
        if service=='telewizjadanet':
            self._service = service
            self._playing = True
        if service=='pierwsza':
            self._service = service
            self._playing = True

        poster, thumb, meta = self.getMeta(meta)
        control.log("###META %s" % meta)

        item = control.item(path=url)
        item.setArt({'icon': thumb, 'thumb': thumb, 'poster': poster, 'tvshow.poster': poster, 'season.poster': poster})
        #item.setInfo(type='Video', infoLabels=meta)
        #item.setInfo(type='Video', infoLabels={ "Title": meta['title']})
        control.log("###URL %s | %s | %s" % (url, name, int(sys.argv[1])))

        control.resolve(int(sys.argv[1]), True, item)

        for i in range(0, 240):
            if self.isPlayingVideo(): break
            xbmc.sleep(1000)
示例#3
0
    def play(self, name, title, service, meta, url):
        #control.log('BBB1 %s %s %s %s' % (name, title, meta,service))

        try:
            if not control.infoLabel('Container.FolderPath').startswith(
                    'plugin://'):
                control.playlist.clear()

            control.resolve(int(sys.argv[1]), True, control.item(path=''))
            #control.execute('Dialog.Close(okdialog)')

            content = 'movie'
            url = self.sourcesDirect(service, meta)

            if url == None: raise Exception()
            if url == 'close://': return

            control.sleep(200)

            from resources.lib.lib.player import player
            player().run(name, url, meta, service)

            return url
        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
示例#4
0
    def play(self, name, title, service, meta, url):
        #control.log('BBB1 %s %s %s %s' % (name, title, meta,service))

        try:
            if not control.infoLabel('Container.FolderPath').startswith('plugin://'):
                control.playlist.clear()

            control.resolve(int(sys.argv[1]), True, control.item(path=''))
            #control.execute('Dialog.Close(okdialog)')

            content = 'movie'
            url = self.sourcesDirect(service, meta)

            if url == None: raise Exception()
            if url == 'close://': return

            control.sleep(200)

            from resources.lib.lib.player import player
            player().run(name, url, meta,service)

            return url
        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
示例#5
0
    def playItem(self, content, name, year, imdb, tvdb, source):
        try:
            control.resolve(int(sys.argv[1]), True, control.item(path=''))
            control.execute('Dialog.Close(okdialog)')

            next = [] ; prev = [] ; total = []
            meta = None

            for i in range(1,10000):
                try:
                    u = control.infoLabel('ListItem(%s).FolderPath' % str(i))
                    if u in total: raise Exception()
                    total.append(u)
                    u = dict(urlparse.parse_qsl(u.replace('?','')))
                    if 'meta' in u: meta = u['meta']
                    u = json.loads(u['source'])[0]
                    next.append(u)
                except:
                    break
            for i in range(-10000,0)[::-1]:
                try:
                    u = control.infoLabel('ListItem(%s).FolderPath' % str(i))
                    if u in total: raise Exception()
                    total.append(u)
                    u = dict(urlparse.parse_qsl(u.replace('?','')))
                    if 'meta' in u: meta = u['meta']
                    u = json.loads(u['source'])[0]
                    prev.append(u)
                except:
                    break

            items = json.loads(source)

            source, quality = items[0]['source'], items[0]['quality']
            items = [i for i in items+next+prev if i['quality'] == quality and i['source'] == source][:10]
            items += [i for i in next+prev if i['quality'] == quality and not i['source'] == source][:10]

            self.progressDialog = control.progressDialog
            self.progressDialog.create(control.addonInfo('name'), '')
            self.progressDialog.update(0)

            block = None

            for i in range(len(items)):
                try:
                    self.progressDialog.update(int((100 / float(len(items))) * i), str(items[i]['label']), str(' '))

                    if items[i]['source'] == block: raise Exception()

                    w = workers.Thread(self.sourcesResolve, items[i]['url'], items[i]['provider'])
                    w.start()

                    m = ''

                    for x in range(3600):
                        if self.progressDialog.iscanceled(): return self.progressDialog.close()
                        if xbmc.abortRequested == True: return sys.exit()
                        k = control.condVisibility('Window.IsActive(virtualkeyboard)')
                        if k: m += '1'; m = m[-1]
                        if (w.is_alive() == False or x > 30) and not k: break
                        time.sleep(1)

                    for x in range(30):
                        if m == '': break
                        if self.progressDialog.iscanceled(): return self.progressDialog.close()
                        if xbmc.abortRequested == True: return sys.exit()
                        if w.is_alive() == False: break
                        time.sleep(1)


                    if w.is_alive() == True: block = items[i]['source']

                    if self.url == None: raise Exception()

                    try: self.progressDialog.close()
                    except: pass

                    control.sleep(200)

                    if control.setting('playback_info') == 'true':
                        control.infoDialog(items[i]['label'], heading=name)

                    from resources.lib.lib.player import player
                    player().run(content, name, self.url, year, imdb, tvdb, meta)

                    return self.url
                except:
                    pass

            try: self.progressDialog.close()
            except: pass

            raise Exception()

        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
            pass
示例#6
0
            xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                        url=url,
                                        listitem=li)
        xbmcplugin.endOfDirectory(addon_handle)
    except Exception as e:
        control.log('ERROR TV:%s' % e)
        pass

elif mode[0] == 'play':
    try:
        title = args.get('name', None)[0]
        icon = args.get('poster', None)[0]
        id = args.get('id', None)[0]
        control.infoDialog(control.lang(30492).encode('utf-8'), time=500)
        u = wizja.getstream(id)

        liz = control.item(title, iconImage=icon, thumbnailImage=icon, path=u)
        liz.setInfo(type="video", infoLabels={"Title": title})
        xbmcPlayer = xbmc.Player()

        control.resolve(int(sys.argv[1]), True, liz)

        for i in range(0, 240):
            if xbmcPlayer.isPlayingVideo(): break
            xbmc.sleep(1000)
    except Exception as e:
        control.log('ERROR PLAY:%s' % e)

elif mode[0] == 'ustawienia':
    __addon__.openSettings()
示例#7
0
    def playItem(self, content, name, year, imdb, tvdb, source):
        try:
            control.resolve(int(sys.argv[1]), True, control.item(path=''))
            control.execute('Dialog.Close(okdialog)')

            next = []
            prev = []
            total = []
            meta = None

            for i in range(1, 10000):
                try:
                    u = control.infoLabel('ListItem(%s).FolderPath' % str(i))
                    if u in total: raise Exception()
                    total.append(u)
                    u = dict(urlparse.parse_qsl(u.replace('?', '')))
                    if 'meta' in u: meta = u['meta']
                    u = json.loads(u['source'])[0]
                    next.append(u)
                except:
                    break
            for i in range(-10000, 0)[::-1]:
                try:
                    u = control.infoLabel('ListItem(%s).FolderPath' % str(i))
                    if u in total: raise Exception()
                    total.append(u)
                    u = dict(urlparse.parse_qsl(u.replace('?', '')))
                    if 'meta' in u: meta = u['meta']
                    u = json.loads(u['source'])[0]
                    prev.append(u)
                except:
                    break

            items = json.loads(source)

            source, quality = items[0]['source'], items[0]['quality']
            items = [
                i for i in items + next + prev
                if i['quality'] == quality and i['source'] == source
            ][:10]
            items += [
                i for i in next + prev
                if i['quality'] == quality and not i['source'] == source
            ][:10]

            self.progressDialog = control.progressDialog
            self.progressDialog.create(control.addonInfo('name'), '')
            self.progressDialog.update(0)

            block = None

            for i in range(len(items)):
                try:
                    self.progressDialog.update(
                        int((100 / float(len(items))) * i),
                        str(items[i]['label']), str(' '))

                    if items[i]['source'] == block: raise Exception()

                    w = workers.Thread(self.sourcesResolve, items[i]['url'],
                                       items[i]['provider'])
                    w.start()

                    m = ''

                    for x in range(3600):
                        if self.progressDialog.iscanceled():
                            return self.progressDialog.close()
                        if xbmc.abortRequested == True: return sys.exit()
                        k = control.condVisibility(
                            'Window.IsActive(virtualkeyboard)')
                        if k:
                            m += '1'
                            m = m[-1]
                        if (w.is_alive() == False or x > 30) and not k: break
                        time.sleep(1)

                    for x in range(30):
                        if m == '': break
                        if self.progressDialog.iscanceled():
                            return self.progressDialog.close()
                        if xbmc.abortRequested == True: return sys.exit()
                        if w.is_alive() == False: break
                        time.sleep(1)

                    if w.is_alive() == True: block = items[i]['source']

                    if self.url == None: raise Exception()

                    try:
                        self.progressDialog.close()
                    except:
                        pass

                    control.sleep(200)

                    if control.setting('playback_info') == 'true':
                        control.infoDialog(items[i]['label'], heading=name)

                    from resources.lib.lib.player import player
                    player().run(content, name, self.url, year, imdb, tvdb,
                                 meta)

                    return self.url
                except:
                    pass

            try:
                self.progressDialog.close()
            except:
                pass

            raise Exception()

        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
            pass
示例#8
0
文件: addon.py 项目: rrosajp/filmkodi
            li.setProperty('IsPlayable', 'true')
            li.setArt({'fanart': control.addonFanart2()})
            xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=li)
        xbmcplugin.endOfDirectory(addon_handle)
    except Exception as e:
        control.log('ERROR TV:%s' % e )
        pass

elif mode[0] == 'play':
    try:
        title =args.get('name', None)[0]
        icon = args.get('poster', None)[0]
        id = args.get('id', None)[0]
        control.infoDialog(control.lang(30492).encode('utf-8'), time=500)
        u = wizja.getstream(id)

        liz = control.item(title, iconImage=icon, thumbnailImage=icon, path=u)
        liz.setInfo(type="video", infoLabels={"Title": title})
        xbmcPlayer = xbmc.Player()

        control.resolve(int(sys.argv[1]), True, liz)

        for i in range(0, 240):
            if xbmcPlayer.isPlayingVideo(): break
            xbmc.sleep(1000)
    except Exception as e:
        control.log('ERROR PLAY:%s' % e)

elif mode[0] == 'ustawienia':
    __addon__.openSettings()