コード例 #1
0
def yt_setup():
    def wizard():

        control.addon('plugin.video.youtube').setSetting(
            'kodion.setup_wizard', 'false')
        control.addon('plugin.video.youtube').setSetting(
            'youtube.language', 'el')
        control.addon('plugin.video.youtube').setSetting(
            'youtube.region', 'GR')
        control.infoDialog(message=control.lang(30402), time=3000)

    def yt_mpd():

        control.addon('plugin.video.youtube').setSetting(
            'kodion.video.quality.mpd', 'true')
        control.addon('plugin.video.youtube').setSetting(
            'kodion.mpd.videos', 'true')
        control.addon('plugin.video.youtube').setSetting(
            'kodion.mpd.live_streams', 'true')
        control.infoDialog(message=control.lang(30402), time=3000)

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

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

        wizard()

    if control.condVisibility(
            'System.HasAddon(inputstream.adaptive)') and control.yesnoDialog(
                line1=control.lang(30287)):

        yt_mpd()
コード例 #2
0
ファイル: tools.py プロジェクト: DoBucki/Kodi_Remote_Manager
def yt_setup():

    def seq():

        control.addon('plugin.video.youtube').setSetting('youtube.api.enable', api_keys['enablement'])
        control.addon('plugin.video.youtube').setSetting('youtube.api.id', api_keys['id'])
        control.addon('plugin.video.youtube').setSetting('youtube.api.key', thgiliwt(api_keys['api_key']))
        control.addon('plugin.video.youtube').setSetting('youtube.api.secret', api_keys['secret'])

        control.infoDialog(message=control.lang(30402), time=3000)

    def wizard():

        control.addon('plugin.video.youtube').setSetting('kodion.setup_wizard', 'false')
        control.addon('plugin.video.youtube').setSetting('youtube.language', 'el')
        control.addon('plugin.video.youtube').setSetting('youtube.region', 'GR')
        control.infoDialog(message=control.lang(30402), time=3000)

    def yt_mpd():

        control.addon('plugin.video.youtube').setSetting('kodion.video.quality.mpd', 'true')
        control.addon('plugin.video.youtube').setSetting('kodion.mpd.videos', 'true')
        control.addon('plugin.video.youtube').setSetting('kodion.mpd.live_streams', 'true')
        control.infoDialog(message=control.lang(30402), time=3000)

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

    def process():

        if control.addon('plugin.video.youtube').getSetting('youtube.api.enable') == 'true':

            if control.yesnoDialog(line1=control.lang(30069), line2=control.lang(30022), line3=''):
                seq()
            else:
                control.infoDialog(message=control.lang(30029), time=3000)

        else:

            if control.yesnoDialog(line1=control.lang(30070), line2=control.lang(30022), line3=''):
                seq()
            else:
                control.infoDialog(message=control.lang(30029), time=3000)

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

    process()

    if control.yesnoDialog(line1=control.lang(30132), line2='', line3=''):

        wizard()

    else: pass

    if control.condVisibility('System.HasAddon(inputstream.adaptive)') and control.yesnoDialog(line1=control.lang(30287), line2='', line3=''):

        yt_mpd()

    else: pass
コード例 #3
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)
コード例 #4
0
ファイル: tools.py プロジェクト: DoBucki/Kodi_Remote_Manager
    def process():

        if control.addon('plugin.video.youtube').getSetting('youtube.api.enable') == 'true':

            if control.yesnoDialog(line1=control.lang(30069), line2=control.lang(30022), line3=''):
                seq()
            else:
                control.infoDialog(message=control.lang(30029), time=3000)

        else:

            if control.yesnoDialog(line1=control.lang(30070), line2=control.lang(30022), line3=''):
                seq()
            else:
                control.infoDialog(message=control.lang(30029), time=3000)
