def show_main_menu():
"""Show the main categories
This is typically: Shows, News, Movies, Live
"""
checkAccountChange()
html = callServiceApi('/')
processed = []
category_ids = common.parseDOM(html, 'a', ret='data-id')
for id in category_ids:
name = common.parseDOM(html, 'a', attrs={'data-id': id})[0]
href = common.parseDOM(html, 'a', attrs={'data-id': id}, ret='href')[0]
if id not in processed:
addDir(name, href, Mode.SUB_MENU, 'icon.png', data_id=id)
processed.append(id)
addDir('Clear cookies', '/', Mode.CLEAR_COOKIES, 'icon.png', isFolder=False)
xbmcplugin.endOfDirectory(thisPlugin)
python类endOfDirectory()的实例源码
def showShows(category_url):
"""Display all shows under a sub category
params:
category_url: a sub category is a unique id
"""
showListData = get_show_list(category_url)
if showListData is None:
xbmcplugin.endOfDirectory(thisPlugin)
return
for show_id, (title, thumbnail) in showListData.iteritems():
addDir(title, str(show_id), Mode.SHOW_INFO, thumbnail)
xbmcplugin.addSortMethod(thisPlugin, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
xbmcplugin.endOfDirectory(thisPlugin)
def list_streams(streams):
stream_list = []
# iterate over the contents of the dictionary songs to build the list
for stream in streams:
# create a list item using the stream's name for the label
li = xbmcgui.ListItem(label=stream['name'])
# set the thumbnail image
li.setArt({'thumb': stream['logo']})
# set the list item to playable
li.setProperty('IsPlayable', 'true')
# build the plugin url for Kodi
url = build_url({'mode': 'stream', 'url': stream['url'], 'title': stream['name']})
# add the current list item to a list
stream_list.append((url, li, False))
# add list to Kodi per Martijn
# http://forum.kodi.tv/showthread.php?tid=209948&pid=2094170#pid2094170
xbmcplugin.addDirectoryItems(addon_handle, stream_list, len(stream_list))
# set the content of the directory
xbmcplugin.setContent(addon_handle, 'songs')
xbmcplugin.endOfDirectory(addon_handle)
def list_podcast_radios(radios):
radio_list = []
# iterate over the contents of the list of radios
for radio in sorted(radios, key=operator.itemgetter('name')):
url = build_url({'mode': 'podcasts-radio', 'foldername': radio['name'], 'url': radio['url'], 'name': radio['name']})
li = xbmcgui.ListItem(radio['name'], iconImage='DefaultFolder.png')
radio_list.append((url, li, True))
# add list to Kodi per Martijn
# http://forum.kodi.tv/showthread.php?tid=209948&pid=2094170#pid2094170
xbmcplugin.addDirectoryItems(addon_handle, radio_list, len(radio_list))
# set the content of the directory
xbmcplugin.setContent(addon_handle, 'songs')
xbmcplugin.endOfDirectory(addon_handle)
def list_podcast_programs(programs):
program_list = []
# iterate over the contents of the list of programs
for program in programs:
url = build_url({'mode': 'podcasts-radio-program', 'foldername': urllib.quote(program['name'].encode('utf8')), 'url': program['url'], 'name': urllib.quote(program['name'].encode('utf8')), 'radio': program['radio']})
li = xbmcgui.ListItem(program['name'], iconImage='DefaultFolder.png')
program_list.append((url, li, True))
# add list to Kodi per Martijn
# http://forum.kodi.tv/showthread.php?tid=209948&pid=2094170#pid2094170
xbmcplugin.addDirectoryItems(addon_handle, program_list, len(program_list))
# set the content of the directory
xbmcplugin.setContent(addon_handle, 'songs')
xbmcplugin.endOfDirectory(addon_handle)
def __init__(self):
try:
self.addon = xbmcaddon.Addon(id=ADDON_ID)
self.win = xbmcgui.Window(10000)
self.cache = SimpleCache()
auth_token = self.get_authkey()
if auth_token:
self.parse_params()
self.sp = spotipy.Spotify(auth=auth_token)
me = self.sp.me()
self.userid = me["id"]
self.usercountry = me["country"]
self.local_playback, self.playername, self.connect_id = self.active_playback_device()
if self.action:
action = "self." + self.action
eval(action)()
else:
self.browse_main()
self.precache_library()
else:
xbmcplugin.endOfDirectory(handle=self.addon_handle)
except Exception as exc:
log_exception(__name__, exc)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
def browse_topartists(self):
xbmcplugin.setContent(self.addon_handle, "artists")
result = self.sp.current_user_top_artists(limit=20, offset=0)
cachestr = "spotify.topartists.%s" % self.userid
checksum = self.cache_checksum(result["total"])
items = self.cache.get(cachestr, checksum=checksum)
if not items:
count = len(result["items"])
while result["total"] > count:
result["items"] += self.sp.current_user_top_artists(limit=20, offset=count)["items"]
count += 50
items = self.prepare_artist_listitems(result["items"])
self.cache.set(cachestr, items, checksum=checksum)
self.add_artist_listitems(items)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_artists:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_artists)
def browse_album(self):
xbmcplugin.setContent(self.addon_handle, "songs")
album = self.sp.album(self.albumid, market=self.usercountry)
xbmcplugin.setProperty(self.addon_handle, 'FolderName', album["name"])
tracks = self.get_album_tracks(album)
if album.get("album_type") == "compilation":
self.add_track_listitems(tracks, True)
else:
self.add_track_listitems(tracks)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TRACKNUM)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TITLE)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_SONG_RATING)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_ARTIST)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
def search_tracks(self):
xbmcplugin.setContent(self.addon_handle, "songs")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(134))
result = self.sp.search(
q="track:%s" %
self.trackid,
type='track',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
tracks = self.prepare_track_listitems(tracks=result["tracks"]["items"])
self.add_track_listitems(tracks, True)
self.add_next_button(result['tracks']['total'])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
def search_albums(self):
xbmcplugin.setContent(self.addon_handle, "albums")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(132))
result = self.sp.search(
q="album:%s" %
self.albumid,
type='album',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
albumids = []
for album in result['albums']['items']:
albumids.append(album["id"])
albums = self.prepare_album_listitems(albumids)
self.add_album_listitems(albums, True)
self.add_next_button(result['albums']['total'])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_albums:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_albums)
def search_playlists(self):
xbmcplugin.setContent(self.addon_handle, "files")
result = self.sp.search(
q=self.playlistid,
type='playlist',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
log_msg(result)
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(136))
playlists = self.prepare_playlist_listitems(result['playlists']['items'])
self.add_playlist_listitems(playlists)
self.add_next_button(result['playlists']['total'])
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_playlists:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_playlists)
def show_sport_selection(self):
"""Creates the KODI list items for the static sport selection"""
self.utils.log('Sport selection')
sports = self.constants.get_sports_list()
for sport in sports:
url = self.utils.build_url({'for': sport})
list_item = xbmcgui.ListItem(label=sports.get(sport).get('name'))
list_item = self.item_helper.set_art(
list_item=list_item,
sport=sport)
xbmcplugin.addDirectoryItem(
handle=self.plugin_handle,
url=url,
listitem=list_item,
isFolder=True)
xbmcplugin.addSortMethod(
handle=self.plugin_handle,
sortMethod=xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.endOfDirectory(self.plugin_handle)
def channeltypes(params,url,category):
logger.info("channelselector.channeltypes")
lista = getchanneltypes()
for item in lista:
addfolder(item.title,item.channel,item.action,category=item.category,thumbnailname=item.thumbnail)
if config.get_platform()=="kodi-krypton":
import plugintools
plugintools.set_view( plugintools.TV_SHOWS )
# Label (top-right)...
import xbmcplugin
xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
if config.get_setting("forceview")=="true":
# Confluence - Thumbnail
import xbmc
xbmc.executebuiltin("Container.SetViewMode(500)")
def listchannels(params,url,category):
logger.info("channelselector.listchannels")
lista = filterchannels(category)
for channel in lista:
if config.is_xbmc() and (channel.type=="xbmc" or channel.type=="generic"):
addfolder(channel.title , channel.channel , "mainlist" , channel.channel)
elif config.get_platform()=="boxee" and channel.extra!="rtmp":
addfolder(channel.title , channel.channel , "mainlist" , channel.channel)
if config.get_platform()=="kodi-krypton":
import plugintools
plugintools.set_view( plugintools.TV_SHOWS )
# Label (top-right)...
import xbmcplugin
xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
if config.get_setting("forceview")=="true":
# Confluence - Thumbnail
import xbmc
xbmc.executebuiltin("Container.SetViewMode(500)")
def show_listing(self, list_items, sort=None):
listing = []
for title_item in list_items:
list_item = xbmcgui.ListItem(label=title_item.title)
url = self._url + '?' + urlencode(title_item.url_dictionary)
list_item.setProperty('IsPlayable', str(title_item.is_playable))
if title_item.thumbnail is not None:
list_item.setArt({'thumb': title_item.thumbnail})
list_item.setInfo('video', title_item.video_dictionary)
listing.append((url, list_item, not title_item.is_playable))
xbmcplugin.addDirectoryItems(self._handle, listing, len(listing))
if sort is not None:
kodi_sorts = {sortmethod.ALPHABET: xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE}
kodi_sortmethod = kodi_sorts.get(sort)
xbmcplugin.addSortMethod(self._handle, kodi_sortmethod)
xbmcplugin.endOfDirectory(self._handle)
def _users(self):
page = int(self.root.params['page'])
users = media_entries('fave.getUsers', self.root.conn, _NO_OWNER, page = page)
if page < users['pages']:
params = {'do': _DO_FAVE_USERS, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
for u in users['items']:
list_item = xbmcgui.ListItem(u'%s %s' % (u.info['last_name'], u.info['first_name']))
#p_key = 'photo_%d' % (max(map(lambda x: int(x.split('_')[1]), filter(lambda x: x.startswith('photo_'), m.info.keys()))),)
#list_item.setArt({'thumb': m.info[p_key], 'icon': m.info[p_key]})
params = {'do': _DO_HOME, 'oid': u.id}
url = self.root.url(**params)
xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
if page < users['pages']:
params = {'do': _DO_FAVE_USERS, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
xbmcplugin.endOfDirectory(_addon_id)
def _groups(self):
page = int(self.root.params['page'])
links = media_entries('fave.getLinks', self.root.conn, _NO_OWNER, page = page)
if page < links['pages']:
params = {'do': _DO_FAVE_GROUPS, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
for l in links['items']:
l_id = l.info['id'].split('_')
if l_id[0] == '2':
list_item = xbmcgui.ListItem(l.info['title'])
p_key = 'photo_%d' % (max(map(lambda x: int(x.split('_')[1]), filter(lambda x: x.startswith('photo_'), l.info.keys()))),)
list_item.setArt({'thumb': l.info[p_key], 'icon': l.info[p_key]})
params = {'do': _DO_HOME, 'oid': -int(l_id[-1])}
url = self.root.url(**params)
xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
if page < links['pages']:
params = {'do': _DO_FAVE_GROUPS, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
xbmcplugin.endOfDirectory(_addon_id)
def _photo_albums(self):
page = int(self.root.params['page'])
oid = self.root.params['oid']
kwargs = {'page': page, 'need_covers': 1, 'need_system': 1}
albums = media_entries('photos.getAlbums', self.root.conn, oid, **kwargs)
if page < albums['pages']:
params = {'do': _DO_PHOTO_ALBUMS,'oid': oid,'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
for a in albums['items']:
list_item = xbmcgui.ListItem(a.info['title'])
list_item.setInfo('pictures', {'title': a.info['title']})
list_item.setArt({'thumb': a.info['thumb_src'], 'icon': a.info['thumb_src']})
params = {'do': _DO_PHOTO, 'oid': oid, 'album': a.id, 'page': 1}
url = self.root.url(**params)
xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
if page < albums['pages']:
params = {'do': _DO_PHOTO_ALBUMS,'oid': oid,'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
xbmcplugin.endOfDirectory(_addon_id)
switch_view()
def _main_video_search(self):
page = int(self.root.params['page'])
self.root.add_folder(self.root.gui._string(400516), {'do': _DO_VIDEO_SEARCH, 'q':'none', 'page': 1})
history = get_search_history(_FILE_VIDEO_SEARCH_HISTORY)
count = len(history)
pages = int(ceil(count / float(_SETTINGS_PAGE_ITEMS)))
if page < pages:
params = {'do': _DO_MAIN_VIDEO_SEARCH, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
h_start = _SETTINGS_PAGE_ITEMS * (page -1)
h_end = h_start + _SETTINGS_PAGE_ITEMS
history = history[h_start:h_end]
for h in history:
query_hex = binascii.hexlify(pickle.dumps(h, -1))
list_item = xbmcgui.ListItem(h)
params = {'do': _DO_VIDEO_SEARCH, 'q': query_hex, 'page': 1}
url = self.root.url(**params)
xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
if page < pages:
params = {'do': _DO_MAIN_VIDEO_SEARCH, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
xbmcplugin.endOfDirectory(_addon_id)
def _video(self):
page = int(self.root.params['page'])
oid = self.root.params['oid']
album = self.root.params.get('album', None)
kwargs = {'page': page, 'extended': 1}
if album: kwargs['album'] = album
vids = media_entries('video.get', self.root.conn, oid, **kwargs)
if page < vids['pages']:
params = {'do': _DO_VIDEO,'oid': oid,'page': page + 1}
if album: params['album'] = album
self.root.add_folder(self.root.gui._string(400602), params)
self.__create_video_list_(vids)
if page < vids['pages']:
params = {'do': _DO_VIDEO,'oid': oid,'page': page + 1}
if album: params['album'] = album
self.root.add_folder(self.root.gui._string(400602), params)
xbmcplugin.endOfDirectory(_addon_id)
def _members(self):
oid = self.root.params['oid']
page = int(self.root.params['page'])
group = Group(oid, self.root.conn)
members = group.members(page = page)
if page < members['pages']:
params = {'do': _DO_MEMBERS, 'oid': oid, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
for m in members['items']:
list_item = xbmcgui.ListItem(u'%s %s' % (m.info['last_name'], m.info['first_name']))
p_key = 'photo_%d' % (max(map(lambda x: int(x.split('_')[1]), filter(lambda x: x.startswith('photo_'), m.info.keys()))),)
list_item.setArt({'thumb': m.info[p_key], 'icon': m.info[p_key]})
params = {'do': _DO_HOME, 'oid': m.id}
url = self.root.url(**params)
xbmcplugin.addDirectoryItem(_addon_id, url, list_item, isFolder = True)
if page < members['pages']:
params = {'do': _DO_MEMBERS, 'oid': oid, 'page': page + 1}
self.root.add_folder(self.root.gui._string(400602), params)
xbmcplugin.endOfDirectory(_addon_id)
def build_no_search_results_available(self, build_url, action):
"""Builds the search results screen if no matches could be found
Parameters
----------
action : :obj:`str`
Action paramter to build the subsequent routes
build_url : :obj:`fn`
Function to build the subsequent routes
Returns
-------
bool
List could be build
"""
self.dialogs.show_no_search_results_notify()
return xbmcplugin.endOfDirectory(self.plugin_handle)
def show_page(obj):
for talk in obj.get_talks():
url = build_url({'mode': 'play', 'folder_name': talk.url})
li = xbmcgui.ListItem("%s - %s [COLOR=lime][%s][/COLOR][COLOR=cyan] Posted: %s[/COLOR]" % (talk.title, talk.speaker, talk.time, talk.posted))
li.setArt({'thumb': talk.thumb, 'icon': talk.thumb, 'fanart': talk.thumb})
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
if obj.next_page:
url = build_url({'mode': 'page', 'folder_name': obj.next_page})
li = xbmcgui.ListItem("[COLOR=yellow]Next Page %s[/COLOR]" % obj.page_number(obj.next_page))
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
if obj.last_page:
url = build_url({'mode': 'page', 'folder_name': obj.last_page})
li = xbmcgui.ListItem("[COLOR=yellow]Last Page %s[/COLOR]" % obj.page_number(obj.last_page))
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
xbmcplugin.endOfDirectory(addon_handle)
def run(self, params):
if params == {} or params == self.params():
return self.root()
if 'list' in params.keys() and params['list'] != '':
self.list(self.provider.list(params['list']))
if self.system is not None:
self.provider.system(self.system, True)
return self.endOfDirectory()
if 'down' in params.keys():
self.force = True
return self.download({'url': params['down'], 'title': params['title'], 'force': '1'})
if 'play' in params.keys():
return self.play({'url': params['play'], 'info': params})
if 'search-list' in params.keys():
return self.search_list()
if 'search' in params.keys():
return self.do_search(params['search'])
if 'search-remove' in params.keys():
return self.search_remove(params['search-remove'])
if 'search-edit' in params.keys():
return self.search_edit(params['search-edit'])
if self.run_custom:
return self.run_custom(params)
def search_type(field):
last_field = addon.getSetting('last_search_field').decode('utf-8')
search_text = addon.getSetting('last_search_text').decode('utf-8')
if last_field <> field or not search_text:
addon.setSetting('last_search_field', field)
keyboard = xbmc.Keyboard('', _T(30206))
keyboard.doModal()
if keyboard.isConfirmed():
search_text = keyboard.getText()
else:
search_text = ''
addon.setSetting('last_search_text', search_text)
if search_text:
searchresults = session.search(field, search_text)
add_items(searchresults.artists, content=CONTENT_FOR_TYPE.get('files'), end=False)
add_items(searchresults.albums, end=False)
add_items(searchresults.playlists, end=False)
add_items(searchresults.tracks, end=False)
add_items(searchresults.videos, end=True)
else:
#xbmcplugin.setContent(plugin.handle, content='files')
xbmcplugin.endOfDirectory(plugin.handle, succeeded=False, updateListing=False)
def run():
"""Docstring"""
# Gather the request info
params = get_params()
if 'action' in params:
if params['action'] == "search":
# If the action is 'search' use item information kodi provides to search for subtitles
search(get_info(), get_languages(params, 0))
elif params['action'] == "manualsearch":
# If the action is 'manualsearch' use user manually inserted string to search
# for subtitles
manual_search(params['searchstring'], get_languages(params, 0))
elif params['action'] == "download":
# If the action is 'download' use the info provided to download the subtitle and give
# the file path to kodi
download(params)
elif params['action'] == "download-addicted":
# If the action is 'download' use the info provided to download the subtitle and give
# the file path to kodi
download_addicted(params)
xbmcplugin.endOfDirectory(HANDLE)
def list_channels():
"""show channels on the kodi list."""
playlist = utility.read_list(playlists_file)
if not playlist:
ok(ADDON.getLocalizedString(11005), ADDON.getLocalizedString(11006))
return None
for channel in playlist:
url = channel['url'].encode('utf-8')
name = channel['display_name'].encode('utf-8')
action_url = build_url({'mode': 'play', 'url': url, 'name': name})
item = xbmcgui.ListItem(name, iconImage='DefaultVideo.png')
item.setInfo(type='Video', infoLabels={'Title': name})
xbmcplugin.addDirectoryItem(handle=HANDLE, url=action_url, listitem=item)
xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=False)
def router(paramstring):
params = dict(parse_qsl(paramstring[1:]))
if params:
if params['mode'] == 'play':
play_item = xbmcgui.ListItem(path=params['link'])
xbmcplugin.setResolvedUrl(__handle__, True, listitem=play_item)
else:
for stream in streams():
list_item = xbmcgui.ListItem(label=stream['name'], thumbnailImage=stream['thumb'])
list_item.setProperty('fanart_image', stream['thumb'])
list_item.setProperty('IsPlayable', 'true')
url = '{0}?mode=play&link={1}'.format(__url__, stream['link'])
xbmcplugin.addDirectoryItem(__handle__, url, list_item, isFolder=False)
xbmcplugin.endOfDirectory(__handle__)
# --------------------------------------------------------------------------------
# Main
# --------------------------------------------------------------------------------
def router(paramstring):
"""Decides what to do based on script parameters"""
check_settings()
params = dict(parse_qsl(paramstring))
# Nothing to do yet with those
if not params:
# Demo channel list
channels = map_channels(filter_channels(get_tv_channels()))
xbmcplugin.addDirectoryItems(plugin_handle, channels, len(channels))
xbmcplugin.addSortMethod(
plugin_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
xbmcplugin.endOfDirectory(plugin_handle)
elif params['action'] == 'play':
play_channel(params['channel'])
elif params['action'] == 'get_user_id':
get_user_id()
def main_menu():
addon_log('Hello World!') # print add-on version
items = [language(30023), language(30015), language(30026), language(30036), language(30030)]
for item in items:
if item == language(30023):
params = {
'action': 'list_events_by_date',
'schedule_type': 'all',
'filter_date': 'today'
}
elif item == language(30015):
params = {'action': 'list_upcoming_days'}
elif item == language(30026):
params = {
'action': 'list_events',
'schedule_type': 'featured'
}
elif item == language(30036):
params = {'action': 'search'}
else: # auth details
item = '[B]%s[/B]' % item
params = {'action': 'show_auth_details'}
add_item(item, params)
xbmcplugin.endOfDirectory(_handle)