viewing source for "README"
last commit
commit 170df1b11aaf646f19daa0abd24d57f619c28b03
Date: Sun Feb 3 09:57:58 2008 -0800
source code
01: # Rmpc Notify #
02:
03: What is it? For people like me using the [MPD Music
04: Server][1], I present a simple notification daemon written
05: in [Ruby][2] using the [ruby-libnotify][3] and [librmpd][4]
06: libraries.
07:
08: Better than words, let the screenshots explain!
09:
10: ## Screen Shots ##
11:
12: The current song notification, displayed on song changes:
13:
14: <div class="image">
15: <image alt="current song" src="/code/rmpc-notify/images/current_song.png" />
16: <div class="image_footer">Current Song</div>
17: </div>
18:
19: The notification if MPD becomes stopped:
20:
21: <div class="image">
22: <image alt="stopped" src="/code/rmpc-notify/images/stopped.png" />
23: <div class="image_footer">Stopped Playback</div>
24: </div>
25:
26: The notification if MPD becomes paused:
27:
28: <div class="image">
29: <img alt="paused" src="/code/rmpc-notify/images/paused.png" />
30: <div class="image_footer">Paused Playback</div>
31: </div>
32:
33: ## Usage ##
34:
35: First make sure you have the necessary dependencies
36: installed. Besides MPD, you need [ruby-libnotify][3] and
37: [librmpd][4].
38:
39: Once you have those installed, download Rmpc Notify and
40: that's it! Everything you need is contained in the file
41: `rmpc-notify.rb`. There are two ways to run Rmpc Notify,
42: the first is to just let it run in the foreground, and the
43: second is to fork it as a daemon.
44:
45: Forking it as a daemon is preferred; you get your
46: controlling terminal back and you have a few extra features.
47: First let's see what we can do:
48:
49: andy$ ./rmpc-notify.rb --help
50: rmpc-notify.rb usage:
51: -h host - MPD hostname (default: localhost)
52: -p port - MPD port (default: 6600)
53: -d - enable daemon mode (default: off)
54: -s - Tells the currently running daemon to
55: display the current song
56: -k - stop an already running copy
57: --help - print this help
58:
59: So we have some options! First, we can specify the host and
60: port of the MPD server to connect to. If left off, these
61: default to `localhost` and `6600` respectively. For example,
62: if your MPD server is running on `mpdserver` at port `7700`:
63:
64: andy$ ./rmpc-notify.rb -h mpdserver -p 7700
65:
66: Next comes the optional daemon mode. Without the `-d` flag,
67: the process will stay in the foreground and will terminate
68: when you close the terminal. You probably don't want that.
69: Specifying the `-d` flag will cause a file named
70: `.rmpcnotify.pid` to be created in your home directory.
71: This contains the process ID so that the daemon can later be
72: shutdown
73:
74: andy$ ./rmpc-notify.rb -d
75:
76: Now we can use the other options. `-s` will cause an already
77: running daemon to display the currently playing song:
78:
79: andy$ ./rmpc-notify.rb -s
80:
81: Finally, `-k` will kill a currently running daemon:
82:
83: andy$ ./rmpc-notify.rb -k
84: Stopped rmpc-notify (pid 16345)
85:
86: [1]: http://musicpd.org
87: [2]: http://ruby-lang.org
88: [3]: http://ruby-libnotify.rubyforge.org
89: [4]: http://librmpd.rubyforge.org