Search in sources :

Example 1 with ActionAttribute

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;
}
Also used : CapsRoot(org.nzbhydra.mapping.newznab.caps.CapsRoot) IndexerCategoryConfig(org.nzbhydra.config.IndexerCategoryConfig) URI(java.net.URI) CapsCategory(org.nzbhydra.mapping.newznab.caps.CapsCategory) ActionAttribute(org.nzbhydra.mapping.newznab.ActionAttribute) IdType(org.nzbhydra.mediainfo.InfoProvider.IdType)

Aggregations

URI (java.net.URI)1 IndexerCategoryConfig (org.nzbhydra.config.IndexerCategoryConfig)1 ActionAttribute (org.nzbhydra.mapping.newznab.ActionAttribute)1 CapsCategory (org.nzbhydra.mapping.newznab.caps.CapsCategory)1 CapsRoot (org.nzbhydra.mapping.newznab.caps.CapsRoot)1 IdType (org.nzbhydra.mediainfo.InfoProvider.IdType)1