Example #1
0
File: videos.py Project: mpie/repo
 def play(self, name, image, uri):
     try:
         from resources.lib.modules.player import player
         item = control.item(label=name, iconImage=image, thumbnailImage=image)
         player().play(uri, item)
     except:
         pass
Example #2
0
 def play(self, name, image, uri):
     try:
         from resources.lib.modules.player import player
         item = control.item(label=name,
                             iconImage=image,
                             thumbnailImage=image)
         player().play(uri, item)
     except:
         pass
Example #3
0
    def play(self, title, year, imdb, tvdb, season, episode, tvshowtitle,
             premiered, meta, url):
        try:
            if not control.addonInfo('id').lower() == control.infoLabel(
                    'Container.PluginName').lower():
                progress = True if control.setting(
                    'progress.dialog') == '1' else False
            else:
                control.resolve(int(sys.argv[1]), True, control.item(path=''))
                control.execute('Dialog.Close(okdialog)')
                progress = True

            if 'super.fav' in control.infoLabel('Container.PluginName'):
                return control.dialog.ok('Exodus',
                                         control.lang(30518).encode('utf-8'),
                                         '', '')

            self.sources = self.getSources(title,
                                           year,
                                           imdb,
                                           tvdb,
                                           season,
                                           episode,
                                           tvshowtitle,
                                           premiered,
                                           progress=progress)
            self.sources = self.sourcesFilter()

            if control.window.getProperty('PseudoTVRunning') == 'True':
                return control.resolve(
                    int(sys.argv[1]), True,
                    control.item(path=str(self.sourcesDirect(
                        progress=progress))))

            if self.sources == []: raise Exception()

            if url == 'direct://': url = self.sourcesDirect(progress=progress)
            elif url == 'dialog://':
                url = self.sourcesDialog(progress=progress)
            elif control.setting('autoplay') == 'false':
                url = self.sourcesDialog(progress=progress)
            else:
                url = self.sourcesDirect(progress=progress)

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

            control.sleep(200)

            if not tvshowtitle == None: title = tvshowtitle

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tvdb, meta, url)

            return url
        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
Example #4
0
    def play(self, title, year, imdb, tvdb, season, episode, tvshowtitle,
             premiered, meta, select):
        try:

            url = None

            control.moderator()

            items = self.getSources(title, year, imdb, tvdb, season, episode,
                                    tvshowtitle, premiered)

            select = control.setting(
                'hosts.mode') if select == None else select

            title = tvshowtitle if not tvshowtitle == None else title

            if control.window.getProperty('PseudoTVRunning') == 'True':
                return control.resolve(
                    int(sys.argv[1]), True,
                    control.item(path=str(self.sourcesDirect(items))))

            if len(items) > 0:

                if select == '1' and 'plugin' in control.infoLabel(
                        'Container.PluginName'):
                    control.window.clearProperty(self.itemProperty)
                    control.window.setProperty(self.itemProperty,
                                               json.dumps(items))

                    control.window.clearProperty(self.metaProperty)
                    control.window.setProperty(self.metaProperty, meta)

                    control.sleep(200)

                    return control.execute(
                        'Container.Update(%s?action=addItem&title=%s)' %
                        (sys.argv[0], urllib.quote_plus(title)))

                elif select == '0' or select == '1':
                    url = self.sourcesDialog(items)

                else:
                    url = self.sourcesDirect(items)

            if url == None:
                return self.errorForSources()

            try:
                meta = json.loads(meta)
            except:
                pass

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tvdb, url, meta)
        except:
            pass
Example #5
0
 def get_video(self, id, meta, image):
     query = base_url + video_link.decode('base64')
     clip = net.request(query % id, headers=self.addAuthenticationHeaders())
     clip = json.loads(clip)
     assets = clip['clips'][0].get('assets')
     if assets is not None and assets != []:
         streams = [i['full_physical_path'] for i in assets]
         from resources.lib.modules import player
         player.player().play(id, streams, image, meta)
     else:
         xbmcgui.Dialog().ok(u'Lej\u00E1tsz\u00E1s sikertelen.', freemium_subscription_needed_errormsg.decode('base64').decode('utf-8'))
         xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem())
