spotify_http_remote 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 72e5b39cdc8be13430e43c08386d65fc2c7347b4
4
+ data.tar.gz: 5c961ea965eb0e688a53240d2fb82288213f6d74
5
+ SHA512:
6
+ metadata.gz: e4aefa4f443fdaade4efa3c7a049e9b6735ef76aa90dcedab83a22348bbfcba48f2e0e2cf26237f5fe78449c66cb805376eebfdb4f64446fd5f4f9b022214785
7
+ data.tar.gz: a8b8831cf6d1517ec545e2a01b12741ffa02057abc7cb77a62f67cf9732bd190b52a31e81356c9591a59720f88a91a4ac0cfa95e656baf462cf97f7393e77ae0
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ before_install: gem install bundler -v 1.10.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in spotify_http_remote.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # SpotifyHttpRemote
2
+
3
+ HTTP API for sending basic playback commands to a spotify client running on OSX.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'spotify_http_remote'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install spotify_http_remote
20
+
21
+ ## Usage
22
+
23
+ Start server:
24
+
25
+ $ spotify_http_remote <port> - Default port is 8080
26
+
27
+ In development mode 'localhost' is the default hostname.
28
+
29
+ Switch to production mode and start sending commands from other devices on the network by setting `RACK_ENV` variable to 'production':
30
+
31
+ $ export RACK_ENV=production
32
+
33
+ To allow devices from outside your network to send requests to the client, the router needs to be configured to forward traffic to the client's local IP.
34
+
35
+ ### HTTP routes
36
+
37
+ Start playback: `<your-domain>:<port>/play`
38
+
39
+ Start playing The Beatles: `<your-domain>:<port>/play?artist=beatles`
40
+
41
+ Start playing Drive My Car by The Beatles: `<your-domain>:<port>/play?artist=beatles&track=drive%20my%20car`
42
+
43
+ Start playing the album Help: `<your-domain>:<port>/play?album=Help!`
44
+
45
+ Stop playback: `<your-domain>:<port>/stop`
46
+
47
+ Next track: `<your-domain>:<port>/next`
48
+
49
+ Previous track: `<your-domain>:<port>/previous`
50
+
51
+
52
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "rake/testtask"
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+
8
+ task :default => :test
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'spotify_http_remote'
4
+
5
+ SpotifyHttpRemote.start ARGV[0]
@@ -0,0 +1,11 @@
1
+ require "spotify_http_remote/version"
2
+ require "spotify_http_remote/application/server"
3
+
4
+ module SpotifyHttpRemote
5
+
6
+ def self.start (port = 8080)
7
+ puts "Starting SpotifyHttpRemote server"
8
+ SpotifyHttpRemote::Server.run! port: port
9
+ end
10
+
11
+ end
@@ -0,0 +1,33 @@
1
+ require 'sinatra'
2
+ require 'spotify_osx_controller'
3
+
4
+ module SpotifyHttpRemote
5
+
6
+ class Server < Sinatra::Base
7
+
8
+ get '/play' do
9
+ params.keys.each do |key|
10
+ params[(key.to_sym rescue key) || key] = params.delete(key)
11
+ end
12
+ SpotifyOsxController.play params
13
+ end
14
+
15
+ get '/stop' do
16
+ SpotifyOsxController.stop
17
+ end
18
+
19
+ get '/playpause' do
20
+ SpotifyOsxController.play_pause
21
+ end
22
+
23
+ get '/next' do
24
+ SpotifyOsxController.next
25
+ end
26
+
27
+ get '/previous' do
28
+ SpotifyOsxController.previous
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,3 @@
1
+ module SpotifyHttpRemote
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'spotify_http_remote/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "spotify_http_remote"
8
+ spec.version = SpotifyHttpRemote::VERSION
9
+ spec.authors = ["Daniel Swensson"]
10
+ spec.email = ["daniel@danielswensson.se"]
11
+
12
+ spec.summary = %q{HTTP API for controlling Spotify OSX client}
13
+ spec.homepage = "https://github.com/DanielSwensson/spotify_http_remote"
14
+ spec.licenses = ['MIT']
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "bin"
18
+ spec.executables = "spotify_http_remote"
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "spotify_osx_controller", "~> 2.0"
22
+ spec.add_dependency "sinatra", "~> 1.0"
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spotify_http_remote
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Swensson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: spotify_osx_controller
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description:
70
+ email:
71
+ - daniel@danielswensson.se
72
+ executables:
73
+ - spotify_http_remote
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - bin/spotify_http_remote
83
+ - lib/spotify_http_remote.rb
84
+ - lib/spotify_http_remote/application/server.rb
85
+ - lib/spotify_http_remote/version.rb
86
+ - spotify_http_remote.gemspec
87
+ homepage: https://github.com/DanielSwensson/spotify_http_remote
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.4.6
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: HTTP API for controlling Spotify OSX client
111
+ test_files: []