You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2id="table-of-contents">Table of Contents <spanstyle="padding-left: 10px;"><supstyle="font-size: 50%"><ahref="#" title="Go to top of the page">Top</a></sup></span></h2>
<p><ahref="README.html">[Return to main doc]</a></p>
61
61
<h2id="introduction">Introduction <spanstyle="padding-left: 10px;"><supstyle="font-size: 50%"><ahref="#" title="Go to top of the page">Top</a></sup></span></h2>
62
-
<p><strong>PyRadio</strong> can provide Desktop Notifications when a notification daemon is already present (on Linux and BSD), or throught <strong>Windows Notification Service</strong> (<strong>WNS</strong>).</p>
62
+
<p><strong>PyRadio</strong> can provide Desktop Notifications when a notification daemon is already present (on Linux and BSD), or through <strong>Windows Notification Service</strong> (<strong>WNS</strong>).</p>
63
+
<p>The behavior and presentation of notifications greatly depends on the daemon/service and command line utility used to trigger a notification.</p>
63
64
<p>If enabled, <strong>PyRadio</strong> will display:</p>
64
65
<oltype="1">
65
-
<li>Song info (as provided by the radio station)<br/>
66
-
That means that if the radio station does not provide any info, no notification will be issued.</li>
66
+
<li>The playlist name, when playback starts.</li>
67
+
<li>Song info (as provided by the radio station).</li>
67
68
<li>Connection failure messages.</li>
68
69
<li>Player crash messages.</li>
69
70
</ol>
70
-
<pstyle="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> If Desktop Notification is enabled by default (in the case of a distro package) users can disable it by creating an empty <strong>~/.config/pyradio/notification</strong> file (Linux only).</p>
71
+
<p>Desktop Notifications are disabled by default.</p>
72
+
<h3id="configuration">Configuration</h3>
73
+
<p>Desktop Notifications are disabled by default. To enable them, go to <strong>PyRadio</strong> config window and customize the “<em>Enable notifications</em>” option.</p>
74
+
<p>Available values are:</p>
75
+
<pre> -1: disabled (deault)
76
+
0: enabled (no repetition)
77
+
x: enabled and repeat every x seconds</pre>
78
+
<p><strong>PyRadio</strong> supports notifications repetition, so that even when used with quake or yakuake and the like, you still have some info on what’s going on with it.</p>
79
+
<p>Notifications can be set to repeat every “<em>x</em>” seconds, with “<em>x</em>” ranging from 30 to 300 (30 seconds to 5 minutes), in 30 seconds steps.</p>
71
80
<h2id="on-linux">On Linux <spanstyle="padding-left: 10px;"><supstyle="font-size: 50%"><ahref="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>On Linux (and the BSDs), <strong>PyRadio</strong> uses the <em>notification daemon</em> that’s already present, using whatever command it provides to send notifications to the daemon.</p>
75
-
<p>On my linux box, this is done using the <strong>notify-send</strong> command (as it would be with most distros).</p>
76
-
<p>This is its help screen.</p>
77
-
<pre># notify-send --help
78
-
79
-
Usage:
80
-
notify-send [OPTION…] <SUMMARY> [BODY] - create a notification
81
-
82
-
Help Options:
83
-
-?, --help Show help options
84
-
85
-
Application Options:
86
-
-u, --urgency=LEVEL Specifies the urgency level (low, normal, critical).
87
-
-t, --expire-time=TIME Specifies the timeout in milliseconds at which to expire the notification.
88
-
-a, --app-name=APP_NAME Specifies the app name for the icon
89
-
-i, --icon=ICON Specifies an icon filename or stock icon to display.
90
-
-c, --category=TYPE[,TYPE...] Specifies the notification category.
91
-
-e, --transient Create a transient notification
92
-
-h, --hint=TYPE:NAME:VALUE Specifies basic extra data to pass. Valid types are boolean, int, double, string, byte and variant.
93
-
-p, --print-id Print the notification ID.
94
-
-r, --replace-id=REPLACE_ID The ID of the notification to replace.
95
-
-w, --wait Wait for the notification to be closed before exiting.
96
-
-A, --action=[NAME=]Text... Specifies the actions to display to the user. Implies --wait to wait for user input. May be set multiple times. The name of the action is output to stdout. If NAME is not specified, the numerical index of the option is used (starting with 0).
97
-
-v, --version Version of the package.</pre>
98
-
<p>In order to make <strong>PyRadio</strong> use it, we wil use this help screen to create a valid command, for example:</p>
99
-
<pre>notify-send -i ~/.config/pyradio/pyradio.png -t 6000 TITLE MSG</pre>
83
+
<p>On Linux (and the BSDs), <strong>PyRadio</strong> uses the <em>notification daemon</em> that’s already present and whatever command line helper program it provides to send notifications to the daemon.</p>
84
+
<p>By default, <strong>PyRadio</strong> uses the following command to issue notifications:</p>
85
+
<pre>notify-send -i ICON TITLE MSG</pre>
100
86
<p>This command will:</p>
101
87
<ul>
102
-
<li>display an icon (-i)<br/>
103
-
The icon is already in <strong>PyRadio</strong> config folder; just use the full path to it.</li>
104
-
<li>display the notification for 6 seconds (-t)</li>
88
+
<li>display the title “<strong>TITLE</strong>” and message “<strong>MSG</strong>”.</li>
89
+
<li>display an icon (<strong>-i</strong>).</li>
105
90
</ul>
106
-
<p>The <strong>TITLE</strong> and <strong>MSG</strong> tokens are just placeholders; <strong>PyRadio</strong> will replace them with real data when issuing the notification.</p>
107
-
<p>When the command is ready, we just write it to <strong>~/.config/pyradio/notification</strong>, like so:</p>
108
-
<pre>echo "notify-send -i ~/.config/pyradio/pyradio.png -t 6000 TITLE MSG" > ~/.config/pyradio/notification</pre>
109
-
<p>Next time <strong>PyRadio</strong> is executed, it will read the above file, and start issuing notifications.</p>
110
-
<p>That was just an example to demonstrate the procedure one would follow to enable <strong>PyRadio</strong> Desktop Notifications.</p>
111
-
<p>Users can populate the <strong>~/.config/pyradio/notification</strong> files as needed and in accordance with their notification daemon / command.</p>
112
-
<h3id="packagers-info">Packagers info</h3>
113
-
<p>Since Desktop Notifications are not enabled by default, packages will have to populate the <strong>notification</strong> file manually (which is originally an empty file in the <strong>pyradio</strong> directory), using the procedure described above.</p>
114
-
<pstyle="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> The icon will probable by in <strong>/usr/share/icons</strong>.</p>
115
-
<pstyle="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> Individual users can disable the Desktop Notifications enabled by the installed packaged, by creating an empty <strong>~/.config/pyradio/notification</strong> file.</p>
91
+
<p>The “<strong>ICON</strong>”, “<strong>TITLE</strong>” and “<strong>MSG</strong>” tokens are just placeholders; <strong>PyRadio</strong> will replace them with real data when issuing the notification.</p>
92
+
<p>If that does not work for you, or you want to customize the output, this is what to do:</p>
93
+
<oltype="1">
94
+
<li>put together a valid command that can be executed on a terminal and produce the desired notification.</li>
95
+
<li>create a file called <strong>notification</strong> in <strong>PyRadio</strong> configuration directory.</li>
96
+
<li>write the above command in that file and put each field in a different line.</li>
97
+
</ol>
98
+
<p><strong>Example:</strong></p>
99
+
<p>I have this custom command:</p>
100
+
<pre>notify-send -i ICON -t 6000 TITLE MSG</pre>
101
+
<p>The file I wrote is <strong>~/.config/pyradio/notification</strong>:</p>
102
+
<pre>notify-send
103
+
-i
104
+
ICON
105
+
-t
106
+
6000
107
+
TITLE
108
+
MSG</pre>
116
109
<h2id="on-macos">On MacOS <spanstyle="padding-left: 10px;"><supstyle="font-size: 50%"><ahref="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>MacOS Maverick (and later) provides a standardized way to display notifications, so it’s much more easier to enable them for <strong>PyRadio</strong>.</p>
120
-
<p>Just create a non-empty <strong>~/.config/pyradio/notification</strong> file:</p>
<pre>osascript -e 'display notification "MSG" with title "TITLE"'
115
+
</pre>
116
+
<p>If that does not work for you, or you want to display the icon as well, just install terminal-notifier:</p>
117
+
<pre>brew install terminal-notifier</pre>
118
+
<p>After it is installed, write the following in <strong>~/.config/pyradio/notification</strong>:</p>
119
+
<pre>terminal-notifier
120
+
-message
121
+
MSG
122
+
-title
123
+
TITLE
124
+
-appIcon
125
+
ICON</pre>
126
+
<p>and you are done!</p>
124
127
<h2id="on-windows">On Windows <spanstyle="padding-left: 10px;"><supstyle="font-size: 50%"><ahref="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>Window will display the program the notification comes from, which in this case is <strong>Python</strong>, not <strong>PyRadio</strong>.</p>
135
134
<p>By default, a sound is played when a notification is displayed, which is very annoying when using <strong>PyRadio</strong> to listen to music and such.</p>
@@ -21,123 +21,119 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
21
21
22
22
## Introduction
23
23
24
-
**PyRadio** can provide Desktop Notifications when a notification daemon is already present (on Linux and BSD), or throught **Windows Notification Service** (**WNS**).
24
+
**PyRadio** can provide Desktop Notifications when a notification daemon is already present (on Linux and BSD), or through **Windows Notification Service** (**WNS**).
25
+
26
+
The behavior and presentation of notifications greatly depends on the daemon/service and command line utility used to trigger a notification.
25
27
26
28
If enabled, **PyRadio** will display:
27
29
28
-
1.Song info (as provided by the radio station) \
29
-
That means that if the radio station does not provide any info, no notification will be issued.
30
+
1.The playlist name, when playback starts.
31
+
1. Song info (as provided by the radio station).
30
32
2. Connection failure messages.
31
33
3. Player crash messages.
32
34
33
-
**Note:** If Desktop Notification is enabled by default (in the case of a distro package) users can disable it by creating an empty **~/.config/pyradio/notification** file (Linux only).
On Linux (and the BSDs), **PyRadio** uses the *notification daemon* that's already present, using whatever command it provides to send notifications to the daemon.
40
37
41
-
On my linux box, this is done using the **notify-send** command (as it would be with most distros).
38
+
### Configuration
42
39
43
-
This is its help screen.
40
+
Desktop Notifications are disabled by default. To enable them, go to **PyRadio** config window and customize the "*Enable notifications*" option.
44
41
42
+
Available values are:
45
43
```
46
-
# notify-send --help
47
-
48
-
Usage:
49
-
notify-send [OPTION…] <SUMMARY> [BODY] - create a notification
50
-
51
-
Help Options:
52
-
-?, --help Show help options
53
-
54
-
Application Options:
55
-
-u, --urgency=LEVEL Specifies the urgency level (low, normal, critical).
56
-
-t, --expire-time=TIME Specifies the timeout in milliseconds at which to expire the notification.
57
-
-a, --app-name=APP_NAME Specifies the app name for the icon
58
-
-i, --icon=ICON Specifies an icon filename or stock icon to display.
59
-
-c, --category=TYPE[,TYPE...] Specifies the notification category.
60
-
-e, --transient Create a transient notification
61
-
-h, --hint=TYPE:NAME:VALUE Specifies basic extra data to pass. Valid types are boolean, int, double, string, byte and variant.
62
-
-p, --print-id Print the notification ID.
63
-
-r, --replace-id=REPLACE_ID The ID of the notification to replace.
64
-
-w, --wait Wait for the notification to be closed before exiting.
65
-
-A, --action=[NAME=]Text... Specifies the actions to display to the user. Implies --wait to wait for user input. May be set multiple times. The name of the action is output to stdout. If NAME is not specified, the numerical index of the option is used (starting with 0).
66
-
-v, --version Version of the package.
44
+
-1: disabled (deault)
45
+
0: enabled (no repetition)
46
+
x: enabled and repeat every x seconds
67
47
```
68
48
69
-
In order to make **PyRadio**use it, we wil use this help screen to create a valid command, for example:
49
+
**PyRadio**supports notifications repetition, so that even when used with `quake` or `yakuake` and the like, you still have some info on what's going on with it.
70
50
71
-
```
72
-
notify-send -i ~/.config/pyradio/pyradio.png -t 6000 TITLE MSG
73
-
```
51
+
Notifications can be set to repeat every "*x*" seconds, with "*x*" ranging from 30 to 300 (30 seconds to 5 minutes), in 30 seconds steps.
74
52
75
-
This command will:
53
+
## On Linux
76
54
77
-
- display an icon (-i) \
78
-
The icon is already in **PyRadio** config folder; just use the full path to it.
The **TITLE**and **MSG** tokens are just placeholders; **PyRadio** will replace them with real data when issuing the notification.
57
+
On Linux (and the BSDs), **PyRadio**uses the *notification daemon* that's already present and whatever command line helper program it provides to send notifications to the daemon.
82
58
83
-
When the command is ready, we just write it to **~/.config/pyradio/notification**, like so:
59
+
By default, **PyRadio** uses the following command to issue notifications:
84
60
85
61
```
86
-
echo "notify-send -i ~/.config/pyradio/pyradio.png -t 6000 TITLE MSG" > ~/.config/pyradio/notification
62
+
notify-send -i ICON TITLE MSG
87
63
```
88
64
89
-
Next time **PyRadio** is executed, it will read the above file, and start issuing notifications.
90
-
91
-
That was just an example to demonstrate the procedure one would follow to enable **PyRadio** Desktop Notifications.
92
-
93
-
Users can populate the **~/.config/pyradio/notification** files as needed and in accordance with their notification daemon / command.
94
-
95
-
### Packagers info
96
-
97
-
Since Desktop Notifications are not enabled by default, packages will have to populate the **notification** file manually (which is originally an empty file in the **pyradio** directory), using the procedure described above.
65
+
This command will:
98
66
99
-
**Note:** The icon will probable by in **/usr/share/icons**.
67
+
- display the title "**TITLE**" and message "**MSG**".
68
+
- display an icon (**-i**).
100
69
101
-
**Note:** Individual users can disable the Desktop Notifications enabled by the installed packaged, by creating an empty **~/.config/pyradio/notification** file.
70
+
The "**ICON**", "**TITLE**" and "**MSG**" tokens are just placeholders; **PyRadio** will replace them with real data when issuing the notification.
102
71
103
-
## On MacOS
72
+
If that does not work for you, or you want to customize the output, this is what to do:
0 commit comments