Example #6
0
    def play(self, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select):
        try:
            sysloc = [urlparse.urlparse(sys.argv[0]).netloc, '', 'plugin.video.live.streamspro', 'plugin.video.tinklepad']

            sysplg = True if control.infoLabel('Container.PluginName') in sysloc else False

            syslib = False #True if '.strm' in str(control.infoLabel('ListItem.FileName')) else False

            items = self.getSources(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered)

            select = control.setting('hosts.mode') if select == None else select

            title = tvshowtitle if not tvshowtitle == None else title

            url = None


            if syslib == True or sysplg == False:
                items = []

            if control.window.getProperty('PseudoTVRunning') == 'True':
                return control.resolve(int(sys.argv[1]), True, control.item(path=str(self.sourcesDirect(items))))

            if len(items) > 0:

                if select == '1' and 'plugin' in control.infoLabel('Container.PluginName'):
                    control.window.clearProperty(self.itemProperty)
                    control.window.setProperty(self.itemProperty, json.dumps(items))

                    control.window.clearProperty(self.metaProperty)
                    control.window.setProperty(self.metaProperty, meta)

                    control.sleep(200)

                    return control.execute('Container.Update(%s?action=addItem&title=%s)' % (sys.argv[0], urllib.quote_plus(title.encode('utf-8'))))

                elif select == '0' or select == '1':
                    url = self.sourcesDialog(items)

                else:
                    url = self.sourcesDirect(items)


            if url == None:
                return self.errorForSources()

            meta = json.loads(meta)

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tvdb, url, meta)
        except:
            pass
Example #7
0
 def get_video(self, id, meta, image):
     headers = {
         'x-6play-freemium': '1',
         'x-auth-gigya-uid': xbmcaddon.Addon().getSetting('userid'),
         'x-auth-gigya-signature': xbmcaddon.Addon().getSetting('signature'),
         'x-auth-gigya-signature-timestamp': xbmcaddon.Addon().getSetting('s.timestamp'),
         'Origin': 'https://www.rtlmost.hu'}
     query = base_url + video_link.decode('base64')
     clip = net.request(query % id, headers=headers)
     clip = json.loads(clip)
     assets = clip['clips'][0].get('assets')
     streams = [i['full_physical_path'] for i in assets]
     from resources.lib.modules import player
     player.player().play(id, streams, image, meta)
Example #8
0
    def play(self, title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select):
        try:
            url = None

            control.moderator()

            items = self.getSources(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered)

            select = control.setting('hosts.mode') if select == None else select

            title = tvshowtitle if not tvshowtitle == None else title

            if control.window.getProperty('PseudoTVRunning') == 'True':
                return control.resolve(int(sys.argv[1]), True, control.item(path=str(self.sourcesDirect(items))))

            if len(items) > 0:

                if select == '1' and 'plugin' in control.infoLabel('Container.PluginName'):
                    control.window.clearProperty(self.itemProperty)
                    control.window.setProperty(self.itemProperty, json.dumps(items))

                    control.window.clearProperty(self.metaProperty)
                    control.window.setProperty(self.metaProperty, meta)

                    control.sleep(200)

                    return control.execute('Container.Update(%s?action=addItem&title=%s)' % (sys.argv[0], urllib.quote_plus(title)))

                elif select == '0' or select == '1':
                    url = self.sourcesDialog(items)

                else:
                    url = self.sourcesDirect(items)


            if url == None:
                return self.errorForSources()

            try: meta = json.loads(meta)
            except: pass

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tvdb, url, meta)
        except:
            pass
Example #9
0
 def liveChannel(self, channel):
     headers = {
         'x-6play-freemium': '1',
         'x-auth-gigya-uid': xbmcaddon.Addon().getSetting('userid'),
         'x-auth-gigya-signature': xbmcaddon.Addon().getSetting('signature'),
         'x-auth-gigya-signature-timestamp': xbmcaddon.Addon().getSetting('s.timestamp'),
         'Origin': 'https://www.rtlmost.hu'}
     query = base_url + live_stream_link.decode('base64')
     live = net.request(query % channel, headers=headers)
     live = json.loads(live)
     assets = live[channel][0]['live']['assets']
     if assets != []:
         streams = [i['full_physical_path'] for i in assets]
         meta = {'title': live[channel][0]['title']}
         from resources.lib.modules import player
         player.player().play(channel, streams, None, json.dumps(meta))
     else:
         xbmcgui.Dialog().ok(u'Lej\u00E1tsz\u00E1s sikertelen.', u'A hozz\u00E1f\u00E9r\u00E9shez RTL Most+ el\u0151fizet\u00E9s sz\u00FCks\u00E9ges.')
         xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem())
