Example #1
0
def clear(table=None):
    try:
        control.idle()

        if table == None: table = ['rel_list', 'rel_lib']
        elif not type(table) == list: table = [table]

        yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')
        if not yes: return

        control.set_setting('telewizjada.token', '')
        control.set_setting('telewizjada.os', '')
        control.set_setting('telewizjada.ua', '')
        control.set_setting('telewizjada.browser', '')
        control.set_setting('telewizjada.device', '')
        control.set_setting('telewizjada.expire', '')
        control.set_setting('telewizjada.referer', '')
        control.set_setting('telewizjada.refreshcookie', '')
        control.set_setting('telewizjada.tokenExpireIn', '')
        control.set_setting('yoytv.sess', '')

        dbcon = database.connect(control.cacheFile)
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS %s" % t)
                dbcur.execute("VACUUM")
                dbcon.commit()
            except:
                pass

        control.infoDialog(control.lang(30402).encode('utf-8'))
    except:
        pass
Example #2
0
def login():
    #if getYoyCredentialsInfo() == False:
    #    raise Exception()
    try:
        params = {}
        url = 'http://yoy.tv/signin'
        client2._clean_cookies('http://yoy.tv/signin')

        result = client2.http_get(url)
        params['remember_me']='1'
        params['email'] = control.get_setting('yoytv.user')
        params['password'] = control.get_setting('yoytv.pass')
        params['_token']=client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0]
        result = client2.http_get(url, data=params)
        #control.set_setting('videostar.sess', result)'<a class="dropdown-toggle" href="http://yoy.tv/signout">Wyloguj się'
        #control.log('Resul %s' % result)
        if not 'http://yoy.tv/signout' in result:
            control.log('BBBBB LOGIN %s' % 'yoy.tv')
            control.infoDialog(control.lang(30484).encode('utf-8'))
        else:
            url = 'http://yoy.tv/user/settings'
            result = client2.http_get(url)
            premium = re.findall('Aktywne do: ([0-9 :-]+)',result)
            if len(premium)>0:
                #control.log('BBBBB LOGIN %s' % len(premium))
                control.log('CCCCC LOGIN %s' % premium)

                control.infoDialog(control.lang(30496) + premium[0].encode('utf-8') )

    except:
        pass
Example #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'))
Example #4
0
    def play(self, name, title, service, meta):
        syshandle = int(sys.argv[1])
        sysaddon = sys.argv[0]
        #control.log('xxx BBB3 %s | %s ' % (syshandle, sysaddon))

        #control.log('BBB1 %s %s %s %s' % (name, title, meta,service))


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

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

            url = self.sourcesDirect(service, meta)

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


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

        except:
            control.infoDialog(control.lang(30501).encode('utf-8'),time=4000)
Example #5
0
def login():
    try:
        if getItiviCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40006).encode('utf-8'), control.lang(30481).encode('utf-8'), '',
                                   'Itivi', control.lang(30483).encode('utf-8'),
                                   control.lang(30482).encode('utf-8')):
                control.openSettings('2.1')
            raise Exception()


        params = {}
        url = 'http://itivi.pl/include/login.php'
        params['log'] = control.get_setting('itivi.user')
        params['pwd'] = control.get_setting('itivi.pass')
        client2._clean_cookies(url)
        result = client2.http_get(url, data=params)
        myres = client.parseDOM(result,'div', attrs={'class': 'account_field_box'})[0]
        myres = client.parseDOM(myres,'font')
        premium = myres[0] + client.parseDOM(myres[1],'b')[0] + ' ' + control.lang(30493)
        control.infoDialog(premium.encode('utf-8'), time=200)
        return True

    except Exception as e:
        control.infoDialog(control.lang(30485).encode('utf-8'), time=400)
        control.log('Error itivi.login %s' % e)
        return True
Example #6
0
def login():
    try:
        if getItiviCredentialsInfo() == False:
            if control.yesnoDialog(
                    control.lang(40006).encode('utf-8'),
                    control.lang(30481).encode('utf-8'), '', 'Itivi',
                    control.lang(30483).encode('utf-8'),
                    control.lang(30482).encode('utf-8')):
                control.openSettings('2.1')
            raise Exception()

        params = {}
        #url = 'http://itivi.pl/include/login.php'
        #params['log'] = control.get_setting('itivi.user')
        #params['pwd'] = control.get_setting('itivi.pass')
        #client2._clean_cookies(url)
        #result = client2.http_get(url, data=params)
        #myres = client.parseDOM(result,'div', attrs={'class': 'account_field_box'})[0]
        #myres = client.parseDOM(myres,'font')
        #premium = myres[0] + client.parseDOM(myres[1],'b')[0] + ' ' + control.lang(30493)
        #control.infoDialog(premium.encode('utf-8'), time=200)
        return True

    except Exception as e:
        control.infoDialog(control.lang(30485).encode('utf-8'), time=400)
        control.log('Error itivi.login %s' % e)
        return True
Example #7
0
def addView(content):
    try:
        skin = control.skin
        skinPath = control.skinPath
        xml = os.path.join(skinPath,'addon.xml')
        file = control.openFile(xml)
        read = file.read().replace('\n','')
        file.close()
        try: src = re.compile('defaultresolution="(.+?)"').findall(read)[0]
        except: src = re.compile('<res.+?folder="(.+?)"').findall(read)[0]
        src = os.path.join(skinPath, src)
        src = os.path.join(src, 'MyVideoNav.xml')
        file = control.openFile(src)
        read = file.read().replace('\n','')
        file.close()
        views = re.compile('<views>(.+?)</views>').findall(read)[0]
        views = [int(x) for x in views.split(',')]
        for view in views:
            label = control.infoLabel('Control.GetLabel(%s)' % (view))
            if not (label == '' or label == None): break
        record = (skin, content, str(view))
        control.makeFile(control.dataPath)
        dbcon = database.connect(control.databaseFile)
        dbcur = dbcon.cursor()
        dbcur.execute("CREATE TABLE IF NOT EXISTS views (""skin TEXT, ""view_type TEXT, ""view_id TEXT, ""UNIQUE(skin, view_type)"");")
        dbcur.execute("DELETE FROM views WHERE skin = '%s' AND view_type = '%s'" % (record[0], record[1]))
        dbcur.execute("INSERT INTO views Values (?, ?, ?)", record)
        dbcon.commit()
        viewName = control.infoLabel('Container.Viewmode')

        control.infoDialog(control.lang(30491).encode('utf-8'), heading=viewName)
    except:
        return
Example #8
0
def getstream(id):
    try:
        pl_proxy = control.setting('pl_proxy')
        pl_proxy_port = control.setting('pl_proxy_port')


        url = 'https://api.videostar.pl/channels/get/%s?format_id=2' % id
        result = get(url,pl_proxy)
        control.log('Z %s' % result)
        result = json.loads(result)


        if result['status'] == 'ok':
            url = result['stream_channel']['url_base']
            result = client.request(url, headers=headers, cookie=control.get_setting('videostar.sess'), output='geturl')
            return result
        if result['status'] == 'error':
            if result['errors'][0]['code'] == 300:
                params = {'t':result['errors'][0]['data']['stream_token'] }
                res = get('/channels/close', headers=headers, cookie=control.get_setting('videostar.sess'), post=params)
                control.log('Z %s' % result)
                return getstream(id)

            else:
                control.infoDialog('%s' % result['errors'][0]['msg'].encode('utf-8'))
                control.dialog.ok(control.addonInfo('name'), result['errors'][0]['msg'].encode('utf-8'), '')

        raise Exception()
    except:
        #control.openSettings('6.1')
        control.log('ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ' )
Example #9
0
def login():
    #f getVideostarCredentialsInfo() == False:
    #    raise Exception()
    params = {}
    #control.set_setting('videostar.sess', '')
    params['login'] = control.get_setting('videostar.user')
    params['password'] = control.get_setting('videostar.pass')
    params['permanent'] = 1
    url = 'https://api-pilot.wp.pl/user/login'
    result = client.request(url, post=params, headers=headers, output='cookie')
    control.log('ResultC videostar.get %s' % result)
    if result == '':
        control.infoDialog('Unauthorized')
        return None

    control.set_setting('videostar.sess', result)
    control.sleep(500)
    url = 'https://api-pilot.wp.pl/invitations/limit'
    headers['cookie'] = result
    result2 = client.request(url, headers=headers)
    if 'error' in result2:
        result2 = json.loads(result2)
        control.log('EEEEEEEEEEEE Result videostar.get %s' %
                    result2['errors'][0]['msg'])
        control.infoDialog(result2['errors'][0]['msg'].encode('utf-8'))

    control.sleep(500)
    return result
Example #10
0
def getstream(id):
    try:

        if yoylogin():
            cookie = control.get_setting('yoytv.sess').strip()
            control.log('#####   cookie2: %s' % cookie)
            url = 'http://yoy.tv/channels/%s' % id
            result = client.request(url, cookie=cookie)

            if 'http://yoy.tv/accept/' in result:
                if 'true' == control.get_setting('xxxmode'):
                    control.log('EROTYK ')
                    u1 = client.parseDOM(result, 'form', ret='action')[0]
                    params = {}
                    params['_token'] = client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0]
                    control.log('params: %s' % params['_token'])
                    result = client.request(u1, data=params, cookie=cookie)
                else:
                    control.infoDialog(control.lang(30799).encode('utf-8') + ' ' +control.lang(30798).encode('utf-8'))
                    return None

            if '<title>Kup konto premium w portalu yoy.tv</title>' in result:
                control.infoDialog(control.lang(30485).encode('utf-8'))
                return None
            result1 = result
            try:
                myobj = client.parseDOM(result1, 'object', ret='data', attrs={'type': 'application/x-shockwave-flash'})[0].encode('utf-8')
                result = client.parseDOM(result1, 'param', ret='value', attrs={'name': 'FlashVars'})[0].encode('utf-8')
                control.log("YOY res: %s |%s| "  % (result,myobj))

                p = urlparse.parse_qs(result)
                #control.log('# %s' % query)
                control.log('# %s' % p)
                control.log('# %s' % p['fms'])
                control.log('# %s' % p['cid'])

                myurl = p['fms'][0] + '/' + p['cid'][0] + ' swfUrl=' + myobj + ' swfVfy=true tcUrl=' + p['fms'][
                    0] + '/_definst_ live=true timeout=15 pageUrl=' + url
                myurl = p['fms'][0] + '/' + p['cid'][0] + ' swfUrl=' + myobj + ' swfVfy=true live=true timeout=15 pageUrl=' + url

                #        ' swfVfy=true tcUrl=' + 'rtmp://'+myip+'/oyo/_definst_ live=true pageUrl=' + url
                control.log("########## TAB:%s" % myurl)
                return myurl

                #myurl = myurl.replace('oyo','yoy')
            except:
                pass
            result = re.compile('type: "application/x-mpegurl", src: "([^"]+)"').findall(result1)
            control.log("########## TAB:%s" % result)
            myurl = result[0]



            return myurl
        else:
            return None

    except Exception as e:
        control.log('Error yoy.getstream %s' % e)
        return None
