| 1 | #!/usr/bin/perl |
| 2 | use v5.14; |
| 3 | use warnings; |
| 4 | |
| 5 | use App::XMMS2::Notifier; |
| 6 | use Getopt::Long; |
| 7 | |
| 8 | my $format = '$artist - $title'; |
| 9 | GetOptions ("format=s" => \$format); |
| 10 | App::XMMS2::Notifier::run($format) |
| 11 | |
| 12 | __END__ |
| 13 | |
| 14 | =head1 NAME |
| 15 | |
| 16 | xmms2-notifier - script which notifies you what xmms2 is playing |
| 17 | |
| 18 | =head1 SYNOPSIS |
| 19 | |
| 20 | # Shows libnotify notifications e.g. "Silence - Cellule" |
| 21 | xmms2-notifier |
| 22 | |
| 23 | # Shows libnotify notifications e.g. "Cellule by Silence (L'autre endroit), year 2005, genre Electro" |
| 24 | xmms2-notifier --format="$title by $artist ($album), year $date, genre $genre" |
| 25 | |
| 26 | =head1 DESCRIPTION |
| 27 | |
| 28 | xmms2-notifier is a script which shows libnotify notifications when |
| 29 | the song is changed and when the playback is started/resumed. |
| 30 | |
| 31 | You can control the notification format with the B<--format> argument. |
| 32 | The following strings are replaced: |
| 33 | |
| 34 | =over |
| 35 | |
| 36 | =item $bitrate |
| 37 | |
| 38 | The song bitrate, in bits/s. Example: 785104 |
| 39 | |
| 40 | =item $date |
| 41 | |
| 42 | Usually the year the song was published. Example: 2005 |
| 43 | |
| 44 | =item $sample_format |
| 45 | |
| 46 | The format of each sample. Example: S16 |
| 47 | |
| 48 | =item $url |
| 49 | |
| 50 | An URL that points to the song. Example: file:///ext/Music/Silence+-+Cellule.flac |
| 51 | |
| 52 | =item $id |
| 53 | |
| 54 | The XMMS2 id of the song. Example: 498 |
| 55 | |
| 56 | =item $channels |
| 57 | |
| 58 | The number of channels the song has. Example: 2 |
| 59 | |
| 60 | =item $samplerate |
| 61 | |
| 62 | The sample rate of the song, in Hz. Example: 44100 |
| 63 | |
| 64 | =item $tracknr |
| 65 | |
| 66 | The track number in the album. Example: 1 |
| 67 | |
| 68 | =item $genre |
| 69 | |
| 70 | The genre of the song. Example: Electro |
| 71 | |
| 72 | =item $artist |
| 73 | |
| 74 | The artist/band. Example: Silence |
| 75 | |
| 76 | =item $album |
| 77 | |
| 78 | The album the song is from. Example: L'autre endroit |
| 79 | |
| 80 | =item $title |
| 81 | |
| 82 | The song title. Example: Cellule |
| 83 | |
| 84 | =back |
| 85 | |
| 86 | =head1 SEE ALSO |
| 87 | |
| 88 | L<xmms2(1)> |
| 89 | |
| 90 | =head1 AUTHOR |
| 91 | |
| 92 | Marius Gavrilescu, E<lt>marius@ieval.roE<gt> |
| 93 | |
| 94 | =head1 COPYRIGHT AND LICENSE |
| 95 | |
| 96 | Copyright (C) 2013 by Marius Gavrilescu |
| 97 | |
| 98 | This library is free software; you can redistribute it and/or modify |
| 99 | it under the same terms as Perl itself, either Perl version 5.14.2 or, |
| 100 | at your option, any later version of Perl 5 you may have available. |
| 101 | |
| 102 | |
| 103 | =cut |
| 104 | |