mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 00:38:52 -05:00
* allow TSV and CSV formats
This commit is contained in:
parent
eaff34998a
commit
400e5f5dcb
@ -91,9 +91,12 @@ public class ExpressionFormatFunctions {
|
||||
public static Map<String, String> csv(String path) throws IOException {
|
||||
Map<String, String> map = new LinkedHashMap<String, String>();
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user