mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-16 22:35:04 -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:
parent
4506272fe6
commit
848d795871
@ -17,6 +17,7 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -184,9 +185,13 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// search by file name or folder name
|
// 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()) {
|
if (autodetect && options.isEmpty()) {
|
||||||
options = service.searchMovie(normalizeMovieName(it), locale);
|
options = service.searchMovie(query, locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class TMDbClient implements MovieIdentificationService {
|
|||||||
@Override
|
@Override
|
||||||
public List<Movie> searchMovie(String query, Locale locale) throws IOException {
|
public List<Movie> searchMovie(String query, Locale locale) throws IOException {
|
||||||
try {
|
try {
|
||||||
return getMovies("Movie.search", query, locale);
|
return getMovies("Movie.search", encode(query), locale);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
// TMDb output is sometimes malformed xml
|
// TMDb output is sometimes malformed xml
|
||||||
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage());
|
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage());
|
||||||
|
Loading…
Reference in New Issue
Block a user