Exemplo n.º 1
0
    def call():

        plugin_call = 'plugin://plugin.video.youtube/api/update/?enable=true'
        route = '{0}&client_id={1}&client_secret={2}&api_key={3}'.format(
            plugin_call, quote(credentials[0]), quote(credentials[2]),
            quote(credentials[1]))
        control.execute('RunPlugin({0})'.format(route))
Exemplo n.º 2
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()
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)
Exemplo n.º 4
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)')
Exemplo n.º 5
0
def presentation():

    path = control.transPath(
        'special://profile/addon_data/{0}/slideshow/'.format(
            control.addonInfo('id')))

    if not control.exists(control.join(path, '01.jpg')):

        control.makeFiles(path)

        control.idle()

        dp = control.ProgressDialog(heading=control.name())

        for i in range(1, 25):
            dp.update((i + 1) * 4, line1=control.lang(30038))
            client.retriever(
                'http://mediaportal.anacon.org/faros/{0}.jpg'.format(
                    str(i) if len(str(i)) >= 2 else str('0' + str(i))),
                control.join(
                    path, (str(i) if len(str(i)) >= 2 else str('0' + str(i))) +
                    '.jpg'))

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

    control.execute('SlideShow({0},pause)'.format(path))
Exemplo n.º 6
0
def weather_set_up():

    addon_settings = '''<settings>
    <setting id="Location1" value="Paphos (CY)" />
    <setting id="Location1id" value="841589" />
    <setting id="Location2" value="" />
    <setting id="Location2id" value="" />
    <setting id="Location3" value="" />
    <setting id="Location3id" value="" />
    <setting id="Location4" value="" />
    <setting id="Location4id" value="" />
    <setting id="Location5" value="" />
    <setting id="Location5id" value="" />
</settings>
'''

    location = control.transPath('special://profile/addon_data/weather.yahoo')
    if not control.exists(location):
        control.makeFile(location)

    with open(control.join(location, 'settings.xml'), mode='w') as f:
        f.write(addon_settings)

    set_a_setting('weather.addon', 'weather.yahoo')
    control.execute('Weather.Refresh')
Exemplo n.º 7
0
def key_map_setup():

    if control.exists(
            control.transPath(
                'special://home/addons/plugin.video.faros.on-air/addon.xml')):
        script_location = 'special://home/addons/plugin.video.faros.on-air/resources/lib/key_nav.py'
    else:
        script_location = 'special://xbmc/addons/plugin.video.faros.on-air/resources/lib/key_nav.py'

    xml = '''<keymap>
    <global>
        <keyboard>
            <key id="browser_back">RunScript({0})</key>
            <key id="61448">RunScript({0})</key>
            <key id="backspace">RunScript({0})</key>
            <key id="browser_home">noop</key>
            <key id="homepage">noop</key>
            <key id="escape">noop</key>
            <key id="61467">noop</key>
        </keyboard>
    </global>
</keymap> 
    '''.format(script_location)

    location = control.transPath('special://profile/keymaps/')

    if not control.exists(location):
        control.makeFile(location)

    with open(control.join(location, 'farosonair.xml'), mode='w') as f:
        f.write(xml)

    control.execute('Action(reloadkeymaps)')
Exemplo n.º 8
0
def youtube_channel(url):

    register_api_keys(
        control.addonInfo('id'), variables.keys['api_key'], variables.keys['id'], variables.keys['secret']
    )

    control.execute('Container.Update({0},return)'.format(url))
Exemplo n.º 9
0
def tools_menu():

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

    control.execute(
        'ActivateWindow(programs,"plugin://plugin.video.AliveGR/?content_type=executable",return)'
    )
Exemplo n.º 10
0
def call_info():

    control.close_all()

    control.execute(
        'ActivateWindow(programs,"plugin://plugin.video.AliveGR/?content_type=executable&action=info",return)'
    )
Exemplo n.º 11
0
def play_m3u(link, title, rename_titles=True, randomize=True):

    m3u_file = control.join(control.transPath('special://temp'),
                            link.rpartition('/')[2])

    play_list = client.request(link)

    if rename_titles:
        videos = play_list.splitlines()[1:][1::2]
    else:
        videos = re.findall('#.+?$\n.+?$', play_list[1:], re.M)

    if randomize and control.setting('randomize_m3u') == 'true':
        random.shuffle(videos)

    if rename_titles:
        m3u_playlist = '#EXTM3U\n#EXTINF:0,{0}\n'.format(
            title) + '\n#EXTINF:0,{0}\n'.format(title).join(videos)
    else:
        m3u_playlist = '#EXTM3U\n' + '\n'.join(videos)

    with open(m3u_file, 'w') as f:
        f.write(m3u_playlist)

    control.playlist().load(m3u_file)
    control.execute('Action(Play)')
