Beispiel #1
0
def getchanels():
    try:
        if getYoyCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40004).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'YOY', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')):
                control.openSettings('2.5')
            raise Exception()
        login()
        items = []
        for j in range(1,10):
            url = 'http://yoy.tv/channels?live=1&country=140&page=%s' % j
            result = client2.http_get(url)
            result = client.parseDOM(result, 'a', attrs = {'class': 'thumb-info team'})
            result = [(client.parseDOM(i, 'img', ret='src')[0], client.parseDOM(i, 'img', ret='alt')[0]) for i in result]
            for i in result:
                item = {}
                item['id'] = i[0].replace('http://yoy.tv/channel/covers/','').replace('.jpg?cache=32','')
                control.log('Alina %s' % item['id'])

                item['id']=item['id'].encode('utf-8')
                item['title'] = i[1].upper().encode('utf-8')

                items.append(item)
        return items
    except:
        #control.openSettings('6.1')
        control.log('ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ' )
Beispiel #2
0
def wizjachanels():
    try:
        if getWizjaCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40005).encode('utf-8'), control.lang(30481).encode('utf-8'), '',
                                   'Wizja', control.lang(30483).encode('utf-8'),
                                   control.lang(30482).encode('utf-8')):
                control.openSettings('2.3')
            raise Exception()
        login()
        items = []
        url = 'http://wizja.tv/'
        result = client2.http_get(url)
        result = client.parseDOM(result, 'td')

        for i in result:
            item = {}
            try:
                result2 = [(client.parseDOM(i, 'a', ret='href')[0], client.parseDOM(i, 'img', ret='src')[0])]
                #control.log('Dalina %s' % result2)
                item['img'] = 'http://wizja.tv/' + result2[0][1]
                item['img'] = item['img'].encode('utf-8')
                item['id'] = result2[0][0].replace('watch.php?id=','')
                item['id'] = item['id'].encode('utf-8')
                item['title'] = result2[0][1].replace('ch_logo/','').replace('.png','')
                item['title'] = item['title'].upper().encode('utf-8')
                # control.log('Calina %s' % item)
                items.append(item)
            except Exception as e:
                control.log('                               Error wizja.wizjachanels for %s' % e)
                pass

        return items
    except Exception as e:
        control.log('Error wizja.wizjachanels %s' % e)
Beispiel #3
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
Beispiel #4
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
Beispiel #5
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)
Beispiel #6
0
 def addDirectoryItem(self,
                      name,
                      query,
                      thumb,
                      icon,
                      context=None,
                      isAction=True,
                      isFolder=True):
     try:
         name = control.lang(name).encode('utf-8')
     except:
         pass
     url = '%s?action=%s' % (sysaddon, query) if isAction == True else query
     thumb = os.path.join(artPath, thumb) if not artPath == None else icon
     cm = []
     if not context == None:
         cm.append((control.lang(context[0]).encode('utf-8'),
                    'RunPlugin(%s?action=%s)' % (sysaddon, context[1])))
     item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
     item.addContextMenuItems(cm, replaceItems=False)
     if not addonFanart == None:
         item.setProperty('Fanart_Image', addonFanart)
     control.addItem(handle=int(sys.argv[1]),
                     url=url,
                     listitem=item,
                     isFolder=isFolder)
Beispiel #7
0
def get(url, params={}):
    try:
        if getVideostarCredentialsInfo() == False:
            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('2.3')
            raise Exception()

        url = urlparse.urljoin('https://api.videostar.pl', url)
        result = client.request(url,
                                headers=headers,
                                cookie=control.get_setting('videostar.sess'))
        r = json.loads(result)

        if r['status'] == "error" or result == None:
            if r['errors'][0]['code'] == 1:
                login()
                control.sleep(500)
                mycookie = control.get_setting('videostar.sess')
                result = client.source(
                    url,
                    headers=headers,
                    cookie=control.get_setting('videostar.sess'))

        return result
    except Exception as e:
        control.log('Error videostar.get %s' % e)
        pass
Beispiel #8
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
Beispiel #9
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)
Beispiel #10
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
Beispiel #11
0
def wizjachanels():
    try:
        if getWizjaCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40005).encode('utf-8'), control.lang(30481).encode('utf-8'), '',
                                   'Wizja', control.lang(30483).encode('utf-8'),
                                   control.lang(30482).encode('utf-8')):
                control.openSettings('2.3')
            raise Exception()
        login()
        items = []
        url = 'http://wizja.tv/'
        result = client2.http_get(url)
        result = client.parseDOM(result, 'td')

        for i in result:
            item = {}
            try:
                result2 = [(client.parseDOM(i, 'a', ret='href')[0], client.parseDOM(i, 'img', ret='src')[0])]
                #control.log('Dalina %s' % result2)
                item['img'] = 'http://wizja.tv/' + result2[0][1]
                item['img'] = item['img'].encode('utf-8')
                item['id'] = result2[0][0].replace('watch.php?id=','')
                item['id'] = item['id'].encode('utf-8')
                item['title'] = result2[0][1].replace('ch_logo/','').replace('.png','')
                item['title'] = item['title'].upper().encode('utf-8')
                # control.log('Calina %s' % item)
                items.append(item)
            except Exception as e:
                control.log('                               Error wizja.wizjachanels for %s' % e)
                pass

        return items
    except Exception as e:
        control.log('Error wizja.wizjachanels %s' % e)
Beispiel #12
0
    def addDirectory(self, items):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonFanart = control.addonFanart()
        addonThumb = control.addonThumb()
        artPath = control.artPath()

        for i in items:
            try:
                try: name = control.lang(i['name']).encode('utf-8')
                except: name = i['name']

                if i['image'].startswith('http://'): thumb = i['image']
                elif not artPath == None: thumb = os.path.join(artPath, i['image'])
                else: thumb = addonThumb

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib.quote_plus(i['url'])
                except: pass

                cm = []

                try: cm.append((control.lang(30211).encode('utf-8'), 'RunPlugin(%s?action=moviesToLibrary&url=%s)' % (sysaddon, urllib.quote_plus(i['context']))))
                except: pass

                item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
                item.addContextMenuItems(cm, replaceItems=False)
                if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
            except:
                pass

        control.directory(int(sys.argv[1]), cacheToDisc=True)
Beispiel #13
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
Beispiel #14
0
    def getVideoInfo(self, content, name, year, imdb, tvdb):
        try:
            self.loadingTime = time.time()
            self.totalTime = 0
            self.currentTime = 0
            self.folderPath = control.infoLabel('Container.FolderPath')
            self.name = name
            self.year = year
            self.content = content
            self.file = self.name + '.strm'
            self.file = self.file.translate(None, '\/:*?"<>|').strip('.')
            self.imdb = 'tt' + imdb if imdb.isdigit() else imdb
            self.tvdb = tvdb if not tvdb == None else '0'
        except:
            pass

        try:
            if self.content == 'movie':
                self.title = re.compile('(.+?) [(]\d{4}[)]$').findall(
                    self.name)[0]
            elif self.content == 'episode':
                self.tvshowtitle, self.season, self.episode = re.compile(
                    '(.+?) S(\d*)E(\d*)$').findall(self.name)[0]
                self.season, self.episode = '%01d' % int(
                    self.season), '%01d' % int(self.episode)
                self.file2 = '%s (%s) S%02dE%02d.strm' % (
                    self.tvshowtitle.translate(None, '\/:*?"<>|'), self.year,
                    int(self.season), int(self.episode))
        except:
            pass

        try:
            if control.setting('resume_playback') == 'true':
                self.offset = bookmarks.getBookmark(self.name, self.imdb)
                if self.offset == '0': raise Exception()

                minutes, seconds = divmod(float(self.offset), 60)
                hours, minutes = divmod(minutes, 60)
                yes = control.yesnoDialog(
                    '%s %02d:%02d:%02d' % (control.lang(30461).encode('utf-8'),
                                           hours, minutes, seconds), '', '',
                    self.name,
                    control.lang(30463).encode('utf-8'),
                    control.lang(30462).encode('utf-8'))

                if yes: self.offset = '0'
        except:
            pass

        try:
            if self.content == 'movie':
                control.window.setProperty('script.trakt.ids',
                                           json.dumps({'imdb': self.imdb}))
            elif self.content == 'episode':
                control.window.setProperty('script.trakt.ids',
                                           json.dumps({'tvdb': self.tvdb}))
        except:
            pass
