spotilocal 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9024ff189cda39e9cdfedc960f2af360a4b72fad
4
- data.tar.gz: 36d400bc168d54a9a19a78a02dbe857641ab92aa
3
+ metadata.gz: 8677fecab24399ca755cef8fa65e9de8fe06f254
4
+ data.tar.gz: a88c87355e6f4541c1eed871fbe08967ba2ea411
5
5
  SHA512:
6
- metadata.gz: a8d6cdcff47c4a5504375e8d7630377976be69b20d8f952182be6cff52754e6a595ec6cc59522b6c4ca80ac981b768dfddcec7e52ab94d639c52b2aa08df0d4b
7
- data.tar.gz: 79e63aa8f02c8919378df1a394e17032d918f79e45e2aba455d58e4ecbe03a009f65e150a4b8260aa95d0c5fd66b96f0fdc6c345d2c354fd2300ffd149c78449
6
+ metadata.gz: cc333f1c1494ce737d57b91aec8a6c7c89a21087810b0b02ad9d56d23bdc5cf21601d3f17c5f1a29b522bec69b506e03c082cc5ff4a6c3323a9f5647ad9d41ae
7
+ data.tar.gz: fba68e4521b10ffc02d1d2f8d6dffad6d9b6ce38a27967ac1527c235db23d04a90bce33e5502960000e906823d1484b30db774f32d7aa7183f8f115ae124fa16
@@ -1,15 +1,16 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-12-24 13:20:03 +0100 using RuboCop version 0.42.0.
3
+ # on 2016-12-25 10:24:00 +0100 using RuboCop version 0.42.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 2
9
+ # Offense count: 3
10
10
  Style/Documentation:
11
11
  Exclude:
12
12
  - 'spec/**/*'
13
13
  - 'test/**/*'
14
14
  - 'lib/spotilocal.rb'
15
+ - 'lib/spotilocal/cli.rb'
15
16
  - 'lib/spotilocal/client.rb'
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Spotilocal
2
+ [![Gem Version](https://badge.fury.io/rb/spotilocal.svg)](https://badge.fury.io/rb/spotilocal)
2
3
  [![Build Status](https://travis-ci.org/Flipez/spotilocal.svg?branch=master)](https://travis-ci.org/Flipez/spotilocal)
4
+ [![Code Climate](https://codeclimate.com/github/Flipez/spotilocal/badges/gpa.svg)](https://codeclimate.com/github/Flipez/spotilocal)
3
5
 
4
6
  Spotilocal allows you to query the local spotify client and fetch informations about the current status and perform actions such as start/stop.
5
7
 
@@ -20,7 +22,7 @@ Or install it yourself as:
20
22
  $ gem install spotilocal
21
23
 
22
24
  ## Usage
23
-
25
+ ### Libary
24
26
  You can specify a port to create the instance faster. Otherwise spotilocal will try to discover the port.
25
27
  ```ruby
26
28
  # Create a new spotify object
@@ -34,6 +36,17 @@ s.pause # true if paused
34
36
  s.unpause # true if playing
35
37
  ```
36
38
 
39
+ ### Cli
40
+ Spotilocas comes with a thor cli. The cli is currently a bit slow due to port autodiscover. You can use it like this
41
+
42
+ ```bash
43
+ spotilocal play URI # plays uri
44
+ spotilocal pause # guess what
45
+ spotilocal unpause # yup..
46
+ ```
47
+
48
+ Thor allows argument guessing. So commands like `spotilocal un` will work too.
49
+
37
50
  ## Development
38
51
 
39
52
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require 'thor'
3
+ require_relative '../lib/spotilocal'
4
+ require_relative '../lib/spotilocal/cli'
5
+ Spotilocal::CLI.start(ARGV)
@@ -0,0 +1,18 @@
1
+ module Spotilocal
2
+ class CLI < Thor
3
+ desc 'play URI', 'play given spotify uri'
4
+ def play(uri)
5
+ Spotilocal::Client.new.play uri
6
+ end
7
+
8
+ desc 'pause', 'pause local spotify client'
9
+ def pause
10
+ Spotilocal::Client.new.pause
11
+ end
12
+
13
+ desc 'unpause', 'unpause local spotify client'
14
+ def unpause
15
+ Spotilocal::Client.new.unpause
16
+ end
17
+ end
18
+ end
@@ -15,6 +15,11 @@ module Spotilocal
15
15
  lcall(:status)
16
16
  end
17
17
 
18
+ def play(uri)
19
+ r = lcall(:play, params: { uri: uri })
20
+ r.playing && r.track.track_resource.uri == uri
21
+ end
22
+
18
23
  def pause
19
24
  !lcall(:pause, params: { pause: 'true' }).playing
20
25
  end
@@ -1,3 +1,3 @@
1
1
  module Spotilocal
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_dependency 'typhoeus'
26
+ spec.add_dependency 'thor'
26
27
 
27
28
  spec.add_development_dependency 'bundler', '~> 1.12'
28
29
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotilocal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flipez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-24 00:00:00.000000000 Z
11
+ date: 2016-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -83,7 +97,8 @@ dependencies:
83
97
  description: Wrapper to remote control a local spotify client
84
98
  email:
85
99
  - code@brauser.io
86
- executables: []
100
+ executables:
101
+ - spotilocal
87
102
  extensions: []
88
103
  extra_rdoc_files: []
89
104
  files:
@@ -97,7 +112,9 @@ files:
97
112
  - Rakefile
98
113
  - bin/console
99
114
  - bin/setup
115
+ - exe/spotilocal
100
116
  - lib/spotilocal.rb
117
+ - lib/spotilocal/cli.rb
101
118
  - lib/spotilocal/client.rb
102
119
  - lib/spotilocal/version.rb
103
120
  - spotilocal.gemspec