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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d601b9ff1a928b545e25d8aaf66ccfbcc71af16c
4
- data.tar.gz: b51862d645944bbae20de5b52357e17779d9a986
3
+ metadata.gz: efe262437212396d2cfb698d45ed1ed0d68c5aec
4
+ data.tar.gz: a1fbaa3262a0525a24c1f6d2e9946ad8182e2f4b
5
5
  SHA512:
6
- metadata.gz: fc3ff1895b80f0a7301fa40a9b0e3b597b487677aee00662b36f02d8aca2d6b8087702eded57dade99def17566ae2d4edf32b1f0722658584f796c4f51ef87e7
7
- data.tar.gz: 5199e150b6d06f00e9a73239552456f4e27457431cdff18c158caa73cd777c3618330115b71afc1f5563d6bcf9760a77b7f1654d4873be0d41b440b49ebc950f
6
+ metadata.gz: 4f689cbb25c65fb633c69e1fca2fe221b2d61b9532fe06b44ab7d7e8636547b570dd41419493b924b2ebc69479ac99f2b45eef2ff9c0d619051d63feebba155c
7
+ data.tar.gz: ca54e82973391d37876f73ea0a13f3865c43b52f38aabd7f8097f93536ca94e4d76051c9a8c41f750c7ef1809561138fba4ea4719e61813d7eb8c2a6ec0b0ea1
data/Rakefile CHANGED
@@ -1,2 +1 @@
1
1
  require "bundler/gem_tasks"
2
-
@@ -1,12 +1,78 @@
1
- require 'sinatra'
2
- require 'audite'
3
1
 
4
- player = Audite.new(8192*8)
2
+ require 'socket'
3
+ require 'slop'
5
4
 
6
- player.load('./Queen/1976 - A Day At The Races/06 - Somebody To Love.mp3')
5
+ #
6
+ #player.load('./Queen/1976 - A Day At The Races/06 - Somebody To Love.mp3')
7
7
 
8
- get '/' do
8
+ if File.exists? './.pid'
9
9
 
10
- player.start_stream
11
- 'hello world'
12
- end
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
@@ -1,3 +1,3 @@
1
1
  module Maxrebo
2
- VERSION = "0.0.1"
2
+ VERSION = '1.0.0'
3
3
  end
@@ -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 = "maxrebo"
7
+ spec.name = 'maxrebo'
8
8
  spec.version = Maxrebo::VERSION
9
- spec.authors = ["Luis Rodrigues Soares"]
10
- spec.email = ["luizsoarez@outlook.com"]
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 = "https://github.com/luizsoarez/maxrebo"
14
- spec.license = "MIT"
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 = ["lib"]
19
+ spec.require_paths = %w(lib)
20
20
 
21
- spec.add_development_dependency "bundler"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency 'sinatra'
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.1
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: sinatra
42
+ name: slop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="