def getMainCategoryList(): ## Get the account details ## account accountLoader = APAccountLoader.APAccountLoader(__properties) jsonAccountDictionary = accountLoader.loadURL() xbmc.log('accountURL --> %s' % (accountLoader.getQuery()), xbmc.LOGDEBUG) # get programs category rootCategoryId = '' #try: # extensionsStr = jsonAccountDictionary["account"]["extensions"] # extensions = APExtensions.APExtensions(json.loads(extensionsStr, 'utf-8')) # rootCategoryId = extensions.getProgramsCategoryId() # if __DEBUG__: # xbmc.log('Programs category id --> %s' % rootCategoryId, xbmc.LOGERROR) #except: # pass if '' == rootCategoryId: ## broadcaster and main category from previous incarnation of the plugin broadcaster = APBroadcaster.APBroadcaster( __properties['broadcasterId'], jsonAccountDictionary["account"]["broadcasters"]) xbmc.log('Main Category --> %s' % (broadcaster.getRootCategory()), xbmc.LOGDEBUG) rootCategoryId = broadcaster.getRootCategory() # get the main categories list getCategory(rootCategoryId)
def getMainCategoryList(): ## Get the account details ## account accountLoader = APAccountLoader.APAccountLoader(__properties) jsonAccountDictionary = accountLoader.loadURL() xbmc.log('***** accountURL --> %s' % (accountLoader.getQuery()), xbmc.LOGDEBUG) # get programs category rootCategoryId = '' try: broadcasterDict = jsonAccountDictionary["account"]["broadcasters"][0] if 'broadcaster' in broadcasterDict: broadcasterDict = broadcasterDict['broadcaster'] extensions = APExtensions.APExtensions(broadcasterDict) rootCategoryId = extensions.getProgramsCategoryId() xbmc.log('***** Programs category id --> %s' % rootCategoryId, xbmc.LOGDEBUG) except: xbmc.log('***** Couldnt obtain main content category ID', xbmc.LOGERROR) pass if None != rootCategoryId and '' != rootCategoryId: # get the main categories list getCategory(rootCategoryId) # obtain item lists and attempt to load each one to search for special programs itemList = extensions.getItemLists() for itemId in itemList: # obtain an item_list. we are interested in promoted shows xbmc.log('***** Retrieving item_list with ID %s' % itemId, xbmc.LOGDEBUG) itemListsLoader = APItemListsLoader.APItemListsLoader( __properties, itemId) itemListsDict = itemListsLoader.loadURL() # make sure its a valid item_lists with actual shows if itemListsDict != None: apItemLists = APItemLists.APItemLists( itemListsDict['item_list']) if apItemLists.isValid(): # now we can expand the category list itemCategories = apItemLists.getCategoryList() if (itemCategories.hasSubCategories()): for itemCat in itemCategories.getSubCategories(): addCategoryView(itemCat) else: xbmc.log('***** Couldnt load item_lists for ID %s' % itemId, xbmc.LOGERROR) else: xbmc.log('***** Cannot obtain programs category ID, sorry...', xbmc.LOGERROR)
def getMainCategoryList(): global rootCategoryId ## Get the account details ## account accountLoader = APAccountLoader.APAccountLoader(__properties) jsonAccountDictionary = accountLoader.loadURL() xbmc.log('accountURL --> %s' % (accountLoader.getQuery()), xbmc.LOGDEBUG) # get programs category rootCategoryId = '' if '' == rootCategoryId: ## broadcaster and main category from previous incarnation of the plugin broadcaster = APBroadcaster.APBroadcaster(__properties['broadcasterId'], jsonAccountDictionary["account"]["broadcasters"]) xbmc.log('Main Category --> %s' % (broadcaster.getRootCategory()), xbmc.LOGDEBUG) rootCategoryId = broadcaster.getRootCategory() # get the main categories list getCategory(rootCategoryId)
def getMainCategoryList(): ## Get the account details ## account accountLoader = APAccountLoader.APAccountLoader(__properties) jsonAccountDictionary = accountLoader.loadURL() if __DEBUG__: xbmc.log('accountURL --> %s' % (accountLoader.getQuery()), xbmc.LOGERROR) ## broadcaster and main category broadcaster = APBroadcaster.APBroadcaster( __properties['broadcasterId'], jsonAccountDictionary["account"]["broadcasters"]) if __DEBUG__: xbmc.log('Main Category --> %s' % (broadcaster.getRootCategory()), xbmc.LOGERROR) mainCategory = broadcaster.getRootCategory() # get the main categories list getCategory(mainCategory)
deviceId = 'd12' + str(rand1) + str(rand2) + str(rand3) __settings__.setSetting(id = 'deviceId', value = deviceId) __properties['deviceId'] = deviceId xbmc.log('***** deviceId --> %s' % (__properties['deviceId']), xbmc.LOGDEBUG) # if we dont have a unique user ID and token yet, make it so uuid = __settings__.getSetting(id = 'UUID') token = __settings__.getSetting(id = 'deviceAuthToken') xbmc.log('***** UUID from settings --> %s, auth token from settings --> %s' % (uuid, token), xbmc.LOGDEBUG) if None == uuid or '' == uuid: accountLoader = APAccountLoader.APAccountLoader(__properties) uuidDict = accountLoader.loadURL() uuid = uuidDict['id'] token = uuidDict['token'] if None != id and '' != id: __settings__.setSetting(id = 'UUID', value = uuid) if None != token and '' != token: __settings__.setSetting(id = 'deviceAuthToken', value = token) __properties['UUID'] = uuid __properties['deviceAuthToken'] = token xbmc.log('***** final UUID --> %s, final auth token --> %s' % (uuid, token), xbmc.LOGDEBUG) params = getParams(sys.argv[2]) categoryId = None