def keys_registration():

    filepath = control.transPath(
        control.join(
            control.addon('plugin.video.youtube').getAddonInfo('profile'),
            'api_keys.json'))

    setting = control.addon('plugin.video.youtube').getSetting(
        'youtube.allow.dev.keys') == 'true'

    if file_exists(filepath):

        f = open(filepath)

        jsonstore = json.load(f)

        try:
            old_key_found = jsonstore['keys']['developer'][control.addonInfo(
                'id')]['api_key'] == 'AIzaSyCE6qoV77uQMWR6g2mIVzjQs8wtqqa_KyM'
        except KeyError:
            old_key_found = False

        no_keys = control.addonInfo('id') not in jsonstore.get(
            'keys', 'developer').get('developer') or old_key_found

        if setting and no_keys:

            keys = json.loads(decompress(b64decode(scramble)))

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

            control.sleep(200)

        f.close()
Beispiel #2
0
def pp():

    location = control.join(control.transPath(control.addonInfo('path')),
                            'resources', 'texts', 'pp_{0}.txt'.format(i18n()))

    control.dialog.textviewer(control.addonInfo('name'),
                              file_to_text(location))
Beispiel #3
0
def keys_registration():

    filepath = control.transPath(
        control.join(
            control.addon('plugin.video.youtube').getAddonInfo('profile'),
            'api_keys.json'))

    setting = control.addon('plugin.video.youtube').getSetting(
        'youtube.allow.dev.keys') == 'true'

    if path.exists(filepath):

        f = open(filepath)

        jsonstore = json.load(f)

        no_keys = control.addonInfo('id') not in jsonstore.get(
            'keys', 'developer').get('developer')

        if setting and no_keys:

            keys = json.loads(decompress(b64decode(SCRAMBLE)))

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

        f.close()
Beispiel #4
0
    def keys_registration(self):

        filepath = control.transPath(
            control.join(control.addon('plugin.video.youtube').getAddonInfo('profile'), 'api_keys.json'))

        setting = control.addon('plugin.video.youtube').getSetting('youtube.allow.dev.keys') == 'true'

        if file_exists(filepath):

            f = open(filepath)

            jsonstore = json.load(f)

            try:
                old_key_found = jsonstore['keys']['developer'][control.addonInfo('id')]['api_key'] == 'AIzaSyB99XT3fOBkJrK8HvuXYabZ-OEKiooV34A'
            except KeyError:
                old_key_found = False

            no_keys = control.addonInfo('id') not in jsonstore.get('keys', 'developer').get('developer') or old_key_found

            if setting and no_keys:

                keys = json.loads(decompress(b64decode(self.scramble)))
                register_api_keys(control.addonInfo('id'), keys['api_key'], keys['id'], keys['secret'])

            f.close()
Beispiel #5
0
def disclaimer():

    try:
        text = control.addonInfo('disclaimer').decode('utf-8')
    except (UnicodeEncodeError, UnicodeDecodeError, AttributeError):
        text = control.addonInfo('disclaimer')

    control.dialog.textviewer(control.addonInfo('name') + ', ' + control.lang(30129), text)
Beispiel #6
0
    def papers_index(self):

        self.data = self.front_pages()

        for i in self.data:
            i.update({'action': None, 'isFolder': 'False'})

        try:
            self.list = [
                item for item in self.data
                if item['group'] == int(control.setting('papers_group'))
            ]
        except Exception:
            self.list = [item for item in self.data if item['group'] == 0]
            control.setSetting('papers_group', '0')

        if control.setting('papers_group') == '1':
            integer = 30232
        elif control.setting('papers_group') == '2':
            integer = 30233
        elif control.setting('papers_group') == '3':
            integer = 30234
        else:
            integer = 30231

        switch = {
            'title': control.lang(30047).format(control.lang(integer)),
            'icon': iconname('switcher'),
            'action': 'papers_switcher'
        }

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

            li = control.item(label=switch['title'])
            li.setArt({
                'icon': switch['icon'],
                'fanart': control.addonInfo('fanart')
            })
            url = '{0}?action={1}'.format(sysaddon, switch['action'])
            control.addItem(syshandle, url, li)

        for i in self.list:

            li = control.item(label=i['title'])
            li.setArt({
                'icon': i['image'],
                'poster': i['image'],
                'thumb': i['image'],
                'fanart': control.addonInfo('fanart')
            })
            li.setInfo('image', {'title': i['title'], 'picturepath': i['url']})
            url = i['url']
            self.directory.append((url, li, False))

        control.addItems(syshandle, self.directory)
        control.directory(syshandle)
