mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-10 06:20:27 -04:00
Support lookup by id, e.g. filebot -list --q 70327
This commit is contained in:
parent
df2a5f9269
commit
102ce41728
@ -996,20 +996,25 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||||||
throw new CmdlineException(String.format("%s: query parameter is required", db.getName()));
|
throw new CmdlineException(String.format("%s: query parameter is required", db.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// search and select search result
|
// collect all episode objects first
|
||||||
List<SearchResult> results = db.search(query, locale);
|
List<Episode> episodes = new ArrayList<Episode>();
|
||||||
|
|
||||||
// sanity check
|
if (query.matches("\\d{5,9}")) {
|
||||||
if (results.isEmpty()) {
|
// lookup by id
|
||||||
throw new CmdlineException(String.format("%s: no results", db.getName()));
|
episodes.addAll(db.getEpisodeList(Integer.parseInt(query), order, locale));
|
||||||
|
} else {
|
||||||
|
// search by name and select search result
|
||||||
|
List<SearchResult> options = selectSearchResult(query, db.search(query, locale), false, false, false, strict ? 1 : 5);
|
||||||
|
|
||||||
|
// fetch episodes
|
||||||
|
for (SearchResult option : options) {
|
||||||
|
episodes.addAll(db.getEpisodeList(option, order, locale));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SearchResult> options = selectSearchResult(query, results, false, false, false, strict ? 1 : 5);
|
// sanity check
|
||||||
|
if (episodes.isEmpty()) {
|
||||||
// fetch episodes
|
throw new CmdlineException(String.format("%s: no results", db.getName()));
|
||||||
List<Episode> episodes = new ArrayList<Episode>();
|
|
||||||
for (SearchResult option : options) {
|
|
||||||
episodes.addAll(db.getEpisodeList(option, order, locale));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply filter
|
// apply filter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user