From fa55b6836033fc6189e6a4700bf8df0553037dae Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 15 Feb 2013 08:48:11 +0000 Subject: [PATCH] * added script for deleting xattr metadata --- .../filebot/MetaAttributeView.java | 20 +++++++++++++++++++ website/scripts/xattr.groovy | 13 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 website/scripts/xattr.groovy diff --git a/source/net/sourceforge/filebot/MetaAttributeView.java b/source/net/sourceforge/filebot/MetaAttributeView.java index c7c3d028..f7aa28d1 100644 --- a/source/net/sourceforge/filebot/MetaAttributeView.java +++ b/source/net/sourceforge/filebot/MetaAttributeView.java @@ -80,6 +80,26 @@ public class MetaAttributeView extends AbstractMap { } + @Override + public int size() { + try { + return attributeView.list().size(); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + + + @Override + public boolean isEmpty() { + try { + return attributeView.list().isEmpty(); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + + private class AttributeEntry implements Entry { private final String name; diff --git a/website/scripts/xattr.groovy b/website/scripts/xattr.groovy new file mode 100644 index 00000000..0cf4b6ee --- /dev/null +++ b/website/scripts/xattr.groovy @@ -0,0 +1,13 @@ +// filebot -script fn:xattr --action clear /path/to/files + +args.getFiles{ it.xattr.size() > 0 }.each{ + println it + it.xattr.each{ k, v -> + println "\t$k: $v" + } + // clear xattr mode + if (_args.action == 'clear') { + it.xattr.clear() + println '*** CLEARED ***' + } +}