ruby-mpris 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS CHANGED
@@ -1,2 +1,7 @@
1
+ Version 0.1.1 (2008-04-27)
2
+ * Renamed base namespace from Mpris to MPRIS
3
+ * Fixed delete_track method
4
+ * Added delete_all method to tracklist
5
+
1
6
  Version 0.1.0 (2008-04-27)
2
7
  * Initial Release.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/rdoctask'
6
6
  require 'rake/testtask'
7
7
 
8
8
  NAME = "ruby-mpris"
9
- VERS = "0.1.0"
9
+ VERS = "0.1.1"
10
10
  CLEAN.include ['pkg', 'rdoc']
11
11
 
12
12
  Gem::manage_gems
@@ -12,7 +12,7 @@ $:.unshift File.dirname(__FILE__)+'/../lib'
12
12
  require 'mpris'
13
13
 
14
14
 
15
- mpris = Mpris.new
15
+ mpris = MPRIS.new
16
16
  puts "Checking capabilites:"
17
17
  puts " can_go_next?: #{mpris.player.can_go_next?}"
18
18
  puts " can_go_prev?: #{mpris.player.can_go_prev?}"
@@ -12,6 +12,6 @@ $:.unshift File.dirname(__FILE__)+'/../lib'
12
12
  require 'mpris'
13
13
 
14
14
 
15
- mpris = Mpris.new
15
+ mpris = MPRIS.new
16
16
  puts "Identity: #{mpris.identity}"
17
17
  puts "MPRIS API Version: #{mpris.mpris_version}"
@@ -12,5 +12,5 @@ $:.unshift File.dirname(__FILE__)+'/../lib'
12
12
  require 'mpris'
13
13
  require 'pp'
14
14
 
15
- mpris = Mpris.new
15
+ mpris = MPRIS.new
16
16
  pp mpris.player.metadata
@@ -13,5 +13,5 @@ require 'mpris'
13
13
 
14
14
  raise "Usage: play_track.rb <filename>" unless (ARGV.size == 1)
15
15
 
16
- mpris = Mpris.new
16
+ mpris = MPRIS.new
17
17
  mpris.tracklist.add_track( ARGV[0], true )
@@ -14,7 +14,7 @@ require 'highline'
14
14
  require 'mpris'
15
15
 
16
16
 
17
- mpris = Mpris.new
17
+ mpris = MPRIS.new
18
18
 
19
19
  puts "p:play space:pause s:stop [:prev ]:next q:quit"
20
20
  puts "+:volume_up -:volume_down x:exit"
@@ -12,7 +12,7 @@ $:.unshift File.dirname(__FILE__)+'/../lib'
12
12
  require 'mpris'
13
13
 
14
14
 
15
- mpris = Mpris.new
15
+ mpris = MPRIS.new
16
16
 
17
17
 
18
18
  puts "Enabling looping."
@@ -42,16 +42,16 @@ puts " Looping status: #{mpris.player.repeat}"
42
42
 
43
43
  puts "Stopping playback..."
44
44
  mpris.player.stop
45
- puts " Mpris::Player::STOPPED: #{Mpris::Player::STOPPED}"
45
+ puts " MPRIS::Player::STOPPED: #{MPRIS::Player::STOPPED}"
46
46
  puts " Playback status: #{mpris.player.status}"
47
47
 
48
48
  puts "Starting playback..."
49
49
  mpris.player.play
50
- puts " Mpris::Player::PLAYING: #{Mpris::Player::PLAYING}"
50
+ puts " MPRIS::Player::PLAYING: #{MPRIS::Player::PLAYING}"
51
51
  puts " Playback status: #{mpris.player.status}"
52
52
 
53
53
  # Current crashes VLC:
54
54
  #puts "Pausing playback..."
55
55
  #mpris.player.pause
56
- #puts " Mpris::Player::PAUSED: #{Mpris::Player::PAUSED}"
56
+ #puts " MPRIS::Player::PAUSED: #{MPRIS::Player::PAUSED}"
57
57
  #puts " Playback status: #{mpris.player.status}"
@@ -11,7 +11,7 @@ $:.unshift File.dirname(__FILE__)+'/../lib'
11
11
 
12
12
  require 'mpris'
13
13
 
14
- mpris = Mpris.new
14
+ mpris = MPRIS.new
15
15
 
16
16
  # Get the number of tracks on the tracklist
17
17
  len = mpris.tracklist.length
@@ -12,7 +12,7 @@ $:.unshift File.dirname(__FILE__)+'/../lib'
12
12
  require 'mpris'
13
13
 
14
14
 
15
- mpris = Mpris.new
15
+ mpris = MPRIS.new
16
16
 
17
17
  # Test to set and get the playback volume of the media player
18
18
  for vol_in in 0..150
@@ -14,14 +14,14 @@ require 'mpris/tracklist'
14
14
 
15
15
  # This is the base MPRIS class. It creates the #Player and #Tracklist objects
16
16
  # automatically, which are accessible via the attribute readers.
17
- class Mpris
17
+ class MPRIS
18
18
  attr_reader :player
19
19
  attr_reader :tracklist
20
20
 
21
21
  MPRIS_SERVICE_PREFIX = 'org.mpris'
22
22
  MPRIS_INTERFACE = 'org.freedesktop.MediaPlayer'
23
23
 
