Ejemplo n.º 1
0
def get_stream(url):  # 4
    data = base64.b64decode(unquote(url))
    # xbmc.log('@#@DATAAAA:%s' % data, xbmc.LOGINFO)
    if b'info_outline' in data:
        control.infoDialog(
            "[COLOR gold]No Links available ATM.\n [COLOR lime]Try Again Later![/COLOR]",
            NAME, iconimage, 5000)
        return
    else:
        links = list(
            zip(client.parseDOM(str(data), 'a', ret='href'),
                client.parseDOM(str(data), 'a')))
        # xbmc.log('@#@STREAMMMMMSSSSSS:%s' % links, xbmc.LOGINFO)
        titles = []
        streams = []
        for link, title in links:
            streams.append(link)
            titles.append(title)

        if len(streams) > 1:
            dialog = xbmcgui.Dialog()
            ret = dialog.select('[COLORgold][B]Choose Stream[/B][/COLOR]',
                                titles)
            if ret == -1:
                return
            elif ret > -1:
                host = streams[ret]
                # xbmc.log('@#@STREAMMMMM:%s' % host, xbmc.LOGNOTICE)
                return resolve(host, name)
            else:
                return
        else:
            link = links[0][0]
            return resolve(link, name)
Ejemplo n.º 2
0
def resolve(name, url, iconimage, description):
    xbmc.log('URLLLL: {}'.format(url))
    if 'm3u8' in url:
        link = url
        link += '|User-Agent={}'.format(urllib.quote_plus(client.agent()))
        liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    else:
        url = base_url + url if url.startswith('/') else url
        info = client.request(url, headers=headers)
        head = client.parseDOM(info, 'title')[0].encode('utf-8')
        # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
        # name = '{0} - {1}'.format(head, title)
        poster = client.parseDOM(info,
                                 'meta',
                                 ret='content',
                                 attrs={'property': 'og:image'})[0]
        link = re.findall(r'''\,url:['"](.+?)['"]\}''', info, re.DOTALL)[0]
        link += '|User-Agent={}&Referer={}'.format(
            urllib.quote_plus(client.agent()), urllib.quote_plus(url))
        liz = xbmcgui.ListItem(head, iconImage=ICON, thumbnailImage=poster)

    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(str(link))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
Ejemplo n.º 3
0
def resolve(name, url, iconimage, description):
    host = url
    stream_url = evaluate(host)
    name = name.split(' [B]|')[0]
    try:
        liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable","true")
        liz.setPath(str(stream_url))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog("[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]", NAME, '')
Ejemplo n.º 4
0
def resolve(name, url, iconimage, description):
    # xbmc.log('URLLLL: {}'.format(url))
    if 'm3u8' in url:
        link = url
        link += '|User-Agent={}&Referer={}'.format(
            'iPad', quote_plus(headers['Referer']))
        liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    else:
        import requests
        url = base_url + url if url.startswith('/') else url
        # xbmc.log('URLLLL2: {}'.format(url))
        # cj = client.request(base_url, headers=headers, output='cookie')
        # xbmc.log('COOKIES: {}'.format(str(cj)))
        # headers['Cookie'] = cj
        info = requests.get(url, headers=headers).text
        info = six.ensure_str(info, encoding='utf-8')
        # xbmc.log('INFOOOO: {}'.format(info))
        head = client.parseDOM(info, 'title')[0]
        # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
        # name = '{0} - {1}'.format(head, title)
        poster = client.parseDOM(info,
                                 'meta',
                                 ret='content',
                                 attrs={'property': 'og:image'})[0]
        link = re.findall(r'''source:['"](.+?)['"]\,''', info, re.DOTALL)[0]
        link = "https://hd-auth.skylinewebcams.com/" + link.replace(
            'livee', 'live') if link.startswith('live') else link
        # xbmc.log('LINK: {}'.format(link))
        link += '|User-Agent=iPad&Referer={}'.format(BASEURL)
        if six.PY2:
            head = head.encode('utf-8')
            link = str(link)
        liz = xbmcgui.ListItem(head)
        liz.setArt({
            'icon': iconimage,
            'thumb': iconimage,
            'poster': poster,
            'fanart': fanart
        })

    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(link)
        # control.player.play(link, liz)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
Ejemplo n.º 5
0
def delete(dbfile=control.cacheFile, withyes=True):

    if withyes:

        yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')

        if not yes:
            return

    else:

        pass

    control.deleteFile(dbfile)

    control.infoDialog(control.lang(30402).encode('utf-8'))
Ejemplo n.º 6
0
def resolve(name, url, iconimage, description):
    url = BASEURL + url if url.startswith('/') else url
    info = client._basic_request(url, headers=headers)
    # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
    # name = '{0} - {1}'.format(head, title)
    #<div class="youtube-player" data-id="0Eeuqh9QfNI"></div>
    link_id = client.parseDOM(info,
                              'div',
                              ret='data-id',
                              attrs={'class': 'youtube-player'})[0]
    link = yout_vid.format(link_id)
    liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(link)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
Ejemplo n.º 7
0
def clear(table=None, withyes=True):

    try:
        control.idle()

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

        if withyes:

            try:
                yes = control.yesnoDialog(
                    control.lang(30401).encode('utf-8'), '', '')
            except BaseException:
                yes = control.yesnoDialog(control.lang(30401), '', '')

            if not yes:
                return

        else:

            pass

        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 BaseException:
                pass

        control.infoDialog(control.lang(30402).encode('utf-8'))
    except BaseException:
        pass
Ejemplo n.º 8
0
def download_media(url, path, file_name, progress=None):

    try:
        if progress is None:
            progress = int(control.setting('progress_dialog'))

        active = not progress == PROGRESS.OFF
        background = progress == PROGRESS.BACKGROUND

        with control.ProgressDialog(
                control.addonInfo('name'), control.lang(30500).format(file_name), background=background, active=active
        ) as pd:

            try:
                headers = dict([item.split('=') for item in (url.split('|')[1]).split('&')])
                for key in headers:
                    headers[key] = unquote(headers[key])
            except:
                headers = {}

            if 'User-Agent' not in headers:
                headers['User-Agent'] = randomagent()

            request = urllib2.Request(url.split('|')[0], headers=headers)
            response = urllib2.urlopen(request)

            if 'Content-Length' in response.info():
                content_length = int(response.info()['Content-Length'])
            else:
                content_length = 0

            file_name += '.' + get_extension(url, response)
            full_path = control.join(path, file_name)
            log_debug('Downloading: %s -> %s' % (url, full_path))

            path = control.transPath(control.legalfilename(path))

            try:
                control.makeFiles(path)
            except Exception as e:
                log_debug('Path Create Failed: %s (%s)' % (e, path))

            from os import sep

            if not path.endswith(sep):
                path += sep
            if not control.exists(path):
                raise Exception('Failed to create dir')

            file_desc = control.openFile(full_path, 'w')
            total_len = 0
            cancel = False
            while 1:
                data = response.read(512 * 1024)
                if not data:
                    break

                if pd.is_canceled():
                    cancel = True
                    break

                total_len += len(data)
                if not file_desc.write(data):
                    raise Exception('Failed to write file')

                percent_progress = total_len * 100 / content_length if content_length > 0 else 0
                log_debug('Position : {0} / {1} = {2}%'.format(total_len, content_length, percent_progress))
                pd.update(percent_progress)

            file_desc.close()

        if not cancel:
            control.infoDialog(control.lang(30501).format(file_name))
            log_debug('Download Complete: {0} -> {1}'.format(url, full_path))

    except Exception as e:
        log_debug('Error ({0}) during download: {1} -> {2}'.format(str(e), url, file_name))
        control.infoDialog(control.lang(30502).format(str(e), file_name))
