summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-10-17 03:07:23 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-10-17 03:07:23 -0700
commit6c74f258aca075dea41fd13ec06da9b1955da3c6 (patch)
tree56974ccd5fa9feb8becd7837f1b8b45e8548d734
parentbd95e550eee8de2ef9a6ab49635c1dec86602c52 (diff)
downloadomptagger-6c74f258aca075dea41fd13ec06da9b1955da3c6.tar.gz
omptagger-6c74f258aca075dea41fd13ec06da9b1955da3c6.tar.xz
Bugfixes.
-rwxr-xr-xomptagger14
1 files changed, 7 insertions, 7 deletions
diff --git a/omptagger b/omptagger
index b526f3a..78f57a8 100755
--- a/omptagger
+++ b/omptagger
@@ -158,10 +158,12 @@ class MetadataError < RuntimeError
case @error
when :empty
str = 'No fields set.'
- when :unset
- str = 'Field not set.'
when :invalid
str = 'Invalid field name.'
+ when :scheme
+ str = 'Filename does not match scheme.'
+ when :unset
+ str = 'Field not set.'
end
return str
@@ -231,13 +233,13 @@ class Metadata
@write = true
end
- def settag(field, value)
+ def settag(field, value, padding = 0)
field.upcase!
raise MetadataError, :invalid unless valid_field?(field)
@metadata[field] = [value]
- Output.field(field, value)
+ Output.field(field, value, padding)
@write = true
end
@@ -270,9 +272,7 @@ class Metadata
fields = scheme.scan(regexp).flatten
values = @filename.chomp(File.extname(@filename)).scan(regexp).flatten
- unless fields.length == values.length
- raise MetadataError, 'Filename does not match naming scheme.'
- end
+ raise MetadataError, :scheme unless fields.length == values.length
fields.collect! do |field|
keys[field[1,1]]