Search in sources :

Example 1 with MainCategory

use of org.nzbhydra.config.IndexerCategoryConfig.MainCategory in project nzbhydra2 by theotherp.

the class NewznabChecker method readAndConvertCategories.

private List<CapsCategory> readAndConvertCategories(CapsRoot capsRoot, IndexerCategoryConfig categoryConfig) {
    List<CapsCategory> categories = new ArrayList<>(capsRoot.getCategories().getCategories());
    List<MainCategory> configMainCategories = new ArrayList<>();
    for (CapsCategory category : capsRoot.getCategories().getCategories()) {
        List<SubCategory> configSubcats = new ArrayList<>();
        if (category.getSubCategories() != null) {
            categories.addAll(category.getSubCategories());
            configSubcats = category.getSubCategories().stream().map(x -> new SubCategory(x.getId(), x.getName())).collect(Collectors.toList());
        }
        configMainCategories.add(new MainCategory(category.getId(), category.getName(), configSubcats));
    }
    categoryConfig.setCategories(configMainCategories);
    return categories;
}
Also used : SubCategory(org.nzbhydra.config.IndexerCategoryConfig.SubCategory) CapsCategory(org.nzbhydra.mapping.newznab.caps.CapsCategory) MainCategory(org.nzbhydra.config.IndexerCategoryConfig.MainCategory)

Aggregations

MainCategory (org.nzbhydra.config.IndexerCategoryConfig.MainCategory)1 SubCategory (org.nzbhydra.config.IndexerCategoryConfig.SubCategory)1 CapsCategory (org.nzbhydra.mapping.newznab.caps.CapsCategory)1