Sha256: cfb3e298e05c42c7eeebba27ad84cbaf356eeef643911ca1f7271f3c3f573a2d

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby

unless ARGV.size == 1
  STDERR.puts "#{File.basename(__FILE__)}: Missing required parameter for the mp3 file to process"
  exit(1)
end

require 'rubygems'
require 'mp3info'

begin
  file_name = ARGV.first

  puts "Listing tags for file: #{file_name}"

  Mp3Info.open(file_name) do |mp3info|
    puts 'ID3v1 tags:'
    mp3info.tag.keys.each{|key|
      puts "  #{key} => #{mp3info.tag.send(key)}"
    }
    puts
    puts 'ID3v2 tags:'
    mp3info.tag2.keys.each{|key|
      case key
        when 'PIC'
        when 'APIC'
          # picture - do not print binary data
        when 'ULT'
          print "  ULT => "
          block_counter = 0
          mp3info.tag2.ULT.bytes{|b|
            print "0x%02x " % b.to_i
            print b > 31 ? " '#{b.chr}' " : " " * 5
            if (block_counter += 1) > 7 # display in blocks of 8 bytes
              puts
              print " " * 9
              block_counter = 0
            end
          }
          puts
        else
          puts "  #{key} => #{mp3info.tag2.send(key)}"
      end
    }
  end
  puts "Modification date: #{File.new(file_name).mtime}"

rescue
  puts "Error: #{$!.message}"
  exit(1)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dropcaster-0.0.8 bin/lstags
dropcaster-0.0.7 bin/lstags
dropcaster-0.0.6 bin/lstags
dropcaster-0.0.5 bin/lstags
dropcaster-0.0.5.rc3 bin/lstags
dropcaster-0.0.5.rc1 bin/lstags