Beispiel #15
0
def getchanels():
    try:
        if getYoyCredentialsInfo() == False:
            if control.yesnoDialog(
                    control.lang(40004).encode('utf-8'),
                    control.lang(30481).encode('utf-8'), '', 'YOY',
                    control.lang(30483).encode('utf-8'),
                    control.lang(30482).encode('utf-8')):
                control.openSettings('1.21')
            raise Exception()
        #login()
        items = []
        for j in range(1, 10):
            try:
                url = 'http://yoy.tv/channels?live=1&country=140&page=%s' % j
                result = client.request(url)
                result = client.parseDOM(result,
                                         'a',
                                         attrs={'class': 'thumb-info team'})
                result = [(client.parseDOM(i, 'img', ret='src')[0],
                           client.parseDOM(i, 'img', ret='alt')[0])
                          for i in result]
                for i in result:
                    item = {}
                    item['id'] = i[0].replace('http://yoy.tv/channel/covers/',
                                              '').replace('.jpg?cache=32', '')
                    control.log('YOY channel %s' % item['id'])
                    item['id'] = item['id'].encode('utf-8')
                    item['title'] = control.trans(i[1].upper().encode('utf-8'))
                    items.append(item)
            except:
                control.log('YOY url: %s' % url)
                pass

        if 'true' == control.get_setting('xxxmode'):
            url = 'http://yoy.tv/channels?category=erotyka'
            result = client.request(url)
            result = client.parseDOM(result,
                                     'a',
                                     attrs={'class': 'thumb-info team'})
            result = [(client.parseDOM(i, 'img', ret='src')[0],
                       client.parseDOM(i, 'img', ret='alt')[0])
                      for i in result]
            for i in result:
                control.log('XXX: %s' % i[0])
                item = {}
                item['id'] = i[0].replace('http://yoy.tv/channel/covers/',
                                          '').replace('.jpg?cache=32', '')
                control.log('XXX Alina %s' % item['id'])
                item['id'] = item['id'].encode('utf-8')
                item['title'] = 'XXX ' + control.trans(
                    i[1].upper().encode('utf-8'))
                items.append(item)

        return items
    except Exception as e:
        control.log('Error yoy.getchanels %s' % e)
Beispiel #16
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
Beispiel #17
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)
Beispiel #18
0
def get(url, proxy=''):
    try:
        pl_proxy = control.setting('pl_proxy')
        pl_proxy_port = control.setting('pl_proxy_port')

        if getVideostarCredentialsInfo() == False:
            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')
            raise Exception()

        url = urlparse.urljoin('https://api.videostar.pl', url)
        if proxy == '':
            result = client.request(
                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(
                url,
                headers=headers,
                cookie=control.get_setting('videostar.sess'),
                proxy=myproxy)
        r = json.loads(result)

        if r['status'] == "error" or result == None:
            if r['errors'][0]['code'] == 1:
                login()
                control.sleep(500)
                mycookie = control.get_setting('videostar.sess')
                result = client.source(
                    url,
                    headers=headers,
                    cookie=control.get_setting('videostar.sess'))

        return result
    except Exception as e:
        control.log('Error videostar.get %s' % e)
        pass
Beispiel #19
0
 def addDirectoryItem(self, name, query, thumb, icon, context=None, isAction=True, isFolder=True):
     try: name = control.lang(name).encode('utf-8')
     except: pass
     url = '%s?action=%s' % (sysaddon, query) if isAction == True else query
     thumb = os.path.join(artPath, thumb) if not artPath == None else icon
     cm = []
     if not context == None: cm.append((control.lang(context[0]).encode('utf-8'), 'RunPlugin(%s?action=%s)' % (sysaddon, context[1])))
     item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
     item.addContextMenuItems(cm, replaceItems=False)
     if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
     control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=isFolder)
