Mercurial > audlegacy-plugins
annotate src/aosd/aosd_trigger.c @ 2566:12aa69e560b2
- Ignore status codes other than 2xx for NE_OK
author | Ralf Ertzinger <ralf@skytale.net> |
---|---|
date | Tue, 13 May 2008 20:10:57 +0200 |
parents | 5a925593d754 |
children | bd3a24b39058 |
rev | line source |
---|---|
597 | 1 /* |
2 * | |
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2007 | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License as published by the | |
7 * Free Software Foundation; either version 2 of the License, or (at your | |
8 * option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, but | |
11 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License along | |
16 * with this program; if not, write to the Free Software Foundation, Inc., | |
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 * | |
19 */ | |
20 | |
21 #include "aosd_trigger.h" | |
22 #include "aosd_trigger_private.h" | |
23 #include "aosd_cfg.h" | |
2064
c8d55b929442
Just to hush down the warnings...
Eugene Paskevich <eugene@raptor.kiev.ua>
parents:
2060
diff
changeset
|
24 #include "aosd_osd.h" |
597 | 25 #include <glib.h> |
746
40fb4189fa88
[svn] - aosd: replaced other occurrencies of glib18n with audacious i18n
giacomo
parents:
637
diff
changeset
|
26 #include <audacious/i18n.h> |
597 | 27 #include <audacious/playlist.h> |
28 #include <audacious/strings.h> | |
29 #include <audacious/hook.h> | |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
30 #include <audacious/auddrct.h> |
597 | 31 |
32 | |
33 extern aosd_cfg_t * global_config; | |
34 | |
35 | |
36 /* trigger codes ( the code values do not need to be sequential ) */ | |
37 enum | |
38 { | |
39 AOSD_TRIGGER_PB_START = 0, | |
623 | 40 AOSD_TRIGGER_PB_TITLECHANGE = 1, |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
41 AOSD_TRIGGER_VOL_CHANGE = 2, |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
42 AOSD_TRIGGER_PB_PAUSEON = 3, |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
43 AOSD_TRIGGER_PB_PAUSEOFF = 4 |
597 | 44 }; |
45 | |
46 /* trigger codes array size */ | |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
47 #define AOSD_TRIGGER_CODES_ARRAY_SIZE 5 |
597 | 48 |
49 /* trigger codes array */ | |
50 gint aosd_trigger_codes[] = | |
51 { | |
52 AOSD_TRIGGER_PB_START, | |
623 | 53 AOSD_TRIGGER_PB_TITLECHANGE, |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
54 AOSD_TRIGGER_VOL_CHANGE, |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
55 AOSD_TRIGGER_PB_PAUSEON, |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
56 AOSD_TRIGGER_PB_PAUSEOFF |
597 | 57 }; |
58 | |
59 /* prototypes of trigger functions */ | |
60 static void aosd_trigger_func_pb_start_onoff ( gboolean ); | |
61 static void aosd_trigger_func_pb_start_cb ( gpointer , gpointer ); | |
623 | 62 static void aosd_trigger_func_pb_titlechange_onoff ( gboolean ); |
597 | 63 static void aosd_trigger_func_pb_titlechange_cb ( gpointer , gpointer ); |
623 | 64 static void aosd_trigger_func_vol_change_onoff ( gboolean ); |
65 static void aosd_trigger_func_vol_change_cb ( gpointer , gpointer ); | |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
66 static void aosd_trigger_func_pb_pauseon_onoff ( gboolean ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
67 static void aosd_trigger_func_pb_pauseon_cb ( gpointer , gpointer ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
68 static void aosd_trigger_func_pb_pauseoff_onoff ( gboolean ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
69 static void aosd_trigger_func_pb_pauseoff_cb ( gpointer , gpointer ); |
2288
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
70 static void aosd_trigger_func_hook_cb ( gpointer markup_text , gpointer unused ); |
597 | 71 |
72 /* map trigger codes to trigger objects */ | |
73 aosd_trigger_t aosd_triggers[] = | |
74 { | |
75 [AOSD_TRIGGER_PB_START] = { N_("Playback Start") , | |
76 N_("Triggers OSD when a playlist entry is played.") , | |
77 aosd_trigger_func_pb_start_onoff , | |
78 aosd_trigger_func_pb_start_cb }, | |
79 | |
80 [AOSD_TRIGGER_PB_TITLECHANGE] = { N_("Title Change") , | |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
81 N_("Triggers OSD when, during playback, the song title changes " |
597 | 82 "but the filename is the same. This is mostly useful to display " |
83 "title changes in internet streams.") , | |
623 | 84 aosd_trigger_func_pb_titlechange_onoff , |
85 aosd_trigger_func_pb_titlechange_cb }, | |
86 | |
87 [AOSD_TRIGGER_VOL_CHANGE] = { N_("Volume Change") , | |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
88 N_("Triggers OSD when volume is changed.") , |
623 | 89 aosd_trigger_func_vol_change_onoff , |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
90 aosd_trigger_func_vol_change_cb }, |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
91 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
92 [AOSD_TRIGGER_PB_PAUSEON] = { N_("Pause On") , |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
93 N_("Triggers OSD when playback is paused.") , |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
94 aosd_trigger_func_pb_pauseon_onoff , |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
95 aosd_trigger_func_pb_pauseon_cb }, |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
96 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
97 [AOSD_TRIGGER_PB_PAUSEOFF] = { N_("Pause Off") , |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
98 N_("Triggers OSD when playback is unpaused.") , |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
99 aosd_trigger_func_pb_pauseoff_onoff , |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
100 aosd_trigger_func_pb_pauseoff_cb } |
597 | 101 }; |
102 | |
103 | |
104 | |
105 /* TRIGGER API */ | |
106 | |
107 void | |
108 aosd_trigger_get_codes_array ( gint ** array , gint * array_size ) | |
109 { | |
110 *array = aosd_trigger_codes; | |
111 *array_size = AOSD_TRIGGER_CODES_ARRAY_SIZE; | |
112 return; | |
113 } | |
114 | |
115 | |
116 const gchar * | |
117 aosd_trigger_get_name ( gint trig_code ) | |
118 { | |
119 return aosd_triggers[trig_code].name; | |
120 } | |
121 | |
122 | |
123 const gchar * | |
124 aosd_trigger_get_desc ( gint trig_code ) | |
125 { | |
126 return aosd_triggers[trig_code].desc; | |
127 } | |
128 | |
129 | |
130 void | |
131 aosd_trigger_start ( aosd_cfg_osd_trigger_t * cfg_trigger ) | |
132 { | |
133 gint i = 0; | |
134 for ( i = 0 ; i < cfg_trigger->active->len ; i++ ) | |
135 { | |
136 gint trig_code = g_array_index( cfg_trigger->active , gint , i ); | |
137 aosd_triggers[trig_code].onoff_func( TRUE ); | |
138 } | |
2288
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
139 /* When called, this hook will display the text of the user pointer |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
140 or the current playing song, if NULL */ |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
141 aud_hook_register("aosd toggle"); |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
142 aud_hook_associate( "aosd toggle" , aosd_trigger_func_hook_cb , NULL ); |
597 | 143 return; |
144 } | |
145 | |
146 | |
147 void | |
148 aosd_trigger_stop ( aosd_cfg_osd_trigger_t * cfg_trigger ) | |
149 { | |
150 gint i = 0; | |
2288
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
151 aud_hook_dissociate( "aosd toggle" , aosd_trigger_func_hook_cb ); |
597 | 152 for ( i = 0 ; i < cfg_trigger->active->len ; i++ ) |
153 { | |
154 gint trig_code = g_array_index( cfg_trigger->active , gint , i ); | |
155 aosd_triggers[trig_code].onoff_func( FALSE ); | |
156 } | |
157 return; | |
158 } | |
159 | |
160 | |
893
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
161 /* HELPER FUNCTIONS */ |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
162 |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
163 static gchar * |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
164 aosd_trigger_utf8convert ( gchar * str ) |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
165 { |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
166 if ( global_config->osd->text.utf8conv_disable == FALSE ) |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1238
diff
changeset
|
167 return aud_str_to_utf8( str ); |
893
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
168 else |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
169 return g_strdup( str ); |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
170 } |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
171 |
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
172 |
597 | 173 /* TRIGGER FUNCTIONS */ |
174 | |
175 static void | |
176 aosd_trigger_func_pb_start_onoff ( gboolean turn_on ) | |
177 { | |
178 if ( turn_on == TRUE ) | |
2060 | 179 aud_hook_associate( "playback begin" , aosd_trigger_func_pb_start_cb , NULL ); |
597 | 180 else |
2060 | 181 aud_hook_dissociate( "playback begin" , aosd_trigger_func_pb_start_cb ); |
597 | 182 return; |
183 } | |
184 | |
185 static void | |
186 aosd_trigger_func_pb_start_cb ( gpointer plentry_gp , gpointer unused ) | |
187 { | |
188 PlaylistEntry *pl_entry = plentry_gp; | |
598
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
189 if ( plentry_gp != NULL ) |
597 | 190 { |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
191 gchar *title, *utf8_title; |
598
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
192 if ( pl_entry->title != NULL ) |
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
193 { |
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
194 /* if there is a proper title, use it */ |
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
195 title = g_strdup(pl_entry->title); |
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
196 } |
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
197 else |
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
198 { |
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
199 /* pick what we have as song title */ |
2057
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
2050
diff
changeset
|
200 Playlist *active = aud_playlist_get_active(); |
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
2050
diff
changeset
|
201 gint pos = aud_playlist_get_position(active); |
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
2050
diff
changeset
|
202 title = aud_playlist_get_songtitle(active, pos); |
598
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
203 } |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
204 utf8_title = aosd_trigger_utf8convert( title ); |
766
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
205 if ( g_utf8_validate( utf8_title , -1 , NULL ) == TRUE ) |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
206 { |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
207 gchar *utf8_title_markup = g_markup_printf_escaped( |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
208 "<span font_desc='%s'>%s</span>" , global_config->osd->text.fonts_name[0] , utf8_title ); |
883
e6d51d079a46
[svn] - aosd: use a single ghosd object for all of the osd showups; this will be a lot gentler to XLib and should definitely help with stability
giacomo
parents:
787
diff
changeset
|
209 aosd_osd_display( utf8_title_markup , global_config->osd , FALSE ); |
766
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
210 g_free( utf8_title_markup ); |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
211 } |
597 | 212 g_free( utf8_title ); |
598
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
213 g_free( title ); |
597 | 214 } |
215 return; | |
216 } | |
217 | |
218 | |
219 | |
220 typedef struct | |
221 { | |
222 gchar *title; | |
223 gchar *filename; | |
224 } | |
225 aosd_pb_titlechange_prevs_t; | |
226 | |
227 | |
228 static void | |
623 | 229 aosd_trigger_func_pb_titlechange_onoff ( gboolean turn_on ) |
597 | 230 { |
231 static aosd_pb_titlechange_prevs_t *prevs = NULL; | |
232 | |
233 if ( turn_on == TRUE ) | |
234 { | |
235 prevs = g_malloc0(sizeof(aosd_pb_titlechange_prevs_t)); | |
236 prevs->title = NULL; | |
237 prevs->filename = NULL; | |
2060 | 238 aud_hook_associate( "playlist set info" , aosd_trigger_func_pb_titlechange_cb , prevs ); |
597 | 239 } |
240 else | |
241 { | |
2060 | 242 aud_hook_dissociate( "playlist set info" , aosd_trigger_func_pb_titlechange_cb ); |
597 | 243 if ( prevs != NULL ) |
244 { | |
245 if ( prevs->title != NULL ) g_free( prevs->title ); | |
246 if ( prevs->filename != NULL ) g_free( prevs->filename ); | |
247 g_free( prevs ); | |
248 prevs = NULL; | |
249 } | |
250 } | |
251 return; | |
252 } | |
253 | |
254 static void | |
255 aosd_trigger_func_pb_titlechange_cb ( gpointer plentry_gp , gpointer prevs_gp ) | |
256 { | |
2058
fffa7e3d39e0
use aud_ip_state (replacement to ip_data).
William Pitcock <nenolod@atheme.org>
parents:
2057
diff
changeset
|
257 if ( aud_ip_state->playing ) |
597 | 258 { |
259 aosd_pb_titlechange_prevs_t *prevs = prevs_gp; | |
260 PlaylistEntry *pl_entry = plentry_gp; | |
261 | |
262 /* same filename but title changed, useful to detect http stream song changes */ | |
263 | |
264 if ( ( prevs->title != NULL ) && ( prevs->filename != NULL ) ) | |
265 { | |
598
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
266 if ( ( pl_entry->filename != NULL ) && ( !strcmp(pl_entry->filename,prevs->filename) ) ) |
597 | 267 { |
598
e83e6fb3ebfa
[svn] - aosd: stability fixes for triggers (handle situation where a plentry exists but plentry->title is null)
giacomo
parents:
597
diff
changeset
|
268 if ( ( pl_entry->title != NULL ) && ( strcmp(pl_entry->title,prevs->title) ) ) |
597 | 269 { |
270 /* string formatting is done here a.t.m. - TODO - improve this area */ | |
893
ca9907354db6
[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
giacomo
parents:
890
diff
changeset
|
271 gchar *utf8_title = aosd_trigger_utf8convert( pl_entry->title ); |
766
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
272 if ( g_utf8_validate( utf8_title , -1 , NULL ) == TRUE ) |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
273 { |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
274 gchar *utf8_title_markup = g_markup_printf_escaped( |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
275 "<span font_desc='%s'>%s</span>" , global_config->osd->text.fonts_name[0] , utf8_title ); |
883
e6d51d079a46
[svn] - aosd: use a single ghosd object for all of the osd showups; this will be a lot gentler to XLib and should definitely help with stability
giacomo
parents:
787
diff
changeset
|
276 aosd_osd_display( utf8_title_markup , global_config->osd , FALSE ); |
766
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
277 g_free( utf8_title_markup ); |
53f63f43663f
[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
giacomo
parents:
746
diff
changeset
|
278 } |
597 | 279 g_free( utf8_title ); |
280 g_free( prevs->title ); | |
281 prevs->title = g_strdup(pl_entry->title); | |
282 } | |
283 } | |
284 else | |
285 { | |
286 g_free(prevs->filename); | |
287 prevs->filename = g_strdup(pl_entry->filename); | |
609
9b73eb35f4ff
[svn] - aosd: avoid collision between playback start trigger and titlechange trigger, that occurred when the next file in playlist was played
giacomo
parents:
598
diff
changeset
|
288 /* if filename changes, reset title as well */ |
9b73eb35f4ff
[svn] - aosd: avoid collision between playback start trigger and titlechange trigger, that occurred when the next file in playlist was played
giacomo
parents:
598
diff
changeset
|
289 if ( prevs->title != NULL ) |
9b73eb35f4ff
[svn] - aosd: avoid collision between playback start trigger and titlechange trigger, that occurred when the next file in playlist was played
giacomo
parents:
598
diff
changeset
|
290 g_free(prevs->title); |
9b73eb35f4ff
[svn] - aosd: avoid collision between playback start trigger and titlechange trigger, that occurred when the next file in playlist was played
giacomo
parents:
598
diff
changeset
|
291 prevs->title = g_strdup(pl_entry->title); |
597 | 292 } |
293 } | |
294 else | |
295 { | |
296 if ( prevs->title != NULL ) | |
297 g_free(prevs->title); | |
298 prevs->title = g_strdup(pl_entry->title); | |
299 if ( prevs->filename != NULL ) | |
300 g_free(prevs->filename); | |
301 prevs->filename = g_strdup(pl_entry->filename); | |
302 } | |
303 } | |
304 } | |
623 | 305 |
306 | |
307 static void | |
308 aosd_trigger_func_vol_change_onoff ( gboolean turn_on ) | |
309 { | |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
310 if ( turn_on == TRUE ) |
2060 | 311 aud_hook_associate( "volume set" , aosd_trigger_func_vol_change_cb , NULL ); |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
312 else |
2060 | 313 aud_hook_dissociate( "volume set" , aosd_trigger_func_vol_change_cb ); |
623 | 314 return; |
315 } | |
316 | |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
317 typedef struct |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
318 { |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
319 gint h_vol[2]; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
320 gint sid; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
321 } |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
322 aosd_vol_change_bucket_t; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
323 |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
324 static gboolean |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
325 aosd_trigger_func_vol_change_timeout ( gpointer bucket_gp ) |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
326 { |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
327 aosd_vol_change_bucket_t *bucket = bucket_gp; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
328 gchar *utf8_title_markup = g_markup_printf_escaped( |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
329 "<span font_desc='%s'>Volume Change - L: %i , R: %i</span>" , |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
330 global_config->osd->text.fonts_name[0] , bucket->h_vol[0] , bucket->h_vol[1] ); |
883
e6d51d079a46
[svn] - aosd: use a single ghosd object for all of the osd showups; this will be a lot gentler to XLib and should definitely help with stability
giacomo
parents:
787
diff
changeset
|
331 aosd_osd_display( utf8_title_markup , global_config->osd , FALSE ); |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
332 g_free( utf8_title_markup ); |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
333 bucket->sid = 0; /* reset source id value */ |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
334 return FALSE; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
335 } |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
336 |
623 | 337 static void |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
338 aosd_trigger_func_vol_change_cb ( gpointer h_vol_gp , gpointer unused ) |
623 | 339 { |
637
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
340 gint *h_vol = h_vol_gp; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
341 static aosd_vol_change_bucket_t bucket = { { 0 , 0 } , 0 }; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
342 |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
343 bucket.h_vol[0] = h_vol[0]; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
344 bucket.h_vol[1] = h_vol[1]; |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
345 |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
346 /* in order to avoid repeated display of osd for each volume variation, use a |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
347 timer to prevent it from appearing more than once when multiple volume |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
348 changes are performed in a short time interval (500 msec) */ |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
349 if ( bucket.sid == 0 ) |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
350 { |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
351 /* first call in the time interval */ |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
352 bucket.sid = g_timeout_add( 500 , aosd_trigger_func_vol_change_timeout , &bucket ); |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
353 } |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
354 else |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
355 { |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
356 /* another call in the same interval, reset the interval */ |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
357 g_source_remove( bucket.sid ); |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
358 bucket.sid = g_timeout_add( 500 , aosd_trigger_func_vol_change_timeout , &bucket ); |
a1687bd302ce
[svn] - aosd: completed volume change trigger, works now
giacomo
parents:
623
diff
changeset
|
359 } |
623 | 360 return; |
361 } | |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
362 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
363 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
364 static void |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
365 aosd_trigger_func_pb_pauseon_onoff ( gboolean turn_on ) |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
366 { |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
367 if ( turn_on == TRUE ) |
2060 | 368 aud_hook_associate( "playback pause" , aosd_trigger_func_pb_pauseon_cb , NULL ); |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
369 else |
2060 | 370 aud_hook_dissociate( "playback pause" , aosd_trigger_func_pb_pauseon_cb ); |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
371 return; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
372 } |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
373 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
374 static void |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
375 aosd_trigger_func_pb_pauseon_cb ( gpointer unused1 , gpointer unused2 ) |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
376 { |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
377 gchar *utf8_title_markup = g_markup_printf_escaped( |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
378 "<span font_desc='%s'>Paused</span>" , global_config->osd->text.fonts_name[0] ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
379 aosd_osd_display( utf8_title_markup , global_config->osd , FALSE ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
380 g_free( utf8_title_markup ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
381 return; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
382 } |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
383 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
384 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
385 static void |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
386 aosd_trigger_func_pb_pauseoff_onoff ( gboolean turn_on ) |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
387 { |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
388 if ( turn_on == TRUE ) |
2060 | 389 aud_hook_associate( "playback unpause" , aosd_trigger_func_pb_pauseoff_cb , NULL ); |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
390 else |
2060 | 391 aud_hook_dissociate( "playback unpause" , aosd_trigger_func_pb_pauseoff_cb ); |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
392 return; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
393 } |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
394 |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
395 static void |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
396 aosd_trigger_func_pb_pauseoff_cb ( gpointer unused1 , gpointer unused2 ) |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
397 { |
2057
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
2050
diff
changeset
|
398 Playlist *active = aud_playlist_get_active(); |
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
2050
diff
changeset
|
399 gint pos = aud_playlist_get_position(active); |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
400 gchar *title, *utf8_title, *utf8_title_markup; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
401 gint time_cur, time_tot; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
402 gint time_cur_m, time_cur_s, time_tot_m, time_tot_s; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
403 |
2057
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
2050
diff
changeset
|
404 time_tot = aud_playlist_get_songtime(active, pos) / 1000; |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
405 time_cur = audacious_drct_get_time() / 1000; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
406 time_cur_s = time_cur % 60; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
407 time_cur_m = (time_cur - time_cur_s) / 60; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
408 time_tot_s = time_tot % 60; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
409 time_tot_m = (time_tot - time_tot_s) / 60; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
410 |
2057
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
2050
diff
changeset
|
411 title = aud_playlist_get_songtitle(active, pos); |
1238
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
412 utf8_title = aosd_trigger_utf8convert( title ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
413 utf8_title_markup = g_markup_printf_escaped( |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
414 "<span font_desc='%s'>%s (%i:%02i/%i:%02i)</span>" , |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
415 global_config->osd->text.fonts_name[0] , utf8_title , time_cur_m , time_cur_s , time_tot_m , time_tot_s ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
416 aosd_osd_display( utf8_title_markup , global_config->osd , FALSE ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
417 g_free( utf8_title_markup ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
418 g_free( utf8_title ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
419 g_free( title ); |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
420 return; |
5d9fb703a7cc
aosd: added triggers for pause and unpause event
Giacomo Lozito <james@develia.org>
parents:
893
diff
changeset
|
421 } |
2288
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
422 |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
423 |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
424 /* Call with aud_hook_call("aosd toggle", param); |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
425 If param != NULL, display the supplied text in the OSD |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
426 If param == NULL, display the current playing song */ |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
427 static void |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
428 aosd_trigger_func_hook_cb ( gpointer markup_text , gpointer unused ) |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
429 { |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
430 if ( markup_text != NULL ) |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
431 { |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
432 /* Display text from caller */ |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
433 aosd_osd_display( markup_text , global_config->osd , FALSE ); |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
434 } else { |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
435 /* Display currently playing song */ |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
436 Playlist* pl; |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
437 PlaylistEntry *pl_entry; |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
438 |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
439 pl = aud_playlist_get_active(); |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
440 if (pl == NULL) return; |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
441 pl_entry = aud_playlist_get_entry_to_play(pl); |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
442 aosd_trigger_func_pb_start_cb ( (void*)pl_entry, NULL ); |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
443 } |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
444 return; |
5a925593d754
Audacious OSD Plugin: Added trigger "aosd toggle" to trigger display of OSD from other plugins
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
2064
diff
changeset
|
445 } |