def LoadSectionsList(self, loadAttempt=1): mc.ShowDialogWait() sectionsList = self.model.sectionsList() if 0 == len(sectionsList) and loadAttempt < 3: mc.HideDialogWait() self.model = exmodel.exmodel(self.localizer, True) sectionsList = self.LoadSectionsList(loadAttempt + 1) mc.HideDialogWait() return sectionsList
def OnPageClick(self): focusedItem = self.GetPagesFocusedItem() self.SavePagesFocusedItem() self.SaveSectionsFocusedItem() url = focusedItem.GetPath() mc.ShowDialogWait() params = { 'path': url, 'name': focusedItem.GetLabel(), 'image': focusedItem.GetThumbnail(), 'referer': focusedItem.GetProperty('referer'), 'folder': focusedItem.GetProperty('folder') } mc.LogInfo("params for loading play list dict %s" % str(params)) playDict = self.model.pagePlaylistDict(params) mc.HideDialogWait() if playDict.has_key("playitems"): self.RunPlayerForItemsFromDict(focusedItem, playDict) elif playDict.has_key("subfolders"): self.OnLoadSubfolders(focusedItem, playDict) else: if self.GetNavNextPageItem() and self.GetNavNextPageItem().GetPath( ) == url: # go to next manually to not push window state self.OnNext() else: #we have link to dig into with pushing window state self.OnLoadSectionPages(focusedItem, True, True, True)
def authenticate(): try: content = mc.Http().Get( 'http://app.boxee.tv/api/get_application_data?id=mlb') if content: return status_error else: auth_dom = parseString(content) email = auth_dom.getElementsByTagName('email')[0].firstChild.data account = auth_dom.getElementsByTagName( 'rand_account')[0].firstChild.data post_data = request({ 'func': '_login', 'email': email, 'pass': account }) if ((not post_data) or (post_data['data'] == '0')): Exception('post request return false') cf = mc.GetApp().GetLocalConfig() response = getJson(data=post_data['data']) response = response.get('identity') code = str(response.get('code')) if ((code != '1') and info('authenticate.code', code)): cf.Reset('fprt') cf.Reset('ipid') cf.Reset('username') cf.Reset('password') info('login', 'stored/entered credentials invalid') return status_invalid mc.HideDialogWait() except Exception, e: updateArchiveSpoiler() return status_invalid
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 InstallApp(URL='', mediaitem=CMediaItem()): type = mediaitem.GetType(0) attributes = mediaitem.GetType(1) if type == 'app': response = mc.ShowDialogConfirm("Message", "Install Boxee App?", "No", "Yes") if response == False: return mc.ShowDialogWait() #loading text installer = CInstaller() # if attributes == 'navi-x': result = installer.InstallNaviX(URL, mediaitem) # else: # result = installer.InstallScript(URL, mediaitem) if result == 0: mc.ShowDialogOk("Installer", "Installation successful.") mc.ShowDialogOk("Installer", "Please restart Boxee.") elif result == -1: mc.ShowDialogOk("Installer", "Installation aborted.") elif result == -3: mc.ShowDialogOk("Installer", "Invalid ZIP file.") else: mc.ShowDialogOk("Installer", "Installation failed.") mc.HideDialogWait() return
def OnLoadSectionPages(self, listItem, startNewSection=True, pushState=False, pushNavItem=True): url = listItem.GetPath() mc.LogInfo("url to load: %s" % url) mc.ShowDialogWait() if listItem.GetProperty("isSearch"): pagesDict = self.model.searchPagesDict(url) else: pagesDict = self.model.pagesDict(url) listItems = self.BuildPanelItemsList(pagesDict) currentNavItem, nextNavItem = self.BuildCurrentAndNextItemsForLoadedPagesDict( listItem, pagesDict) if pushState is True: self.SaveWindowState() if pushState or startNewSection: self.StartNavNewSection(listItem.GetLabel(), currentNavItem, nextNavItem) else: self.UpdateNavigationContainerForLoadedPages( currentNavItem, nextNavItem, pushNavItem) self.GetPagesPanel().SetItems(listItems) mc.HideDialogWait()
def getFeaturedMixes(count): mc.ShowDialogWait() featured_url = "http://8tracks.com/mixes.json?api_key=a07ee2f7cc1577f749ed10d2c796fc52515243cc&api_version=2&per_page=%s&page=1" % count fd = urllib.urlopen(featured_url) mix_sets = simplejson.loads(fd.read()) listItems = mc.ListItems() for mix in mix_sets["mixes"]: item = mc.ListItem(mc.ListItem.MEDIA_AUDIO_OTHER) item.SetArtist(str(mix["user"]["login"])) year = mix['first_published_at'][1:4] month = mix['first_published_at'][6:7] day=mix['first_published_at'][9:10] item.SetDate(int(year), int(month), int(day)) name = mix["name"].replace(u'\xbd', '') item.SetLabel(str(name)) item.SetThumbnail(str(mix['cover_urls']['original'])) item.SetIcon(str(mix['cover_urls']['sq100'])) # get the real track url, so default actions like play would work # this should not be here! trackD = urllib.urlopen("http://8tracks.com/sets/460486803/play.json?mix_id=%s&api_key=a07ee2f7cc1577f749ed10d2c796fc52515243cc&api_version=2" % mix["id"]) trackInformation = simplejson.loads(trackD.read()) item.SetPath(str(trackInformation['set']['track']['url'])) item.SetProperty("id", str(mix['id'])) listItems.append(item) mc.GetWindow(14000).GetList(201).SetItems(listItems) mc.GetWindow(14000).GetList(201).Refresh() mc.GetWindow(14000).GetList(201).SetFocusedItem(0) mc.HideDialogWait()
def favoriteTeams(): try: mc.ShowDialogWait() data = getJson( 'http://mlb.mlb.com/lookup/json/named.team_all.bam?sport_code=%27mlb%27&active_sw=%27Y%27&all_star_sw=%27N%27' ) data = data.get('team_all').get('queryResults').get('row') teamList = mc.ListItems() for team in data: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(team.get('name_display_full'))) item.SetThumbnail( ('http://mlb.mlb.com/images/logos/200x200/200x200_%s.png' % str(team.get('name_abbrev')))) item.SetProperty('team-id', str(team.get('team_id'))) item.SetProperty('team-abbrev', str(team.get('team_abbrev'))) teamList.append(item) favList = [] for ( index, team, ) in enumerate(teamList): if ((team.GetProperty('team-id') in favList) and teamList.SetSelected(index, True)): pass mc.HideDialogWait() return teamList except Exception, e: raiseError(log='favoriteteams', error=e)
def PushDir(): app = mc.GetApp() params = mc.Parameters() params["noreload"] = "1" app.ActivateWindow(targetwindow, params) list = mc.GetWindow(targetwindow).GetList(targetcontrol) list.SetItems(dir) mc.HideDialogWait()
def OnSearchEverywhere(self): query = mc.ShowDialogKeyboard( mc.GetLocalizedString(137) + " FS.TO", "", False) if 0 != len(query): mc.LogInfo("string to search: %s" % query) mc.ShowDialogWait() pagesDict = self.model.searchAllPagesDict(query) self.UpdatePagesPanelWithSearchResults(query, pagesDict) mc.HideDialogWait()
def raiseError(message=False, log=False, error=False): mc.HideDialogWait() if (log and error): mc.LogError(((('@mlb.tv (' + log) + ') ') + str(error))) if message: response = message else: response = 'An error has occurred. Details have been saved in your log. Please notify Boxee support.' mc.ShowDialogOk('MLB.TV', response) return False
def loadSports(): mc.ShowDialogWait() sportsList = mc.GetActiveWindow().GetList(9000) sportsItems = mc.ListItems() for sport in SPORTS: sportItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) sportItem.SetLabel(sport.get('title', 'Unknown')) sportItem.SetProperty("id", str(sport.get('id', -1))) sportsItems.append(sportItem) sportsList.SetItems(sportsItems) mc.HideDialogWait()
def search(): term = mc.ShowDialogKeyboard("Search for:", "", False) mc.ShowDialogWait() url = "%s%s%s" % ("http://pipes.yahoo.com/pipes/pipe.run?Search=", term, "&_id=acacaff9768ad4f22e06b0644879a6b1&_render=rss") quoted = urllib.quote_plus(url) apiurl = "http://tinyurl.com/api-create.php?url=" tinyurl = urllib.urlopen(apiurl + quoted).read() mc.GetActiveWindow().GetList(1000).SetContentURL(tinyurl) mc.HideDialogWait() return tinyurl
def loadFavorites(): try: mc.ShowDialogWait() mc.GetActiveWindow().PushState() if isLoggedIn(): response = callService('teams') data = json.loads(response) data = data.get('teams') division = { '200': mc.ListItems(), '201': mc.ListItems(), '202': mc.ListItems(), '203': mc.ListItems(), '204': mc.ListItems(), '205': mc.ListItems() } for team in data: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(team.get('title'))) item.SetThumbnail(str(team.get('thumb'))) item.SetProperty('team-id', str(team.get('team-id'))) item.SetProperty('team-abbrev', str(team.get('team-abbrev'))) item.SetProperty('team-leauge', str(team.get('team-leauge'))) item.SetProperty('team-division', str(team.get('team-division'))) item.SetProperty('team-fav', str(team.get('team-fav'))) div = str(team.get('team-division')) division[div].append(item) for div in division: mc.GetActiveWindow().GetList(int(div)).SetItems(division[div]) list = mc.GetActiveWindow().GetList(int(div)) for ( i, v, ) in enumerate(list.GetItems()): if ((v.GetProperty('team-fav') == '1') and list.SetSelected(i, True)): pass mc.GetActiveWindow().GetControl(3000).SetVisible(True) mc.GetActiveWindow().GetList(200).SetFocusedItem(0) mc.GetActiveWindow().GetControl(200).SetFocus() mc.GetActiveWindow().GetList(200).SetFocusedItem(0) else: return raiseError( 'You must be logged in to access your favorite teams!') mc.HideDialogWait() except Exception, e: mc.GetActiveWindow().PopState() return raiseError( 'An error occured while accessing your favorite team settings. Are you logged in?', log='loadfavorites', error=e)
def ShowPlay(url): mc.ShowDialogWait() player = mc.GetPlayer() data = GetCached(url, 3600).decode('utf-8') playurl = re.compile( '<a class="wmv-player-holder" href="http://asx.sbsnet.nl/(.*?)"></a>', re.DOTALL + re.IGNORECASE).search(data).group(1) list_item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_CLIP) list_item.SetPath("mms://pssbswm.fplive.net/pssbswm/w/" + str(playurl)) list_item.SetReportToServer(True) list_item.SetAddToHistory(True) mc.HideDialogWait() player.Play(list_item)
def loginUser(): username = mc.GetActiveWindow().GetEdit(991).GetText() password = mc.GetActiveWindow().GetEdit(992).GetText() _user = user.getUser() if (username and password): mc.ShowDialogWait() _user.authenticate(username, password) mc.HideDialogWait() if _user.isAuthenticated: mc.ShowDialogOk("Welcome", "You are logged in as " + username) ui.toggleLoginVisibility(False) else: ui.showErrorMessage("An Error Has Occured")
def _handleMenuItem(listItem, fromWindowId): 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 mc.ShowDialogWait() machineIdentifier = listItem.GetProperty("machineidentifier") windowInformation = manager.getListItems(machineIdentifier, url) viewGroup = windowInformation.titleListItems[0].GetProperty("viewgroup") nextWindowID = getWindowID(viewGroup) window = mc.GetActiveWindow() if fromWindowId != getWindowID('home'): if not (listItem.GetProperty('type') == "" and listItem.GetProperty('secondary') == ""): #Not a menu item with no secondary elements mc.GetActiveWindow().PushState() if viewGroup == "secondary": menuItems = windowInformation.childListItems if fromWindowId == getWindowID('home'): #Clicked on Movie etc.. from home menu #Grab the menu items - and go to the first one url = menuItems[0].GetPath() windowInformation = manager.getListItems(machineIdentifier, url) window = activateWindow(nextWindowID) updateMenuItems(window, menuItems) updateWindowItems(window, windowInformation) else: #Only found more menu items, so update them updateMenuItems(window, menuItems) else: #Found a list of items to display if fromWindowId == getWindowID('home'): #We need a window to update window = activateWindow(nextWindowID) #This means we have no menu items updateWindowItems(window, windowInformation) mc.HideDialogWait()
def updateArchiveSpoiler(): try: mc.ShowDialogWait() if isLoggedIn(): response = callService('showhide') if ((response == 'T') and mc.GetApp().GetLocalConfig().SetValue( 'hide_scores', 'true')): pass else: mc.GetApp().GetLocalConfig().Reset('hide_scores') mc.HideDialogWait() except Exception, e: mc.GetApp().GetLocalConfig().Reset('hide_scores') return raiseError(log='updatearchivespoiler', 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 standings(league): try: mc.ShowDialogWait() if (league == 'national'): league = 0 elif (league == 'american'): league = 1 data = getJson( 'http://mlb.mlb.com/lookup/json/named.standings_all_league_repeater.bam?sit_code=%27h0%27&league_id=104&league_id=103&season=2010' ) data = data.get('standings_all_league_repeater').get( 'standings_all')[league] stand = data.get('queryResults').get('row') east = mc.ListItems() west = mc.ListItems() central = mc.ListItems() for team in stand: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(team.get('team_short'))) item.SetThumbnail( ('http://mlb.mlb.com/images/logos/200x200/200x200_%s.png' % str(team.get('team_abbrev')))) item.SetProperty('games-back', str(team.get('gb'))) item.SetProperty('wild-card', str(team.get('wild_card'))) item.SetProperty('elim-wildcard', str(team.get('elim_wildcard'))) details = ((( ((((((((((((('Steak (' + team.get('streak')) + '), Home (') + team.get('home')) + '), Away (') + team.get('away')) + '), Vs Division (') + team.get('vs_division')) + '), Last Ten (') + team.get('last_ten')) + ')[CR]Winning Percentage (') + team.get('pct')) + '%), Wildcard (') + team.get('wild_card')) + '), Elimination Wildcard (') + team.get('elim_wildcard')) + ')') item.SetDescription(str(details)) division = str(team.get('division')) if (('East' in division) and east.append(item)): pass mc.GetActiveWindow().GetList(3002).SetItems(west) mc.GetActiveWindow().GetList(3003).SetItems(central) mc.GetActiveWindow().GetList(3004).SetItems(east) mc.HideDialogWait() except Exception, e: return raiseError( message= 'There was a problem accessing standings. Please try again later.', log='league', error=e)
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 OnSearchInActiveSection(self): if self.GetNavSearchContext(): query = mc.ShowDialogKeyboard( mc.GetLocalizedString(137) + " " + mc.GetLocalizedString(1405) + " " + self.GetNavSectionName(), "", False) if 0 != len(query): mc.ShowDialogWait() pagesDict = self.model.searchInSectionPagesDict( self.GetNavSearchContext(), query) self.UpdatePagesPanelWithSearchResults(query, pagesDict) mc.HideDialogWait() else: mc.LogInfo( "No search context present - unable to perform search in active section" )
def viewImage(mode=0, mediaitem=''): mc.ShowDialogWait() URL = mediaitem.URL ext = getFileExtension(URL) mc.HideDialogWait() listitem_image = mc.ListItem(mc.ListItem.MEDIA_PICTURE) listitem_image.SetContentType("url") listitem_image.SetLabel(mediaitem.name) listitem_image.SetPath(URL) player = mc.Player() player.PlayWithActionMenu(listitem_image) return 0
def categories(): mc.ShowDialogWait() list = mc.ListItems() categories = playkanalerna.getCategories() for category in categories: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(category['name'].encode('utf-8', 'ignore'))) item.SetPath(str(category['url'].encode('utf-8', 'ignore'))) list.append(item) mc.ActivateWindow(14000) window = mc.GetWindow(14000) window.GetList(51).SetItems(list) mc.HideDialogWait()
def OnPageClick(self): focusedItem = self.GetPagesFocusedItem() self.SavePagesFocusedItem() self.SaveSectionsFocusedItem() url = focusedItem.GetPath() mc.ShowDialogWait() playDict = self.model.pagePlaylistDict({"url": url}) mc.HideDialogWait() if playDict.has_key("playitems"): self.RunPlayerForItemsFromDict(focusedItem, playDict) else: if self.GetNavNextPageItem() and self.GetNavNextPageItem().GetPath( ) == url: # go to next manually to not push window state self.OnNext() else: #we have link to dig into with pushing window state self.OnLoadSectionPages(focusedItem, True, True, True)
def __init__(self): mc.ShowDialogWait() self.useCoverArt = True self.player = mc.GetPlayer() self.defaultCoverArt = 'default-cover.png' self.xbmcPlaylist = mc.PlayList(mc.PlayList.PLAYLIST_MUSIC) self.gs = GrooveAPI(enableDebug=__debugging__, cwd=__cwd__, clientUuid=None, clientVersion=None) username = __settings__.GetValue("username") password = __settings__.GetValue("password") self.gs.startSession(username, password) self.gs.setRemoveDuplicates(True) self._search = None self.start() mc.HideDialogWait()
def programs(url, category): mc.ShowDialogWait() list = mc.ListItems() programs = playkanalerna.getPrograms(url) for program in programs: item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) item.SetLabel(str(program['name'].encode('utf-8', 'ignore'))) item.SetPath(str(program['url'].encode('utf-8', 'ignore'))) list.append(item) mc.ActivateWindow(14001) window = mc.GetWindow(14001) window.GetList(51).SetItems(list) window.GetLabel(30).SetLabel(category) mc.HideDialogWait()
def ShowEpisode(urlshow): mc.ShowDialogWait() targetcontrol = 52 targetwindow = 14000 urlbase = re.compile('http://(.*?).nl').findall(urlshow)[0] data = GetCached(urlshow, 3600).decode('utf-8') soup = BeautifulSoup(data) try: pages = soup.findAll('div', {'class': 'paginator'})[0] pages = pages.findAll('span') pages = len(pages) - 1 except: pages = 1 list = mc.GetWindow(targetwindow).GetList(targetcontrol) list_items = mc.ListItems() for i in range(1, pages + 1): url = str(urlshow) + '/page=' + str(i) data = GetCached(url, 3600).decode('utf-8') soup = BeautifulSoup(data) maindiv = soup.findAll('div', {'class': 'mo-c double'})[0] showdiv = maindiv.findAll('div', {'class': 'wrapper'})[0] thumb = showdiv.findAll('div', {'class': 'thumb'}) airtime = showdiv.findAll('div', {'class': 'airtime'}) count = len(thumb) for i in range(0, count): link = 'http://' + urlbase + '.nl' + thumb[i].a['href'] thumbnail = 'http://' + urlbase + '.nl' + thumb[i].img['src'] date = airtime[i].a.span.renderContents() list_item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) list_item.SetThumbnail(str(thumbnail)) list_item.SetLabel(str(date)) list_item.SetPath(str(link)) list_items.append(list_item) mc.HideDialogWait() list.SetItems(list_items) list.control.SetFocus(0)
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)