Beispiel #20
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
Beispiel #21
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
Beispiel #22
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
Beispiel #23
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)
Beispiel #24
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
Beispiel #25
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'))
Beispiel #26
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
Beispiel #27
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
Beispiel #28
0
def getchanels():
    try:
        if getYoyCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40004).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'YOY', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')):
                control.openSettings('1.21')
            raise Exception()
        #login()
        items = []
        for j in range(1,10):
            try:
                url = 'http://yoy.tv/channels?live=1&country=140&page=%s' % j
                result = client.request(url)
                result = client.parseDOM(result, 'a', attrs = {'class': 'thumb-info team'})
                result = [(client.parseDOM(i, 'img', ret='src')[0], client.parseDOM(i, 'img', ret='alt')[0]) for i in result]
                for i in result:
                    item = {}
                    item['id'] = i[0].replace('http://yoy.tv/channel/covers/','').replace('.jpg?cache=32','')
                    control.log('YOY channel %s' % item['id'])
                    item['id']=item['id'].encode('utf-8')
                    item['title'] = control.trans(i[1].upper().encode('utf-8'))
                    items.append(item)
            except:
                control.log('YOY url: %s' % url)
                pass

        if 'true'== control.get_setting('xxxmode'):
            url = 'http://yoy.tv/channels?category=erotyka'
            result = client.request(url)
            result = client.parseDOM(result, 'a', attrs = {'class': 'thumb-info team'})
            result = [(client.parseDOM(i, 'img', ret='src')[0], client.parseDOM(i, 'img', ret='alt')[0]) for i in result]
            for i in result:
                control.log('XXX: %s' %i[0])
                item = {}
                item['id'] = i[0].replace('http://yoy.tv/channel/covers/','').replace('.jpg?cache=32','')
                control.log('XXX Alina %s' % item['id'])
                item['id']=item['id'].encode('utf-8')
                item['title'] = 'XXX '+ control.trans(i[1].upper().encode('utf-8'))
                items.append(item)

        return items
    except Exception as e:
        control.log('Error yoy.getchanels %s' % e)
Beispiel #29
0
def login():
    try:
        if getLooknijCredentialsInfo() == False:
            if control.yesnoDialog(control.lang(40008).encode('utf-8'), control.lang(30481).encode('utf-8'), '',
                                   'Looknij', control.lang(30483).encode('utf-8'),
                                   control.lang(30482).encode('utf-8')):
                control.openSettings('1.4')
            raise Exception()


        params = {}
        #url = 'http://itivi.pl/include/login.php'
        #params['log'] = control.get_setting('itivi.user')
        #params['pwd'] = control.get_setting('itivi.pass')
        #result = client2.http_get(url, data=params)

        return True

    except Exception as e:
        control.log('Error wizja.login %s' % e)
        return False
Beispiel #30
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')
        result = client2.http_get(url, data=params)

        return True

    except Exception as e:
        control.log('Error wizja.login %s' % e)
        return False
Beispiel #31
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
Beispiel #32
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
Beispiel #33
0
def get(url, params={}):
    try:
        if getVideostarCredentialsInfo() == False:
            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('2.3')
            raise Exception()

        url = urlparse.urljoin('https://api.videostar.pl', url)
        result = client.request(url, headers=headers, cookie=control.get_setting('videostar.sess'))
        r = json.loads(result)

        if r['status'] =="error" or result==None:
            if r['errors'][0]['code'] == 1:
                login()
                control.sleep(500)
                mycookie = control.get_setting('videostar.sess')
                result = client.source(url, headers=headers, cookie=control.get_setting('videostar.sess'))

        return result
    except Exception as e:
        control.log('Error videostar.get %s' % e)
        pass
