projects
/
rhynodge.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use multiple patterns instead of one large pattern.
[rhynodge.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
rhynodge
/
states
/
EpisodeState.java
diff --git
a/src/main/java/net/pterodactylus/rhynodge/states/EpisodeState.java
b/src/main/java/net/pterodactylus/rhynodge/states/EpisodeState.java
index
c604634
..
5d494e5
100644
(file)
--- a/
src/main/java/net/pterodactylus/rhynodge/states/EpisodeState.java
+++ b/
src/main/java/net/pterodactylus/rhynodge/states/EpisodeState.java
@@
-29,6
+29,7
@@
import net.pterodactylus.rhynodge.states.EpisodeState.Episode;
import net.pterodactylus.rhynodge.states.TorrentState.TorrentFile;
import com.fasterxml.jackson.annotation.JsonProperty;
import net.pterodactylus.rhynodge.states.TorrentState.TorrentFile;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Function;
/**
* {@link State} implementation that stores episodes of TV shows, parsed via
/**
* {@link State} implementation that stores episodes of TV shows, parsed via
@@
-100,6
+101,15
@@
public class EpisodeState extends AbstractState implements Iterable<Episode> {
*/
public static class Episode implements Comparable<Episode>, Iterable<TorrentFile> {
*/
public static class Episode implements Comparable<Episode>, Iterable<TorrentFile> {
+ /** Function to extract the season of an episode. */
+ public static final Function<Episode, Integer> BY_SEASON = new Function<Episode, Integer>() {
+
+ @Override
+ public Integer apply(Episode episode) {
+ return episode.season();
+ }
+ };
+
/** The season of the episode. */
@JsonProperty
private final int season;
/** The season of the episode. */
@JsonProperty
private final int season;
@@
-184,7
+194,9
@@
public class EpisodeState extends AbstractState implements Iterable<Episode> {
* The torrent file to add
*/
public void addTorrentFile(TorrentFile torrentFile) {
* The torrent file to add
*/
public void addTorrentFile(TorrentFile torrentFile) {
- torrentFiles.add(torrentFile);
+ if (!torrentFiles.contains(torrentFile)) {
+ torrentFiles.add(torrentFile);
+ }
}
//
}
//