Пример #1
0
    def set_controls(self):

        image = pyxbmct.Image(control.fanart(), aspectRatio=2)
        self.placeControl(image, 0, 0, 5, 3)
        # Note
        self.description = pyxbmct.Label(control.lang(30328), alignment=2)
        self.placeControl(self.description, 5, 0, 2, 3)
        # Click to open label
        # self.external_label = pyxbmct.Label(control.lang(30131), alignment=pyxbmct.ALIGN_CENTER_Y | pyxbmct.ALIGN_CENTER_X)
        # self.placeControl(self.external_label, 6, 0, 1, 1)
        # Twitter button
        self.twitter_button = pyxbmct.Button('Twitter')
        self.placeControl(self.twitter_button, 6, 0)
        self.connect(self.twitter_button, lambda: control.open_web_browser(TWITTER))
        # Website
        self.website_button = pyxbmct.Button(control.lang(30333))
        self.placeControl(self.website_button, 6, 1)
        self.connect(self.website_button, lambda: control.open_web_browser(WEBSITE))
        # Facebook button
        self.facebook_button = pyxbmct.Button('Facebook')
        self.placeControl(self.facebook_button, 6, 2)
        self.connect(self.facebook_button, lambda: control.open_web_browser(FACEBOOK))
        # Close button
        self.close_button = pyxbmct.Button(control.lang(30329))
        self.placeControl(self.close_button, 7, 1)
        self.connect(self.close_button, self.close)
        # Changelog button
        self.changelog_button = pyxbmct.Button(control.lang(30110))
        self.placeControl(self.changelog_button, 7, 0)
        self.connect(self.changelog_button, lambda: changelog())
        # Disclaimer button
        self.disclaimer_button = pyxbmct.Button(control.lang(30129))
        self.placeControl(self.disclaimer_button, 7, 2)
        self.connect(self.disclaimer_button, lambda: disclaimer())
    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)
Пример #3
0
def authorize():

    control.setSetting('get.toggle', 'true')

    choices = [
        control.lang(30063),
        control.lang(30080),
        control.lang(30149),
        control.lang(30081)
    ]

    choice = control.selectDialog(choices, control.lang(30061))

    if choice == 0:

        control.open_web_browser(authorization_link())
        reddit_server()

    elif choice == 1:

        kodi_auth()

    elif choice == 2:

        manual_auth()

    if choice != -1:
        control.sleep(200)
        control.refresh()
    def set_controls(self):

        # Image object
        self.image = pyxbmct.Image(
            'http://chart.apis.google.com/chart?cht=qr&chl={0}&chs=256'.format(
                quote(authorization_link())),
            aspectRatio=2)
        self.placeControl(self.image, 0, 0, 6)
        # Text box
        self.text_box = pyxbmct.TextBox()
        self.placeControl(self.text_box, 0, 1, 2)
        self.text_box.setText(control.lang(30064).format(get_ip()))
        self.text_box.autoScroll(1000, 1000, 1000)
        # Button capable of changing the local ip address
        self.address_button = pyxbmct.Button(control.lang(30056))
        self.placeControl(self.address_button, 2, 1)
        self.connect(self.address_button, lambda: ip_address_set())
        # Button capable of starting the server
        self.server_button = pyxbmct.Button(control.lang(30147))
        self.placeControl(self.server_button, 3, 1)
        self.connect(self.server_button, lambda: reddit_server())
        # Button displaying address for auth, and capable of opening it
        self.link_button = pyxbmct.Button(self.link)
        self.placeControl(self.link_button, 4, 1)
        self.connect(self.link_button,
                     lambda: control.open_web_browser(self.link))
        # Close button
        self.close_button = pyxbmct.Button(control.lang(30062))
        self.placeControl(self.close_button, 5, 1)
        self.connect(self.close_button, self.close)
def authorize():

    control.setSetting('get.toggle', 'true')

    choices = [
        control.lang(30063),
        control.lang(30080),
        control.lang(30149),
        control.lang(30081)
    ]

    choice = control.selectDialog(choices, control.lang(30061))

    if choice == 0:

        control.open_web_browser(authorization_link())
        reddit_server()

    elif choice == 1:

        window = QR_display(control.name())

        window.doModal()

        del window

    elif choice == 2:

        kodi_auth()

    elif choice == 3:

        control.okDialog(control.name(),
                         control.lang(30146).format(QR_display.link))

        if control.setting('ip.address') == '0.0.0.0':
            ip_address_set()

        auth_token = control.dialog.input(heading=control.lang(30082))

        if not auth_token:
            control.okDialog(control.name(), control.lang(30083))
            return
        else:
            control.setSetting('auth.token', auth_token)
            get_tokens(code=auth_token)