コード例 #5
0
def clear(table=None,
          withyes=False,
          notify=True,
          file_=None,
          label_yes_no=30401,
          label_success=30402):

    if file_ is None:
        if control:
            file_ = control.cacheFile
        else:
            file_ = os.path.join(os.path.curdir, 'cache.db')

    try:
        if control:
            control.idle()

        if table is None:
            table = ['rel_list', 'rel_lib']
        elif not type(table) == list:
            table = [table]

        if withyes and control:

            try:
                yes = control.yesnoDialog(
                    control.lang(label_yes_no).encode('utf-8'), '', '')
            except Exception:
                yes = control.yesnoDialog(control.lang(label_yes_no), '', '')

            if not yes:
                return

        dbcon = database.connect(file_)
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS {0}".format(t))
                dbcur.execute("VACUUM")
                dbcon.commit()
            except Exception:
                pass

        if control and notify:
            control.infoDialog(control.lang(label_success).encode('utf-8'))
    except Exception:
        pass
コード例 #6
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')
コード例 #7
0
    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)
コード例 #8
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')
コード例 #9
0
def isa_setup():

    settings_file = '''<settings version="2">
    <setting id="MINBANDWIDTH" default="true">0</setting>
    <setting id="MAXBANDWIDTH" default="true">0</setting>
    <setting id="MAXRESOLUTION" default="true">0</setting>
    <setting id="MAXRESOLUTIONSECURE" default="true">0</setting>
    <setting id="STREAMSELECTION">2</setting>
    <setting id="MEDIATYPE" default="true">0</setting>
    <setting id="HDCPOVERRIDE" default="true">false</setting>
    <setting id="IGNOREDISPLAY" default="true">false</setting>
    <setting id="DECRYPTERPATH" default="true">special://xbmcbinaddons</setting>
    <setting id="WIDEVINE_API" default="true">10</setting>
    <setting id="PRERELEASEFEATURES" default="true">false</setting>
</settings>
'''

    def wizard():

        lines = settings_file.splitlines()[1:-1]

        for line in lines:

            control.addon('inputstream.adaptive').setSetting(
                re.search(r'id="(\w+)"', line).group(1),
                re.search(r'>([\w/:]+)<', line).group(1))

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

        wizard()
        control.infoDialog(message=control.lang(30402), time=3000)
コード例 #10
0
    def check_inputstream_addon():

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

        leia_plus = control.kodi_version() >= 18.0

        first_time_file = control.join(control.dataPath, 'first_time')

        if not addon_enabled and not file_exists(first_time_file) and leia_plus:

            try:

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

                if yes:
                    control.enable_addon('inputstream.adaptive')
                    control.infoDialog(control.lang(30402))

                with open(first_time_file, 'a'):
                    pass

            except Exception:

                pass
コード例 #11
0
def seq():

    conditions = [
        bool(
            control.addon('plugin.video.youtube').getSetting(
                'youtube.api.id')),
        bool(
            control.addon('plugin.video.youtube').getSetting(
                'youtube.api.key')),
        bool(
            control.addon('plugin.video.youtube').getSetting(
                'youtube.api.secret'))
    ]

    if int(YT_VERSION) >= 670:
        conditions.insert(
            0,
            control.addon('plugin.video.youtube').getSetting(
                'youtube.api.enable') == 'true')

    if any(conditions) and bool(control.setting('local')) or bool(
            control.setting('remote')):
        control.okDialog(control.addonInfo('name'), control.lang(30017))

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

        result = None

    elif control.setting('local_or_remote') == '0':

        result = local(control.setting('local'))

    else:

        result = remote(control.setting('remote'))

    if not result:

        control.okDialog(control.lang(30010), control.lang(30011))

    else:

        if control.yesnoDialog(line1=control.lang(30012),
                               line2='',
                               line3='',
                               yeslabel=control.lang(30013),
                               nolabel=control.lang(30014)):

            setup(result)

            if control.setting('wizard') == 'true':
                wizard()
            else:
                pass

        else:

            control.infoDialog(control.lang(30014))