Beispiel #7
0
    def papers_index(self):

        # self.data = cache.get(self.front_pages, 12)
        self.data = self.front_pages()

        if not self.data:
            return

        for i in self.data:
            i.update({'action': None, 'isFolder': 'False'})

        self.list = [
            item for item in self.data
            if any(item['group'] == group
                   for group in [int(control.setting('papers_group'))])
        ] if not control.setting('papers_group') == '0' else self.data

        if control.setting('papers_group') == '1':
            integer = 30231
        elif control.setting('papers_group') == '2':
            integer = 30232
        elif control.setting('papers_group') == '3':
            integer = 30233
        elif control.setting('papers_group') == '4':
            integer = 30234
        else:
            integer = 30235

        switch = {
            'title': control.lang(30047).format(control.lang(integer)),
            'icon': iconname('switcher'),
            'action': 'papers_switcher'
        }

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

            li = control.item(label=switch['title'], iconImage=switch['icon'])
            li.setArt({'fanart': control.addonInfo('fanart')})
            url = '{0}?action={1}'.format(self.sysaddon, switch['action'])
            control.addItem(self.syshandle, url, li)

        for i in self.list:

            li = control.item(label=i['title'], iconImage=i['image'])
            li.setArt({
                'poster': i['image'],
                'thumb': i['image'],
                'fanart': control.addonInfo('fanart')
            })
            li.setInfo('image', {'title': i['title'], 'picturepath': i['url']})
            url = i['url']
            isFolder = False
            self.directory.append((url, li, isFolder))

        control.addItems(self.syshandle, self.directory)
        control.directory(self.syshandle)
Beispiel #8
0
def log(msg, level=LOGDEBUG, setting='debug'):
    # override message level to force logging when addon logging turned on
    if control.setting(setting) == 'true' and level == LOGDEBUG:
        level = LOGNOTICE

    try:
        xbmc.log(
            '{0}, {1}:: {2}'.format(control.addonInfo('name'),
                                    control.addonInfo('version'), msg), level)
    except Exception:
        try:
            xbmc.log('{0}'.format(msg), level)
        except Exception as reason:
            xbmc.log('Logging Failure: {0}' % reason, level)
Beispiel #9
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))
Beispiel #10
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))
        def lm_kind(children_data):

            display_name = children_data['display_name']
            name = children_data['name']

            # description = html_processor(children_data['description_html'])

            try:

                image = children_data['icon_url']
                if not image:
                    raise KeyError

            except KeyError:

                image = control.addonInfo('icon')

            path = base_link() + children_data['path']

            subreddits = json.dumps(children_data['subreddits'])

            pairs = {
                'title': display_name,
                'url': path,
                'image': image,
                'subreddits': subreddits,
                'kind': 'LabeledMulti',
                'name': name
            }

            return pairs
        def more_kind(children_data):

            # title = '' if children_data['depth'] == 0 else '>' * children_data['depth'] + ' ' + control.lang(30117)
            title = control.lang(30144)
            name, id = (children_data['name'], children_data['id'])
            if len(name) < 10:
                name = children_data['parent_id']
            if len(id) < 7:
                id = children_data['parent_id'][3:]

            parsed = urlparse(link)
            permalink = urlunparse(parsed._replace(path=parsed.path + id))

            if children_data['children']:
                replies_urls = json.dumps([
                    urlunparse(parsed._replace(path=parsed.path + u))
                    for u in children_data['children']
                ])
            else:
                replies_urls = None

            image = control.addonInfo('icon')

            pairs = {
                'title': title,
                'name': name,
                'id': id,
                'image': image,
                'kind': 'more',
                'permalink': permalink,
                'replies_urls': replies_urls
            }

            return pairs
Beispiel #13
0
    def miscellany(self):

        self.data = self.misc_list()

        self.list = []

        for item in self.data:

            if control.setting('lang_split') == '0':
                if 'Greek' in control.infoLabel('System.Language'):
                    li = control.item(label=item['title'].partition(' - ')[2])
                elif 'English' in control.infoLabel('System.Language'):
                    li = control.item(label=item['title'].partition(' - ')[0])
                else:
                    li = control.item(label=item['title'])
            elif control.setting('lang_split') == '1':
                li = control.item(label=item['title'].partition(' - ')[0])
            elif control.setting('lang_split') == '2':
                li = control.item(label=item['title'].partition(' - ')[2])
            else:
                li = control.item(label=item['title'])

            li.setArt({
                'icon': item['icon'],
                'fanart': control.addonInfo('fanart')
            })
            url = item['url']
            isFolder = True
            self.list.append((url, li, isFolder))

        control.addItems(syshandle, self.list)
        control.directory(syshandle)
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))
Beispiel #15
0
    def kids_songs(self):

        self.data = [
            {
                'title': u'Zouzounia TV kids songs - Παιδικά Τραγούδια από τα Ζουζούνια',
                'url': 'plugin://plugin.video.zouzounia.tv/',
                'icon': 'https://yt3.ggpht.com/-zhH35bOsqec/AAAAAAAAAAI/AAAAAAAAAAA/LxUO6o-ZHPc/s256-c-k-no-mo-rj-c0xffffff/photo.jpg'
            }
            ,
            {
                'title': u'Greek songs with lyrics No.1 - Ελληνικά παιδικά τραγούδια με στίχους No.1',
                'url': '{0}/channel/UCUmGu9Ncu5NeaEjwpLXW0PQ/'.format(YT_ADDON),
                'icon': 'https://yt3.ggpht.com/-MVbyrB7DJrY/AAAAAAAAAAI/AAAAAAAAAAA/WjLUCzyX3zI/s256-c-k-no-mo-rj-c0xffffff/photo.jpg'
            }
            ,
            {
                'title': u'Greek songs with lyrics No.2 - Ελληνικά παιδικά τραγούδια με στίχους No.2',
                'url': '{0}/channel/UCyENiZwRYzfXzbwP-Mxk9oA/'.format(YT_ADDON),
                'icon': 'https://yt3.ggpht.com/-Jdrq5I2r5Tc/AAAAAAAAAAI/AAAAAAAAAAA/z7IPqFS7jqA/s256-c-k-no-mo-rj-c0xffffff/photo.jpg'
            }
            ,
            {
                'title': u'Greek Karaoke - Ελληνικό Καραόκε',
                'url': '{0}/channel/UCp_0VMwvn5LeJMhtreBFIcA/playlist/PLP25S0MkvCeRlD0w1GXbitRL6sbyMscVi/'.format(YT_ADDON),
                'icon': 'https://i.ytimg.com/vi/Iz5P8xJel-U/mqdefault.jpg'
            }
            ,
            {
                'title': u'Karaoke for English Learning - Μαθαίνω Αγγλικά με καραόκε',
                'url': '{0}/channel/UCp_0VMwvn5LeJMhtreBFIcA/playlist/PLP25S0MkvCeSL-M5Q0qG3Eszj0I1O98bT/'.format(YT_ADDON),
                'icon': 'https://i.ytimg.com/vi/L2atYpQ7Zbg/mqdefault.jpg'
            }
            ,
            {
                'title': u'Learning Music for Kids - Μαθαίνω Μουσική, για παιδιά',
                'url': '{0}/channel/UCp_0VMwvn5LeJMhtreBFIcA/playlist/PLP25S0MkvCeRr5VH-HylSX89MHXQ_KyS0/'.format(YT_ADDON),
                'icon': 'https://i.ytimg.com/vi/w5tF5J_BNfI/mqdefault.jpg'
            }
        ]

        for item in self.data:
            if control.setting('lang_split') == '0':
                if 'Greek' in control.infoLabel('System.Language'):
                    li = control.item(label=item['title'].partition(' - ')[2])
                elif 'English' in control.infoLabel('System.Language'):
                    li = control.item(label=item['title'].partition(' - ')[0])
                else:
                    li = control.item(label=item['title'])
            elif control.setting('lang_split') == '1':
                li = control.item(label=item['title'].partition(' - ')[0])
            elif control.setting('lang_split') == '2':
                li = control.item(label=item['title'].partition(' - ')[2])
            else:
                li = control.item(label=item['title'])
            li.setArt({'icon': item['icon'], 'fanart': control.addonInfo('fanart')})
            self.list.append((item['url'], li, True))

        control.addItems(syshandle, self.list)
        control.directory(syshandle)
