Codota Logo
NewznabXmlItem.getTorznabAttributes
Code IndexAdd Codota to your IDE (free)

How to use
getTorznabAttributes
method
in
org.nzbhydra.mapping.newznab.xml.NewznabXmlItem

Best Java code snippets using org.nzbhydra.mapping.newznab.xml.NewznabXmlItem.getTorznabAttributes (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: theotherp/nzbhydra2

protected List<Integer> tryAndGetCategoryAsNumber(NewznabXmlItem item) {
  Set<Integer> foundCategories = new HashSet<>();
  if (item.getCategory() != null) {
    try {
      foundCategories.add(Integer.parseInt(item.getCategory()));
    } catch (NumberFormatException e) {
      //NOP
    }
  }
  foundCategories.addAll(item.getNewznabAttributes().stream().filter(x -> x.getName().equals("category")).map(x -> Integer.valueOf(x.getValue())).collect(Collectors.toList()));
  foundCategories.addAll(item.getTorznabAttributes().stream().filter(x -> x.getName().equals("category")).map(x -> Integer.valueOf(x.getValue())).collect(Collectors.toList()));
  return new ArrayList<>(foundCategories);
}
origin: theotherp/nzbhydra2

protected boolean isTorznabResult(NewznabXmlRoot rssRoot) {
  return rssRoot.getRssChannel().getItems().stream().anyMatch(x -> x.getEnclosures().stream().anyMatch(enclosure -> "application/x-bittorrent".equals(enclosure.getType())) || !x.getTorznabAttributes().isEmpty());
}
origin: theotherp/nzbhydra2

@RequestMapping(value = "/torznab/api", produces = MediaType.TEXT_XML_VALUE)
public ResponseEntity<? extends Object> torznabapi(NewznabParameters params) throws Exception {
  if (params.getT() == ActionAttribute.CAPS) {
    return new ResponseEntity<Object>(NewznabMockBuilder.getCaps(), HttpStatus.OK);
  }
  NewznabXmlRoot rssRoot = NewznabMockBuilder.generateResponse(0, 10, params.getApikey(), false, Collections.emptyList());
  Random random = new Random();
  for (NewznabXmlItem item : rssRoot.getRssChannel().getItems()) {
    item.setNewznabAttributes(new ArrayList<>());
    item.getTorznabAttributes().add(new NewznabAttribute("seeders", String.valueOf(random.nextInt(30000))));
    item.getTorznabAttributes().add(new NewznabAttribute("peers", String.valueOf(random.nextInt(30000))));
    if (random.nextInt(5) > 3) {
      item.getTorznabAttributes().add(new NewznabAttribute("grabs", String.valueOf(random.nextInt(30000))));
    }
    item.setCategory("5000");
    item.setGrabs(null);
  }
  return new ResponseEntity<Object>(rssRoot, HttpStatus.OK);
}
origin: theotherp/nzbhydra2

searchResultItem.setGrabs(item.getGrabs());
searchResultItem.setIndexerGuid(item.getRssGuid().getGuid());
for (NewznabAttribute attribute : item.getTorznabAttributes()) {
  searchResultItem.getAttributes().put(attribute.getName(), attribute.getValue());
  switch (attribute.getName()) {
if (item.getSize() != null && item.getTorznabAttributes().stream().noneMatch(x -> x.getName().equals("size"))) {
  searchResultItem.getAttributes().put("size", String.valueOf(item.getSize()));
origin: theotherp/nzbhydra2

rssRoot.getRssChannel().getItems().get(0).getEnclosure().setLength(100000L);
rssRoot.getRssChannel().getItems().get(0).getNewznabAttributes().clear();
rssRoot.getRssChannel().getItems().get(0).getTorznabAttributes().clear();
rssRoot.getRssChannel().getItems().get(0).getNewznabAttributes().add(new NewznabAttribute("grabs", "100"));
rssRoot3.getRssChannel().getItems().get(0).getEnclosure().setLength(200000L);
rssRoot3.getRssChannel().getItems().get(0).getNewznabAttributes().clear();
rssRoot3.getRssChannel().getItems().get(0).getTorznabAttributes().clear();
rssRoot3.getRssChannel().getItems().get(0).getNewznabAttributes().add(new NewznabAttribute("grabs", "2000"));
rssRoot3.getRssChannel().getItems().get(0).setLink("anotherlink"); //Otherwise it will result in a unique key exception
org.nzbhydra.mapping.newznab.xmlNewznabXmlItemgetTorznabAttributes

Popular methods of NewznabXmlItem

  • <init>
  • setCategory
  • setDescription
  • setLink
  • setNewznabAttributes
  • setRssGuid
  • setTitle
  • getLink
  • getNewznabAttributes
  • getRssGuid
  • getTitle
  • setComments
  • getTitle,
  • setComments,
  • setEnclosure,
  • setGrabs,
  • setPubDate,
  • setTorznabAttributes,
  • getCategory,
  • getComments,
  • getDescription

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now