Beispiel #34
0
def chanels():
    adult = control.get_setting('xxxmode')

    #if login() == False:
    #    control.log('Błędny login')
    #    raise ValueError('Błędny login')
    url = 'http://www.telewizjada.net/get_channels_cache.php'
    items = []
    try:
        result = client.request(url)
        result = json.loads(result)

        for i in result['channels']:
            try:
                if adult == 'false':
                    if i['isAdult'] == 1:
                        control.log('Adult telewizjada.chanels %s' %
                                    i['displayName'])
                        raise ValueError('Adult channel %s' % i['displayName'])
                item = {}
                item['img'] = urlparse.urljoin(base_url,
                                               i['bigThumb']).encode('utf-8')
                item['id'] = i['id']
                item['title'] = i['displayName'].upper().encode('utf-8')
                item['plot'] = i['description'].encode('utf-8')
                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': 'telewizjadanet',
                    'next': ''
                }
                items.append(item)
                #control.log('XXXXXXXXX %s' % i)

            except:
                pass
        return items

    except Exception as e:
        control.log('Error telewizjada.chanels %s' % e)
        control.dialog.ok(
            control.addonInfo('name') + ' - Telewizjada.net',
            control.lang(30602).encode('utf-8'), '')
        return
Beispiel #35
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
Beispiel #36
0
def get(url, proxy=''):
    try:
        pl_proxy = control.setting('pl_proxy')
        pl_proxy_port = control.setting('pl_proxy_port')

        if getVideostarCredentialsInfo() == False:
            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')
            raise Exception()

        url = urlparse.urljoin('https://api.videostar.pl', url)
        if proxy == '':
            result = client.request(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(url, headers=headers, cookie=control.get_setting('videostar.sess'), proxy=myproxy)
        r = json.loads(result)

        if r['status'] =="error" or result==None:
            if r['errors'][0]['code'] == 1:
                login()
                control.sleep(500)
                mycookie = control.get_setting('videostar.sess')
                result = client.source(url, headers=headers, cookie=control.get_setting('videostar.sess'))

        return result
    except Exception as e:
        control.log('Error videostar.get %s' % e)
        pass
Beispiel #37
0
def getchanels():
    try:
        if getYoyCredentialsInfo() == False:
            if control.yesnoDialog(
                    control.lang(40004).encode('utf-8'),
                    control.lang(30481).encode('utf-8'), '', 'YOY',
                    control.lang(30483).encode('utf-8'),
                    control.lang(30482).encode('utf-8')):
                control.openSettings('2.5')
            raise Exception()
        login()
        items = []
        for j in range(1, 10):
            url = 'http://yoy.tv/channels?live=1&country=140&page=%s' % j
            result = client2.http_get(url)
            result = client.parseDOM(result,
                                     'a',
                                     attrs={'class': 'thumb-info team'})
            result = [(client.parseDOM(i, 'img', ret='src')[0],
                       client.parseDOM(i, 'img', ret='alt')[0])
                      for i in result]
            for i in result:
                item = {}
                item['id'] = i[0].replace('http://yoy.tv/channel/covers/',
                                          '').replace('.jpg?cache=32', '')
                control.log('Alina %s' % item['id'])

                item['id'] = item['id'].encode('utf-8')
                item['title'] = i[1].upper().encode('utf-8')

                items.append(item)
        return items
    except:
        #control.openSettings('6.1')
        control.log(
            'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
        )
Beispiel #38
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
Beispiel #39
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
Beispiel #40
0
    def search(self, query=None):
        #try:
            if query == None:
                t = control.lang(30201).encode('utf-8')
                k = control.keyboard('', t) ; k.doModal()
                self.query = k.getText() if k.isConfirmed() else None
            else:
                self.query = query

            if (self.query == None or self.query == ''): return


            url = self.search_link % (urllib.quote_plus(self.query))
            self.list = cache.get(self.trakt_list, 0, url, self.trakt_user)

            self.worker()
            self.movieDirectory(self.list)
            return self.list
Beispiel #41
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
Beispiel #42
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)
Beispiel #43
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
Beispiel #44
0
    def getVideoInfo(self, content, name, year, imdb, tvdb):
        try:
            self.loadingTime = time.time()
            self.totalTime = 0 ; self.currentTime = 0
            self.folderPath = control.infoLabel('Container.FolderPath')
            self.name = name ; self.year = year ; self.content = content
            self.file = self.name + '.strm'
            self.file = self.file.translate(None, '\/:*?"<>|').strip('.')
            self.imdb = 'tt' + imdb if imdb.isdigit() else imdb
            self.tvdb = tvdb if not tvdb == None else '0'
        except:
            pass

        try:
            if self.content == 'movie':
                self.title = re.compile('(.+?) [(]\d{4}[)]$').findall(self.name)[0]
            elif self.content == 'episode':
                self.tvshowtitle, self.season, self.episode = re.compile('(.+?) S(\d*)E(\d*)$').findall(self.name)[0]
                self.season, self.episode = '%01d' % int(self.season), '%01d' % int(self.episode)
                self.file2 = '%s (%s) S%02dE%02d.strm' % (self.tvshowtitle.translate(None, '\/:*?"<>|'), self.year, int(self.season), int(self.episode))
        except:
            pass

        try:
            if control.setting('resume_playback') == 'true':
                self.offset = bookmarks.getBookmark(self.name, self.imdb)
                if self.offset == '0': raise Exception()

                minutes, seconds = divmod(float(self.offset), 60) ; hours, minutes = divmod(minutes, 60)
                yes = control.yesnoDialog('%s %02d:%02d:%02d' % (control.lang(30461).encode('utf-8'), hours, minutes, seconds), '', '', self.name, control.lang(30463).encode('utf-8'), control.lang(30462).encode('utf-8'))

                if yes: self.offset = '0'
        except:
            pass

        try:
            if self.content == 'movie':
                control.window.setProperty('script.trakt.ids', json.dumps({'imdb': self.imdb}))
            elif self.content == 'episode':
                control.window.setProperty('script.trakt.ids', json.dumps({'tvdb': self.tvdb}))
        except:
            pass
