sonice 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 085515e77678d7661159be8f83aafaac2624452d
4
+ data.tar.gz: 32d2d8074a1210561c850871698aae447a001b6c
5
+ SHA512:
6
+ metadata.gz: 18e19b550620b93d47206020fa765c7b714d17b2c9540766c07a4b08a4bc0d68659a368d3e22287d3a84d4f06d975c9ea3d3276bd2934e98f1bfc8a204c15cc8
7
+ data.tar.gz: 3b49fa23978e7d58e79393a1076aa9c6e30a6cc22078014bb90d54e303266aa20f0c050e0293dc85c3fb60952953e6b0771b32b4a9786fb8c3344c94909254f6
@@ -0,0 +1,2 @@
1
+ Style/StringLiterals:
2
+ Enabled: false
@@ -0,0 +1,17 @@
1
+ Changelog
2
+ =========
3
+
4
+ So Nice tries its best to follow Semantic Versioning.
5
+
6
+ ## Latest branch
7
+
8
+ ## v2.1.1
9
+
10
+ Bugfixes :
11
+
12
+ - Fix LastFM JavaScript (thanks @datagutt)
13
+ - Fix Thin dependency with Sinatra
14
+
15
+ ## v2.1.0 (2013-12-18)
16
+
17
+ First Gem version.
@@ -1,34 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sonice (2.1.0)
4
+ sonice (2.1.1)
5
5
  anyplayer (> 1.1.1)
6
6
  haml
7
7
  sinatra
8
- thin
8
+ thin (>= 1.6.0)
9
9
  xml-simple
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- anyplayer (1.1.2)
14
+ anyplayer (1.1.4)
15
15
  ruby-mpd (~> 0.3.0)
16
16
  daemons (1.1.9)
17
17
  eventmachine (1.0.3)
18
- haml (4.0.3)
18
+ haml (4.0.5)
19
19
  tilt
20
20
  rack (1.5.2)
21
- rack-protection (1.5.0)
21
+ rack-protection (1.5.3)
22
22
  rack
23
- ruby-mpd (0.3.0)
24
- sinatra (1.4.3)
23
+ rake (10.3.2)
24
+ ruby-mpd (0.3.1)
25
+ sinatra (1.4.5)
25
26
  rack (~> 1.4)
26
27
  rack-protection (~> 1.4)
27
28
  tilt (~> 1.3, >= 1.3.4)
28
- thin (1.5.1)
29
+ thin (1.6.0)
29
30
  daemons (>= 1.0.9)
30
- eventmachine (>= 0.12.6)
31
- rack (>= 1.0.0)
31
+ eventmachine (>= 1.0.0)
32
+ rack (>= 1.5.0)
32
33
  tilt (1.4.1)
33
34
  xml-simple (1.1.2)
34
35
 
@@ -36,5 +37,5 @@ PLATFORMS
36
37
  ruby
37
38
 
38
39
  DEPENDENCIES
39
- rack
40
+ rake
40
41
  sonice!
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  So Nice ♫
2
2
  =======
3
3
 
