mpc 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/mpc.rb +1 -2
  2. data/test/mpc_test.rb +40 -0
  3. metadata +4 -4
data/lib/mpc.rb CHANGED
@@ -125,9 +125,8 @@ class Mpc
125
125
  end
126
126
 
127
127
  def ping
128
- song = current_song
129
128
  unless status[:state] == "stop"
130
- output = {:song_time=>song[:time],:time=>status[:time].split(":").first,:artist=>song[:artist],:title=>song[:title],:file=>song[:file],:album=>song[:album],:id=>song[:id]}
129
+ output = {:song_time=>current_song[:Time],:time=>status[:time].split(":").first,:artist=>current_song[:Artist],:title=>current_song[:Title],:file=>current_song[:file],:album=>current_song[:Album],:id=>current_song[:Id]}
131
130
  else
132
131
  output = {:song_time=>0,:time=>0,:artist=>nil,:title=>nil,:file=>nil,:album=>nil,:id=>nil}
133
132
  end
data/test/mpc_test.rb CHANGED
@@ -146,4 +146,44 @@ class MpcTest < Test::Unit::TestCase
146
146
  expected_output << {:playlist => "nowa"}
147
147
  assert_equal(expected_output,@mpc.list_playlists)
148
148
  end
149
+
150
+ test "ping method should return hash with informations about song" do
151
+ @mpc.stubs(:current_song).returns({
152
+ :Date=> "2001",
153
+ :Id=> "23",
154
+ :Title=> "ToNieMy",
155
+ :file=> "Paktofonika - Kinematografia/ToNieMy.mp3",
156
+ :Time=> "227",
157
+ :Album=> "Kinematografia",
158
+ :Track=> "6",
159
+ :Pos=> "5",
160
+ :Genre=> "Hip-Hop",
161
+ :Artist=> "Paktofonika"} )
162
+ @mpc.stubs(:status).returns({
163
+ :bitrate=> "128",
164
+ :song=> "5",
165
+ :volume=> "-1",
166
+ :audio=> "44100:24:2",
167
+ :consume=> "0",
168
+ :repeat=> "0",
169
+ :nextsong=> "6",
170
+ :time=> "102:227",
171
+ :playlist=> "54",
172
+ :state=> "play",
173
+ :playlistlength=> "23",
174
+ :nextsongid=> "24",
175
+ :xfade=> "0",
176
+ :random=> "0",
177
+ :songid=> "23",
178
+ :single=> "0"})
179
+ expected_output = {
180
+ :title=>"ToNieMy",
181
+ :file=>"Paktofonika - Kinematografia/ToNieMy.mp3",
182
+ :artist=>"Paktofonika",
183
+ :album=>"Kinematografia",
184
+ :song_time=>"227",
185
+ :id=>"23",
186
+ :time=>"102"}
187
+ assert_equal(expected_output,@mpc.ping)
188
+ end
149
189
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
9
- version: "0.5"
8
+ - 6
9
+ version: "0.6"
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Micha\xC5\x82 Krzy\xC5\xBCanowski"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-11 00:00:00 +02:00
17
+ date: 2010-08-12 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency