On 9/17/07, Konrad Meyer <konrad / tylerc.org> wrote:
> Quoth Ilmari Heikkinen:
> > find $MEDIA_LIBRARY_DIR -type f | \
> > mplayer -identify -ao null -vo null -frames 0 -playlist - | \
> > grep ID_CLIP_INFO_NAME | sed 's/^.*=//' | sort | uniq
> >
> > (replace $MEDIA_LIBRARY_DIR with the directory name)
> >

> I'd love to run that but mplayer dies rather early on on some of my files.

Hmm, here's a ruby version that should work through those:

media_dir = "music"
seen_names = {}
mpc = "mplayer -identify -ao null -vo null -frames 0 -playlist - 2>/dev/null"
Dir["#{media_dir}/**/*"].each{|fn|
  if File.file?(fn)
    IO.popen(mpc, "r+"){|mp|
      begin
        mp.puts fn
        mp.close_write
        tags = mp.read.strip.split("\n").grep(/^ID_CLIP_INFO_NAME/)
        names = tags.map{|t| t.split("=", 2)[1] }
        names.each{|n|
          seen_names[n] ||= (puts n; true)
        }
      rescue
      end
    }
  end
}

> I'd guess one of the libraries you're using for parsing is giving back 40
> as a genre or track number (a bit high, but might be tagged wrong) and it
> needs to be converted to a string before you can use it.

Good catch, thanks. Fixed.
http://dark.fhtr.org/repos/metadata/metadata-0.9.tar.gz


>
> Thanks!
> --
> Konrad Meyer <konrad / tylerc.org> http://konrad.sobertillnoon.com/
>
>