kschrader / ruby-mtv forked from tiegz/ruby-mtv

A Ruby library for the newly borne MTV Networks api.

This URL has Read+Write access

README
ruby-mtv
    by Tieg Zaharia
    http://github.com/tiegz/ruby-mtv
 
== DESCRIPTION:
 
This is a Ruby library for the MTV Networks api. Right now it has classes for Artists, Videos and Genres, 
although there is much to be done! It currently parses the default ATOM response format.
 
== REQUIREMENTS:
 
* ActiveSupport
* Hpricot

== INSTALL:
 
  $ gem sources -a http://gems.github.com/ (you only need to do this once)
  $ gem install tiegz-ruby-mtv
 
== USAGE:

Require the gem...

  require 'tiegz-ruby-mtv'

To find an artist,

  artist = MTV::Artist.search('dinosaur jr').first
  # => #<MTV::Artist name: "Dinosaur Jr.", uid: "dinosaur_jr", uri: "http://api.mtvnservices.com/1/artist/dinosaur_jr/">

  
To find related artists,

  artist.related
  # => [#<MTV::Artist name: "Afghan Whigs", uid: "afghan_whigs", uri: 
  "http://api.mtvnservices.com/1/artist/afghan_whigs/">, 
        #<MTV::Artist name: "The Breeders", uid: "breeders", uri: "http://api.mtvnservices.com/1/artist/breeders/">, ... 
        ]

To find a video,

  video = MTV::Video.search('dinosaur jr').first
  # => #<MTV::Video title: "Been There All the Time", uid: "hznHivqrbHHDAXBAZ", artist_name: "Dinosaur Jr.", 
                    uri: "http://api.mtvnservices.com/1/video/hznHivqrbHHDAXB...", 
                    artist_uri: "http://api.mtvnservices.com/1/artist/dinosaur_jr/">
  v.artist
  # => #<MTV::Artist name: "Dinosaur Jr.", uid: "dinosaur_jr", uri: "http://api.mtvnservices.com/1/artist/dinosaur_jr/">

  
To get html embed markup for the video swf,

  v.embed_code(:width => 200)
  # => "<embed src=\"http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:143042\" 
               type=\"application/x-shockwave-flash\" width=\"200\" height=\"163\"
               allowFullScreen=\"true\" allowScriptAccess=\"always\" />"

To find all videos for an artist,

  artist.videos
  # => [#<MTV::Video title: ["Been There All the Time"], uid: "hznHivqrbHHDAXBAZ", artist_name: ["Dinosaur Jr."] ...>, 
  ... ] 

== RELEVANT LINKS

    MTVN api docs: http://developer.mtvnservices.com/docs