* fix 'n clean

This commit is contained in:
Reinhard Pointner 2011-12-30 19:31:33 +00:00
parent f818ca5124
commit 3e45873ce3
3 changed files with 14 additions and 4 deletions

View File

@ -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;
}

View File

@ -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<SearchResult> results = new ArrayList<SearchResult>(probableMatches.values());
sort(results, new SimilarityComparator(query));
if (query != null) {
sort(results, new SimilarityComparator(query));
}
return results;
}

View File

@ -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<String, String> filter = new HashMap<String, String>();
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());