| 1 | package App::Pimpd::Doc; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | BEGIN { | ||
| 5 | use Exporter; | ||
| 6 | use vars qw(@ISA @EXPORT); | ||
| 7 | @ISA = qw(Exporter); | ||
| 8 | @EXPORT = qw( | ||
| 9 | help | ||
| 10 | ); | ||
| 11 | } | ||
| 12 | |||
| 13 | use App::Pimpd; | ||
| 14 | use Term::ExtendedColor qw(fg bold); | ||
| 15 | |||
| 16 | sub help { | ||
| 17 | my $cmd = shift; | ||
| 18 | |||
| 19 | my %help = ( | ||
| 20 | |||
| 21 | # Controls | ||
| 22 | 'next' => \&_help_next, | ||
| 23 | 'previous' => \&_help_previous, | ||
| 24 | 'pause' => \&_help_pause, | ||
| 25 | 'repeat' => \&_help_repeat, | ||
| 26 | 'random' => \&_help_random, | ||
| 27 | 'clear' => \&_help_clear, | ||
| 28 | 'crop' => \&_help_crop, | ||
| 29 | 'kill' => \&_help_kill, | ||
| 30 | 'stop' => \&_help_stop, | ||
| 31 | |||
| 32 | # Collection | ||
| 33 | 'songs' => \&_help_songs, | ||
| 34 | 'albums' => \&_help_albums, | ||
| 35 | 'sany' => \&_help_sany, | ||
| 36 | 'sartist' => \&_help_sartist, | ||
| 37 | 'salbum' => \&_help_salbum, | ||
| 38 | 'stitle' => \&_help_stitle, | ||
| 39 | 'slove' => \&_help_slove, | ||
| 40 | |||
| 41 | 'stats' => \&_help_stats, | ||
| 42 | 'status' => \&_help_status, | ||
| 43 | |||
| 44 | # Playlist | ||
| 45 | 'playlist' => \&_help_playlist, | ||
| 46 | 'lsplaylists' => \&_help_lsplaylists, | ||
| 47 | 'add' => \&_help_add, | ||
| 48 | 'add-album' => \&_help_add_album, | ||
| 49 | #'add-files' => \&_help_add_files, | ||
| 50 | #'add-playlist' => \&_help_add_playlist, | ||
| 51 | 'randomize' => \&_help_randomize, | ||
| 52 | 'randomalbum' => \&_help_randomize_albums, | ||
| 53 | 'randomtrack' => \&_help_random_track, | ||
| 54 | 'rmalbum' => \&_help_rm_album, | ||
| 55 | 'delete-album' => \&_help_delete_album, | ||
| 56 | 'love' => \&_help_love, | ||
| 57 | 'loved?' => \&_help_loved, | ||
| 58 | 'unlove' => \&_help_unlove, | ||
| 59 | 'splaylist' => \&_help_splaylist, | ||
| 60 | |||
| 61 | |||
| 62 | # Options | ||
| 63 | 'queue' => \&_help_queue, | ||
| 64 | 'shell' => \&_help_shell, | ||
| 65 | 'help' => \&_help_shell, | ||
| 66 | 'copy' => \&_help_copy, | ||
| 67 | 'info' => \&_help_info, | ||
| 68 | 'np' => \&_help_np, | ||
| 69 | ); | ||
| 70 | |||
| 71 | if(exists($help{$cmd})) { | ||
| 72 | return $help{$cmd}->(); | ||
| 73 | } | ||
| 74 | else { | ||
| 75 | return "No such topic.\n"; | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | sub _help_status { | ||
| 80 | return << "EOF" | ||
| 81 | @{[fg('bold', 'Usage')]}: status | ||
| 82 | |||
| 83 | Display MPD status | ||
| 84 | |||
| 85 | EOF | ||
| 86 | } | ||
| 87 | sub _help_stats { | ||
| 88 | return << "EOF" | ||
| 89 | @{[fg('bold', 'Usage')]}: stats | ||
| 90 | |||
| 91 | Display statistics about MPD | ||
| 92 | |||
| 93 | EOF | ||
| 94 | } | ||
| 95 | |||
| 96 | sub _help_unlove { | ||
| 97 | return << "EOF" | ||
| 98 | @{[fg('bold', 'Usage')]}: unlove PATTERN | ||
| 99 | |||
| 100 | Un-love file(s) matching PATTERN. | ||
| 101 | |||
| 102 | EOF | ||
| 103 | } | ||
| 104 | |||
| 105 | sub _help_add_album { | ||
| 106 | return << "EOF" | ||
| 107 | @{[fg('bold', 'Usage')]}: add-album ALBUM | ||
| 108 | |||
| 109 | Add all songs from ALBUM to playlist. | ||
| 110 | If ALBUM is omitted, use albumtag from the current song. | ||
| 111 | |||
| 112 | EOF | ||
| 113 | } | ||
| 114 | |||
| 115 | |||
| 116 | sub _help_add { | ||
| 117 | return << "EOF" | ||
| 118 | @{[fg('bold', 'Usage')]}: add FILES || PLAYLIST | ||
| 119 | |||
| 120 | Argument can be either a playlist or a command that produces file lists. | ||
| 121 | Those commands include; | ||
| 122 | |||
| 123 | songs add all songs from the current album | ||
| 124 | slove add all songs matching pattern given to slove | ||
| 125 | |||
| 126 | EOF | ||
| 127 | } | ||
| 128 | |||
| 129 | sub _help_slove { | ||
| 130 | return << "EOF" | ||
| 131 | @{[fg('bold', 'Usage')]}: slove PATTERN | ||
| 132 | |||
| 133 | Search the database with loved songs for PATTERN. | ||
| 134 | |||
| 135 | If PATTERN is omitted, returns all loved songs. | ||
| 136 | |||
| 137 | The results are added to the current playlist. | ||
| 138 | EOF | ||
| 139 | } | ||
| 140 | |||
| 141 | sub _help_random_track { | ||
| 142 | return << "EOF" | ||
| 143 | @{[fg('bold', 'Usage')]}: randomtrack | ||
| 144 | |||
| 145 | Play a random song from the current playlist. | ||
| 146 | EOF | ||
| 147 | } | ||
| 148 | |||
| 149 | sub _help_stop { | ||
| 150 | return << "EOF" | ||
| 151 | @{[fg('bold', 'Usage')]}: stop | ||
| 152 | |||
| 153 | Stop @{[fg('bold', 'local and remote')]} playback. | ||
| 154 | EOF | ||
| 155 | } | ||
| 156 | |||
| 157 | |||
| 158 | sub _help_kill { | ||
| 159 | return << "EOF" | ||
| 160 | @{[fg('bold', 'Usage')]}: kill | ||
| 161 | |||
| 162 | Stop @{[fg('bold', 'local')]} playback. | ||
| 163 | EOF | ||
| 164 | } | ||
| 165 | |||
| 166 | sub _help_crop { | ||
| 167 | return << "EOF" | ||
| 168 | @{[fg('bold', 'Usage')]}: crop | ||
| 169 | |||
| 170 | Remove all but the current song from the playlist. | ||
| 171 | EOF | ||
| 172 | } | ||
| 173 | |||
| 174 | |||
| 175 | sub _help_clear { | ||
| 176 | return << "EOF" | ||
| 177 | @{[fg('bold', 'Usage')]}: clear | ||
| 178 | |||
| 179 | Clear the current playlist. | ||
| 180 | EOF | ||
| 181 | } | ||
| 182 | |||
| 183 | sub _help_random { | ||
| 184 | return << "EOF" | ||
| 185 | @{[fg('bold', 'Usage')]}: random | ||
| 186 | |||
| 187 | Toggle random on/off. | ||
| 188 | EOF | ||
| 189 | } | ||
| 190 | |||
| 191 | sub _help_repeat { | ||
| 192 | return << "EOF" | ||
| 193 | @{[fg('bold', 'Usage')]}: repeat | ||
| 194 | |||
| 195 | Toggle repeat on/off. | ||
| 196 | EOF | ||
| 197 | } | ||
| 198 | |||
| 199 | sub _help_pause { | ||
| 200 | return << "EOF" | ||
| 201 | @{[fg('bold', 'Usage')]}: pause | ||
| 202 | |||
| 203 | Toggle playback status. | ||
| 204 | EOF | ||
| 205 | } | ||
| 206 | |||
| 207 | sub _help_previous { | ||
| 208 | return << "EOF" | ||
| 209 | @{[fg('bold', 'Usage')]}: previous | ||
| 210 | |||
| 211 | Play the previous song in playlist. | ||
| 212 | EOF | ||
| 213 | } | ||
| 214 | |||
| 215 | sub _help_next { | ||
| 216 | return << "EOF" | ||
| 217 | @{[fg('bold', 'Usage')]}: next | ||
| 218 | |||
| 219 | Play the next song in playlist. | ||
| 220 | EOF | ||
| 221 | } | ||
| 222 | |||
| 223 | |||
| 224 | sub _help_stitle { | ||
| 225 | return << "EOF" | ||
| 226 | @{[fg('bold', 'Usage')]}: sartist TITLE | ||
| 227 | |||
| 228 | Search the collection for songs where the title tag | ||
| 229 | @{[fg('bold', 'partially')]} matches TITLE. | ||
| 230 | The results are added to the current playlist. | ||
| 231 | EOF | ||
| 232 | } | ||
| 233 | |||
| 234 | sub _help_salbum { | ||
| 235 | return << "EOF" | ||
| 236 | @{[fg('bold', 'Usage')]}: sartist ALBUM | ||
| 237 | |||
| 238 | Search the collection for songs where the album tag | ||
| 239 | @{[fg('bold', 'partially')]} matches ALBUM. | ||
| 240 | The results are added to the current playlist. | ||
| 241 | EOF | ||
| 242 | } | ||
| 243 | sub _help_sartist { | ||
| 244 | return << "EOF" | ||
| 245 | @{[fg('bold', 'Usage')]}: sartist ARTIST | ||
| 246 | |||
| 247 | Search the collection for songs where the artist tag | ||
| 248 | @{[fg('bold', 'partially')]} matches ARTIST. | ||
| 249 | The results are added to the current playlist. | ||
| 250 | EOF | ||
| 251 | } | ||
| 252 | |||
| 253 | |||
| 254 | |||
| 255 | sub _help_sany { | ||
| 256 | return << "EOF" | ||
| 257 | @{[fg('bold', 'Usage')]}: sany PATTERN | ||
| 258 | |||
| 259 | Search the collection for filenams matching PATTERN. | ||
| 260 | The results are added to the current playlist. | ||
| 261 | EOF | ||
| 262 | } | ||
| 263 | |||
| 264 | |||
| 265 | sub _help_albums { | ||
| 266 | return << "EOF" | ||
| 267 | @{[fg('bold', 'Usage')]}: albums [ARTIST] | ||
| 268 | |||
| 269 | List albums where ARTIST is featured. | ||
| 270 | If ARTIST is omitted, use the artist tag from the currently | ||
| 271 | playing song. | ||
| 272 | EOF | ||
| 273 | } | ||
| 274 | |||
| 275 | |||
| 276 | sub _help_songs { | ||
| 277 | return << "EOF" | ||
| 278 | @{[fg('bold', 'Usage')]}: songs [ALBUM] | ||
| 279 | |||
| 280 | List songs on ALBUM. | ||
| 281 | If ALBUM is omitted, use the album tag from the currently playing | ||
| 282 | song. | ||
| 283 | EOF | ||
| 284 | } | ||
| 285 | |||
| 286 | |||
| 287 | |||
| 288 | sub _help_queue { | ||
| 289 | return << "EOF" | ||
| 290 | @{[fg('bold', 'Usage')]}: queue INTEGERs | ||
| 291 | |||
| 292 | Put songs in a queue. | ||
| 293 | Arguments need to be valid playlist position IDs, as shown in | ||
| 294 | the 'playlist' output. | ||
| 295 | EOF | ||
| 296 | } | ||
| 297 | |||
| 298 | sub _help_splaylist { | ||
| 299 | return << "EOF" | ||
| 300 | @{[fg('bold', 'Usage')]}: splaylist PATTERN | ||
| 301 | |||
| 302 | Search the current playlist for PATTERN. | ||
| 303 | If more then one result is found, queue up the results. | ||
| 304 | |||
| 305 | See 'help queue'. | ||
| 306 | EOF | ||
| 307 | } | ||
| 308 | |||
| 309 | sub _help_love { | ||
| 310 | return << "EOF" | ||
| 311 | @{[fg('bold', 'Usage')]}: love [PLAYLIST] | ||
| 312 | |||
| 313 | Add the currently playing track to the library of loved songs. | ||
| 314 | If PLAYLIST is omitted, the song is added to a playlist following | ||
| 315 | this naming scheme: | ||
| 316 | |||
| 317 | @{[fg($c[0], '%year-%month-%genre.m3u')]} | ||
| 318 | |||
| 319 | If a genre tag is missing, the string 'undef' is used in its place. | ||
| 320 | EOF | ||
| 321 | } | ||
| 322 | |||
| 323 | sub _help_loved { | ||
| 324 | return << "EOF" | ||
| 325 | @{[fg('bold', 'Usage')]}: loved? | ||
| 326 | |||
| 327 | Check if the current song is already loved. | ||
| 328 | EOF | ||
| 329 | } | ||
| 330 | |||
| 331 | sub _help_delete_album { | ||
| 332 | return << "EOF" | ||
| 333 | @{[fg('bold', 'Usage')]}: delete_album | ||
| 334 | |||
| 335 | Deletes the current album from disk. | ||
| 336 | EOF | ||
| 337 | } | ||
| 338 | |||
| 339 | |||
| 340 | sub _help_rm_album { | ||
| 341 | return << "EOF" | ||
| 342 | @{[fg('bold', 'Usage')]}: rmalbum PATTERN | ||
| 343 | |||
| 344 | Search the current playlist for albums matching PATTERN and | ||
| 345 | removes the matches from the playlist. | ||
| 346 | EOF | ||
| 347 | } | ||
| 348 | |||
| 349 | |||
| 350 | |||
| 351 | sub _help_playlists { | ||
| 352 | return << "EOF" | ||
| 353 | @{[fg('bold', 'Usage')]}: playlists | ||
| 354 | |||
| 355 | List all by MPD known playlists. | ||
| 356 | EOF | ||
| 357 | } | ||
| 358 | |||
| 359 | |||
| 360 | sub _help_playlist { | ||
| 361 | return << "EOF" | ||
| 362 | @{[fg('bold', 'Usage')]}: playlist | ||
| 363 | |||
| 364 | Show the current playlist. | ||
| 365 | EOF | ||
| 366 | } | ||
| 367 | |||
| 368 | |||
| 369 | sub _help_shell { | ||
| 370 | return sprintf("\n%s%s", | ||
| 371 | "@{[fg('bold', fg($c[8], 'OPTIONS'))]}\t\t " . | ||
| 372 | "@{[fg('bold', fg($c[3], 'DESCRIPTION'))]} \t\t\t\t " | ||
| 373 | ," | ||
| 374 | np show the current song | ||
| 375 | info show all current information | ||
| 376 | copy copy song | ||
| 377 | optional argument: @{[bold('destination')]} | ||
| 378 | copya copy album | ||
| 379 | optional argument: @{[bold('destination')]} | ||
| 380 | queue put songs in a queue | ||
| 381 | |||
| 382 | @{[fg('bold', fg($c[0], ' Playlist'))]} | ||
| 383 | lsplaylists list all known playlists | ||
| 384 | add add playlists or songs to the current playlist | ||
| 385 | add-album add songs from album to playlist | ||
| 386 | rmalbum remove album from playlist | ||
| 387 | randomize randomize a new playlist with n tracks | ||
| 388 | optional arguments: @{[bold('quantity')]}, @{[bold('artist')]} | ||
| 389 | randomalbum and n random full albums | ||
| 390 | optional arguments: @{[bold('quantity')]}, @{[bold('artist')]} | ||
| 391 | love love song | ||
| 392 | loved? check if the current song is loved | ||
| 393 | unlove unlove file(s) matching PATTERN | ||
| 394 | splaylist search the current playlist for str | ||
| 395 | |||
| 396 | @{[fg('bold', fg($c[0], ' Collection'))]} | ||
| 397 | songs list songs on album | ||
| 398 | albums list albums by artist | ||
| 399 | optional argument: @{[bold('artist')]} | ||
| 400 | sartist search for artist str | ||
| 401 | salbum search for album str | ||
| 402 | stitle search for title str | ||
| 403 | sany search database for str | ||
| 404 | slove search the database with loved songs for pattern | ||
| 405 | |||
| 406 | @{[fg('bold', fg($c[0], ' Controls'))]} | ||
| 407 | next next track in playlist | ||
| 408 | previous previous track in playlist | ||
| 409 | pause toggle playback | ||
| 410 | repeat toggle repeat on/off | ||
| 411 | random toggle random on/off | ||
| 412 | clear clear playlist | ||
| 413 | crop remove all tracks but the current one | ||
| 414 | kill stop local playback | ||
| 415 | |||
| 416 | help show help for command | ||
| 417 | exit exit pimpd2 | ||
| 418 | |||
| 419 | \n", shift, | ||
| 420 | ); | ||
| 421 | } | ||
| 422 | |||
| 423 | |||
| 424 | sub _help_copy { | ||
| 425 | return << "EOF" | ||
| 426 | @{[fg('bold', 'Usage')]}: copy [DESTINATION] | ||
| 427 | |||
| 428 | Copy the currently playing song to DESTINATION. | ||
| 429 | |||
| 430 | If DESTINATION is omitted, use the @{[fg($c[0], '$target_directory')]} | ||
| 431 | setting defined in @{[fg('bold', 'pimpd2.conf')]}. | ||
| 432 | EOF | ||
| 433 | } | ||
| 434 | |||
| 435 | |||
| 436 | sub _help_info { | ||
| 437 | return << "EOF" | ||
| 438 | @{[fg('bold', 'Usage')]}: info | ||
| 439 | |||
| 440 | Show all available song metadata, as well as playback status | ||
| 441 | and various MPD settings. | ||
| 442 | EOF | ||
| 443 | } | ||
| 444 | |||
| 445 | |||
| 446 | sub _help_np { | ||
| 447 | return << "EOF" | ||
| 448 | @{[fg('bold', 'Usage')]}: np | ||
| 449 | |||
| 450 | Show basic song metadata on a single line. | ||
| 451 | EOF | ||
| 452 | } | ||
| 453 | |||
| 454 | |||
| 455 | |||
| 456 | sub _help_randomize { | ||
| 457 | return << "EOF" | ||
| 458 | @{[fg('bold', 'Usage')]}: randomize [INTEGER] [ARTIST] | ||
| 459 | |||
| 460 | Add n random songs from the collection to the current playlist. | ||
| 461 | |||
| 462 | The first, optional argument, is the number of songs to add. | ||
| 463 | The second, optional argument, is an artist name. | ||
| 464 | If a second argument is provided, add n random songs from that artist. | ||
| 465 | |||
| 466 | Defaults to 100 random songs. | ||
| 467 | EOF | ||
| 468 | } | ||
| 469 | |||
| 470 | sub _help_randomize_albums { | ||
| 471 | return << "EOF" | ||
| 472 | @{[fg('bold', 'Usage')]}: randomalbum [INTEGER] | ||
| 473 | |||
| 474 | Add n random full albums to the current playlist. | ||
| 475 | |||
| 476 | Defaults to 10 albums. | ||
| 477 | EOF | ||
| 478 | } | ||
| 479 | |||
| 480 | 1; | ||
| 481 | |||
| 482 | __END__ |