1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-05 08:55:08 -05:00

Support -rename --q <Numeric ID>

This commit is contained in:
Reinhard Pointner 2018-07-09 03:15:26 +07:00
parent b93815b5a8
commit 749e614d50

View File

@ -205,7 +205,11 @@ public class CmdlineOperations implements CmdlineInterface {
episodes = fetchEpisodeSet(db, seriesNames, sortOrder, locale, strict, 5); // consider episodes of up to N search results for each query
} else {
episodes = fetchEpisodeSet(db, singleton(query), sortOrder, locale, false, 1); // use --q option and pick first result
if (isSeriesID(query)) {
episodes = db.getEpisodeList(Integer.parseInt(query), sortOrder, locale);
} else {
episodes = fetchEpisodeSet(db, singleton(query), sortOrder, locale, false, 1); // use --q option and pick first result
}
}
if (episodes.isEmpty()) {
@ -1018,7 +1022,7 @@ public class CmdlineOperations implements CmdlineInterface {
// collect all episode objects first
List<Episode> episodes = new ArrayList<Episode>();
if (query.matches("\\d{5,9}")) {
if (isSeriesID(query)) {
// lookup by id
episodes.addAll(db.getEpisodeList(Integer.parseInt(query), order, locale));
} else {
@ -1040,6 +1044,10 @@ public class CmdlineOperations implements CmdlineInterface {
return applyExpressionFilter(episodes, filter);
}
private boolean isSeriesID(String query) {
return query.matches("\\d{5,9}");
}
@Override
public Stream<String> fetchEpisodeList(EpisodeListProvider db, String query, ExpressionFormat format, ExpressionFilter filter, SortOrder order, Locale locale, boolean strict) throws Exception {
// collect all episode objects first