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=65a215ed95b46082de6425ae76e1203e8d3c7c0a;hpb=18db828b7548bb8a030b64c80bf9e4b81f669b95;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 65a215e..64ff693 100644 --- a/src/main/java/net/pterodactylus/reactor/triggers/NewTorrentTrigger.java +++ b/src/main/java/net/pterodactylus/reactor/triggers/NewTorrentTrigger.java @@ -21,6 +21,7 @@ import static com.google.common.base.Preconditions.checkState; import java.util.List; +import net.pterodactylus.reactor.Reaction; import net.pterodactylus.reactor.State; import net.pterodactylus.reactor.Trigger; import net.pterodactylus.reactor.output.DefaultOutput; @@ -70,8 +71,8 @@ public class NewTorrentTrigger implements Trigger { * {@inheritDoc} */ @Override - public Output output() { - DefaultOutput output = new DefaultOutput(String.format("Found %d new Torrent(s)!", torrentFiles.size())); + public Output output(Reaction reaction) { + DefaultOutput output = new DefaultOutput(String.format("Found %d new Torrent(s) for “%s!”", torrentFiles.size(), reaction.name())); output.addText("text/plain", getPlainTextList(torrentFiles)); output.addText("text/html", getHtmlTextList(torrentFiles)); return output; @@ -93,9 +94,14 @@ public class NewTorrentTrigger implements Trigger { plainText.append("New Torrents:\n\n"); for (TorrentFile torrentFile : torrentFiles) { plainText.append(torrentFile.name()).append('\n'); - plainText.append('\t').append(torrentFile.size()).append('\n'); - plainText.append('\t').append(torrentFile.magnetUri()).append('\n'); - plainText.append('\t').append(torrentFile.downloadUri()).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"); + 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(); @@ -115,9 +121,14 @@ public class NewTorrentTrigger implements Trigger { htmlText.append("\n"); htmlText.append("\n");