#!/usr/bin/env ruby
require 'taglib'
if ARGV[0] == "--prefix"
puts "#EXTM3U"
ARGV.shift
end
ARGV.each do |file|
TagLib::FileRef.open(file) do |ref|
next unless ref
tag = ref.tag
props = ref.audio_properties
puts "#EXTINF:#{props.length},#{tag.artist} - #{tag.title.sub(/\[.*?\]/, '')}"
puts file
end
end