From 4d8b603aea34464189cfeca62cb80f69ef9012fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 19 Feb 2013 20:19:10 +0100 Subject: [PATCH] Store new torrents. --- .../java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java b/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java index 745a1f8..f3aee94 100644 --- a/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java +++ b/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java @@ -59,6 +59,8 @@ public class NewEpisodeTrigger implements Trigger { /** All changed episodes. */ private final Collection changedEpisodes = Sets.newHashSet(); + /** All new torrent files. */ + private final Collection newTorrentFiles = Sets.newHashSet(); // // TRIGGER METHODS @@ -74,6 +76,7 @@ public class NewEpisodeTrigger implements Trigger { newEpisodes.clear(); changedEpisodes.clear(); this.allEpisodes.clear(); + newTorrentFiles.clear(); Map allEpisodes = Maps.newHashMap(FluentIterable.from(((EpisodeState) previousState).episodes()).toMap(new Function() { @Override @@ -90,6 +93,9 @@ public class NewEpisodeTrigger implements Trigger { int oldSize = allEpisodes.get(episode).torrentFiles().size(); allEpisodes.get(episode).addTorrentFile(torrentFile); int newSize = allEpisodes.get(episode).torrentFiles().size(); + if (oldSize != newSize) { + newTorrentFiles.add(torrentFile); + } if (!newEpisodes.contains(episode) && (oldSize != newSize)) { changedEpisodes.add(episode); } -- 2.7.4