Beispiel #1
0
def play(url):

    stream = router(url)

    dash = ('.mpd' in stream or 'dash' in stream or '.ism' in stream
            or '.hls' in stream)

    if dash:

        if '.hls' in stream:
            manifest_type = 'hls'
        elif '.ism' in stream:
            manifest_type = 'ism'
        else:
            manifest_type = 'mpd'

        log_debug('Activating MPEG-DASH for this url: ' + stream)

    else:
        manifest_type = ''

    try:

        if '.mpd' in stream:

            directory.resolve(stream, dash=dash, manifest_type=manifest_type)

        else:

            directory.resolve(stream)

    except:

        pass
Beispiel #2
0
def play(url):

    try:
        addon_enabled = control.addon_details('inputstream.adaptive').get(
            'enabled')
    except KeyError:
        addon_enabled = False

    mimetype = None
    manifest_type = None

    leia_plus = control.kodi_version() >= 18.0

    stream = resolve(url)

    if '.m3u8' in stream:

        manifest_type = 'hls'
        mimetype = 'application/vnd.apple.mpegurl'

    elif '.mpd' in stream:

        manifest_type = 'mpd'

    dash = addon_enabled and ('.m3u8' in stream or '.mpd' in stream)

    directory.resolve(stream,
                      dash=dash and leia_plus,
                      mimetype=mimetype,
                      manifest_type=manifest_type)
Beispiel #3
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
        )
Beispiel #4
0
    def play(self, name, url=None, as_script=True, append_string=''):

        try:

            url = self.worker(name, url, append_string)
            if url is None:
                return

            title = control.infoLabel('listitem.title')
            if title == '':
                title = control.infoLabel('listitem.label')
            icon = control.infoLabel('listitem.icon')

            item = control.item(path=url, iconImage=icon, thumbnailImage=icon)

            try:
                item.setArt({'icon': icon})
            except Exception:
                pass

            item.setInfo(type='Video', infoLabels={'title': title})

            if as_script:
                control.player.play(url, item)
            else:
                directory.resolve(url, meta={'title': title}, icon=icon)

        except Exception:

            pass
    def playback(resolved_mode=True):

        stream = router(link)

        if stream == link and not skip_question:

            yesno = control.yesnoDialog(control.lang(30125),
                                        yeslabel=control.lang(30126),
                                        nolabel=control.lang(30127))

            if not yesno:

                control.open_web_browser(stream)
                return close_all()

        dash = '.mpd' in stream or 'dash' in stream

        if title and image:
            directory.resolve(stream,
                              dash=dash,
                              icon=image,
                              meta={'title': title},
                              resolved_mode=resolved_mode)
        else:
            directory.resolve(stream, dash=dash, resolved_mode=resolved_mode)
def play(url):

    if not any(['.m3u8' in url, '.mpd' in url, 'radiostreaming' in url]):
        url = resolve(url)

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

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

    if meta:

        control.busy()

    stream = resolver(url, quality)

    try:
        isa_enabled = control.addon_details('inputstream.adaptive').get(
            'enabled')
    except KeyError:
        isa_enabled = False

    dash = ('.mpd' in stream or 'dash' in stream or '.ism' in stream
            or '.hls' in stream or '.m3u8' in stream) and isa_enabled

    mimetype = None

    if isinstance(meta, dict):

        control.idle()

        if meta['title'] == 'custom':

            title = control.inputDialog()

            meta['title'] = title

    if dash and control.setting('disable_mpd') == 'false':

        if '.hls' in stream or 'm3u8' in stream:
            manifest_type = 'hls'
            mimetype = 'application/vnd.apple.mpegurl'
        elif '.ism' in stream:
            manifest_type = 'ism'
        else:
            manifest_type = 'mpd'

        log_debug('Activating MPEG-DASH for this url: ' + stream)

        directory.resolve(stream,
                          meta=meta,
                          dash=dash,
                          manifest_type=manifest_type,
                          mimetype=mimetype,
                          resolved_mode=meta is None)

    else:

        directory.resolve(stream, meta=meta, resolved_mode=meta is None)
def play(url):

    if url.isdigit():

        resolved = resolve(url)

        if resolved is None:
            return

        title, url, image = resolved

        directory.resolve(url, {'title': title}, image)

    else:

        directory.resolve(url)
