1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 08:18:52 -05:00

* encode search query properly, caused search to fail for many movies

* search by folder/filename, but only once if they're the same
This commit is contained in:
Reinhard Pointner 2011-11-14 02:26:55 +00:00
parent 4506272fe6
commit 848d795871
2 changed files with 8 additions and 3 deletions

View File

@ -17,6 +17,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -184,9 +185,13 @@ class MovieHashMatcher implements AutoCompleteMatcher {
}
// search by file name or folder name
for (File it : new File[] { movieFile, movieFile.getParentFile() }) {
Set<String> searchQueries = new LinkedHashSet<String>(2);
searchQueries.add(normalizeMovieName(movieFile));
searchQueries.add(normalizeMovieName(movieFile.getParentFile()));
for (String query : searchQueries) {
if (autodetect && options.isEmpty()) {
options = service.searchMovie(normalizeMovieName(it), locale);
options = service.searchMovie(query, locale);
}
}

View File

@ -53,7 +53,7 @@ public class TMDbClient implements MovieIdentificationService {
@Override
public List<Movie> searchMovie(String query, Locale locale) throws IOException {
try {
return getMovies("Movie.search", query, locale);
return getMovies("Movie.search", encode(query), locale);
} catch (SAXException e) {
// TMDb output is sometimes malformed xml
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage());