* easy to get episode key
This commit is contained in:
parent
29253af34d
commit
54854d3098
|
@ -1,48 +1,42 @@
|
||||||
|
|
||||||
package net.sourceforge.filebot.web;
|
package net.sourceforge.filebot.web;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Episode implements Serializable {
|
public class Episode implements Serializable {
|
||||||
|
|
||||||
private String seriesName;
|
private String seriesName;
|
||||||
private Date seriesStartDate;
|
private Date seriesStartDate;
|
||||||
|
|
||||||
private Integer season;
|
private Integer season;
|
||||||
private Integer episode;
|
private Integer episode;
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
// absolute episode number
|
// absolute episode number
|
||||||
private Integer absolute;
|
private Integer absolute;
|
||||||
|
|
||||||
// special number
|
// special number
|
||||||
private Integer special;
|
private Integer special;
|
||||||
|
|
||||||
// episode airdate
|
// episode airdate
|
||||||
private Date airdate;
|
private Date airdate;
|
||||||
|
|
||||||
// original series descriptor
|
// original series descriptor
|
||||||
private SearchResult series;
|
private SearchResult series;
|
||||||
|
|
||||||
|
|
||||||
protected Episode() {
|
protected Episode() {
|
||||||
// used by serializer
|
// used by serializer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Episode(Episode obj) {
|
public Episode(Episode obj) {
|
||||||
this(obj.seriesName, obj.seriesStartDate, obj.season, obj.episode, obj.title, obj.absolute, obj.special, obj.airdate, obj.series);
|
this(obj.seriesName, obj.seriesStartDate, obj.season, obj.episode, obj.title, obj.absolute, obj.special, obj.airdate, obj.series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, SearchResult series) {
|
public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, SearchResult series) {
|
||||||
this(seriesName, seriesStartDate, season, episode, title, null, null, null, series);
|
this(seriesName, seriesStartDate, season, episode, title, null, null, null, series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, Integer absolute, Integer special, Date airdate, SearchResult series) {
|
public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, Integer absolute, Integer special, Date airdate, SearchResult series) {
|
||||||
this.seriesName = seriesName;
|
this.seriesName = seriesName;
|
||||||
this.seriesStartDate = seriesStartDate;
|
this.seriesStartDate = seriesStartDate;
|
||||||
|
@ -54,87 +48,77 @@ public class Episode implements Serializable {
|
||||||
this.airdate = airdate;
|
this.airdate = airdate;
|
||||||
this.series = series;
|
this.series = series;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getSeriesName() {
|
public String getSeriesName() {
|
||||||
return seriesName;
|
return seriesName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getSeriesStartDate() {
|
public Date getSeriesStartDate() {
|
||||||
return seriesStartDate;
|
return seriesStartDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Integer getEpisode() {
|
public Integer getEpisode() {
|
||||||
return episode;
|
return episode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Integer getSeason() {
|
public Integer getSeason() {
|
||||||
return season;
|
return season;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Integer getAbsolute() {
|
public Integer getAbsolute() {
|
||||||
return absolute;
|
return absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Integer getSpecial() {
|
public Integer getSpecial() {
|
||||||
return special;
|
return special;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getAirdate() {
|
public Date getAirdate() {
|
||||||
return airdate;
|
return airdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SearchResult getSeries() {
|
public SearchResult getSeries() {
|
||||||
return series;
|
return series;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> getNumbers() {
|
||||||
|
return Arrays.asList(season, episode, special);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof Episode) {
|
if (obj instanceof Episode) {
|
||||||
Episode other = (Episode) obj;
|
Episode other = (Episode) obj;
|
||||||
return equals(season, other.season) && equals(episode, other.episode) && equals(seriesName, other.seriesName) && equals(title, other.title) && equals(special, other.special);
|
return equals(season, other.season) && equals(episode, other.episode) && equals(seriesName, other.seriesName) && equals(title, other.title) && equals(special, other.special);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean equals(Object o1, Object o2) {
|
private boolean equals(Object o1, Object o2) {
|
||||||
if (o1 == null || o2 == null)
|
if (o1 == null || o2 == null)
|
||||||
return o1 == o2;
|
return o1 == o2;
|
||||||
|
|
||||||
return o1.equals(o2);
|
return o1.equals(o2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Arrays.hashCode(new Object[] { seriesName, season, episode, title, special });
|
return Arrays.hashCode(new Object[] { seriesName, season, episode, title, special });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Episode clone() {
|
public Episode clone() {
|
||||||
return new Episode(this);
|
return new Episode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return EpisodeFormat.SeasonEpisode.format(this);
|
return EpisodeFormat.SeasonEpisode.format(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue