diff --git a/source/net/sourceforge/filebot/cli/ArgumentProcessor.java b/source/net/sourceforge/filebot/cli/ArgumentProcessor.java index 47a621f8..75c35d48 100644 --- a/source/net/sourceforge/filebot/cli/ArgumentProcessor.java +++ b/source/net/sourceforge/filebot/cli/ArgumentProcessor.java @@ -95,7 +95,7 @@ public class ArgumentProcessor { CLILogger.finest("Done ヾ(@⌒ー⌒@)ノ"); return 0; } catch (Throwable e) { - CLILogger.log(Level.SEVERE, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), getRootCause(e)); + CLILogger.log(Level.SEVERE, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), e.getClass() == Exception.class ? null : getRootCause(e)); CLILogger.finest("Failure (°_°)"); return -1; } diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index 615afd79..00180cf7 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -640,7 +640,7 @@ public class CmdlineOperations implements CmdlineInterface { // find probable matches using name similarity > 0.9 for (SearchResult result : searchResults) { - float f = metric.getSimilarity(query, result.getName()); + float f = (query == null) ? 1 : metric.getSimilarity(query, result.getName()); if (f >= 0.9 || (f >= 0.6 && result.getName().toLowerCase().startsWith(query.toLowerCase()))) { if (!probableMatches.containsKey(result.toString())) { probableMatches.put(result.toString(), result); @@ -650,7 +650,9 @@ public class CmdlineOperations implements CmdlineInterface { // sort results by similarity to query List results = new ArrayList(probableMatches.values()); - sort(results, new SimilarityComparator(query)); + if (query != null) { + sort(results, new SimilarityComparator(query)); + } return results; } diff --git a/test/net/sourceforge/filebot/web/TheTVDBClientTest.java b/test/net/sourceforge/filebot/web/TheTVDBClientTest.java index 3e7d1dd9..65bf173a 100644 --- a/test/net/sourceforge/filebot/web/TheTVDBClientTest.java +++ b/test/net/sourceforge/filebot/web/TheTVDBClientTest.java @@ -5,8 +5,10 @@ package net.sourceforge.filebot.web; import static org.junit.Assert.*; import java.util.EnumSet; +import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -169,7 +171,13 @@ public class TheTVDBClientTest { @Test public void getBanner() throws Exception { - BannerDescriptor banner = thetvdb.getBanner(new TheTVDBSearchResult("Buffy the Vampire Slayer", 70327), "season", "seasonwide", 7, Locale.ENGLISH, 0); + Map filter = new HashMap(); + filter.put("BannerType", "season"); + filter.put("BannerType2", "seasonwide"); + filter.put("Season", "7"); + filter.put("Language", "en"); + + BannerDescriptor banner = thetvdb.getBanner(new TheTVDBSearchResult("Buffy the Vampire Slayer", 70327), filter); assertEquals(857660, banner.getId(), 0); assertEquals("season", banner.getBannerType());