Skip to content

Instantly share code, notes, and snippets.

@tastycode
Created September 30, 2011 06:09
Show Gist options
  • Save tastycode/1252835 to your computer and use it in GitHub Desktop.
Save tastycode/1252835 to your computer and use it in GitHub Desktop.
Metahash Documentation
require 'metahash'
# Writing to a file
mh = Metahash::Metahash.new "path/to/beiber.mp3"
mh["id3:artist"] = "Dave Meowtthews"
# Reading the metadata
mh = Metahash::Metahash.new "path/to/beiber.mp3"
puts mh.to_h
# It acts just like a hash
puts mh["id3:artist"]
# Unlike exif/id3 it can handle more complex structures
mh["genres"] = ["rap","hip-hop technofunk"]
mh["album"] = {
:title => "Dark side of the moon",
:year => 2003
}
mh["references"] = {
:soundcloud => "http://www.soundcloud.com/kultiv8tor"
}
# Unlike XMP, Its not made by a corporate monster and full of XML nightmare-fuel
# (No way to demonstrate this in code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment