* fix 'n clean
This commit is contained in:
parent
f818ca5124
commit
3e45873ce3
|
@ -95,7 +95,7 @@ public class ArgumentProcessor {
|
||||||
CLILogger.finest("Done ヾ(@⌒ー⌒@)ノ");
|
CLILogger.finest("Done ヾ(@⌒ー⌒@)ノ");
|
||||||
return 0;
|
return 0;
|
||||||
} catch (Throwable e) {
|
} 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 (°_°)");
|
CLILogger.finest("Failure (°_°)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -640,7 +640,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
|
|
||||||
// find probable matches using name similarity > 0.9
|
// find probable matches using name similarity > 0.9
|
||||||
for (SearchResult result : searchResults) {
|
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 (f >= 0.9 || (f >= 0.6 && result.getName().toLowerCase().startsWith(query.toLowerCase()))) {
|
||||||
if (!probableMatches.containsKey(result.toString())) {
|
if (!probableMatches.containsKey(result.toString())) {
|
||||||
probableMatches.put(result.toString(), result);
|
probableMatches.put(result.toString(), result);
|
||||||
|
@ -650,7 +650,9 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
|
|
||||||
// sort results by similarity to query
|
// sort results by similarity to query
|
||||||
List<SearchResult> results = new ArrayList<SearchResult>(probableMatches.values());
|
List<SearchResult> results = new ArrayList<SearchResult>(probableMatches.values());
|
||||||
|
if (query != null) {
|
||||||
sort(results, new SimilarityComparator(query));
|
sort(results, new SimilarityComparator(query));
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,10 @@ package net.sourceforge.filebot.web;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -169,7 +171,13 @@ public class TheTVDBClientTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getBanner() throws Exception {
|
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(857660, banner.getId(), 0);
|
||||||
assertEquals("season", banner.getBannerType());
|
assertEquals("season", banner.getBannerType());
|
||||||
|
|
Loading…
Reference in New Issue