def add_shows(items, category_item): BPTraceEnter() win = mc.GetWindow(14000) target = win.GetList(2001) mc_list = target.GetItems() for item in items: mc_list.append(show_to_list_item(item, category_item.GetLabel())) focusedIndex = target.GetFocusedItem() target.SetItems(mc_list) target.SetFocusedItem(focusedIndex) BPTraceExit()
def set_shows(items, category_item): global labelPrograms global show_list_index BPTraceEnter() win = mc.GetWindow(14000) title = category_item.GetLabel() labelPrograms = title win.GetLabel(2002).SetLabel(title) target = win.GetList(2001) mc_list = mc.ListItems() for item in items: mc_list.append(show_to_list_item(item, title)) target.SetItems(mc_list) show_list_index = 0 if len(mc_list) > 0: win.GetLabel(2003).SetLabel("") target.SetFocus() else: win.GetLabel(2003).SetLabel(NO_SHOWS_TEXT) BPTraceExit()
BPLog(simplejson.dumps(category_item.to_object(), indent=2)) show = { "category": "/v1/category/5/", "episodes": [ "/v1/episode/4306/", "/v1/episode/4307/" ], "id": "300", "resource_uri": "/v1/show/300/", "thumbnail": "shows/image_5_6.jpg", "thumbnail_url": "http://www.svt.se/cachable_image/1356099963000/svts/article927529.svt/ALTERNATES/large/rapport_affisch_ny.jpg", "title": "Rapport", "url": "http://www.svtplay.se/rapport" } show_item = show_to_list_item(show) BPLog("Transformed show:") BPLog(simplejson.dumps(show_item.to_object(), indent=2)) episode = { "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,