Example #11
0
def getstream(id):
    try:
        pl_proxy = control.setting('pl_proxy')
        pl_proxy_port = control.setting('pl_proxy_port')

        url = 'https://api.videostar.pl/channels/get/%s?format_id=2' % id
        result = get(url, pl_proxy)
        control.log('Z %s' % result)
        result = json.loads(result)

        if result['status'] == 'ok':
            url = result['stream_channel']['url_base']
            result = client.request(
                url,
                headers=headers,
                cookie=control.get_setting('videostar.sess'),
                output='geturl')
            return result
        if result['status'] == 'error':
            control.infoDialog('%s' %
                               result['errors'][0]['msg'].encode('utf-8'))
            control.dialog.ok(control.addonInfo('name'),
                              result['errors'][0]['msg'].encode('utf-8'), '')

        raise Exception()
    except:
        #control.openSettings('6.1')
        control.log(
            'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
        )
Example #12
0
def getstream(id):
    login()
    try:
        url = 'http://yoy.tv/channels/%s' % id
        result = client2.http_get(url)
        #control.log('RES:%s'%result)

        if 'http://yoy.tv/accept/' in result:
            if 'true' == control.get_setting('xxxmode'):
                control.log('EROTYK ')
                u1 = client.parseDOM(result, 'form', ret='action')[0]
                params = {}
                params['_token'] = client.parseDOM(result,
                                                   'input',
                                                   ret='value',
                                                   attrs={'name': '_token'})[0]
                control.log('params: %s' % params['_token'])
                result = client2.http_get(u1, data=params)
            else:
                control.infoDialog(
                    control.lang(30799).encode('utf-8') + ' ' +
                    control.lang(30798).encode('utf-8'))
                return None

        if '<title>Kup konto premium w portalu yoy.tv</title>' in result:
            control.infoDialog(control.lang(30485).encode('utf-8'))
            return None

        #control.log('r %s' % result)
        result = client.parseDOM(result,
                                 'param',
                                 ret='value',
                                 attrs={'name':
                                        'FlashVars'})[0].encode('utf-8')
        lpi = result.index("s=") + result.index("=") * 3
        rpi = result.index("&", lpi) - result.index("d") * 2
        dp = []
        cp = result[lpi:rpi].split('.')
        for i, item in enumerate(cp):
            j = 2 ^ i ^ ((i ^ 3) >> 1)
            k = 255 - int(cp[j])
            dp.append(k)
        myip = '.'.join(map(str, dp))
        control.log(myip)
        result = dict(urlparse.parse_qsl(result))
        myplaypath = '%s?email=%s&secret=%s&hash=%s' % (
            result['cid'], result['email'], result['secret'], result['hash'])
        myurl = 'rtmp://'+myip + ' app=yoy/_definst_ playpath=' + myplaypath + ' swfUrl=http://yoy.tv/playerv3a.swf' \
                ' swfVfy=true tcUrl=' + 'rtmp://'+myip+'/yoy/_definst_ live=true pageUrl=' + url
        #control.log("########## TAB:%s" % myurl)

        return myurl

    except Exception as e:
        control.log('Error yoy.getstream %s' % e)
Example #13
0
File: yoy.py Project: undg/filmkodi
def yoylogin():
    if getYoyCredentialsInfo() == False:
        raise ValueError('Brak ustawienia logiun lub hasła ')
    try:

        params = {}
        url = 'http://yoy.tv/signin'
        result, headers, content, cookie = client.request(url,
                                                          output='extended')

        params['remember_me'] = '1'
        params['email'] = control.get_setting('yoytv.user')
        params['password'] = control.get_setting('yoytv.pass')
        params['_token'] = client.parseDOM(result,
                                           'input',
                                           ret='value',
                                           attrs={'name': '_token'})[0]
        result1, headers, content, cookie = client.request(url,
                                                           post=params,
                                                           cookie=cookie,
                                                           output='extended',
                                                           redirect=False)
        mycookies = re.findall('Set-Cookie: (.*?);', '%s' % content)
        cookie = ";".join(mycookies)
        control.set_setting('yoytv.sess', cookie)
        control.log('#####   cookie1: %s' % cookie)
        url = 'http://yoy.tv/'
        result = client.request(url, cookie=cookie)

        if not 'http://yoy.tv/signout' in result:
            control.log('BBBBB LOGIN %s' % 'yoy.tv')
            control.infoDialog(control.lang(30484).encode('utf-8'))
            control.dialog.ok(
                control.addonInfo('name') + ' - YOY TV',
                control.lang(30484).encode('utf-8'), '')
            control.openSettings('1.12')
            return False
        else:
            url = 'http://yoy.tv/user/settings'
            result = client.request(url, cookie=cookie)
            premium = re.findall('Aktywne do: ([0-9 :-]+)', result)
            if len(premium) > 0:
                control.log('CCCCC LOGIN %s' % premium)
                control.infoDialog(
                    control.lang(30496) + premium[0].encode('utf-8'))

            return True

    except Exception as e:
        control.log('Yoylogin ERROR %s' % e)
        return False
Example #14
0
def get(url, proxy='', retry=True):
    try:
        pl_proxy = control.setting('pl_proxy')
        pl_proxy_port = control.setting('pl_proxy_port')

        if getVideostarCredentialsInfo() == False:
            control.infoDialog('Enter credentials')
            if control.yesnoDialog(
                    control.lang(40001).encode('utf-8'),
                    control.lang(30481).encode('utf-8'), '', 'Trakt',
                    control.lang(30483).encode('utf-8'),
                    control.lang(30482).encode('utf-8')):
                control.openSettings('1.11')
            return None

        full_url = urlparse.urljoin('https://api-pilot.wp.pl', url)
        if proxy == '':
            result = client.request(
                full_url,
                headers=headers,
                cookie=control.get_setting('videostar.sess'))
        else:
            myproxy = pl_proxy
            if pl_proxy_port != '': myproxy = myproxy + ':' + pl_proxy_port

            myproxy_check = is_bad_proxy(myproxy)
            if not myproxy_check == '':
                control.dialog.ok(
                    control.addonInfo('name'),
                    control.lang(40013).encode('utf-8') + ' ' +
                    myproxy_check.encode('utf-8'), '')
                control.openSettings('0.11')
                return None

            result = client.request(
                full_url,
                headers=headers,
                cookie=control.get_setting('videostar.sess'),
                proxy=myproxy)

        r = json.loads(result)

        if (r['status'] == "error" or result == None) and retry:
            login()
            result = get(url, proxy, False)

        return result
    except Exception as e:
        control.log('Error videostar.get %s' % e)
        pass
Example #15
0
def login():
    #if getYoyCredentialsInfo() == False:
    #    raise Exception()
    try:
        params = {}
        url = 'http://wizja.tv/users/index.php'
        result = client2.http_get(url)
        params['login']='******'
        params['user_name'] = control.get_setting('wizja.user')
        params['user_password'] = control.get_setting('wizja.pass')
        result = client2.http_get(url, data=params)
        control.log('DATA %s' % result)
        if  'o..</font><br>' in result:
            control.log('CCCC LOGIN %s' % 'wizja.tv')
            control.infoDialog(control.lang(30486).encode('utf-8'),time=6000)
            raise Exception()
        elif 'Zalogowany jako :' in result:
            if '<font color=ff0000>Brak premium' in result:
                control.infoDialog(control.lang(30490).encode('utf-8'), time=6000)
                return True
            else:
                return True
        elif '<font color="#FF0000">Wpisa' in result:
            control.log('CCCC LOGIN %s' % 'wizja.tv')
            control.infoDialog(control.lang(30487).encode('utf-8'),time=6000)
        else:
            control.log('CCCC LOGIN %s' % 'wizja.tv')
            control.infoDialog(control.lang(30488).encode('utf-8'), time=6000)

        return False

    except Exception as e:
        control.log('Error wizja.login %s' % e)
Example #16
0
def login():
    #if getYoyCredentialsInfo() == False:
    #    raise Exception()
    try:
        params = {}
        url = 'http://wizja.tv/users/index.php'
        result = client2.http_get(url)
        params['login']='******'
        params['user_name'] = control.get_setting('wizja.user')
        params['user_password'] = control.get_setting('wizja.pass')
        result = client2.http_get(url, data=params)
        control.log('DATA %s' % result)
        if  'o..</font><br>' in result:
            control.log('CCCC LOGIN %s' % 'wizja.tv')
            control.infoDialog(control.lang(30486).encode('utf-8'),time=6000)
            raise Exception()
        elif 'Zalogowany jako :' in result:
            if '<font color=ff0000>Brak premium' in result:
                control.infoDialog(control.lang(30490).encode('utf-8'), time=6000)
                return True
            else:
                return True
        elif '<font color="#FF0000">Wpisa' in result:
            control.log('CCCC LOGIN %s' % 'wizja.tv')
            control.infoDialog(control.lang(30487).encode('utf-8'),time=6000)
        else:
            control.log('CCCC LOGIN %s' % 'wizja.tv')
            control.infoDialog(control.lang(30488).encode('utf-8'), time=6000)

        return False

    except Exception as e:
        control.log('Error wizja.login %s' % e)
Example #17
0
    def clearSources(self):
        try:
            control.idle()

            yes = control.yesnoDialog(control.lang(30510).encode('utf-8'), '', '')
            if not yes: return

            control.makeFile(control.dataPath)
            dbcon = database.connect(control.sourcescacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("DROP TABLE IF EXISTS rel_src")
            dbcur.execute("VACUUM")
            dbcon.commit()

            control.infoDialog(control.lang(30511).encode('utf-8'))
        except:
            pass
Example #18
0
    def clearSources(self):
        try:
            control.idle()

            yes = control.yesnoDialog(
                control.lang(30510).encode('utf-8'), '', '')
            if not yes: return

            control.makeFile(control.dataPath)
            dbcon = database.connect(control.sourcescacheFile)
            dbcur = dbcon.cursor()
            dbcur.execute("DROP TABLE IF EXISTS rel_src")
            dbcur.execute("VACUUM")
            dbcon.commit()

            control.infoDialog(control.lang(30511).encode('utf-8'))
        except:
            pass
Example #19
0
def getstream(id):
    login()
    try:
        url = 'http://yoy.tv/channels/%s' % id
        result = client2.http_get(url)
        if '<title>Kup konto premium w portalu yoy.tv</title>' in result:
            control.infoDialog(control.lang(30485).encode('utf-8'))
            return None

        #control.log('r %s' % result)
        result = client.parseDOM(result, 'param', ret='value', attrs={'name': 'FlashVars'})[0].encode('utf-8')
        result = dict(urlparse.parse_qsl(result))
        myplaypath='%s?email=%s&secret=%s&hash=%s' %(result['cid'],result['email'],result['secret'],result['hash'])
        myurl = result['fms'].replace('/yoy','')  + ' app=yoy/_definst_ playpath=' + myplaypath +' swfUrl=http://yoy.tv/playerv3a.swf' \
        ' swfVfy=true tcUrl='+result['fms']+'/_definst_ live=true pageUrl='+url
        return myurl

    except Exception as e:
        control.log('Error yoy.getstream %s' % e)
Example #20
0
def login():
    #if getYoyCredentialsInfo() == False:
    #    raise Exception()
    try:
        params = {}
        url = 'http://yoy.tv/signin'
        result = client2.http_get(url)
        params['remember_me']='1'
        params['email'] = control.get_setting('yoytv.user')
        params['password'] = control.get_setting('yoytv.pass')
        params['_token']=client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0]
        result = client2.http_get(url, data=params)
        #control.set_setting('videostar.sess', result)
        '<a class="dropdown-toggle" href="http://yoy.tv/signout">Wyloguj się'
        if not 'http://yoy.tv/signout' in result:
            control.log('BBBBB LOGIN %s' % 'yoy.tv')
            control.infoDialog(control.lang(30484).encode('utf-8'))
    except:
        pass
