mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-21 23:38:50 -05:00
Reverse Map [%s] to [%s]
This commit is contained in:
parent
f0b4d65d27
commit
b0734f74c4
@ -224,7 +224,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
episodes = applyEpisodeExpressionMapper(episodes, mapper);
|
||||
|
||||
for (List<File> filesPerType : mapByMediaExtension(filter(batch, VIDEO_FILES, SUBTITLE_FILES)).values()) {
|
||||
matches.addAll(matchEpisodes(filesPerType, episodes, strict));
|
||||
matchEpisodes(filesPerType, episodes, strict).stream().map(this::unmap).forEach(matches::add);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -254,6 +254,16 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
return renameAll(formatMatches(matches, format, outputDir), renameAction, conflictAction, matches, exec);
|
||||
}
|
||||
|
||||
private Match<File, ?> unmap(Match<File, ?> match) {
|
||||
// add matches and unmap mapped episodes
|
||||
if (match.getCandidate() instanceof MappedEpisode) {
|
||||
MappedEpisode mapping = (MappedEpisode) match.getCandidate();
|
||||
log.fine(format("Reverse Map [%s] to [%s]", mapping.getMapping(), mapping.getOriginal()));
|
||||
return new Match<File, Episode>(match.getValue(), mapping.getOriginal());
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
private List<Match<File, Object>> matchEpisodes(Collection<File> files, Collection<Episode> episodes, boolean strict) throws Exception {
|
||||
// always use strict fail-fast matcher
|
||||
EpisodeMatcher matcher = new EpisodeMatcher(files, episodes, strict);
|
||||
|
Loading…
Reference in New Issue
Block a user