X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Freactor%2Ftriggers%2FNewTorrentTrigger.java;h=64ff693967762356d24990b7d627da1bc33e5f2f;hb=a6e8911302a7482787136ef41d1fdb0448d81c1f;hp=ab640c6d2c8257b1764add67a3a0d16e8b997ce2;hpb=26e850e216e9b84865341b5aedaf617aa64ff821;p=rhynodge.git diff --git a/src/main/java/net/pterodactylus/reactor/triggers/NewTorrentTrigger.java b/src/main/java/net/pterodactylus/reactor/triggers/NewTorrentTrigger.java index ab640c6..64ff693 100644 --- a/src/main/java/net/pterodactylus/reactor/triggers/NewTorrentTrigger.java +++ b/src/main/java/net/pterodactylus/reactor/triggers/NewTorrentTrigger.java @@ -96,8 +96,12 @@ public class NewTorrentTrigger implements Trigger { plainText.append(torrentFile.name()).append('\n'); plainText.append('\t').append(torrentFile.size()).append(" in ").append(torrentFile.fileCount()).append(" file(s)\n"); plainText.append('\t').append(torrentFile.seedCount()).append(" seed(s), ").append(torrentFile.leechCount()).append(" leecher(s)\n"); - plainText.append('\t').append(torrentFile.magnetUri()).append('\n'); - plainText.append('\t').append(torrentFile.downloadUri()).append('\n'); + if ((torrentFile.magnetUri() != null) && (torrentFile.magnetUri().length() > 0)) { + plainText.append('\t').append(torrentFile.magnetUri()).append('\n'); + } + if ((torrentFile.downloadUri() != null) && (torrentFile.downloadUri().length() > 0)) { + plainText.append('\t').append(torrentFile.downloadUri()).append('\n'); + } plainText.append('\n'); } return plainText.toString(); @@ -119,8 +123,12 @@ public class NewTorrentTrigger implements Trigger { htmlText.append("
  • ").append(StringEscapeUtils.escapeHtml4(torrentFile.name())).append("
  • "); htmlText.append("
    Size: ").append(StringEscapeUtils.escapeHtml4(torrentFile.size())).append(" in ").append(torrentFile.fileCount()).append(" file(s)
    "); htmlText.append("
    ").append(torrentFile.seedCount()).append(" seed(s), ").append(torrentFile.leechCount()).append(" leecher(s)
    "); - htmlText.append(String.format("
    Magnet URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.magnetUri()))); - htmlText.append(String.format("
    Download URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.downloadUri()))); + if ((torrentFile.magnetUri() != null) && (torrentFile.magnetUri().length() > 0)) { + htmlText.append(String.format("
    Magnet URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.magnetUri()))); + } + if ((torrentFile.downloadUri() != null) && (torrentFile.downloadUri().length() > 0)) { + htmlText.append(String.format("
    Download URI
    ", StringEscapeUtils.escapeHtml4(torrentFile.downloadUri()))); + } } htmlText.append("\n"); htmlText.append("\n");