gmusic 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +16 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +27 -0
- data/README.rdoc +3 -3
- data/Rakefile +2 -12
- data/VERSION +1 -1
- data/lib/gmusic.rb +2 -0
- data/lib/gmusic/parser.rb +1 -1
- data/spec/gmusic_spec.rb +4 -4
- data/spec/parser_spec.rb +1 -0
- data/spec/spec_helper.rb +4 -4
- metadata +80 -62
data/CHANGELOG
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
=== 0.2.1 / 2011-07-23
|
2
|
+
|
3
|
+
* song_list return by google has a tbody now
|
4
|
+
|
5
|
+
=== 0.2.0 / 2011-07-23
|
6
|
+
|
7
|
+
* use bundler to manage gems
|
8
|
+
* update to rspec 2
|
9
|
+
|
10
|
+
=== 0.1.0 / 2010-02-22
|
11
|
+
|
12
|
+
* Feature #56: parse the downloading related information of the song
|
13
|
+
* Feature #57: parse the lyrics of the song
|
14
|
+
* Feature #58: parse the search result
|
15
|
+
* Feature #59: provide a search API
|
16
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
hpricot (0.8.4)
|
7
|
+
jeweler (1.6.4)
|
8
|
+
bundler (~> 1.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
rake (0.9.2)
|
12
|
+
rspec (2.6.0)
|
13
|
+
rspec-core (~> 2.6.0)
|
14
|
+
rspec-expectations (~> 2.6.0)
|
15
|
+
rspec-mocks (~> 2.6.0)
|
16
|
+
rspec-core (2.6.4)
|
17
|
+
rspec-expectations (2.6.0)
|
18
|
+
diff-lcs (~> 1.1.2)
|
19
|
+
rspec-mocks (2.6.0)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
hpricot
|
26
|
+
jeweler
|
27
|
+
rspec
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= GMusic
|
2
2
|
|
3
|
-
GMusic provides APIs to search songs from http://music.g.cn.
|
3
|
+
GMusic provides a serias of APIs to search songs from http://music.g.cn. Title and aritist are supported now.
|
4
4
|
|
5
5
|
== SYNOPSIS:
|
6
6
|
|
@@ -16,8 +16,8 @@ GMusic provides APIs to search songs from http://music.g.cn. There are three que
|
|
16
16
|
|
17
17
|
== REQUIREMENTS:
|
18
18
|
|
19
|
-
* jeweler
|
20
|
-
* hpricot
|
19
|
+
* jeweler http://technicalpickles.github.com/jeweler
|
20
|
+
* hpricot http://github.com/whymirror/hpricot
|
21
21
|
|
22
22
|
== INSTALL:
|
23
23
|
|
data/Rakefile
CHANGED
@@ -20,20 +20,10 @@ rescue LoadError
|
|
20
20
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
21
|
end
|
22
22
|
|
23
|
-
require '
|
24
|
-
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
23
|
+
require 'rspec/core/rake_task'
|
24
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
27
25
|
end
|
28
26
|
|
29
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
34
|
-
|
35
|
-
task :spec => :check_dependencies
|
36
|
-
|
37
27
|
task :default => :spec
|
38
28
|
|
39
29
|
require 'rake/rdoctask'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1
|
1
|
+
0.2.1
|
data/lib/gmusic.rb
CHANGED
data/lib/gmusic/parser.rb
CHANGED
data/spec/gmusic_spec.rb
CHANGED
@@ -27,17 +27,17 @@ describe "Gmusic" do
|
|
27
27
|
songs.size.should == 1
|
28
28
|
end
|
29
29
|
|
30
|
-
it "should return
|
30
|
+
it "should return 6 full matched items" do
|
31
31
|
parsed = GMusic::SongListParser.parse path_of('g-search-thankyou.html')
|
32
32
|
dowload_info = GMusic::DownloadInfoParser.parse path_of('g-download.html')
|
33
33
|
lyrics = GMusic::LyricsParser.parse path_of('g-lyrics.html')
|
34
34
|
|
35
35
|
GMusic::SongListParser.should_receive(:parse).and_return(parsed)
|
36
|
-
GMusic::DownloadInfoParser.should_receive(:parse).exactly(
|
37
|
-
GMusic::LyricsParser.should_receive(:parse).exactly(
|
36
|
+
GMusic::DownloadInfoParser.should_receive(:parse).exactly(6).times.and_return(dowload_info)
|
37
|
+
GMusic::LyricsParser.should_receive(:parse).exactly(6).times.and_return(lyrics)
|
38
38
|
|
39
39
|
songs = GMusic.search(:title => 'thank you', :artist => 'dido')
|
40
40
|
|
41
|
-
songs.size.should ==
|
41
|
+
songs.size.should == 6
|
42
42
|
end
|
43
43
|
end
|
data/spec/parser_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
require 'rspec'
|
3
5
|
require 'gmusic'
|
4
|
-
require 'spec'
|
5
|
-
require 'spec/autorun'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.mock_with :rspec
|
9
9
|
end
|
10
10
|
|
11
11
|
def path_of(file)
|
metadata
CHANGED
@@ -1,60 +1,86 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmusic
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Tower He
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-02-22 00:00:00 +08:00
|
12
|
+
date: 2011-07-23 00:00:00.000000000 +08:00
|
18
13
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: jeweler
|
17
|
+
requirement: &85340560 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *85340560
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &85340250 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *85340250
|
37
|
+
- !ruby/object:Gem::Dependency
|
21
38
|
name: hpricot
|
39
|
+
requirement: &85339950 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :runtime
|
22
46
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
47
|
+
version_requirements: *85339950
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: hpricot
|
50
|
+
requirement: &85339680 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
31
55
|
version: 0.8.2
|
32
56
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rspec
|
36
57
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
58
|
+
version_requirements: *85339680
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rspec
|
61
|
+
requirement: &85339410 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
45
66
|
version: 1.2.9
|
46
67
|
type: :development
|
47
|
-
|
48
|
-
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *85339410
|
70
|
+
description: ! 'gmusic provides APIs to search songs from http://music.g.cn. There
|
71
|
+
are three query conditions supported by gmusic, which are title, artist and album
|
72
|
+
of a song. gmusic delivers query requests to Google and collects the search result
|
73
|
+
returned from Google. '
|
49
74
|
email: towerhe@gmail.com
|
50
75
|
executables: []
|
51
|
-
|
52
76
|
extensions: []
|
53
|
-
|
54
|
-
extra_rdoc_files:
|
77
|
+
extra_rdoc_files:
|
55
78
|
- LICENSE
|
56
79
|
- README.rdoc
|
57
|
-
files:
|
80
|
+
files:
|
81
|
+
- CHANGELOG
|
82
|
+
- Gemfile
|
83
|
+
- Gemfile.lock
|
58
84
|
- LICENSE
|
59
85
|
- README.rdoc
|
60
86
|
- Rakefile
|
@@ -67,34 +93,26 @@ files:
|
|
67
93
|
has_rdoc: true
|
68
94
|
homepage: http://github.com/towerhe/gmusic
|
69
95
|
licenses: []
|
70
|
-
|
71
96
|
post_install_message:
|
72
|
-
rdoc_options:
|
73
|
-
|
74
|
-
require_paths:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
75
99
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
- 0
|
89
|
-
version: "0"
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
90
112
|
requirements: []
|
91
|
-
|
92
113
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.3.
|
114
|
+
rubygems_version: 1.3.9.2
|
94
115
|
signing_key:
|
95
116
|
specification_version: 3
|
96
117
|
summary: Search songs from http://music.g.cn
|
97
|
-
test_files:
|
98
|
-
- spec/gmusic_spec.rb
|
99
|
-
- spec/parser_spec.rb
|
100
|
-
- spec/spec_helper.rb
|
118
|
+
test_files: []
|