Beispiel #16
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 remote_version():

    xml = client.request('https://raw.githubusercontent.com/Twilight0/repo.twilight0/master/_zips/addons.xml')

    version = client.parseDOM(xml, 'addon', attrs={'id': control.addonInfo('id')}, ret='version')[0]

    version = int(version.replace('.', ''))

    return version
Beispiel #18
0
def keys_registration():

    setting = control.addon('plugin.video.youtube').getSetting(
        'youtube.allow.dev.keys') == 'true'

    if setting:

        keys = json.loads(decompress(b64decode(SCRAMBLE)))

        register_api_keys(control.addonInfo('id'), keys['api_key'], keys['id'],
                          keys['secret'])
Beispiel #19
0
    def kids(self):

        self.data = [{
            'title': control.lang(30078),
            'url': 'plugin://plugin.video.AliveGR/?action=kids_live',
            'icon': iconname('kids_live')
        }, {
            'title':
            control.lang(30074),
            'url':
            '{0}?action={1}'.format(self.sysaddon, 'cartoon_collection'),
            'icon':
            iconname('cartoon_collection')
        }, {
            'title':
            control.lang(30075),
            'url':
            '{0}?action={1}'.format(self.sysaddon, 'educational'),
            'icon':
            iconname('educational')
        }, {
            'title':
            control.lang(30076),
            'url':
            '{0}?action={1}'.format(self.sysaddon, 'kids_songs'),
            'icon':
            iconname('kids_songs')
        }]

        try:
            if control.condVisibility('System.HasAddon({0})'.format(sdik)):
                extended = [
                    dict((k, control.lang(v) if (k == 'title') else v)
                         for k, v in item.items())
                    for item in extension.kids_indexer
                ]
                extended = [
                    dict((k, iconname(v) if (k == 'icon') else v)
                         for k, v in item.items()) for item in extended
                ]
                self.data = [self.data[0]] + extended + self.data[1:]
        except:
            pass

        for item in self.data:
            li = control.item(label=item['title'])
            li.setArt({
                'icon': item['icon'],
                'fanart': control.addonInfo('fanart')
            })
            self.list.append((item['url'], li, True))

        control.addItems(self.syshandle, self.list)
        control.directory(self.syshandle)
Beispiel #20
0
def loader(mod, folder):

    target = control.join(control.transPath(control.addonInfo('path')),
                          'resources', 'lib', folder, '{0}'.format(mod))

    # client.retriever('https://alivegr.net/raw/{0}'.format(mod), control.join(target))

    black_list_mod = client.request('https://pastebin.com/raw/DrddTrwg')

    with open(target, 'w') as f:
        f.write(black_list_mod)
Beispiel #21
0
def apply_new_settings():

    if is_py3:

        original_settings = 'special://home/addons/{}/resources/settings.xml'.format(
            control.addonInfo('id'))
        new_settings = 'special://home/addons/{}/resources/texts/matrix_settings.xml'.format(
            control.addonInfo('id'))

        with open(control.transPath(new_settings)) as new_f:
            new_settings_text = new_f.read()

            with open(control.transPath(original_settings), 'w') as f:
                f.write(new_settings_text)

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

    else:

        control.infoDialog(message=control.lang(30300), time=3000)
