def set_episodes(items, show_item): global labelEpisodes global episode_list_index BPTraceEnter() win = mc.GetWindow(14000) title = show_item.GetLabel() win.GetLabel(3002).SetLabel(title) labelEpisodes = title target = win.GetList(3001) mc_list = mc.ListItems() for item in items: list_item = episode_to_list_item( item , show_item.GetProperty("category") , title ) if list_item: mc_list.append(list_item) target.SetItems(mc_list) episode_list_index = 0 if len(mc_list) > 0: win.GetLabel(3003).SetLabel("") target.SetFocus() else: win.GetLabel(3003).SetLabel(NO_EPISODES_TEXT) BPTraceExit()
def add_episodes(items, show_item): global labelEpisodes BPTraceEnter() win = mc.GetWindow(14000) title = show_item.GetLabel() win.GetLabel(3002).SetLabel(title) labelEpisodes = title target = win.GetList(3001) mc_list = target.GetItems() for item in items: mc_list.append(episode_to_list_item( item , show_item.GetProperty("category") , show_item.GetLabel() )) if len(mc_list) > 0: win.GetLabel(3003).SetLabel("") focusedIndex = target.GetFocusedItem() target.SetItems(mc_list) target.SetFocusedItem(focusedIndex) BPTraceExit()
"date_available_until": "2013-03-13T22:04:28.295345+00:00", "date_broadcasted": "2013-03-07T08:00:00+00:00", "date_created": "2013-03-07T23:04:28.298583+00:00", "date_downloaded": None, "description": "SVT Rapport är Sveriges största nyhetsprogram med nyheter dygnet runt i SVT1, SVT Forum och SVT Play.", "http_status": 200, "http_status_checked_date": "2013-03-09T22:10:15.070459+00:00", "id": "4307", "kind_of": 1, "length": "5 min", "recommended": False, "resource_uri": "/v1/episode/4307/", "show": "/v1/show/300/", "state": 0, "thumbnail_url": "http://www.svt.se/cachable_image/1362644099000/svts/article1079534.svt/ALTERNATES/extralarge/default_title", "title": "Rapport - 7/3 09:00 ", "title_slug": "Rapport - 7-3 09:00", "url": "http://www.svtplay.se/video/1079535/7-3-09-00", "viewable_in": 1, "viewable_on_device": 1 } episode_item = episode_to_list_item(episode) BPLog("Transformed episode:") BPLog(simplejson.dumps(episode_item.to_object(), indent=2)) try: BPLog("Is in sweden: " + str(ip_info.get_country_code() == "SE")) BPLog("Country: " + ip_info.get_country_name() + ", Code: " + ip_info.get_country_code()) except Exception, e: BPLog(str(e))