cultome_player 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +24 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +7 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +325 -0
  9. data/Rakefile +8 -0
  10. data/bin/cultome_player +39 -0
  11. data/config/environment.yml +28 -0
  12. data/cultome_player.gemspec +35 -0
  13. data/db/001_create_schema.rb +58 -0
  14. data/lib/cultome_player.rb +107 -0
  15. data/lib/cultome_player/command.rb +11 -0
  16. data/lib/cultome_player/command/language.rb +61 -0
  17. data/lib/cultome_player/command/processor.rb +165 -0
  18. data/lib/cultome_player/command/reader.rb +86 -0
  19. data/lib/cultome_player/environment.rb +130 -0
  20. data/lib/cultome_player/events.rb +29 -0
  21. data/lib/cultome_player/media.rb +47 -0
  22. data/lib/cultome_player/objects.rb +15 -0
  23. data/lib/cultome_player/objects/album.rb +21 -0
  24. data/lib/cultome_player/objects/artist.rb +18 -0
  25. data/lib/cultome_player/objects/command.rb +37 -0
  26. data/lib/cultome_player/objects/drive.rb +26 -0
  27. data/lib/cultome_player/objects/genre.rb +16 -0
  28. data/lib/cultome_player/objects/parameter.rb +37 -0
  29. data/lib/cultome_player/objects/response.rb +42 -0
  30. data/lib/cultome_player/objects/song.rb +38 -0
  31. data/lib/cultome_player/player.rb +13 -0
  32. data/lib/cultome_player/player/adapter.rb +14 -0
  33. data/lib/cultome_player/player/adapter/mpg123.rb +143 -0
  34. data/lib/cultome_player/player/interactive.rb +56 -0
  35. data/lib/cultome_player/player/interface.rb +13 -0
  36. data/lib/cultome_player/player/interface/basic.rb +96 -0
  37. data/lib/cultome_player/player/interface/builtin_help.rb +368 -0
  38. data/lib/cultome_player/player/interface/extended.rb +199 -0
  39. data/lib/cultome_player/player/interface/helper.rb +300 -0
  40. data/lib/cultome_player/player/playlist.rb +280 -0
  41. data/lib/cultome_player/plugins.rb +23 -0
  42. data/lib/cultome_player/plugins/help.rb +58 -0
  43. data/lib/cultome_player/state_checker.rb +74 -0
  44. data/lib/cultome_player/utils.rb +95 -0
  45. data/lib/cultome_player/version.rb +3 -0
  46. data/spec/config.yml +0 -0
  47. data/spec/cultome_player/command/processor_spec.rb +168 -0
  48. data/spec/cultome_player/command/reader_spec.rb +45 -0
  49. data/spec/cultome_player/cultome_player_spec.rb +17 -0
  50. data/spec/cultome_player/environment_spec.rb +65 -0
  51. data/spec/cultome_player/events_spec.rb +22 -0
  52. data/spec/cultome_player/media_spec.rb +41 -0
  53. data/spec/cultome_player/player/adapter/mpg123_spec.rb +82 -0
  54. data/spec/cultome_player/player/interface/basic_spec.rb +168 -0
  55. data/spec/cultome_player/player/interface/extended/connect_spec.rb +117 -0
  56. data/spec/cultome_player/player/interface/extended/search_spec.rb +90 -0
  57. data/spec/cultome_player/player/interface/extended/show_spec.rb +36 -0
  58. data/spec/cultome_player/player/interface/extended/shuffle_spec.rb +26 -0
  59. data/spec/cultome_player/player/interface/extended_spec.rb +136 -0
  60. data/spec/cultome_player/player/interface/helper_spec.rb +63 -0
  61. data/spec/cultome_player/player/interface_spec.rb +17 -0
  62. data/spec/cultome_player/player/playlist_spec.rb +301 -0
  63. data/spec/cultome_player/plugins/help_spec.rb +21 -0
  64. data/spec/cultome_player/plugins_spec.rb +19 -0
  65. data/spec/cultome_player/utils_spec.rb +15 -0
  66. data/spec/spec_helper.rb +108 -0
  67. data/spec/test/uno/dos/dos.mp3 +0 -0
  68. data/spec/test/uno/dos/tres/tres.mp3 +0 -0
  69. data/spec/test/uno/uno.mp3 +0 -0
  70. data/tasks/console.rake +19 -0
  71. data/tasks/db.rake +19 -0
  72. data/tasks/run.rake +7 -0
  73. metadata +322 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 520affa57eb4cbb5aee209993047772c18379b0d