Ejemplo n.º 9
0
    def run(self, query=None):

        if not 'Greek' in str(langs).split(','):
            control.directory(syshandle)
            control.infoDialog(control.lang(32002).encode('utf-8'))
            return

        if query is None:
            if control.condVisibility('Player.HasVideo'):
                title = control.infoLabel('VideoPlayer.Title')

                if re.search(r'[^\x00-\x7F]+', title) is not None:
                    title = control.infoLabel('VideoPlayer.OriginalTitle')
                year = control.infoLabel('VideoPlayer.Year')

                tvshowtitle = control.infoLabel('VideoPlayer.TVshowtitle')

                season = control.infoLabel('VideoPlayer.Season')

                episode = control.infoLabel('VideoPlayer.Episode')
                try:
                    imdb = control.infoLabel('VideoPlayer.IMDBNumber')
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'
            else:
                title = xbmc.getInfoLabel("ListItem.OriginalTitle")
                year = xbmc.getInfoLabel("ListItem.Year")
                tvshowtitle = xbmc.getInfoLabel("ListItem.TVShowTitle")
                season = xbmc.getInfoLabel("ListItem.Season")
                episode = xbmc.getInfoLabel("ListItem.Episode")
                #labelType = xbmc.getInfoLabel("ListItem.DBTYPE")
                try:
                    imdb = control.infoLabel('ListItem.IMDBNumber')
                    # xbmc.log('$#$QUERY-NONE-IMDB: %s' % imdb, xbmc.LOGNOTICE)
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'

            if 's' in episode.lower():
                season, episode = '0', episode[-1:]

            if not tvshowtitle == '':  # episode
                query = '%s S%02dE%02d/imdb=%s' % (tvshowtitle, int(season),
                                                   int(episode), str(imdb))

            elif not year == '':  # movie
                query = '%s (%s)/imdb=%s' % (title, year, str(imdb))

            elif '(S' in title:
                query = '%s/imdb=%s' % (title, str(imdb))

            else:  # file
                query, year = getCleanMovieTitle(title)
                if not year == '':
                    query = '%s (%s)/imdb=%s' % (query, year, str(imdb))
            # xbmc.log('$#$QUERY-NONE-FINAL: %s' % query, xbmc.LOGNOTICE)

        else:
            query = '%s/imdb=0' % re.sub('[\(|\)]', '', query)
            # xbmc.log('$#$QUERY-ELSE: %s' % query, xbmc.LOGNOTICE)

        self.query = query
        # xbmc.log('$#$QUERY: %s' % query, xbmc.LOGNOTICE)

        threads = []
        if control.setting('provider.subztv.club'):
            threads.append(workers.Thread(self.subztv))
        if control.setting('provider.s4f'):
            threads.append(workers.Thread(self.s4f))
        if control.setting('provider.yifi'):
            threads.append(workers.Thread(self.yifi))

        [i.start() for i in threads]
        [i.join() for i in threads]

        f = []

        f += [i for i in self.list if i['source'] == 'subztv']

        f += [i for i in self.list if i['source'] == 's4f']

        f += [i for i in self.list if i['source'] == 'yifi']

        self.list = sorted(f, key=lambda k: k['rating'], reverse=True)

        for i in self.list:

            try:

                if i['source'] == 'subztv':
                    i['name'] = '[subztv] %s' % i['name']

                elif i['source'] == 's4f':
                    i['name'] = '[S4F] %s' % i['name']

                elif i['source'] == 'yifi':
                    i['name'] = '[yifi] %s' % i['name']
            except BaseException:
                pass

        for i in self.list:

            try:
                name, url, source, rating = i['name'], i['url'], i[
                    'source'], i['rating']

                u = {'action': 'download', 'url': url, 'source': source}
                u = '%s?%s' % (sysaddon, urllib.urlencode(u))

                item = control.item(label='Greek',
                                    label2=name,
                                    iconImage=str(rating),
                                    thumbnailImage='el')
                item.setProperty('sync', 'false')
                item.setProperty('hearing_imp', 'false')

                control.addItem(handle=syshandle,
                                url=u,
                                listitem=item,
                                isFolder=False)
            except BaseException:
                pass

        control.directory(syshandle)
