Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 29 lines (21 sloc) 0.37 kB
1e1ec63 @mikeycgto move file and code
mikeycgto authored
1 #!/usr/bin/env ruby
03fa4ff @mikeycgto better error handling in bin
mikeycgto authored
2 require 'spotify-dbus'
a704393 @mikeycgto output an error msg when spotify is not running
mikeycgto authored
3
5064f59 @mikeycgto formatting changes and clean up in bin
mikeycgto authored
4 def die msg
03fa4ff @mikeycgto better error handling in bin
mikeycgto authored
5 puts msg
6 exit false
7 end
1e1ec63 @mikeycgto move file and code
mikeycgto authored
8
03fa4ff @mikeycgto better error handling in bin
mikeycgto authored
9 if ARGV.size > 0
10 begin
11 cmd = ARGV.pop
cffbaf0 @mikeycgto change module name to avoid conflicts
mikeycgto authored
12 player = SpotifyDBus.player
5064f59 @mikeycgto formatting changes and clean up in bin
mikeycgto authored
13
cffbaf0 @mikeycgto change module name to avoid conflicts
mikeycgto authored
14 if player.methods[cmd]
15 player.send(cmd)
5064f59 @mikeycgto formatting changes and clean up in bin
mikeycgto authored
16
03fa4ff @mikeycgto better error handling in bin
mikeycgto authored
17 else
5064f59 @mikeycgto formatting changes and clean up in bin
mikeycgto authored
18 die "Invalid command!"
19
03fa4ff @mikeycgto better error handling in bin
mikeycgto authored
20 end
21 rescue
5064f59 @mikeycgto formatting changes and clean up in bin
mikeycgto authored
22 die "Spotify is not running!"
03fa4ff @mikeycgto better error handling in bin
mikeycgto authored
23 end
5064f59 @mikeycgto formatting changes and clean up in bin
mikeycgto authored
24
03fa4ff @mikeycgto better error handling in bin
mikeycgto authored
25 else
5064f59 @mikeycgto formatting changes and clean up in bin
mikeycgto authored
26 die "No command given!"
a704393 @mikeycgto output an error msg when spotify is not running
mikeycgto authored
27 end
1e1ec63 @mikeycgto move file and code
mikeycgto authored
28
Something went wrong with that request. Please try again.