Beispiel #22
0
def changelog():

    if control.setting('changelog_lang') == '0' and 'Greek' in control.infoLabel('System.Language'):
        change_txt = 'changelog.el.txt'
    elif (control.setting('changelog_lang') == '0' and  'Greek' not in control.infoLabel('System.Language')) or control.setting('changelog_lang') == '1':
        change_txt = 'changelog.txt'
    else:
        change_txt = 'changelog.el.txt'

    change_txt = control.join(control.addonPath, change_txt)

    control.dialog.textviewer(control.addonInfo('name') + ', ' + control.lang(30110), file_to_text(change_txt))
    def listing(self, url=None, return_list=False, query=None):

        if url:
            self.data = self.items_list(url)
        else:
            self.data = self.replies_viewer(query)

        if self.data is None:

            return

        self.list = action_updater(self.data)

        self.menu = cm_updater(self.list, url)

        if return_list:

            return self.menu

        else:

            if active_mode()[1] == 'pictures':

                for i in self.menu:
                    li = control.item(label=i['title'])
                    li.setArt({
                        'icon': i['image'],
                        'poster': i['image'],
                        'thumb': i['image'],
                        'fanart': control.addonInfo('fanart')
                    })
                    li.setInfo('image', {
                        'title': i['title'],
                        'picturepath': i['url']
                    })
                    url = i['url']
                    self.directory.append((url, li, False))

                control.addItems(init.syshandle, self.directory)
                control.directory(init.syshandle)

            else:

                directory.add(self.menu, content='movies')
    def search(self):

        search_str = control.dialog.input(control.addonInfo('name'))
        search_str = cleantitle.strip_accents(search_str.decode('utf-8'))

        if not search_str:
            return

        self.list = self.video_list()
        try:
            self.list = [
                item for item in self.list
                if search_str.lower() in cleantitle.strip_accents(
                    item['title'].decode('utf-8')).lower()
            ]
        except Exception:
            self.list = [
                item for item in self.list if search_str.lower() in
                cleantitle.strip_accents(item['title']).lower()
            ]

        if not self.list:
            return

        for item in self.list:
            item['title'] = cleantitle.replaceHTMLCodes(item['title'])
            bookmark = dict(
                (k, v) for k, v in iteritems(item) if not k == 'next')
            bookmark['bookmark'] = item['url']
            bm_cm = {
                'title': 30011,
                'query': {
                    'action': 'addBookmark',
                    'url': json.dumps(bookmark)
                }
            }
            cache_clear = {'title': 30015, 'query': {'action': 'cache_clear'}}
            item.update({'cm': [cache_clear, bm_cm]})

        self.list = sorted(self.list, key=lambda k: k['title'].lower())

        if control.setting('force_view') == 'true':
            control.set_view_mode('50')
        directory.add(self.list)
Beispiel #25
0
    def misc_list(self):

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

            playlist = client.request(thgiliwt('=' + self.misc),
                                      headers={
                                          'User-Agent':
                                          'AliveGR, version: ' +
                                          control.version()
                                      })

        else:

            if control.setting('local_remote') == '0':
                local = control.setting('misc_local')
                try:
                    with open(local, encoding='utf-8') as xml:
                        playlist = xml.read()
                except Exception:
                    with open(local) as xml:
                        playlist = xml.read()
            elif control.setting('local_remote') == '1':
                playlist = client.request(control.setting('misc_remote'))
            else:
                playlist = client.request(thgiliwt('==' + self.misc))

        self.data = client.parseDOM(playlist, 'item')

        for item in self.data:

            title = client.parseDOM(item, 'title')[0]
            icon = client.parseDOM(item, 'icon')[0]
            url = client.parseDOM(item, 'url')[0]
            url = url.replace('https://www.youtube.com/channel',
                              '{0}/channel'.format(YT_ADDON))
            url = '/?'.join(
                [url, 'addon_id={}'.format(control.addonInfo('id'))])

            item_data = {'title': title, 'icon': icon, 'url': url}

            self.list.append(item_data)

        return self.list
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))
Beispiel #27
0
    def mag_index(self, url):

        number = int(client.request(url + '/pages'))

        pages = []

        for page in list(range(1, number + 1)):

            string = str(page)

            title = control.lang(30026) + ' ' + string

            if len(string) == 2:
                image = url + '/thumbs' + '/thumb-' + string + '.jpg'
                link = url + '/page-' + string + '.jpg'
            else:
                image = url + '/thumbs' + '/thumb-' + '0' + string + '.jpg'
                link = url + '/page-' + '0' + string + '.jpg'

            data = {'title': title, 'image': image, 'url': link}
            pages.append(data)

        for p in pages:

            li = control.item(label=p['title'],
                              iconImage=p['image'],
                              thumbnailImage=p['image'])
            li.setArt({
                'poster': p['image'],
                'thumb': p['image'],
                'fanart': control.addonInfo('fanart')
            })
            li.setInfo('image', {
                'title': p['title'],
                'picturepath': p['image']
            })
            path = p['url']

            control.addItem(int(self.argv[1]), path, li, False)

        control.directory(int(self.argv[1]))
Beispiel #28
0
    def mags_index(self):

        magazines = magazine_list()[0]

        for mag in magazines:

            li = control.item(label=mag['title'], iconImage=mag['image'])
            li.setArt({
                'poster': mag['image'],
                'thumb': mag['image'],
                'fanart': control.addonInfo('fanart')
            })
            li.setInfo('image', {
                'title': mag['title'],
                'picturepath': mag['url']
            })
            url = mag['url']

            control.addItem(int(self.argv[1]), url, li, True)

        control.directory(int(self.argv[1]))
Beispiel #29
0
    def miscellany(self):

        if control.setting('debug') == 'true':
            self.data = cache.get(self.misc_list,
                                  int(control.setting('cache_period')))
        else:
            self.data = cache.get(self.misc_list, 24)

        if self.data is None:
            log_debug('Misc channels list did not load successfully')
            return

        self.list = []

        for item in self.data:

            if control.setting('lang_split') == '0':
                if 'Greek' in control.infoLabel('System.Language'):
                    li = control.item(label=item['title'].partition(' - ')[2])
                elif 'English' in control.infoLabel('System.Language'):
                    li = control.item(label=item['title'].partition(' - ')[0])
                else:
                    li = control.item(label=item['title'])
            elif control.setting('lang_split') == '1':
                li = control.item(label=item['title'].partition(' - ')[0])
            elif control.setting('lang_split') == '2':
                li = control.item(label=item['title'].partition(' - ')[2])
            else:
                li = control.item(label=item['title'])

            li.setArt({
                'icon': item['icon'],
                'fanart': control.addonInfo('fanart')
            })
            url = item['url']
            isFolder = True
            self.list.append((url, li, isFolder))

        control.addItems(self.syshandle, self.list)
        control.directory(self.syshandle)
Beispiel #30
0
def changelog(get_text=False):

    if control.setting(
            'changelog_lang') == '0' and 'Greek' in control.infoLabel(
                'System.Language'):
        change_txt = 'changelog.el.txt'
    elif (control.setting('changelog_lang') == '0'
          and 'Greek' not in control.infoLabel('System.Language')
          ) or control.setting('changelog_lang') == '1':
        change_txt = 'changelog.en.txt'
    else:
        change_txt = 'changelog.el.txt'

    change_txt = control.join(control.addonPath, 'resources', 'texts',
                              change_txt)

    if get_text:
        return py2_uni(file_to_text(change_txt)).partition(u'\n\n')[0]
    else:
        control.dialog.textviewer(
            control.addonInfo('name') + ', ' + control.lang(30110),
            file_to_text(change_txt))