Beispiel #45
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
Beispiel #46
0
def chanels():
    adult = control.get_setting('xxxmode')

    #if login() == False:
    #    control.log('Błędny login')
    #    raise ValueError('Błędny login')
    url = 'http://www.telewizjada.net/get_channels_cache.php'
    items = []
    try:
        result = client.request(url)
        result = json.loads(result)

        for i in result['channels']:
            try:
                if adult == 'false':
                    if i['isAdult'] == 1:
                        control.log('Adult telewizjada.chanels %s' % i['displayName'])
                        raise ValueError('Adult channel %s' % i['displayName'])
                item={}
                item['img'] =  urlparse.urljoin(base_url, i['bigThumb']).encode('utf-8')
                item['id'] = i['id']
                item['title'] = control.trans(i['displayName'].upper().encode("utf-8"))
                item['plot'] = i['description'].encode('utf-8')
                item = {'title': item['title'],  'genre': '0', 'plot': item['plot'],
                        'name': item['title'], 'tagline': '0', 'poster': item['img'], 'fanart': '0', 'id': item['id'],
                        'service': 'telewizjadanet', 'next': ''}
                items.append(item)
                #control.log('XXXXXXXXX %s' % i)

            except:
                pass
        return items

    except Exception as e:
        control.log('Error telewizjada.chanels %s' % e)
        control.dialog.ok(control.addonInfo('name') + ' - Telewizjada.net', control.lang(30602).encode('utf-8'), '')
        return
