From 84f0130910fd9e1bf5584f502c000a8b7044b487 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 7 Nov 2010 15:26:51 -0800 Subject: Use extensions; filemagic doesn't always work. --- omptagger | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'omptagger') diff --git a/omptagger b/omptagger index 83c055a..722f66c 100755 --- a/omptagger +++ b/omptagger @@ -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) -- cgit v1.2.3-70-g09d2