4
- > Everynight with my star friends
5
- >
6
- > We eat caviar and drink champage
4
+ [![Gem Version](https://badge.fury.io/rb/sonice.png)](http://badge.fury.io/rb/sonice)
5
+
6
+ > “Everynight with my star friends, we eat caviar and drink champage
7
7
 
8
8
  A small Web interface to play, pause, change volume or skip the currently
9
9
  playing song in iTunes Mac, iTunes Windows, Spotify Mac, MPD, Rhythmbox, Amarok and XMMS2.
@@ -14,7 +14,7 @@ playing song in iTunes Mac, iTunes Windows, Spotify Mac, MPD, Rhythmbox, Amarok
14
14
  Install
15
15
  -------
16
16
 
17
- Make sure you have Ruby and Rubygems installed. You can then type in a terminal:
17
+ Make sure you have Ruby > 1.9 and Rubygems installed. You can then type in a terminal:
18
18
 
19
19
  ```bash
20
20
  $ gem install sonice
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require 'bundler'
2
- require 'rake/testtask'
3
3
 
4
4
  Bundler::GemHelper.install_tasks
data/bin/sonice CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+ # -*- encoding: utf-8 -*-
2
3
  require 'sonice/command_line'
3
4
  Sonice::CommandLine.parse(ARGV)
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  # Standard library
2
4
  require 'open-uri'
3
5
 
@@ -1,4 +1,6 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  module Sonice
3
+ # Sinatra application
2
4
  class App < Sinatra::Base
3
5
  set :port, ENV['SONICE_PORT'] || 3000
4
6
  set :controls, ENV['SONICE_CONTROLS'] != '0'
@@ -12,29 +14,29 @@ module Sonice
12
14
  set :haml, format: :html5
13
15
  set :protection, except: :frame_options
14
16
 
17
+ def initialize
18
+ @player = player
19
+ end
20
+
15
21
  def player
16
- @@player ||= begin
22
+ @player ||= begin
17
23
  puts "Looking for a player..."
18
24
  player = Anyplayer::Selector.new.player
19
- abort "Error: no music player launched!" if !player
25
+ abort "Error: no music player launched!" unless player
20
26
  puts "Connected to #{player.name}"
21
27
  player
22
28
  end
23
29
  end
24
30
 
25
31
  put '/player' do
26
- if settings.voting
27
- player.vote if params['vote']
28
- end
32
+ player.vote if settings.voting && params['vote']
29
33
 
30
34
  if settings.controls
31
35
  methods = %w(playpause prev next voldown volup) & params.keys
32
36
  methods.each { |method| player.send(method) }
33
37
  end
34
38
 
35
- if !request.xhr?
36
- redirect '/'
37
- end
39
+ redirect "/" unless request.xhr?
38
40
  end
39
41
 
40
42
  get '/' do
@@ -43,11 +45,10 @@ module Sonice
43
45
  @album = player.album
44
46
  if request.xhr?
45
47
  content_type :json
46
- { :title => @title, :artist => @artist, :album => @album }.to_json
48
+ { title: @title, artist: @artist, album: @album }.to_json
47
49
  else
48
50
  haml :index
49
51
  end
50
52
  end
51
-
52
53
  end
53
54
  end
@@ -1,9 +1,11 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require "sonice"
2
3
  require 'sonice/version'
3
4
 
4
5
  module Sonice
6
+ # Module CommandLine
5
7
  module CommandLine
6
- extend self
8
+ module_function
7
9
 
8
10
  def parse(argv)
9
11
  case argv
@@ -19,7 +21,6 @@ module Sonice
19
21
  puts "Usage: sonice [--version]"
20
22
  exit(1)
21
23
  end
22
-
23
24
  end
24
25
  end
25
26
  end
@@ -35,37 +35,37 @@ $.fn.keyboardShortcut = function() {
35
35
  // Get a new artist image from Last.fm via jsonp
36
36
  // When found calls the `callback` with the image url as the first argument
37
37
  function artistImage(artist, callback) {
38
- // Commented out because Last.fm does not support this URL anymore.
39
-
40
- // if (!artist)
41
- // return callback()
42
- // var cb = function() { callback(cache[artist].random()) },
43
- // cache = artistImage.cache
44
- // artist = encodeURI(artist)
45
-
46
- // // Deliver from cache
47
- // if (cache.hasOwnProperty(artist)) {
48
- // // execute the callback asynchronously to minimize codepaths
49
- // setTimeout(cb, 10)
50
- // return
51
- // }
52
-
53
- // // Load
54
- // var last_fm_uri = "http://ws.audioscrobbler.com/2.0/?format=json&method=artist.getimages&artist=%s&api_key=5636ca9fea36d0323a76638385aab1f3"
55
- // $.ajax({
56
- // url: last_fm_uri.replace('%s', artist),
57
- // dataType: 'jsonp',
58
- // success: function(obj) {
59
- // if (obj.images.image) {
60
- // cache[artist] = $.map(obj.images.image, function(img) {
61
- // return img.sizes.size[0]['#text']
62
- // })
63
- // cb()
64
- // } else {
65
- // callback()
66
- // }
67
- // }
68
- // })
38
+ if (!artist)
39
+ return callback()
40
+ var cb = function() { callback(cache[artist].random()) },
41
+ cache = artistImage.cache
42
+ artist = encodeURI(artist)
43
+
44
+ // Deliver from cache
45
+ if (cache.hasOwnProperty(artist)) {
46
+ // execute the callback asynchronously to minimize codepaths
47
+ setTimeout(cb, 10)
48
+ return
49
+ }
50
+
51
+ // Load
52
+ var last_fm_uri = "http://ws.audioscrobbler.com/2.0/?format=json&method=artist.getinfo&artist=%s&api_key=5636ca9fea36d0323a76638385aab1f3"
53
+ $.ajax({
54
+ url: last_fm_uri.replace('%s', artist),
55
+ dataType: 'jsonp',
56
+ success: function(obj) {
57
+ if (obj.artist.image) {
58
+ cache[artist] = $.map(obj.artist.image, function(img) {
59
+ if (img.size == 'mega') {
60
+ return img['#text']
61
+ }
62
+ })
63
+ cb()
64
+ } else {
65
+ callback()
66
+ }
67
+ }
68
+ })
69
69
  }
70
70
  artistImage.cache = {}
71
71
 
@@ -141,4 +141,3 @@ $(function() {
141
141
  $('input').keyboardShortcut()
142
142
 
143
143
  })
144
-
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # Module Sonice
1
3
  module Sonice
2
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
3
5
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
3
3
  require "sonice/version"
4
4
 
5
5
  Gem::Specification.new do |s|
@@ -9,19 +9,21 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Sunny Ripert"]
10
10
  s.email = ["sunny@sunfox.org"]
11
11
  s.homepage = "http://github.com/sunny/so-nice"
12
- s.summary = %q{Web interface to control your current music player}
13
- s.description = %q{Small Web interface to control iTunes, Spotify, Rdio, MPD, Rhythmbox, Amarok and XMMS2. ♫}
14
- s.license = 'WTFPL'
12
+ s.summary = "Web interface to control your current music player"
13
+ s.description = "Small Web interface to control iTunes, Spotify, " + \
14
+ "Rdio, MPD, Rhythmbox, Amarok and XMMS2. ♫"
15
+ s.license = "WTFPL"
15
16
 
17
+ s.require_paths = ["lib"]
16
18
  s.files = `git ls-files`.split("\n")
17
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
+ s.executables = `git ls-files -- bin/*`.split("\n")
21
+ .map { |f| File.basename(f) }
20
22
 
21
23
  s.add_runtime_dependency 'anyplayer', '> 1.1.1'
22
24
  s.add_runtime_dependency 'sinatra'
23
25
  s.add_runtime_dependency 'haml'
24
26
  s.add_runtime_dependency 'xml-simple'
25
- s.add_runtime_dependency 'thin'
26
- s.add_development_dependency 'rack'
27
+ s.add_runtime_dependency 'thin', '>= 1.6.0'
28
+ s.add_development_dependency 'rake'
27
29
  end
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonice
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
5
- prerelease:
4
+ version: 2.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sunny Ripert
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2014-09-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: anyplayer
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>'
17
+ - - ">"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.1.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>'
24
+ - - ">"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.1.1
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sinatra
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: haml
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: xml-simple
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: thin
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
- version: '0'
75
+ version: 1.6.0
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
- version: '0'
82
+ version: 1.6.0
94
83
  - !ruby/object:Gem::Dependency
95
- name: rack
84
+ name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  description: Small Web interface to control iTunes, Spotify, Rdio, MPD, Rhythmbox,
@@ -116,7 +103,9 @@ executables:
116
103
  extensions: []
117
104
  extra_rdoc_files: []
118
105
  files:
119
- - .gitignore
106
+ - ".gitignore"
107
+ - ".rubocop.yml"
108
+ - CHANGELOG.md
120
109
  - Gemfile
121
110
  - Gemfile.lock
122
111
  - README.md
@@ -136,26 +125,25 @@ files:
136
125
  homepage: http://github.com/sunny/so-nice
137
126
  licenses:
138
127
  - WTFPL
128
+ metadata: {}
139
129
  post_install_message:
140
130
  rdoc_options: []
141
131
  require_paths:
142
132
  - lib
143
133
  required_ruby_version: !ruby/object:Gem::Requirement
144
- none: false
145
134
  requirements:
146
- - - ! '>='
135
+ - - ">="
147
136
  - !ruby/object:Gem::Version
148
137
  version: '0'
149
138
  required_rubygems_version: !ruby/object:Gem::Requirement
150
- none: false
151
139
  requirements:
152
- - - ! '>='
140
+ - - ">="
153
141
  - !ruby/object:Gem::Version
154
142
  version: '0'
155
143
  requirements: []
156
144
  rubyforge_project:
157
- rubygems_version: 1.8.23
145
+ rubygems_version: 2.1.11
158
146
  signing_key:
159
- specification_version: 3
147
+ specification_version: 4
160
148
  summary: Web interface to control your current music player
161
149
  test_files: []