use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class RssMappingTest method shouldParseResponseFromCardigann.
@Test
public void shouldParseResponseFromCardigann() throws Exception {
NewznabXmlRoot rssRoot = getRssRootFromXml("btnJackettResponse.xml");
NewznabXmlChannel channel = rssRoot.getRssChannel();
assertThat(channel.getDescription(), is("Needs no description.."));
NewznabXmlResponse newznabResponse = channel.getNewznabResponse();
assertThat(newznabResponse, is(nullValue()));
List<NewznabXmlItem> items = channel.getItems();
assertThat(items.size(), is(3));
NewznabXmlItem item = items.get(0);
assertThat(item.getTitle(), is("The.Challenge.S30.Special.14.Times.Our.Challengers.Found.Their.Shit.1080p.WEB.x264-CookieMonster"));
assertThat(item.getRssGuid().getGuid(), is("https://unicasthe.net/torrents.php?action=download&id=799031&authkey=authkey&torrent_pass=torrentPass"));
assertThat(item.getLink(), startsWith("http://127.0.0.1:9117/dl/unicasthenet/jackettApiKey?path=linkstuff&file=The.Challenge.S30.Special.14.Times.Our.Challengers.Found.Their.Shit.1080p.WEB.x264-CookieMonster.torrent"));
assertThat(item.getCategory(), is("5000"));
assertThat(item.getEnclosure().getLength(), is(1459519537L));
assertThat(item.getTorznabAttributes().size(), is(6));
assertThat(item.getTorznabAttributes().get(0).getName(), is("rageid"));
assertThat(item.getTorznabAttributes().get(0).getValue(), is("6126"));
}
use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class RssMappingTest method shouldParseResponseFromOmgwtf.
@Test
public void shouldParseResponseFromOmgwtf() throws Exception {
NewznabXmlRoot rssRoot = getRssRootFromXml("omgwtfResponse.xml");
assertEquals(Integer.valueOf(416), 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 shouldParseResponseFromDrunkenSlug.
@Test
public void shouldParseResponseFromDrunkenSlug() throws Exception {
NewznabXmlRoot rssRoot = getRssRootFromXml("drunkenSlugResponse.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 shouldSerializeToJson.
@Test
public void shouldSerializeToJson() throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
NewznabXmlRoot rssRoot = getRssRootFromXml("newznab_3results.xml");
String json = objectMapper.writeValueAsString(rssRoot);
System.out.println(json);
}
use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.
the class TorznabMappingTest method testMappingFromXml.
@Test
public void testMappingFromXml() throws Exception {
NewznabXmlRoot rssRoot = getRssRootFromXml("cardigann.xml");
NewznabXmlChannel channel = rssRoot.getRssChannel();
assertThat(channel.getTitle(), is("some-torrents"));
assertThat(channel.getLink(), is("https://some-torrents.com/"));
assertThat(channel.getLanguage(), is("en-us"));
List<NewznabXmlItem> items = channel.getItems();
assertThat(items.size(), is(2));
NewznabXmlItem item = items.get(0);
assertThat(item.getLink(), is("http://127.0.0.1:5060/download/111.torrent"));
assertThat(item.getPubDate(), is(Instant.ofEpochSecond(1493900064)));
assertThat(item.getComments(), is("https://some-torrents.com/details.php?id=111&page=0#startcomments"));
NewznabXmlGuid rssGuid = item.getRssGuid();
assertThat(rssGuid.getGuid(), is("https://some-torrents.com/details.php?id=111"));
NewznabXmlEnclosure enclosure = item.getEnclosure();
assertThat(enclosure.getUrl(), is("http://127.0.0.1:5060/download/111.torrent"));
List<NewznabAttribute> attributes = item.getTorznabAttributes();
assertThat(attributes.size(), is(8));
assertThat(attributes.get(1).getName(), is("seeders"));
assertThat(attributes.get(1).getValue(), is("11"));
assertThat(attributes.get(5).getName(), is("size"));
assertThat(attributes.get(5).getValue(), is("620000000"));
}
Aggregations