def onclick(): state = mc.GetApp().GetLocalConfig().GetValue("logotweak.state") if state == "green": #red os.system( 'printf "\xAA\x06\x35\x30\x30\x33\x30\x30\x35\x33" > /dev/ttyS1') os.system( 'printf "\xAA\x06\x35\x30\x30\x31\x36\x34\x42\x35" > /dev/ttyS1') mc.GetApp().GetLocalConfig().SetValue("logotweak.state", "red") mc.ShowDialogNotification("Boxee Box Logo: Red") elif state == "red": #off os.system( 'printf "\xAA\x06\x35\x30\x30\x33\x30\x30\x35\x33" > /dev/ttyS1') mc.GetApp().GetLocalConfig().SetValue("logotweak.state", "off") mc.ShowDialogNotification("Boxee Box Logo: Off") elif state == "off": #green os.system( 'printf "\xAA\x06\x35\x30\x30\x33\x30\x30\x35\x33" > /dev/ttyS1') os.system( 'printf "\xAA\x06\x35\x30\x30\x32\x36\x34\x42\x36" > /dev/ttyS1') mc.GetApp().GetLocalConfig().SetValue("logotweak.state", "green") mc.ShowDialogNotification("Boxee Box Logo: Green")
def playList(mlbList): try: cf = mc.GetApp().GetLocalConfig() list = mc.GetActiveWindow().GetList(mlbList) item = list.GetItem(list.GetFocusedItem()) if (isLoggedIn() or mc.ShowDialogNotification( 'You must first log in before you can watch this game.', 'mlb-icon.png')): pass except Exception, e: error('playlist', e) mc.ShowDialogNotification( 'Sorry, we are currently unable to play this game.', 'mlb-icon.png') return False
def saveArchiveSpoiler(value): try: mc.ShowDialogWait() if isLoggedIn(): response = callService('showhidesave', {'value': value}) if ((response == '1') and mc.ShowDialogNotification( 'Score spoiler settings saved successfully!', 'mlb-icon.png')): pass else: mc.ShowDialogNotification( 'You must be logged in to modify settings.', 'mlb-icon.png') mc.HideDialogWait() except Exception, e: return raiseError(log='savearchivespoiler', error=e)
def onClick(self, controlID): if controlID == 90: if mc.GetPlayer().IsPlayingAudio(): mc.ActivateWindow(12006) elif mc.GetPlayer().IsPlayingVideo(): mc.ActivateWindow(12005) if controlID == 1001: if mlb.isLoggedIn(): #mc.GetActiveWindow().ClearStateStack() mc.ActivateWindow(14003) else: mc.ShowDialogNotification( "You must be logged in to make changes to your settings.", "mlb-icon.png") if controlID == 1002: mc.ActivateWindow(14001) if controlID == 1003: mc.ActivateWindow(14002) if controlID == 120: mlb.playList(120) if controlID == 501: mlb.playItem(501)
def StartUp(): mc.ShowDialogWait() if ba.Cache('database' + '{0}', 3600): refresh = False else: refresh = True if refresh: mc.ShowDialogNotification("Loading streams...") url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fadaptive.rtl.nl%2Fxl%2FVideoItem%2FIpadXML'&_maxage=3600" data = ba.FetchUrl(url, 3600) soup = BeautifulSoup(data, convertEntities="xml", smartQuotesTo="xml") items = [] for info in soup.findAll('item'): if info.serienaam.string == info.title.string: item = {} daynr = getDate(info.broadcastdatetime.string.split('T')[0]) item['time'] = daynr item['label'] = info.serienaam.string.encode('utf-8') item['thumb'] = str(info.thumbnail.string) item['desc'] = str( week[daynr]) + ' - ' + info.samenvattingkort.string.encode( 'utf-8') item['path'] = str(info.movie.string) items.append(item) config.Reset('database') config.Reset('database') config.PushBackValue('database', str(time.time()).split('.')[0]) config.PushBackValue('database', pickle.dumps(items)) mc.HideDialogWait()
def handleItem(listItem, fromHome=False): global secondaryListItems itemType = listItem.GetProperty("itemtype") url = listItem.GetPath() # Handle search items if listItem.GetProperty("search") == "1": search = mc.ShowDialogKeyboard(listItem.GetProperty("prompt"), "", False) if search: url += "&query=" + urllib.quote(search) else: return # Load screen of items if itemType == "Directory": mc.ShowDialogWait() # load next screen information machineIdentifier = listItem.GetProperty("machineidentifier") windowInformation = manager.getListItems(machineIdentifier, url) viewGroup = windowInformation.titleListItems[0].GetProperty( "viewgroup") nextWindowID = getWindowID(viewGroup) # save the state if not fromHome: mc.GetActiveWindow().PushState() # secondary items if viewGroup == "secondary": secondaryListItems = windowInformation.childListItems if fromHome: handleItem(windowInformation.childListItems[0]) else: #clearItems() showWindowInformation(window, windowInformation) else: # start the new window window = activateWindow(nextWindowID) showWindowInformation(window, windowInformation) # Play video elif itemType == "Video": machineIdentifier = listItem.GetProperty("machineidentifier") manager.playVideoUrl(machineIdentifier, url) #TEMP DISABLE PLAY WINDOW AND JUST PLAY VIDEO #windowInformation = manager.getListItems(machineIdentifier, url) #mc.ActivateWindow(PLAY_DIALOG_ID) #mc.GetWindow(PLAY_DIALOG_ID).GetList(PLAY_DIALOG_LIST_ID).SetItems(windowInformation.childListItems) elif itemType == "Track": machineIdentifier = listItem.GetProperty("machineidentifier") manager.playMusicUrl(machineIdentifier, url) # Unknown item else: mc.ShowDialogNotification("Unknown itemType: %s" % itemType) mc.HideDialogWait()
def start(): os.system("/etc/init.d/telnetd start") mc.GetApp().GetLocalConfig().SetValue("telnettweak.status", "1") ilist = mc.GetActiveWindow().GetList(101) item = ilist.GetItem(ilist.GetFocusedItem()) item.SetLabel("Disable Telnet") mc.ShowDialogNotification("Telnet: Started")
def autoLogin(): _user = user.getUser() if (_user.isAuthenticated): mc.ShowDialogNotification("Welcome " + _user.userName) ui.toggleLoginVisibility(False) else: ui.toggleLoginVisibility(True)
def myPlexLogin(self, username, password): self.myplex.login(username, password) if self.myplex.isAuthenticated(): myPlexServers, myPlexRemote = self.myplex.getServers() self.addMyServers(myPlexServers) self.addSharedServers(myPlexRemote) else: mc.ShowDialogNotification("Error logging into myPlex service")
def stop(): os.system( "/bin/kill `ps ax | grep -v grep | grep telnetd | awk '{print $1}'`") mc.GetApp().GetLocalConfig().SetValue("telnettweak.status", "0") ilist = mc.GetActiveWindow().GetList(101) item = ilist.GetItem(ilist.GetFocusedItem()) item.SetLabel("Enable Telnet") mc.ShowDialogNotification("Telnet: Stopped")
def thumbnail_function(): if mc.ShowDialogConfirm( "Clear thumbnail cache", "Are you sure you want to clear the thumbnail cache?", "Cancel", "OK"): os.system("rm %s" % xbmc.translatePath('special://profile/.fanart')) os.system( "find /data/.boxee/UserData/profiles/*/Thumbnails/ -name \*.tbn | xargs rm" ) mc.ShowDialogNotification("Clearing thumbnail cache")
def _handlePhotoItem(listItem): list = manager.getPhotoList(listItem) if list != None: mc.ActivateWindow(PHOTO_DIALOG_ID) mc.GetWindow(PHOTO_DIALOG_ID).GetList(PHOTO_DIALOG_LIST_ID).SetItems( list) mc.GetWindow(PHOTO_DIALOG_ID).GetList( PHOTO_DIALOG_LIST_ID).SetFocusedItem(util.getIndex(listItem, list)) else: mc.ShowDialogNotification("Unable to display picture")
def updateWindowItems(window, windowInformation): window.GetList(DIRECTORY_TITLE_ID).SetItems( windowInformation.titleListItems) window.GetList(DIRECTORY_ITEMS_ID).SetItems( windowInformation.childListItems) if len(windowInformation.childListItems ) > 0 and windowInformation.childListItems[0].GetLabel() != "": mc.ShowDialogNotification( windowInformation.childListItems[0].GetLabel()) window.GetControl(DIRECTORY_ITEMS_ID).SetFocus()
def init(args=False): try: info('init', 'mlb launched, checking authentication') auth = authenticate() if ((auth == status_valid) and mc.ShowDialogNotification( 'Welcome to MLB.TV!', 'mlb-icon.png')): if (args and launchWithItem(args)): pass return False except Exception, e: return raiseError(False, True)
def countdown_timer(delay_time, title, caption): if delay_time == 0: print '0-second delay time specified; returning' return True print 'Waiting ' + str(delay_time) + ' seconds' if title == '': title = 'Please wait' # calculate target end time cur_time = time.time() end_time = cur_time + delay_time dialog = xbmcgui.DialogProgress() dialog.create(title) rdisp = 0 while cur_time < end_time: cur_time = time.time() remaining = int(end_time - cur_time) # Only update display once per second if rdisp != remaining: #percent=str(int(100*(delay_time-remaining)/delay_time)) #mc.ShowDialogNotification(title + ": " + percent + "% - " +str(remaining)+" seconds remaining") mc.ShowDialogNotification(title + ": " + str(remaining) + " seconds remaining") rdisp = remaining time.sleep(0.1) if (dialog.iscanceled()): print 'Wait cancelled' mc.ShowDialogNotification("Wait cancelled") return False dialog.close() print 'Wait finished' return True
def showWindowInformation(window, windowInformation): viewGroup = windowInformation.titleListItems[0].GetProperty("viewgroup") if viewGroup == "secondary": window.GetList(DIRECTORY_SECONDARY_ID).SetItems( windowInformation.childListItems) else: window.GetList(DIRECTORY_TITLE_ID).SetItems( windowInformation.titleListItems) window.GetList(DIRECTORY_ITEMS_ID).SetItems( windowInformation.childListItems) mc.ShowDialogNotification( windowInformation.childListItems[0].GetLabel()) window.GetControl(DIRECTORY_ITEMS_ID).SetFocus()
def SaveWindowState(self): # save all focused items currentFocusControlId = self.PAGES_PANEL_ID # find current focused control if self.GetControl(self.SEARCH_ALL_ID).HasFocus(): currentFocusControlId = self.SEARCH_ALL_ID elif self.GetControl(self.SEARCH_ID).HasFocus(): currentFocusControlId = self.SEARCH_ID elif self.GetControl(self.PAGES_PANEL_ID).HasFocus(): currentFocusControlId = self.PAGES_PANEL_ID # store current focus info in nav container's focused item currentNavItem = self.GetListFocusedItem(self.GetNavigationContainer()) currentNavItem.SetProperty("focusId", str(currentFocusControlId)) self.SavePagesFocusedItem() self.GetNavAnchorControl().SetFocus() mc.GetActiveWindow().PushState() self.GetControl(currentFocusControlId).SetFocus() # tell user how to go back ;) mc.ShowDialogNotification(mc.GetLocalizedString(53112))
def handleItem(listItem, fromWindowId=0): itemType = listItem.GetProperty("itemtype") if itemType == "Video": _handleVideoItem(listItem) elif itemType == "Track": _handleTrackItem(listItem) #Clicked on directory item elif itemType == "Directory": _handleMenuItem(listItem, fromWindowId) elif itemType == "Photo": _handlePhotoItem(listItem) # Unknown item else: mc.ShowDialogNotification("Unknown itemType: %s" % itemType)
def saveFavorites(): try: mc.ShowDialogWait() favs = [] for div in range(200, 206): items = mc.GetActiveWindow().GetList(div).GetSelected() for team in items: favs.append(team.GetProperty('team-id')) favs = ';'.join(favs) response = callService('setfavorites', {'teamids': favs}) if ((response == '1') and mc.ShowDialogNotification( 'Your favorite teams have been saved successfully.', 'mlb-icon.png')): pass mc.HideDialogWait() except Exception, e: mc.GetActiveWindow().PopState() return raiseError(log='savefavorites', error=e)
def onClick(self, controlID): if controlID == 90: if mc.GetPlayer().IsPlayingAudio(): mc.ActivateWindow(12006) elif mc.GetPlayer().IsPlayingVideo(): mc.ActivateWindow(12005) if controlID == 1001: if mlb.isLoggedIn(): #mc.GetActiveWindow().ClearStateStack() mc.ActivateWindow(14003) else: mc.ShowDialogNotification("You must be logged in to make changes to your settings.", "mlb-icon.png") if controlID == 1002: #mc.GetActiveWindow().ClearStateStack() mc.ActivateWindow(14000) if controlID == 120: #mc.GetActiveWindow().PushState() wait = mc.ShowDialogWait() mlb.standings('national') mc.GetActiveWindow().GetControl(2000).SetVisible(False) mc.GetActiveWindow().GetLabel(3001).SetLabel('National League') mc.GetActiveWindow().GetControl(3000).SetVisible(True) mc.GetActiveWindow().GetControl(4000).SetFocus() mc.GetActiveWindow().GetControl(3002).SetFocus() mc.HideDialogWait(wait) if controlID == 121: #mc.GetActiveWindow().PushState() wait = mc.ShowDialogWait() mlb.standings('american') mc.GetActiveWindow().GetControl(2000).SetVisible(False) mc.GetActiveWindow().GetLabel(3001).SetLabel('American League') mc.GetActiveWindow().GetControl(3000).SetVisible(True) mc.HideDialogWait(wait)
def update(): version_remote = get_remote_version() os.system("dtool 6 1 0 100") os.system("dtool 6 2 0 0") mc.ShowDialogNotification("Beginning Upgrade") if os.path.exists("/media/BOXEE/hack"): mc.ShowDialogNotification("Found USB Drive with Boxee+") ev = common.file_get_contents("/media/BOXEE/hack/version") xbmc.executebuiltin("Notification(,Installing Boxee+,60000)") mc.ShowDialogWait() os.system("rm -Rf /data/hack") os.system("cp -R /media/BOXEE/hack /data/") os.system("chmod -R +x /data/hack/*.sh") os.system("chmod -R +x /data/hack/bin/*") mc.HideDialogWait() else: # Clean Up to Ensure we have Disk Space cleanupdownload() xbmc.executebuiltin("Notification(,Downloading Boxee+,120000)") mc.ShowDialogWait() os.system( "/opt/local/bin/curl -L http://boxeed.in/boxeeplus/boxeehack.zip -o /download/boxeehack.zip" ) os.system( "/opt/local/bin/curl -L http://boxeed.in/boxeeplus/boxeehack.md5 -o /download/boxeehack.md5" ) dm = common.file_get_contents("/download/boxeehack.md5") os.system( "md5sum /download/boxeehack.zip | awk '{ print $1 }'> /download/boxeehack.md52" ) tm = common.file_get_contents("/download/boxeehack.md5") mc.HideDialogWait() if dm != tm or tm == "": os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin( "Notification(,Download Failed - Aborting,60000)") return mc.ShowDialogNotification("Download Complete") time.sleep(2) xbmc.executebuiltin("Notification(,Extracting Archive,120000)") mc.ShowDialogWait() os.system("/bin/busybox unzip /download/boxeehack.zip -d /download/") mc.HideDialogWait() mc.ShowDialogNotification("Extraction Complete") time.sleep(2) mc.ShowDialogNotification("Verifying Extraction") ev = common.file_get_contents( "/download/boxeehack-master/hack/version") if ev != version_remote: os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin( "Notification(,Extraction Failed - Aborting,60000)") return time.sleep(2) xbmc.executebuiltin("Notification(,Installing Boxee+,60000)") mc.ShowDialogWait() os.system("rm -Rf /data/hack") os.system("cp -R /download/boxeehack-master/hack /data/") os.system("chmod -R +x /data/hack/*.sh") os.system("chmod -R +x /data/hack/bin/*") mc.HideDialogWait() mc.ShowDialogNotification("Verifying Installation") hv = common.file_get_contents("/data/hack/version") if ev != hv: os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin( "Notification(,Installation Failed - Aborting,60000)") return time.sleep(2) mc.ShowDialogNotification("Cleaning Up") cleanupdownload() time.sleep(2) os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") # No need to redo all the settings since Boxee+ is already running xbmc.executebuiltin("Notification(,Rebooting,120000)") os.system("reboot")
def loadRecordList(): global current_navigation current_navigation = 'record' #http://192.168.0.160/web/movielist?dirname=/hdd/movie/&tag= mc.GetActiveWindow().GetList(120).SetItems(mc.ListItems()) mc.ShowDialogNotification("load recordlist. will be implemented soon")
def showErrorMessage(message): mc.ShowDialogNotification(message)
def loadEPG(): global current_navigation current_navigation = 'epg' mc.GetActiveWindow().GetList(120).SetItems(mc.ListItems()) mc.ShowDialogNotification("load epg. will be implemented soon")
import mc import dreamboxee config = mc.GetApp().GetLocalConfig() ipaddress = config.GetValue("ipaddress") if ipaddress: mc.ShowDialogNotification("IP address is: " + ipaddress) else: ipaddress = mc.ShowDialogKeyboard("Dreambox IP", "", False) config.SetValue("ipaddress", ipaddress) mc.ActivateWindow(14000)
def onClick(self, controlID): """start your code""" """end your code""" if controlID == 91: mlb.prevMonth() if controlID == 92: mlb.nextMonth() if controlID == 90: if mc.GetPlayer().IsPlayingAudio(): mc.ActivateWindow(12006) elif mc.GetPlayer().IsPlayingVideo(): mc.ActivateWindow(12005) if controlID == 1001: if mlb.isLoggedIn(): #mc.GetActiveWindow().ClearStateStack() mc.ActivateWindow(14003) else: mc.ShowDialogNotification( "You must be logged in to make changes to your settings.", "mlb-icon.png") if controlID == 1003: mc.ActivateWindow(14000) if controlID == 121: clear = mc.ListItems() mc.GetActiveWindow().GetList(4002).SetItems(clear) list = mc.GetActiveWindow().GetList(121) item = list.GetItem(list.GetFocusedItem()) if item.GetProperty('today'): mc.ActivateWindow(14000) elif not item.GetProperty('display') or not item.GetDescription(): mc.ShowDialogNotification('No games available for this day.', 'mlb-icon.png') else: date = item.GetPath() date = date.split(':') games = mlb.getGames(date[0], date[1], date[2]) if games: mc.GetActiveWindow().PushState() mc.GetActiveWindow().GetList(4002).SetItems(games) mc.GetActiveWindow().GetControl(4000).SetVisible(True) mc.GetActiveWindow().GetList(4002).SetFocusedItem(0) mc.GetActiveWindow().GetControl(4002).SetFocus() mc.GetActiveWindow().GetList(4002).SetFocusedItem(0) else: mc.ShowDialogOk( "MLB.TV", "To view MLB Post Season content, please disconnect and reconnect your MLB.TV account at http://boxee.tv/services." ) item.Dump() if controlID == 4002: mlb.playList(4002) if controlID == 4003: mc.GetActiveWindow().PopState() if controlID == 501: mlb.playItem(501)
def set_watched(command): lst = get_list(52, False) count = 10 while lst == "" and count > 0: time.sleep(0.1) lst = get_list(52, False) count = count - 1 if lst == "": pass else: item = lst.GetItem(1) series = mc.GetInfoString("Container(52).ListItem.TVShowTitle") itemList = lst.GetItems() seasons = [] episodes_count = 0 for item in itemList: season = item.GetSeason() if(season != -1): seasons.append(season) episodes_count = episodes_count + 1 seasons = dict.fromkeys(seasons) seasons = seasons.keys() use_season = -1 display_name = series season_string = "" if(len(seasons) == 1): season_string = " Season %s" % (seasons[0]) use_season = seasons[0] dialog = xbmcgui.Dialog() if dialog.yesno("Watched", "Do you want to mark all episodes of %s%s as %s?" % (series, season_string, command)): progress = xbmcgui.DialogProgress() progress.create('Updating episodes', 'Setting %s%s as %s' % (series, season_string, command)) current_count = 0 info_count = 0 db_path = xbmc.translatePath('special://profile/Database/') + "./boxee_user_catalog.db" conn = sqlite.connect(db_path, 100000) c = conn.cursor() for item in itemList: episode = item.GetEpisode() boxeeid = mc.GetInfoString("Container(52).ListItem("+str(info_count)+").Property(boxeeid)") info_count = info_count + 1 print boxeeid if(episode != -1): current_count = current_count+1 percent = int( ( episodes_count / current_count ) * 100) message = "Episode " + str(current_count) + " out of " + str(episodes_count) progress.update( percent, "", message, "" ) path = item.GetPath() # First make sure we don't get double values in the DB, so remove any old ones sql = "DELETE FROM watched WHERE strPath = \""+str(path).strip()+"\" or (strBoxeeId != \"\" AND strBoxeeId = \""+str(boxeeid).strip()+"\");" c.execute(sql) if command == "watched": sql = "INSERT INTO watched VALUES(null, \""+path+"\", \""+boxeeid+"\", 1, 0, -1.0);" c.execute(sql) c.execute("REINDEX;") conn.commit() c.close() conn.close() lst = get_list(52, False) if lst != "": lst.Refresh() xbmc.executebuiltin("XBMC.ReplaceWindow(10483)") progress.close() mc.ShowDialogNotification("%s marked as %s..." % (display_name, command))