def onClick(self, controlID): channel = _zattooDB_.get_playing()['channel'] channeltitle = _zattooDB_.get_channeltitle(channel) program = _zattooDB_.getPrograms({'index': [channel]}, True, datetime.datetime.now(), datetime.datetime.now()) program = program[0] self.close() #close OSD if controlID == 209: #recall xbmc.executebuiltin("Action(OSD)") #close hidden gui start = int(time.mktime(program['start_date'].timetuple())) end = int(time.mktime(program['end_date'].timetuple())) showID = program['showID'] if SWISS == 'true': watch_channel(channel, start, end) else: watch_channel(channel, start, end, showID, True) elif controlID == 210: #record program setup_recording(program['showID']) elif controlID == 211: #teletext from resources.teletext import Teletext tele = Teletext() tele.doModal() del tele elif controlID == 201: #Back self.close() elif controlID == 202: #Channel Up nr = skip_channel(-1) self.showChannelNr(nr + 1) elif controlID == 203: #Channel Down nr = skip_channel(+1) self.showChannelNr(nr + 1) elif controlID == 205: #stop xbmc.executebuiltin("Action(OSD)") xbmc.executebuiltin("Action(Stop)") elif controlID == 208: if xbmcgui.Dialog().yesno(channeltitle, __addon__.getLocalizedString(31907)): __addon__.setSetting(id="start_channel", value=channeltitle) elif controlID > 300: xbmc.executebuiltin("Action(OSD)") #close hidden gui if controlID == 303: xbmc.executebuiltin('ActivateWindow(10025,"plugin://' + __addonId__ + '/?mode=channellist")') #if controlID==301: xbmc.executebuiltin('RunPlugin("plugin://'+__addonId__+'/?mode=channellist")') elif controlID == 302: xbmc.executebuiltin('RunPlugin("plugin://' + __addonId__ + '/?mode=previewOSD")') elif controlID == 301: xbmc.executebuiltin('RunPlugin("plugin://' + __addonId__ + '/?mode=epgOSD")')
def main(): global _listMode_ if _listMode_ == None: _listMode_ = 'all' #print 'LISTMODE ' + str(_listMode_) addon_uri = sys.argv[0] addon_handle = int(sys.argv[1]) args = urlparse.parse_qs(sys.argv[2][1:]) action = args.get('mode', ['root'])[0] channel = _zattooDB_.get_playing()['channel'] channeltitle = _zattooDB_.get_channeltitle(channel) program = _zattooDB_.getPrograms({'index': [channel]}, True, datetime.datetime.now(), datetime.datetime.now()) program = program[0] xbmcgui.Window(10000).setProperty('ZBElastAction', action) _keymap_.saveKeyMap() _keymap_.toggleKeyMap() if action is 'root': build_root(addon_uri, addon_handle) elif action == 'channellist': build_channelsList(addon_uri, addon_handle) elif action == 'preview': showPreview() elif action == 'previewOSD': showPreview() elif action == 'epg': showEpg() elif action == 'epgOSD': showEpg() elif action == 'recordings': build_recordingsList(addon_uri, addon_handle) elif action == 'search': search_show(addon_uri, addon_handle) elif action == 'selectStartChannel': selectStartChannel() elif action == 'editKeyMap': _keymap_.editKeyMap() elif action == 'deleteKeyMap': _keymap_.deleteKeyMap() elif action == 'showKeyMap': showkeymap() elif action == 'record_l': setup_recording(program['showID']) elif action == 'show_settings': __addon__.openSettings() _zattooDB_.zapi.renew_session() elif action == 'watch_c': cid = args.get('id', ['ard'])[0] if cid == "current": cid = _zattooDB_.get_playing()['channel'] start = args.get('start', '0')[0] end = args.get('end', '0')[0] showID = args.get('showID', '1')[0] restart = args.get('restart', 'false')[0] showOSD = args.get('showOSD', '0')[0] watch_channel(cid, start, end, showID, restart == 'true', showOSD == '1') elif action == 'skip_channel': skipDir = args.get('skipDir')[0] skip_channel(int(skipDir)) elif action == 'toggle_channel': toggle_channel() elif action == 'switchlist': if _listMode_ == 'all': _listMode_ = 'favourites' else: _listMode_ = 'all' __addon__.setSetting('channellist', _listMode_) xbmc.executebuiltin('Container.Refresh') elif action == 'watch_r': recording_id = args.get('id')[0] watch_recording(addon_uri, addon_handle, recording_id) elif action == 'record_p': program_id = args.get('program_id')[0] setup_recording(program_id) elif action == 'remove_recording': recording_id = args.get('recording_id')[0] delete_recording(recording_id) elif action == 'remove_series': recording_id = args.get('recording_id')[0] series = args.get('series')[0] delete_series(recording_id, series) elif action == 'reloadDB': xbmc.executebuiltin("ActivateWindow(busydialog)") _zattooDB_.reloadDB() xbmcgui.Dialog().notification( localString(31916), localString(30110), __addon__.getAddonInfo('path') + '/icon.png', 3000, False) _zattooDB_.getProgInfo(True) xbmcgui.Dialog().notification( localString(31106), localString(31915), __addon__.getAddonInfo('path') + '/icon.png', 3000, False) _library_.make_library() xbmc.executebuiltin("Dialog.Close(busydialog)") elif action == 'changeStream': if not DASH: change_stream(1) else: streams = xbmc.Player().getAvailableAudioStreams() dialog = xbmcgui.Dialog() ret = dialog.select('audio streams', streams) if ret == -1: return xbmc.Player().setAudioStream(ret) elif action == 'teletext': from resources.teletext import Teletext tele = Teletext() tele.doModal() del tele elif action == 'makelibrary': xbmc.executebuiltin("ActivateWindow(busydialog)") _library_.delete_library() _library_.make_library() xbmc.executebuiltin("Dialog.Close(busydialog)") elif action == 'resetdir': delete = xbmcgui.Dialog().yesno(__addonname__, __addon__.getLocalizedString(31911)) if delete: _library_.delete_library() __addon__.setSetting(id="library_dir", value="") xbmc.executebuiltin('Container.Refresh') elif action == 'cleanProg': _zattooDB_.cleanProg() elif action == 'popular': showPreview('popular') elif action == 'showInfo': makeOsdInfo() osd = zattooOSD("zattooOSD.xml", __addon__.getAddonInfo('path')) osd.doModal() del osd elif action == 'nr': nr = args.get('nr')[0] input_numbers(nr)
def onClick(self, controlID): channel = _zattooDB_.get_playing()['channel'] channeltitle = _zattooDB_.get_channeltitle(channel) program = _zattooDB_.getPrograms({'index': [channel]}, True, datetime.datetime.now(), datetime.datetime.now()) program = program[0] self.close() #close OSD if controlID == 209: #recall xbmc.executebuiltin("Action(OSD)") #close hidden gui start = int(time.mktime(program['start_date'].timetuple())) end = int(time.mktime(program['end_date'].timetuple())) showID = program['showID'] if SWISS == 'true': watch_channel(channel, start, end) else: watch_channel(channel, start, end, showID, True) elif controlID == 210: #record program setup_recording(program['showID']) elif controlID == 211: #teletext from resources.teletext import Teletext tele = Teletext() tele.doModal() del tele elif controlID == 201: #Back self.close() elif controlID == 202: #Channel Up nr = skip_channel(-1) elif controlID == 203: #Channel Down nr = skip_channel(+1) elif controlID == 205: #stop #xbmc.executebuiltin("Action(OSD)") xbmc.executebuiltin("Action(Stop)") #elif controlID==208: #start channel # if xbmcgui.Dialog().yesno(channeltitle, __addon__.getLocalizedString(31907)): # __addon__.setSetting(id="start_channel", value=channeltitle) elif controlID == 208: #favourite isFavourite = xbmcgui.Window(10000).getProperty('favourite') channelList = _zattooDB_.getChannelList()['index'] update = False if isFavourite == "0": if xbmcgui.Dialog().yesno(channeltitle, __addon__.getLocalizedString(31908)): channelList.append(channel) update = True elif xbmcgui.Dialog().yesno(channeltitle, __addon__.getLocalizedString(31909)): channelList.remove(channel) update = True if update: channelList = ",".join(channelList) result = _zattooDB_.zapi.exec_zapiCall( '/zapi/channels/favorites/update', { 'cids': channelList, 'ctype': 'tv' }) _zattooDB_.updateChannels(True) _zattooDB_.updateProgram() elif controlID > 300: xbmcgui.Window(10000).setProperty('zattoo_runningView', "") xbmcgui.Window(10000).setProperty('zattooGUI', 'False') xbmc.executebuiltin("Dialog.Close(all,true)") #close hidden GUI #xbmc.executebuiltin("Action(OSD)") #close hidden gui if controlID == 303: xbmc.executebuiltin('ActivateWindow(10025,"plugin://' + __addonId__ + '/?mode=channellist")') elif controlID == 302: xbmc.executebuiltin('RunPlugin("plugin://' + __addonId__ + '/?mode=previewOSD")') elif controlID == 301: xbmc.executebuiltin('RunPlugin("plugin://' + __addonId__ + '/?mode=epgOSD")')
def main(): global _listMode_ if _listMode_ == None: _listMode_='all' print 'LISTMODE ' + str(_listMode_) addon_uri = sys.argv[0] addon_handle = int(sys.argv[1]) args = urlparse.parse_qs(sys.argv[2][1:]) action=args.get('mode', ['root'])[0] #xbmcgui.Dialog().notification("HANDLE", str(action)+' '+str(addon_handle), '', 1000, False) #hack for repeat actions from keyMap #if ((action=='preview' or action=='epg' )and action==xbmcgui.Window(10000).getProperty('ZBElastAction')): #xbmcgui.Window(10000).setProperty('ZBElastAction', '') #xbmc.executebuiltin("Action(FullScreen)") #if(str(_zattooDB_.get_playing()['start'])=='1970-01-01 01:00:00'):makeZattooGUI() #return xbmcgui.Window(10000).setProperty('ZBElastAction', action) if action is 'root': build_root(addon_uri, addon_handle) elif action == 'channellist': build_channelsList(addon_uri, addon_handle) elif action == 'preview': showPreview(False) elif action == 'previewOSD': showPreview(True) elif action == 'epg': showEpg(False) elif action == 'epgOSD': showEpg(True) elif action == 'recordings': build_recordingsList(addon_uri, addon_handle) elif action == 'search': search_show(addon_uri, addon_handle) elif action == 'show_settings': __addon__.openSettings() _zattooDB_.zapi.renew_session() elif action == 'watch_c': cid = args.get('id','ard')[0] start = args.get('start', '0')[0] end = args.get('end', '0')[0] showID = args.get('showID', '1')[0] restart = args.get('restart', 'false')[0] if restart == 'true': rest=True else: rest=False print 'Watch ' +str(showID)+str(rest) watch_channel(cid, start, end, showID, rest) elif action == 'skip_channel': skipDir = args.get('skipDir')[0] skip_channel(int(skipDir)) elif action == 'toggle_channel': toggle_channel() elif action == 'switchlist': if _listMode_ == 'all': _listMode_ = 'favourites' else: _listMode_ = 'all' __addon__.setSetting('channellist', _listMode_) xbmc.executebuiltin('Container.Refresh') elif action == 'watch_r': recording_id = args.get('id')[0] watch_recording(addon_uri, addon_handle, recording_id) elif action == 'record_p': program_id = args.get('program_id')[0] setup_recording(program_id) elif action == 'remove_recording': recording_id = args.get('recording_id')[0] delete_recording(recording_id) elif action == 'remove_series': recording_id = args.get('recording_id')[0] series = args.get('series')[0] delete_series(recording_id, series) elif action == 'reloadDB': xbmc.executebuiltin("ActivateWindow(busydialog)") _zattooDB_.reloadDB() xbmcgui.Dialog().notification(localString(31916), localString(30110), __addon__.getAddonInfo('path') + '/icon.png', 3000, False) _zattooDB_.getProgInfo(True) xbmcgui.Dialog().notification(localString(31106), localString(31915), __addon__.getAddonInfo('path') + '/icon.png', 3000, False) _library_.make_library() xbmc.executebuiltin("Dialog.Close(busydialog)") elif action == 'changeStream': dir = int(args.get('dir')[0]) change_stream(dir) elif action == 'teletext': from resources.teletext import Teletext tele = Teletext() tele.doModal() del tele elif action == 'makelibrary': xbmc.executebuiltin("ActivateWindow(busydialog)") _library_.delete_library() _library_.make_library() xbmc.executebuiltin("Dialog.Close(busydialog)") elif action == 'resetdir': delete = xbmcgui.Dialog().yesno(__addonname__, __addon__.getLocalizedString(31911)) if delete: _library_.delete_library() __addon__.setSetting(id="library_dir", value="") xbmc.executebuiltin('Container.Refresh') elif action == 'cleanProg': _zattooDB_.cleanProg() '''