pianobartender 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.2@pianobartender --create
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ require 'guard'
2
+ require 'guard/process'
3
+
4
+ guard 'process', :name => 'SinatraApp', :command => 'ruby pianobartender.rb' do
5
+ watch('pianobartender.rb')
6
+ watch('lib/**/*')
7
+ end
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"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ `[ -f config.ru ] && rackup || rackup ../config.ru`
data/config.ru ADDED
@@ -0,0 +1,2 @@
1
+ require './lib/pianobartender'
2
+ run Pianobartender
@@ -0,0 +1,3 @@
1
+ module Pianobartender
2
+ VERSION = "0.0.2"
3
+ end
@@ -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: []