use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class ExternalApiSearchingIntegrationTest method shouldConvertProvidedIdentifier.
@Test
public void shouldConvertProvidedIdentifier() throws Exception {
prepareIndexerWithOneResponse();
searchModuleProvider.getIndexers().get(0).getConfig().setSupportedSearchIds(Arrays.asList(IdType.IMDB));
when(infoProvider.convert(anyMap())).thenReturn(new MediaInfo(new MovieInfo("tt1234", null, null, 0, null)));
when(infoProvider.canConvertAny(anySet(), anySet())).thenReturn(true);
NewznabXmlRoot root = (NewznabXmlRoot) externalApi.api(NewznabParameters.builder().tmdbid("abcd").t(ActionAttribute.MOVIE).apikey("apikey").build()).getBody();
RecordedRequest request = webServer.takeRequest(2, TimeUnit.SECONDS);
assertThat(request.getRequestUrl().queryParameter("imdbid")).isEqualTo("1234");
assertThat(root.getRssChannel().getNewznabResponse().getTotal()).isEqualTo(1);
assertThat(root.getRssChannel().getItems().size()).isEqualTo(1);
}
use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class RssBuilder method build.
public NewznabXmlRoot build() {
NewznabXmlRoot rssRoot = new NewznabXmlRoot();
rssChannel.getItems().addAll(items);
rssRoot.setRssChannel(rssChannel);
return rssRoot;
}
use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class NzbIndexTest method shouldParseRows.
@Test
public void shouldParseRows() throws Exception {
Instant now = Instant.now();
String enclosureUrl = "http://nzbindex.com/download/164950363/Watchers.of.the.Universe.S02E09.1080p.WEB-DL.DD5.1.AAC2.0.H.264-YFN-0030-Watchers.of.the.Universe.S02E09.Cant.Get.You.out.of.My.Head.1080p.WEB-DL.nzb";
String link = "http://nzbindex.com/release/164950363/Watchers.of.the.Universe.S02E09.1080p.WEB-DL.DD5.1.AAC2.0.H.264-YFN-0030-Watchers.of.the.Universe.S02E09.Cant.Get.You.out.of.My.Head.1080p.WEB-DL.nzb";
NewznabXmlRoot root = RssBuilder.builder().items(Arrays.asList(RssItemBuilder.builder("[ Watchers.of.the.Universe.S02E09.1080p.WEB-DL.DD5.1.AAC2.0.H.264-YFN ] - [00/30] - \"Watchers.of.the.Universe.S02E09.Cant.Get.You.out.of.My.Head.1080p.WEB-DL.DD5.1.AAC2.0.H.264-YFN.nzb\" yEnc\n").link(link).description("<![CDATA[\n" + "<p><font color=\"gray\">alt.binaries.hdtv.x264</font><br /> <b>1.01 GB</b><br /> 7 hours<br /> <font color=\"#3DA233\">31 files (1405 parts)</font> <font color=\"gray\">by s@nd.p (SP)</font><br /> <font color=\"#E2A910\"> 1 NFO | 9 PAR2 | 1 NZB | 19 ARCHIVE</font> - <a href=\"http://nzbindex.com/nfo/164950363/Watchers.of.the.Universe.S02E09.1080p.WEB-DL.DD5.1.AAC2.0.H.264-YFN-0030-Watchers.of.the.Universe.S02E09.Cant.Get.You.out.of.My.Head.1080p.WEB-DL.nzb/?q=\" target=\"_blank\">View NFO</a></p>\n" + "]]>").category("alt.binaries.hdtv.x264").pubDate(now).rssGuid(new NewznabXmlGuid(link, true)).enclosure(new NewznabXmlEnclosure(enclosureUrl, 1089197181L, "application/x-nzb")).build())).build();
List<SearchResultItem> items = testee.getSearchResultItems(root);
assertThat(items.size(), is(1));
SearchResultItem item = items.get(0);
assertThat(item.getTitle(), is("Watchers.of.the.Universe.S02E09.1080p.WEB-DL.DD5.1.AAC2.0.H.264-YFN-0030-Watchers.of.the.Universe.S02E09.Cant.Get.You.out.of.My.Head.1080p.WEB-DL"));
assertThat(item.getGroup().get(), is("alt.binaries.hdtv.x264"));
assertThat(item.getPubDate(), is(now));
assertThat(item.isAgePrecise(), is(true));
assertThat(item.getSize(), is(1089197181L));
assertThat(item.getIndexerGuid(), is("164950363"));
assertThat(item.getDownloadType(), is(DownloadType.NZB));
assertThat(item.getHasNfo(), is(HasNfo.YES));
}
use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class RssMappingTest method shouldParseResponseFromNzbAG.
@Test
public void shouldParseResponseFromNzbAG() throws Exception {
NewznabXmlRoot rssRoot = getRssRootFromXml("nzbAgResponse.xml");
assertEquals(Integer.valueOf(125000), rssRoot.getRssChannel().getNewznabResponse().getTotal());
assertNotNull(rssRoot.getRssChannel().getItems().get(0).getPubDate());
}
use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class RssMappingTest method shouldParseResponseFromNzbCat.
@Test
public void shouldParseResponseFromNzbCat() throws Exception {
NewznabXmlRoot rssRoot = getRssRootFromXml("nzbCatResponse.xml");
assertEquals(Integer.valueOf(125000), rssRoot.getRssChannel().getNewznabResponse().getTotal());
assertNotNull(rssRoot.getRssChannel().getItems().get(0).getPubDate());
}
Aggregations