Example #21
0
def addView(content):
    try:
        skin = control.skin
        skinPath = control.skinPath
        xml = os.path.join(skinPath, 'addon.xml')
        file = control.openFile(xml)
        read = file.read().replace('\n', '')
        file.close()
        try:
            src = re.compile('defaultresolution="(.+?)"').findall(read)[0]
        except:
            src = re.compile('<res.+?folder="(.+?)"').findall(read)[0]
        src = os.path.join(skinPath, src)
        src = os.path.join(src, 'MyVideoNav.xml')
        file = control.openFile(src)
        read = file.read().replace('\n', '')
        file.close()
        views = re.compile('<views>(.+?)</views>').findall(read)[0]
        views = [int(x) for x in views.split(',')]
        for view in views:
            label = control.infoLabel('Control.GetLabel(%s)' % (view))
            if not (label == '' or label == None): break
        record = (skin, content, str(view))
        control.makeFile(control.dataPath)
        dbcon = database.connect(control.databaseFile)
        dbcur = dbcon.cursor()
        dbcur.execute("CREATE TABLE IF NOT EXISTS views ("
                      "skin TEXT, "
                      "view_type TEXT, "
                      "view_id TEXT, "
                      "UNIQUE(skin, view_type)"
                      ");")
        dbcur.execute(
            "DELETE FROM views WHERE skin = '%s' AND view_type = '%s'" %
            (record[0], record[1]))
        dbcur.execute("INSERT INTO views Values (?, ?, ?)", record)
        dbcon.commit()
        viewName = control.infoLabel('Container.Viewmode')

        control.infoDialog(control.lang(30491).encode('utf-8'),
                           heading=viewName)
    except:
        return
Example #22
0
def yoylogin():
    if getYoyCredentialsInfo() == False:
        raise ValueError('Brak ustawienia logiun lub hasła ')
    try:

        params = {}
        url = 'http://yoy.tv/signin'
        result, headers, content, cookie = client.request(url, output='extended')

        params['remember_me']='1'
        params['email'] = control.get_setting('yoytv.user')
        params['password'] = control.get_setting('yoytv.pass')
        params['_token']=client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0]
        result1, headers, content, cookie = client.request(url, post=params, cookie=cookie, output='extended', redirect=False)
        mycookies = re.findall('Set-Cookie: (.*?);', '%s' % content)
        cookie = ";".join(mycookies)
        control.set_setting('yoytv.sess', cookie)
        control.log('#####   cookie1: %s' % cookie)
        url = 'http://yoy.tv/'
        result = client.request(url, cookie=cookie)

        if not 'http://yoy.tv/signout' in result:
            control.log('BBBBB LOGIN %s' % 'yoy.tv')
            control.infoDialog(control.lang(30484).encode('utf-8'))
            control.dialog.ok(control.addonInfo('name') + ' - YOY TV', control.lang(30484).encode('utf-8'), '')
            control.openSettings('1.12')
            return False
        else:
            url = 'http://yoy.tv/user/settings'
            result = client.request(url, cookie=cookie)
            premium = re.findall('Aktywne do: ([0-9 :-]+)',result)
            if len(premium)>0:
                control.log('CCCCC LOGIN %s' % premium)
                control.infoDialog(control.lang(30496) + premium[0].encode('utf-8') )

            return True

    except Exception as e:
        control.log('Yoylogin ERROR %s' % e)
        return False
Example #23
0
def login():
    #if getYoyCredentialsInfo() == False:
    #    raise Exception()
    try:
        params = {}
        url = 'http://yoy.tv/signin'
        result = client2.http_get(url)
        params['remember_me']='1'
        params['email'] = control.get_setting('yoytv.user')
        params['password'] = control.get_setting('yoytv.pass')
        params['_token']=client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0]
        result = client2.http_get(url, data=params)
        #control.set_setting('videostar.sess', result)
        '<a class="dropdown-toggle" href="http://yoy.tv/signout">Wyloguj się'
        if not 'http://yoy.tv/signout' in result:
            control.log('BBBBB LOGIN %s' % 'yoy.tv')

            control.infoDialog(control.lang(30484).encode('utf-8'))


    except:
        pass
Example #24
0
def clear(table=None):
    try:
        control.idle()

        if table == None:
            table = ["rel_list", "rel_lib"]
        elif not type(table) == list:
            table = [table]

        yes = control.yesnoDialog(control.lang(30401).encode("utf-8"), "", "")
        if not yes:
            return

        control.set_setting("telewizjada.token", "")
        control.set_setting("telewizjada.os", "")
        control.set_setting("telewizjada.ua", "")
        control.set_setting("telewizjada.browser", "")
        control.set_setting("telewizjada.device", "")
        control.set_setting("telewizjada.expire", "")
        control.set_setting("telewizjada.referer", "")
        control.set_setting("telewizjada.refreshcookie", "")
        control.set_setting("telewizjada.tokenExpireIn", "")
        control.set_setting("yoytv.sess", "")

        dbcon = database.connect(control.cacheFile)
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS %s" % t)
                dbcur.execute("VACUUM")
                dbcon.commit()
            except:
                pass

        control.infoDialog(control.lang(30402).encode("utf-8"))
    except:
        pass
Example #25
0
def login():
    #f getVideostarCredentialsInfo() == False:
    #    raise Exception()
    params = {}
    #control.set_setting('videostar.sess', '')
    params['login'] = control.get_setting('videostar.user')
    params['password'] = control.get_setting('videostar.pass')
    params['permanent']=1
    url = 'https://api.videostar.pl/user/login'
    result = client.request(url, post=params, headers=headers, output='cookie')
    control.log('ResultC videostar.get %s' % result)

    control.set_setting('videostar.sess', result)
    url='https://api.videostar.pl/invitations/limit'
    headers['cookie']=result
    result2 = client.request(url, headers=headers)
    if 'error' in  result2:
        result2 = json.loads(result2)
        control.log('EEEEEEEEEEEE Result videostar.get %s' % result2['errors'][0]['msg'])
        control.infoDialog(result2['errors'][0]['msg'].encode('utf-8'))

    control.sleep(500)
    return result
Example #26
0
def clear(table=None):
    try:
        control.idle()

        if table == None: table = ['rel_list', 'rel_lib']
        elif not type(table) == list: table = [table]

        yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')
        if not yes: return

        dbcon = database.connect(control.cacheFile)
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS %s" % t)
                dbcur.execute("VACUUM")
                dbcon.commit()
            except:
                pass

        control.infoDialog(control.lang(30402).encode('utf-8'))
    except:
        pass
Example #27
0
def getstream(id):
    login()
    try:
        url = 'http://yoy.tv/channels/%s' % id
        result = client2.http_get(url)
        if '<title>Kup konto premium w portalu yoy.tv</title>' in result:
            control.infoDialog(control.lang(30485).encode('utf-8'))
            return None

        #control.log('r %s' % result)
        result = client.parseDOM(result,
                                 'param',
                                 ret='value',
                                 attrs={'name':
                                        'FlashVars'})[0].encode('utf-8')
        result = dict(urlparse.parse_qsl(result))
        myplaypath = '%s?email=%s&secret=%s&hash=%s' % (
            result['cid'], result['email'], result['secret'], result['hash'])
        myurl = result['fms'].replace('/yoy','')  + ' app=yoy/_definst_ playpath=' + myplaypath +' swfUrl=http://yoy.tv/playerv3a.swf' \
        ' swfVfy=true tcUrl='+result['fms']+'/_definst_ live=true pageUrl='+url
        return myurl

    except Exception as e:
        control.log('Error yoy.getstream %s' % e)
Example #28
0
def clear(table=None):
    try:
        control.idle()

        if table == None: table = ['rel_list', 'rel_lib']
        elif not type(table) == list: table = [table]

        yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')
        if not yes: return

        dbcon = database.connect(control.cacheFile)
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS %s" % t)
                dbcur.execute("VACUUM")
                dbcon.commit()
            except:
                pass

        control.infoDialog(control.lang(30402).encode('utf-8'))
    except:
        pass
Example #29
0
def login():
    try:
        client2._clean_cookies('http://wizja.tv/users/index.php')
        control.sleep(300)
        params = {}
        url = 'http://wizja.tv/users/index.php'
        result = client2.http_get(url)
        params['login'] = '******'
        params['user_name'] = control.get_setting('wizja.user')
        params['user_password'] = control.get_setting('wizja.pass')
        result = client2.http_get(url, data=params)
        control.sleep(300)
        #control.log('DATA %s' % result)
        if 'o..</font><br>' in result:  #zly login
            control.log('WIZJA.TV ZLY LOGIN: %s' % result)
            control.infoDialog(control.lang(30486).encode('utf-8'), time=6000)
            raise Exception()
        elif 'Zalogowany jako :' in result:
            if '<font color=ff0000>Brak premium' in result:
                control.log('WIZJA.TV BRAK PREMIUM: %s' % result)
                control.infoDialog(control.lang(30490).encode('utf-8'),
                                   time=6000)
                raise Exception('NO premium')
            else:
                return True
        elif '<font color="#FF0000">Wpisa' in result:
            control.log(
                'WIZJA.TV zbyt wiele razy pobowales - poczekaj 60 minut: %s' %
                result)
            control.infoDialog(control.lang(30487).encode('utf-8'), time=6000)
            raise Exception('zbyt wiele razy pobowales - poczekaj 60 minut')
        else:
            control.log('WIZJA.TV inny blad: %s' % result)
            control.infoDialog(control.lang(30488).encode('utf-8'), time=6000)
            raise Exception('Inny bład: ' + result)
        return False

    except Exception as e:
        control.log('Error wizja.login %s' % e)
        return False
Example #30
0
    def sourcesDirect(self, service, meta):
        u = None
        meta = json.loads(meta)
        #control.log('ZZZZ: %s' % service)

        if service == 'itivi':
            try:
                control.infoDialog(control.lang(30493).encode('utf-8'),
                                   time=1500)
                u = itivi.getstream(meta['id'])
            except:
                pass
        if service == 'eskago':
            try:
                u = meta['id']
            except:
                pass
        if service == 'pierwsza':
            try:
                control.infoDialog(control.lang(30489).encode('utf-8'),
                                   time=500)
                u = pierwsza.getstream(meta['id'])
            except:
                pass
        if service == 'videostar':
            try:
                u = videostar.getstream(meta['id'])
            except:
                pass
        if service == 'yoy':
            try:
                u = yoy.getstream(meta['id'])
            except:
                pass
        if service == 'weeb':
            try:
                u = weeb.getstream(meta['id'])
            except:
                pass
        if service == 'wizja':
            try:
                control.infoDialog(control.lang(30492).encode('utf-8'),
                                   time=500)
                u = wizja.getstream(meta['id'])
            except:
                pass
        #control.log('XYZ: %s' % u)

        return u