Example #10
0
    def play(self, name, url, image):
        html = client.request(url)
        data = json.loads(html)

        m3u8Url = data['playlist']

        if m3u8Url != "https://embed.kijk.nl/api/playlist/.m3u8":
            player.player().playLiveStream(name, data['playlist'], image)
            return

        # Try an older player
        videoId = data['vpakey']
        referer = self.oldEmbedUri % (videoId)
        mpdManifestUrl = referer + "?width=868&height=491"

        data = client.request(mpdManifestUrl, referer=referer)
        # First try to find an M3u8
        m3u8Urls = re.compile('https:[^"]+.m3u8', re.DOTALL).findall(data)
        for m3u8Url in m3u8Urls:
            player.player().playLiveStream(name, m3u8Url, image)
            return

        # Maybe the new bc player
        videoId = client.parseDOM(data, 'video', ret='data-video-id')[0]
        accountId = client.parseDOM(data, 'video', ret='data-account')[0]

        brightCoveUrl = self.bcPlaybackUrl % (accountId, videoId)
        print brightCoveUrl
        headers = {
            'Accept':
            'application/json;pk=BCpkADawqM3ve1c3k3HcmzaxBvD8lXCl89K7XEHiKutxZArg2c5RhwJHJANOwPwS_4o7UsC4RhIzXG8Y69mrwKCPlRkIxNgPQVY9qG78SJ1TJop4JoDDcgdsNrg',
            'DNT': 1,
            'Origin': 'https://embed.kijk.nl',
            'User-Agent': self.User_Agent
        }
        html = client.request(brightCoveUrl,
                              XHR=True,
                              headers=headers,
                              referer=referer)
        data = json.loads(html)

        streams = filter(lambda d: d["container"] == "M2TS", data["sources"])
        if streams:
            streamUrl = streams[0]["src"]
            player.player().playLiveStream(name, streamUrl, image)
            return

        # If all else fails. try the first one with a src
        for item in data['sources']:
            if 'src' in item:
                player.player().playLiveStream(name, item['src'], image)
                return
Example #11
0
    def directPlay(self, url, title, year, imdb, tvdb, season, episode,
                   tvshowtitle, premiered, meta, id):
        try:
            debug('PLAY ITEM:', title, id)

            title = tvshowtitle if not tvshowtitle == None else title

            if url == None or url == '' or url == '0':
                return self.errorForSources()

            try:
                meta = json.loads(meta)
            except:
                pass

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tvdb, url, meta,
                         id)
        except:
            pass
Example #12
0
    def play(self, title, year, imdb, tmdb, tvdb, season, episode, tvshowtitle, premiered, meta, url):
        try:
            if not control.addonInfo('id').lower() == control.infoLabel('Container.PluginName').lower():
                progress = True if control.setting('progress.dialog') == '1' else False
            else:
                control.resolve(int(sys.argv[1]), True, control.item(path=''))
                control.execute('Dialog.Close(okdialog)')
                progress = True

            if 'super.fav' in control.infoLabel('Container.PluginName'):
                return control.dialog.ok('Exodus', control.lang(30518).encode('utf-8'), '', '')

            self.sources = self.getSources(title, year, imdb, tmdb, tvdb, season, episode, tvshowtitle, premiered, progress=progress)
            self.sources = self.sourcesFilter()

            if control.window.getProperty('PseudoTVRunning') == 'True':
                return control.resolve(int(sys.argv[1]), True, control.item(path=str(self.sourcesDirect(progress=progress))))

            if self.sources == []: raise Exception()

            if url == 'direct://': url = self.sourcesDirect(progress=progress)
            elif url == 'dialog://': url = self.sourcesDialog(progress=progress)
            elif control.setting('autoplay') == 'false': url = self.sourcesDialog(progress=progress)
            else: url = self.sourcesDirect(progress=progress)

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

            control.sleep(200)

            if not tvshowtitle == None: title = tvshowtitle

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tmdb, tvdb, meta, url)

            return url
        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
Example #13
0
    def directPlay(self, url, title, year, imdb, tvdb, tmdb, season, episode,
                   tvshowtitle, premiered, meta, id):
        try:
            #print('PLAY ITEM', url, title, year, imdb, tvdb, tmdb, season, episode, tvshowtitle, premiered, meta, id)

            title = tvshowtitle if not tvshowtitle == None else title

            if url == None or url == '' or url == '0':
                return self.errorForSources()

            elif url == 'resolve':
                url = premiumize.getIDLink(id)
                if url == None: return self.errorForSources()

            try:
                meta = json.loads(meta)
            except:
                pass

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tvdb, tmdb, url,
                         meta, id)
        except:
            pass
Example #14
0
File: dutchtv.py Project: mpie/repo
    def play(self, name, url, image):
        html = client.request(url)
        data = json.loads(html)

        m3u8Url = data['playlist']

        if m3u8Url != "https://embed.kijk.nl/api/playlist/.m3u8":
            player.player().playLiveStream(name, data['playlist'], image)
            return

        # Try an older player
        videoId = data['vpakey']
        referer = self.oldEmbedUri % (videoId)
        mpdManifestUrl = referer + "?width=868&height=491"

        data = client.request(mpdManifestUrl, referer=referer)
        # First try to find an M3u8
        m3u8Urls = re.compile('https:[^"]+.m3u8', re.DOTALL).findall(data)
        for m3u8Url in m3u8Urls:
            player.player().playLiveStream(name, m3u8Url, image)
            return

        # Maybe the new bc player
        videoId = client.parseDOM(data, 'video', ret='data-video-id')[0]
        accountId = client.parseDOM(data, 'video', ret='data-account')[0]

        brightCoveUrl = self.bcPlaybackUrl % (accountId, videoId)
        print brightCoveUrl
        headers = {'Accept': 'application/json;pk=BCpkADawqM3ve1c3k3HcmzaxBvD8lXCl89K7XEHiKutxZArg2c5RhwJHJANOwPwS_4o7UsC4RhIzXG8Y69mrwKCPlRkIxNgPQVY9qG78SJ1TJop4JoDDcgdsNrg', 'DNT': 1, 'Origin': 'https://embed.kijk.nl', 'User-Agent': self.User_Agent}
        html = client.request(brightCoveUrl, XHR=True, headers=headers, referer=referer)
        data = json.loads(html)

        streams = filter(lambda d: d["container"] == "M2TS", data["sources"])
        if streams:
            streamUrl = streams[0]["src"]
            player.player().playLiveStream(name, streamUrl, image)
            return

        # If all else fails. try the first one with a src
        for item in data['sources']:
            if 'src' in item:
                player.player().playLiveStream(name, item['src'], image)
                return
