mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
* 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 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");
|
||||
|
||||
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
|
||||
|
@ -5,20 +5,21 @@ package net.sourceforge.filebot.web;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
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.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import net.sourceforge.filebot.web.SerienjunkiesClient.SerienjunkiesSearchResult;
|
||||
|
||||
|
||||
public class SerienjunkiesClientTest {
|
||||
|
||||
private SerienjunkiesClient serienjunkies = new SerienjunkiesClient("9fbhw9uebfiwvbefzuwv");
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void search() throws Exception {
|
||||
List<SearchResult> results = serienjunkies.search("alias die agentin");
|
||||
@ -33,10 +34,10 @@ public class SerienjunkiesClientTest {
|
||||
assertEquals("2001-09-30", series.getStartDate().toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
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
|
||||
Episode eps = list.get(0);
|
||||
@ -56,7 +57,7 @@ public class SerienjunkiesClientTest {
|
||||
assertEquals("2005-04-10", eps.airdate().toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@BeforeClass
|
||||
@AfterClass
|
||||
public static void clearCache() {
|
||||
|
Loading…
Reference in New Issue
Block a user