Example #31
0
def login():
    try:
        #clean cookies
        client2._clean_cookies('http://wizja.tv/users/index.php')
        control.sleep(300)
        params = {}
        url = 'http://wizja.tv/users/index.php'
        result = client2.http_get(url)
        params['login'] = '******'
        params['user_name'] = control.get_setting('wizja.user')
        params['user_password'] = control.get_setting('wizja.pass')

        #login to site
        result = client2.http_get(url, data=params)
        control.sleep(300)
        control.log('WIZJA %s' % result)

        #wrong login
        if '<font color="#FF0000">Błędne hasło..</font>' in result:  #zly login
            control.log('WIZJA.TV ZLY LOGIN: %s' % result)
            control.infoDialog(control.lang(30497).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - WIZJA TV',
                control.lang(30497).encode('utf-8'), '')

            raise Exception()
        elif 'lub hasło.</font>' in result:  #zly login
            control.log('WIZJA.TV ZLY LOGIN: %s' % result)
            control.infoDialog(control.lang(30486).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - WIZJA TV',
                control.lang(30486).encode('utf-8'), '')

            raise Exception()

        elif 'Zalogowany jako :' in result:
            #no premium
            if '<font color=ff0000>Brak premium' in result:
                control.log('WIZJA.TV BRAK PREMIUM: %s' % result)
                control.infoDialog(control.lang(30490).encode('utf-8'),
                                   time=6000)
                control.dialog.ok(
                    control.addonInfo('name') + ' - WIZJA TV',
                    control.lang(30490).encode('utf-8'), '')

                raise Exception('NO premium')
            else:
                #all ok, return True
                return True
        #account locked - wait 60 minutes
        elif '<font color="#FF0000">Wpisa' in result:
            control.log(
                'WIZJA.TV zbyt wiele razy pobowales - poczekaj 60 minut: %s' %
                result)
            control.infoDialog(control.lang(30487).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - WIZJA TV',
                control.lang(30487).encode('utf-8'), '')

            raise Exception('zbyt wiele razy pobowales - poczekaj 60 minut')
        #Other error
        else:
            control.log('WIZJA.TV inny blad: %s' % result)
            control.infoDialog(control.lang(30488).encode('utf-8'), time=6000)
            raise Exception('Inny bład: ' + result)
        return False

    except Exception as e:
        control.log('Error wizja.login %s' % e)
        return False
Example #32
0
def login():
    try:
        if getTelewizjadaCredentialsInfo() == False:
            if control.yesnoDialog(
                    control.lang(40003).encode('utf-8'),
                    control.lang(30481).encode('utf-8'), '', 'Trakt',
                    control.lang(30483).encode('utf-8'),
                    control.lang(30482).encode('utf-8')):
                control.set_setting('telewizjada.user', '')
                control.set_setting('telewizjada.password', '')
                control.openSettings('1.20')
        control.log('>>>>  LOGIN()')

        expire = control.get_setting('telewizjada.expire')
        control.log('Expire1: %s' % expire)

        if expire != '':
            try:
                from datetime import datetime
                #d = datetime.strptime(expire, '%Y-%m-%d %H:%M:%S')
                d = datetime(
                    *(time.strptime(expire, '%Y-%m-%d %H:%M:%S')[0:6]))
                control.log('Expire2: %s' % d)

                d2 = datetime.now()
                if d > d2:
                    control.log('Expire OK: %s %s' % (d, d2))
                    return True
            except:
                pass

        url = 'http://www.deltamediaplayer.com/index.php?option=com_users&view=login&Itemid=116'
        result, h1, content, cookie1 = client.request(url, output='extended')
        headers = {'referer': url}
        result = client.parseDOM(result, 'div', attrs={'class': 'login'})[0]
        result = re.findall(
            '<input type="hidden" name="([^"]+)" value="([^"]+)"', result)
        params = {
            'username': control.get_setting('telewizjada.user'),
            'password': control.get_setting('telewizjada.pass'),
            'remember': 'yes',
            str(result[0][0]): urllib.quote(str(result[0][1])),
            str(result[1][0]): urllib.quote(str(result[1][1]))
        }
        paramslog = {
            'username': control.get_setting('telewizjada.user'),
            'password': '',
            'remember': 'yes',
            str(result[0][0]): urllib.quote(str(result[0][1])),
            str(result[1][0]): urllib.quote(str(result[1][1]))
        }
        control.log('>>>>  PARAMS %s' % (paramslog))

        url = 'http://www.deltamediaplayer.com/index.php?option=com_users&task=user.login'

        result, h2, content, cookie2 = client.request(url,
                                                      redirect=False,
                                                      post=params,
                                                      headers=headers,
                                                      cookie=cookie1,
                                                      output='extended')

        if content[
                'Location'] != 'https://www.deltamediaplayer.com/index.php?option=com_users&view=profile':
            control.infoDialog(control.lang(30600).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - Telewizzjada.net',
                control.lang(30600).encode('utf-8'), '')
            raise ValueError('Bledny login lub haslo.')

        url = 'http://www.deltamediaplayer.com/playercode/authorised/gethlsusers.php'
        headers[
            'referer'] = 'http://www.deltamediaplayer.com/index.php?option=com_acctexp&view=user&layout=subscriptiondetails&Itemid=119'
        headers['X-Requested-With'] = 'XMLHttpRequest'
        headers['Content-Type'] = 'application/json'
        headers['cookie'] = '%s; %s' % (cookie1,
                                        content['Set-Cookie'].split(';')[0])
        params2 = json.dumps({'browser': 'Desktop;Windows;Chrome 54'})
        result = client.request(url, post=params2, headers=headers)
        control.log('>>>>  RES r:%s ' % (result))

        r = json.loads(result)

        result = [i for i in r if i['registered'] != 0]

        if len(result) > 0:
            for i in result:
                control.log('I %s' % i)

            control.log('QQQQQQQQQQQQQQ %s' % r[0]['hash'], )
            control.set_setting('telewizjada.token', r[0]['hash'])
            control.set_setting('telewizjada.os', r[0]['os'])
            control.set_setting('telewizjada.browser', r[0]['browser'])
            control.set_setting('telewizjada.device', r[0]['device'])
            control.log("Brovser: %s" % r[0]['browser'].split(' ')[0])
            ua = 'Mozilla/5.0 (%s; %s; rv:%s) Gecko/20100101 %s/%s' % (
                r[0]['os'], r[0]['device'], r[0]['browser'].split(' ')[-1],
                r[0]['browser'].split(' ')[0], r[0]['browser'].split(' ')[-1])
            control.log('UA %s' % ua)
            control.set_setting('telewizjada.ua', ua)
            return True

        else:
            control.infoDialog(control.lang(30601).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - Telewizzjada.net',
                control.lang(30601).encode('utf-8'), '')
            raise ValueError('Brak zarejestrowanych przeglądarek.')
        return False

    except Exception as e:
        control.log('Exception telewizjada.net login %s' % e)
        return False
Example #33
0
    def sourcesDirect(self,service, meta):
        u=None
        meta = json.loads(meta)
        #control.log('ZZZZ: %s' % service)

        if service == 'ipla':
            try:
                #control.infoDialog(control.lang(30493).encode('utf-8'), time=1000)
                u = ipla.getstream(meta['id'])
            except:
                pass

        if service == 'itivi':
            try:
                #control.infoDialog(control.lang(30493).encode('utf-8'), time=1000)
                u = itivi.getstream(meta['id'])
            except:
                pass
        if service == 'looknij':
            try:
                u = looknij.getstream(meta['id'])

            except:
                pass

        if service == 'eskago':
            try:
                u = meta['id']
            except:
                pass
        if service == 'telewizjadanet':
            try:
                control.infoDialog(control.lang(30498).encode('utf-8'), time=500)
                u = telewizjadanet.getstream(meta['id'])
            except:
                pass
        if service == 'videostar':
            try:
                control.infoDialog(control.lang(30494).encode('utf-8'), time=500)
                u = videostar.getstream(meta['id'])
            except:
                pass
        if service == 'yoy':
            try:
                u = yoy.getstream(meta['id'])
            except:
                pass
        if service == 'weeb':
            try:
                u = weeb.getstream(meta['id'])
            except:
                pass
        if service == 'wizja':
            try:
                control.infoDialog(control.lang(30492).encode('utf-8'), time=500)
                u = wizja.getstream(meta['id'])
            except:
                pass
        if service == 'pierwsza':
            try:
                control.infoDialog(control.lang(30489).encode('utf-8'), time=500)
                u = pierwsza.getstream(meta['id'])
            except:
                pass

        #control.log('XYZ: %s' % u)

        return u
Example #34
0
    def addItem(self, name, title, year, imdb, tmdb, tvdb, service, season, episode, tvshowtitle, alter, date, meta):
        try:
            if imdb == '0': imdb = '0000000'
            imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

            content = 'movie' if tvshowtitle == None else 'episode'

            self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb, service, season, episode, tvshowtitle, alter, date)
            if self.sources == []: raise Exception()
            self.progressDialog = control.progressDialog
            self.progressDialog.create(control.addonInfo('name'), '')
            self.progressDialog.update(0, control.lang(30515).encode('utf-8'), str(' '))

            self.sources = self.sourcesFilter()
            infoMenu = control.lang(30502).encode('utf-8') if content == 'movie' else control.lang(30503).encode('utf-8')

            sysmeta = urllib.quote_plus(meta)
            sysaddon = sys.argv[0]

            meta = json.loads(meta)

            poster = meta['poster'] if 'poster' in meta else '0'
            banner = meta['banner'] if 'banner' in meta else '0'
            thumb = meta['thumb'] if 'thumb' in meta else poster
            fanart = meta['fanart'] if 'fanart' in meta else '0'

            if poster == '0': poster = control.addonPoster()
            if banner == '0' and poster == '0': banner = control.addonBanner()
            elif banner == '0': banner = poster
            if thumb == '0' and fanart == '0': thumb = control.addonFanart()
            elif thumb == '0': thumb = fanart
            if control.setting('fanart') == 'true' and not fanart == '0': pass
            else: fanart = control.addonFanart()

            for i in range(len(self.sources)):
                try:
                    if self.progressDialog.iscanceled(): break

                    self.progressDialog.update(int((100 / float(len(self.sources))) * i))
                    url, label, provider = self.sources[i]['url'], self.sources[i]['label'], self.sources[i]['provider']


                    sysname, sysurl, sysimage, sysprovider = urllib.quote_plus(name), urllib.quote_plus(url), urllib.quote_plus(poster), urllib.quote_plus(provider)

                    syssource = urllib.quote_plus(json.dumps([self.sources[i]]))
                    if i == 0:
                        query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s&meta=%s' % (content, sysname, year, imdb, tvdb, syssource, sysmeta)
                    else:
                        query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s' % (content, sysname, year, imdb, tvdb, syssource)

                    cm = []
                    cm.append((control.lang(30504).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))
                    cm.append((control.lang(30505).encode('utf-8'), 'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&provider=%s)' % (sysaddon, sysname, sysimage, sysurl, sysprovider)))
                    cm.append((infoMenu, 'Action(Info)'))
                    cm.append((control.lang(30506).encode('utf-8'), 'RunPlugin(%s?action=refresh)' % sysaddon))
                    cm.append((control.lang(30507).encode('utf-8'), 'RunPlugin(%s?action=openSettings)' % sysaddon))
                    cm.append((control.lang(30508).encode('utf-8'), 'RunPlugin(%s?action=openPlaylist)' % sysaddon))

                    item = control.item(label=label, iconImage='DefaultVideo.png', thumbnailImage=thumb)
                    try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                    except: pass
                    item.setInfo(type='Video', infoLabels = meta)
                    if not fanart == None: item.setProperty('Fanart_Image', fanart)
                    item.setProperty('Video', 'true')
                    #item.setProperty('IsPlayable', 'true')
                    item.addContextMenuItems(cm, replaceItems=True)

                    control.addItem(handle=int(sys.argv[1]), url='%s?%s' % (sysaddon, query), listitem=item, isFolder=False)
                except:
                    pass

            control.directory(int(sys.argv[1]), cacheToDisc=True)
            try: self.progressDialog.close()
            except: pass
        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
            try: self.progressDialog.close()
            except: pass
