1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* rename Date class to SimpleDate to avoid confusion with java.util.Date

This commit is contained in:
Reinhard Pointner 2014-04-19 05:39:52 +00:00
parent f7a7866e23
commit ba1ae98d1c
19 changed files with 63 additions and 63 deletions

View File

@ -41,7 +41,7 @@ import net.sourceforge.filebot.util.FileUtilities;
import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter; import net.sourceforge.filebot.util.FileUtilities.ExtensionFileFilter;
import net.sourceforge.filebot.web.AnidbSearchResult; import net.sourceforge.filebot.web.AnidbSearchResult;
import net.sourceforge.filebot.web.AudioTrack; import net.sourceforge.filebot.web.AudioTrack;
import net.sourceforge.filebot.web.Date; import net.sourceforge.filebot.web.SimpleDate;
import net.sourceforge.filebot.web.Episode; import net.sourceforge.filebot.web.Episode;
import net.sourceforge.filebot.web.EpisodeListProvider; import net.sourceforge.filebot.web.EpisodeListProvider;
import net.sourceforge.filebot.web.Movie; import net.sourceforge.filebot.web.Movie;
@ -93,7 +93,7 @@ public class MediaBindingBean {
if (infoObject instanceof Movie) if (infoObject instanceof Movie)
return getMovie().getYear(); return getMovie().getYear();
if (infoObject instanceof AudioTrack) if (infoObject instanceof AudioTrack)
return getReleaseDate() != null ? ((Date) getReleaseDate()).getYear() : new Scanner(getMediaInfo(StreamKind.General, 0, "Recorded_Date")).useDelimiter("\\D+").nextInt(); return getReleaseDate() != null ? ((SimpleDate) getReleaseDate()).getYear() : new Scanner(getMediaInfo(StreamKind.General, 0, "Recorded_Date")).useDelimiter("\\D+").nextInt();
return null; return null;
} }
@ -163,12 +163,12 @@ public class MediaBindingBean {
} }
@Define("airdate") @Define("airdate")
public Date airdate() { public SimpleDate airdate() {
return getEpisode().getAirdate(); return getEpisode().getAirdate();
} }
@Define("startdate") @Define("startdate")
public Date startdate() { public SimpleDate startdate() {
return getEpisode().getSeriesStartDate(); return getEpisode().getSeriesStartDate();
} }

View File

@ -58,7 +58,7 @@ import net.sourceforge.filebot.similarity.SimilarityComparator;
import net.sourceforge.filebot.similarity.SimilarityMetric; import net.sourceforge.filebot.similarity.SimilarityMetric;
import net.sourceforge.filebot.similarity.StringEqualsMetric; import net.sourceforge.filebot.similarity.StringEqualsMetric;
import net.sourceforge.filebot.vfs.FileInfo; import net.sourceforge.filebot.vfs.FileInfo;
import net.sourceforge.filebot.web.Date; import net.sourceforge.filebot.web.SimpleDate;
import net.sourceforge.filebot.web.Episode; import net.sourceforge.filebot.web.Episode;
import net.sourceforge.filebot.web.Movie; import net.sourceforge.filebot.web.Movie;
import net.sourceforge.filebot.web.MovieIdentificationService; import net.sourceforge.filebot.web.MovieIdentificationService;
@ -135,7 +135,7 @@ public class MediaDetection {
return getSeasonEpisodeMatcher(strict).match(file); return getSeasonEpisodeMatcher(strict).match(file);
} }
public static Date parseDate(Object object) { public static SimpleDate parseDate(Object object) {
return new DateMetric().parse(object); return new DateMetric().parse(object);
} }
@ -1384,7 +1384,7 @@ public class MediaDetection {
} else if (model instanceof Movie) { } else if (model instanceof Movie) {
Movie movie = (Movie) model; Movie movie = (Movie) model;
if (movie.getYear() > 0 && movie.getTmdbId() > 0) { if (movie.getYear() > 0 && movie.getTmdbId() > 0) {
Date releaseDate = WebServices.TheMovieDB.getMovieInfo(movie, Locale.ENGLISH, false).getReleased(); SimpleDate releaseDate = WebServices.TheMovieDB.getMovieInfo(movie, Locale.ENGLISH, false).getReleased();
xattr.setCreationDate(releaseDate.getTimeStamp()); xattr.setCreationDate(releaseDate.getTimeStamp());
} }
} }

