Esempio n. 1
0
def multichoice(filenames):

    if filenames is None or len(filenames) == 0:

        return

    elif len(filenames) >= 1:

        if len(filenames) == 1:
            return filenames[0]

        choices = [os_split(i)[1] for i in filenames]

        choices.insert(0, control.lang(32215))

        _choice = control.selectDialog(heading=control.lang(32214),
                                       list=choices)

        if _choice == 0:
            filename = choice(filenames)
        elif _choice != -1 and _choice <= len(filenames) + 1:
            filename = filenames[_choice - 1]
        else:
            filename = choice(filenames)

        return filename

    else:

        return
def mini_picker(hl, sl, dont_check=False):

    if len(hl) == 1 and len(sl) == 1:

        stream = sl[0]

        return stream

    else:

        if control.setting('action_type') == '3' or skip_directory:

            try:
                if dont_check:
                    url = random_choice(sl)
                else:
                    url = check_stream(sl)
            except Exception:
                return

            return url

        choice = control.selectDialog(heading=control.lang(30064), list=hl)

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

            return sl[choice]

        else:

            prevent_failure()
Esempio n. 3
0
def lang_choice():

    selections = [
        control.lang(30217),
        control.lang(30218),
        control.lang(30312),
        control.lang(30327)
    ]

    dialog = control.selectDialog(selections)

    if dialog == 0:
        control.execute('Addon.Default.Set(kodi.resource.language)')
    elif dialog == 1:
        languages = [control.lang(30286), control.lang(30299)]
        layouts = ['English QWERTY', 'Greek QWERTY']
        indices = control.dialog.multiselect(control.name(), languages)
        control.set_gui_setting('locale.keyboardlayouts',
                                [layouts[i] for i in indices])
    elif dialog == 2:
        control.set_gui_setting('locale.charset', 'CP1253')
        control.set_gui_setting('subtitles.charset', 'CP1253')
    elif dialog == 3:
        control.execute('ActivateWindow(interfacesettings)')
    else:
        control.execute('Dialog.Close(all)')
Esempio n. 4
0
def start():

    if not control.setting('local') and not control.setting('remote'):

        if control.yesnoDialog(heading=control.lang(30008),
                               line1=control.lang(30009)):
            control.openSettings()
        else:
            control.infoDialog(control.lang(30014))

    else:

        choices = [
            control.lang(30020),
            control.lang(30016),
            control.lang(30019)
        ]

        selection = control.selectDialog(choices)

        if selection == 0:

            seq()

        elif selection == 1:

            control.openSettings()

        elif selection == 2:

            control.openSettings(id='plugin.video.youtube')
Esempio n. 5
0
def stream_picker(qualities, urls):

    choice = control.selectDialog(heading=control.lang(30006), list=qualities)

    if choice <= len(qualities) and not choice == -1:
        popped = urls[choice]
        return popped
Esempio n. 6
0
def lang_choice():
    def set_other_options():

        set_a_setting('locale.longdateformat', 'regional')
        set_a_setting('locale.shortdateformat', 'regional')
        set_a_setting('locale.speedunit', 'regional')
        set_a_setting('locale.temperatureunit', 'regional')
        set_a_setting('locale.timeformat', 'regional')
        # set_a_setting('locale.timezone', 'default')
        # set_a_setting('locale.timezonecountry', 'default')
        set_a_setting('locale.use24hourclock', 'regional')

    selections = [control.lang(30020), control.lang(30021)]

    dialog = control.selectDialog(selections)

    if dialog == 0:
        set_a_setting('locale.language', 'resource.language.en_gb')
        set_a_setting('locale.country', 'Central Europe')
        set_other_options()
    elif dialog == 1:
        set_a_setting('locale.language', 'resource.language.el_gr')
        set_a_setting('locale.country', 'Ελλάδα')
        set_other_options()
    else:
        control.execute('Dialog.Close(all)')

    control.sleep(100)
    refresh()
Esempio n. 7
0
def mini_picker(links):

    if len(links) == 1:

        stream = links[0][1]

        return stream

    elif control.setting('action_type') == '2' or skip_directory:

        try:
            if control.setting('check_streams') == 'false':
                stream = random_choice([link[1] for link in links])
            else:
                stream = check_stream(links)
        except Exception:
            return

        return stream

    else:

        choice = control.selectDialog(heading=control.lang(30064),
                                      list=[link[0] for link in links])

        if choice == -1:
            return
        elif control.setting('check_streams') == 'false':
            return [link[1] for link in links][choice]
        else:
            return check_stream(links,
                                False,
                                start_from=choice,
                                show_pd=True,
                                cycle_list=False)
