+ * Returns a function that creates an {@link Episode} that contains all {@link
+ * TorrentFile}s.
+ *
+ * @param episodeTorrents
+ * A multimap mapping episodes to torrent files.
+ * @return The function that performs the extraction of torrent files
+ */
+ private static Function<Episode, Episode> episodeFiller(final Multimap<Episode, TorrentFile> episodeTorrents) {
+ return new Function<Episode, Episode>() {
+ @Override
+ public Episode apply(Episode episode) {
+ Episode completeEpisode = new Episode(episode.season(), episode.episode());
+ for (TorrentFile torrentFile : episodeTorrents.get(episode)) {
+ completeEpisode.addTorrentFile(torrentFile);
+ }
+ return completeEpisode;
+ }
+ };
+ }
+
+ /**