spotify-dbus 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +61 -0
- data/bin/spotify-dbus +8 -2
- data/lib/spotify-dbus.rb +12 -14
- metadata +4 -4
- data/README +0 -16
data/README.markdown
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
spotify-dbus (for Ruby)
|
2
|
+
=========
|
3
|
+
|
4
|
+
Credits
|
5
|
+
-------
|
6
|
+
|
7
|
+
DBus exmaple from:
|
8
|
+
https://gist.github.com/892428
|
9
|
+
|
10
|
+
Install
|
11
|
+
--------
|
12
|
+
gem install spotify-dbus
|
13
|
+
|
14
|
+
|
15
|
+
Examples
|
16
|
+
--------
|
17
|
+
require 'spotify-dbus'
|
18
|
+
|
19
|
+
Spotify.player.Pause
|
20
|
+
Spotify.player.Play
|
21
|
+
|
22
|
+
Command Line Utility
|
23
|
+
--------------------
|
24
|
+
|
25
|
+
spotify-dbus Next
|
26
|
+
spotify-dbus Previous
|
27
|
+
spotify-dbus PlayPause
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
Available methods
|
32
|
+
-----------------
|
33
|
+
|
34
|
+
* Next
|
35
|
+
* Previous
|
36
|
+
* Pause
|
37
|
+
* PlayPause (think toggle)
|
38
|
+
* Stop
|
39
|
+
* Play
|
40
|
+
* Seek
|
41
|
+
* SetPosition
|
42
|
+
* OpenUri
|
43
|
+
|
44
|
+
RVM Wrapper
|
45
|
+
-----------
|
46
|
+
|
47
|
+
This is useful when creating keyboard shortcuts in Linux (and OSX).
|
48
|
+
|
49
|
+
rvm wrapper [version]@spotify-dbus [prefix] spotify-dbus
|
50
|
+
|
51
|
+
For example:
|
52
|
+
|
53
|
+
rvm wrapper 1.9.2@spotify-dbus wrapper spotify-dbus
|
54
|
+
|
55
|
+
Now you can bind a shortcut with the following command
|
56
|
+
|
57
|
+
/home/[name]/.rvm/bin/wrapper_spotify-dbus [cmd]
|
58
|
+
|
59
|
+
For example:
|
60
|
+
|
61
|
+
/home/bob/.rvm/bin/wrapper_spotify-dbus PlayPause
|
data/bin/spotify-dbus
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'spotify-dbus'
|
2
|
+
#require 'spotify-dbus'
|
3
|
+
require File.join(File.dirname(__FILE__), '../lib/spotify-dbus.rb')
|
4
|
+
|
3
5
|
|
4
6
|
cmd = ARGV.pop
|
5
7
|
|
6
|
-
|
8
|
+
begin
|
9
|
+
Spotify.player.send(cmd) if Spotify.player.methods[cmd]
|
10
|
+
rescue
|
11
|
+
puts "Spotify is not running!"
|
12
|
+
end
|
7
13
|
|
data/lib/spotify-dbus.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
require 'dbus'
|
2
2
|
|
3
3
|
module Spotify
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
4
|
+
def player
|
5
|
+
@player ||= player_object
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
protected
|
9
|
+
|
10
|
+
def player_object
|
11
|
+
dbus = DBus::SessionBus.instance
|
12
|
+
service = dbus.service('org.mpris.MediaPlayer2.spotify')
|
13
|
+
object = service.object('/org/mpris/MediaPlayer2')
|
14
|
+
object.introspect
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
16
|
+
object['org.mpris.MediaPlayer2.Player']
|
17
|
+
end
|
20
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotify-dbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ruby-dbus
|
17
|
-
requirement: &
|
17
|
+
requirement: &19886080 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: 0.6.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *19886080
|
26
26
|
description: Simple module and bin for Spotify DBus interfacing
|
27
27
|
email: mikeycgto@gmail.com
|
28
28
|
executables:
|
@@ -30,7 +30,7 @@ executables:
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
-
- README
|
33
|
+
- README.markdown
|
34
34
|
- bin/spotify-dbus
|
35
35
|
- lib/spotify-dbus.rb
|
36
36
|
has_rdoc: true
|
data/README
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
DBus exmaple from:
|
2
|
-
https://gist.github.com/892428
|
3
|
-
|
4
|
-
|
5
|
-
Install:
|
6
|
-
|
7
|
-
gem install spotify-dbus
|
8
|
-
|
9
|
-
./spotify Pause
|
10
|
-
./spotify Play
|
11
|
-
|
12
|
-
|
13
|
-
List of Available methods:
|
14
|
-
|
15
|
-
"Next", "Previous", "Pause", "PlayPause", "Stop", "Play", "Seek", "SetPosition", "OpenUri"
|
16
|
-
|