Пример #6
0
    def set_controls(self):

        image = pyxbmct.Image(control.fanart(), aspectRatio=2)
        self.placeControl(image, 0, 0, 5, 5)
        # Note
        self.description = pyxbmct.Label(control.lang(30328), alignment=2)
        self.placeControl(self.description, 5, 0, 2, 5)
        # Click to open label
        # self.external_label = pyxbmct.Label(control.lang(30131), alignment=pyxbmct.ALIGN_CENTER_Y | pyxbmct.ALIGN_CENTER_X)
        # self.placeControl(self.external_label, 6, 0, 1, 1)
        self.website_button = pyxbmct.Button(control.lang(30333))
        self.placeControl(self.website_button, 6, 0, 1, 1)
        self.connect(self.website_button, lambda: control.open_web_browser('https://www.alivegr.net'))
        # Paypal button
        self.paypal_button = pyxbmct.Button(control.lang(30141))
        self.placeControl(self.paypal_button, 6, 2, 1, 1)
        self.connect(self.paypal_button, lambda: control.open_web_browser('https://www.paypal.me/AliveGR'))
        # Patreon button
        self.patreon_button = pyxbmct.Button(control.lang(30142))
        self.placeControl(self.patreon_button, 6, 1, 1, 1)
        self.connect(self.patreon_button, lambda: control.open_web_browser('https://www.patreon.com/twilight0'))
        # Facebook button
        self.facebook_button = pyxbmct.Button('Facebook')
        self.placeControl(self.facebook_button, 6, 3, 1, 1)
        self.connect(self.facebook_button, lambda: control.open_web_browser('https://www.facebook.com/alivegr/'))
        # Twitter button
        self.twitter_button = pyxbmct.Button('Twitter')
        self.placeControl(self.twitter_button, 6, 4, 1, 1)
        self.connect(self.twitter_button, lambda: control.open_web_browser('https://twitter.com/TwilightZer0'))
        # Close button
        self.close_button = pyxbmct.Button(control.lang(30329))
        self.placeControl(self.close_button, 7, 2)
        self.connect(self.close_button, self.close)
        # Changelog button
        self.changelog_button = pyxbmct.Button(control.lang(30110))
        self.placeControl(self.changelog_button, 7, 0, 1, 2)
        self.connect(self.changelog_button, lambda: changelog())
        # Disclaimer button
        self.disclaimer_button = pyxbmct.Button(control.lang(30129))
        self.placeControl(self.disclaimer_button, 7, 3, 1, 2)
        self.connect(self.disclaimer_button, lambda: disclaimer())
Пример #7
0
def welcome():

    choices = [
        control.lang(30329),
        control.lang(30340),
        control.lang(30129),
        control.lang(30333)
    ]

    _choice = control.selectDialog(choices,
                                   heading=control.lang(30267).format(
                                       control.version()))

    if _choice in [0, -1]:
        control.close_all()
    elif _choice == 1:
        changelog()
    elif _choice == 2:
        disclaimer()
    elif _choice == 3:
        control.open_web_browser(WEBSITE)
elif action == 'mags_index':

    navigator.Indexer(argv=argv).mags_index()

elif action == 'mags_addon':

    tools.mags_addon()

elif action == 'youtube_channel':

    tools.youtube_channel(url)

elif action == 'mag_index':

    navigator.Indexer(argv=argv).mag_index(url)

elif action == 'settings':

    from tulip.control import openSettings
    openSettings()

elif action == 'keymap_edit':

    tools.keymap_edit()

elif action == 'open_url':

    from tulip.control import open_web_browser
    open_web_browser(url)
Пример #9
0
elif action == 'info':
    from resources.lib.indexers import settings
    settings.Indexer(argv=argv).info()

elif action == 'input_stream_addons':
    from resources.lib.indexers import settings
    settings.Indexer(argv=argv).input_stream_addons()

elif action == 'call_info':
    from resources.lib.modules import helpers
    helpers.call_info()

elif action == 'open_link':
    from tulip import control
    control.open_web_browser(url)

elif action == 'force':
    from resources.lib.modules import helpers
    helpers.force()

elif action == 'dmca':
    from resources.lib.modules import tools
    tools.dmca()

elif action == 'pp':
    from resources.lib.modules import tools
    tools.pp()

elif action == 'system_info':
    from resources.lib.modules import helpers
Пример #10
0
def player(url, params, do_not_resolve=False):

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

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

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