Better error message when bad --q parameter is passed
This commit is contained in:
parent
49e82b7824
commit
cd01fe26bf
|
@ -390,13 +390,13 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
} else {
|
} else {
|
||||||
log.fine(format("Looking up movie by query [%s]", query));
|
log.fine(format("Looking up movie by query [%s]", query));
|
||||||
List<Movie> results = service.searchMovie(query, locale);
|
List<Movie> results = service.searchMovie(query, locale);
|
||||||
List<Movie> validResults = applyExpressionFilter(results, filter);
|
List<Movie> options = applyExpressionFilter(results, filter);
|
||||||
if (validResults.isEmpty()) {
|
if (options.isEmpty()) {
|
||||||
throw new CmdlineException("Failed to find a valid match: " + results);
|
throw new CmdlineException("Failed to find a valid match: " + results);
|
||||||
}
|
}
|
||||||
|
|
||||||
// force all mappings
|
// force all mappings
|
||||||
Movie result = (Movie) selectSearchResult(query, validResults, false, strict).get(0);
|
Movie result = (Movie) selectSearchResult(query, options, false, strict).get(0);
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
movieByFile.put(file, result);
|
movieByFile.put(file, result);
|
||||||
}
|
}
|
||||||
|
@ -1038,8 +1038,11 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
Locale locale = getLanguage(languageName).getLocale();
|
Locale locale = getLanguage(languageName).getLocale();
|
||||||
|
|
||||||
// fetch episode data
|
// fetch episode data
|
||||||
SearchResult hit = selectSearchResult(query, service.search(query, locale), false, false).get(0);
|
List<SearchResult> options = selectSearchResult(query, service.search(query, locale), false, false);
|
||||||
List<Episode> episodes = service.getEpisodeList(hit, sortOrder, locale);
|
if (options.isEmpty())
|
||||||
|
throw new CmdlineException(service.getName() + ": no results");
|
||||||
|
|
||||||
|
List<Episode> episodes = service.getEpisodeList(options.get(0), sortOrder, locale);
|
||||||
|
|
||||||
// apply filter
|
// apply filter
|
||||||
episodes = applyExpressionFilter(episodes, filter);
|
episodes = applyExpressionFilter(episodes, filter);
|
||||||
|
|
Loading…
Reference in New Issue