diff --git a/source/net/sourceforge/filebot/web/SerienjunkiesClient.java b/source/net/sourceforge/filebot/web/SerienjunkiesClient.java index ab68e40b..2f75c356 100644 --- a/source/net/sourceforge/filebot/web/SerienjunkiesClient.java +++ b/source/net/sourceforge/filebot/web/SerienjunkiesClient.java @@ -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 diff --git a/test/net/sourceforge/filebot/web/SerienjunkiesClientTest.java b/test/net/sourceforge/filebot/web/SerienjunkiesClientTest.java index 1d5edb43..f80d4d9d 100644 --- a/test/net/sourceforge/filebot/web/SerienjunkiesClientTest.java +++ b/test/net/sourceforge/filebot/web/SerienjunkiesClientTest.java @@ -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 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 list = serienjunkies.getEpisodeList(new SerienjunkiesSearchResult(260, "greys-anatomy", "Grey's Anatomy", null, null)); + List 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() {