Module: CultomePlayer::Player::BuiltinHelp
- Included in:
- Interface
- Defined in:
- lib/cultome_player/player/interface/builtin_help.rb
Instance Method Summary collapse
- #description_connect ⇒ Object
- #description_disconnect ⇒ Object
- #description_enqueue ⇒ Object
- #description_fb ⇒ Object
- #description_ff ⇒ Object
- #description_next ⇒ Object
- #description_pause ⇒ Object
- #description_play ⇒ Object
- #description_prev ⇒ Object
- #description_quit ⇒ Object
- #description_repeat ⇒ Object
- #description_search ⇒ Object
- #description_show ⇒ Object
- #description_shuffle ⇒ Object
- #description_stop ⇒ Object
- #usage_connect ⇒ Object
- #usage_cultome_player ⇒ Object
- #usage_disconnect ⇒ Object
- #usage_enqueue ⇒ Object
- #usage_fb ⇒ Object
- #usage_ff ⇒ Object
- #usage_next ⇒ Object
- #usage_pause ⇒ Object
- #usage_play ⇒ Object
- #usage_prev ⇒ Object
- #usage_quit ⇒ Object
- #usage_repeat ⇒ Object
- #usage_search ⇒ Object
- #usage_show ⇒ Object
- #usage_shuffle ⇒ Object
- #usage_stop ⇒ Object
Instance Method Details
#description_connect ⇒ Object
44 45 46 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 44 def description_connect "Add or reconnect a drive to the music library." end |
#description_disconnect ⇒ Object
48 49 50 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 48 def description_disconnect "Disconnect a drive from the music library." end |
#description_enqueue ⇒ Object
36 37 38 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 36 def description_enqueue "Append a playlist to the queue playlist." end |
#description_fb ⇒ Object
56 57 58 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 56 def description_fb "Fast backward 10 seconds the current playback." end |
#description_ff ⇒ Object
52 53 54 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 52 def description_ff "Fast forward 10 seconds the current playback." end |
#description_next ⇒ Object
16 17 18 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 16 def description_next "Play the next song in current playlist." end |
#description_pause ⇒ Object
8 9 10 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 8 def description_pause "Toggle pause." end |
#description_play ⇒ Object
4 5 6 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 4 def description_play "Creates a playlist and start playing. Resumes playback." end |
#description_prev ⇒ Object
20 21 22 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 20 def description_prev "Play the last song in history playlist." end |
#description_quit ⇒ Object
24 25 26 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 24 def description_quit "Quits the playback and exit the player." end |
#description_repeat ⇒ Object
60 61 62 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 60 def description_repeat "Repeat the current playback from the begining." end |
#description_search ⇒ Object
28 29 30 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 28 def description_search "Search into the connected music drives." end |
#description_show ⇒ Object
32 33 34 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 32 def description_show "Shows representations of diverse objects in the player." end |
#description_shuffle ⇒ Object
40 41 42 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 40 def description_shuffle "Check the state of shuffle. Can turn it on and off." end |
#description_stop ⇒ Object
12 13 14 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 12 def description_stop "Stops current playback." end |
#usage_connect ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 284 def usage_connect return <<-USAGE usage: connect (literal | path => literal) This command allows you to create a new drive or reconnect an existing one. A drive is a logical folder or container that groups songs by path. This player uses this concept to organize your music directories. You can disconnect it to avoid the music search look in there. Examples: To connect a drive you use the following form: connect path/to/my/music => my_library To reconnect the same drive in the future (if you disconnect it for some reason): connect my_library USAGE end |
#usage_cultome_player ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 64 def usage_cultome_player cmds_availables = methods.grep(/^description_/).collect do |method_name| [method_name.to_s.gsub("description_", ""), send(method_name)] end border_width = 5 cmd_column_width = cmds_availables.reduce(0){|sum, arr| sum > arr[0].length ? sum : arr[0].length} desc_column_width = 90 - border_width - cmd_column_width cmds_availables_formatted = cmds_availables.collect do |arr| " " + arrange_in_columns(arr, [cmd_column_width, desc_column_width], border_width) end return <<-HELP usage: <command> [param param ...] The following commands are availables: #{cmds_availables_formatted.join("\n")} The params can be of any of these types: criterio A key:value pair. Only a,b,t are recognized. literal Any valid string. If contains spaces quotes or double quotes are required. object Identifiers preceded with an @. number An integer number. path A string representing a path in filesystem. boolean Can be true, false. Accept some others. ip An IP4 address. See 'help <command>' for more information on a especific command. Refer to the README file for a complete user guide. HELP end |
#usage_disconnect ⇒ Object
303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 303 def usage_disconnect return <<-USAGE usage: disconnect literal Disconnect a previously connected drive. With the drive disconnected the searches are not made in this drives. Examples: Disconnect a temporal download music drive: disconnect my_downloads USAGE end |
#usage_enqueue ⇒ Object
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 249 def usage_enqueue return <<-USAGE usage: enqueue [literal|number|criteria|object] Search, pick and extract the song defined in the parameters and creates a playlist that is appended to the *queue* playlist. Similar to a search with the literal and criteria parameters, but with number takes songs from the *focus* playlist, and with object extract the songs from the respective object. Examples: After the current song I want to play all Jugulator album: enqueue b:Jugulator Play te third song in the list after this: enqueue 3 USAGE end |
#usage_fb ⇒ Object
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 334 def usage_fb return <<-USAGE usage: fb [number] Fast backward the current playback 10 seconds by default. This time can be customized passing a parameter with the seconds to fast backward. Examples: Fas backward 10 seconds: fb Fas backward 5 seconds: fb 5 USAGE end |
#usage_ff ⇒ Object
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 317 def usage_ff return <<-USAGE usage: ff [number] Fast forward the current playback 10 seconds by default. This time can be customized passing a parameter with the seconds to fast forward. Examples: Fas forward 10 seconds: ff Fas forward 35 seconds: ff 35 USAGE end |
#usage_next ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 158 def usage_next return <<-USAGE usage: next Select the next song in the *current* playlist and play it, if there is any or if *repeat* is on. Examples: You dont like the music and wanna try lunk with the next: next USAGE end |
#usage_pause ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 124 def usage_pause return <<-USAGE usage: pause [boolean] Without parameters, toggle pause. Whit a boolean parameter... well, just you what is been told. Examples: If there is an active playback, pause it: pause If is paused, resume: pause If you wanna make sure is paused: pause on USAGE end |
#usage_play ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 98 def usage_play return <<-USAGE usage: play [literal|number|criteria|object] This command is intelligent, so it reacts depending on its context. Without parameters, if the current playlist is empty, play without parameters crate a playlist with all the music in your library and start playing, also if you stop or pause the player, this command resumes the playback where you left it. With parameters works as if you make a search and then create a playlist from the results. If you select songs from the *focus* playlist, this command dont replace the *current* playlist, just append the song to the *queue* playlist. Examples: Create a playlist with songs that contains "super" in its title, artist name o album name: play super Create a playlist with all the songs in the current album: play @album Create a playlist with songs whose artists contains the string "llica" or "gori": play a:llica a:gori If you use a command that modifies the *focus* playlist, you can play songs associated with their index in the list: play 1 5 9 USAGE end |
#usage_prev ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 172 def usage_prev return <<-USAGE usage: prev Select the last song in the *history* playlist and plays it again. Examples: "OMG! I love that song, lets hear it again": prev USAGE end |
#usage_quit ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 186 def usage_quit return <<-USAGE usage: quit Stop playback and exit player. Examples: You wanna quit the player: quit USAGE end |
#usage_repeat ⇒ Object
351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 351 def usage_repeat return <<-USAGE usage: stop Stop current playback. Examples Stop current playback: stop USAGE end |
#usage_search ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 200 def usage_search return <<-USAGE usage: search (literal|criteria) Search in the connected drives for song that fullfil the parameters criteria. When a search is made, the results go to the *search* and *focus* playlist. From there, they can be manipulated. To understand the results, I will explain the rules the search algorith uses: 1. Similar criteria creates an OR filter and differents create AND filter. Example: search t:tres a:uno a:dos This extract songs whose title contains "tres" and whose artist contains "uno" OR "dos" in their names 2. Literal words form and OR search uno dos tres This extract songs whose title, artist name or album name contains "uno" OR "dos" OR "tres". Examples: Get all my Gorillaz's songs search a:gorillaz Im in love and I wanna hear love-related songs: search love USAGE end |
#usage_show ⇒ Object
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 231 def usage_show return <<-USAGE usage: show [number|object] Display a representation of player's objects. Without parameters show the status of the current playback, if any. Examples: See how much time left of this song: show See what songs are in the *focus* playlist: show @focus USAGE end |
#usage_shuffle ⇒ Object
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 267 def usage_shuffle return <<-USAGE usage: shuffle [boolean] Without parameters, check the shuffle state. When parameters are provided, you can turn it on and off. Examples: Is shuffling?: shuffle Turn shuffle off: shuffle off USAGE end |
#usage_stop ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/cultome_player/player/interface/builtin_help.rb', line 144 def usage_stop return <<-USAGE usage: stop Stop the current playback. If *play* is called after *stop*, the playback will begin again. Examples: Stop current playback: stop USAGE end |