24
- # Create a new Mpris instance.
24
+ # Create a new MPRIS instance.
25
25
  # By default it will return the first MPRIS enabled player found
26
26
  # on the Session Bus.
27
27
  #
@@ -71,10 +71,10 @@ class Mpris
71
71
  @interface = root_object[MPRIS_INTERFACE]
72
72
 
73
73
  # Create the player object
74
- @player = Mpris::Player.new(@service, self)
74
+ @player = MPRIS::Player.new(@service, self)
75
75
 
76
76
  # Create a tracklist object
77
- @tracklist = Mpris::TrackList.new(@service, self)
77
+ @tracklist = MPRIS::TrackList.new(@service, self)
78
78
  end
79
79
 
80
80
  # Identify the "media player" as in "VLC 0.9.0", "bmpx 0.34.9", "Audacious 1.4.0" ...
@@ -95,7 +95,7 @@ class Mpris
95
95
  end
96
96
 
97
97
 
98
- # Exception raised if no Mpris service is found on the D-Bus.
98
+ # Exception raised if no MPRIS service is found on the D-Bus.
99
99
  class ServiceNotFoundException < Exception
100
100
  end
101
101
 
@@ -7,7 +7,7 @@
7
7
  # License:: Distributes under the same terms as Ruby
8
8
  #
9
9
 
10
- class Mpris
10
+ class MPRIS
11
11
 
12
12
  # This class represents the player itself.
13
13
  class Player
@@ -16,7 +16,7 @@ class Mpris
16
16
  PAUSED = 1
17
17
  STOPPED = 2
18
18
 
19
- # A player object should only be created directly by its parent Mpris
19
+ # A player object should only be created directly by its parent MPRIS
20
20
  def initialize( service, parent ) #:nodoc:
21
21
  @service = service
22
22
  @parent = parent
@@ -24,11 +24,11 @@ class Mpris
24
24
  # Check the service implements the MediaPlayer interface
25
25
  object = @service.object("/Player")
26
26
  object.introspect
27
- unless object.has_iface? Mpris::MPRIS_INTERFACE
28
- raise(Mpris::InterfaceNotImplementedException,
27
+ unless object.has_iface? MPRIS::MPRIS_INTERFACE
28
+ raise(MPRIS::InterfaceNotImplementedException,
29
29
  "#{service_name} does not implement the MediaPlayer interface on /.")
30
30
  end
31
- @interface = object[Mpris::MPRIS_INTERFACE]
31
+ @interface = object[MPRIS::MPRIS_INTERFACE]
32
32
  end
33
33
 
34
34
 
@@ -79,7 +79,7 @@ class Mpris
79
79
  end
80
80
 
81
81
  # Return the playing status of "Media Player".
82
- # Mpris::Player::PLAYING / Mpris::Player::PAUSED / Mpris::Player::STOPPED
82
+ # MPRIS::Player::PLAYING / MPRIS::Player::PAUSED / MPRIS::Player::STOPPED
83
83
  def status
84
84
  return @interface.GetStatus.first[0]
85
85
  end
@@ -7,7 +7,7 @@
7
7
  # License:: Distributes under the same terms as Ruby
8
8
  #
9
9
 
10
- class Mpris
10
+ class MPRIS
11
11
 
12
12
  # This class represents the Media Player's tracklist.
13
13
  #
@@ -18,7 +18,7 @@ class Mpris
18
18
  #
19
19
  class TrackList
20
20
 
21
- # A tracklist object should only be created directly by its parent Mpris
21
+ # A tracklist object should only be created directly by its parent MPRIS
22
22
  def initialize( service, parent ) #:nodoc:
23
23
  @service = service
24
24
  @parent = parent
@@ -26,11 +26,11 @@ class Mpris
26
26
  # Check the service implements the MediaPlayer interface
27
27
  object = @service.object("/TrackList")
28
28
  object.introspect
29
- unless object.has_iface? Mpris::MPRIS_INTERFACE
30
- raise(Mpris::InterfaceNotImplementedException,
29
+ unless object.has_iface? MPRIS::MPRIS_INTERFACE
30
+ raise(MPRIS::InterfaceNotImplementedException,
31
31
  "#{service_name} does not implement the MediaPlayer interface on /.")
32
32
  end
33
- @interface = object[Mpris::MPRIS_INTERFACE]
33
+ @interface = object[MPRIS::MPRIS_INTERFACE]
34
34
  end
35
35
 
36
36
  # Gives all metadata available for item at given position in the TrackList, counting from 0.
@@ -65,7 +65,16 @@ class Mpris
65
65
  #
66
66
  # pos is the position in the tracklist of the item to remove.
67
67
  def delete_track(pos)
68
- @interface.DeleteTrack(pos)
68
+ @interface.DelTrack(pos)
69
+ end
70
+
71
+ # Removes all tracks from the TrackList.
72
+ def delete_all
73
+ len = length
74
+ while(len) do
75
+ delete_track(0)
76
+ len -= 1
77
+ end
69
78
  end
70
79
 
71
80
  # Set the tracklist looping status. true to loop, false to stop looping.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mpris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas J Humfrey
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  requirements: []
70
70
 
71
71
  rubyforge_project: mpris
72
- rubygems_version: 1.0.1
72
+ rubygems_version: 0.9.5
73
73
  signing_key:
74
74
  specification_version: 2
75
75
  summary: A library to control MPRIS based Media Players