From 492e20ae8af0599deb9293d758844f09140d46d5 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 14 Apr 2013 04:29:41 +0000 Subject: [PATCH] * improved support for derived files in cmdline -rename mode @see http://www.filebot.net/forums/viewtopic.php?f=8&t=668#p4448 --- .../filebot/cli/CmdlineOperations.java | 17 +++++++++++++++++ source/net/sourceforge/filebot/media.types | 1 + 2 files changed, 18 insertions(+) diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index 1048b7b3..d799523a 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -201,6 +201,23 @@ public class CmdlineOperations implements CmdlineInterface { throw new Exception("Unable to match files to episode data"); } + // handle derived files + List> derivateMatches = new ArrayList>(); + SortedSet derivateFiles = new TreeSet(files); + derivateFiles.removeAll(mediaFiles); + + for (File file : derivateFiles) { + for (Match match : matches) { + if (file.getParentFile().equals(match.getValue().getParentFile()) && isDerived(file, match.getValue()) && match.getCandidate() instanceof Episode) { + derivateMatches.add(new Match(file, ((Episode) match.getCandidate()).clone())); + break; + } + } + } + + // add matches from other files that are linked via filenames + matches.addAll(derivateMatches); + // first write all the metadata if xattr is enabled if (useExtendedFileAttributes()) { try { diff --git a/source/net/sourceforge/filebot/media.types b/source/net/sourceforge/filebot/media.types index 0e7a539d..debe915b 100644 --- a/source/net/sourceforge/filebot/media.types +++ b/source/net/sourceforge/filebot/media.types @@ -97,6 +97,7 @@ ts tp m2ts + rec wmv