def text_viewer(text, title=None, permalink=None):

    if control.setting('single.button') == 'true':

        choice = control.selectDialog(
            [control.lang(30158),
             control.lang(30100),
             control.lang(30159)])

        if choice == 0:

            view_text(text, title)

        elif choice == 1:

            if permalink.startswith('http'):
                window_activate(url=permalink, jump=True)
            else:
                window_activate(query=permalink, jump=True)

        elif choice == 2:

            control.execute('Action(ContextMenu)')

    else:

        view_text(text, title)
Esempio n. 9
0
    def switcher():
        def seq(choose):

            control.setSetting('papers_group', choose)
            control.idle()
            control.sleep(100)
            control.refresh()

        groups = ([
            control.lang(30235),
            control.lang(30231),
            control.lang(30232),
            control.lang(30233),
            control.lang(30234)
        ], ['0', '1', '2', '3', '4'])

        choice = control.selectDialog(heading=control.lang(30049),
                                      list=groups[0])

        if choice == 0:
            seq('0')
        elif choice <= len(groups[0]) and not choice == -1:
            seq(groups[1][choice])
        else:
            control.execute('Dialog.Close(all)')
Esempio n. 10
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()
Esempio n. 11
0
def stream_picker(links):

    _choice = control.selectDialog(heading=control.lang(30006),
                                   list=[link[0] for link in links])

    if _choice <= len(links) and not _choice == -1:
        popped = [link[1] for link in links][_choice]
        return popped
Esempio n. 12
0
def toggle_alt():

    if control.setting('show_alt_live') == 'true':
        live_enability = '[COLOR green]' + control.lang(30330) + '[/COLOR]'
    else:
        live_enability = '[COLOR red]' + control.lang(30335) + '[/COLOR]'

    if control.setting('show_alt_vod') == 'true':
        vod_enability = '[COLOR green]' + control.lang(30330) + '[/COLOR]'
    else:
        vod_enability = '[COLOR red]' + control.lang(30335) + '[/COLOR]'

    option = control.selectDialog(
        [
            control.lang(30317).format(live_enability),
            control.lang(30405).format(vod_enability)
        ],
        heading=': '.join([control.addonInfo('name'),
                           control.lang(30350)]))

    if option == 0:

        if control.setting('show_alt_live') == 'false':

            yes = control.yesnoDialog(control.lang(30114))

            if yes:

                control.setSetting('show_alt_live', 'true')
                control.infoDialog(message=control.lang(30402), time=1000)
        else:

            yes = control.yesnoDialog(control.lang(30404))

            if yes:

                control.setSetting('show_alt_live', 'false')
                control.infoDialog(message=control.lang(30402), time=1000)

    elif option == 1:

        if control.setting('show_alt_vod') == 'false':

            yes = control.yesnoDialog(control.lang(30114))

            if yes:

                control.setSetting('show_alt_vod', 'true')
                control.infoDialog(message=control.lang(30402), time=1000)

        else:

            yes = control.yesnoDialog(control.lang(30404))

            if yes:

                control.setSetting('show_alt_vod', 'false')
                control.infoDialog(message=control.lang(30402), time=1000)
def stream_picker(names, urls):

    choice = control.selectDialog(heading=control.lang(30061), list=names)

    if choice <= len(names) and not choice == -1:
        popped = urls[choice]
        return popped
    else:
        return control.execute('Dialog.Close(all)')
Esempio n. 14
0
    def switch(query):

        pages = [control.lang(30026).format(i) for i in list(range(1, int(query) + 1))]

        choice = control.selectDialog(pages, heading=control.lang(30028))

        if choice != -1:
            control.setSetting('page', str(choice))
            control.sleep(200)
            control.refresh()
    def executable(self):

        modes = [
            control.lang(30033),
            control.lang(30034),
            control.lang(30035),
            control.lang(30028)
        ]

        if control.setting('window.action') == '0':

            choice = control.selectDialog(modes)

            if choice == 0:

                window_activate(query='video')

            elif choice == 1:

                window_activate(query='audio')

            elif choice == 2:

                window_activate(query='image')

            elif choice == 3:

                control.openSettings()

            else:

                control.execute('Dialog.Close(all)')

        else:

            self.list = [{
                'title': modes[0],
                'action': 'window_activate',
                'query': 'video'
            }, {
                'title': modes[1],
                'action': 'window_activate',
                'query': 'audio'
            }, {
                'title': modes[2],
                'action': 'window_activate',
                'query': 'image'
            }, {
                'title': modes[3],
                'action': 'tools',
                'icon': 'settings_tools.png'
            }]

            directory.add(self.list)
