diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-11-07 15:26:51 -0800 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-11-07 15:26:51 -0800 |
commit | 84f0130910fd9e1bf5584f502c000a8b7044b487 (patch) | |
tree | a76dabeb02b376b215d9631bda8abdb076700439 | |
parent | aed4cd0a167b4d48d8bf3e5a8de1b8d5b4614f51 (diff) | |
download | omptagger-84f0130910fd9e1bf5584f502c000a8b7044b487.tar.gz omptagger-84f0130910fd9e1bf5584f502c000a8b7044b487.tar.xz |
Use extensions; filemagic doesn't always work.
-rwxr-xr-x | omptagger | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -12,13 +12,11 @@ # Ruby http://www.ruby-lang.org/ # RubyGems http://rubygems.org/ # rtaglib http://rubygems.org/gems/rtaglib -# ruby-filemagic http://rubygems.org/gems/ruby-filemagic # TagLib http://developer.kde.org/~wheeler/taglib.html require 'getoptlong' require 'rubygems' require 'TagLib' -require 'filemagic' module Output @@colour = true @@ -90,9 +88,6 @@ See the man page for: end class Datum - @@mime = FileMagic.mime - @@mime.simplified = true - def initialize(filename) raise 'File does not exist.' unless File.exist?(filename) @@ -100,15 +95,15 @@ class Datum @filename = File.expand_path(filename) - case @@mime.file(@filename) - when 'audio/x-flac' + case File.extname(filename) + when '.flac' type = FLAC - when 'application/ogg' + when '.ogg' type = Vorbis - when 'audio/mpeg' + when '.mp3' type = MP3 else - raise 'File type not recognised.' + raise 'File extension not recognised.' end @metadata = type.new(@filename) |