コード例 #12
0
def delete_settings_xml():

    if path.exists(control.dataPath):
        if control.yesnoDialog(line1=control.lang(30348)):
            control.deleteFile(control.join(control.dataPath, 'settings.xml'))
            control.infoDialog(control.lang(30402))
        else:
            control.infoDialog(control.lang(30403))
    else:
        control.infoDialog(control.lang(30487))
コード例 #13
0
def purge_bookmarks():

    if path.exists(control.bookmarksFile):
        if control.yesnoDialog(line1=control.lang(30214)):
            control.deleteFile(control.bookmarksFile)
            control.infoDialog(control.lang(30402))
        else:
            control.infoDialog(control.lang(30403))
    else:
        control.infoDialog(control.lang(30139))
コード例 #14
0
def delete_history():

    if path.exists(HISTORY):
        if control.yesnoDialog(line1=control.lang(30484)):
            control.deleteFile(HISTORY)
            control.infoDialog(control.lang(30402))
        else:
            control.infoDialog(control.lang(30403))
    else:
        control.infoDialog(control.lang(30347))
コード例 #15
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))
コード例 #16
0
def ip_address_set():

    yesno = control.yesnoDialog(control.lang(30060),
                                yeslabel='127.0.0.1',
                                nolabel=get_ip())

    if yesno:

        control.setSetting('ip.address', '127.0.0.1')

    else:

        control.setSetting('ip.address', get_ip())
コード例 #17
0
def clear(table=None, withyes=True):
    try:
        control.idle()

        if table is None:
            table = ['rel_list', 'rel_lib']
        elif not type(table) == list:
            table = [table]

        if withyes:

            try:
                yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')
            except Exception:
                yes = control.yesnoDialog(control.lang(30401), '', '')

            if not yes:
                return

        else:

            pass

        dbcon = database.connect(control.cacheFile)
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS {0}".format(t))
                dbcur.execute("VACUUM")
                dbcon.commit()
            except Exception:
                pass

        control.infoDialog(control.lang(30402).encode('utf-8'))
    except Exception:
        pass
コード例 #18
0
ファイル: tools.py プロジェクト: DoBucki/Kodi_Remote_Manager
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))
コード例 #19
0
def delete(withyes=True):

    if withyes:

        yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '')

        if not yes:
            return

    else:

        pass

    control.deleteFile(control.cacheFile)

    control.infoDialog(control.lang(30402).encode('utf-8'))
コード例 #20
0
def delete(withyes=True, label_yes_no=30401, label_success=30402):

    if withyes:

        yes = control.yesnoDialog(
            control.lang(label_yes_no).encode('utf-8'), '', '')

        if not yes:
            return

    else:

        pass

    control.deleteFile(control.cacheFile)

    control.infoDialog(control.lang(label_success).encode('utf-8'))
コード例 #21
0
def debugging_toggle():

    if not control.get_a_setting('debug.showloginfo')['result']['value']:

        control.execute('ToggleDebug')

        if control.setting('debugging.toggle') == 'false':

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

            if yes:

                control.setSetting('debugging.toggle', 'true')
                log_debug('Debugging activated')

    else:

        control.setSetting('debugging.toggle', 'false')
        control.execute('ToggleDebug')
コード例 #22
0
ファイル: tools.py プロジェクト: DoBucki/Kodi_Remote_Manager
        def seq():

            string_start = '<keymap><slideshow><keyboard>'
            ok_button = ''
            long_ok_button = ''
            next_pic = ''
            previous_pic = ''
            context = ''
            string_end = '</keyboard></slideshow></keymap>'

            yes_clicked = control.yesnoDialog(control.lang(30026))

            if yes_clicked:

                to_write = string_start + ok_button + long_ok_button + next_pic + previous_pic + context + string_end

            else:

                to_write = string_start + ok_button + long_ok_button + context + string_end

            with open(location, 'w') as f:
                f.write(to_write)
コード例 #23
0
def revoke():

    yesno = control.yesnoDialog(control.lang(30079))

    if yesno:

        post = {'token': control.setting('access.token')}
        headers = {'User-Agent': user_agent()}
        username, password = (client_id, '')
        result = client.request(api_link('revoke_token'),
                                post=post,
                                headers=headers,
                                username=username,
                                password=password,
                                output='response')

        if control.setting('debugging.toggle') == 'true':
            log_debug('Revoking tokens, response: ' + result[0])

        tokens_reset()

        control.refresh()
コード例 #24
0
ファイル: addon.py プロジェクト: Twilight0/plugin.video.mgtow
elif action == 'playlist':

    playlist(url)

elif action == 'bookmarks':

    bm_list()

elif action == 'addBookmark':

    bookmarks.add(url)

elif action == 'deleteBookmark':

    bookmarks.delete(url)

elif action == 'settings':

    control.openSettings()

elif action == 'cache_clear':

    if control.yesnoDialog(line1=control.lang(30009), line2='', line3=''):

        cache.clear(withyes=False)

    else:

        control.infoDialog(control.lang(30011))
コード例 #25
0
ファイル: tools.py プロジェクト: DoBucki/Kodi_Remote_Manager
def setup_various_keymaps(keymap):

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

    if not path.exists(keymap_settings_folder):
        control.makeFile(keymap_settings_folder)

    if keymap == 'previous':

        location = control.join(keymap_settings_folder, 'alivegr_tvguide.xml')

        lang_int = 30025

        def seq():

            previous_keymap = """<keymap>
    <tvguide>
        <keyboard>
            <key id="61448">previousmenu</key>
        </keyboard>
    </tvguide>
    <tvchannels>
        <keyboard>
            <key id="61448">previousmenu</key>
        </keyboard>
    </tvchannels>
</keymap>
"""

            with open(location, 'w') as f:
                f.write(previous_keymap)

    elif keymap == 'mouse':

        location = control.transPath(control.join('special://profile', 'keymaps', 'alivegr_mouse.xml'))

        lang_int = 30238

        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

                with open(location, 'w') as f:
                    f.write(to_write)

    elif keymap == 'remote_slideshow':

        location = control.transPath(control.join('special://profile', 'keymaps', 'alivegr_remote_slideshow.xml'))

        lang_int = 30238

        def seq():

            string_start = '<keymap><slideshow><keyboard>'
            ok_button = ''
            long_ok_button = ''
            next_pic = ''
            previous_pic = ''
            context = ''
            string_end = '</keyboard></slideshow></keymap>'

            yes_clicked = control.yesnoDialog(control.lang(30026))

            if yes_clicked:

                to_write = string_start + ok_button + long_ok_button + next_pic + previous_pic + context + string_end

            else:

                to_write = string_start + ok_button + long_ok_button + context + string_end

            with open(location, 'w') as f:
                f.write(to_write)

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

    if yes:

        if path.exists(location):

            choices = [control.lang(30248), control.lang(30249)]

            choice = control.selectDialog(choices, heading=control.lang(30247))

            if choice == 0:

                seq()
                control.execute('Action(reloadkeymaps)')
                control.okDialog(control.name(), control.lang(30027) + ', ' + (control.lang(30028)))
                control.infoDialog(control.lang(30402))

            elif choice == 1:

                control.deleteFile(location)
                control.execute('Action(reloadkeymaps)')
                control.infoDialog(control.lang(30402))

            else:

                control.infoDialog(control.lang(30403))

        else:

            seq()
            control.okDialog(control.name(), control.lang(30027) + ', ' + (control.lang(30028)))
            control.infoDialog(control.lang(30402))

    else:

        control.infoDialog(control.lang(30403))