def play(link, permalink=None, title=None, image=None, skip_question=False):
    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)

    ##############################################

    if control.setting('single.button') == 'true':

        choice = control.selectDialog(
            [control.lang(30157),
             control.lang(30100),
             control.lang(30159)])

        if choice == 0:

            playback(resolved_mode=False)

        elif choice == 1:

            window_activate(url=permalink, jump=True)

        elif choice == 2:

            control.execute('Action(ContextMenu)')

    else:

        playback()
Esempio n. 17
0
    def switch(self):

        choices = [control.lang(30020), control.lang(30021)]

        choice = control.selectDialog(choices)

        if choice == 0:
            control.setSetting('sport', '0')
        elif choice == 1:
            control.setSetting('sport', '1')

        if choice != -1:
            control.sleep(100)
            control.refresh()
Esempio n. 18
0
def prompt():

    control.okDialog('AliveGR', control.lang(30356).format(remote_version()))

    choices = [control.lang(30357), control.lang(30358), control.lang(30359)]

    _choice = control.selectDialog(choices, heading=control.lang(30482))

    if _choice == 0:
        force()
    elif _choice == 1:
        control.close_all()
    elif _choice == 2:
        do_not_ask_again()
Esempio n. 19
0
def pair_tool(dialog=False, coinhive=True):

    items = [
        {
            'title': 'OpenLoad',
            'url': 'https://cnhv.co/kswm' if coinhive else 'https://olpair.com/',
            'icon': 'openload.png'
        }
        ,
        {
            'title': 'TheVideo',
            'url': 'https://cnhv.co/ktej' if coinhive else 'https://thevideo.cc/pair',
            'icon': 'thevideo.png'
        }
        ,
        {
            'title': 'VidUP',
            'url': 'https://cnhv.co/ktem' if coinhive else 'https://vidup.me/pair',
            'icon': 'vidup.png'
        }
        ,
        {
            'title': 'Streamango',
            'url': 'https://cnhv.co/1tluc' if coinhive else 'https://streamango.com/pair',
            'icon': 'streamango.jpg'
        }
        ,
        {
            'title': 'FlashX',
            'url': 'https://cnhv.co/kt1j' if coinhive else 'https://www.flashx.tv/pairing.php',
            'icon': 'flashx.png'
        }
    ]

    for i in items:
        i.update({'action': 'pair'})

    if not dialog:

        from tulip import directory
        directory.add(items)

    else:

        choice = selectDialog([i['title'] for i in items], lang(30004))

        if choice >= 0:

            selection = [i['url'] for i in items][choice]
            pair(selection)
Esempio n. 20
0
    def vod_switcher(self, url):

        self.data = root(url)[1]

        translated = [control.lang(int(i)) for i in self.data]

        choice = control.selectDialog(heading=control.lang(30062), list=translated)

        if choice <= len(self.data) and not choice == -1:
            control.setSetting('vod_group', self.data[choice])
            control.idle()
            control.sleep(100)  # ensure setting has been saved
            control.refresh()
        else:
            control.execute('Dialog.Close(all)')
Esempio n. 21
0
def mini_picker(hl, sl, params):

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

    if len(hl) == 1:

        stream = cache.get(gm_debris, 12, sl[0])

        if control.setting('action_type') == '2':
            if control.setting('auto_play') == 'true':
                play_url = sysaddon + play_action + quote(
                    stream) + '&image=' + quote(image) + '&title=' + quote(
                        title)
                control.execute('PlayMedia("{0}")'.format(play_url))
            else:
                m3u_file = playlist_maker(hl, sl, title, image)
                control.playlist().load(m3u_file)
                control.openPlaylist()
        else:
            control.infoDialog(hl[0])
            return stream

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

        m3u_file = playlist_maker(hl, sl, title, image)

        control.playlist().load(m3u_file)

        if control.setting('auto_play') == 'true':
            control.execute('Action(Play)')
        else:
            control.openPlaylist()
        return

    else:

        choice = control.selectDialog(heading=control.lang(30064), list=hl)

        if choice <= len(sl) and not choice == -1:
            popped = sl[choice]
            return cache.get(gm_debris, 12, popped)
        else:
            return
