use of org.nzbhydra.mapping.newznab.ActionAttribute in project nzbhydra2 by theotherp.
the class NewznabChecker method setSupportedSearchTypesAndIndexerCategoryMapping.
public IndexerCategoryConfig setSupportedSearchTypesAndIndexerCategoryMapping(IndexerConfig indexerConfig, int timeout) throws IndexerAccessException {
List<IdType> supportedSearchIds = indexerConfig.getSupportedSearchIds();
List<ActionAttribute> supportedSearchTypes = new ArrayList<>();
if (supportedSearchIds.contains(IdType.TVDB) || supportedSearchIds.contains(IdType.TVRAGE) || supportedSearchIds.contains(IdType.TVMAZE) || supportedSearchIds.contains(IdType.TRAKT)) {
supportedSearchTypes.add(ActionAttribute.TVSEARCH);
}
if (supportedSearchIds.contains(IdType.IMDB) || supportedSearchIds.contains(IdType.TMDB)) {
supportedSearchTypes.add(ActionAttribute.MOVIE);
}
URI uri = getBaseUri(indexerConfig).queryParam("t", "caps").build().toUri();
CapsRoot capsRoot = indexerWebAccess.get(uri, indexerConfig);
if (capsRoot.getSearching().getAudioSearch() != null) {
supportedSearchTypes.add(ActionAttribute.AUDIO);
}
if (capsRoot.getSearching().getBookSearch() != null) {
supportedSearchTypes.add(ActionAttribute.BOOK);
}
indexerConfig.setSupportedSearchTypes(supportedSearchTypes);
IndexerCategoryConfig categoryConfig = new IndexerCategoryConfig();
List<CapsCategory> categories = readAndConvertCategories(capsRoot, categoryConfig);
setCategorySpecificMappings(categoryConfig, categories);
return categoryConfig;
}
Aggregations