Sha256: d122893ee8bbd347c1a4c167f82026871692db5d9e3e3da3d7043d043977a1d1
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true unless ARGV.size == 1 warn "#{File.basename(__FILE__)}: Missing required parameter for the mp3 file to process" exit(1) end require 'mp3info' begin file_name = ARGV.first puts "Listing tags for file: #{file_name}" # rubocop:disable Metrics/BlockLength # rubocop:disable Lint/EmptyWhen Mp3Info.open(file_name) do |mp3info| puts 'ID3v1 tags:' mp3info.tag.each_key do |key| puts " #{key} => #{mp3info.tag.send(key)}" end puts puts 'ID3v2 tags:' mp3info.tag2.each_key do |key| case key when 'PIC' when 'APIC' # picture - do not print binary data when 'ULT' print ' ULT => ' block_counter = 0 mp3info.tag2.ULT.bytes do |b| # rubocop:disable Style/FormatStringToken print format('0x%02x ', b.to_i) # rubocop:enable Style/FormatStringToken print b > 31 ? " '#{b.chr}' " : ' ' * 5 if (block_counter += 1) > 7 # display in blocks of 8 bytes puts print ' ' * 9 block_counter = 0 end end puts else puts " #{key} => #{mp3info.tag2.send(key)}" end end end # rubocop:enable Metrics/BlockLength # rubocop:enable Lint/EmptyWhen puts "Modification date: #{File.new(file_name).mtime}" rescue StandardError puts "Error: #{$ERROR_INFO.message}" exit(1) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dropcaster-1.1.0 | bin/lstags |