* fix SerienJunkies NPE problems
This commit is contained in:
parent
bfe4add9ab
commit
aa9cccc285
|
@ -130,10 +130,15 @@ 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"));
|
||||||
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(seriesName.trim(), series.getStartDate(), season, episode, title.trim(), i + 1, null, airdate));
|
String title = (String) obj.get("original");
|
||||||
|
String german = (String) obj.get("german");
|
||||||
|
if (title == null || (Locale.GERMAN.equals(locale) && german != null)) {
|
||||||
|
title = german;
|
||||||
|
}
|
||||||
|
|
||||||
|
episodes.add(new Episode(seriesName, series.getStartDate(), season, episode, title, i + 1, null, airdate));
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure episodes are in ordered correctly
|
// make sure episodes are in ordered correctly
|
||||||
|
|
|
@ -5,14 +5,15 @@ package net.sourceforge.filebot.web;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import net.sf.ehcache.CacheManager;
|
||||||
|
import net.sourceforge.filebot.web.SerienjunkiesClient.SerienjunkiesSearchResult;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import net.sf.ehcache.CacheManager;
|
|
||||||
import net.sourceforge.filebot.web.SerienjunkiesClient.SerienjunkiesSearchResult;
|
|
||||||
|
|
||||||
|
|
||||||
public class SerienjunkiesClientTest {
|
public class SerienjunkiesClientTest {
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ public class SerienjunkiesClientTest {
|
||||||
|
|
||||||
@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, null));
|
List<Episode> list = serienjunkies.getEpisodeList(new SerienjunkiesSearchResult(260, "greys-anatomy", "Grey's Anatomy", null, null), null, Locale.GERMAN);
|
||||||
|
|
||||||
// check ordinary episode
|
// check ordinary episode
|
||||||
Episode eps = list.get(0);
|
Episode eps = list.get(0);
|
||||||
|
|
Loading…
Reference in New Issue