Example #15
0
    def play(self, title, year, imdb, tvdb, season, episode, tvshowtitle,
             premiered, meta, select):
        try:
            sysloc = [
                urlparse.urlparse(sys.argv[0]).netloc, '',
                'plugin.video.live.streamspro', 'plugin.video.tinklepad'
            ]

            sysplg = True if control.infoLabel(
                'Container.PluginName') in sysloc else False

            syslib = True if '.strm' in str(
                control.infoLabel('ListItem.FileName')) else False

            items = self.getSources(title, year, imdb, tvdb, season, episode,
                                    tvshowtitle, premiered)

            select = control.setting(
                'hosts.mode') if select == None else select

            title = tvshowtitle if not tvshowtitle == None else title

            url = None

            if syslib == True or sysplg == False:
                items = []

            if control.window.getProperty('PseudoTVRunning') == 'True':
                return control.resolve(
                    int(sys.argv[1]), True,
                    control.item(path=str(self.sourcesDirect(items))))

            if len(items) > 0:

                if select == '1' and 'plugin' in control.infoLabel(
                        'Container.PluginName'):
                    control.window.clearProperty(self.itemProperty)
                    control.window.setProperty(self.itemProperty,
                                               json.dumps(items))

                    control.window.clearProperty(self.metaProperty)
                    control.window.setProperty(self.metaProperty, meta)

                    control.sleep(200)

                    return control.execute(
                        'Container.Update(%s?action=addItem&title=%s)' %
                        (sys.argv[0], urllib.quote_plus(
                            title.encode('utf-8'))))

                elif select == '0' or select == '1':
                    url = self.sourcesDialog(items)

                else:
                    url = self.sourcesDirect(items)

            if url == None:
                return self.errorForSources()

            meta = json.loads(meta)

            from resources.lib.modules.player import player
            player().run(title, year, season, episode, imdb, tvdb, url, meta)
        except:
            pass
    def onClick(self, controlID):

        if controlID in range(20500, 20510):

            listitem = self.getControl(controlID).getSelectedItem()

            videourl = None
            viewtype = None

            videourl = listitem.getProperty('videourl')
            viewtype = listitem.getProperty('viewtype')
            closedCaptionUrl = listitem.getProperty('closedCaptionUrl')

            if videourl:

                from resources.lib.modules.player import player

                try:

                    contMap = self.updates.get(20001, None)

                    if contMap:

                        pStart = contMap.get('startPosition', None)
                        pDuration = contMap.get('duration', None)
                        pAdd = contMap.get('add', None)

                        if pStart and pDuration and pAdd:

                            listitem.setProperty('pStart', str(pStart))
                            listitem.setProperty('pDuration', str(pDuration))
                            listitem.setProperty('pAdd', str(pAdd))

                            if closedCaptionUrl:
                                listitem.setSubtitles([closedCaptionUrl])

                            self.logger.debug(pAdd)

                except:
                    pass

                player().run(videourl, listitem)

            elif viewtype in SHOW_VIEWS:

                self.logger.debug(
                    "This is a show so we are launching the SHOW GUI")

                from resources.lib.gui.showgui import show
                #window = xbmcgui.Window(xbmcgui.getCurrentWindowId());
                xrfPath = listitem.getProperty('detailPath')
                xrfParam = listitem.getProperty('detailParams')

                self.logger.debug(xrfPath)
                self.logger.debug(xrfParam)

                if viewtype and viewtype == 'myqueue':
                    xrfPath = listitem.getProperty('detailPath')
                    xrfParam = listitem.getProperty('detailParams')

                else:
                    xrfPath = listitem.getProperty('path')
                    xrfParam = listitem.getProperty('params')

                show(self.landing_page, xrfPath, xrfParam)

            else:
                self.logger.error(viewtype)
                self.logger.error('No Url Found')

        elif controlID == 5004:
            self.login()

        elif controlID == 4002:
            import webbrowser

            webbrowser.open(
                'http://www.funimation.com/android-mobile/register?territory=%s'
                % funimationnow.getTerritory(),
                new=0,
                autoraise=True)

        elif controlID == 4004:

            self.createLoginSplash()

            self.getControl(500).setVisible(True)
            self.getControl(400).setVisible(False)

        elif controlID == 5000:

            self.getControl(400).setVisible(True)
            self.getControl(500).setVisible(False)

        elif controlID == 5004:

            self.getControl(400).setVisible(False)
            self.getControl(500).setVisible(False)
            self.getControl(401).setVisible(True)

        elif controlID in MENU_IDS:

            funimationnow.execute(self.menus[controlID])

        elif controlID in QUE_BTNS:
            #self.updateQueue(controlID, True);
            workers.DetailsThread(target=self.updateQueue,
                                  args=(
                                      controlID,
                                      True,
                                  )).start()

        elif controlID in SCREEN_NAV_BTNS:
            self.prepNavigation(controlID)

        elif controlID in SIDE_MENU:
            self.menuNavigation(controlID)
Example #17
0
elif action == 'updatefavorites':
    from resources.lib.modules import utils;

    utils.updatefavorites(params);


elif action == 'player':
    from resources.lib.modules import utils;
    
    showinfo = utils.gathermeta(params);

    if showinfo is not None:
        from resources.lib.modules.player import player;

        player().run(showinfo);

    
elif action == 'searchNavigator':
    from resources.lib.modules import control;
    from resources.lib.modules import utils;

    search_text = utils.implementsearch();

    if search_text is not None:

        #url = self.search_link + urllib.quote_plus(q)
        url = '%s?action=search&search=%s' % (sys.argv[0], search_text);
        control.execute('Container.Update(%s)' % url);

