From: David ‘Bombe’ Roden Date: Tue, 19 Feb 2013 19:19:30 +0000 (+0100) Subject: Get an reusa existing episode. X-Git-Tag: 0.1~13 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6de37ebbf253a84d904d85cad2760dc71b9be913;p=rhynodge.git Get an reusa existing episode. --- 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); } } }