Ejemplo n.º 10
0
    def run(self, query=None):

        if not 'Greek' in str(langs).split(','):
            control.directory(syshandle)
            control.infoDialog(control.lang(32002).encode('utf-8'))
            return

        if query is None:

            title = control.infoLabel('VideoPlayer.Title')

            if re.search(r'[^\x00-\x7F]+', title) is not None:
                title = control.infoLabel('VideoPlayer.OriginalTitle')

            year = control.infoLabel('VideoPlayer.Year')

            tvshowtitle = control.infoLabel('VideoPlayer.TVshowtitle')

            season = control.infoLabel('VideoPlayer.Season')

            episode = control.infoLabel('VideoPlayer.Episode')
            try:
                imdb = control.infoLabel('VideoPlayer.IMDBNumber')
            except:
                imdb = '0'

            if 's' in episode.lower():
                season, episode = '0', episode[-1:]

            if not tvshowtitle == '':  # episode
                query = '%s S%02dE%02d/imdb=%s' % (tvshowtitle, int(season),
                                                   int(episode), imdb)
            elif not year == '':  # movie
                query = '%s (%s)/imdb=%s' % (title, year, imdb)
            else:  # file
                query, year = getCleanMovieTitle(title)
                if not year == '':
                    query = '%s (%s)' % (query, year)

        self.query = query

        threads = []

        threads.append(workers.Thread(self.subztv))
        threads.append(workers.Thread(self.s4f))
        threads.append(workers.Thread(self.yifi))

        [i.start() for i in threads]

        for i in range(0, 10 * 2):
            try:
                is_alive = [x.is_alive() for x in threads]
                if all(x is False for x in is_alive):
                    break
                if control.aborted is True:
                    break
                control.sleep(500)
            except:
                pass

        if len(self.list) == 0:
            control.directory(syshandle)
            return

        f = []

        f += [i for i in self.list if i['source'] == 'subztv']
        f += [i for i in self.list if i['source'] == 's4f']
        f += [i for i in self.list if i['source'] == 'yifi']

        self.list = sorted(f, key=lambda k: k['rating'], reverse=True)

        for i in self.list:

            try:

                if i['source'] == 'subztv':
                    i['name'] = '[subztv] %s' % i['name']

                elif i['source'] == 's4f':
                    i['name'] = '[S4F] %s' % i['name']

                elif i['source'] == 'yifi':
                    i['name'] = '[yifi] %s' % i['name']
            except:
                pass

        for i in self.list:

            try:
                name, url, source, rating = i['name'], i['url'], i[
                    'source'], i['rating']

                u = {'action': 'download', 'url': url, 'source': source}
                u = '%s?%s' % (sysaddon, urllib.urlencode(u))

                item = control.item(label='Greek',
                                    label2=name,
                                    iconImage=str(rating),
                                    thumbnailImage='el')
                item.setProperty('sync', 'false')
                item.setProperty('hearing_imp', 'false')

                control.addItem(handle=syshandle,
                                url=u,
                                listitem=item,
                                isFolder=False)
            except:
                pass

        control.directory(syshandle)