コード例 #26
0
def setup_various_keymaps(keymap):

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

    if not path.exists(keymap_settings_folder):
        control.makeFile(keymap_settings_folder)

    if keymap == 'previous':

        location = control.join(keymap_settings_folder, 'alivegr_tvguide.xml')

        lang_int = 30022

        def seq():

            previous_keymap = """<keymap>
    <tvguide>
        <keyboard>
            <key id="61448">previousmenu</key>
        </keyboard>
    </tvguide>
    <tvchannels>
        <keyboard>
            <key id="61448">previousmenu</key>
        </keyboard>
    </tvchannels>
</keymap>
"""

            with open(location, 'w') as f:
                f.write(previous_keymap)

    elif keymap == 'mouse':

        location = control.transPath(
            control.join('special://profile', 'keymaps', 'alivegr_mouse.xml'))

        lang_int = 30238

        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

                with open(location, 'w') as f:
                    f.write(to_write)

                control.execute('Action(reloadkeymaps)')

    elif keymap == 'samsung':

        string = '''<keymap>
    <global>
        <keyboard>
            <key id="61670">contextmenu</key>
        </keyboard>
    </global>
    <fullscreenvideo>
        <keyboard>
            <key id="61670">osd</key>
        </keyboard>
    </fullscreenvideo>
    <visualisation>
        <keyboard>
            <key id="61670">osd</key>
        </keyboard>
    </visualisation>
</keymap>'''

        location = control.join(keymap_settings_folder, 'samsung.xml')

        lang_int = 30022

        def seq():

            with open(location, 'w') as f:
                f.write(string)

    elif keymap == 'stop_playback':

        string = '''<keymap>
    <fullscreenvideo>
        <keyboard>
            <key id="61448">stop</key>
        </keyboard>
        <keyboard>
            <key id="61448" mod="longpress">back</key>
        </keyboard>
    </fullscreenvideo>
    <visualisation>
        <keyboard>
            <key id="61448">stop</key>
        </keyboard>
        <keyboard>
            <key id="61448" mod="longpress">back</key>
        </keyboard>
    </visualisation>
</keymap>'''

        location = control.join(keymap_settings_folder, 'stop_playback.xml')

        lang_int = 30022

        def seq():

            with open(location, 'w') as f:
                f.write(string)

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

    if yes:

        if path.exists(location):

            choices = [control.lang(30248), control.lang(30249)]

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

            if _choice == 0:

                seq()
                control.okDialog(
                    control.name(),
                    control.lang(30027) + ', ' + (control.lang(30028)))
                control.infoDialog(control.lang(30402))
                control.execute('Action(reloadkeymaps)')

            elif _choice == 1:

                control.deleteFile(location)
                control.infoDialog(control.lang(30402))
                control.execute('Action(reloadkeymaps)')

            else:

                control.infoDialog(control.lang(30403))

        else:

            seq()
            control.okDialog(
                control.name(),
                control.lang(30027) + ', ' + (control.lang(30028)))
            control.infoDialog(control.lang(30402))

            control.execute('Action(reloadkeymaps)')

    else:

        control.infoDialog(control.lang(30403))