Beispiel #9
0
    def play(self, url):

        if control.setting('debug') == 'false':
            stream = cache.get(self.resolve, 96, url)
        else:
            stream = self.resolve(url)

        if stream is None:
            return

        m3u8_dash = 'm3u8' in stream and control.kodi_version() >= 18.0

        directory.resolve(
            stream, dash=any(['.mpd' in stream, m3u8_dash]),
            mimetype='application/vnd.apple.mpegurl' if m3u8_dash else None,
            manifest_type='hls' if m3u8_dash else None
        )
def play(url):

    if '.m3u8' not in url:
        url = resolve(url)

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

    meta = None

    if url == LIVE_LINK:
        meta = {'title': 'ANT1'}

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

    if meta:

        control.busy()

    stream = router(url)

    if isinstance(meta, dict):

        control.idle()

        if meta['title'] == 'custom':

            title = control.inputDialog()

            meta['title'] = title

    directory.resolve(stream, meta=meta, resolved_mode=meta is None)
Beispiel #12
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)
Beispiel #13
0
    def play(self, url):

        if '.mp4' in url or '.m3u8' in url:

            stream = url

        else:

            html = client.request(url)

            stream = re.search("video/mp4.+?'(.+?)'", html, re.S).group(1)

        try:
            addon_enabled = control.addon_details('inputstream.adaptive').get('enabled')
        except KeyError:
            addon_enabled = False

        dash = '.m3u8' in url and control.kodi_version() >= 18.0 and addon_enabled and control.setting('hls_dash') == 'true'

        if dash:
            directory.resolve(stream, dash=dash, mimetype='application/vnd.apple.mpegurl', manifest_type='hls')
        else:
            directory.resolve(stream)
Beispiel #14
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)
Beispiel #15
0
    def live(self):

        lang = 'www' if self.lang == 'en' else self.lang

        stream = self.resolve_live(lang=lang)

        if control.setting('quality_live') == '2' and int(
                control.infoLabel('System.AddonVersion({0})'.format('xbmc.python')).replace('.', '')
        ) >= 2260:

            dash = True
            manifest_type = 'hls'
            mimetype= 'application/vnd.apple.mpegurl'

        else:

            dash = False
            manifest_type = None
            mimetype = None

        directory.resolve(
            stream, meta={'title': 'Euronews'}, dash=dash, manifest_type=manifest_type,
            mimetype=mimetype
        )
    def live(self):

        lang = 'www' if self.lang == 'en' else self.lang

        stream = self.resolve_live(lang=lang)

        if control.setting(
                'quality_live') == '2' and control.kodi_version() >= 18.0:

            dash = True
            manifest_type = 'hls'
            mimetype = 'application/vnd.apple.mpegurl'

        else:

            dash = False
            manifest_type = None
            mimetype = None

        directory.resolve(stream,
                          meta={'title': 'Euronews'},
                          dash=dash,
                          manifest_type=manifest_type,
                          mimetype=mimetype)
Beispiel #17
0
        f.close()


if action is None:

    main_menu()

elif action == 'live':

    constructor(lc)

elif action == 'radio':

    constructor(rc)

elif action == 'play':

    directory.resolve(url)

elif action == 'guide':

    guide()

elif action == 'settings':

    control.openSettings()

if __name__ == '__main__':

    keys_registration()
 def live(self):
     directory.resolve(self.resolve_live(), meta={'title': 'ANT1'})
Beispiel #19
0
    def play(self, url):

        directory.resolve(self.resolve(url, self.lang))
def player(url):

    qofs = []

    lofs = literal_eval(url)

    print(lofs)

    for item in lofs:

        if '320' in item:
            item = ttz
        elif '256' in item:
            item = tfs
        elif '192' in item:
            item = ont
        elif '130' in item:
            item = aac1
        elif '64' in item:
            item = aac2
        elif '32' in item:
            item = aac3
        else:
            item = ote

        qofs.append(item)

    if control.setting('quality_selector') == '0':

        choice = control.selectDialog(heading='Select quality', list=qofs)

        if choice <= len(lofs) and not choice == -1:

            link = lofs.pop(choice)

            stream = resolver(link)

            directory.resolve(stream)

        else:

            control.execute('Playlist.Clear')
            control.sleep(100)
            control.execute('Dialog.Close(all)')

    elif control.setting('quality_selector') == '1':

        stream = client.request(selector(qofs, lofs))
        stream = resolver(stream)
        directory.resolve(stream)

    elif control.setting('quality_selector') == '2':

        if 'MP3 320k' in qofs:
            stream = client.request(selector(qofs, lofs, ttz))
        elif 'MP3 256k' in qofs:
            stream = client.request(selector(qofs, lofs, tfs))
        elif 'MP3 192k' in qofs:
            stream = client.request(selector(qofs, lofs, ont))
        else:
            stream = client.request(selector(qofs, lofs))

        stream = resolver(stream)
        directory.resolve(stream)

    elif control.setting('quality_selector') == '3':

        stream = client.request(selector(qofs, lofs))
        stream = resolver(stream)
        directory.resolve(stream)

    elif control.setting('quality_selector') == '4':

        if 'AAC 128k' in qofs:
            stream = client.request(selector(qofs, lofs, aac1))
        elif 'AAC 64k' in qofs:
            stream = client.request(selector(qofs, lofs, aac2))
        elif 'AAC 32k' in qofs:
            stream = client.request(selector(qofs, lofs, aac3))
        else:
            stream = selector(qofs, lofs)

        stream = resolver(stream)
        directory.resolve(stream)

    elif control.setting('quality_selector') == '5':

        if 'AAC 128k' in qofs:
            stream = client.request(selector(qofs, lofs, aac3))
        elif 'AAC 64k' in qofs:
            stream = client.request(selector(qofs, lofs, aac2))
        elif 'AAC 32k' in qofs:
            stream = client.request(selector(qofs, lofs, aac1))
        else:
            stream = selector(qofs, lofs)

        stream = resolver(stream)
        directory.resolve(stream)

    else:

        selector(qofs, lofs)
Beispiel #21
0
def play_item(path):

    if path == 'broadcasts':
        path = broadcasts()

    directory.resolve(path)
Beispiel #22
0
 def live(self):
     directory.resolve(self.resolve_live(self.lang), meta={'title': 'Euronews'})
def play(url):

    directory.resolve(url)
# -*- 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)
Beispiel #25
0
def player(url, params, do_not_resolve=False):

    if url is None:
        log_debug('Nothing playable was found')
        return

    url = url.replace('&amp;', '&')

    log_debug('Attempting to play this url: ' + url)

    if 'ustream' in url:

        log_debug('Opening browser window for this url: {0}'.format(url))

        control.open_web_browser(url)

        while not control.wait(1):

            if control.condVisibility('Window.IsActive(okdialog)'):
                control.execute('Dialog.Close(all)')
                break

            return

    if do_not_resolve:
        stream = url
    else:
        stream = conditionals(url, params)

    if not stream or (len(stream) == 2 and not stream[0]):

        log_debug('Failed to resolve this url: {0}'.format(url))
        control.execute('Dialog.Close(all)')

        return

    plot = None

    try:

        if isinstance(stream, tuple):

            plot = stream[1]
            stream = stream[0]

        else:

            try:
                plot = params.get('plot').encode('latin-1')
            except (UnicodeEncodeError, UnicodeDecodeError, AttributeError):
                plot = params.get('plot')

    except TypeError:

        pass

    else:

        log_debug('Plot obtained')

    dash, m3u8_dash, mimetype, manifest_type = dash_conditionals(stream)

    if not m3u8_dash and control.setting('m3u8_quality_picker') in [
            '1', '2'
    ] and '.m3u8' in stream:

        try:

            stream = m3u8_loader.m3u8_picker(stream)

        except TypeError:

            pass

    if isinstance(stream, OrderedDict):

        try:

            try:
                args = stream['best'].args
            except Exception:
                args = None

            try:
                json_dict = json.loads(stream['best'].json)
            except Exception:
                json_dict = None

            for h in args, json_dict:

                if 'headers' in h:
                    headers = h['headers']
                    break
                else:
                    headers = None

            if headers:

                try:
                    del headers['Connection']
                    del headers['Accept-Encoding']
                    del headers['Accept']
                except KeyError:
                    pass

                append = ''.join(['|', urlencode(headers)])

            else:

                append = ''

        except AttributeError:

            append = ''

        if control.setting('sl_quality_picker') == '0' or len(stream) == 3:

            stream = stream['best'].to_url() + append

        else:

            keys = stream.keys()[::-1]
            values = [u.to_url() + append for u in stream.values()][::-1]

            stream = stream_picker(keys, values)

        dash, m3u8_dash, mimetype, manifest_type = dash_conditionals(stream)

    if stream != url:

        log_debug('Stream has been resolved: ' + stream)

    if '|' in stream or '|' in url:

        from tulip.compat import parse_qsl

        log_debug('Appending custom headers: ' +
                  repr(dict(parse_qsl(stream.rpartition('|')[2]))))

    try:

        image = params.get('image').encode('latin-1')
        title = params.get('title').encode('latin-1')

    except (UnicodeEncodeError, UnicodeDecodeError, AttributeError):

        image = params.get('image')
        title = params.get('title')

    meta = {'title': title}

    if plot:

        meta.update({'plot': plot})

    try:
        directory.resolve(stream,
                          meta=meta,
                          icon=image,
                          dash=dash,
                          manifest_type=manifest_type,
                          mimetype=mimetype)
    except:
        control.execute('Dialog.Close(all)')
        control.infoDialog(control.lang(30112))
 def live(self, url):
     directory.resolve(self.resolve_live(url), meta={'title': 'ALPHA'})
 def play(self, url):
     directory.resolve(self.resolve(url))
