Exemple #1
0
 def _loadOnlineClassIndex(self, classCode):
     if not Settings.siteServerUrl():
         return False
     if self._ark is None:
         self._createArkSession()
     if self._ark is None:
         return False
     response = self._ark.getItems(classCode + '_cd')
     if response.error:
         self._plugin.logMessage(response.url)
         self._plugin.logMessage(response.message)
         self._plugin.logMessage(response.raw)
     else:
         lst = response.data[classCode]
         items = set()
         for record in lst:
             item = Item(record['ste_cd'], classCode, record[classCode + '_no'])
             if item.isValid():
                 items.add(item)
         self.items[classCode] = sorted(items)
         self._plugin.logMessage('ARK Items ' + classCode + ' = ' + str(len(self.items[classCode])))
         if (len(self.items[classCode]) > 0):
             self._indexLoaded = True
             return True
     return False
Exemple #2
0
 def getFilterItems(self, filterId):
     items = []
     if self._ark is None:
         return items
     response = self._ark.getFilterSet(filterId)
     if response.error:
         utils.logMessage(response.url)
         utils.logMessage(response.message)
         utils.logMessage(response.raw)
     else:
         for item in response.data:
             res = response.data[item]
             item = Item()
             item.fromArkKey(res['itemkey'], res['itemval'])
             utils.logMessage(item.debug())
             if item.isValid():
                 items.append(item)
     return sorted(items)