maxrebo 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +0 -1
- data/lib/maxrebo.rb +74 -8
- data/lib/maxrebo/version.rb +1 -1
- data/maxrebo.gemspec +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe262437212396d2cfb698d45ed1ed0d68c5aec
|
4
|
+
data.tar.gz: a1fbaa3262a0525a24c1f6d2e9946ad8182e2f4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f689cbb25c65fb633c69e1fca2fe221b2d61b9532fe06b44ab7d7e8636547b570dd41419493b924b2ebc69479ac99f2b45eef2ff9c0d619051d63feebba155c
|
7
|
+
data.tar.gz: ca54e82973391d37876f73ea0a13f3865c43b52f38aabd7f8097f93536ca94e4d76051c9a8c41f750c7ef1809561138fba4ea4719e61813d7eb8c2a6ec0b0ea1
|
data/Rakefile
CHANGED
data/lib/maxrebo.rb
CHANGED
@@ -1,12 +1,78 @@
|
|
1
|
-
require 'sinatra'
|
2
|
-
require 'audite'
|
3
1
|
|
4
|
-
|
2
|
+
require 'socket'
|
3
|
+
require 'slop'
|
5
4
|
|
6
|
-
|
5
|
+
#
|
6
|
+
#player.load('./Queen/1976 - A Day At The Races/06 - Somebody To Love.mp3')
|
7
7
|
|
8
|
-
|
8
|
+
if File.exists? './.pid'
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
file = File.open('./.pid')
|
11
|
+
puts file.read
|
12
|
+
|
13
|
+
# now let's parse stuff
|
14
|
+
|
15
|
+
opts = Slop.parse({:help=>true}) do # allows me to call it with --help
|
16
|
+
|
17
|
+
banner "What do you want from Max Rebo's band?"
|
18
|
+
|
19
|
+
on 'song', 'a song to play', :argument => true
|
20
|
+
end
|
21
|
+
|
22
|
+
# if ARGV is `--name Lee -v`
|
23
|
+
if opts[:song].eql? 'stop' or opts[:song].eql? 'kill'
|
24
|
+
TCPSocket.open('localhost', 3000).puts opts[:song]
|
25
|
+
else
|
26
|
+
songToPlay = Dir.glob('**/*').select { |file|
|
27
|
+
file.include?("Queen") &&
|
28
|
+
file.downcase.match(/(.*)\/(.*)\/(.*)/) &&
|
29
|
+
file.downcase.match(/(.*)\/(.*)\/(.*)/).length == 4 &&
|
30
|
+
file.downcase.match(/(.*)\/(.*)\/(.*)/)[3].include?(opts[:song].downcase)}.first
|
31
|
+
|
32
|
+
puts "will play #{songToPlay}"
|
33
|
+
|
34
|
+
TCPSocket.open('localhost', 3000).puts songToPlay
|
35
|
+
#puts s.gets
|
36
|
+
end
|
37
|
+
|
38
|
+
else
|
39
|
+
|
40
|
+
fork do
|
41
|
+
|
42
|
+
require 'audite'
|
43
|
+
player = Audite.new(8192*8)
|
44
|
+
|
45
|
+
File.open('./.pid', 'w') { |file| file.write(Process.pid) }
|
46
|
+
|
47
|
+
server = TCPServer.new 3000
|
48
|
+
|
49
|
+
loop do
|
50
|
+
|
51
|
+
Thread.start(server.accept) do |client|
|
52
|
+
|
53
|
+
recv = client.gets.strip!
|
54
|
+
puts'received command :: ' << recv
|
55
|
+
|
56
|
+
case recv
|
57
|
+
when 'kill'
|
58
|
+
puts 'triggered :: kill'
|
59
|
+
File.delete('./.pid')
|
60
|
+
Process.kill('INT', Process.pid)
|
61
|
+
|
62
|
+
when 'stop'
|
63
|
+
puts 'triggered :: stop'
|
64
|
+
player.stop_stream
|
65
|
+
|
66
|
+
else
|
67
|
+
puts 'triggered :: play'
|
68
|
+
player.load('./' << recv)
|
69
|
+
player.start_stream
|
70
|
+
end
|
71
|
+
|
72
|
+
client.close
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
data/lib/maxrebo/version.rb
CHANGED
data/maxrebo.gemspec
CHANGED
@@ -4,22 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'maxrebo/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'maxrebo'
|
8
8
|
spec.version = Maxrebo::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email =
|
9
|
+
spec.authors = ['Luis Rodrigues Soares']
|
10
|
+
spec.email = %w(luizsoarez@outlook.com)
|
11
11
|
spec.summary = %q{a small music player}
|
12
12
|
spec.description = %q{really, it's just a small music player}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/luizsoarez/maxrebo'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths =
|
19
|
+
spec.require_paths = %w(lib)
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency '
|
21
|
+
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'slop'
|
24
24
|
spec.add_development_dependency 'audite'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maxrebo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Rodrigues Soares
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: slop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|