pianobartender 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rvmrc +1 -0
- data/Gemfile +3 -0
- data/Guardfile +7 -0
- data/MIT-LICENSE +7 -0
- data/README.md +45 -0
- data/Rakefile +1 -0
- data/bin/pianobartender +3 -0
- data/config.ru +2 -0
- data/lib/pianobartender/version.rb +3 -0
- data/lib/pianobartender.rb +35 -0
- data/pianobartender.gemspec +22 -0
- metadata +91 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2@pianobartender --create
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2011 Bradley Grzesiak
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
pianobartender
|
2
|
+
--------------
|
3
|
+
|
4
|
+
Wraps pianobar in a really simple web api
|
5
|
+
|
6
|
+
Installation
|
7
|
+
============
|
8
|
+
|
9
|
+
$ gem install pianobartender
|
10
|
+
|
11
|
+
Usage
|
12
|
+
=====
|
13
|
+
|
14
|
+
Make sure you have [pianobar][pianobar] installed.
|
15
|
+
|
16
|
+
Also, make sure you have the control fifo setup:
|
17
|
+
|
18
|
+
$ mkdir -p ~/.config/pianobar && mkfifo ~/.config/pianobar/ctl
|
19
|
+
|
20
|
+
Then run pianobar (and login):
|
21
|
+
|
22
|
+
$ pianobar
|
23
|
+
|
24
|
+
Finally, in another terminal, just run:
|
25
|
+
|
26
|
+
$ pianobartender
|
27
|
+
|
28
|
+
To control pianobar, just issue a command via GET:
|
29
|
+
|
30
|
+
$ curl http://localhost:9292/command/next
|
31
|
+
|
32
|
+
You can use any of the following commands:
|
33
|
+
|
34
|
+
* love
|
35
|
+
* ban
|
36
|
+
* bookmark
|
37
|
+
* history
|
38
|
+
* info
|
39
|
+
* next
|
40
|
+
* pause
|
41
|
+
* unpause
|
42
|
+
* tired
|
43
|
+
* upcoming
|
44
|
+
* voldown
|
45
|
+
* volup
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/pianobartender
ADDED
data/config.ru
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
class Pianobartender < Sinatra::Base
|
4
|
+
|
5
|
+
def commands
|
6
|
+
{
|
7
|
+
'love' => '+',
|
8
|
+
'ban' => '-',
|
9
|
+
'bookmark' => 'b',
|
10
|
+
'history' => 'h',
|
11
|
+
'info' => 'i',
|
12
|
+
'next' => 'n',
|
13
|
+
'pause' => 'p',
|
14
|
+
'unpause' => 'p',
|
15
|
+
'tired' => 't',
|
16
|
+
'upcoming' => 'u',
|
17
|
+
'voldown' => '(',
|
18
|
+
'volup' => ')'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
get '/command/:cmd' do
|
23
|
+
cmd = commands[params[:cmd]]
|
24
|
+
if cmd
|
25
|
+
result = %x[echo '#{cmd}' > ~/.config/pianobar/ctl]
|
26
|
+
end
|
27
|
+
result || 'ok'
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/' do
|
31
|
+
'go away!'
|
32
|
+
end
|
33
|
+
|
34
|
+
run! if app_file == $0
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "pianobartender/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "pianobartender"
|
7
|
+
s.version = Pianobartender::VERSION
|
8
|
+
s.authors = ["Bradley Grzesiak"]
|
9
|
+
s.email = ["brad@bendyworks.com"]
|
10
|
+
s.homepage = "https://github.com/listrophy/pianobartender"
|
11
|
+
s.summary = %q{Wraps pianobar in a really simple web api}
|
12
|
+
s.description = %q{Wraps pianobar in a really simple web api}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_development_dependency "guard"
|
20
|
+
s.add_development_dependency "guard-process"
|
21
|
+
s.add_runtime_dependency "sinatra"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pianobartender
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bradley Grzesiak
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-15 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: &70121122649440 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70121122649440
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: guard-process
|
27
|
+
requirement: &70121122649000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70121122649000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sinatra
|
38
|
+
requirement: &70121122648560 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70121122648560
|
47
|
+
description: Wraps pianobar in a really simple web api
|
48
|
+
email:
|
49
|
+
- brad@bendyworks.com
|
50
|
+
executables:
|
51
|
+
- pianobartender
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- .rvmrc
|
57
|
+
- Gemfile
|
58
|
+
- Guardfile
|
59
|
+
- MIT-LICENSE
|
60
|
+
- README.md
|
61
|
+
- Rakefile
|
62
|
+
- bin/pianobartender
|
63
|
+
- config.ru
|
64
|
+
- lib/pianobartender.rb
|
65
|
+
- lib/pianobartender/version.rb
|
66
|
+
- pianobartender.gemspec
|
67
|
+
homepage: https://github.com/listrophy/pianobartender
|
68
|
+
licenses: []
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 1.8.10
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: Wraps pianobar in a really simple web api
|
91
|
+
test_files: []
|