From 6de37ebbf253a84d904d85cad2760dc71b9be913 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:30 +0100 Subject: [PATCH] Get an reusa existing episode. --- .../pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java b/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java index f3aee94..5f09560 100644 --- a/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java +++ b/src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java @@ -89,15 +89,16 @@ public class NewEpisodeTrigger implements Trigger { allEpisodes.put(episode, episode); newEpisodes.add(episode); } + Episode existingEpisode = allEpisodes.get(episode); for (TorrentFile torrentFile : Lists.newArrayList(episode.torrentFiles())) { - int oldSize = allEpisodes.get(episode).torrentFiles().size(); - allEpisodes.get(episode).addTorrentFile(torrentFile); - int newSize = allEpisodes.get(episode).torrentFiles().size(); + int oldSize = existingEpisode.torrentFiles().size(); + existingEpisode.addTorrentFile(torrentFile); + int newSize = existingEpisode.torrentFiles().size(); if (oldSize != newSize) { newTorrentFiles.add(torrentFile); } - if (!newEpisodes.contains(episode) && (oldSize != newSize)) { - changedEpisodes.add(episode); + if (!newEpisodes.contains(existingEpisode) && (oldSize != newSize)) { + changedEpisodes.add(existingEpisode); } } } -- 2.7.4