示例#1
0
def livetv_dir():
	dnatv = DNATVSession(username, password, servicename)
	if dnatv.login():
		liveTV = dnatv.getlivetv()
		for channel in liveTV:
			if not channel['isUserAuthorized']:
				continue
			try:
				url = build_url({'mode': 'watch', 'videoUrl': channel['liveService']['services'][0]['stream']['streamUrl']})
			except IndexError:
				continue
			li = xbmcgui.ListItem(channel['title'], iconImage='DefaultFile.png')
			start_time = channel['epg'][0]['startTime'].split()
			li.setInfo('video', { 'StartTime': start_time[4],
				'Plot' : channel['epg'][0]['title'] + '\n' + channel['epg'][0]['description']})
			li.setProperty('IsPlayable', 'true')
			add_logout_context_menu_item( li )
			xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=False)
		xbmcplugin.endOfDirectory(addon_handle)