From 400e5f5dcb87ad6cf197eccfe02cf4782171d78a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 17 Dec 2014 02:19:29 +0000 Subject: [PATCH] * allow TSV and CSV formats --- source/net/filebot/format/ExpressionFormatFunctions.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/net/filebot/format/ExpressionFormatFunctions.java b/source/net/filebot/format/ExpressionFormatFunctions.java index 3c013e2f..52b1e1ec 100644 --- a/source/net/filebot/format/ExpressionFormatFunctions.java +++ b/source/net/filebot/format/ExpressionFormatFunctions.java @@ -91,9 +91,12 @@ public class ExpressionFormatFunctions { public static Map csv(String path) throws IOException { Map map = new LinkedHashMap(); for (String line : Files.readAllLines(Paths.get(path), Charset.forName("UTF-8"))) { - String[] field = line.split(";", 2); - if (field.length >= 2) { - map.put(field[0], field[1]); + for (String delim : new String[] { "\t", ";" }) { + String[] field = line.split(delim, 2); + if (field.length >= 2) { + map.put(field[0], field[1]); + break; + } } } return map;