コード例 #27
0
    def run(self, url, source):

        log_debug('Source selected: {0}'.format(source))

        path = control.join(control.dataPath, 'temp')

        try:

            path = path.decode('utf-8')

        except Exception:

            pass

        control.deleteDir(control.join(path, ''), force=True)
        control.makeFile(control.dataPath)
        control.makeFile(path)

        if control.setting('keep_subs') == 'true' or control.setting(
                'keep_zips') == 'true':

            if not control.get_info_label('ListItem.Path').startswith(
                    'plugin://') and control.setting('destination') == '0':
                output_path = control.get_info_label('Container.FolderPath')
            elif control.setting('output_folder').startswith('special://'):
                output_path = control.transPath(
                    control.setting('output_folder'))
            else:
                output_path = control.setting('output_folder')

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

        if source == 'subtitlesgr':

            subtitle = subtitlesgr.Subtitlesgr().download(path, url)

        elif source == 'xsubstv':

            subtitle = xsubstv.Xsubstv().download(path, url)

        elif source == 'podnapisi':

            subtitle = podnapisi.Podnapisi().download(path, url)

        elif source == 'vipsubs':

            subtitle = vipsubs.Vipsubs().download(path, url)

        else:

            subtitle = None

        if subtitle is not None:

            if control.setting('keep_subs') == 'true':

                # noinspection PyUnboundLocalVariable
                try:
                    if control.setting('destination') in ['0', '2']:
                        if control.infoLabel('{0}.Title'.format(
                                infolabel_prefix)).startswith('plugin://'):
                            copy(
                                subtitle,
                                control.join(output_path,
                                             os_split(subtitle)[1]))
                            log_debug(
                                'Item currently selected is not a local file, cannot save subtitle next to it'
                            )
                        else:
                            output_filename = control.join(
                                output_path, ''.join([
                                    splitext(
                                        control.infoLabel('ListItem.FileName'))
                                    [0],
                                    splitext(os_split(subtitle)[1])[1]
                                ]))
                            if exists(output_filename):
                                yesno = control.yesnoDialog(
                                    control.lang(30015))
                                if yesno:
                                    copy(subtitle, output_filename)
                            else:
                                copy(subtitle, output_filename)
                            if control.setting('destination') == '2':
                                if control.setting('output_folder').startswith(
                                        'special://'):
                                    output_path = control.transPath(
                                        control.setting('output_folder'))
                                else:
                                    output_path = control.setting(
                                        'output_folder')
                                copy(
                                    subtitle,
                                    control.join(output_path,
                                                 os_split(subtitle)[1]))
                    else:
                        copy(subtitle,
                             control.join(output_path,
                                          os_split(subtitle)[1]))
                    control.infoDialog(control.lang(30008))
                except Exception:
                    control.infoDialog(control.lang(30013))

            item = control.item(label=subtitle)
            control.addItem(handle=self.syshandle,
                            url=subtitle,
                            listitem=item,
                            isFolder=False)

        control.directory(self.syshandle)
コード例 #28
0
def setup_iptv():

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

    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

    def setup_client(apply=False):

        url = thgiliwt('=' + vtpi)

        if apply:

            xml = client.request(url)

            settings = re.findall(r'id="(\w*?)" value="(\S*?)"', xml)

            for k, v in settings:

                control.addon('pvr.iptvsimple').setSetting(k, v)

        else:

            if not path.exists(iptv_folder):
                control.makeFile(iptv_folder)

            client.retriever(url, control.join(iptv_folder, "settings.xml"))

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

        integer = 30021

    else:

        integer = 30023

    if control.yesnoDialog(line1=control.lang(integer) + '[CR]' +
                           control.lang(30022)):

        success = install()

        if success:

            setup_client(apply=success == 'enabled')
            control.infoDialog(message=control.lang(30024), time=2000)
            enable_iptv()
            enable_proxy_module()

        else:

            control.okDialog('AliveGR', control.lang(30410))

    else:

        control.infoDialog(message=control.lang(30029), time=2000)
コード例 #29
0
def keymap_edit():

    location = control.transPath(control.join('special://profile', 'keymaps', 'tc.xml'))

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

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

        map_left = control.lang(30031)
        map_right = control.lang(30032)
        map_middle = control.lang(30033)
        map_up = control.lang(30034)
        map_down = control.lang(30035)

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

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

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

        if not indices:

            control.infoDialog(control.lang(30036))

        else:

            finalized = []

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

            joined = ''.join(finalized)

            to_write = string_start + joined + string_end

            with open(location, 'w') as f:
                f.write(to_write)

            control.execute('Action(reloadkeymaps)')

            control.infoDialog(control.lang(30015))

    yes = control.yesnoDialog(control.lang(30028), control.lang(30014))

    if yes:

        if control.exists(location):

            choices = [control.lang(30038), control.lang(30039)]

            choice = control.selectDialog(choices)

            if choice == 0:

                seq()

            elif choice == 1:

                control.deleteFile(location)
                control.execute('Action(reloadkeymaps)')

            else:

                control.infoDialog(control.lang(30016))

        else:

            seq()

    else:

        control.infoDialog(control.lang(30016))