use of org.nzbhydra.searching.SearchResultEntity in project nzbhydra2 by theotherp.
the class FileHandler method getNfo.
public NfoResult getNfo(Long searchResultId) {
SearchResultEntity result = searchResultRepository.findOne(searchResultId);
if (result == null) {
logger.error("Download request with invalid/outdated search result ID " + searchResultId);
throw new RuntimeException("Download request with invalid/outdated search result ID " + searchResultId);
}
Indexer indexer = searchModuleProvider.getIndexerByName(result.getIndexer().getName());
return indexer.getNfo(result.getIndexerGuid());
}
use of org.nzbhydra.searching.SearchResultEntity in project nzbhydra2 by theotherp.
the class FileHandler method getFileByGuid.
public DownloadResult getFileByGuid(long guid, FileDownloadAccessType fileDownloadAccessType, SearchSource accessSource) throws InvalidSearchResultIdException {
SearchResultEntity result = searchResultRepository.findOne(guid);
if (result == null) {
logger.error("Download request with invalid/outdated GUID {}", guid);
throw new InvalidSearchResultIdException(guid, accessSource == SearchSource.INTERNAL);
}
String downloadType = result.getDownloadType() == DownloadType.NZB ? "NZB" : "Torrent";
logger.info("{} download request for \"{}\" from indexer {}", downloadType, result.getTitle(), result.getIndexer().getName());
if (fileDownloadAccessType == FileDownloadAccessType.REDIRECT) {
return handleRedirect(accessSource, result);
} else {
return handleContentDownload(accessSource, result, downloadType);
}
}
Aggregations