elif action == 'search':
Example #18
0
    def playItem(self, title, source):
        try:
            meta = control.window.getProperty(self.metaProperty)
            meta = json.loads(meta)

            year = meta['year'] if 'year' in meta else None
            season = meta['season'] if 'season' in meta else None
            episode = meta['episode'] if 'episode' in meta else None

            imdb = meta['imdb'] if 'imdb' in meta else None
            tvdb = meta['tvdb'] if 'tvdb' in meta else None

            next = [] ; prev = [] ; total = []

            for i in range(1,1000):
                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('?','')))
                    u = json.loads(u['source'])[0]
                    next.append(u)
                except:
                    break
            for i in range(-1000,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('?','')))
                    u = json.loads(u['source'])[0]
                    prev.append(u)
                except:
                    break

            items = json.loads(source)
            items = [i for i in items+next+prev][:20]

            header = control.addonInfo('name')
            header2 = header.upper()

            progressDialog = control.progressDialog if control.setting('progress.dialog') == '0' else control.progressDialogBG
            progressDialog.create(header, '')
            progressDialog.update(0)

            block = None

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

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

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

                    m = ''

                    for x in range(3600):
                        try:
                            if xbmc.abortRequested == True: return sys.exit()
                            if progressDialog.iscanceled(): return progressDialog.close()
                        except:
                            pass

                        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
                        k = control.condVisibility('Window.IsActive(yesnoDialog)')
                        if k: m += '1'; m = m[-1]
                        if (w.is_alive() == False or x > 30) and not k: break
                        time.sleep(0.5)


                    for x in range(30):
                        try:
                            if xbmc.abortRequested == True: return sys.exit()
                            if progressDialog.iscanceled(): return progressDialog.close()
                        except:
                            pass

                        if m == '': break
                        if w.is_alive() == False: break
                        time.sleep(0.5)


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

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

                    try: progressDialog.close()
                    except: pass

                    control.sleep(200)
                    control.execute('Dialog.Close(virtualkeyboard)')
                    control.execute('Dialog.Close(yesnoDialog)')

                    from resources.lib.modules.player import player
                    player().run(title, year, season, episode, imdb, tvdb, self.url, meta)

                    return self.url
                except:
                    pass

            try: progressDialog.close()
            except: pass

            self.errorForSources()
        except:
            pass
Example #19
0
query = params.get('query')

source = params.get('source')

content = params.get('content')
import json
if action == None:
	CATEGORIES()
if action == 'play':
	from resources.lib.modules.player import player

	meta = json.loads(meta)
	
	print ("PLAYER META", meta)
	player().run(name, url, meta)
	
	
#------------------------ FREEDOC -----------------------------
if action == 'freedoc':
    from resources.lib.sources import freedoc
    freedoc.source().get()

if action == 'freedoc_cat':
    from resources.lib.sources import freedoc
    freedoc.source().cat(url)

if action == 'freedoc_resolve':
    from resources.lib.sources import freedoc
    freedoc.source().resolve(url, name, iconimage, meta)
#------------------------  -----------------------------	
Example #20
0
elif action == 'tools_menu':

    utils.tools_menu()

elif action == 'openSettings':

    control.openSettings(query)

elif action == 'other_addon_settings':

    utils.other_addon_settings(query)

elif action in ['play', 'play_resolved', 'play_skipped']:

    player.player(url, params)

elif action == 'directory':

    player.directory_picker(url, argv=argv)

elif action == 'live_switcher':

    live.Indexer().switcher()

elif action == 'vod_switcher':

    gm.Indexer().vod_switcher(url)

elif action == 'papers_switcher':
Example #21
0
    navigator.navigator().thaiLiveTV()

elif action == 'thaiShows':
    from resources.lib.indexers import navigator

    navigator.navigator().thaiShows()

elif action == 'thaiShows2':
    from resources.lib.indexers import navigator

    navigator.navigator().thaiShows2()

elif action == 'playLiveTV':
    from resources.lib.modules import player

    player.player().playLiveStream(name, url, image)

elif action == 'playThaiLiveTV':
    from resources.lib.modules import player

    player.player().playLiveStream(name, url, image)

elif action == 'listShows':
    from resources.lib.indexers import thai

    thai.thai().listShows(catid, page)

elif action == 'listShows2':
    from resources.lib.indexers import thai2

    thai2.thai().listShows(catid, page, limit, channel)
image = params.get('image')
name = params.get('name')
title = params.get('title')
text = params.get('text')

########################################################################################################################

if action is None:

    radios.Indexer().stations()

########################################################################################################################

elif action == 'play':

    player(url)

elif action == 'description':

    info.description(text)

elif action == 'history':

    info.history(url)

elif action == 'info_cm':

    info.info_cm()