Exemplo n.º 12
0
def papers():

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

    control.execute(
        'ActivateWindow(10002,"plugin://plugin.video.AliveGR/?content_type=image",return)'
    )
Exemplo n.º 13
0
    def install():

        if control.conditional_visibility('System.Platform.Linux') and not (
                path.exists(control.transPath(xbmc_path))
                or path.exists(control.transPath(home_path))):

            control.okDialog(heading='AliveGR', line1=control.lang(30323))

            return False

        elif path.exists(control.transPath(xbmc_path)) or path.exists(
                control.transPath(home_path)):

            return True

        elif control.kodi_version() >= 18.0 and not control.condVisibility(
                'System.HasAddon(pvr.iptvsimple)'):

            control.execute('InstallAddon(pvr.iptvsimple)')

            return True

        elif control.condVisibility('System.HasAddon(pvr.iptvsimple)'):

            return 'enabled'

        else:

            return False
Exemplo n.º 14
0
def enable_iptv():

    xbmc_path = control.join('special://xbmc', 'addons', 'pvr.iptvsimple')
    home_path = control.join('special://home', 'addons', 'pvr.iptvsimple')

    if control.condVisibility('Pvr.HasTVChannels') and (
            path.exists(control.transPath(xbmc_path))
            or path.exists(control.transPath(home_path))
    ) and control.addon_details('pvr.iptvsimple').get('enabled'):

        control.infoDialog(message=control.lang(30407), time=4000)

    elif not path.exists(control.join(iptv_folder, 'settings.xml')):

        control.infoDialog(message=control.lang(30409), time=4000)

    else:

        if control.yesnoDialog(line1=control.lang(30406)):

            control.enable_addon('pvr.iptvsimple')

            if control.infoLabel(
                    'System.AddonVersion(xbmc.python)') == '2.24.0':

                control.execute('StartPVRManager')
Exemplo n.º 15
0
def prevent_failure():

    for i in range(0, 500):

        if control.condVisibility('Window.IsActive(busydialog)'):
            control.sleep(100)
        else:
            control.execute('Dialog.Close(all,true)')
            break
    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)
Exemplo n.º 17
0
def rtmp_enable():

    if control.kodi_version() < 17.0:

        control.infoDialog(control.lang(30322))
        return

    try:

        enabled = control.addon_details('inputstream.rtmp').get('enabled')

    except Exception:

        enabled = False

    try:

        if enabled:

            control.infoDialog(control.lang(30276))
            return

        else:

            xbmc_path = control.join('special://xbmc', 'addons',
                                     'inputstream.rtmp')
            home_path = control.join('special://home', 'addons',
                                     'inputstream.rtmp')

            if path.exists(control.transPath(xbmc_path)) or path.exists(
                    control.transPath(home_path)):

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

                if yes:

                    control.enable_addon('inputstream.rtmp')
                    control.infoDialog(control.lang(30402))

            else:

                try:

                    control.execute('InstallAddon(inputstream.rtmp)')

                except Exception:

                    control.okDialog(heading='AliveGR',
                                     line1=control.lang(30323))

    except Exception:

        control.infoDialog(control.lang(30279))
Exemplo n.º 18
0
        def seq():

            string_start = '<keymap><slideshow><mouse>'
            string_end = '</mouse></slideshow></keymap>'
            string_for_left = '<leftclick>NextPicture</leftclick>'
            string_for_right = '<rightclick>PreviousPicture</rightclick>'
            string_for_middle = '<middleclick>Rotate</middleclick>'
            string_for_up = '<wheelup>ZoomIn</wheelup>'
            string_for_down = '<wheeldown>ZoomOut</wheeldown>'

            classes = [
                string_for_left, string_for_right, string_for_middle,
                string_for_up, string_for_down
            ]

            map_left = control.lang(30241)
            map_right = control.lang(30242)
            map_middle = control.lang(30243)
            map_up = control.lang(30244)
            map_down = control.lang(30245)

            keys = [
                map_left, map_right, map_middle, map_up, map_down
            ]

            control.okDialog(control.name(), control.lang(30240))

            indices = control.dialog.multiselect(control.name(), keys)

            if not indices:

                control.infoDialog(control.lang(30246))

            else:

                finalized = []

                for i in indices:
                    finalized.append(classes[i])

                joined = ''.join(finalized)

                to_write = string_start + joined + string_end

                try:
                    with open(location, mode='w', encoding='utf-8') as f:
                        f.write(to_write)
                except Exception:
                    with open(location, 'w') as f:
                        f.write(to_write)

                control.execute('Action(reloadkeymaps)')
