mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-11 13:58:16 -05:00
* added support for SeriesStartDate in SerienJunkies
This commit is contained in:
parent
ad92f85a90
commit
9c805d5b2a
@ -124,7 +124,7 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
|
|||||||
// fetch series data
|
// fetch series data
|
||||||
seriesList = new ArrayList<SerienjunkiesSearchResult>();
|
seriesList = new ArrayList<SerienjunkiesSearchResult>();
|
||||||
|
|
||||||
JSONObject data = (JSONObject) request("allseries.php?d=" + apikey);
|
JSONObject data = (JSONObject) request("/allseries.php?d=" + apikey);
|
||||||
JSONArray list = (JSONArray) data.get("allseries");
|
JSONArray list = (JSONArray) data.get("allseries");
|
||||||
|
|
||||||
for (Object element : list) {
|
for (Object element : list) {
|
||||||
@ -134,8 +134,9 @@ 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");
|
||||||
|
|
||||||
seriesList.add(new SerienjunkiesSearchResult(sid, link, mainTitle, germanTitle != null && germanTitle.length() > 0 ? germanTitle : null));
|
seriesList.add(new SerienjunkiesSearchResult(sid, link, mainTitle, germanTitle != null && !germanTitle.isEmpty() ? germanTitle : null, startDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate cache
|
// populate cache
|
||||||
@ -157,7 +158,7 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
|
|||||||
// fetch episode data
|
// fetch episode data
|
||||||
episodes = new ArrayList<Episode>(25);
|
episodes = new ArrayList<Episode>(25);
|
||||||
|
|
||||||
JSONObject data = (JSONObject) request("allepisodes.php?d=" + apikey + "&q=" + series.getSeriesId());
|
JSONObject data = (JSONObject) request("/allepisodes.php?d=" + apikey + "&q=" + series.getSeriesId());
|
||||||
JSONArray list = (JSONArray) data.get("allepisodes");
|
JSONArray list = (JSONArray) data.get("allepisodes");
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
@ -168,7 +169,7 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
|
|||||||
String title = (String) obj.get("german");
|
String title = (String) obj.get("german");
|
||||||
Date airdate = Date.parse((String) ((JSONObject) obj.get("airdates")).get("premiere"), "yyyy-MM-dd");
|
Date airdate = Date.parse((String) ((JSONObject) obj.get("airdates")).get("premiere"), "yyyy-MM-dd");
|
||||||
|
|
||||||
episodes.add(new Episode(series.getName(), null, season, episode, title, i + 1, null, airdate));
|
episodes.add(new Episode(series.getName(), series.getStartDate(), season, episode, title, i + 1, null, airdate));
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate cache
|
// populate cache
|
||||||
@ -188,7 +189,7 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
|
|||||||
// disable SSL certificate validation
|
// disable SSL certificate validation
|
||||||
connection.setSSLSocketFactory(createIgnoreCertificateSocketFactory());
|
connection.setSSLSocketFactory(createIgnoreCertificateSocketFactory());
|
||||||
|
|
||||||
// fetch and parse json data
|
// fetch and parse JSON data
|
||||||
Reader reader = getReader(connection);
|
Reader reader = getReader(connection);
|
||||||
try {
|
try {
|
||||||
return JSONValue.parse(reader);
|
return JSONValue.parse(reader);
|
||||||
@ -221,6 +222,7 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
|
|||||||
protected String link;
|
protected String link;
|
||||||
protected String mainTitle;
|
protected String mainTitle;
|
||||||
protected String germanTitle;
|
protected String germanTitle;
|
||||||
|
protected Date startDate;
|
||||||
|
|
||||||
|
|
||||||
protected SerienjunkiesSearchResult() {
|
protected SerienjunkiesSearchResult() {
|
||||||
@ -228,11 +230,12 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SerienjunkiesSearchResult(int sid, String link, String mainTitle, String germanTitle) {
|
public SerienjunkiesSearchResult(int sid, String link, String mainTitle, String germanTitle, Date startDate) {
|
||||||
this.sid = sid;
|
this.sid = sid;
|
||||||
this.link = link;
|
this.link = link;
|
||||||
this.mainTitle = mainTitle;
|
this.mainTitle = mainTitle;
|
||||||
this.germanTitle = germanTitle;
|
this.germanTitle = germanTitle;
|
||||||
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -260,6 +263,11 @@ public class SerienjunkiesClient extends AbstractEpisodeListProvider {
|
|||||||
public String getGermanTitle() {
|
public String getGermanTitle() {
|
||||||
return germanTitle;
|
return germanTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Date getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,18 +24,19 @@ public class SerienjunkiesClientTest {
|
|||||||
List<SearchResult> results = serienjunkies.search("alias die agentin");
|
List<SearchResult> results = serienjunkies.search("alias die agentin");
|
||||||
assertEquals(1, results.size());
|
assertEquals(1, results.size());
|
||||||
|
|
||||||
SerienjunkiesSearchResult first = (SerienjunkiesSearchResult) results.get(0);
|
SerienjunkiesSearchResult series = (SerienjunkiesSearchResult) results.get(0);
|
||||||
assertEquals(34, first.getSeriesId());
|
assertEquals(34, series.getSeriesId());
|
||||||
assertEquals("Alias", first.getLink());
|
assertEquals("Alias", series.getLink());
|
||||||
assertEquals("Alias - Die Agentin", first.getName());
|
assertEquals("Alias - Die Agentin", series.getName());
|
||||||
assertEquals("Alias", first.getMainTitle());
|
assertEquals("Alias", series.getMainTitle());
|
||||||
assertEquals("Alias - Die Agentin", first.getGermanTitle());
|
assertEquals("Alias - Die Agentin", series.getGermanTitle());
|
||||||
|
assertEquals("2001-09-30", series.getStartDate().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getEpisodeListAll() throws Exception {
|
public void getEpisodeListAll() throws Exception {
|
||||||
List<Episode> list = serienjunkies.getEpisodeList(new SerienjunkiesSearchResult(260, "greys-anatomy", "Grey's Anatomy", null));
|
List<Episode> list = serienjunkies.getEpisodeList(new SerienjunkiesSearchResult(260, "greys-anatomy", "Grey's Anatomy", null, null));
|
||||||
|
|
||||||
// check ordinary episode
|
// check ordinary episode
|
||||||
Episode eps = list.get(0);
|
Episode eps = list.get(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user