musicbrainz_ruby 0.0.4 → 0.0.5

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/lib/music_brainz.rb CHANGED
@@ -2,34 +2,16 @@ require "musicbrainz/version"
2
2
  require "net/http"
3
3
  require "uri"
4
4
  require 'json'
5
+ $: << File.dirname(__FILE__)
5
6
 
6
7
  module MusicBrainz
7
8
 
8
- class Base
9
- def self.get_path(method, mbid, query)
10
-
11
- path="/ws/2/#{method}/#{mbid}?inc=#{query}"
12
- uri_host="musicbrainz.org"
13
- uri_port="80"
14
- http = Net::HTTP.new(uri_host, uri_port).get(path)
15
- response = http.response.code
16
- body = http.response.body
17
-
18
- body=Hash.from_xml(body)
19
- if response=="200"
20
- return body
21
- else
22
- return false
23
- end
24
-
25
-
26
- end
27
-
28
- def self.release_getInfo(mbid)
29
- query='recordings'
30
- get_path('release', {'mbid' => mbid}, query)
31
- end
32
-
33
-
34
- end
35
- end
9
+ end
10
+ require 'musicbrainz/base'
11
+ require 'musicbrainz/artist'
12
+ require 'musicbrainz/label'
13
+ require 'musicbrainz/recording'
14
+ require 'musicbrainz/release'
15
+ require 'musicbrainz/release_group'
16
+ require 'musicbrainz/version'
17
+ require 'musicbrainz/work'
File without changes
@@ -0,0 +1,25 @@
1
+ module MusicBrainz
2
+ class Base
3
+
4
+ def self.get(method, mbid, query)
5
+
6
+ includes="?inc=#{query}" unless query==[]
7
+
8
+ path="/ws/2/#{method}/#{mbid}#{includes}"
9
+ uri_host="musicbrainz.org"
10
+ uri_port="80"
11
+ http = Net::HTTP.new(uri_host, uri_port).get(path)
12
+ response = http.response.code
13
+ body = http.response.body
14
+
15
+ body=Hash.from_xml(body)
16
+ if response=="200"
17
+ return body
18
+ else
19
+ return false
20
+ end
21
+
22
+
23
+ end
24
+ end
25
+ end
File without changes
File without changes
@@ -0,0 +1,19 @@
1
+ module MusicBrainz
2
+ class Release
3
+ def self.get_tracks(mbid, query=[])
4
+ @mbid=mbid
5
+ if query.present? && query!=[]
6
+ @query=query.join("+")
7
+ else
8
+ @query='recordings'
9
+ end
10
+ MusicBrainz::Base.get('release', @mbid, @query)
11
+ end
12
+
13
+ def inspect
14
+ "currently querying #{@query} with an mbid #{@mbid}"
15
+ end
16
+
17
+
18
+ end
19
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module MusicBrainz
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: musicbrainz_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -24,7 +24,14 @@ files:
24
24
  - README.md
25
25
  - Rakefile
26
26
  - lib/music_brainz.rb
27
+ - lib/musicbrainz/artist.rb
28
+ - lib/musicbrainz/base.rb
29
+ - lib/musicbrainz/label.rb
30
+ - lib/musicbrainz/recording.rb
31
+ - lib/musicbrainz/release.rb
32
+ - lib/musicbrainz/release_group.rb
27
33
  - lib/musicbrainz/version.rb
34
+ - lib/musicbrainz/work.rb
28
35
  - musicbrainz.gemspec
29
36
  homepage: http://ror.caged-media.com
30
37
  licenses: []