def rootMenu(self): filmWise = FilmWiseCore() # get the list of available quizzes quizList = filmWise.getQuizList() log("FilmWisePlugin: Available Number of Quizzes is %d" % len(quizList)) # Now the system has been loaded, we should update the last viewed setting if len(quizList) > 0: Settings.setLastViewed(quizList[0]['link']) for quiz in quizList: displaytitle = "%s %s" % (quiz['date'], quiz['name']) li = xbmcgui.ListItem(displaytitle, iconImage=ICON) li.setProperty("Fanart_Image", FANART) url = self._build_url({'mode': 'quiz', 'number': quiz['number'], 'name': quiz['name'], 'link': quiz['link'], 'solution': quiz['solution']}) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=False) del filmWise xbmcplugin.endOfDirectory(self.addon_handle)
######################### # Main ######################### if __name__ == '__main__': log("FilmWise: Started") xbmc.executebuiltin("ActivateWindow(busydialog)") filmWise = FilmWiseCore() # get the list of available quizzes quizList = filmWise.getQuizList() # Now the system has been loaded, we should update the last viewed setting if len(quizList) > 0: Settings.setLastViewed(quizList[0]['link']) displayList = [] for quiz in quizList: displayName = "%s %s" % (quiz['date'], quiz['name']) displayList.append(displayName) xbmc.executebuiltin("Dialog.Close(busydialog)") # Show the list to the user select = xbmcgui.Dialog().select(ADDON.getLocalizedString(32001), displayList) if select < 0: log("FilmWise: Cancelled by user") else: xbmc.executebuiltin("ActivateWindow(busydialog)")