View File

@ -6,7 +6,7 @@ import java.util.regex.MatchResult;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.sourceforge.filebot.web.Date; import net.sourceforge.filebot.web.SimpleDate;
public class DateMatcher { public class DateMatcher {
@ -30,9 +30,9 @@ public class DateMatcher {
} }
public Date match(CharSequence seq) { public SimpleDate match(CharSequence seq) {
for (DatePattern pattern : patterns) { for (DatePattern pattern : patterns) {
Date match = pattern.match(seq); SimpleDate match = pattern.match(seq);
if (match != null) { if (match != null) {
return match; return match;
@ -68,12 +68,12 @@ public class DateMatcher {
} }
protected Date process(MatchResult match) { protected SimpleDate process(MatchResult match) {
return new Date(Integer.parseInt(match.group(order[0])), Integer.parseInt(match.group(order[1])), Integer.parseInt(match.group(order[2]))); return new SimpleDate(Integer.parseInt(match.group(order[0])), Integer.parseInt(match.group(order[1])), Integer.parseInt(match.group(order[2])));
} }
public Date match(CharSequence seq) { public SimpleDate match(CharSequence seq) {
Matcher matcher = pattern.matcher(seq); Matcher matcher = pattern.matcher(seq);
if (matcher.find()) { if (matcher.find()) {

View File

@ -4,7 +4,7 @@ package net.sourceforge.filebot.similarity;
import java.io.File; import java.io.File;
import net.sourceforge.filebot.web.Date; import net.sourceforge.filebot.web.SimpleDate;
public class DateMetric implements SimilarityMetric { public class DateMetric implements SimilarityMetric {
@ -24,11 +24,11 @@ public class DateMetric implements SimilarityMetric {
@Override @Override
public float getSimilarity(Object o1, Object o2) { public float getSimilarity(Object o1, Object o2) {
Date d1 = parse(o1); SimpleDate d1 = parse(o1);
if (d1 == null) if (d1 == null)
return 0; return 0;
Date d2 = parse(o2); SimpleDate d2 = parse(o2);
if (d2 == null) if (d2 == null)
return 0; return 0;
@ -36,7 +36,7 @@ public class DateMetric implements SimilarityMetric {
} }
public Date parse(Object object) { public SimpleDate parse(Object object) {
if (object instanceof File) { if (object instanceof File) {
// parse file name // parse file name
object = ((File) object).getName(); object = ((File) object).getName();

View File

@ -32,7 +32,7 @@ import net.sourceforge.filebot.media.ReleaseInfo;
import net.sourceforge.filebot.media.SmartSeasonEpisodeMatcher; import net.sourceforge.filebot.media.SmartSeasonEpisodeMatcher;
import net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE; import net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE;
import net.sourceforge.filebot.vfs.FileInfo; import net.sourceforge.filebot.vfs.FileInfo;
import net.sourceforge.filebot.web.Date; import net.sourceforge.filebot.web.SimpleDate;
import net.sourceforge.filebot.web.Episode; import net.sourceforge.filebot.web.Episode;
import net.sourceforge.filebot.web.EpisodeFormat; import net.sourceforge.filebot.web.EpisodeFormat;
import net.sourceforge.filebot.web.Movie; import net.sourceforge.filebot.web.Movie;
@ -90,10 +90,10 @@ public enum EpisodeMetrics implements SimilarityMetric {
// Match episode airdate // Match episode airdate
AirDate(new DateMetric() { AirDate(new DateMetric() {
private final Map<Object, Date> transformCache = synchronizedMap(new HashMap<Object, Date>(64, 4)); private final Map<Object, SimpleDate> transformCache = synchronizedMap(new HashMap<Object, SimpleDate>(64, 4));
@Override @Override
public Date parse(Object object) { public SimpleDate parse(Object object) {
if (object instanceof Movie) { if (object instanceof Movie) {
return null; return null;
} }
@ -105,7 +105,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
return episode.getAirdate(); return episode.getAirdate();
} }
Date result = transformCache.get(object); SimpleDate result = transformCache.get(object);
if (result != null) { if (result != null) {
return result; return result;
} }

View File

@ -106,7 +106,7 @@ public class AcoustIDClient implements MusicIdentificationService {
Map<?, ?> release = (Map<?, ?>) it; Map<?, ?> release = (Map<?, ?>) it;
Map<?, ?> date = (Map<?, ?>) release.get("date"); Map<?, ?> date = (Map<?, ?>) release.get("date");
try { try {
thisRelease.albumReleaseDate = new Date(Integer.parseInt(date.get("year").toString()), Integer.parseInt(date.get("month").toString()), Integer.parseInt(date.get("day").toString())); thisRelease.albumReleaseDate = new SimpleDate(Integer.parseInt(date.get("year").toString()), Integer.parseInt(date.get("month").toString()), Integer.parseInt(date.get("day").toString()));
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }

View File

@ -105,7 +105,7 @@ public class AnidbClient extends AbstractEpisodeListProvider {
Document dom = getDocument(url); Document dom = getDocument(url);
// select main title and anime start date // select main title and anime start date
Date seriesStartDate = Date.parse(selectString("//startdate", dom), "yyyy-MM-dd"); SimpleDate seriesStartDate = SimpleDate.parse(selectString("//startdate", dom), "yyyy-MM-dd");
String animeTitle = selectString("//titles/title[@type='official' and @lang='" + language.getLanguage() + "']", dom); String animeTitle = selectString("//titles/title[@type='official' and @lang='" + language.getLanguage() + "']", dom);
if (animeTitle.isEmpty()) { if (animeTitle.isEmpty()) {
animeTitle = selectString("//titles/title[@type='main']", dom); animeTitle = selectString("//titles/title[@type='main']", dom);
@ -119,7 +119,7 @@ public class AnidbClient extends AbstractEpisodeListProvider {
int type = Integer.parseInt(getAttribute("type", epno)); int type = Integer.parseInt(getAttribute("type", epno));
if (type == 1 || type == 2) { if (type == 1 || type == 2) {
Date airdate = Date.parse(getTextContent("airdate", node), "yyyy-MM-dd"); SimpleDate airdate = SimpleDate.parse(getTextContent("airdate", node), "yyyy-MM-dd");
String title = selectString(".//title[@lang='" + language.getLanguage() + "']", node); String title = selectString(".//title[@lang='" + language.getLanguage() + "']", node);
if (title.isEmpty()) { // English language fall-back if (title.isEmpty()) { // English language fall-back
title = selectString(".//title[@lang='en']", node); title = selectString(".//title[@lang='en']", node);

View File

@ -13,7 +13,7 @@ public class AudioTrack implements Serializable {
protected String albumArtist; protected String albumArtist;
protected String trackTitle; protected String trackTitle;
protected Date albumReleaseDate; protected SimpleDate albumReleaseDate;
protected Integer mediumIndex; protected Integer mediumIndex;
protected Integer mediumCount; protected Integer mediumCount;
protected Integer trackIndex; protected Integer trackIndex;
@ -45,7 +45,7 @@ public class AudioTrack implements Serializable {
} }
public AudioTrack(String artist, String title, String album, String albumArtist, String trackTitle, Date albumReleaseDate, Integer mediumIndex, Integer mediumCount, Integer trackIndex, Integer trackCount) { public AudioTrack(String artist, String title, String album, String albumArtist, String trackTitle, SimpleDate albumReleaseDate, Integer mediumIndex, Integer mediumCount, Integer trackIndex, Integer trackCount) {
this.artist = artist; this.artist = artist;
this.title = title; this.title = title;
this.album = album; this.album = album;
@ -84,7 +84,7 @@ public class AudioTrack implements Serializable {
} }
public Date getAlbumReleaseDate() { public SimpleDate getAlbumReleaseDate() {
return albumReleaseDate; return albumReleaseDate;
} }

View File

@ -7,7 +7,7 @@ import java.util.List;
public class Episode implements Serializable { public class Episode implements Serializable {
private String seriesName; private String seriesName;
private Date seriesStartDate; private SimpleDate seriesStartDate;
private Integer season; private Integer season;
private Integer episode; private Integer episode;
@ -20,7 +20,7 @@ public class Episode implements Serializable {
private Integer special; private Integer special;
// episode airdate // episode airdate
private Date airdate; private SimpleDate airdate;
// original series descriptor // original series descriptor
private SearchResult series; private SearchResult series;
@ -33,11 +33,11 @@ public class Episode implements Serializable {
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, SimpleDate 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, SimpleDate seriesStartDate, Integer season, Integer episode, String title, Integer absolute, Integer special, SimpleDate airdate, SearchResult series) {
this.seriesName = seriesName; this.seriesName = seriesName;
this.seriesStartDate = (seriesStartDate == null ? null : seriesStartDate.clone()); this.seriesStartDate = (seriesStartDate == null ? null : seriesStartDate.clone());
this.season = season; this.season = season;
@ -53,7 +53,7 @@ public class Episode implements Serializable {
return seriesName; return seriesName;
} }
public Date getSeriesStartDate() { public SimpleDate getSeriesStartDate() {
return seriesStartDate; return seriesStartDate;
} }
@ -77,7 +77,7 @@ public class Episode implements Serializable {
return special; return special;
} }
public Date getAirdate() { public SimpleDate getAirdate() {
return airdate; return airdate;
} }

View File

@ -163,12 +163,12 @@ public class EpisodeFormat extends Format {
Integer season = null; Integer season = null;
Integer episode = null; Integer episode = null;
Integer special = null; Integer special = null;
Date airdate = null; SimpleDate airdate = null;
Matcher m; Matcher m;
if ((m = airdatePattern.matcher(source)).find()) { if ((m = airdatePattern.matcher(source)).find()) {
airdate = Date.parse(m.group(1), "yyyy-MM-dd"); airdate = SimpleDate.parse(m.group(1), "yyyy-MM-dd");
source.replace(m.start(), m.end(), ""); // remove matched part from text source.replace(m.start(), m.end(), ""); // remove matched part from text
} }

View File

@ -43,12 +43,12 @@ public class ID3Lookup implements MusicIdentificationService {
// extra info if available // extra info if available
String albumArtist = null, trackTitle = null; String albumArtist = null, trackTitle = null;
Date albumReleaseDate = null; SimpleDate albumReleaseDate = null;
Integer mediumIndex = null, mediumCount = null, trackIndex = null, trackCount = null; Integer mediumIndex = null, mediumCount = null, trackIndex = null, trackCount = null;
try { try {
int year = new Scanner(mediaInfo.get(StreamKind.General, 0, "Recorded_Date")).useDelimiter("\\D+").nextInt(); int year = new Scanner(mediaInfo.get(StreamKind.General, 0, "Recorded_Date")).useDelimiter("\\D+").nextInt();
albumReleaseDate = new Date(year, 1, 1); albumReleaseDate = new SimpleDate(year, 1, 1);
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }

View File

@ -206,11 +206,11 @@ public class IMDbClient implements MovieIdentificationService {
fields.put(MovieProperty.poster_path, data.get("poster")); fields.put(MovieProperty.poster_path, data.get("poster"));
// convert release date to yyyy-MM-dd // convert release date to yyyy-MM-dd
Date released = Date.parse(data.get("released"), "dd MMM yyyy"); SimpleDate released = SimpleDate.parse(data.get("released"), "dd MMM yyyy");
if (released != null) { if (released != null) {
fields.put(MovieProperty.release_date, released.format("yyyy-MM-dd")); fields.put(MovieProperty.release_date, released.format("yyyy-MM-dd"));
} else { } else {
Date year = Date.parse(data.get("year"), "yyyy"); SimpleDate year = SimpleDate.parse(data.get("year"), "yyyy");
if (year != null) { if (year != null) {
fields.put(MovieProperty.release_date, year.format("yyyy-MM-dd")); fields.put(MovieProperty.release_date, year.format("yyyy-MM-dd"));
} }

View File

@ -94,7 +94,7 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
String link = (String) obj.get("link"); String link = (String) obj.get("link");
String mainTitle = (String) obj.get("short"); String mainTitle = (String) obj.get("short");
String germanTitle = (String) obj.get("short_german"); String germanTitle = (String) obj.get("short_german");
Date startDate = Date.parse((String) obj.get("firstepisode"), "yyyy-MM-dd"); SimpleDate startDate = SimpleDate.parse((String) obj.get("firstepisode"), "yyyy-MM-dd");
Set<String> titleSet = new LinkedHashSet<String>(2); Set<String> titleSet = new LinkedHashSet<String>(2);
for (String title : new String[] { germanTitle, mainTitle }) { for (String title : new String[] { germanTitle, mainTitle }) {
@ -128,7 +128,7 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
Integer season = new Integer((String) obj.get("season")); Integer season = new Integer((String) obj.get("season"));
Integer episode = new Integer((String) obj.get("episode")); Integer episode = new Integer((String) obj.get("episode"));
Date airdate = Date.parse((String) ((JSONObject) obj.get("airdates")).get("premiere"), "yyyy-MM-dd"); SimpleDate airdate = SimpleDate.parse((String) ((JSONObject) obj.get("airdates")).get("premiere"), "yyyy-MM-dd");
String title = (String) obj.get("original"); String title = (String) obj.get("original");
String german = (String) obj.get("german"); String german = (String) obj.get("german");

View File

@ -4,13 +4,13 @@ public class SerienjunkiesSearchResult extends SearchResult {
protected int sid; protected int sid;
protected String link; protected String link;
protected Date startDate; protected SimpleDate startDate;
protected SerienjunkiesSearchResult() { protected SerienjunkiesSearchResult() {
// used by serializer // used by serializer
} }
public SerienjunkiesSearchResult(int sid, String link, String germanTitle, String[] otherTitles, Date startDate) { public SerienjunkiesSearchResult(int sid, String link, String germanTitle, String[] otherTitles, SimpleDate startDate) {
super(germanTitle, otherTitles); super(germanTitle, otherTitles);
this.sid = sid; this.sid = sid;
this.link = link; this.link = link;
@ -29,7 +29,7 @@ public class SerienjunkiesSearchResult extends SearchResult {
return link; return link;
} }
public Date getStartDate() { public SimpleDate getStartDate() {
return startDate; return startDate;
} }

View File

@ -10,17 +10,17 @@ import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.Locale; import java.util.Locale;
public class Date implements Serializable { public class SimpleDate implements Serializable {
private int year; private int year;
private int month; private int month;
private int day; private int day;
protected Date() { protected SimpleDate() {
// used by serializer // used by serializer
} }
public Date(int year, int month, int day) { public SimpleDate(int year, int month, int day) {
this.year = year; this.year = year;
this.month = month; this.month = month;
this.day = day; this.day = day;
@ -44,8 +44,8 @@ public class Date implements Serializable {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof Date) { if (obj instanceof SimpleDate) {
Date other = (Date) obj; SimpleDate other = (SimpleDate) obj;
return year == other.year && month == other.month && day == other.day; return year == other.year && month == other.month && day == other.day;
} }
@ -58,8 +58,8 @@ public class Date implements Serializable {
} }
@Override @Override
public Date clone() { public SimpleDate clone() {
return new Date(year, month, day); return new SimpleDate(year, month, day);
} }
@Override @Override
@ -75,7 +75,7 @@ public class Date implements Serializable {
return new SimpleDateFormat(pattern, locale).format(new GregorianCalendar(year, month - 1, day).getTime()); // Calendar months start at 0 return new SimpleDateFormat(pattern, locale).format(new GregorianCalendar(year, month - 1, day).getTime()); // Calendar months start at 0
} }
public static Date parse(String string, String pattern) { public static SimpleDate parse(String string, String pattern) {
if (string == null || string.isEmpty()) if (string == null || string.isEmpty())
return null; return null;
@ -85,7 +85,7 @@ public class Date implements Serializable {
try { try {
Calendar date = new GregorianCalendar(Locale.ROOT); Calendar date = new GregorianCalendar(Locale.ROOT);
date.setTime(formatter.parse(string)); date.setTime(formatter.parse(string));
return new Date(date.get(YEAR), date.get(MONTH) + 1, date.get(DAY_OF_MONTH)); // Calendar months start at 0 return new SimpleDate(date.get(YEAR), date.get(MONTH) + 1, date.get(DAY_OF_MONTH)); // Calendar months start at 0
} catch (ParseException e) { } catch (ParseException e) {
// no result if date is invalid // no result if date is invalid
// Logger.getLogger(Date.class.getName()).log(Level.WARNING, e.getMessage()); // Logger.getLogger(Date.class.getName()).log(Level.WARNING, e.getMessage());

View File

@ -451,10 +451,10 @@ public class TMDbClient implements MovieIdentificationService {
return get(MovieProperty.collection); return get(MovieProperty.collection);
} }
public Date getReleased() { public SimpleDate getReleased() {
// e.g. 2005-09-30 // e.g. 2005-09-30
try { try {
return Date.parse(get(MovieProperty.release_date), "yyyy-MM-dd"); return SimpleDate.parse(get(MovieProperty.release_date), "yyyy-MM-dd");
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }

View File

@ -74,7 +74,7 @@ public class TVRageClient extends AbstractEpisodeListProvider {
Document dom = getDocument(episodeListUrl); Document dom = getDocument(episodeListUrl);
String seriesName = selectString("Show/name", dom); String seriesName = selectString("Show/name", dom);
Date seriesStartDate = Date.parse(selectString("Show/started", dom), "MMM/dd/yyyy"); SimpleDate seriesStartDate = SimpleDate.parse(selectString("Show/started", dom), "MMM/dd/yyyy");
List<Episode> episodes = new ArrayList<Episode>(25); List<Episode> episodes = new ArrayList<Episode>(25);
List<Episode> specials = new ArrayList<Episode>(5); List<Episode> specials = new ArrayList<Episode>(5);
@ -85,7 +85,7 @@ public class TVRageClient extends AbstractEpisodeListProvider {
Integer episodeNumber = getIntegerContent("seasonnum", node); Integer episodeNumber = getIntegerContent("seasonnum", node);
String seasonIdentifier = getAttribute("no", node.getParentNode()); String seasonIdentifier = getAttribute("no", node.getParentNode());
Integer seasonNumber = seasonIdentifier == null ? null : new Integer(seasonIdentifier); Integer seasonNumber = seasonIdentifier == null ? null : new Integer(seasonIdentifier);
Date airdate = Date.parse(getTextContent("airdate", node), "yyyy-MM-dd"); SimpleDate airdate = SimpleDate.parse(getTextContent("airdate", node), "yyyy-MM-dd");
// check if we have season and episode number, if not it must be a special episode // check if we have season and episode number, if not it must be a special episode
if (episodeNumber == null || seasonNumber == null) { if (episodeNumber == null || seasonNumber == null) {

View File

@ -122,7 +122,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider {
// we could get the series name from the search result, but the language may not match the given parameter // we could get the series name from the search result, but the language may not match the given parameter
String seriesName = selectString("Data/Series/SeriesName", dom); String seriesName = selectString("Data/Series/SeriesName", dom);
Date seriesStartDate = Date.parse(selectString("Data/Series/FirstAired", dom), "yyyy-MM-dd"); SimpleDate seriesStartDate = SimpleDate.parse(selectString("Data/Series/FirstAired", dom), "yyyy-MM-dd");
List<Node> nodes = selectNodes("Data/Episode", dom); List<Node> nodes = selectNodes("Data/Episode", dom);
@ -134,7 +134,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider {
String dvdSeasonNumber = getTextContent("DVD_season", node); String dvdSeasonNumber = getTextContent("DVD_season", node);
String dvdEpisodeNumber = getTextContent("DVD_episodenumber", node); String dvdEpisodeNumber = getTextContent("DVD_episodenumber", node);
Integer absoluteNumber = getIntegerContent("absolute_number", node); Integer absoluteNumber = getIntegerContent("absolute_number", node);
Date airdate = Date.parse(getTextContent("FirstAired", node), "yyyy-MM-dd"); SimpleDate airdate = SimpleDate.parse(getTextContent("FirstAired", node), "yyyy-MM-dd");
// default numbering // default numbering
Integer episodeNumber = getIntegerContent("EpisodeNumber", node); Integer episodeNumber = getIntegerContent("EpisodeNumber", node);
@ -437,9 +437,9 @@ public class TheTVDBClient extends AbstractEpisodeListProvider {
return get(SeriesProperty.Airs_Time); return get(SeriesProperty.Airs_Time);
} }
public Date getFirstAired() { public SimpleDate getFirstAired() {
// e.g. 2007-09-24 // e.g. 2007-09-24
return Date.parse(get(SeriesProperty.FirstAired), "yyyy-MM-dd"); return SimpleDate.parse(get(SeriesProperty.FirstAired), "yyyy-MM-dd");
} }
public String getContentRating() { public String getContentRating() {

View File

@ -7,7 +7,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.filebot.web.Date; import net.sourceforge.filebot.web.SimpleDate;
import net.sourceforge.filebot.web.Episode; import net.sourceforge.filebot.web.Episode;
import net.sourceforge.filebot.web.TheTVDBSearchResult; import net.sourceforge.filebot.web.TheTVDBSearchResult;
@ -17,7 +17,7 @@ public class EpisodeMetricsTest {
@Test @Test
public void substringMetrics() { public void substringMetrics() {
Episode eY1T1 = new Episode("Doctor Who", new Date(2005, 0, 0), 1, 1, "Rose", new TheTVDBSearchResult("Doctor Who", -1)); Episode eY1T1 = new Episode("Doctor Who", new SimpleDate(2005, 0, 0), 1, 1, "Rose", new TheTVDBSearchResult("Doctor Who", -1));
// Episode eY2T2 = new Episode("Doctor Who", new Date(1963, 0, 0), 1, 1, "An Unearthly Child"); // Episode eY2T2 = new Episode("Doctor Who", new Date(1963, 0, 0), 1, 1, "An Unearthly Child");
File fY1T1 = new File("Doctor Who (2005)/Doctor Who - 1x01 - Rose"); File fY1T1 = new File("Doctor Who (2005)/Doctor Who - 1x01 - Rose");
File fY2T2 = new File("Doctor Who (1963)/Doctor Who - 1x01 - An Unearthly Child"); File fY2T2 = new File("Doctor Who (1963)/Doctor Who - 1x01 - An Unearthly Child");