Example #35
0
    def addItem(self, name, title, year, imdb, tmdb, tvdb, service, season,
                episode, tvshowtitle, alter, date, meta):
        try:
            if imdb == '0': imdb = '0000000'
            imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))

            content = 'movie' if tvshowtitle == None else 'episode'

            self.sources = self.getSources(name, title, year, imdb, tmdb, tvdb,
                                           service, season, episode,
                                           tvshowtitle, alter, date)
            if self.sources == []: raise Exception()
            self.progressDialog = control.progressDialog
            self.progressDialog.create(control.addonInfo('name'), '')
            self.progressDialog.update(0,
                                       control.lang(30515).encode('utf-8'),
                                       str(' '))

            self.sources = self.sourcesFilter()
            infoMenu = control.lang(30502).encode(
                'utf-8') if content == 'movie' else control.lang(30503).encode(
                    'utf-8')

            sysmeta = urllib.quote_plus(meta)
            sysaddon = sys.argv[0]

            meta = json.loads(meta)

            poster = meta['poster'] if 'poster' in meta else '0'
            banner = meta['banner'] if 'banner' in meta else '0'
            thumb = meta['thumb'] if 'thumb' in meta else poster
            fanart = meta['fanart'] if 'fanart' in meta else '0'

            if poster == '0': poster = control.addonPoster()
            if banner == '0' and poster == '0': banner = control.addonBanner()
            elif banner == '0': banner = poster
            if thumb == '0' and fanart == '0': thumb = control.addonFanart()
            elif thumb == '0': thumb = fanart
            if control.setting('fanart') == 'true' and not fanart == '0': pass
            else: fanart = control.addonFanart()

            for i in range(len(self.sources)):
                try:
                    if self.progressDialog.iscanceled(): break

                    self.progressDialog.update(
                        int((100 / float(len(self.sources))) * i))
                    url, label, provider = self.sources[i][
                        'url'], self.sources[i]['label'], self.sources[i][
                            'provider']

                    sysname, sysurl, sysimage, sysprovider = urllib.quote_plus(
                        name), urllib.quote_plus(url), urllib.quote_plus(
                            poster), urllib.quote_plus(provider)

                    syssource = urllib.quote_plus(json.dumps([self.sources[i]
                                                              ]))
                    if i == 0:
                        query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s&meta=%s' % (
                            content, sysname, year, imdb, tvdb, syssource,
                            sysmeta)
                    else:
                        query = 'action=playItem&content=%s&name=%s&year=%s&imdb=%s&tvdb=%s&source=%s' % (
                            content, sysname, year, imdb, tvdb, syssource)

                    cm = []
                    cm.append((control.lang(30504).encode('utf-8'),
                               'RunPlugin(%s?action=queueItem)' % sysaddon))
                    cm.append((
                        control.lang(30505).encode('utf-8'),
                        'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&provider=%s)'
                        % (sysaddon, sysname, sysimage, sysurl, sysprovider)))
                    cm.append((infoMenu, 'Action(Info)'))
                    cm.append((control.lang(30506).encode('utf-8'),
                               'RunPlugin(%s?action=refresh)' % sysaddon))
                    cm.append((control.lang(30507).encode('utf-8'),
                               'RunPlugin(%s?action=openSettings)' % sysaddon))
                    cm.append((control.lang(30508).encode('utf-8'),
                               'RunPlugin(%s?action=openPlaylist)' % sysaddon))

                    item = control.item(label=label,
                                        iconImage='DefaultVideo.png',
                                        thumbnailImage=thumb)
                    try:
                        item.setArt({
                            'poster': poster,
                            'tvshow.poster': poster,
                            'season.poster': poster,
                            'banner': banner,
                            'tvshow.banner': banner,
                            'season.banner': banner
                        })
                    except:
                        pass
                    item.setInfo(type='Video', infoLabels=meta)
                    if not fanart == None:
                        item.setProperty('Fanart_Image', fanart)
                    item.setProperty('Video', 'true')
                    #item.setProperty('IsPlayable', 'true')
                    item.addContextMenuItems(cm, replaceItems=True)

                    control.addItem(handle=int(sys.argv[1]),
                                    url='%s?%s' % (sysaddon, query),
                                    listitem=item,
                                    isFolder=False)
                except:
                    pass

            control.directory(int(sys.argv[1]), cacheToDisc=True)
            try:
                self.progressDialog.close()
            except:
                pass
        except:
            control.infoDialog(control.lang(30501).encode('utf-8'))
            try:
                self.progressDialog.close()
            except:
                pass
Example #36
0
def wizjalogin():
    try:
        params = {}
        url = 'http://wizja.tv/users/index.php'
        #result, headers, content, cookie = client.request(url, output='extended')

        params['login']='******'
        params['user_name'] = control.get_setting('wizja.user')
        params['user_password'] = control.get_setting('wizja.pass')

        #login to site
        result, headers, content, cookie = client.request(url, post=params, headers=HOST, output='extended')
        control.set_setting('wizja.token', cookie)

        #wrong login
        if  '<font color="#FF0000">Błędne hasło..</font>' in result: #zly login
            control.log('WIZJA.TV ZLY LOGIN: %s' % result)
            control.infoDialog(control.lang(30497).encode('utf-8'),time=6000)
            control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV',control.lang(30497).encode('utf-8'), '')
            raise Exception()
        elif  'lub hasło.</font>' in result: #zly login
            control.log('WIZJA.TV ZLY LOGIN: %s' % result)
            control.infoDialog(control.lang(30486).encode('utf-8'),time=6000)
            control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV',control.lang(30486).encode('utf-8'), '')

            raise Exception()

        elif 'Zalogowany jako :' in result:
            #no premium
            if '<font color=ff0000>Brak premium' in result:
                control.log('WIZJA.TV BRAK PREMIUM: %s' % result)
                control.infoDialog(control.lang(30490).encode('utf-8'), time=6000)
                control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV', control.lang(30490).encode('utf-8'), '')

                raise Exception('NO premium')
            else:
                try:
                    premium = re.findall('Premium aktywne do (\d{4}.*?)</font>', result)[0]
                    control.set_setting('wizja.expire', premium)
                    control.infoDialog('Premium Wizja.tv do: '+ premium.encode('utf-8'), time=2000)
                except:
                    pass
                return True, cookie
        #account locked - wait 60 minutes
        elif '<font color="#FF0000">Wpisa' in result:
            control.log('WIZJA.TV zbyt wiele razy pobowales - poczekaj 60 minut: %s' % result)
            control.infoDialog(control.lang(30487).encode('utf-8'),time=6000)
            control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV',control.lang(30487).encode('utf-8'), '')

            raise Exception('zbyt wiele razy pobowales - poczekaj 60 minut')
        #Other error
        else:
            control.log('WIZJA.TV inny blad: %s' % result)
            control.infoDialog(control.lang(30488).encode('utf-8'), time=6000)
            raise Exception('Inny bład: '+ result)
        return False

    except Exception as e:
        control.log('Error wizja.login %s' % e)
        return False
Example #37
0
def wizjalogin():
    try:
        params = {}
        url = 'http://wizja.tv/users/index.php'
        #result, headers, content, cookie = client.request(url, output='extended')

        params['login'] = '******'
        params['user_name'] = control.get_setting('wizja.user')
        params['user_password'] = control.get_setting('wizja.pass')

        #login to site
        result, headers, content, cookie = client.request(url,
                                                          post=params,
                                                          headers=HOST,
                                                          output='extended')
        control.set_setting('wizja.token', cookie)

        #wrong login
        if '<font color="#FF0000">Błędne hasło..</font>' in result:  #zly login
            control.log('WIZJA.TV ZLY LOGIN: %s' % result)
            control.infoDialog(control.lang(30497).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - WIZJA TV',
                control.lang(30497).encode('utf-8'), '')
            raise Exception()
        elif 'lub hasło.</font>' in result:  #zly login
            control.log('WIZJA.TV ZLY LOGIN: %s' % result)
            control.infoDialog(control.lang(30486).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - WIZJA TV',
                control.lang(30486).encode('utf-8'), '')

            raise Exception()

        elif 'Zalogowany jako :' in result:
            #no premium
            if '<font color=ff0000>Brak premium' in result:
                control.log('WIZJA.TV BRAK PREMIUM: %s' % result)
                control.infoDialog(control.lang(30490).encode('utf-8'),
                                   time=6000)
                control.dialog.ok(
                    control.addonInfo('name') + ' - WIZJA TV',
                    control.lang(30490).encode('utf-8'), '')

                raise Exception('NO premium')
            else:
                try:
                    premium = re.findall(
                        'Premium aktywne do (\d{4}.*?)</font>', result)[0]
                    control.set_setting('wizja.expire', premium)
                    control.infoDialog('Premium Wizja.tv do: ' +
                                       premium.encode('utf-8'),
                                       time=2000)
                except:
                    pass
                return True, cookie
        #account locked - wait 60 minutes
        elif '<font color="#FF0000">Wpisa' in result:
            control.log(
                'WIZJA.TV zbyt wiele razy pobowales - poczekaj 60 minut: %s' %
                result)
            control.infoDialog(control.lang(30487).encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - WIZJA TV',
                control.lang(30487).encode('utf-8'), '')

            raise Exception('zbyt wiele razy pobowales - poczekaj 60 minut')
        #Other error
        else:
            control.log('WIZJA.TV inny blad: %s' % result)
            control.infoDialog(control.lang(30488).encode('utf-8'), time=6000)
            raise Exception('Inny bład: ' + result)
        return False

    except Exception as e:
        control.log('Error wizja.login %s' % e)
        return False
Example #38
0
def ipla_chanels():
    control.log('Python version %s' % (sys.version))
    #url10 = 'https://gm2.redefine.pl/rpc/system/'
    #headers10 = {'User-Agent': 'mipla_ios/122', 'Content-Type': 'application/x-www-form-urlencoded',
    #             'Accept-Language': 'pl-pl'}
    #post_init10 = {"jsonrpc": "2.0", "method": "getConfiguration", "id": 2, "params": {
    #    "message": {"id": "CC3DFE81-1C70-403A-9C52-FC10EC51125A", "timestamp": "2016-10-16T00:08:57Z"}}}
    #data = requests.post(url10, data=post_init, headers=headers10)
    #print data.status_code, data.text
    #control.log('request %s|%s' % (data.status_code, data.text))

    try:
        ipla_system_id()
        if getIplaCredentialsInfo() == False:
            if control.yesnoDialog(
                    control.lang(40009).encode('utf-8'),
                    control.lang(30481).encode('utf-8'), '', 'Ipla',
                    control.lang(30483).encode('utf-8'),
                    control.lang(30482).encode('utf-8')):
                control.set_setting('ipla.user', '')
                control.set_setting('ipla.pass', '')
                control.openSettings('1.1')

            raise ValueError('No login orr password')

        user = control.setting('ipla.user').strip()
        password = hashlib.md5(
            control.setting('ipla.pass').strip()).hexdigest()
        systemid = control.setting('ipla.systemid').strip()
        items = []
        post_getTVChannels = json.loads(
            '{"jsonrpc":"2.0","method":"getTvChannels","id":5,"params":{"authData":{"login":"******"},"message":{"id":"4B737B56-A11D-4E65-BC86-47EA1E40EC4D","timestamp":"2016-10-15T17:03:21Z"}}}'
        )
        url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5=' + password + '&api_client=mipla_ios&login='******'&machine_id=iOS%' + systemid + '&outformat=2&api_build=122'

        result = _call_ipla(url_system, post_init, headers)
        control.log('request %s' % (result))
        result = _call_ipla(url_preauth, post_preauth, headers)
        result = _call_ipla(url_auth, headers=headers1)
        moje = json.loads(result)
        loginstatus = ipla_check_login(moje)
        if loginstatus <> 'OK':
            control.log('Ipla Login Error %s ' % loginstatus)
            control.infoDialog(loginstatus.encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - IPLA',
                loginstatus.encode('utf-8'), '')
            return

        myperms = []
        for i in moje['config']['access_groups']:
            #control.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %s' % i)
            if 'sc:' in i['code']:
                myperms.append(str(i['code']))
            if 'oth:' in i['code']:
                myperms.append(str(i['code']))
            #if 'loc:' in i['code']:
            #    myperms.append(str(i['code']))
        #control.log('###################################' % moje['config'])

        control.set_setting('ipla.passwdmd5',
                            moje['config']['user']['passwdmd5'])


        my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view'

        result = _call_ipla(my_action1, headers=headers2)
        control.log('Python version %s' % (result))

        result = _call_ipla(my_action2, headers=headers2)
        result = _call_ipla(my_action3, headers=headers2)
        post_getCat = json.loads(
            '{"jsonrpc":"2.0","method":"getCategoryWithFlatNavigation","id":4,"params":{"catid":0,"authData":{"login":"******"},"message":{"id":"47B80EF0-19D0-4BD0-82FF-80BC50EDF2A9","timestamp":"2016-10-15T23:02:22Z"}}}'
        )

        #result = _call_ipla(url_navigation, post_getCat, headers)
        result = _call_ipla(url_navigation, post_getTVChannels, headers)

        moje = json.loads(result)

        print "GETCAT", result
        for i in moje['result']['results']:
            item = {}
            channelperms = i['grantExpression'].split('*')
            channelperms = [w.replace('+plat:all', '') for w in channelperms]
            for j in myperms:
                #control.log('BB: %s AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %s' % (i['title'].upper(), i['grantExpression']))
                if j in channelperms:
                    #print("OK", i['id'], i['title'], i['published'], i['grantExpression'])
                    # control.log('Dalina %s' % result2)
                    item['img'] = i['thumbnails'][-1]['src'].encode('utf-8')
                    item['id'] = i['id']
                    item['title'] = i['title'].upper().encode('utf-8')
                    item['plot'] = i['description'].encode('utf-8')
                    #control.log('RESULT I %s' % dump(item))
                    # control.log('Calina %s' % item)
                    item = {
                        'title': item['title'],
                        'originaltitle': item['title'],
                        'genre': '0',
                        'plot': item['plot'],
                        'name': item['title'],
                        'tagline': '0',
                        'poster': item['img'],
                        'fanart': '0',
                        'id': item['id'],
                        'service': 'ipla',
                        'next': ''
                    }
                    items.append(item)

        #Dupes
        dupes = []
        filter = []
        for entry in items:
            if not entry['id'] in dupes:
                filter.append(entry)
                dupes.append(entry['id'])

        items = filter
        return items
    except Exception as e:
        control.log('Ipla Error %s ' % e)
        return
Example #39
0
def getstream(id):
    try:
        control.infoDialog(control.lang(30495).encode('utf-8'), time=200)

        if getIplaCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')):
                control.set_setting('ipla.user', '')
                control.set_setting('ipla.pass', '')
                control.openSettings('1.1')

            raise Exception()
        user = control.setting('ipla.user').strip()
        password = hashlib.md5(control.setting('ipla.pass').strip()).hexdigest()
        systemid = control.setting('ipla.systemid').strip()
        passwdmd5 = control.setting('ipla.passwdmd5').strip()


        url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5='+password+'&api_client=mipla_ios&login='******'&machine_id=iOS%'+systemid+'&outformat=2&api_build=122'
        post_getMedia = json.loads(
            '{"jsonrpc":"2.0","method":"getMedia","id":10,"params":{"cpid":0,"message":{"id":"F26642A8-8000-4C7A-B1CB-C2EADFD82E23","timestamp":"2016-10-16T00:53:25Z"},"authData":{"login":"******"},"mediaId":"'+str(id)+'"}}')
        post_perPlayData = json.loads(
            '{"jsonrpc":"2.0","method":"prePlayData","id":"-1864568404","params":{"mediaId":"'+str(id)+'","cpid":0,"authData":{"login":"******"}}}')


        #control.log('ipla1 %s' % id)

        result = _call_ipla(url_auth, headers=headers1)
        moje = json.loads(result)
        loginstatus = ipla_check_login(moje)
        if loginstatus <> 'OK':
            control.log('Ipla Login Error %s ' % loginstatus)
            control.infoDialog(loginstatus.encode('utf-8'),time=6000)
            control.dialog.ok(control.addonInfo('name') + ' - IPLA',loginstatus.encode('utf-8'), '')
            return
        my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view'

        result = _call_ipla(my_action1, headers=headers2)
        result = _call_ipla(my_action2, headers=headers2)
        result = _call_ipla(my_action3, headers=headers2)
        result = _call_ipla(url_navigation, post_getMedia, headers)

        result = _call_ipla(url_navigation, post_perPlayData, headers)
        moje = json.loads(result)
        url = moje['result']['mediaItem']['playback']['mediaSources'][-1]['authorizationServices']['pseudo']['url']
        myid = moje['result']['mediaItem']['playback']['mediaId']['id']

        url = url + '?cltype=mobile&cpid=0&id=' + myid + '&login='******'&passwdmd5='+passwdmd5+'&client_id=iOS%'+systemid+'&outformat=2'
        result = _call_ipla(url, headers=headers1)
        result = json.loads(result)
        url = result['resp']['license']['url'] + '|User-Agent='+urllib.quote_plus('IPLA/4.2.2.5 CFNetwork/808.0.2 Darwin/16.0.0')
        url = result['resp']['license']['url']

        result = _call_ipla(url, headers=headers3)
        result = result.decode('utf-8')
        link = re.findall("BANDWIDTH=\d+\n(.*?m3u8)", result, re.MULTILINE)[0]
        if url_hls in link:
            url = link + '?userid=iOS%' + systemid + '&initial|User-Agent=' + urllib.quote_plus(headers2['User-Agent'])
        else:
            url = url_hls +link + '?userid=iOS%'+systemid+'&initial|User-Agent='+ urllib.quote_plus(headers2['User-Agent'])
        return url

        return None

    except Exception as e:
        control.log('Error ipla.getstream %s' % e )
        return None
Example #40
0
File: yoy.py Project: undg/filmkodi
def getstream(id):
    try:

        if yoylogin():
            cookie = control.get_setting('yoytv.sess').strip()
            control.log('#####   cookie2: %s' % cookie)
            url = 'http://yoy.tv/channels/%s' % id
            result = client.request(url, cookie=cookie)

            if 'http://yoy.tv/accept/' in result:
                if 'true' == control.get_setting('xxxmode'):
                    control.log('EROTYK ')
                    u1 = client.parseDOM(result, 'form', ret='action')[0]
                    params = {}
                    params['_token'] = client.parseDOM(
                        result, 'input', ret='value', attrs={'name':
                                                             '_token'})[0]
                    control.log('params: %s' % params['_token'])
                    result = client.request(u1, data=params, cookie=cookie)
                else:
                    control.infoDialog(
                        control.lang(30799).encode('utf-8') + ' ' +
                        control.lang(30798).encode('utf-8'))
                    return None

            if '<title>Kup konto premium w portalu yoy.tv</title>' in result:
                control.infoDialog(control.lang(30485).encode('utf-8'))
                return None
            result1 = result
            try:
                myobj = client.parseDOM(
                    result1,
                    'object',
                    ret='data',
                    attrs={'type':
                           'application/x-shockwave-flash'})[0].encode('utf-8')
                result = client.parseDOM(result1,
                                         'param',
                                         ret='value',
                                         attrs={'name': 'FlashVars'
                                                })[0].encode('utf-8')
                control.log("YOY res: %s |%s| " % (result, myobj))

                p = urlparse.parse_qs(result)
                #control.log('# %s' % query)
                control.log('# %s' % p)
                control.log('# %s' % p['fms'])
                control.log('# %s' % p['cid'])

                myurl = p['fms'][0] + '/' + p['cid'][
                    0] + ' swfUrl=' + myobj + ' swfVfy=true tcUrl=' + p['fms'][
                        0] + '/_definst_ live=true timeout=15 pageUrl=' + url
                myurl = p['fms'][0] + '/' + p['cid'][
                    0] + ' swfUrl=' + myobj + ' swfVfy=true live=true timeout=15 pageUrl=' + url

                #        ' swfVfy=true tcUrl=' + 'rtmp://'+myip+'/oyo/_definst_ live=true pageUrl=' + url
                control.log("########## TAB:%s" % myurl)
                return myurl

                #myurl = myurl.replace('oyo','yoy')
            except:
                pass
            result = re.compile('type: "application/x-mpegurl", src: "([^"]+)"'
                                ).findall(result1)
            control.log("########## TAB:%s" % result)
            myurl = result[0]

            return myurl
        else:
            return None

    except Exception as e:
        control.log('Error yoy.getstream %s' % e)
        return None
Example #41
0
            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':
