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)
def sports(self): self.list = [{ 'title': 30116, 'action': 'sports_news', 'icon': iconname('news') }, { 'title': 30117, 'action': 'gm_sports', 'icon': iconname('sports') }] directory.add(self.list, argv=self.argv)
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)
def bookmarks(self): self.data = bookmarks.get() if not self.data: log_debug('Bookmarks list is empty') na = [{'title': 30033, 'action': None, 'icon': iconname('empty')}] directory.add(na) else: for i in self.data: if i['url'].startswith( (movies_link, theater_link, shortfilms_link)): if control.setting('action_type') == '1': try: del i['isFolder'] except: pass action = 'directory' elif control.setting( 'action_type') == '2' and control.setting( 'auto_play') == 'false': try: del i['isFolder'] except: pass action = i['action'] else: action = i['action'] else: action = i['action'] i['action'] = action item = dict((k, v) for k, v in iteritems(i) if not k == 'next') item['delbookmark'] = i['url'] i.update({ 'cm': [{ 'title': 30081, 'query': { 'action': 'deleteBookmark', 'url': json.dumps(item) } }] }) self.list = sorted(self.data, key=lambda k: k['title'].lower()) directory.add(self.list, argv=self.argv)
def audio(self): self.list = [{ 'title': 30002, 'action': 'radio', 'icon': iconname('radios') }, { 'title': 30125, 'action': 'music', 'icon': iconname('music') }] for item in self.list: refresh = {'title': 30054, 'query': {'action': 'refresh'}} cache_clear = {'title': 30056, 'query': {'action': 'cache_clear'}} reset_idx = {'title': 30134, 'query': {'action': 'reset_idx'}} settings = {'title': 30011, 'query': {'action': 'openSettings'}} tools = {'title': 30137, 'query': {'action': 'tools_menu'}} item.update( {'cm': [refresh, cache_clear, reset_idx, settings, tools]}) directory.add(self.list, argv=self.argv)
def page_menu(pages, reset=False): if not reset: index = str(int(control.setting('page')) + 1) else: index = '1' menu = { 'title': control.lang(30414).format(index), 'action': 'page_selector', 'query': str(pages), 'icon': iconname('switcher'), 'isFolder': 'False', 'isPlayable': 'False' } return menu
def gm_music(self): html = cache.get(gm.root, 96, gm.music_link) options = re.compile('(<option value=.+?</option>)', re.U).findall(html) for option in options: title = client.parseDOM(option, 'option')[0] link = client.parseDOM(option, 'option', ret='value')[0] link = urljoin(gm.base_link, link) data = {'title': title, 'url': link, 'image': iconname('music'), 'action': 'artist_index'} self.list.append(data) directory.add(self.list, argv=self.argv)
def music_list(self, url): html = client.request(url) if 'albumlist' in html: artist = [client.parseDOM(html, 'h4')[0].partition(' <a')[0]] else: artist = None if control.setting('audio_only') == 'true' and control.condVisibility('Window.IsVisible(music)') and artist is not None: artist = ''.join(artist) if 'songlist' in html: songlist = client.parseDOM(html, 'div', attrs={'class': 'songlist'})[0] items = client.parseDOM(songlist, 'li') elif 'albumlist' in html: albumlist = client.parseDOM(html, 'div', attrs={'class': 'albumlist'})[0] items = client.parseDOM(albumlist, 'li') else: artistlist = client.parseDOM(html, 'div', attrs={'class': 'artistlist'})[0] items = client.parseDOM(artistlist, 'li') if 'icon/music' in html: icon = client.parseDOM(html, 'img', attrs={'class': 'img-responsive'}, ret='src')[-1] icon = urljoin(gm.base_link, icon) else: icon = iconname('music') for item in items: title = client.parseDOM(item, 'a')[0] link = client.parseDOM(item, 'a', ret='href')[0] link = urljoin(gm.base_link, link) data = {'title': title, 'url': link, 'image': icon, 'artist': artist} self.list.append(data) return self.list
def root(self): self.list = [{ 'title': control.lang(30001), 'action': 'live_tv', 'icon': iconname('monitor'), 'boolean': control.setting('show_live') == 'true' }, { 'title': control.lang(30036), 'action': 'pvr_client', 'icon': iconname('guide'), 'boolean': control.setting('show_pvr') == 'true', 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.lang(30008), 'action': 'networks', 'icon': iconname('networks'), 'boolean': control.setting('show_networks') == 'true' }, { 'title': control.lang(30123), 'action': 'news', 'icon': iconname('news'), 'boolean': control.setting('show_news') == 'true' }, { 'title': control.lang(30031), 'action': 'movies', 'icon': iconname('movies'), 'boolean': control.setting('show_movies') == 'true' }, { 'title': control.lang(30083), 'action': 'short_films', 'icon': iconname('short'), 'boolean': control.setting('show_short_films') == 'true' }, { 'title': control.lang(30030), 'action': 'series', 'icon': iconname('series'), 'boolean': control.setting('show_series') == 'true' }, { 'title': control.lang(30063), 'action': 'shows', 'icon': iconname('shows'), 'boolean': control.setting('show_shows') == 'true' }, { 'title': control.lang(30068), 'action': 'theater', 'icon': iconname('theater'), 'boolean': control.setting('show_theater') == 'true' }, { 'title': control.lang(30079), 'action': 'listing', 'url': 'http://greek-movies.com/movies.php?g=6&y=&l=&p=', 'icon': iconname('documentaries'), 'boolean': control.setting('show_docs') == 'true' }, { 'title': control.lang(30094), 'action': 'sports', 'icon': iconname('sports'), 'boolean': control.setting('show_sports') == 'true' }, { 'title': control.lang(30032), 'action': 'kids', 'icon': iconname('kids'), 'boolean': control.setting('show_kids') == 'true' }, { 'title': control.lang(30012), 'action': 'miscellany', 'icon': iconname('miscellany'), 'boolean': control.setting('show_misc') == 'true' }, { 'title': control.lang(30002), 'action': 'radio', 'icon': iconname('radios'), 'boolean': control.setting('show_radio') == 'true' }, { 'title': control.lang(30125), 'action': 'music', 'icon': iconname('music'), 'boolean': control.setting('show_music') == 'true' }, { 'title': control.lang(30095).partition(' ')[0], 'action': 'search', 'icon': iconname('search'), 'boolean': control.setting('show_search') == 'true' }, { 'title': control.lang(30055), 'action': 'bookmarks', 'icon': iconname('bookmarks'), 'boolean': control.setting('show_bookmarks') == 'true' }, { 'title': control.lang(30137), 'action': 'openSettings&query=0.0' if control.setting('old_settings') == 'true' else 'settings', 'icon': iconname('settings'), 'boolean': control.setting('show_settings') == 'true' }, { 'title': control.lang(30288), 'action': 'quit', 'icon': iconname('quit'), 'boolean': control.setting('show_quit') == 'true', 'isFolder': 'False', 'isPlayable': 'False' }] self.menu = [i for i in self.list if i['boolean']] for item in self.menu: refresh = {'title': 30054, 'query': {'action': 'refresh'}} cache_clear = {'title': 30056, 'query': {'action': 'cache_clear'}} reset_idx = {'title': 30134, 'query': {'action': 'reset_idx'}} settings = {'title': 30011, 'query': {'action': 'openSettings'}} go_to_audio = { 'title': 30321, 'query': { 'action': 'activate_audio_addon', 'url': 'plugin.video.AliveGR' } } tools = {'title': 30137, 'query': {'action': 'tools_menu'}} ii_cm = {'title': 30255, 'query': {'action': 'call_info'}} item.update({ 'cm': [ ii_cm, refresh, cache_clear, reset_idx, settings, go_to_audio, tools ] }) if control.setting('reset-idx') == 'true': reset(notify=False) directory.add(self.menu, argv=self.argv)
def menu(self): self.list = [{ 'title': control.addonInfo('name') + ': ' + control.lang(30255), 'action': 'info', 'icon': control.addonInfo('icon') }, { 'title': control.lang(30011) + ': ' + control.lang(30003), 'action': 'openSettings', 'icon': iconname('settings'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.lang(30011) + ': ' + control.lang(30005), 'action': 'openSettings', 'query': '1.0', 'icon': iconname('settings'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.lang(30011) + ': ' + control.lang(30004), 'action': 'openSettings', 'query': '2.0', 'icon': iconname('monitor'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.lang(30011) + ': ' + control.lang(30138), 'action': 'openSettings', 'query': '3.0', 'icon': iconname('settings'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.lang(30011) + ': ' + control.lang(30017), 'action': 'openSettings', 'query': '4.0', 'icon': iconname('settings'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.addonInfo('name') + ': ' + control.lang(30115), 'action': 'openSettings', 'query': '5.0', 'icon': iconname('godmode'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.addonInfo('name') + ': ' + control.lang(30056), 'action': 'cache_clear', 'icon': iconname('empty'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.addonInfo('name') + ': ' + control.lang(30135), 'action': 'purge_bookmarks', 'icon': iconname('empty'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.addonInfo('name') + ': ' + control.lang(30134), 'action': 'reset_idx', 'icon': iconname('settings'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.addonInfo('name') + ': ' + control.lang(30110), 'action': 'changelog', 'icon': control.addonInfo('icon'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.lang(30111), 'action': 'other_addon_settings', 'query': 'script.module.resolveurl', 'icon': control.addon(id='script.module.resolveurl').getAddonInfo('icon'), 'isFolder': 'False', 'isPlayable': 'False' }, { 'title': control.lang(30319), 'action': 'global_settings', 'icon': control.addonmedia(addonid=art_id, theme='icons', icon='kodi.png', media_subfolder=False), 'isFolder': 'False', 'isPlayable': 'False' }] if float(control.addon('xbmc.addon').getAddonInfo('version') [:4]) >= 17.0: inputstream = { 'title': control.lang(30320) + ': ' + control.lang(30272), 'action': 'input_stream_addons', 'icon': iconname('monitor') } self.list.insert(6, inputstream) if control.condVisibility('Window.IsVisible(programs)'): for i in self.list: i.update( {'cm': [{ 'title': 30307, 'query': { 'action': 'root' } }]}) directory.add(self.list, argv=self.argv)
def live_tv(self, zapping=False, query=None): if control.setting('live_tv_mode') == '1' and query is None: zapping = True if control.setting('debug') == 'false': live_data = cache.get(self.live, 8) else: live_data = cache.get(self.live, int(control.setting('cache_period'))) self.list = live_data[0] if self.list is None: log_debug('Live channels list did not load successfully') return if zapping and control.setting('live_group_switcher') != '0': value = int(control.setting('live_group_switcher')) - 1 group = str(live_groups.values()[value]) self.list = [item for item in self.list if item['group'] == group] elif control.setting('show_live_switcher') == 'true': if control.setting('live_group') != 'ALL' and query is None: self.list = [ item for item in self.list if item['group'] == control.setting('live_group') ] elif not zapping: if control.setting('live_group_switcher') != '0' and query is None: value = int(control.setting('live_group_switcher')) - 1 group = str(live_groups.values()[value]) self.list = [ item for item in self.list if item['group'] == group ] if control.setting('show_alt') == 'false': self.list = [ item for item in self.list if not any([ 'BUP' in item['title'], re.search(r'\(\d\)', item['title']) ]) ] year = datetime.now().year for count, item in list(enumerate(self.list, start=1)): item.update({ 'action': 'play_resolved' if zapping and control.setting('preresolve_streams') == 'true' else 'play', 'isFolder': 'False', 'year': year, 'duration': None, 'code': str(count) }) for item in self.list: # 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)}} if not zapping: r_and_c_cm = { 'title': 30082, 'query': { 'action': 'refresh_and_clear' } } else: r_and_c_cm = None pvr_client_cm = { 'title': 30084, 'query': { 'action': 'pvr_client', 'query': 'true' } } if item['website'] != 'None': web_cm = { 'title': 30316, 'query': { 'action': 'open_link', 'url': item['website'] } } else: web_cm = None if control.condVisibility('Pvr.HasTVChannels'): item.update({'cm': [r_and_c_cm, pvr_client_cm, web_cm]}) else: item.update({'cm': [r_and_c_cm, web_cm]}) if control.setting( 'show_live_switcher') == 'true' and zapping is False: switch = { 'title': control.lang(30047).format( control.lang(30048) if control.setting('live_group') == 'ALL' else control.lang(int(control.setting('live_group')) )), 'image': iconname('switcher'), 'action': 'live_switcher', 'plot': control.lang(30034) + '\n' + control.lang(30035) + live_data[2], 'isFolder': 'False', 'isPlayable': 'False' } self.list.insert(0, switch) if control.setting('preresolve_streams') == 'true': from resources.lib.modules.player import conditionals pd = control.progressDialogGB pd.create(control.name()) for item in self.list: try: percent = control.per_cent(int(item['code']), len(self.list)) pd.update(percent) item.update( {'url': conditionals(item['url'], params=self.params)}) except Exception as e: log_debug('Failed to resolve ' + item['title'] + ' , reason: ' + repr(e)) continue pd.update(100) pd.close() if query: self.list = [i for i in self.list if query in i['title'].lower()] return self.list if not zapping: control.sortmethods('production_code') control.sortmethods('title') control.sortmethods('genre') directory.add(self.list, content='movies', argv=self.argv, as_playlist=zapping, progress=len(self.list) >= 100)
def menu(self): self.list = [ { 'title': control.lang(30170), 'action': 'music_live', 'image': iconname('monitor'), 'fanart': 'https://i.ytimg.com/vi/vtjL9IeowUs/maxresdefault.jpg' } , { 'title': control.lang(30124), 'action': 'gm_music', 'image': iconname('music'), 'fanart': 'https://cdn.allwallpaper.in/wallpapers/1280x720/1895/music-hd-1280x720-wallpaper.jpg' } , { 'title': control.lang(30126), 'action': 'mgreekz_index', 'image': 'https://pbs.twimg.com/profile_images/697098521527328772/VY8e_klm_400x400.png', 'fanart': control.addonmedia( addonid=art_id, theme='networks', icon='mgz_fanart.jpg', media_subfolder=False ) } , { 'title': control.lang(30127), 'action': 'mgreekz_top10', 'image': 'https://pbs.twimg.com/profile_images/697098521527328772/VY8e_klm_400x400.png', 'fanart': control.addonmedia( addonid=art_id, theme='networks', icon='mgz_fanart.jpg', media_subfolder=False ) } , { 'title': control.lang(30128), 'action': 'top20_list', 'url': self.rythmos_top20_url, 'image': 'https://is3-ssl.mzstatic.com/image/thumb/Purple62/v4/3e/a4/48/3ea44865-8cb2-5fec-be70-188a060b712c/source/256x256bb.jpg', 'fanart': control.addonmedia( addonid=art_id, theme='networks', icon='rythmos_fanart.jpg', media_subfolder=False ) } , { 'title': control.lang(30221), 'action': 'top20_list', 'url': self.plus_url, 'image': 'https://is5-ssl.mzstatic.com/image/thumb/Purple20/v4/e8/99/e8/e899e8ea-0df6-0f60-d66d-b82b8021e8af/source/256x256bb.jpg', 'fanart': 'https://i.imgur.com/G8koVR8.jpg' } , { 'title': control.lang(30222), 'action': 'top20_list', 'url': self.radiopolis_url_gr, 'image': 'http://www.radiopolis.gr/wp-content/uploads/2017/11/noimageavailable.jpg', 'fanart': 'https://i.ytimg.com/vi/tCupKdpHVx8/maxresdefault.jpg' } , { 'title': control.lang(30223), 'action': 'top20_list', 'url': self.radiopolis_url_other, 'image': 'http://www.radiopolis.gr/wp-content/uploads/2017/11/noimageavailable.jpg', 'fanart': 'https://i.ytimg.com/vi/tCupKdpHVx8/maxresdefault.jpg' } , { 'title': control.lang(30269), 'action': 'top50_list', 'url': 's1GeuATNw9GdvcXYy9Cdl5mLydWZ2lGbh9yL6MHc0RHa', 'image': control.addonInfo('icon'), 'fanart': 'https://i.ytimg.com/vi/vtjL9IeowUs/maxresdefault.jpg' } , { 'title': control.lang(30292), 'action': 'techno_choices', 'url': 'PLZF-_NNdxpb5s1vjh6YSMTyjjlfiZhgbp', 'image': control.addonInfo('icon'), 'fanart': 'https://i.ytimg.com/vi/vtjL9IeowUs/maxresdefault.jpg' } ] if control.condVisibility('Window.IsVisible(music)'): del self.list[0] log_debug('Music section loaded') directory.add(self.list, argv=self.argv)