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: connect (literal | path => literal)\n\nThis command allows you to create a new drive or reconnect an existing one.\nA drive is a logical folder or container that groups songs by path. This player uses this concept to organize your music directories.\nYou can disconnect it to avoid the music search look in there.\n\nExamples:\n\nTo connect a drive you use the following form:\n connect path/to/my/music => my_library\n\nTo reconnect the same drive in the future (if you disconnect it for some reason):\n connect my_library\n\n USAGE\nend\n" |
#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 "usage: <command> [param param ...]\n\nThe following commands are availables:\n\#{cmds_availables_formatted.join(\"\\n\")}\n\nThe params can be of any of these types:\n criterio A key:value pair. Only a,b,t are recognized.\n literal Any valid string. If contains spaces quotes or double quotes are required.\n object Identifiers preceded with an @.\n number An integer number.\n path A string representing a path in filesystem.\n boolean Can be true, false. Accept some others.\n ip An IP4 address.\n\nSee 'help <command>' for more information on a especific command.\n\nRefer to the README file for a complete user guide.\n HELP\nend\n" |
#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: disconnect literal\n\nDisconnect a previously connected drive. With the drive disconnected the searches are not made in this drives.\n\nExamples:\n\nDisconnect a temporal download music drive:\n disconnect my_downloads\n\n USAGE\nend\n" |
#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: enqueue [literal|number|criteria|object]\n\nSearch, pick and extract the song defined in the parameters and creates a playlist that is appended to the *queue* playlist.\nSimilar 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.\n\nExamples:\n\nAfter the current song I want to play all Jugulator album:\n enqueue b:Jugulator\n\nPlay te third song in the list after this:\n enqueue 3\n\n USAGE\nend\n" |
#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: fb [number]\n\nFast backward the current playback 10 seconds by default. This time can be customized passing a parameter with the seconds to fast backward.\n\nExamples:\n\nFas backward 10 seconds:\n fb\n\nFas backward 5 seconds:\n fb 5\n\n USAGE\nend\n" |
#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: ff [number]\n\nFast forward the current playback 10 seconds by default. This time can be customized passing a parameter with the seconds to fast forward.\n\nExamples:\n\nFas forward 10 seconds:\n ff\n\nFas forward 35 seconds:\n ff 35\n\n USAGE\nend\n" |
#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: next\n\nSelect the next song in the *current* playlist and play it, if there is any or if *repeat* is on.\n\nExamples:\n\nYou dont like the music and wanna try lunk with the next:\n next\n\n USAGE\nend\n" |
#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: pause [boolean]\n\nWithout parameters, toggle pause. Whit a boolean parameter... well, just you what is been told.\n\nExamples:\n \nIf there is an active playback, pause it:\n pause\n\nIf is paused, resume:\n pause\n\nIf you wanna make sure is paused:\n pause on\n\n USAGE\nend\n" |
#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: play [literal|number|criteria|object]\n\nThis command is intelligent, so it reacts depending on its context. \nWithout 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.\nWith parameters works as if you make a search and then create a playlist from the results.\nIf you select songs from the *focus* playlist, this command dont replace the *current* playlist, just append the song to the *queue* playlist.\n\nExamples:\n\nCreate a playlist with songs that contains \"super\" in its title, artist name o album name:\n play super\n\nCreate a playlist with all the songs in the current album:\n play @album\n\nCreate a playlist with songs whose artists contains the string \"llica\" or \"gori\":\n play a:llica a:gori\n\nIf you use a command that modifies the *focus* playlist, you can play songs associated with their index in the list:\n play 1 5 9\n\n USAGE\nend\n" |
#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: prev\n\nSelect the last song in the *history* playlist and plays it again.\n\nExamples:\n\n\"OMG! I love that song, lets hear it again\":\n prev\n\n USAGE\nend\n" |
#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: quit\n\nStop playback and exit player.\n\nExamples:\n\nYou wanna quit the player:\n quit\n\n USAGE\nend\n" |
#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: stop\n\nStop current playback.\n\nExamples\n\nStop current playback:\n stop\n\n USAGE\nend\n" |
#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: search (literal|criteria)\n\nSearch in the connected drives for song that fullfil the parameters criteria.\nWhen a search is made, the results go to the *search* and *focus* playlist. From there, they can be manipulated.\nTo understand the results, I will explain the rules the search algorith uses:\n 1. Similar criteria creates an OR filter and differents create AND filter.\n Example:\n\nsearch t:tres a:uno a:dos\n\nThis extract songs whose title contains \"tres\" and whose artist contains \"uno\" OR \"dos\" in their names\n\n 2. Literal words form and OR\n\nsearch uno dos tres\n\nThis extract songs whose title, artist name or album name contains \"uno\" OR \"dos\" OR \"tres\".\n\nExamples:\n\nGet all my Gorillaz's songs\n search a:gorillaz\n\nIm in love and I wanna hear love-related songs:\n search love\n\n USAGE\nend\n" |
#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: show [number|object]\n\nDisplay a representation of player's objects.\nWithout parameters show the status of the current playback, if any.\n\nExamples:\n\nSee how much time left of this song:\n show\n\nSee what songs are in the *focus* playlist:\n show @focus\n\n USAGE\nend\n" |
#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: shuffle [boolean]\n\nWithout parameters, check the shuffle state. When parameters are provided, you can turn it on and off.\n\nExamples:\n\nIs shuffling?:\n shuffle\n\nTurn shuffle off:\n shuffle off\n\n USAGE\nend\n" |
#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: stop\n\nStop the current playback. If *play* is called after *stop*, the playback will begin again.\n\nExamples:\n\nStop current playback:\n stop\n\n USAGE\nend\n" |