Exemplo n.º 19
0
def txt_box(heading, announce):

    window_id = 10147
    control_id1 = 1
    control_id2 = 5
    gui_window = control.window(window_id)

    control.execute('ActivateWindow(%d)' % window_id)
    control.sleep(200)

    gui_window.getControl(control_id1).setLabel(heading)

    gui_window.getControl(control_id2).setText(announce)
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()
Exemplo n.º 21
0
def play_yt_m3u(url, title):

    m3u_file = control.join(control.dataPath, url.rpartition('/')[2])

    play_list = client.request(url)
    videos = play_list.splitlines()[1:][1::2]
    shuffle(videos)
    m3u_playlist = '#EXTM3U\n#EXTINF:0,{0}\n'.format(title) + '\n#EXTINF:0,{0}\n'.format(title).join(videos)

    with open(m3u_file, 'w') as f:
        f.write(m3u_playlist)

    control.playlist().load(m3u_file)
    control.execute('Action(Play)')
Exemplo n.º 22
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('Dialog.Close(all)')
        control.execute('ActivateWindow(interfacesettings)')
    else:
        control.execute('Dialog.Close(all)')
Exemplo n.º 23
0
def isa_enable():

    if addon_version('xbmc.python') < 2250:

        control.infoDialog(control.lang(30322))
        return

    try:

        enabled = control.addon_details('inputstream.adaptive').get('enabled')

    except Exception:

        enabled = False

    try:

        if enabled:

            control.infoDialog(control.lang(30254))
            return

        else:

            xbmc_path = control.join('special://xbmc', 'addons', 'inputstream.adaptive')
            home_path = control.join('special://home', 'addons', 'inputstream.adaptive')

            if path.exists(control.transPath(xbmc_path)) or path.exists(control.transPath(home_path)):

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

                if yes:

                    control.enable_addon('inputstream.adaptive')
                    control.infoDialog(control.lang(30402))

            else:

                try:

                    control.execute('InstallAddon(inputstream.adaptive)')

                except Exception:

                    control.okDialog(heading='AliveGR', line1=control.lang(30323))

    except Exception:

        control.infoDialog(control.lang(30278))
Exemplo n.º 24
0
def enable_proxy_module():

    if control.condVisibility('System.HasAddon(service.streamlink.proxy)'):

        control.infoDialog(control.lang(30143))

    else:

        if control.infoLabel('System.AddonVersion(xbmc.python)') == '2.24.0':

            control.execute('RunPlugin(plugin://service.streamlink.proxy/)')

        else:

            control.execute('InstallAddon(service.streamlink.proxy)')
Exemplo n.º 25
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)')
Exemplo n.º 26
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
Exemplo n.º 27
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()
Exemplo n.º 28
0
def android_activity(url):

    if control.setting('browser') == 'Opera Mobile':
        browser = '"com.opera.browser"'
    elif control.setting('browser') == 'Opera Mini':
        browser = '"com.opera.mini.native"'
    elif control.setting('browser') == 'Firefox':
        browser = '"org.mozilla.firefox"'
    elif control.setting('browser') == 'UC Browser':
        browser = '"com.UCMobile.intl"'
    elif control.setting('browser') == 'Chrome':
        browser = '"com.android.chrome"'
    else:
        browser = ''

    control.execute(
        'StartAndroidActivity({0},"android.intent.action.VIEW","","{1}")'.
        format(browser, url))
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)')
Exemplo n.º 30
0
def activate_other_addon(url, query=None):

    if not url.startswith('plugin://'):
        url = ''.join(['plugin://', url, '/'])

    parsed = urlparse(url)

    if not control.condVisibility('System.HasAddon({0})'.format(
            parsed.netloc)):
        control.execute('InstallAddon({0})'.format(parsed.netloc))

    params = dict(parse_qsl(parsed.query))
    action = params.get('action')
    url = params.get('url')

    directory.run_builtin(addon_id=parsed.netloc,
                          action=action,
                          url=url,
                          content_type=query)