tiegz-ruby-mtv 1.1 → 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -1,5 +1,13 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'rake/testtask'
3
4
  require 'rake/gempackagetask'
4
5
 
6
+ desc 'Run all tests by default'
7
+ task :default => :test
5
8
 
9
+ task :test do
10
+ Dir['test/**/*_test.rb'].all? do |file|
11
+ system("export DEBUG=true && ruby -Itest #{file}")
12
+ end or raise "Failures"
13
+ end
data/TODO CHANGED
@@ -1,4 +1,3 @@
1
1
  - Fix edge cases where no string is passed to a #find, #browse, #search, etc. method
2
2
  - Add request cacheing
3
- - Add specs (with mock requests)
4
- - Better rdocs
3
+ - Allow fake or real requests during tests
data/lib/mtv/artist.rb CHANGED
@@ -6,16 +6,29 @@ module MTV
6
6
  #-----------------
7
7
  # Class Methods
8
8
  #-----------------
9
+
9
10
  class << self
10
- # MTV::Artist.browse 'x' => X, X-Clan, The X-Ecutioners, Xiren, Xscape, Xtreme, Xzibit
11
+ # Browse all artists by a single letter.
12
+ #
13
+ # ==== Examples
14
+ #
15
+ # MTV::Artist.browse('x')
16
+ # > [#<MTV::Artist name: "X">, #<MTV::Artist name: "X-Clan">, #<MTV::Artist name: "The X-Ecutioners">, ... ]
11
17
  def browse(letter='a')
12
18
  response = request "artist/browse/#{letter.to_s.first}/"
13
19
  raise Error, "That artist not found!" if response.nil? || response.empty?
14
20
  parse_many response
15
21
  end
16
-
17
- # MTV::Artist.find 'beck'
18
- # MTV::Artist.find 'meGADeath'
22
+
23
+ # Find an artist by their specific name. The name will be sanitized for the url, for example
24
+ # 'Dinosaur Jr.' becomes 'dinosaur_jr'.
25
+ #
26
+ # ==== Examples
27
+ #
28
+ # MTV::Artist.find('beck')
29
+ # > #<MTV::Artist name: "Beck">
30
+ # MTV::Artist.find('meGADeath')
31
+ # > #<MTV::Artist name: "Megadeath">
19
32
  def find(name, options={})
20
33
  return name if name.is_a? Artist
21
34
 
@@ -26,9 +39,13 @@ module MTV
26
39
  raise Error, "That artist not found!" if response.nil? || response.empty?
27
40
  parse_one response
28
41
  end
29
-
30
- # MTV::Artist.related 'qtip'
31
- # MTV::Artist.related MTV::Artist.find('qtip')
42
+
43
+ # Finds any related artists, given an artist or artist name.
44
+ #
45
+ # ==== Examples
46
+ #
47
+ # MTV::Artist.related('Q Tip')
48
+ # > [#<MTV::Artist name: "Allure">, #<MTV::Artist name: "Beastie Boys">, #<MTV::Artist name: "Busta Rhymes">, ... ]
32
49
  def related(artist)
33
50
  artist = find(artist)
34
51
  response = request "artist/#{artist.uid}/related/"
@@ -36,7 +53,17 @@ module MTV
36
53
  parse_many response
37
54
  end
38
55
 
39
- # MTV::Artist.search 'beck', :max_results => 1, :start_index => 1
56
+ # Search all artists.
57
+ #
58
+ # ==== Attributes
59
+ #
60
+ # * +term+ - The search term to find an artist
61
+ # * +options+ - <tt>:max_results</tt> and/or <tt>:start_index</tt> for pagination.
62
+ #
63
+ # ==== Examples
64
+ #
65
+ # MTV::Artist.search('Beck', :max_results => 1, :start_index => 1)
66
+ # > [#<MTV::Artist name: "Beck">]
40
67
  def search(term=nil, options={})
41
68
  options.symbolize_keys!
42
69
  params = {}
@@ -49,13 +76,19 @@ module MTV
49
76
  parse_many response
50
77
  end
51
78
 
52
- # MTV::Artist.find('beck').videos
79
+ # Returns a list of MTV::Video instances that are by the given artist.
80
+ #
81
+ # ==== Examples
82
+ #
83
+ # MTV::Artist.videos('buggles')
84
+ # > [#<MTV::Video title: "Video Killed The Radio Star", artist_uri: "http://api.mtvnservices.com/1/artist/buggles/">]
53
85
  def videos(artist)
54
86
  MTV::Video.from_artist(artist)
55
87
  end
56
88
 
57
89
  protected
58
- def parse_many(body)
90
+ # Parses a response xml string for artists.
91
+ def parse_many(body) # :nodoc:
59
92
  entries = XmlSimple.xml_in(body)['entry']
60
93
  raise Error, "That artist not found!" if entries.nil?
61
94
  entries = [entries] unless entries.is_a? Array
@@ -64,9 +97,11 @@ module MTV
64
97
  }.reject { |artist| MTV::Artist.name.nil? || MTV::Artist.name.empty? }
65
98
  end
66
99
 
67
- def parse_one(body)
100
+ # Parses a response xml string for an artist.
101
+ def parse_one(body) # :nodoc:
68
102
  entry = XmlSimple.xml_in(body)
69
- raise Error, "That artist not found!" if entry['author'].first['name'].nil? || entry['author'].first['name'].empty?
103
+ name = entry['author'].first['name'].first
104
+ raise Error, "That artist not found!" if name.nil? || name.empty?
70
105
  instantiate entry
71
106
  end
72
107
 
@@ -81,6 +116,12 @@ module MTV
81
116
  #-----------------
82
117
  # Instance Methods
83
118
  #-----------------
119
+
120
+ # Creates a new artist, setting all the given hash keys as attributes.
121
+ #
122
+ # ==== Attributes
123
+ #
124
+ # * +options+ - Possible attributes are <tt>name</tt>, <tt>uid</tt>, <tt>uri</tt>, <tt>links</tt>, <tt>updated</tt>
84
125
  def initialize(values={})
85
126
  super(values)
86
127
  self.uid = uri.gsub(self.class.base_url + "/artist", '').delete '/' unless @uri.nil?
@@ -91,20 +132,33 @@ module MTV
91
132
  "#<#{self.class} #{attrs}>"
92
133
  end
93
134
 
94
- # artist = MTV::Artist.search('In Flames')[2]
95
- # MTV::Artist.browse => I Am Ghost, IB3, INXS, Ice Cube, ...
135
+ # Searches for artists with the same first letter.
136
+ #
137
+ # ==== Examples
138
+ #
139
+ # MTV::Artist.find('Sonic Youth').browse
140
+ # > [#<MTV::Artist name: "The S.O.U.L. S.Y.S.T.E.M.">, #<MTV::Artist name: "S.T.U.N."> ... ]
96
141
  def browse
97
142
  @browse ||= Artist.browse(uid.first)
98
143
  end
99
144
 
100
- # artist = MTV::Artist.search 'Frank Zappa'
101
- # MTV::Artist.browse => Amon Amarth, Amorphis, Arch Enemy, Arcturus, Borknagar, ...
145
+ # Searchs for related artists.
146
+ #
147
+ # ==== Examples
148
+ #
149
+ # MTV::Artist.find('Sonic Youth').related
150
+ # > [#<MTV::Artist name: "Beck">, #<MTV::Artist name: "Big Black">, #<MTV::Artist name: "Blonde Redhead"> ... ]
102
151
  def related
103
152
  @related ||= Artist.related(self)
104
153
  end
105
154
 
106
- # artist = MTV::Artist.find('beck')
107
- # MTV::Artist.videos => ...
155
+
156
+ # Returns all <tt>MTV::Video</tt>s for this artist.
157
+ #
158
+ # ==== Examples
159
+ #
160
+ # MTV::Artist.find('Sonic Youth').videos
161
+ # > [#<MTV::Video title: "Incinerate", artist_uri: "http://api.mtvnservices.com/1/artist/sonic_youth/"> ... ]
108
162
  def videos
109
163
  @videos ||= Video.from_artist(self)
110
164
  end
data/lib/mtv/base.rb CHANGED
@@ -21,7 +21,7 @@ module MTV
21
21
  protected
22
22
  # assuming that the uid for the artist is downcase and no spaces, this tries to match better
23
23
  def string_to_uid(str)
24
- str.downcase.underscore.gsub(" ", "_")
24
+ str.downcase.underscore.gsub(" ", "_").gsub(".", "")
25
25
  end
26
26
  end
27
27
 
data/lib/mtv/video.rb CHANGED
@@ -10,8 +10,15 @@ module MTV
10
10
  #-----------------
11
11
  # Class Methods
12
12
  #-----------------
13
+
13
14
  class << self
14
- # MTV::Video.find '1234abcd'
15
+ # Finds a video based on its unique id. It is unlike the intuitive <tt>MTV::Artist.uid</tt>, so
16
+ # you usually have to find a video's uid first through a search or through the artist.
17
+ #
18
+ # ==== Examples
19
+ #
20
+ # MTV::Video.find 'hznHivqrbHHDGDAW'
21
+ # > #<MTV::Video title: "Loser", artist_uri: "http://api.mtvnservices.com/1/artist/beck/">
15
22
  def find(uid, options={})
16
23
  return uid if uid.is_a? Artist
17
24
 
@@ -19,22 +26,38 @@ module MTV
19
26
  uid = options[:uid] || uid
20
27
 
21
28
  response = request "video/#{uid}/"
29
+ response = hack_empty_response_case(response)
22
30
  raise Error, "That video not found!" if response.nil? || response.empty?
23
31
  parse_one response
24
32
  end
25
33
 
26
- # MTV::Video.from_artist(Artist.find('beck'))
27
- # MTV::Video.from_artist('beck')
34
+ # Finds all videos from a given artist or artist name.
35
+ #
36
+ # ==== Examples
37
+ #
38
+ # MTV::Video.from_artist(MTV::Artist.find('beck'))
39
+ # > #<MTV::Video title: "Gamma Ray", artist_uri: "http://api.mtvnservices.com/1/artist/beck/"> ... ]
40
+ # MTV::Video.from_artist('beck')
41
+ # > #<MTV::Video title: "Gamma Ray", artist_uri: "http://api.mtvnservices.com/1/artist/beck/"> ... ]
28
42
  def from_artist(artist)
29
43
  artist_uid = artist.is_a?(Artist) ? artist.uid : string_to_uid(artist)
30
44
 
31
- response = request "artist/#{artist_uid}/videos"
45
+ response = request "artist/#{artist_uid}/videos/"
32
46
  raise Error, "No videos found!" if response.nil? || response.empty?
33
47
  parse_many response
34
48
  end
35
49
 
36
- # http://api.mtvnservices.com/1/video/search/[parameters]
37
- # MTV::Video.search 'the golden age', :max_results => 1, :start_index => 1
50
+ # Returns an array of videos that match a given search term.
51
+ #
52
+ # ==== Attributes
53
+ #
54
+ # * +term+ - The search term to find a video
55
+ # * +options+ - <tt>:max_results</tt> and/or <tt>:start_index</tt> for pagination.
56
+ #
57
+ # ==== Examples
58
+ #
59
+ # MTV::Video.search 'the golden age', :max_results => 1, :start_index => 1
60
+ # > [#<MTV::Video title: "The Golden Age", artist_uri: "http://api.mtvnservices.com/1/artist/beck/">]
38
61
  def search(term=nil, options={})
39
62
  options.symbolize_keys!
40
63
  params = { :'max-results' => (options[:max_results] || 1),
@@ -48,9 +71,11 @@ module MTV
48
71
  end
49
72
 
50
73
  protected
51
- def parse_many(body)
74
+ # Parses a response xml string for videos.
75
+ def parse_many(body) # :nodoc:
52
76
  body = hack_media_enclosures(body)
53
77
  entries = XmlSimple.xml_in(body)['entry']
78
+ raise Error, "That video not found!" if entries.nil?
54
79
  entries = [entries] unless entries.is_a? Array
55
80
  entries.reject! { |entry| entry.nil? }
56
81
  entries.map { |entry|
@@ -58,16 +83,25 @@ module MTV
58
83
  }
59
84
  end
60
85
 
61
- def parse_one(body)
86
+ # Parses a response xml string for a video.
87
+ def parse_one(body) # :nodoc:
62
88
  body = hack_media_enclosures(body)
63
89
  entry = XmlSimple.xml_in(body)
64
- raise Error, "That artist not found!" if entry['author']['name'].nil? || entry['author']['name'].empty?
90
+ artist_name = entry['author'].first['name'].first
91
+ raise Error, "That video not found!" if artist_name.nil? || artist_name.empty?
65
92
  instantiate entry
66
93
  end
67
94
 
95
+ # HACK the 'video not found' response is just an xml processing instruction, which kills
96
+ # XMLSimple, so let's delete it for now and return empty string.
97
+ # TODO keep eye out for new MTV error responses
98
+ def hack_empty_response_case(response) # :nodoc:
99
+ response.strip.gsub('<?xml version="1.0" encoding="iso-8859-1"?>', '').empty? ? "" : response
100
+ end
101
+
68
102
  # HACK because XmlSimple doesn't seem to handle enclosures, we'll replace colons with hyphens
69
103
  # TODO write a better regexp for that hack :\
70
- def hack_media_enclosures(body)
104
+ def hack_media_enclosures(body) # :nodoc:
71
105
  body.gsub("<media:", "<media_").gsub("</media:", "</media_")
72
106
  end
73
107
 
@@ -75,7 +109,7 @@ module MTV
75
109
  Video.new(:title => entry['title'].to_s,
76
110
  :artist_uri => entry['author'].first['uri'].to_s,
77
111
  :artist_name => entry['author'].first['name'].to_s,
78
- :published => entry['published'].to_s,
112
+ :published => entry['published'].first.to_s,
79
113
  :content => entry['content'], # Artist Name, Video Title, and Record Label
80
114
  :uri => entry['link'].select { |link| link['rel'].to_s == 'self' }.first['href'].to_s,
81
115
  :updated => (entry['updated'].to_s.to_datetime rescue nil),
@@ -87,7 +121,7 @@ module MTV
87
121
  :media_keywords => entry['media_keywords'].to_s,
88
122
  :media_medium => entry['media_content'].first['medium'].to_s,
89
123
  :media_player_url => entry['media_player'].first['url'].to_s,
90
- :media_thumbnails => entry['media_thumbnail'].to_s,
124
+ :thumbnails => entry['media_thumbnail'],
91
125
  :media_title => entry['media_title'].to_s,
92
126
  :media_type => entry['media_content'].first['type'].to_s,
93
127
  :media_url => entry['media_content'].first['url'].to_s)
@@ -97,18 +131,44 @@ module MTV
97
131
  #-----------------
98
132
  # Instance Methods
99
133
  #-----------------
134
+
135
+ # Creates a new video, setting all the given hash keys as attributes.
136
+ #
137
+ # ==== Attributes
138
+ #
139
+ # * +options+ - Possible attributes are <tt>title</tt>, <tt>artist_uri</tt>, <tt>artist_name</tt>,
140
+ # <tt>published</tt>, <tt>content</tt>, <tt>uri</tt>, <tt>updated</tt>, <tt>media_category</tt>,
141
+ # <tt>media_credits</tt>, <tt>media_description</tt>, <tt>media_duration</tt>, <tt>media_expression</tt>,
142
+ # <tt>media_keywords</tt>, <tt>media_medium</tt>, <tt>media_player_url</tt>, <tt>media_thumbnails</tt>,
143
+ # <tt>media_title</tt>, <tt>media_type</tt>, <tt>media_url</tt>
100
144
  def initialize(values={})
101
145
  super(values)
102
146
  self.uid = uri.gsub(self.class.base_url + "/video", '').delete '/' unless @uid
103
147
  self.vid = media_url.split(':').last
104
148
  end
105
149
 
106
- # MTV::Video.search('gold').first.artist
150
+ # Returns the artist object for the video.
151
+ #
152
+ # ==== Examples
153
+ #
154
+ # MTV::Video.search('mellow gold').first.artist
155
+ # > #<MTV::Artist name: "Beck">
107
156
  def artist
108
157
  @artist ||= Artist.find(artist_uri.gsub(self.class.base_url + "/artist", '').delete('/'))
109
158
  end
110
159
 
111
- # HTML to embed the Flash player for this video
160
+ # Returns HTML to embed the Flash player for this video anywhere
161
+ #
162
+ # ==== Attributes
163
+ #
164
+ # * +options+ - Takes a combination of <tt>width</tt> and/or <tt>height</tt> for the Flash player
165
+ # to specify a certain size (if one is given, the ratio will be calculated for the other value)
166
+ #
167
+ # ==== Examples
168
+ #
169
+ # MTV::Video.search('mellow gold').first.embed_code
170
+ # MTV::Video.search('mellow gold').first.embed_code(:width => 100)
171
+ # MTV::Video.search('mellow gold').first.embed_code(:width => 57, :height => 943)
112
172
  def embed_code(options={})
113
173
  options[:width] ||= (options[:height] ? ((options[:height]*448).to_f/366).to_i : 448)
114
174
  options[:height] ||= (options[:width]==448 ? 366 : ((options[:width]*366).to_f/448).to_i)
@@ -123,8 +183,19 @@ module MTV
123
183
  attrs = [:title, :artist_uri].map { |name| "#{name}: #{attribute_for_inspect(name)}" }.compact.join(", ")
124
184
  "#<#{self.class} #{attrs}>"
125
185
  end
126
-
127
- def thumbnails=(val)
186
+
187
+ # Returns an array of thumbnails for this video.
188
+ #
189
+ # ==== Examples
190
+ #
191
+ # MTV::Video.search('mellow gold').first.thumbnails
192
+ # > [#<MTV::Thumbnail:0x184e274 @width="70", @height="53", @url="http://www.mtv.com/shared/promoimages/bands/b/beck/video_stills/loser/loser_70x53.jpg"> ... ]
193
+ def thumbnails
194
+ @thumbnails
195
+ end
196
+
197
+ # Parses the video thumbnails and sets them into an array.
198
+ def thumbnails=(val) # :nodoc:
128
199
  @thumbnails = (val.is_a?(Array) ? val : [val]).map { |t| Thumbnail.new(t['url'], t['width'], t['height']) unless t.nil? }
129
200
  end
130
201
  end
data/ruby-mtv.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ruby-mtv"
3
- s.version = "1.1"
3
+ s.version = "1.2"
4
4
  s.date = "2008-10-27"
5
5
  s.summary = "Ruby wrapper library for MTV api"
6
- s.email = "tiegzaharia@gmail.com"
6
+ s.email = "tieg.zaharia+github@gmail.com"
7
7
  s.homepage = "http://github.com/tiegz/ruby-mtv"
8
8
  s.description = "ruby-mtv is a Ruby library for accessing Artist and Video objects through the MTVN api."
9
9
  s.has_rdoc = true
@@ -18,7 +18,21 @@ Gem::Specification.new do |s|
18
18
  "lib/mtv/base.rb",
19
19
  "lib/mtv/thumbnail.rb",
20
20
  "lib/mtv/video.rb"]
21
- s.test_files = []
21
+ s.test_files = ["test/test_helper.rb",
22
+ "test/unit/artist_test.rb",
23
+ "test/unit/base_test.rb",
24
+ "test/unit/video_test.rb",
25
+ "test/fixtures/artist_find_beck.xml",
26
+ "test/fixtures/artist_find_some_fake_name.xml",
27
+ "test/fixtures/artist_related_beck.xml",
28
+ "test/fixtures/artist_search_alexanderthegreat.xml",
29
+ "test/fixtures/artist_search_beck.xml",
30
+ "test/fixtures/artist_videos_beck.xml",
31
+ "test/fixtures/video_find_foobar.xml",
32
+ "test/fixtures/video_find_hznHivqrbHHDGDZX.xml",
33
+ "test/fixtures/video_from_artist_dinosaur_jr.xml",
34
+ "test/fixtures/video_search_somelongcrazynameforavideo.xml",
35
+ "test/fixtures/video_search_video_killed_the_radio_star.xml"]
22
36
  s.rdoc_options = ["--main", "README"]
23
37
  s.extra_rdoc_files = ["README"]
