ruby-mpd-client 0.0.1 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a5f269daaee86e7aae52ba8aaf7563405297cdd
4
- data.tar.gz: c67bfa95cb8bbd8d0098ca1a60138f27916f993a
3
+ metadata.gz: 848583ce10594fdc63bf86b171c48c4f46ca8fa6
4
+ data.tar.gz: 2d55bec022cdf89c6bade050070bf5913ab1105d
5
5
  SHA512:
6
- metadata.gz: ca6a6b9608feec8ff4d23724589f3b03942b4ed0274a3e2ec2eb61e30761923c76547060891fa5e6501fd756134482506bc27559f29af830a128a08d5ab203a4
7
- data.tar.gz: 63f2c58e74605215f01940d367ecde94ee93c1909cd3111b10a3d72cc3773668ef9da3bdc85b80b89c7fd1a68e2b7da7bd2d16f308a404e334d07c1d6ea07222
6
+ metadata.gz: ef433c38433b97d823de38aa187d07e88dad973584597d854d1abff2a45a27fa475b4071cbe2fd73681f7004937cbe38abac8623fe753e047397b5c9992cf60e
7
+ data.tar.gz: 26ae0891ec7de8fa3e534c1b87fc2b6bcdb2d67f3f5b86cba9b97cc16749438cabf4df81bc4fd23cef2bd563a2501bf1dc027dd4dfd4f336cf4c970281da8d43
data/lib/mpd/client.rb CHANGED
@@ -10,6 +10,10 @@ module MPD
10
10
  @connection = Connection.new(host: host, port: port)
11
11
  end
12
12
 
13
+ def current_song
14
+ execute('currentsong').to_h
15
+ end
16
+
13
17
  def status
14
18
  response = execute('status')
15
19
  response.to_h
@@ -26,7 +26,13 @@ module MPD
26
26
  end
27
27
 
28
28
  def key_value_pairs
29
- content.split("\n").map { |line| line.split.map(&:strip) }
29
+ content.split("\n").map do |line|
30
+ index = line.index(':')
31
+ raise "can't create key-value pair" unless index
32
+ key = line[0...index]
33
+ value = line[(index + 1)..-1].strip
34
+ [key, value]
35
+ end
30
36
  end
31
37
 
32
38
  # text without status
data/lib/mpd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MPD
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mpd-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Non