Ejemplo n.º 11
0
    def run(self, query=None):

        if not 'Greek' in str(langs).split(','):
            control.directory(syshandle)
            control.infoDialog(control.lang(32002).encode('utf-8'))
            return

        if control.kodi_version() >= 18.0 and not\
                control.conditional_visibility('System.HasAddon(vfs.libarchive)')\
                and not (control.condVisibility('System.Platform.Linux')):
            control.execute('InstallAddon(vfs.libarchive)')

        if not control.conditional_visibility(
                'System.HasAddon(script.module.futures)') and six.PY2:
            if 17.0 <= control.kodi_version() <= 18.9:
                control.execute('InstallAddon(script.module.futures)')
                control.sleep(1500)

        if query:
            query = '{}/imdb=0'.format(re.sub(r'[\(|\)]', '', query))
            # xbmc.log('$#$QUERY-ELSE: %s' % query, xbmc.LOGINFO)
        else:
            if control.condVisibility('Player.HasVideo'):
                title = control.infoLabel('VideoPlayer.Title')

                if re.search(r'[^\x00-\x7F]+', title) is not None:
                    title = control.infoLabel('VideoPlayer.OriginalTitle')
                year = control.infoLabel('VideoPlayer.Year')

                tvshowtitle = control.infoLabel('VideoPlayer.TVshowtitle')

                season = control.infoLabel('VideoPlayer.Season')

                episode = control.infoLabel('VideoPlayer.Episode')
                try:
                    imdb = control.infoLabel('VideoPlayer.IMDBNumber')
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'
            else:
                title = xbmc.getInfoLabel("ListItem.OriginalTitle")
                year = xbmc.getInfoLabel("ListItem.Year")
                tvshowtitle = xbmc.getInfoLabel("ListItem.TVShowTitle")
                season = xbmc.getInfoLabel("ListItem.Season")
                episode = xbmc.getInfoLabel("ListItem.Episode")
                #labelType = xbmc.getInfoLabel("ListItem.DBTYPE")
                try:
                    imdb = control.infoLabel('ListItem.IMDBNumber')
                    # xbmc.log('$#$QUERY-NONE-IMDB: %s' % imdb, xbmc.LOGNOTICE)
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'

            if 's' in episode.lower():
                season, episode = '0', episode[-1:]

            if not tvshowtitle == '':  # episode
                query = '%s S%02dE%02d/imdb=%s' % (tvshowtitle, int(season),
                                                   int(episode), str(imdb))

            elif not year == '':  # movie
                query = '%s (%s)/imdb=%s' % (title, year, str(imdb))

            elif '(S' in title:
                query = '%s/imdb=%s' % (title, str(imdb))

            else:  # file
                query, year = getCleanMovieTitle(title)
                if not year == '':
                    query = '{} ({})/imdb={}'.format(query, year, str(imdb))

        self.query = six.ensure_str(query, encoding='utf-8')

        with concurrent.futures.ThreadPoolExecutor(5) as executor:
            query = self.query
            threads = [
                executor.submit(self.subztv, query),
                executor.submit(self.s4f, query),
                executor.submit(self.yifi, query)
            ]

            for future in concurrent.futures.as_completed(threads):

                item = future.result()

                if not item:
                    continue

                self.list.extend(item)
        # threads = []
        # if control.setting('provider.subztv.club'):
        #     threads.append(workers.Thread(self.subztv))
        # xbmc.log('$#$THREAD1: %s' % threads)
        # if control.setting('provider.s4f'):
        #     threads.append(workers.Thread(self.s4f))
        # xbmc.log('$#$THREAD2: %s' % threads)
        # if control.setting('provider.yifi'):
        #     threads.append(workers.Thread(self.yifi))
        # xbmc.log('$#$THREAD3: %s' % threads)
        #
        # [i.start() for i in threads]
        # [i.join() for i in threads]
        self.list = [i for i in self.list if i]

        f = []

        f += [i for i in self.list if i['source'] == 'subztv']

        f += [i for i in self.list if i['source'] == 's4f']

        f += [i for i in self.list if i['source'] == 'yifi']

        self.list = sorted(f, key=lambda k: k['rating'], reverse=True)
        for i in self.list:
            try:

                if i['source'] == 'subztv':
                    i['name'] = u'[SUBZ] {0}'.format(i['name'])

                elif i['source'] == 's4f':
                    i['name'] = u'[S4F] {0}'.format(i['name'])

                elif i['source'] == 'yifi':
                    i['name'] = u'[YIFI] {0}'.format(i['name'])
            except BaseException:
                pass

        for i in self.list:
            try:
                u = {
                    'action': 'download',
                    'url': i['url'],
                    'source': i['source']
                }
                u = '{0}?{1}'.format(sysaddon, urlencode(u))
                item = control.item(label='Greek', label2=i['name'])
                item.setArt({'icon': str(i['rating'])[:1], 'thumb': 'el'})
                item.setProperty('hearing_imp', 'false')
                control.addItem(handle=syshandle,
                                url=u,
                                listitem=item,
                                isFolder=False)
            except BaseException:
                pass

        control.directory(syshandle)