Beispiel #47
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)
Beispiel #48
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
Beispiel #49
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
Beispiel #50
0
    def getSources(self, name, title, year, imdb, tmdb, tvdb, service, season, episode, tvshowtitle, alter, date):
        sourceDict = []
        for package, name, is_pkg in pkgutil.walk_packages(__path__):
            sourceDict.append((name, is_pkg))
        sourceDict = [i[0] for i in sourceDict if i[1] == False]

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


        if content == 'movie':
            sourceDict = [i for i in sourceDict if i.endswith(('_mv', '_mv_tv'))]
            try: sourceDict = [(i, control.setting(re.sub('_mv_tv$|_mv$|_tv$', '', i))) for i in sourceDict]
            except: sourceDict = [(i, 'true') for i in sourceDict]
        else:
            sourceDict = [i for i in sourceDict if i.endswith(('_tv', '_mv_tv'))]
            try: sourceDict = [(i, control.setting(re.sub('_mv_tv$|_mv$|_tv$', '', i) + '_tv')) for i in sourceDict]
            except: sourceDict = [(i, 'true') for i in sourceDict]

        threads = []

        control.makeFile(control.dataPath)
        self.sourceFile = control.sourcescacheFile

        sourceDict = [i[0] for i in sourceDict if i[1] == 'true']

        if content == 'movie':
            title = cleantitle.normalize(title)
            for source in sourceDict: threads.append(workers.Thread(self.getMovieSource, title, year, imdb, re.sub('_mv_tv$|_mv$|_tv$', '', source), __import__(source, globals(), locals(), [], -1).source()))
        else:
            tvshowtitle = cleantitle.normalize(tvshowtitle)
            season, episode = alterepisode.alterepisode().get(imdb, tmdb, tvdb, service, season, episode, alter, title, date)
            for source in sourceDict: threads.append(workers.Thread(self.getEpisodeSource, title, year, imdb, tvdb, season, episode, tvshowtitle, date, re.sub('_mv_tv$|_mv$|_tv$', '', source), __import__(source, globals(), locals(), [], -1).source()))


        try: timeout = int(control.setting('sources_timeout_40'))
        except: timeout = 40

        [i.start() for i in threads]

        control.idle()

        sourceLabel = [re.sub('_mv_tv$|_mv$|_tv$', '', i) for i in sourceDict]
        sourceLabel = [re.sub('v\d+$', '', i).upper() for i in sourceLabel]


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

        string1 = control.lang(30512).encode('utf-8')
        string2 = control.lang(30513).encode('utf-8')
        string3 = control.lang(30514).encode('utf-8')

        for i in range(0, timeout * 2):
            try:
                if xbmc.abortRequested == True: return sys.exit()

                try: info = [sourceLabel[int(re.sub('[^0-9]', '', str(x.getName()))) - 1] for x in threads if x.is_alive() == True]
                except: info = []

                if len(info) > 5: info = len(info)

                self.progressDialog.update(int((100 / float(len(threads))) * len([x for x in threads if x.is_alive() == False])), str('%s: %s %s' % (string1, int(i * 0.5), string2)), str('%s: %s' % (string3, str(info).translate(None, "[]'"))))

                if self.progressDialog.iscanceled(): break

                is_alive = [x.is_alive() for x in threads]
                if all(x == False for x in is_alive): break
                time.sleep(0.5)
            except:
                pass

        self.progressDialog.close()

        return self.sources
Beispiel #51
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
Beispiel #52
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
Beispiel #53
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
Beispiel #54
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
Beispiel #55
0
    def sourcesDialog(self):
        try:
            sources = [{'label': '00 | [B]%s[/B]' % control.lang(30509).encode('utf-8').upper()}] + self.sources

            labels = [i['label'] for i in sources]

            select = control.selectDialog(labels)
            if select == 0: return self.sourcesDirect()
            if select == -1: return 'close://'

            items = [self.sources[select-1]]

            next = [y for x,y in enumerate(self.sources) if x >= select]
            prev = [y for x,y in enumerate(self.sources) if x < select][::-1]

            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:
                    if self.progressDialog.iscanceled(): break

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

                    self.selectedSource = items[i]['label']
                    self.progressDialog.close()

                    return self.url
                except:
                    pass

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

        except:
            try: self.progressDialog.close()
            except: pass