elif action == 'cache_clear':
Example #23
0
    def playItem(self, title, source):
        try:
            meta = control.window.getProperty(self.metaProperty)
            meta = json.loads(meta)

            year = meta['year'] if 'year' in meta else None
            season = meta['season'] if 'season' in meta else None
            episode = meta['episode'] if 'episode' in meta else None

            imdb = meta['imdb'] if 'imdb' in meta else None
            tvdb = meta['tvdb'] if 'tvdb' in meta else None

            next = []
            prev = []
            total = []

            for i in range(1, 1000):
                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('?', '')))
                    u = json.loads(u['source'])[0]
                    next.append(u)
                except:
                    break
            for i in range(-1000, 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('?', '')))
                    u = json.loads(u['source'])[0]
                    prev.append(u)
                except:
                    break

            items = json.loads(source)
            items = [i for i in items + next + prev][:40]

            header = control.addonInfo('name')
            header2 = header.upper()

            progressDialog = control.progressDialog if control.setting(
                'progress.dialog') == '0' else control.progressDialogBG
            progressDialog.create(header, '')
            progressDialog.update(0)

            block = None

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

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

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

                    offset = 60 * 2 if items[i].get(
                        'source') in self.hostcapDict else 0

                    m = ''

                    for x in range(3600):
                        try:
                            if xbmc.abortRequested == True: return sys.exit()
                            if progressDialog.iscanceled():
                                return progressDialog.close()
                        except:
                            pass

                        k = control.condVisibility(
                            'Window.IsActive(virtualkeyboard)')
                        if k:
                            m += '1'
                            m = m[-1]
                        if (w.is_alive() == False
                                or x > 30 + offset) and not k:
                            break
                        k = control.condVisibility(
                            'Window.IsActive(yesnoDialog)')
                        if k:
                            m += '1'
                            m = m[-1]
                        if (w.is_alive() == False
                                or x > 30 + offset) and not k:
                            break
                        time.sleep(0.5)

                    for x in range(30):
                        try:
                            if xbmc.abortRequested == True: return sys.exit()
                            if progressDialog.iscanceled():
                                return progressDialog.close()
                        except:
                            pass

                        if m == '': break
                        if w.is_alive() == False: break
                        time.sleep(0.5)

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

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

                    try:
                        progressDialog.close()
                    except:
                        pass

                    control.sleep(200)
                    control.execute('Dialog.Close(virtualkeyboard)')
                    control.execute('Dialog.Close(yesnoDialog)')

                    from resources.lib.modules.player import player
                    player().run(title, year, season, episode, imdb, tvdb,
                                 self.url, meta)

                    return self.url
                except:
                    pass

            try:
                progressDialog.close()
            except:
                pass

            self.errorForSources()
        except:
            pass
    def onClick(self, controlID):

        if controlID == MENU_BTN:
            self.close()

        elif controlID in NAV_BUTTONS:

            self.currentChoice = NAV_BUTTONS.index(controlID)
            self.setButtonStates()
            self.setSelectedContent()

        elif controlID in PANEL_LISTS:

            listitem = self.getControl(controlID).getSelectedItem()

            self.currentPanel = controlID
            self.currentIndex = self.getControl(
                controlID).getSelectedPosition()

            if self.isEmpty is False:

                if controlID == QUEUE_PANEL_LIST:

                    try:

                        from resources.lib.gui.showgui import show

                        xrfPath = listitem.getProperty('detailPath')
                        xrfParam = listitem.getProperty('detailParams')

                        show(self.landing_page, xrfPath, xrfParam)

                    except Exception as inst:
                        self.logger.error(inst)

                elif controlID == HISTORY_PANEL_LIST:

                    utils.lock()

                    path = listitem.getProperty('path')
                    params = listitem.getProperty('params')

                    sDetails = funimationnow.selection(path, params,
                                                       'episodeDesc',
                                                       self.currentValue, 0,
                                                       False)

                    if sDetails:

                        videourl = sDetails.get('videourl', None)
                        closedCaptionUrl = sDetails.get(
                            'closedCaptionUrl', None)

                        if videourl:

                            from resources.lib.modules.player import player

                            try:

                                contMap = self.contentMaps.get(
                                    self.currentValue).get('config')

                                if contMap:

                                    pStart = contMap.get(
                                        'startPosition', None)
                                    pDuration = contMap.get('duration', None)
                                    pAdd = contMap.get('add', None)

                                    if pStart and pDuration and pAdd:

                                        listitem.setProperty(
                                            'pStart', str(pStart))
                                        listitem.setProperty(
                                            'pDuration', str(pDuration))
                                        listitem.setProperty(
                                            'pAdd', str(pAdd))

                                        if closedCaptionUrl:
                                            listitem.setSubtitles(
                                                [closedCaptionUrl])

                            except:
                                pass

                            utils.unlock()

                            player().run(videourl, listitem)

                    utils.unlock()

        elif controlID in SIDE_MENU:
            self.menuNavigation(controlID)
