def get_documents(self, db):
     """ return the database docids for the given category """
     enq = AppEnquire(db._aptcache, db)
     app_filter = AppFilter(db, db._aptcache)
     if "available-only" in self.flags:
         app_filter.set_available_only(True)
     if "not-installed-only" in self.flags:
         app_filter.set_not_installed_only(True)
     enq.set_query(self.query,
                   limit=self.item_limit,
                   filter=app_filter,
                   sortmode=self.sortmode,
                   nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                   nonblocking_load=False)
     return enq.get_documents()
Exemple #2
0
 def get_documents(self, db):
     """ return the database docids for the given category """
     enq = AppEnquire(db._aptcache, db)
     app_filter = AppFilter(db, db._aptcache)
     if "available-only" in self.flags:
         app_filter.set_available_only(True)
     if "not-installed-only" in self.flags:
         app_filter.set_not_installed_only(True)
     enq.set_query(self.query,
                   limit=self.item_limit,
                   filter=app_filter,
                   sortmode=self.sortmode,
                   nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                   nonblocking_load=False)
     return enq.get_documents()
 def _ceibal_get_docs(self):
     """ return the database docids for the given category """
     enq = AppEnquire(self.db._aptcache, self.db)
     app_filter = AppFilter(self.db, self.db._aptcache)
     
     app_filter.set_available_only(True)
     #app_filter.set_not_installed_only(True)
     p = "http://apt.ceibal.edu.uy/recommendations/list.json"
     data = json.load(urllib2.urlopen(p))
     query = get_query_for_pkgnames(data['packages']) 
     enq.set_query(query,
                   limit=20,
                   filter=app_filter,
                   sortmode=0,
                   nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                   nonblocking_load=False)
     return enq.get_documents()
Exemple #4
0
    def _get_new_category_content(self):
        whatsnew_cat = get_category_by_name(
            self.categories, u"What\u2019s New")  # unstranslated name
        if whatsnew_cat is None:
            LOG.warn("No 'new' category found!!")
            return None, []

        enq = AppEnquire(self.cache, self.db)
        app_filter = AppFilter(self.db, self.cache)
        app_filter.set_available_only(True)
        app_filter.set_not_installed_only(True)
        enq.set_query(whatsnew_cat.query,
                      limit=8,
                      filter=app_filter,
                      sortmode=SortMethods.BY_CATALOGED_TIME,
                      nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                      nonblocking_load=False)

        if not hasattr(self, "helper"):
            self.helper = AppPropertiesHelper(self.db, self.cache, self.icons)

        return whatsnew_cat, enq.get_documents()
    def _get_new_category_content(self):
        whatsnew_cat = get_category_by_name(self.categories, 
                                            u"What\u2019s New") # unstranslated name
        if whatsnew_cat is None:
            LOG.warn("No 'new' category found!!")
            return None, []

        enq = AppEnquire(self.cache, self.db)
        app_filter = AppFilter(self.db, self.cache)
        app_filter.set_available_only(True)
        app_filter.set_not_installed_only(True)
        enq.set_query(whatsnew_cat.query,
                      limit=8,
                      filter=app_filter,
                      sortmode=SortMethods.BY_CATALOGED_TIME,
                      nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                      nonblocking_load=False)

        if not hasattr(self, "helper"):
            self.helper = AppPropertiesHelper(self.db,
                                              self.cache,
                                              self.icons)

        return whatsnew_cat, enq.get_documents()