X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Frhynodge%2Ftriggers%2FNewTorrentTrigger.java;h=9e3e91ee22e1c563f1989394c01b9cace522d9bb;hb=22e98b8896aa47b397ba89d887bfdbe212850517;hp=12c7f8cc7f181cf4aa2fd5c525d078b6f8c55155;hpb=9c01d55d3969a1b3df6529df0c64d4feb146fe4d;p=rhynodge.git diff --git a/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java b/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java index 12c7f8c..9e3e91e 100644 --- a/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java +++ b/src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java @@ -89,26 +89,26 @@ public class NewTorrentTrigger implements Trigger { @Override public Output output(Reaction reaction) { DefaultOutput output = new DefaultOutput(String.format("Found %d new Torrent(s) for “%s!”", newTorrentFiles.size(), reaction.name())); - output.addText("text/plain", getPlainTextList(newTorrentFiles)); - output.addText("text/html", getHtmlTextList(newTorrentFiles)); + output.addText("text/plain", getPlainTextList(reaction)); + output.addText("text/html", getHtmlTextList(reaction)); return output; } // - // STATIC METHODS + // PRIVATE METHODS // /** * Generates a plain text list of torrent files. * - * @param torrentFiles - * The torrent files to list + * @param reaction + * The reaction that was triggered * @return The generated plain text */ - private static String getPlainTextList(List torrentFiles) { + private String getPlainTextList(Reaction reaction) { StringBuilder plainText = new StringBuilder(); plainText.append("New Torrents:\n\n"); - for (TorrentFile torrentFile : torrentFiles) { + for (TorrentFile torrentFile : newTorrentFiles) { 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"); @@ -126,29 +126,45 @@ public class NewTorrentTrigger implements Trigger { /** * Generates an HTML list of the given torrent files. * - * @param torrentFiles - * The torrent files to list + * @param reaction + * The reaction that was triggered * @return The generated HTML */ - private static String getHtmlTextList(List torrentFiles) { - StringBuilder htmlText = new StringBuilder(); - htmlText.append("\n"); - htmlText.append("

New Torrents

\n"); - htmlText.append("