Beispiel #56
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
Beispiel #57
0
    def movieDirectory(self, items):
        if items == None or len(items) == 0: return

        isFolder = True if control.setting('autoplay') == 'false' and control.setting('host_select') == '1' else False
        isFolder = False if control.window.getProperty('PseudoTVRunning') == 'True' else isFolder

        playbackMenu = control.lang(30204).encode('utf-8') if control.setting('autoplay') == 'true' else control.lang(30203).encode('utf-8')

        cacheToDisc = False if not action == 'movieSearch' else True

        addonPoster, addonBanner = control.addonPoster(), control.addonBanner()
        addonFanart, settingFanart = control.addonFanart(), control.setting('fanart')
        sysaddon = sys.argv[0]

        #try:
        #    favitems = favourites.getFavourites('movies')
        #    favitems = [i[0] for i in favitems]
        #except:
        #    pass

        for i in items:
            try:
                label = i['name']

                sysname = urllib.quote_plus(label)
                systitle = urllib.quote_plus(i['title'])
                #imdb, tmdb, year = i['imdb'], i['tmdb'], i['year']
                service = i['service']

                poster, fanart = i['poster'], i['fanart']
                if poster == '0': poster = addonPoster

                meta = dict((k,v) for k, v in i.iteritems() if not v == '0')
                sysmeta = urllib.quote_plus(json.dumps(meta))

                url = '%s?action=play&name=%s&title=%s&service=%s&meta=%s&t=%s' % (sysaddon, sysname, systitle, service, sysmeta, self.systime)
                sysurl = urllib.quote_plus(url)

                #if isFolder == True:
                #    url = '%s?action=sources&name=%s&title=%s&meta=%s' % (sysaddon, sysname, systitle,sysmeta)

                #cm = []

                #cm.append((playbackMenu, 'RunPlugin(%s?action=alterSources&url=%s)' % (sysaddon, sysurl)))

                #cm.append((control.lang(30205).encode('utf-8'), 'Action(Info)'))

                """if not action == 'movieSearch':
                    cm.append((control.lang(30206).encode('utf-8'), 'RunPlugin(%s?action=moviePlaycount&title=%s&year=%s&imdb=%s&query=7)' % (sysaddon, systitle, year, imdb)))
                    cm.append((control.lang(30207).encode('utf-8'), 'RunPlugin(%s?action=moviePlaycount&title=%s&year=%s&imdb=%s&query=6)' % (sysaddon, systitle, year, imdb)))
                """
                #if action == 'tvFavourites':
                #    cm.append((control.lang(30210).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=movies)' % (sysaddon, sysmeta)))
                #else:
                #    cm.append((control.lang(30209).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&query=0&content=movies)' % (sysaddon, sysmeta)))
                """
                else:
                    a=1
                    #if not imdb in favitems: cm.append((control.lang(30209).encode('utf-8'), 'RunPlugin(%s?action=addFavourite&meta=%s&content=movies)' % (sysaddon, sysmeta)))
                    #else: cm.append((control.lang(30210).encode('utf-8'), 'RunPlugin(%s?action=deleteFavourite&meta=%s&content=movies)' % (sysaddon, sysmeta)))
                """
                #cm.append((control.lang(30211).encode('utf-8'), 'RunPlugin(%s?action=movieToLibrary&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s)' % (sysaddon, sysname, systitle,  service, sysmeta, self.systime)))

                #cm.append((control.lang(30212).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))

                item = control.item(label=label, iconImage=poster, thumbnailImage=poster)
                try: item.setArt({'poster': poster})
                except: pass

                if settingFanart == 'true' and not fanart == '0':

                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                #item.setInfo(type='Video', infoLabels = meta)
                item.setProperty('Video', 'true')
                #item.setProperty('IsPlayable', 'true')
                #item.addContextMenuItems(cm, replaceItems=True)
                control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=isFolder)

            except:
                pass

        try:
            url = items[0]['next']
            if url == '': raise Exception()
            url = '%s?action=movies&url=%s' % (sysaddon, urllib.quote_plus(url))
            addonNext = control.addonNext()
            item = control.item(label=control.lang(30213).encode('utf-8'), iconImage=addonNext, thumbnailImage=addonNext)
            item.addContextMenuItems([], replaceItems=False)
            if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
        except:
            pass


        control.content(int(sys.argv[1]), 'movies')
        control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc)
        views.setView('movies', {'skin.confluence': 500})