From: David ‘Bombe’ Roden Date: Tue, 19 Feb 2013 19:19:10 +0000 (+0100) Subject: Store new torrents. X-Git-Tag: 0.1~14 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4d8b603aea34464189cfeca62cb80f69ef9012fb;p=rhynodge.git Store new torrents. --- 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); }