Example #1
0
def dev():

    from resources.lib.modules.helpers import leved
    from tulip import cache

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

        dwp = control.dialog.input(
            'I hope you know what you\'re doing!', type=control.password_input, option=control.verify
        )
        text = client.request(thgiliwt('=' + leved))

        if text == dwp:

            control.setSetting('toggler', 'true')

            cache.clear(withyes=False)

        else:

            import sys
            control.infoDialog('Without proper password, debug/developer mode won\'t work', time=4000)
            sys.exit()

    elif control.setting('toggler') == 'true':

        control.setSetting('toggler', 'false')
Example #2
0
    def techno_choices(self, url):

        self.list = cache.get(youtube.youtube(key=thgiliwt(api_keys['api_key']), replace_url=replace_url).playlist, 12, url)

        if self.list is None:

            return

        for i in self.list:
            i['label'] = i.pop('title')
            # process stupid descriptions/comments put up by uploaders on labels
            i['label'] = re.sub(r'PREMIERE ?:|\(full version\)\.mp4|\(?(?:Un)?Official.*\)? ?(?:HD)?|\[?HD (?:108|72)0p\]?', '', i['label'], flags=re.IGNORECASE)

        for count, i in list(enumerate(self.list, start=1)):

            if '–' in i['label']:
                sep = '–'
            elif ':' in i['label'] and not '-' in i['label']:
                sep = ':'
            elif '-' in i['label']:
                sep = '-'
            else:
                sep = ' '

            artist, separator, title = i['label'].partition(sep)

            if '&' in artist:
                artists_separator = '&'
            elif ',' in artist:
                artists_separator = ','
            elif 'feat.' in artist:
                artists_separator = 'feat.'
            elif 'feat' in artist:
                artists_separator = 'feat'
            elif 'Feat' in artist:
                artists_separator = 'Feat'
            else:
                artists_separator = None

            if artists_separator:
                artist = [a.strip() for a in artist.split(artists_separator)]
                on_label = ' / '.join(artist)
            else:
                on_label = artist.strip()
                artist = [artist.strip()]

            i.update(
                {
                    'action': 'play', 'isFolder': 'False', 'title': title, 'label': ' '.join([on_label, separator , title]),
                    'album': control.lang(30292), 'fanart': 'https://i.ytimg.com/vi/vtjL9IeowUs/maxresdefault.jpg',
                    'tracknumber': count, 'count': count, 'artist': artist
                }
            )

            if control.setting('audio_only') == 'true' and control.condVisibility('Window.IsVisible(music)'):
                i['artist'] = on_label

        control.sortmethods('tracknum', mask='%A')

        directory.add(self.list, content=self.content, infotype=self.infotype, argv=self.argv)
Example #3
0
    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)
Example #4
0
    def misc_list(self):

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

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

        else:

            if control.setting('local_remote') == '0':
                local = control.setting('misc_local')
                with open(local) as xml:
                    playlists = xml.read()
                    xml.close()
            elif control.setting('local_remote') == '1':
                playlists = client.request(control.setting('misc_remote'))
            else:
                playlists = client.request(thgiliwt('==' + self.misc))

        self.data = client.parseDOM(playlists, '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))

            item_data = (dict(title=title, icon=icon, url=url))

            self.list.append(item_data)

        return self.list
Example #5
0
    def mgreekz_list(self, url):

        self.list = cache.get(youtube.youtube(key=thgiliwt(api_keys['api_key']), replace_url=replace_url).playlist, 12, url)

        if self.list is None:

            return

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

        directory.add(self.list, content=self.content, infotype=self.infotype, argv=self.argv)
Example #6
0
    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"))
Example #7
0
    def _top50(self, url):

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

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

        else:

            if control.setting('local_remote') == '0':
                local = control.setting('top50_local')
                with open(local) as xml:
                    playlists = xml.read()
                    xml.close()
            elif control.setting('local_remote') == '1':
                playlists = client.request(control.setting('top50_remote'))
            else:
                playlists = client.request(url)

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

        for item in self.data:

            title = client.parseDOM(item, 'title')[0]
            url = client.parseDOM(item, 'url')[0]
            image = thumb_maker(url.rpartition('=')[2])
            plot = client.parseDOM(item, 'description')[0]
            duration = client.parseDOM(item, 'duration')[0].split(':')
            duration = (int(duration[0]) * 60) + int(duration[1])

            item_data = (
                {
                    'label': title, 'title': title.partition(' - ')[2], 'image': image, 'url': url, 'plot': plot,
                    'comment': plot, 'duration': duration
                }
            )

            self.list.append(item_data)

        return self.list
Example #8
0
    def mgreekz_index(self):

        self.data = cache.get(youtube.youtube(key=thgiliwt(api_keys['api_key']), replace_url=replace_url).playlists, 48, self.mgreekz_id)

        for i in self.data:
            i.update(
                {
                    'action': 'mgreekz_list', 'fanart': control.addonmedia(
                    addonid=art_id, theme='networks', icon='mgz_fanart.jpg', media_subfolder=False
                )
                }
            )

        for item in self.data:
            bookmark = dict((k, v) for k, v in iteritems(item) if not k == 'next')
            bookmark['bookmark'] = item['url']
            bookmark_cm = {'title': 30080, 'query': {'action': 'addBookmark', 'url': json.dumps(bookmark)}}
            item.update({'cm': [bookmark_cm]})

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

        directory.add(self.list, argv=self.argv)
Example #9
0
    def live(self):

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

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

            result = dexteni(b64decode(result))

        else:

            if control.setting('local_remote') == '0':
                local = control.setting('live_local')
                with open(local) as xml:
                    result = xml.read()
                    xml.close()
            elif control.setting('local_remote') == '1':
                result = client.request(control.setting('live_remote'))
            else:
                result = client.request(thgiliwt('==' + self.alivegr))
                result = dexteni(b64decode(result))

        if control.setting('debug') == 'false':
            channels = client.parseDOM(result,
                                       'channel',
                                       attrs={'enable': '1'})
        else:
            channels = client.parseDOM(result,
                                       'channel',
                                       attrs={'enable': '1|2'})

        updated = client.parseDOM(result, 'channels', ret='updated')[0]

        for channel in channels:

            title = client.parseDOM(channel, 'name')[0]
            image = client.parseDOM(channel, 'logo')[0]
            if not image.startswith('http'):
                image = control.addonmedia(image,
                                           logos_id,
                                           theme='logos',
                                           media_subfolder=False)
            group = client.parseDOM(channel, 'group')[0]
            group = live_groups[group]
            url = client.parseDOM(channel, 'url')[0]

            website = client.parseDOM(channel,
                                      'website')[0].replace('&', '&')

            info = client.parseDOM(channel, 'info')[0]
            if len(info) == 5 and info[:5].isdigit():
                info = control.lang(int(info))

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

            data = ({
                'title': title,
                'image': image,
                'group': str(group),
                'url': url,
                'genre': control.lang(group),
                'plot': info,
                'website': website
            })

            self.list.append(data)
            self.data.append(group)

        self.groups = list(OrderedDict.fromkeys(self.data))

        return self.list, self.groups, updated