Example #42
0
def getstream(id):
    try:

        if yoylogin():
            cookie = control.get_setting('yoytv.sess').strip()
            control.log('#####   cookie2: %s' % cookie)
            url = 'http://yoy.tv/channels/%s' % id
            result = client.request(url, cookie=cookie)

            if 'http://yoy.tv/accept/' in result:
                if 'true' == control.get_setting('xxxmode'):
                    control.log('EROTYK ')
                    u1 = client.parseDOM(result, 'form', ret='action')[0]
                    params = {}
                    params['_token'] = client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0]
                    control.log('params: %s' % params['_token'])
                    result = client.request(u1, data=params, cookie=cookie)
                else:
                    control.infoDialog(control.lang(30799).encode('utf-8') + ' ' +control.lang(30798).encode('utf-8'))
                    return None

            if '<title>Kup konto premium w portalu yoy.tv</title>' in result:
                control.infoDialog(control.lang(30485).encode('utf-8'))
                return None

            myobj = client.parseDOM(result, 'object', ret='data', attrs={'type': 'application/x-shockwave-flash'})[0].encode('utf-8')
            result = client.parseDOM(result, 'param', ret='value', attrs={'name': 'FlashVars'})[0].encode('utf-8')
            control.log("YOY res: %s |%s| "  % (result,myobj))

            p = urlparse.parse_qs(result)
            #control.log('# %s' % query)
            control.log('# %s' % p)
            control.log('# %s' % p['fms'])
            control.log('# %s' % p['cid'])

            #lpi = result.index("s=") + result.index("=") * 3
            #control.log('# %s' )
            #rpi = result.index("&", lpi) - result.index("d") * 2
            #dp=[]
            #cp=result[lpi:rpi].split('.')
            #for i, item in enumerate(cp):
            #    j = 2 ^ i ^ ((i ^ 3) >> 1)
            #    k = 255 - int(cp[j])
            #    dp.append(k)
            #myip = '.'.join(map(str, dp))
            #control.log("YOY myip: %s " % (myip))

            #myplaypath='%s?email=%s&secret=%s&hash=%s' %(result['cid'],result['email'],result['secret'],result['hash'])
            #myurl = 'rtmp://'+myip + ' app=yoy/_definst_ playpath=' + myplaypath + ' swfUrl=' + myobj + \
            #        ' swfVfy=true tcUrl=' + 'rtmp://'+myip+'/yoy/_definst_ live=true timeout=15 pageUrl=' + url

            myurl = p['fms'][0] + '/' + p['cid'][0] + ' swfUrl=' + myobj + ' swfVfy=true tcUrl=' + p['fms'][
                0] + '/_definst_ live=true timeout=15 pageUrl=' + url
            myurl = p['fms'][0] + '/' + p['cid'][0] + ' swfUrl=' + myobj + ' swfVfy=true live=true timeout=15 pageUrl=' + url

            #        ' swfVfy=true tcUrl=' + 'rtmp://'+myip+'/oyo/_definst_ live=true pageUrl=' + url
            control.log("########## TAB:%s" % myurl)
            #myurl = myurl.replace('oyo','yoy')


            return myurl
        else:
            return None

    except Exception as e:
        control.log('Error yoy.getstream %s' % e)
        return None
Example #43
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
Example #44
0
            ico = s['poster']
            li = xbmcgui.ListItem(s['name'], iconImage=ico, thumbnailImage=ico)
            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':
Example #45
0
def getstream(id):
    try:
        control.infoDialog(control.lang(30495).encode('utf-8'), time=200)

        if getIplaCredentialsInfo() == False:
            if control.yesnoDialog(
                    control.lang(40003).encode('utf-8'),
                    control.lang(30481).encode('utf-8'), '', 'Trakt',
                    control.lang(30483).encode('utf-8'),
                    control.lang(30482).encode('utf-8')):
                control.set_setting('ipla.user', '')
                control.set_setting('ipla.pass', '')
                control.openSettings('1.1')

            raise Exception()
        user = control.setting('ipla.user').strip()
        password = hashlib.md5(
            control.setting('ipla.pass').strip()).hexdigest()
        systemid = control.setting('ipla.systemid').strip()
        passwdmd5 = control.setting('ipla.passwdmd5').strip()

        url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5=' + password + '&api_client=mipla_ios&login='******'&machine_id=iOS%' + systemid + '&outformat=2&api_build=122'
        post_getMedia = json.loads(
            '{"jsonrpc":"2.0","method":"getMedia","id":10,"params":{"cpid":0,"message":{"id":"F26642A8-8000-4C7A-B1CB-C2EADFD82E23","timestamp":"2016-10-16T00:53:25Z"},"authData":{"login":"******"},"mediaId":"' + str(id) + '"}}')
        post_perPlayData = json.loads(
            '{"jsonrpc":"2.0","method":"prePlayData","id":"-1864568404","params":{"mediaId":"'
            + str(id) + '","cpid":0,"authData":{"login":"******"}}}')

        #control.log('ipla1 %s' % id)

        result = _call_ipla(url_auth, headers=headers1)
        moje = json.loads(result)
        loginstatus = ipla_check_login(moje)
        if loginstatus <> 'OK':
            control.log('Ipla Login Error %s ' % loginstatus)
            control.infoDialog(loginstatus.encode('utf-8'), time=6000)
            control.dialog.ok(
                control.addonInfo('name') + ' - IPLA',
                loginstatus.encode('utf-8'), '')
            return
        my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view'

        result = _call_ipla(my_action1, headers=headers2)
        result = _call_ipla(my_action2, headers=headers2)
        result = _call_ipla(my_action3, headers=headers2)
        result = _call_ipla(url_navigation, post_getMedia, headers)

        result = _call_ipla(url_navigation, post_perPlayData, headers)
        moje = json.loads(result)
        url = moje['result']['mediaItem']['playback']['mediaSources'][-1][
            'authorizationServices']['pseudo']['url']
        myid = moje['result']['mediaItem']['playback']['mediaId']['id']

        url = url + '?cltype=mobile&cpid=0&id=' + myid + '&login='******'&passwdmd5=' + passwdmd5 + '&client_id=iOS%' + systemid + '&outformat=2'
        result = _call_ipla(url, headers=headers1)
        result = json.loads(result)
        url = result['resp']['license'][
            'url'] + '|User-Agent=' + urllib.quote_plus(
                'IPLA/4.2.2.5 CFNetwork/808.0.2 Darwin/16.0.0')
        url = result['resp']['license']['url']

        result = _call_ipla(url, headers=headers3)
        result = result.decode('utf-8')
        link = re.findall("BANDWIDTH=\d+\n(.*?m3u8)", result, re.MULTILINE)[0]
        if url_hls in link:
            url = link + '?userid=iOS%' + systemid + '&initial|User-Agent=' + urllib.quote_plus(
                headers2['User-Agent'])
        else:
            url = url_hls + link + '?userid=iOS%' + systemid + '&initial|User-Agent=' + urllib.quote_plus(
                headers2['User-Agent'])
        return url

        return None

    except Exception as e:
        control.log('Error ipla.getstream %s' % e)
        return None