Example #25
0
    def playItem(self, source):
        try:
            f = dict(urlparse.parse_qsl(control.infoLabel('Container.FolderPath').replace('?','')))

            meta = f['meta'] if 'meta' in f else None
            title = f['title'] if 'title' in f else None
            title = f['tvshowtitle'] if 'tvshowtitle' in f else title
            year = f['year'] if 'year' in f else None
            season = f['season'] if 'season' in f else None
            episode = f['episode'] if 'episode' in f else None
            imdb = f['imdb'] if 'imdb' in f else None
            tvdb = f['tvdb'] if 'tvdb' in f else None

            next = [] ; prev = [] ; total = []

            for i in range(1,1000):
                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('?','')))
                    u = json.loads(u['source'])[0]
                    next.append(u)
                except:
                    break
            for i in range(-1000,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('?','')))
                    u = json.loads(u['source'])[0]
                    prev.append(u)
                except:
                    break

            items = json.loads(source)
            items = [i for i in items+next+prev][:20]

            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])
                    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
                        k = control.condVisibility('Window.IsActive(yesnoDialog)')
                        if k: m += '1'; m = m[-1]
                        if (w.is_alive() == False or x > 30) and not k: break
                        time.sleep(0.5)

                    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(0.5)


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

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

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

                    control.sleep(200)
                    control.execute('Dialog.Close(virtualkeyboard)')
                    control.execute('Dialog.Close(yesnoDialog)')

                    from resources.lib.modules.player import player
                    player().run(title, year, season, episode, imdb, tvdb, meta, self.url)

                    return self.url
                except:
                    pass

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

            raise Exception()

        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
            pass
Example #26
0
elif action == 'tools_menu':
    from resources.lib.modules import helpers
    helpers.tools_menu()

elif action == 'openSettings':
    from tulip import control
    control.openSettings(query)

elif action == 'other_addon_settings':
    from resources.lib.modules import helpers
    helpers.other_addon_settings(query)

elif action in ['play', 'play_resolved']:
    from resources.lib.modules.player import player
    player(url, params, do_not_resolve=action == 'play_resolved')

elif action == 'play_m3u':
    from distutils.util import strtobool
    from resources.lib.modules.player import play_m3u
    play_m3u(url,
             title,
             randomize=True if query is None else bool(strtobool(query)))

elif action == 'directory':
    from resources.lib.modules.player import directory_picker
    directory_picker(url, argv=argv)

elif action == 'live_switcher':
    from resources.lib.indexers import live
    live.Indexer(argv=argv).switcher()
Example #27
0
    def playItem(self, source):
        try:
            f = dict(
                urlparse.parse_qsl(
                    control.infoLabel('Container.FolderPath').replace('?',
                                                                      '')))

            meta = f['meta'] if 'meta' in f else None
            title = f['title'] if 'title' in f else None
            title = f['tvshowtitle'] if 'tvshowtitle' in f else title
            year = f['year'] if 'year' in f else None
            season = f['season'] if 'season' in f else None
            episode = f['episode'] if 'episode' in f else None
            imdb = f['imdb'] if 'imdb' in f else None
            tvdb = f['tvdb'] if 'tvdb' in f else None

            next = []
            prev = []
            total = []

            for i in range(1, 1000):
                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('?', '')))
                    u = json.loads(u['source'])[0]
                    next.append(u)
                except:
                    break
            for i in range(-1000, 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('?', '')))
                    u = json.loads(u['source'])[0]
                    prev.append(u)
                except:
                    break

            items = json.loads(source)
            items = [i for i in items + next + prev][:20]

            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])
                    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(0.5)

                    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(0.5)

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

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

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

                    control.sleep(200)

                    from resources.lib.modules.player import player
                    player().run(title, year, season, episode, imdb, tvdb,
                                 meta, self.url)

                    return self.url
                except:
                    pass

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

            raise Exception()

        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
            pass
Example #28
0
        control.refresh()

elif action == 'updatefavorites':
    from resources.lib.modules import utils

    utils.updatefavorites(params)

elif action == 'player':
    from resources.lib.modules import utils

    showinfo = utils.gathermeta(params)

    if showinfo is not None:
        from resources.lib.modules.player import player

        player().run(showinfo)

elif action == 'searchNavigator':
    from resources.lib.modules import control
    from resources.lib.modules import utils

    search_text = utils.implementsearch()

    if search_text is not None:

        #url = self.search_link + urllib.quote_plus(q)
        url = '%s?action=search&search=%s' % (sys.argv[0], search_text)
        control.execute('Container.Update(%s)' % url)

elif action == 'search':
    from resources.lib.indexers import navigator