24
38
  s.add_dependency("active-support", ["> 2.0.2"])
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
4
+ <id>http://api.mtvnservices.com/1/artist/beck/</id>
5
+ <updated>2008-10-27T16:16:25.207-04:00</updated>
6
+ <title>Beck</title>
7
+ <author>
8
+ <name>Beck</name>
9
+ <uri>http://api.mtvnservices.com/1/artist/beck/</uri>
10
+ </author>
11
+ <link rel="self" type="application/atom+xml"
12
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
13
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/videos"
14
+ type="application/atom+xml"
15
+ href="http://api.mtvnservices.com/1/artist/beck/videos/"/>
16
+
17
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/related"
18
+ type="application/atom+xml"
19
+ href="http://api.mtvnservices.com/1/artist/beck/related/"/>
20
+ <content/>
21
+ <media:thumbnail url="http://www.mtv.com/shared/media/images/artist/b/beck/az_official/376x180.jpg"
22
+ height="180"
23
+ width="376"/>
24
+ <media:thumbnail url="http://www.mtv.com/shared/media/images/artist/b/beck/dms/288x162.jpg"
25
+ height="162"
26
+ width="288"/>
27
+ <media:thumbnail url="http://www.mtv.com/shared/media/images/artist/b/beck/dms/92x52.jpg"
28
+ height="52"
29
+ width="92"/>
30
+ </entry>
31
+
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
4
+ <id>http://api.mtvnservices.com/1/artist/</id>
5
+ <updated>2008-10-27T16:01:47.351-04:00</updated>
6
+ <title/>
7
+ <author>
8
+ <name/>
9
+ <uri>http://api.mtvnservices.com/1/artist/</uri>
10
+ </author>
11
+ <link rel="self" type="application/atom+xml"
12
+ href="http://api.mtvnservices.com/1/artist/"/>
13
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/related"
14
+ type="application/atom+xml"
15
+ href="http://api.mtvnservices.com/1/artist/related/"/>
16
+ <content/>
17
+ </entry>
@@ -0,0 +1,55 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <feed xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:atom="http://www.w3.org/2005/Atom"
5
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
6
+ xmlns="http://www.w3.org/2005/Atom">
7
+ <id>http://api.mtvnservices.com/1/artist/beck/related/</id>
8
+ <updated>2008-10-27T16:16:43.335-04:00</updated>
9
+ <title>Beck Related Artists</title>
10
+ <author>
11
+ <name>MTV Networks Content API</name>
12
+ <uri>http://api.mtvnservices.com/1/</uri>
13
+ </author>
14
+ <link rel="self" type="application/atom+xml"
15
+ href="http://api.mtvnservices.com/1/artist/beck/related/"/>
16
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
17
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
18
+
19
+ <link rel="related" type="application/atom+xml"
20
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
21
+ <entry>
22
+ <id>http://api.mtvnservices.com/1/artist/</id>
23
+ <updated>2008-10-27T16:16:43.335-04:00</updated>
24
+ <title/>
25
+ <author>
26
+ <name/>
27
+ <uri>http://api.mtvnservices.com/1/artist/</uri>
28
+ </author>
29
+ <link rel="self" type="application/atom+xml"
30
+ href="http://api.mtvnservices.com/1/artist/"/>
31
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/related"
32
+ type="application/atom+xml"
33
+ href="http://api.mtvnservices.com/1/artist/related/"/>
34
+ <content/>
35
+ </entry>
36
+ <entry>
37
+
38
+ <id>http://api.mtvnservices.com/1/artist/air/</id>
39
+ <updated>2008-10-27T16:16:43.335-04:00</updated>
40
+ <title>Air</title>
41
+ <author>
42
+ <name>Air</name>
43
+ <uri>http://api.mtvnservices.com/1/artist/air/</uri>
44
+ </author>
45
+ <link rel="self" type="application/atom+xml"
46
+ href="http://api.mtvnservices.com/1/artist/air/"/>
47
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/videos"
48
+ type="application/atom+xml"
49
+ href="http://api.mtvnservices.com/1/artist/air/videos/"/>
50
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/related"
51
+ type="application/atom+xml"
52
+ href="http://api.mtvnservices.com/1/artist/air/related/"/>
53
+ <content/>
54
+ </entry>
55
+ </feed>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <feed xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:atom="http://www.w3.org/2005/Atom"
5
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
6
+ xmlns="http://www.w3.org/2005/Atom">
7
+ <id>http://api.mtvnservices.com/1/artist/search/</id>
8
+ <updated>2008-10-27T16:46:02.635-04:00</updated>
9
+ <title>MTVN Content API artist search for "alexanderthegreat"</title>
10
+ <link rel="self" type="application/atom+xml"
11
+ href="http://api.mtvnservices.com/1/artist/search/?term=alexanderthegreat"/>
12
+ </feed>
13
+
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <feed xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:atom="http://www.w3.org/2005/Atom"
5
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
6
+ xmlns="http://www.w3.org/2005/Atom">
7
+ <id>http://api.mtvnservices.com/1/artist/search/</id>
8
+ <updated>2008-10-27T16:35:22.569-04:00</updated>
9
+ <title>MTVN Content API artist search for "beck"</title>
10
+ <link rel="self" type="application/atom+xml"
11
+ href="http://api.mtvnservices.com/1/artist/search/?term=beck"/>
12
+ <entry>
13
+ <id>http://api.mtvnservices.com/1/artist/beck/</id>
14
+ <updated>2008-10-27T16:35:22.569-04:00</updated>
15
+ <title>Beck</title>
16
+
17
+ <author>
18
+ <name>Beck</name>
19
+ <uri>http://api.mtvnservices.com/1/artist/beck/</uri>
20
+ </author>
21
+ <link rel="self" type="application/atom+xml"
22
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
23
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/related"
24
+ type="application/atom+xml"
25
+ href="http://api.mtvnservices.com/1/artist/beck/related/"/>
26
+ <content/>
27
+ </entry>
28
+ <entry>
29
+ <id>http://api.mtvnservices.com/1/artist/stephanie_beck_williams/</id>
30
+ <updated>2008-10-27T16:35:22.569-04:00</updated>
31
+ <title>Stephanie Beck Williams</title>
32
+
33
+ <author>
34
+ <name>Stephanie Beck Williams</name>
35
+ <uri>http://api.mtvnservices.com/1/artist/stephanie_beck_williams/</uri>
36
+ </author>
37
+ <link rel="self" type="application/atom+xml"
38
+ href="http://api.mtvnservices.com/1/artist/stephanie_beck_williams/"/>
39
+ <link rel="http://api.mtvnservices.com/1/schemas/artist/related"
40
+ type="application/atom+xml"
41
+ href="http://api.mtvnservices.com/1/artist/stephanie_beck_williams/related/"/>
42
+ <content/>
43
+ </entry>
44
+ </feed>
45
+
@@ -0,0 +1,158 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <feed xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:atom="http://www.w3.org/2005/Atom"
5
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
6
+ xmlns="http://www.w3.org/2005/Atom">
7
+ <id>http://api.mtvnservices.com/1/artist/beck/videos/</id>
8
+ <updated>2008-10-27T16:38:28.364-04:00</updated>
9
+ <title>Beck Videos</title>
10
+ <link rel="self" type="application/atom+xml"
11
+ href="http://api.mtvnservices.com/1/artist/beck/videos/"/>
12
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
13
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
14
+ <entry>
15
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHZSWADD/</id>
16
+ <published>2008-08-12T00:00:00.000-04:00</published>
17
+ <updated>2008-10-27T16:38:28.364-04:00</updated>
18
+
19
+ <title>Gamma Ray</title>
20
+ <content>Beck | Gamma Ray | Interscope</content>
21
+ <link rel="self" type="application/atom+xml"
22
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHZSWADD/"/>
23
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
24
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
25
+ <author>
26
+ <name>Beck</name>
27
+ <uri>http://api.mtvnservices.com/1/artist/beck/</uri>
28
+ </author>
29
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:265411"
30
+ duration="0"
31
+ type="application/x-shockwave-flash"
32
+ medium="video"
33
+ isDefault="true"
34
+ expression="full"/>
35
+ <media:player url="http://www.mtv.com/overdrive/?vid=265411"/>
36
+ <media:title>Gamma Ray</media:title>
37
+ <media:description>Beck | Gamma Ray | Interscope</media:description>
38
+
39
+ <media:thumbnail url="http://www.vh1.com/shared/promoimages/bands/b/beck/gamma_ray/70x53.jpg"
40
+ height="53"
41
+ width="70"/>
42
+ <media:thumbnail url="http://www.vh1.com/shared/promoimages/bands/b/beck/gamma_ray/84x77.jpg"
43
+ height="77"
44
+ width="84"/>
45
+ <media:thumbnail url="http://www.vh1.com/shared/promoimages/bands/b/beck/gamma_ray/140x105.jpg"
46
+ height="105"
47
+ width="140"/>
48
+ <media:thumbnail url="http://www.vh1.com/shared/promoimages/bands/b/beck/gamma_ray/281x211.jpg"
49
+ height="211"
50
+ width="281"/>
51
+ <media:thumbnail url="http://www.vh1.com/shared/promoimages/bands/b/beck/gamma_ray/320x240.jpg"
52
+ height="240"
53
+ width="320"/>
54
+ <media:restriction type="country" relationship="allow">US </media:restriction>
55
+ <media:keywords><![CDATA[Beck, Gamma Ray, Modern Guilt, Autumn deWilde]]></media:keywords>
56
+ <media:credit role="director" scheme="urn:ebu">Autumn deWilde</media:credit>
57
+ <media:credit role="artist/performer" scheme="urn:ebu">Beck</media:credit>
58
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">3</media:category>
59
+ </entry>
60
+ <entry>
61
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHZSDZGW/</id>
62
+
63
+ <published>2008-07-28T00:00:00.000-04:00</published>
64
+ <updated>2008-10-27T16:38:28.364-04:00</updated>
65
+ <title>Orphans</title>
66
+ <content>Beck | Orphans | </content>
67
+ <link rel="self" type="application/atom+xml"
68
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHZSDZGW/"/>
69
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
70
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
71
+ <author>
72
+ <name>Beck</name>
73
+ <uri>http://api.mtvnservices.com/1/artist/beck/</uri>
74
+ </author>
75
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:261285"
76
+ duration="0"
77
+ type="application/x-shockwave-flash"
78
+ medium="video"
79
+ isDefault="true"
80
+ expression="full"/>
81
+
82
+ <media:player url="http://www.mtv.com/overdrive/?vid=261285"/>
83
+ <media:title>Orphans</media:title>
84
+ <media:description>Beck | Orphans | </media:description>
85
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/b/beck/orphans/70x53.jpg"
86
+ height="53"
87
+ width="70"/>
88
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/b/beck/orphans/84x77.jpg"
89
+ height="77"
90
+ width="84"/>
91
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/b/beck/orphans/140x105.jpg"
92
+ height="105"
93
+ width="140"/>
94
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/b/beck/orphans/281x211.jpg"
95
+ height="211"
96
+ width="281"/>
97
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/b/beck/orphans/320x240.jpg"
98
+ height="240"
99
+ width="320"/>
100
+ <media:restriction type="country" relationship="allow">US </media:restriction>
101
+ <media:keywords><![CDATA[Beck,Orphans]]></media:keywords>
102
+ <media:credit role="director" scheme="urn:ebu"/>
103
+ <media:credit role="artist/performer" scheme="urn:ebu">Beck</media:credit>
104
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">6</media:category>
105
+
106
+ </entry>
107
+ <entry>
108
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHDDPSXZ/</id>
109
+ <published>2006-11-06T00:00:00.000-05:00</published>
110
+ <updated>2008-10-27T16:38:28.364-04:00</updated>
111
+ <title>Think I'm in Love</title>
112
+ <content>Beck | Think I'm in Love | Universal/Polydor</content>
113
+ <link rel="self" type="application/atom+xml"
114
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHDDPSXZ/"/>
115
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
116
+ href="http://api.mtvnservices.com/1/artist/beck/"/>
117
+ <author>
118
+ <name>Beck</name>
119
+
120
+ <uri>http://api.mtvnservices.com/1/artist/beck/</uri>
121
+ </author>
122
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:117632"
123
+ duration="0"
124
+ type="application/x-shockwave-flash"
125
+ medium="video"
126
+ isDefault="true"
127
+ expression="full"/>
128
+ <media:player url="http://www.mtv.com/overdrive/?vid=117632"/>
129
+ <media:title>Think I'm in Love</media:title>
130
+ <media:description>Beck | Think I'm in Love | Universal/Polydor</media:description>
131
+ <media:thumbnail url="http://www.mtv.com/bands/b/beck/thumbnails/Think_Im_In_Love70x53.jpg"
132
+ height="53"
133
+ width="70"/>
134
+ <media:thumbnail url="http://www.vh1la.com/bands/b/beck/think_im_in_love_82x55.jpg" height="55"
135
+ width="82"/>
136
+ <media:thumbnail url="http://www.vh1.com/sitewide/promoimages/artists/b/beck/v_spot/think_im_in_love/84x77.jpg"
137
+ height="77"
138
+ width="84"/>
139
+ <media:thumbnail url="http://www.mtv.com/bands/b/beck/thumbnails/Think_Im_In_Love140x105.jpg"
140
+ height="105"
141
+ width="140"/>
142
+ <media:thumbnail url="http://www.mtv.com/bands/b/beck/thumbnails/Think_Im_In_Love140x211.jpg"
143
+ height="211"
144
+ width="140"/>
145
+ <media:thumbnail url="http://www.mtv.com/bands/b/beck/thumbnails/Think_Im_In_Love281x105.jpg"
146
+ height="105"
147
+ width="281"/>
148
+ <media:thumbnail url="http://www.mtv.com/bands/b/beck/thumbnails/Think_Im_In_Love281x211.jpg"
149
+ height="211"
150
+ width="281"/>
151
+ <media:restriction type="country" relationship="allow">CA US </media:restriction>
152
+
153
+ <media:keywords><![CDATA[Beck, Think I'm in Love, Beck Hansen]]></media:keywords>
154
+ <media:credit role="director" scheme="urn:ebu">Beck Hansen</media:credit>
155
+ <media:credit role="artist/performer" scheme="urn:ebu">Beck</media:credit>
156
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">3</media:category>
157
+ </entry>
158
+ </feed>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
4
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHDGDZX/</id>
5
+ <published>2002-09-11T00:00:00.000-04:00</published>
6
+ <updated>2008-10-27T17:14:28.328-04:00</updated>
7
+ <title>Video Killed The Radio Star</title>
8
+ <content>The Buggles | Video Killed The Radio Star | Island Records</content>
9
+ <link rel="self" type="application/atom+xml"
10
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHDGDZX/"/>
11
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
12
+ href="http://api.mtvnservices.com/1/artist/buggles/"/>
13
+ <author>
14
+ <name>The Buggles</name>
15
+
16
+ <uri>http://api.mtvnservices.com/1/artist/buggles/</uri>
17
+ </author>
18
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:18123"
19
+ duration="210"
20
+ type="application/x-shockwave-flash"
21
+ medium="video"
22
+ isDefault="true"
23
+ expression="full"/>
24
+ <media:player url="http://www.mtv.com/overdrive/?vid=18123"/>
25
+ <media:title>Video Killed The Radio Star</media:title>
26
+ <media:description>The Buggles | Video Killed The Radio Star | Island Records</media:description>
27
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_70x5.jpg"
28
+ height="53"
29
+ width="70"/>
30
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_82x5.jpg"
31
+ height="55"
32
+ width="82"/>
33
+ <media:thumbnail url="http://www.vh1.com/sitewide/promoimages/artists/b/buggles_the/vspot/video_killed_the_radio_star/84x77.jpg"
34
+ height="77"
35
+ width="84"/>
36
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_star.jpg"
37
+ height="105"
38
+ width="140"/>
39
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_281x.jpg"
40
+ height="211"
41
+ width="281"/>
42
+ <media:thumbnail url="http://www.vh1.com/sitewide/promoimages/artists/b/buggles_the/vspot/video_killed_the_radio_star/320x240.jpg"
43
+ height="240"
44
+ width="320"/>
45
+ <media:keywords><![CDATA[The Buggles, Video Killed The Radio Star]]></media:keywords>
46
+ <media:credit role="director" scheme="urn:ebu"/>
47
+
48
+ <media:credit role="artist/performer" scheme="urn:ebu">The Buggles</media:credit>
49
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">3</media:category>
50
+ </entry>
51
+
@@ -0,0 +1,140 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <feed xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:atom="http://www.w3.org/2005/Atom"
5
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
6
+ xmlns="http://www.w3.org/2005/Atom">
7
+ <id>http://api.mtvnservices.com/1/artist/dinosaur_jr/videos/</id>
8
+ <updated>2008-10-28T12:23:06.044-04:00</updated>
9
+ <title>Dinosaur Jr. Videos</title>
10
+ <link rel="self" type="application/atom+xml"
11
+ href="http://api.mtvnservices.com/1/artist/dinosaur_jr/videos/"/>
12
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
13
+ href="http://api.mtvnservices.com/1/artist/dinosaur_jr/"/>
14
+ <entry>
15
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHDAXBAZ/</id>
16
+ <published>2007-04-13T00:00:00.000-04:00</published>
17
+ <updated>2008-10-28T12:23:06.044-04:00</updated>
18
+
19
+ <title>Been There All the Time</title>
20
+ <content>Dinosaur Jr. | Been There All the Time | Fat Possum Records</content>
21
+ <link rel="self" type="application/atom+xml"
22
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHDAXBAZ/"/>
23
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
24
+ href="http://api.mtvnservices.com/1/artist/dinosaur_jr/"/>
25
+ <author>
26
+ <name>Dinosaur Jr.</name>
27
+ <uri>http://api.mtvnservices.com/1/artist/dinosaur_jr/</uri>
28
+ </author>
29
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:143042"
30
+ duration="250"
31
+ type="application/x-shockwave-flash"
32
+ medium="video"
33
+ isDefault="true"
34
+ expression="full"/>
35
+ <media:player url="http://www.mtv.com/overdrive/?vid=143042"/>
36
+ <media:title>Been There All the Time</media:title>
37
+ <media:description>Dinosaur Jr. | Been There All the Time | Fat Possum Records</media:description>
38
+
39
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/d/dinosaur_jr/been_there_all_the_time/70x53.jpg"
40
+ height="53"
41
+ width="70"/>
42
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/d/dinosaur_jr/been_there_all_the_time/84x77.jpg"
43
+ height="77"
44
+ width="84"/>
45
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/d/dinosaur_jr/been_there_all_the_time/140x105.jpg"
46
+ height="105"
47
+ width="140"/>
48
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/d/dinosaur_jr/been_there_all_the_time/281x211.jpg"
49
+ height="211"
50
+ width="281"/>
51
+ <media:thumbnail url="http://www.mtv.com/shared/promoimages/bands/d/dinosaur_jr/been_there_all_the_time/320x240.jpg"
52
+ height="240"
53
+ width="320"/>
54
+ <media:keywords><![CDATA[Dinosaur Jr., Been There All The Time]]></media:keywords>
55
+ <media:credit role="director" scheme="urn:ebu"/>
56
+ <media:credit role="artist/performer" scheme="urn:ebu">Dinosaur Jr.</media:credit>
57
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">6</media:category>
58
+ </entry>
59
+ <entry>
60
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHWGWBB/</id>
61
+ <published>2005-08-23T00:00:00.000-04:00</published>
62
+
63
+ <updated>2008-10-28T12:23:06.044-04:00</updated>
64
+ <title>I Don't Think So</title>
65
+ <content>Dinosaur Jr. | I Don't Think So | Sire/Reprise Records</content>
66
+ <link rel="self" type="application/atom+xml"
67
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHWGWBB/"/>
68
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
69
+ href="http://api.mtvnservices.com/1/artist/dinosaur_jr/"/>
70
+ <author>
71
+ <name>Dinosaur Jr.</name>
72
+ <uri>http://api.mtvnservices.com/1/artist/dinosaur_jr/</uri>
73
+ </author>
74
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:58500"
75
+ duration="213"
76
+ type="application/x-shockwave-flash"
77
+ medium="video"
78
+ isDefault="true"
79
+ expression="full"/>
80
+ <media:player url="http://www.mtv.com/overdrive/?vid=58500"/>
81
+ <media:title>I Don't Think So</media:title>
82
+
83
+ <media:description>Dinosaur Jr. | I Don't Think So | Sire/Reprise Records</media:description>
84
+ <media:thumbnail url="http://www.mtv.com/bands/d/dinosaur_jr/thumbnails/i_dont_think70x53.jpg"
85
+ height="53"
86
+ width="70"/>
87
+ <media:thumbnail url="http://www.mtv.com/bands/d/dinosaur_jr/thumbnails/i_dont_think82x55.jpg"
88
+ height="55"
89
+ width="82"/>
90
+ <media:thumbnail url="http://www.mtv.com/bands/d/dinosaur_jr/thumbnails/i_dont_think140x105.jpg"
91
+ height="105"
92
+ width="140"/>
93
+ <media:thumbnail url="http://www.mtv.com/bands/d/dinosaur_jr/thumbnails/i_dont_think281x211.jpg"
94
+ height="211"
95
+ width="281"/>
96
+ <media:restriction type="country" relationship="allow">US </media:restriction>
97
+ <media:keywords><![CDATA[ Dinosaur Jr., I Don't Think, Greg Stump]]></media:keywords>
98
+ <media:credit role="director" scheme="urn:ebu">Greg Stump</media:credit>
99
+ <media:credit role="artist/performer" scheme="urn:ebu">Dinosaur Jr.</media:credit>
100
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">1</media:category>
101
+ </entry>
102
+ <entry>
103
+
104
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHWXGNP/</id>
105
+ <published>2005-07-07T00:00:00.000-04:00</published>
106
+ <updated>2008-10-28T12:23:06.044-04:00</updated>
107
+ <title>The Wagon</title>
108
+ <content>Dinosaur Jr. | The Wagon | Sire/Warner Bros. Records</content>
109
+ <link rel="self" type="application/atom+xml"
110
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHWXGNP/"/>
111
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
112
+ href="http://api.mtvnservices.com/1/artist/dinosaur_jr/"/>
113
+ <author>
114
+ <name>Dinosaur Jr.</name>
115
+ <uri>http://api.mtvnservices.com/1/artist/dinosaur_jr/</uri>
116
+
117
+ </author>
118
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:53897"
119
+ duration="194"
120
+ type="application/x-shockwave-flash"
121
+ medium="video"
122
+ isDefault="true"
123
+ expression="full"/>
124
+ <media:player url="http://www.mtv.com/overdrive/?vid=53897"/>
125
+ <media:title>The Wagon</media:title>
126
+ <media:description>Dinosaur Jr. | The Wagon | Sire/Warner Bros. Records</media:description>
127
+ <media:thumbnail url="http://www.mtv.com/bands/d/dinosaur_jr/thumbnails/the_wagon70x53.jpg"
128
+ height="53"
129
+ width="70"/>
130
+ <media:thumbnail url="http://www.mtv.com/bands/d/dinosaur_jr/thumbnails/the_wagon140x105.jpg"
131
+ height="105"
132
+ width="140"/>
133
+ <media:restriction type="country" relationship="allow">US </media:restriction>
134
+ <media:keywords><![CDATA[Dinosaur Jr., The Wagon]]></media:keywords>
135
+ <media:credit role="director" scheme="urn:ebu"/>
136
+ <media:credit role="artist/performer" scheme="urn:ebu">Dinosaur Jr.</media:credit>
137
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">1</media:category>
138
+
139
+ </entry>
140
+ </feed>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <feed xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:atom="http://www.w3.org/2005/Atom"
5
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
6
+ xmlns="http://www.w3.org/2005/Atom">
7
+ <id>http://api.mtvnservices.com/1/video/search/</id>
8
+ <updated>2008-10-27T17:00:59.729-04:00</updated>
9
+ <title>MTVN Content API video search for "somelongcrazynameforavideo"</title>
10
+ <link rel="self" type="application/atom+xml"
11
+ href="http://api.mtvnservices.com/1/video/search/?term=somelongcrazynameforavideo"/>
12
+ </feed>
13
+
@@ -0,0 +1,91 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+
3
+ <feed xmlns:media="http://search.yahoo.com/mrss/"
4
+ xmlns:atom="http://www.w3.org/2005/Atom"
5
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
6
+ xmlns="http://www.w3.org/2005/Atom">
7
+ <id>http://api.mtvnservices.com/1/video/search/</id>
8
+ <updated>2008-10-27T16:59:50.917-04:00</updated>
9
+ <title>MTVN Content API video search for "video killed the radio star"</title>
10
+ <link rel="self" type="application/atom+xml"
11
+ href="http://api.mtvnservices.com/1/video/search/?term=video%20killed%20the%20radio%20star"/>
12
+ <entry>
13
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHDGDZX/</id>
14
+ <published/>
15
+ <updated>2008-10-27T16:59:50.917-04:00</updated>
16
+ <title>Video Killed The Radio Star</title>
17
+
18
+ <content>The Buggles | Video Killed The Radio Star | Island Records</content>
19
+ <link rel="self" type="application/atom+xml"
20
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHDGDZX/"/>
21
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
22
+ href="http://api.mtvnservices.com/1/artist/buggles/"/>
23
+ <author>
24
+ <name>The Buggles</name>
25
+ <uri>http://api.mtvnservices.com/1/artist/buggles/</uri>
26
+ </author>
27
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:18123"
28
+ duration="210"
29
+ type="application/x-shockwave-flash"
30
+ medium="video"
31
+ isDefault="true"
32
+ expression="full"/>
33
+ <media:player url="http://www.mtv.com/overdrive/?vid=18123"/>
34
+ <media:title>Video Killed The Radio Star</media:title>
35
+ <media:description>The Buggles | Video Killed The Radio Star | Island Records</media:description>
36
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_70x5.jpg"
37
+ height="53"
38
+ width="70"/>
39
+
40
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_82x5.jpg"
41
+ height="55"
42
+ width="82"/>
43
+ <media:thumbnail url="http://www.vh1.com/sitewide/promoimages/artists/b/buggles_the/vspot/video_killed_the_radio_star/84x77.jpg"
44
+ height="77"
45
+ width="84"/>
46
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_star.jpg"
47
+ height="105"
48
+ width="140"/>
49
+ <media:thumbnail url="http://www.mtv.com/bands/b/buggles_the/video_killed_the_radio_281x.jpg"
50
+ height="211"
51
+ width="281"/>
52
+ <media:thumbnail url="http://www.vh1.com/sitewide/promoimages/artists/b/buggles_the/vspot/video_killed_the_radio_star/320x240.jpg"
53
+ height="240"
54
+ width="320"/>
55
+ <media:keywords><![CDATA[The Buggles, Video Killed The Radio Star]]></media:keywords>
56
+ <media:credit role="director" scheme="urn:ebu"/>
57
+ <media:credit role="artist/performer" scheme="urn:ebu">The Buggles</media:credit>
58
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">3</media:category>
59
+ </entry>
60
+ <entry>
61
+ <id>http://api.mtvnservices.com/1/video/hznHivqrbHHWGNBD/</id>
62
+ <published/>
63
+ <updated>2008-10-27T16:59:50.917-04:00</updated>
64
+
65
+ <title>Video Killed The Radio Star</title>
66
+ <content>Presidents of the United States of America | Video Killed The Radio Star | Maverick Recording Company/New Line Productions, Inc.</content>
67
+ <link rel="self" type="application/atom+xml"
68
+ href="http://api.mtvnservices.com/1/video/hznHivqrbHHWGNBD/"/>
69
+ <link rel="http://api.mtvnservices.com/1/schemas/artist" type="application/atom+xml"
70
+ href="http://api.mtvnservices.com/1/artist/presidents_of_the_united_states_of_america/"/>
71
+ <author>
72
+ <name>Presidents of the United States of America</name>
73
+ <uri>http://api.mtvnservices.com/1/artist/presidents_of_the_united_states_of_america/</uri>
74
+ </author>
75
+ <media:content url="http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:58901"
76
+ duration="191"
77
+ type="application/x-shockwave-flash"
78
+ medium="video"
79
+ isDefault="true"
80
+ expression="full"/>
81
+ <media:player url="http://www.mtv.com/overdrive/?vid=58901"/>
82
+ <media:title>Video Killed The Radio Star</media:title>
83
+ <media:description>Presidents of the United States of America | Video Killed The Radio Star | Maverick Recording Company/New Line Productions, Inc.</media:description>
84
+
85
+ <media:keywords><![CDATA[Presidents of the United States of America, Video Killed The Radio Star]]></media:keywords>
86
+ <media:credit role="director" scheme="urn:ebu">Joe Perota</media:credit>
87
+ <media:credit role="artist/performer" scheme="urn:ebu">Presidents of the United States of America</media:credit>
88
+ <media:category scheme="urn:mtvn:governing_agreement" label="Governing Agreement">1</media:category>
89
+ </entry>
90
+ </feed>
91
+
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'fake_web'
4
+ require 'open-uri'
5
+ require File.dirname(__FILE__) + '/../lib/mtv'
6
+
7
+ def enable_fake_web
8
+ dir = File.dirname(__FILE__)
9
+
10
+ # Artist fixtures
11
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/artist/some_fake_name/', :string => File.read("#{dir}/fixtures/artist_find_some_fake_name.xml"))
12
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/artist/search?term=beck&max-results=2', :string => File.read("#{dir}/fixtures/artist_search_beck.xml"))
13
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/artist/search?term=alexanderthegreat&max-results=1', :string => File.read("#{dir}/fixtures/artist_search_alexanderthegreat.xml"))
14
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/artist/beck/', :string => File.read("#{dir}/fixtures/artist_find_beck.xml"))
15
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/artist/beck/related/', :string => File.read("#{dir}/fixtures/artist_related_beck.xml"))
16
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/artist/beck/videos/', :string => File.read("#{dir}/fixtures/artist_videos_beck.xml"))
17
+
18
+ # Video fixtures
19
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/video/hznHivqrbHHDGDZX', :string => File.read("#{dir}/fixtures/video_find_hznHivqrbHHDGDZX.xml"))
20
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/video/foobar', :string => File.read("#{dir}/fixtures/video_find_foobar.xml"))
21
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/video/search?term=somelongcrazynameforavideo&max-results=1', :string => File.read("#{dir}/fixtures/video_search_somelongcrazynameforavideo.xml"))
22
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/video/search?term=video+killed+the+radio+star&max-results=2', :string => File.read("#{dir}/fixtures/video_search_video_killed_the_radio_star.xml"))
23
+ FakeWeb.register_uri('http://api.mtvnservices.com/1/artist/dinosaur_jr/videos/', :string => File.read("#{dir}/fixtures/video_from_artist_dinosaur_jr.xml"))
24
+ end
25
+
26
+ def disable_fake_web
27
+ FakeWeb.clean_registry
28
+ end
29
+
@@ -0,0 +1,53 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ # MTV::Artist.debug = true
4
+
5
+ enable_fake_web
6
+
7
+ class TestArtist < Test::Unit::TestCase
8
+ def test_browse
9
+ a = MTV::Artist.browse('x')
10
+ assert a.all? { |_| _.is_a? MTV::Artist }
11
+ assert a.any? { |_| _.name == 'X' }
12
+ end
13
+
14
+ def test_find_succeeds
15
+ a = MTV::Artist.find('Beck')
16
+ assert a.is_a?(MTV::Artist)
17
+ assert_equal a.name, 'Beck'
18
+ end
19
+
20
+ def test_find_succeeds_with_period_and_space_in_name
21
+ a = MTV::Artist.find('Dinosaur Jr.')
22
+ assert a.is_a?(MTV::Artist)
23
+ assert_equal a.name, 'Dinosaur Jr.'
24
+ assert_equal a.uid, 'dinosaur_jr'
25
+ end
26
+
27
+ def test_find_fails
28
+ assert_raises(MTV::Error) { MTV::Artist.find('Some Fake Name') }
29
+ end
30
+
31
+ def test_related
32
+ a = MTV::Artist.related 'Beck'
33
+ assert a.any? { |_| _.name == 'Air' }
34
+ end
35
+
36
+ def test_search_succeeds
37
+ a = MTV::Artist.search 'beck', :max_results => 2
38
+ assert_equal 2, a.size
39
+ assert a.any? { |_| _.name == 'Beck' }
40
+ end
41
+
42
+ def test_search_fails
43
+ assert_raises(MTV::Error) { MTV::Artist.search('alexanderthegreat') }
44
+ end
45
+
46
+ def test_videos
47
+ v = MTV::Artist.videos('Beck')
48
+ assert v.all? { |_| _.is_a?(MTV::Video) }
49
+ assert v.all? { |_| _.artist_name == 'Beck' }
50
+ assert v.any? { |_| _.title == 'Gamma Ray' }
51
+ end
52
+
53
+ end
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class Foobar < MTV::Base
4
+ attr_accessor :foo, :bar, :baz
5
+ end
6
+
7
+ class TestBase < Test::Unit::TestCase
8
+
9
+ def test_new_should_set_hash_of_attributes
10
+ f = Foobar.new(:foo => '123', :bar => 'abc')
11
+ assert_equal '123', f.foo
12
+ assert_equal 'abc', f.bar
13
+ assert_nil f.baz
14
+ end
15
+
16
+ end
@@ -0,0 +1,53 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ # MTV::Video.debug = true
4
+
5
+ enable_fake_web
6
+
7
+ class TestVideo < Test::Unit::TestCase
8
+ def test_search_succeeds
9
+ a = MTV::Video.search 'video killed the radio star', :max_results => 2
10
+ assert_equal 2, a.size
11
+ assert a.any? { |_| _.artist_name == 'The Buggles' && _.title == 'Video Killed The Radio Star' }
12
+ end
13
+
14
+ def test_search_fails
15
+ assert_raises(MTV::Error) { MTV::Video.search('somelongcrazynameforavideo') }
16
+ end
17
+
18
+ def test_find_succeeds
19
+ a = MTV::Video.find('hznHivqrbHHDGDZX') # the uid
20
+ assert a.is_a?(MTV::Video)
21
+ assert_equal a.title, 'Video Killed The Radio Star'
22
+ assert_equal a.artist_name, 'The Buggles'
23
+ end
24
+
25
+ def test_find_fails
26
+ assert_raises(MTV::Error) { MTV::Video.find('foobar') }
27
+ end
28
+
29
+ def test_from_artist_succeeds
30
+ v = MTV::Video.from_artist('Dinosaur Jr.')
31
+ assert v.all? { |_| _.artist_name == 'Dinosaur Jr.' }
32
+ assert v.any? { |_| _.title == 'Been There All the Time' }
33
+ end
34
+
35
+ def test_embed_code
36
+ v = MTV::Video.from_artist('Dinosaur Jr.').first
37
+ e = v.embed_code
38
+ assert e =~ /width="448" height="366"/
39
+ assert e =~ /src="#{v.media_url}" type="#{v.media_type}"/
40
+
41
+ e = v.embed_code(:width => 314, :height => 839)
42
+ assert e =~ /width="314" height="839"/
43
+ end
44
+
45
+ def test_thumbnails
46
+ v = MTV::Video.from_artist('Dinosaur Jr.').first
47
+ assert v.thumbnails.all? { |_| _.is_a?(MTV::Thumbnail) }
48
+ assert v.thumbnails.all? { |_| !_.width.nil? }
49
+ assert v.thumbnails.all? { |_| !_.height.nil? }
50
+ assert v.thumbnails.all? { |_| !_.url.nil? }
51
+ end
52
+ end
53
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiegz-ruby-mtv
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.1"
4
+ version: "1.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tieg Zaharia
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: 2.0.2
23
23
  version:
24
24
  description: ruby-mtv is a Ruby library for accessing Artist and Video objects through the MTVN api.
25
- email: tiegzaharia@gmail.com
25
+ email: tieg.zaharia+github@gmail.com
26
26
  executables: []
27
27
 
28
28
  extensions: []
@@ -67,5 +67,19 @@ rubygems_version: 1.2.0
67
67
  signing_key:
68
68
  specification_version: 2
69
69
  summary: Ruby wrapper library for MTV api
70
- test_files: []
71
-
70
+ test_files:
71
+ - test/test_helper.rb
72
+ - test/unit/artist_test.rb
73
+ - test/unit/base_test.rb
74
+ - test/unit/video_test.rb
75
+ - test/fixtures/artist_find_beck.xml
76
+ - test/fixtures/artist_find_some_fake_name.xml
77
+ - test/fixtures/artist_related_beck.xml
78
+ - test/fixtures/artist_search_alexanderthegreat.xml
79
+ - test/fixtures/artist_search_beck.xml
80
+ - test/fixtures/artist_videos_beck.xml
81
+ - test/fixtures/video_find_foobar.xml
82
+ - test/fixtures/video_find_hznHivqrbHHDGDZX.xml
83
+ - test/fixtures/video_from_artist_dinosaur_jr.xml
84
+ - test/fixtures/video_search_somelongcrazynameforavideo.xml
85
+ - test/fixtures/video_search_video_killed_the_radio_star.xml