Esempio n. 22
0
    def selector():

        choices = [control.lang(30004), control.lang(30005)]

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

        if choice == 0:
            control.setSetting('region', 'GR')
        elif choice == 1:
            control.setSetting('region', 'CY')

        if choice != -1:

            cache.FunctionCache().reset_cache()
            control.sleep(200)
            control.refresh()
Esempio n. 23
0
def page_selector(query):

    pages = [control.lang(30415).format(i) for i in list(range(1, int(query) + 1))]

    _choice = control.selectDialog(pages, heading=control.lang(30416))

    if _choice != -1:

        control.setSetting('page', str(_choice))
        control.sleep(200)
        control.refresh()

        if control.setting('pagination_reset') == 'true':
            # wait a second in order to ensure container is first loaded then reset the page
            control.sleep(1000)
            control.setSetting('page', '0')
Esempio n. 24
0
def show_picture(title, link, permalink=None):
    def image_display():

        image = pic_router(link)

        if 'mp4' in image:

            play(link=image,
                 title=title,
                 image=dict(parse_qsl(argv[2].replace('?', ''))).get('image'),
                 skip_question=True)

        else:

            if control.setting('image.fullscreen') == 'true':

                control.execute('ShowPicture("{0}")'.format(image))

            else:

                window = ImageDisplay(title, image)
                window.doModal()
                del window
                close_all()

    if control.setting('single.button') == 'true':

        choice = control.selectDialog(
            [control.lang(30157),
             control.lang(30100),
             control.lang(30159)])

        if choice == 0:

            image_display()

        elif choice == 1:

            window_activate(url=permalink, jump=True)

        elif choice == 2:

            control.execute('Action(ContextMenu)')

    else:

        image_display()
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)
def multichoice(filenames, allow_random=False):

    if filenames is None or len(filenames) == 0:

        return

    elif len(filenames) >= 1:

        if allow_random:
            length = len(filenames) + 1
        else:
            length = len(filenames)

        if len(filenames) == 1:
            return filenames[0]

        choices = [os_split(i)[1] for i in filenames]

        if allow_random:
            choices.insert(0, control.lang(30215))

        _choice = control.selectDialog(heading=control.lang(30214),
                                       list=choices)

        if _choice == 0:
            if allow_random:
                filename = choice(filenames)
            else:
                filename = filenames[0]
        elif _choice != -1 and _choice <= length:
            if allow_random:
                filename = filenames[_choice - 1]
            else:
                filename = filenames[_choice]
        else:
            if allow_random:
                filename = choice(filenames)
            else:
                return

        return filename

    else:

        return
Esempio n. 27
0
    def switcher(self):
        def seq(group):

            control.setSetting('live_group', str(group))
            control.idle()
            control.sleep(100)
            control.refresh()

        self.groups = cache.get(self.live, 8)[1]
        translated = [control.lang(i) for i in self.groups]
        self.data = [control.lang(30048)] + self.groups
        choice = control.selectDialog(heading=control.lang(30049),
                                      list=[control.lang(30048)] + translated)

        if choice == 0:
            seq('ALL')
        elif choice <= len(self.data) and not choice == -1:
            seq(self.data[choice])
def comment_scraper(text, title):

    link = None

    links = re.findall('(\w*(?:://|/r/|/domain/)[^\r\n\t\f\v()\[\] ]*)', text)

    if links:

        choice = control.selectDialog(links)

        if choice == -1:
            close_all()
            return
        elif choice <= len(links):
            link = links[choice]

        if 'reddit.com/r/' in link:

            window_activate(url=link, jump=True)

        elif link.startswith('/r/') or link.startswith('/domain/'):

            link = base_link() + link
            window_activate(url=link, jump=True)

        else:

            if images_boolean(link):

                show_picture(title, link)

            else:

                # play(link, title=title, image=control.addonInfo('icon'))
                control.execute(
                    'PlayMedia("{0}?action=play&url={1}&title={2}&image={3}")'.
                    format(sysaddon[:-1], link, title,
                           control.addonInfo('icon')))

    else:

        control.infoDialog(control.lang(30130))
Esempio n. 29
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)
Esempio n. 30
0
def pvr_client(query='false'):

    control.execute('Dialog.Close(all)')

    if control.condVisibility('Pvr.HasTVChannels'):

        if query is None or query == 'false':

            selection = control.selectDialog([control.lang(30001), control.lang(30014)])

            if selection == 0:
                control.execute('ActivateWindow(TVChannels)')
            elif selection == 1:
                control.execute('ActivateWindow(TVGuide)')

        elif query == 'true':

            control.execute('ActivateWindow(TVGuide)')

    else:

        control.infoDialog(message=control.lang(30065))