Пример #1
0
    def play(self, url, query=None, resolved_mode=True):

        if url in [self.live_link_cy, self.live_link_gr]:

            title = 'Alpha'
            icon = control.icon()

        elif query:

            title = query
            icon = control.addonmedia('news.png')

        else:

            title = None
            icon = None

        stream = self.resolve(url)
        meta = {'title': title}
        dash = 'm3u8' in stream and control.kodi_version() >= 18.0

        directory.resolve(
            url=stream, meta=meta, dash=dash, icon=icon,
            mimetype='application/vnd.apple.mpegurl' if '.m3u8' in stream else None,
            manifest_type='hls' if '.m3u8' in stream else None, resolved_mode=resolved_mode
        )
Пример #2
0
    def event(self, url):

        html = client.request(url)

        event_id = client.parseDOM(html, 'div', attrs={'id': 'event_id'})[0]
        teama_id = client.parseDOM(html, 'div', attrs={'id': 'teama_id'})[0]
        teamb_id = client.parseDOM(html, 'div', attrs={'id': 'teamb_id'})[0]

        items = client.request(self.event_link.format(event=event_id, team_a=teama_id, team_b=teamb_id), output='json')

        videos = [i for i in items if ('Has_Videos' in i and i['Has_Videos']) or ('MediaType' in i and i['MediaType'] == 'video')]

        for video in videos:

            title = client.replaceHTMLCodes(video['Title'])

            try:
                image = video['ImageLowQuality']
                if image:
                    image = ''.join([self.base_link, image])
                else:
                    image = control.icon()
                fanart = video['Image']
                if fanart:
                    fanart = ''.join([self.base_link, fanart])
                else:
                    fanart = None
            except KeyError:
                image = video['Image']
                if image:
                    image = ''.join([self.base_link, image])
                else:
                    image = control.icon()
                fanart = None

            url = ''.join([self.base_link, video['Link']])

            data = {'title': title, 'image': image, 'url': url, 'action': 'play', 'isFolder': 'False'}

            if fanart:
                data.update({'fanart': fanart})

            self.list.append(data)

        directory.add(self.list)
Пример #3
0
    def play(self, url):

        resolved = self.resolve(url)

        if 'youtu' in resolved:
            resolved = self.yt_session(resolved)

        if isinstance(resolved, tuple):

            stream, plot = resolved
            meta = {'plot': plot}

        else:

            stream = resolved
            meta = None

        icon = None

        if url == self.live_link:

            icon = {
                'poster': control.icon(),
                'icon': control.icon(),
                'thumb': control.icon()
            }

        dash = ('dash' in stream or '.mpd' in stream
                or 'm3u8' in stream) and control.kodi_version() >= 18.0

        directory.resolve(url=stream,
                          meta=meta,
                          dash=dash,
                          icon=icon,
                          mimetype='application/vnd.apple.mpegurl'
                          if 'm3u8' in stream else None,
                          manifest_type='hls' if '.m3u8' in stream else None)
Пример #4
0
    def play(self, url):

        resolved = self.resolve(url)

        if 'youtu' in resolved:
            resolved = self.yt_session(resolved)

        if isinstance(resolved, tuple):

            stream, plot = resolved
            meta = {'plot': plot}

        else:

            stream = resolved
            meta = None

        icon = None

        if url == self.radio_link:

            meta = {'title': 'Skai Radio 100.3FM'}

        elif url == self.live_link:

            meta = {'title': 'Skai Live TV'}
            icon = control.icon()

        dash = ('dash' in stream or '.mpd' in stream
                or 'm3u8' in stream) and control.kodi_version() >= 18.0

        directory.resolve(url=stream,
                          meta=meta,
                          dash=dash,
                          icon=icon,
                          mimetype='application/vnd.apple.mpegurl'
                          if 'm3u8' in stream else None,
                          manifest_type='hls' if '.m3u8' in stream else None)
def video_list(url):

    html = client.request(url)

    next_url = [i.attributes for i in itertags(html, 'a') if 'WRC' in i.attributes.get('onclick', '')][-1]['onclick']
    next_url = ''.join([VIDEOS_BASE, next_url.replace('getdata("', '').replace('","WRC")', '')])

    items = [i.text for i in itertags(html, 'article')]

    self_list = []

    for item in items:

        title = client.parseDOM(item, 'h3')[0]
        try:
            image = client.parseDOM(item, 'img', ret='src')[0]
        except IndexError:
            image = control.icon()
        url = client.parseDOM(item, 'a', ret='href')[0]
        url = ''.join([VIDEOS_BASE, url])
        self_list.append({'title': title, 'url': url, 'image': image, 'next': next_url})

    return self_list
Пример #6
0
    def episodes_list_cy(self, url, title, image):

        if title:
            try:
                title = title.decode('utf-8')
                title = title.partition('|')[0]
            except Exception:
                title = title.partition('|')[0]

        if url.startswith(self.views_ajax):

            html = client.request(url.partition('#')[0], post=url.partition('#')[2])
            _json = json.loads(html)
            html = _json[4]['data']
            view_path = dict(parse_qsl(url.partition('#')[2]))['view_path']
            view_args = dict(parse_qsl(url.partition('#')[2]))['view_args']
            page = str(int(dict(parse_qsl(url.partition('#')[2]))['page']) + 1)

        else:

            html = client.request(url)
            view_path = urlparse(url).path
            view_args = '/'.join(view_path.split('/')[2:4])
            page = '1'

        next_link = '#'.join(
            [self.views_ajax, self.ajax_post_episodes.format(view_args=view_args, view_path=view_path, page=page)]
        )

        try:

            items = [i for i in client.parseDOM(html, 'div', {'class': 'box'}) if 'play-big' in i]

            if not items:
                raise Exception

            for item in items:
                itemtitle = client.parseDOM(item, 'a')[-1]
                if title:
                    label = ' - '.join([title, itemtitle])
                else:
                    label = itemtitle
                url = client.parseDOM(item, 'a', ret='href')[0]
                url = urljoin(self.basecy_link, url)
                image = client.parseDOM(item, 'img', ret='src')[0]

                data = {'title': label, 'image': image, 'url': url, 'next': next_link}

                if title:
                    data.update({'name': title})

                self.list.append(data)

        except Exception:

            self.list = [
                {
                    'title': u' - '.join([title, control.lang(30014)]),
                    'action': 'back',
                    'image': image,
                    'isFolder': 'False', 'isPlayable': 'False'
                }
                ,
                {
                    'title': control.lang(30013),
                    'action': 'back',
                    'image': control.icon(),
                    'isFolder': 'False', 'isPlayable': 'False'
                }
            ]

        return self.list
Пример #7
0
# -*- coding: utf-8 -*-
'''
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import json
from tulip import directory, client, control

html = client.request('https://www.tvopen.gr/templates/data/LiveDetails')

stream = json.loads(html)['stream']

directory.resolve(stream,
                  meta={'title': 'Open TV Live'},
                  icon=control.icon(),
                  resolved_mode=False)
Пример #8
0
    def items_list(self, url):

        if '/api/v1' not in url:

            html = client.request(url)

            if 'web-tv' in url:

                if url.endswith('roi'):

                    urls = [
                        self.sports_latest_link.format(range_id=i) for i in list(
                            range(0, int(control.setting('pages_size')) + 1)
                        )
                    ]

                else:

                    json_id = client.parseDOM(html, 'div', attrs={'class': 'web-tv-container-.+'}, ret='class')[0]
                    json_id = re.search(r'(\d+)', json_id).group(1)
                    type_ = client.parseDOM(html, 'div', attrs={'class': 'vocabulary hidden'})[0]

                    urls = [
                        self.sports_link.format(type=type_, sport_id=json_id, range_id=i) for i in
                        list(range(0, int(control.setting('pages_size')) + 1))
                    ]

            else:

                try:
                    event_id = client.parseDOM(html, 'div', attrs={'id': 'event_id'})[0]
                    type_ = 'event'
                except IndexError:
                    event_id = client.parseDOM(html, 'div', attrs={'id': 'video-list-term-id'})[0]
                    type_ = 'team'

                urls = [
                    self.index_link.format(type=type_, event_id=event_id, page=i) for i in
                    list(range(0, int(control.setting('pages_size')) + 1))
                ]

            for url in urls:

                _json = client.request(url, output='json')
                sleep(0.1)
                items = _json['Items']

                self.data.extend(items)

        else:

            self.data = client.request(url, output='json')

        for r in self.data:

            try:
                title = client.replaceHTMLCodes(r['Title'])
            except KeyError:
                continue

            if 'Is_Live' in r:
                title = '[CR]'.join([title, r['Live_From']])

            try:
                plot = client.replaceHTMLCodes(r['Short_Desc'])
            except TypeError:
                plot = control.lang(30011)
            urls = r['VideoUrl']

            for u in urls:

                data = {'title': title, 'plot': plot}

                image = r.get('Image')

                if image:
                    image = ''.join([self.base_link, image])
                    data.update({'image': image})
                else:
                    data.update({'icon': control.icon()})

                url = u['uri']

                data.update({'url': url})

                self.list.append(data)

        return self.list