Example #46
0
def getstream(id):
    try:
        control.set_setting('pierwszatv.tokenExpireIn', '')
        control.set_setting('pierwszatv.serverId', '')
        control.set_setting('pierwszatv.streamId', '')
        control.set_setting('pierwszatv.token', '')

        if getPierwszaCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')):
                control.set_setting('pierwszatv.user', '')
                control.set_setting('pierwszatv.password', '')
                control.openSettings('2.1')

            raise Exception()
        url = '/api/stream/create'
        params = {}
        params['id'] =id
        params['user'] =control.setting('pierwszatv.user').strip()
        params['password'] = urllib.quote_plus(control.setting('pierwszatv.password'))

        result = get(url, params)
        result = json.loads(result)

        if result['status'] == 'ok':
            #time.sleep(1)
            #control.log('x1x1x1: %s' % result['status'])
            expirein = int(int(result['tokenExpireIn'])*0.75)
            expirewhen  = datetime.datetime.now() + datetime.timedelta(seconds=expirein)
            control.set_setting('pierwszatv.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple()))))
            control.set_setting('pierwszatv.serverId', result['serverId'])
            control.set_setting('pierwszatv.streamId', result['streamId'])
            control.set_setting('pierwszatv.token', result['token'])

            for i in range(0, 5):
                try:
                    r = get('/api/stream/status', {'serverId': result['serverId'] , 'streamId': result['streamId'], 'token': result['token']})
                    r = json.loads(r)
                    if r['status'] == 'ok':
                        #control.infoDialog(control.lang(30489).encode('utf-8'), time=6000)
                        for j in range(0, 20):
                            time.sleep(1)
                            control.infoDialog(control.lang(30489).encode('utf-8'), time=500)
                            try:
                                result2 = client.request(r['source']+'?token='+result['token'],safe=True, timeout='2')
                                control.log('Pierwsza link check nr: %s: result:%s' % (j,result2))


                                if result2 == None: raise Exception()
                                else: return r['source']+'?token='+result['token']
                            except:
                                pass

                        return r['source']+'?token='+result['token']
                    time.sleep(3)

                except:
                    pass
        if result['status'] == 'error':
            control.infoDialog('%s' % result['message'].encode('utf-8'))

        return None

    except Exception as e:
        control.log('Error pierwsza.getstream %s' % e )
Example #47
0
def getstream(id):
    try:
        control.set_setting('pierwszatv.tokenExpireIn', '')
        control.set_setting('pierwszatv.serverId', '')
        control.set_setting('pierwszatv.streamId', '')
        control.set_setting('pierwszatv.token', '')

        if getPierwszaCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')):
                control.set_setting('pierwszatv.user', '')
                control.set_setting('pierwszatv.password', '')
                control.openSettings('1.4')

            raise Exception()
        url = '/api/stream/create'
        params = {}
        params['id'] =id
        params['user'] =control.setting('pierwszatv.user').strip()
        params['password'] = urllib.quote_plus(control.setting('pierwszatv.password'))

        result = get(url, params)
        control.log('x1x1x1: %s' % result)
        result = json.loads(result)

        if result['status'] == 'ok':
            #time.sleep(1)

            expirein = int(int(result['tokenExpireIn'])*0.75)
            expirewhen  = datetime.datetime.now() + datetime.timedelta(seconds=expirein)
            control.set_setting('pierwszatv.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple()))))
            control.set_setting('pierwszatv.serverId', result['serverId'])
            control.set_setting('pierwszatv.streamId', result['streamId'])
            control.set_setting('pierwszatv.token', result['token'])

            for i in range(0, 5):
                try:
                    r = get('/api/stream/status', {'serverId': result['serverId'] , 'streamId': result['streamId'], 'token': result['token']})
                    r = json.loads(r)
                    if r['status'] == 'ok':
                        #control.infoDialog(control.lang(30489).encode('utf-8'), time=6000)
                        for j in range(0, 20):
                            time.sleep(1)
                            control.infoDialog(control.lang(30489).encode('utf-8'), time=500)
                            try:
                                result2 = client.request(r['source']+'?token='+result['token'],safe=True, timeout='2')
                                control.log('Pierwsza link check nr: %s: result:%s' % (j,result2))


                                if result2 == None: raise Exception()
                                else: return r['source']+'?token='+result['token']
                            except:
                                pass

                        return r['source']+'?token='+result['token']
                    time.sleep(3)

                except:
                    pass
        if result['status'] == 'error':
            control.infoDialog('%s' % result['message'].encode('utf-8'))
            control.dialog.ok(control.addonInfo('name'), result['message'].encode('utf-8'), '')

        return None

    except Exception as e:
        control.log('Error pierwsza.getstream %s' % e )
Example #48
0
def ipla_chanels():
    control.log('Python version %s' %  (sys.version))
    #url10 = 'https://gm2.redefine.pl/rpc/system/'
    #headers10 = {'User-Agent': 'mipla_ios/122', 'Content-Type': 'application/x-www-form-urlencoded',
    #             'Accept-Language': 'pl-pl'}
    #post_init10 = {"jsonrpc": "2.0", "method": "getConfiguration", "id": 2, "params": {
    #    "message": {"id": "CC3DFE81-1C70-403A-9C52-FC10EC51125A", "timestamp": "2016-10-16T00:08:57Z"}}}
    #data = requests.post(url10, data=post_init, headers=headers10)
    #print data.status_code, data.text
    #control.log('request %s|%s' % (data.status_code, data.text))

    try:
        ipla_system_id()
        if getIplaCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40009).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Ipla',
                                   control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')):
                control.set_setting('ipla.user', '')
                control.set_setting('ipla.pass', '')
                control.openSettings('1.1')

            raise ValueError('No login orr password')

        user = control.setting('ipla.user').strip()
        password = hashlib.md5(control.setting('ipla.pass').strip()).hexdigest()
        systemid = control.setting('ipla.systemid').strip()
        items = []
        post_getTVChannels = json.loads(
            '{"jsonrpc":"2.0","method":"getTvChannels","id":5,"params":{"authData":{"login":"******"},"message":{"id":"4B737B56-A11D-4E65-BC86-47EA1E40EC4D","timestamp":"2016-10-15T17:03:21Z"}}}')
        url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5='+password+'&api_client=mipla_ios&login='******'&machine_id=iOS%'+systemid+'&outformat=2&api_build=122'

        result = _call_ipla(url_system, post_init, headers)
        control.log('request %s' % (result))
        result = _call_ipla(url_preauth, post_preauth, headers)
        result = _call_ipla(url_auth, headers=headers1)
        moje = json.loads(result)
        loginstatus = ipla_check_login(moje)
        if loginstatus <> 'OK':
            control.log('Ipla Login Error %s ' % loginstatus)
            control.infoDialog(loginstatus.encode('utf-8'),time=6000)
            control.dialog.ok(control.addonInfo('name') + ' - IPLA',loginstatus.encode('utf-8'), '')
            return

        myperms = []
        for i in moje['config']['access_groups']:
            #control.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %s' % i)
            if 'sc:' in i['code']:
                myperms.append(str(i['code']))
            if 'oth:' in i['code']:
                myperms.append(str(i['code']))
            #if 'loc:' in i['code']:
            #    myperms.append(str(i['code']))
        #control.log('###################################' % moje['config'])

        control.set_setting('ipla.passwdmd5', moje['config']['user']['passwdmd5'])


        my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action'
        my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \
                     '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view'

        result = _call_ipla(my_action1, headers=headers2)
        control.log('Python version %s' % (result))

        result = _call_ipla(my_action2, headers=headers2)
        result = _call_ipla(my_action3, headers=headers2)
        post_getCat = json.loads(
            '{"jsonrpc":"2.0","method":"getCategoryWithFlatNavigation","id":4,"params":{"catid":0,"authData":{"login":"******"},"message":{"id":"47B80EF0-19D0-4BD0-82FF-80BC50EDF2A9","timestamp":"2016-10-15T23:02:22Z"}}}')

        #result = _call_ipla(url_navigation, post_getCat, headers)
        result = _call_ipla(url_navigation, post_getTVChannels, headers)

        moje = json.loads(result)

        print "GETCAT", result
        for i in moje['result']['results']:
            item = {}
            channelperms = i['grantExpression'].split('*')
            channelperms = [w.replace('+plat:all', '') for w in channelperms]
            for j in myperms:
                #control.log('BB: %s AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %s' % (i['title'].upper(), i['grantExpression']))
                if j in channelperms:
                    #print("OK", i['id'], i['title'], i['published'], i['grantExpression'])
                    # control.log('Dalina %s' % result2)
                    item['img'] = i['thumbnails'][-1]['src'].encode('utf-8')
                    item['id'] = i['id']
                    item['title'] = i['title'].upper().encode('utf-8')
                    item['plot'] = i['description'].encode('utf-8')
                    #control.log('RESULT I %s' % dump(item))
                    # control.log('Calina %s' % item)
                    item = {'title': item['title'], 'originaltitle': item['title'], 'genre': '0', 'plot': item['plot'], 'name':item['title'], 'tagline': '0',  'poster': item['img'], 'fanart': '0', 'id':item['id'], 'service':'ipla', 'next': ''}
                    items.append(item)

        #Dupes
        dupes = []
        filter = []
        for entry in items:
            if not entry['id'] in dupes:
                filter.append(entry)
                dupes.append(entry['id'])

        items = filter
        return items
    except Exception as e:
        control.log('Ipla Error %s ' % e)
        return
Example #49
0
def login():
    try:
        if getTelewizjadaCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')):
                control.set_setting('telewizjada.user', '')
                control.set_setting('telewizjada.password', '')
                control.openSettings('1.20')
        control.log('>>>>  LOGIN()' )

        expire = control.get_setting('telewizjada.expire')
        control.log('Expire1: %s' % expire)

        if expire != '':
            try:
                from datetime import datetime
                #d = datetime.strptime(expire, '%Y-%m-%d %H:%M:%S')
                d = datetime(*(time.strptime(expire, '%Y-%m-%d %H:%M:%S')[0:6]))
                control.log('Expire2: %s' % d)

                d2 = datetime.now()
                if d>d2:
                    control.log('Expire OK: %s %s' % (d,d2))
                    return True
            except: pass

        url = 'http://www.deltamediaplayer.com/index.php?option=com_users&view=login&Itemid=116'
        result, h1, content, cookie1 = client.request(url,output='extended')
        headers= {'referer':url}
        result = client.parseDOM(result, 'div', attrs={'class':'login'})[0]
        result = re.findall('<input type="hidden" name="([^"]+)" value="([^"]+)"',result)
        params = {  'username':control.get_setting('telewizjada.user'),
                    'password':control.get_setting('telewizjada.pass'),
                    'remember':'yes',
                    str(result[0][0]): urllib.quote(str(result[0][1])),
                    str(result[1][0]): urllib.quote(str(result[1][1]))
                    }
        paramslog = {  'username':control.get_setting('telewizjada.user'),
                    'password':'',
                    'remember':'yes',
                    str(result[0][0]): urllib.quote(str(result[0][1])),
                    str(result[1][0]): urllib.quote(str(result[1][1]))
                    }
        control.log('>>>>  PARAMS %s' % (paramslog))

        url='http://www.deltamediaplayer.com/index.php?option=com_users&task=user.login'

        result, h2, content, cookie2 = client.request(url, redirect=False, post=params, headers=headers, cookie=cookie1, output='extended')

        if content['Location'] != 'https://www.deltamediaplayer.com/index.php?option=com_users&view=profile':
            control.infoDialog(control.lang(30600).encode('utf-8'),time=6000)
            control.dialog.ok(control.addonInfo('name') + ' - Telewizzjada.net',control.lang(30600).encode('utf-8'), '')
            raise ValueError('Bledny login lub haslo.')


        url = 'http://www.deltamediaplayer.com/playercode/authorised/gethlsusers.php'
        headers['referer']='http://www.deltamediaplayer.com/index.php?option=com_acctexp&view=user&layout=subscriptiondetails&Itemid=119'
        headers['X-Requested-With']='XMLHttpRequest'
        headers['Content-Type'] = 'application/json'
        headers['cookie'] = '%s; %s' % (cookie1,content['Set-Cookie'].split(';')[0])
        params2=json.dumps({'browser':'Desktop;Windows;Chrome 54'})
        result = client.request(url,  post=params2, headers=headers)
        control.log('>>>>  RES r:%s ' % (result))

        r = json.loads(result)

        result = [i for i in r if i['registered'] != 0]

        if len(result)>0:
            for i in result:
                control.log('I %s' %i)

            control.log('QQQQQQQQQQQQQQ %s' % r[0]['hash'], )
            control.set_setting('telewizjada.token', r[0]['hash'])
            control.set_setting('telewizjada.os', r[0]['os'])
            control.set_setting('telewizjada.browser', r[0]['browser'])
            control.set_setting('telewizjada.device', r[0]['device'])
            control.log("Brovser: %s" % r[0]['browser'].split(' ')[0])
            ua = 'Mozilla/5.0 (%s; %s; rv:%s) Gecko/20100101 %s/%s' % (r[0]['os'], r[0]['device'], r[0]['browser'].split(' ')[-1],
                                                                       r[0]['browser'].split(' ')[0], r[0]['browser'].split(' ')[-1])
            control.log('UA %s' %ua)
            control.set_setting('telewizjada.ua', ua)
            return True

        else:
            control.infoDialog(control.lang(30601).encode('utf-8'), time=6000)
            control.dialog.ok(control.addonInfo('name') + ' - Telewizzjada.net',control.lang(30601).encode('utf-8'), '')
            raise ValueError('Brak zarejestrowanych przeglądarek.')
        return False


    except Exception as e:
        control.log('Exception telewizjada.net login %s' % e)
        return False
Example #50
0
    def sourcesDirect(self, service, meta):
        u = None
        meta = json.loads(meta)
        #control.log('ZZZZ: %s' % service)

        if service == 'ipla':
            try:
                #control.infoDialog(control.lang(30493).encode('utf-8'), time=1000)
                u = ipla.getstream(meta['id'])
            except:
                pass

        if service == 'itivi':
            try:
                #control.infoDialog(control.lang(30493).encode('utf-8'), time=1000)
                u = itivi.getstream(meta['id'])
            except:
                pass
        if service == 'looknij':
            try:
                u = looknij.getstream(meta['id'])

            except:
                pass

        if service == 'eskago':
            try:
                result = client.request(meta['id'])
                result = re.compile(
                    'post\([\'"]https://api.stream.smcdn.pl/api/secureToken.php[\'"], { streamUri:\s*[\'"]([^\'"]+)[\'"]'
                ).findall(result)
                control.log('Meta %s' % result[0])
                headers = {}
                headers['Referer'] = meta['id']
                #headers['Content-Type'] == 'application/json'
                myurl = client.request(
                    'https://api.stream.smcdn.pl/api/secureToken.php',
                    post={"streamUri": result[0]},
                    headers=headers)
                control.log('Meta2 %s' % myurl)
                u = myurl
            except:
                pass
        if service == 'telewizjadanet':
            try:
                control.infoDialog(control.lang(30498).encode('utf-8'),
                                   time=500)
                u = telewizjadanet.getstream(meta['id'])
            except:
                pass
        if service == 'videostar':
            try:
                control.infoDialog(control.lang(30494).encode('utf-8'),
                                   time=500)
                u = videostar.getstream(meta['id'])
            except:
                pass
        if service == 'yoy':
            try:
                u = yoy.getstream(meta['id'])
            except:
                pass
        if service == 'weeb':
            try:
                u = weeb.getstream(meta['id'])
            except:
                pass
        if service == 'wizja':
            try:
                control.infoDialog(control.lang(30492).encode('utf-8'),
                                   time=500)
                u = wizja.getstream(meta['id'])
            except:
                pass
        if service == 'pierwsza':
            try:
                control.infoDialog(control.lang(30489).encode('utf-8'),
                                   time=500)
                u = pierwsza.getstream(meta['id'])
            except:
                pass

        #control.log('XYZ: %s' % u)

        return u
Example #51
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