4
+ data.tar.gz: 2fe8bbee2da06c8515a710edb4666a825e7dd19e
5
+ SHA512:
6
+ metadata.gz: c286b696f6881b843c7577bb8451d21a6c8312c61d47e1e6986845b132637c0933311fe9d5ad17c3a3dd39709e7559ce8b36f46a565feaa9c04acf83278fa192
7
+ data.tar.gz: 9ac39288b1acea2127f0e7f6d8f19e85f4bf37e5c54912bdb648de9039ab4498fb819628e7703c6b6f97e3d8dd7f4b4a08cae6a3ac73fdae2ef6770ca85c147c
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.swp
19
+ tester.rb
20
+ *.tmp
21
+ TODO
22
+ checklist
23
+ spec/db.dat
24
+ spec/db.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0
4
+ script: rspec spec
5
+
6
+ before_install:
7
+ - sudo apt-get install libtag1-dev
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cultome_player.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Carlos Soria
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,325 @@
1
+ [![Gem Version](https://badge.fury.io/rb/cultome_player.png)](http://badge.fury.io/rb/cultome_player)
2
+ [![Build Status](https://travis-ci.org/cultome/cultome_player.svg)](https://travis-ci.org/cultome/cultome_player)
3
+ [![Coverage Status](https://coveralls.io/repos/cultome/cultome_player/badge.png)](https://coveralls.io/r/cultome/cultome_player)
4
+
5
+ # Cultome Player
6
+ A handy music library explorer. Is designed to facilitate you to play the music you like in the moment you want.
7
+
8
+ **"I want to play exactly this music"**
9
+
10
+ The player is designed around this concept, so it has commands to help you find music in your library and play it.
11
+
12
+ ## Usage
13
+
14
+ Lets see a couple examples and translate it to what to expect
15
+
16
+ ```ruby
17
+ play a:weird
18
+ ```
19
+ Generate a playlist with songs whose artist contains the string 'weird' in their name.
20
+
21
+ ```ruby
22
+ play @history
23
+ ```
24
+ Generate a playlist with all the songs you have heard in this session.
25
+
26
+ ```ruby
27
+ play a:gorillaz b:demon
28
+ ```
29
+ Generate a playlist with songs from albums that contains the string 'demon' in their name and their artist's name contains the string 'gorillaz'
30
+
31
+ ```ruby
32
+ search rose
33
+ ```
34
+ Finds all the songs whose title, artist'name or album's name has the string 'rose' in them.
35
+
36
+ ```ruby
37
+ play 12
38
+ ```
39
+ From the *focused list*, play the 12th item but dont modify the *current playlist*. If the *focused list* is a list of songs, then play a song, but if the *focused list* is of artists o albums, the play all the song from that artist o album.
40
+
41
+ ```ruby
42
+ play @album
43
+ ```
44
+ Generate a playlist with the songs from the *current song*'s album
45
+
46
+ ```ruby
47
+ play @search
48
+ ```
49
+ Generate a playlist with the results of the latest *search*.
50
+
51
+ ```ruby
52
+ play @tribal
53
+ ```
54
+ Generates a playlist with song whose genres includes 'tribal'
55
+
56
+ ## Player's command interface
57
+ To understand the command interface, you need to understand its parameters types and formats.
58
+
59
+ #### Criterio
60
+ A criterio is a key:value pair. In this moment only three keys are valid:
61
+ ```
62
+ * a Stand for Artist
63
+ * b Stand for Album
64
+ * t Stand for Title
65
+ ```
66
+
67
+ Examples of criterio are:
68
+
69
+ ```ruby
70
+ a:duffy
71
+ ```
72
+ ```ruby
73
+ b:"this is"
74
+ ```
75
+ ```ruby
76
+ t:Jugulator
77
+ ```
78
+
79
+ #### Literal
80
+ A chain of non-space characters. If you require spaces you can wrap the text in " or ' so this can be considered only one parameter.
81
+
82
+ Examples of literals are:
83
+
84
+ ```ruby
85
+ tunnels
86
+ ```
87
+
88
+ ```ruby
89
+ "The miss and the pit"
90
+ ```
91
+
92
+ #### Object
93
+ The objects are words with special meaning to the player prefixed with an @. In this moment the fully recognized objects are:
94
+ ```
95
+ * @library Refers to the complete list of songs in you *connected* collection.
96
+ * @search Refers to the list of songs returned in your last search.
97
+ * @playlist Refers to the current playlist. @current work as well.
98
+ * @history Refers to the playlist of songs you have heard in this session.
99
+ * @queue Refers to the list of songs scheduled to be played next.
100
+ * @song Refers to the current song playing.
101
+ * @artist Refers to the current song's artist playing.
102
+ * @album Refers to the current song's album playing.
103
+ * @drives Refers to all the drives the player knows.
104
+ ```
105
+
106
+ Some others are not player's objects but act as special functions placeholders.
107
+ ```
108
+ * @artists Referes to the complete list of artists in you *connected* collection.
109
+ * @albums Referes to the complete list of albums in you *connected* collection.
110
+ * @genres Referes to the complete list of genres in you *connected* collection.
111
+ * @recently_added Referes to the list of recently added to the collection's songs.
112
+ * @recently_played Referes to the list of recently played songs.
113
+ * @more_played Referes to the list of songs with more playbacks.
114
+ * @less_played Referes to the list of songs with less playbacks.
115
+ * @populars Referes to the list of songs with highest puntuations from playback preferences.
116
+ ```
117
+
118
+ And anything else is interpreted as follow:
119
+ * If there is a @drive with the same name, the @drive is used. The spaces in the @drive name are replaced with _. So, @my_drive search a drive with name 'my drive', no matter the case.
120
+ * Try to match a genre, with same name tranformation as above. So, @rock refers to the genre named 'rock', no matter the case.
121
+
122
+ #### Number
123
+ The numbers refers to elements in a displayed list. When a list is displayed, that lists becomes the *focused list* and any given numerical parameter refers to the elements in this list. Depending on the list type, that will be the type of parameter used.A *focused list* is usually the latest list displayed by the player.
124
+
125
+ Lets say we have the following *focused list*:
126
+
127
+ ```ruby
128
+ 35 :::: Song: Suburban War \ Artist: Arcade Fire \ Album: The Suburbs ::::
129
+ 36 :::: Song: Butcher Blues \ Artist: Kasabian \ Album: Kasabian ::::
130
+ 37 :::: Song: Master Of Puppets \ Artist: Metallica \ Album: 40 Greatest Metal Songs (Vh1) ::::
131
+ 38 :::: Song: Gavilán O Paloma \ Artist: La Lupita \ Album: Un Tributo A José José ::::
132
+ 39 :::: Song: La Primavera \ Artist: Manu Chao \ Album: Proxima Estacion: Esperanza ::::
133
+ 40 :::: Song: Caviar And Meths \ Artist: Judas Priest \ Album: Rocka Rolla ::::
134
+ 41 :::: Song: Take Me Out \ Artist: Franz Ferdinand \ Album: Take Me Out ::::
135
+ 42 :::: Song: Si Señor \ Artist: Control Machete \ Album: Artilleria Pesada, Presenta ::::
136
+ 43 :::: Song: Her We Kum \ Artist: Molotov \ Album: Dance And Dense Denso ::::
137
+ ```
138
+
139
+ Because is a songs list, if we do
140
+
141
+ ```ruby
142
+ play 39
143
+ ```
144
+ We're saying that we want to play the song 'La Primavera'. But if we have the following *focused list*:
145
+
146
+ ```ruby
147
+ 149 :::: Artist: Paloma Faith ::::
148
+ 150 :::: Artist: Duffy ::::
149
+ 151 :::: Artist: Ke$Ha ::::
150
+ 152 :::: Artist: Interpol ::::
151
+ 153 :::: Artist: Jean Knight ::::
152
+ 154 :::: Artist: Curtis Mayfield ::::
153
+ 155 :::: Artist: War ::::
154
+ ```
155
+
156
+ And the we do
157
+
158
+ ```ruby
159
+ play 151
160
+ ```
161
+
162
+ We get a playlist with all the songs of 'Ke$ha'. Similar behavior if we have had a albums list.
163
+
164
+ #### Path
165
+ Is an absolute path inside the filesystem. As with literals if the path has any spaces in it, is required to be wrapped inside " or '. In this moment there is no route expansion, so path like ~/music are not valids.
166
+
167
+ ```
168
+ /home/usuario/music
169
+ ```
170
+
171
+ #### Boolean
172
+ Basicly anything that match the next regex is considered a boolean value, so watch out if you try to insert a literal value instead of a boolean.
173
+ ```
174
+ /^(on|off|yes|false|true|si|no|y|n|s|ok)$/
175
+ ```
176
+
177
+ #### IP
178
+ A valid IP4 address.
179
+
180
+ ```ruby
181
+ 192.168.0.1
182
+ ```
183
+
184
+
185
+ ## Commands
186
+ The commands are very rustic. Basicly consist in a command name and a list of parameters.
187
+
188
+ ```ruby
189
+ <command> [<param>...]
190
+ ```
191
+
192
+ The following command are implemented in this moment.
193
+
194
+ ```
195
+ * help Provides information for player features.
196
+ * play Creates a playlist and start playing. Resumes playback.
197
+ * pause Toggle pause.
198
+ * stop Stops current playback.
199
+ * next Play the next song in current playlist.
200
+ * prev Play the last song in history playlist.
201
+ * quit Quits the playback and exit the player.
202
+ * search Search into the connected music drives.
203
+ * show Shows representations of diverse objects in the player.
204
+ * enqueue Append a playlist to the queue playlist.
205
+ * shuffle Check the state of shuffle. Can turn it on and off.
206
+ * connect Add or reconnect a drive to the music library.
207
+ * disconnect Disconnect a drive from the music library.
208
+ * ff Fast forward 10 seconds the current playback.
209
+ * fb Fast backward 10 seconds the current playback.
210
+ * repeat Repeat the current playback from the begining.
211
+ ```
212
+
213
+ Parameters passed to commands that dont require any are simply ignored.
214
+
215
+ Normally and where makes sense, multiple parameters can mix types. For example, in the 'play' the following is valid and means 'Create a playlist with the results from last search, the artist 'Loly' and any song, artist or album whose name contains 'little'.
216
+
217
+ ```ruby
218
+ play @search a:Loly little
219
+ ```
220
+
221
+ The following search songs of artist named 'Poor' or 'Rich'
222
+
223
+ ```ruby
224
+ search a:Poor a:Rich
225
+ ```
226
+
227
+ If in doubt of a command please refer to the help of the command inside the app with the following:
228
+ ```ruby
229
+ help <command_name>
230
+ ```
231
+
232
+ ## Installation
233
+ Due I'm not a genius, I rely in an excelent media player as a multimedia backbone. So, unless you're trying to write yor own adapter for other music player, you need to have Mpg123 installed. With linux, is a piece of cake:
234
+
235
+ For Ubuntu
236
+ ```
237
+ sudo apt-get install mpg123
238
+ ```
239
+
240
+ When you finish install this gem:
241
+ ```ruby
242
+ gem install cultome_player
243
+
244
+ cultome_player
245
+
246
+ connect /home/user/music => main
247
+
248
+ play
249
+ ```
250
+
251
+ ## What's new
252
+
253
+ **Version 2.0.0**
254
+
255
+ You know! I cant remember how many times I have rewrited this player. Mainly I do it because is fun to work in it, but the ugly truth is that I never finish it. However I will try to delivery at least a stable and prolonged api for this version. I'm taking my time and hopefully some day near I can delivery a fully funcional version with the plugins and all the flashing lights. If you wanna try the player while Im building it, try this version, if not stick it to the 1.0.0 (Im using version 1.0.0 while writing this) until I reach the functional point of that version, when that happens I'll post it here.
256
+
257
+ UPDATE:
258
+
259
+ I'm working again! Some changes ocurred since last update. First I change mi github account for dumb reasons, anyway this is the new old gem and I have this first stable new version. You know, some rought edges but at least is useful. I'll release the gem with another name because the cultome_player namespace is reserved. I let you know which one I pick. Wait the new gem in a couple days.
260
+
261
+ **Version 1.0.0**
262
+
263
+ I took so long I know, but it was for a good cause. When I realized thanks to [Travis CI](https://travis-ci.org/csoriav/cultome_player) that my code was a little more than difficult to test in more than one environment, considering the weird hybrid that result the JRuby thing, I decided to rewrite all the player, and that was what i been doing since then.
264
+
265
+ With the hope to deliver zero-defect, multiple-environment-friendly, less error prone code, a better developer experience and a truly code that could be called gem, I invest a lot of effort writing with a test-first methodology with new version. As you can see my coverage incremented radically.
266
+
267
+ As you can imagine, I test a lot, but even with my greattest efforts is possible that some scenarios have gone under the radar. I'm also conscient that this version still has some jagged edges, mostly of then I have identified but, by the nature of this change and the time it took, i decide to release this stable version and polish all the other things in the next release.
268
+
269
+ So, whats new with this release? Well at first sight you will feel the speed in the starting, also will note the memory consumption is now less than half than before. I also remove dependencies but over all now the player is **PURE RUBY**... well! you still need to have java installed because the music player is the same, but now run in a separate process and the communication between ruby and java is with sockets. This allows to use the gem even without a music player or connect a nother player, lets say mplayer, with just overwriting a couple methods =D
270
+
271
+ I remove the share funcitonality in this version, but it will come back in esteroids in future releases.
272
+
273
+ Whats next? Musicbrainz integration, I need to tags correctly all the songs if I want to go further. So, see you next version!
274
+
275
+ **Version 0.4.0**
276
+
277
+ * Now you database and your config file are inside you user directory (~/.cultome), that mean every new version dont require re-connect you music or make your aliases again.
278
+ * Scrobbler? of course! why not? but please run **'configure_lastfm begin'** before use it.
279
+ * Better environment startup check.
280
+
281
+ **Version 0.3.0**
282
+
283
+ * Colors!!! Yeah! a color schema that you can customize if you dont like mine.
284
+ * Some ASCII progress bars to let you know the player is not stuck!
285
+ * Improvement in the 'help <command>' command, to, hopefully help you you surf in the player.
286
+ * Add but not yet fully tested the *share* command to share music between two machines.
287
+ * Some minor bugs fixed.
288
+ * Specs up to date! YEAH!
289
+
290
+ **Version 0.2.0**
291
+
292
+ * The code were reorganized to be more API-oriented, even when this was not the mainly intention of this project, but can be uselful for others to use it this way.
293
+ * The some commands were extracted from the core, like help and kill.
294
+ * The command 'copy <object> <destiny_path>' were added to copy all the songs in the objet to a directory in the filesystem.
295
+ * The option 'search @\<artist|album\>' was implemented to facilitate the __'that album rocks! lets hear it!'__.
296
+ * The player now emit exception-thrown events, a general exception and a player's exception.
297
+ * The aliases/shortcuts/macros plugin is in place. With this you can translate user input into commands, for example type 'sa' and the players tranform it to 'search @artist'.
298
+ * Changes in plugin structure. Not the final version but a step ahead for building a better plugin model.
299
+ * Some minor bugs fixes, like the db hanging or the lost in focus when search is empty.
300
+
301
+ ## TODO
302
+
303
+ * Connect with musicbrainz to tag correctly and beatifuly my music, this also surge as Last.fm is very picky with the information you submit with your scrobbles.
304
+ * Add tags to the songs, for example 'party' or 'sadness'.
305
+ * A friend of mine give me an idea, when you are in a place where many people hear the same music, you should be able to decide what to play, as everyone else. So I will try an implementation of this idea, maybe a slave-masters model.
306
+ * Support for Windows. Not my priority but would be nice my wife to use it.
307
+ * Add gestures to the detector and start making appropiated suggestions for them.
308
+ * Refine the taste analizer, which is the component that give preference points to songs.
309
+ * Change the underlying in-file database for a real one, thinking on mongo or mysql.
310
+
311
+ ## Contributing
312
+
313
+ 1. Fork it
314
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
315
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
316
+ 4. Push to the branch (`git push origin my-new-feature`)
317
+ 5. Create new Pull Request
318
+
319
+ ## Additional Information
320
+
321
+ #### jlGui BasicPlayer
322
+ This component is what I use to play music and is included within the libraries of this project, dependencies included of course.
323
+
324
+ [jlGui](http://www.javazoom.net/jlgui/developerguide.html)
325
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(File.expand_path(__FILE__)), 'lib'))
4
+
5
+ dirname = File.join(File.dirname(File.expand_path(__FILE__)), "tasks")
6
+ Dir.entries(dirname).each do |task|
7
+ import "#{dirname}/#{task}" if task.end_with?(".rake")
8
+ end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift(File.join(File.dirname(File.expand_path(__FILE__)), '../lib'))
3
+
4
+ require 'optparse'
5
+ require 'cultome_player'
6
+
7
+ options = {
8
+ interactive: false,
9
+ environment: :user,
10
+ }
11
+
12
+ parser = OptionParser.new do |opts|
13
+ opts.banner = "Usage: cultome_player [options] [file1, file2, ...]"
14
+
15
+ opts.on('-i', '--interactive', 'Starts the player in interactive mode') do
16
+ options[:interactive] = true
17
+ end
18
+
19
+ opts.on('-e', '--env ENV', 'Starts the player in interactive mode') do |env|
20
+ options[:environment] = env.to_sym
21
+ end
22
+
23
+ opts.on('--version', "Shows version") do
24
+ puts CultomePlayer::VERSION
25
+ exit
26
+ end
27
+
28
+ end
29
+
30
+ ARGV << "--help" if ARGV.empty?
31
+
32
+ # parseamos las opciones
33
+ parser.parse!(ARGV)
34
+
35
+ player = CultomePlayer.get_player(options[:environment])
36
+
37
+ if options[:interactive]
38
+ player.begin_session
39
+ end