mpc 0.9 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mpc/song.rb ADDED
@@ -0,0 +1,14 @@
1
+ class Mpc::Song
2
+
3
+ def initialize(options)
4
+ @options = options
5
+ end
6
+
7
+ def to_s
8
+ if @options[:Artist].empty? || @options[:Title].empty?
9
+ @options[:file]
10
+ else
11
+ "#{@options[:Artist]} - #{@options[:Title]}"
12
+ end
13
+ end
14
+ end
data/lib/mpc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- module Mpc
2
- VERSION = "0.9"
1
+ class Mpc
2
+ VERSION = "0.9.1"
3
3
  end
data/lib/mpc.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "socket"
2
+ require "mpc/song"
2
3
  class Mpc
3
4
 
4
5
  @@regexps = {
@@ -87,6 +88,11 @@ class Mpc
87
88
  set_volume(volume.to_i - 20)
88
89
  end
89
90
 
91
+ def current_song
92
+ options = to_hash(send_command("currentsong"))
93
+ Song.new(options)
94
+ end
95
+
90
96
  private
91
97
 
92
98
  def get_volume
data/mpc.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "mpc"
16
16
 
17
- s.add_dependency("rubytree")
17
+ # s.add_dependency("rubytree")
18
18
 
19
19
  s.add_development_dependency("mocha")
20
20
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mpc
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.9"
5
+ version: 0.9.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Micha\xC5\x82 Krzy\xC5\xBCanowski"
@@ -13,28 +13,17 @@ cert_chain: []
13
13
  date: 2011-08-04 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: rubytree
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
25
- type: :runtime
26
- version_requirements: *id001
27
16
  - !ruby/object:Gem::Dependency
28
17
  name: mocha
29
18
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
19
+ requirement: &id001 !ruby/object:Gem::Requirement
31
20
  none: false
32
21
  requirements:
33
22
  - - ">="
34
23
  - !ruby/object:Gem::Version
35
24
  version: "0"
36
25
  type: :development
37
- version_requirements: *id002
26
+ version_requirements: *id001
38
27
  description: Ruby MPD client
39
28
  email:
40
29
  - michal.krzyzanowski+github@gmail.com
@@ -49,6 +38,7 @@ files:
49
38
  - Gemfile
50
39
  - Rakefile
51
40
  - lib/mpc.rb
41
+ - lib/mpc/song.rb
52
42
  - lib/mpc/version.rb
53
43
  - mpc.gemspec
54
44
  - test/mpc_test.rb