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;
}
Aggregations