summaryrefslogtreecommitdiff
path: root/omptagger
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-10-06 01:07:55 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-10-06 01:07:55 -0700
commit012fcec93c02c81f20aad7e2abb1d1ededeea60f (patch)
tree094767c6b6a4268b0b43861fd2fd18d29c940c11 /omptagger
parent7685de9855d1abd113c846caf163937dabc1951c (diff)
downloadomptagger-012fcec93c02c81f20aad7e2abb1d1ededeea60f.tar.gz
omptagger-012fcec93c02c81f20aad7e2abb1d1ededeea60f.tar.xz
Add argument parsing; treat each argument as file.
Diffstat (limited to 'omptagger')
-rwxr-xr-xomptagger22
1 files changed, 22 insertions, 0 deletions
diff --git a/omptagger b/omptagger
index d603ee8..4b2375a 100755
--- a/omptagger
+++ b/omptagger
@@ -101,3 +101,25 @@ list if options.include?(:list)
help if actions.empty?
puts 'No files specified.' if ARGV.empty?
+
+ARGV.each do |file|
+ puts file
+
+ # Use absolute path internally.
+ file = File.expand_path(file)
+
+ begin
+ raise 'File does not exist.' unless File.exist?(file)
+
+ case File.extname(file).downcase
+ when '.flac'
+ puts ' Treat this as a FLAC file.'
+ when '.ogg'
+ puts ' Treat this as a Vorbis file.'
+ else
+ raise 'File extension not recognised.'
+ end
+ rescue RuntimeError => message
+ puts ' ' + message
+ end
+end