def play(url):

    stream = session(url)

    directory.resolve(stream, dash='.mpd' in stream)
Beispiel #29
0
def play_item(url):

    directory.resolve(url)
def player(url, params):

    global skip_directory

    if url is None:
        log_debug('Nothing playable was found')
        return

    if url.startswith('alivegr://'):
        log_debug('Attempting pseudo live playback')
        skip_directory = True
        pseudo_live(url)
        return

    url = url.replace('&amp;', '&')
    skip_directory = params.get('action') == 'play_skipped'

    directory_boolean = MOVIES in url or SHORTFILMS in url or THEATER in url or GK_BASE in url or (
        'episode' in url and GM_BASE in url)

    if directory_boolean and control.setting(
            'action_type') == '1' and not skip_directory:
        directory.run_builtin(action='directory', url=url)
        return

    log_debug('Attempting to play this url: ' + url)

    if params.get('action') == 'play_resolved':
        stream = url
    elif params.get('query') and control.setting('check_streams') == 'true':
        sl = json.loads(params.get('query'))
        index = int(control.infoLabel('Container.CurrentItem')) - 1
        stream = check_stream(sl,
                              False,
                              start_from=index,
                              show_pd=True,
                              cycle_list=False)
    else:
        stream = conditionals(url)

    if not stream:

        log_debug('Failed to resolve this url: {0}'.format(url))

        return

    try:
        plot = params.get('plot').encode('latin-1')
    except (UnicodeEncodeError, UnicodeDecodeError, AttributeError):
        plot = params.get('plot')

    if not plot and 'greek-movies.com' in url:
        plot = gm_source_maker(url).get('plot')

    dash, m3u8_dash, mimetype, manifest_type = dash_conditionals(stream)

    if not m3u8_dash and control.setting(
            'm3u8_quality_picker') == '1' and '.m3u8' in stream:

        try:

            stream = m3u8_picker(stream)

        except TypeError:

            pass

    if stream != url:

        log_debug('Stream has been resolved: ' + stream)

    else:

        log_debug('Attempting direct playback: ' + stream)

    # process headers if necessary:
    if '|' in stream:

        stream, sep, headers = stream.rpartition('|')

        headers = dict(parse_qsl(headers))

        log_debug('Appending custom headers: ' + repr(headers))

        stream = sep.join([stream, urlencode(headers)])

    try:

        image = params.get('image').encode('latin-1')
        title = params.get('title').encode('latin-1')

    except (UnicodeEncodeError, UnicodeDecodeError, AttributeError):

        image = params.get('image')
        title = params.get('title')

    meta = {'title': title}

    if plot:

        meta.update({'plot': plot})

    try:

        directory.resolve(stream,
                          meta=meta,
                          icon=image,
                          dash=dash,
                          manifest_type=manifest_type,
                          mimetype=mimetype)

        if url.startswith('iptv://') or 'kineskop.tv' in url:
            control.execute('PlayerControl(RepeatOne)')

    except:

        control.execute('Dialog.Close(all)')
        control.infoDialog(control.lang(30112))