Created
September 30, 2011 06:09
-
-
Save tastycode/1252835 to your computer and use it in GitHub Desktop.
Metahash Documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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