~ubuntu-branches/debian/sid/audacious-plugins/sid

« back to all changes in this revision

Viewing changes to src/song_change/song_change.c

  • Committer: Bazaar Package Importer
  • Author(s): Bilal Akhtar
  • Date: 2011-04-10 18:56:21 UTC
  • mfrom: (1.1.14 upstream) (2.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110410185621-7eg1k5a7v3f4aqrn
Tags: 2.4.4-1
* New upstream release.
  - Fix FTBFS with GCC 4.5 (Closes: #621989)
* Upload to unstable.
* debian/control:
  - Update versioned dependencies according to upstream changes.
  - Bump Standards-Version to 3.9.2 (no changes needed).
  - Since the package will be building against the new FFMpeg libs,
    fix the problem of depending on old uninstallable libav*
    packages (Closes: #617603)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include <string.h>
17
17
 
 
18
#include <audacious/configdb.h>
 
19
#include <audacious/drct.h>
 
20
#include <audacious/i18n.h>
18
21
#include <audacious/plugin.h>
19
 
#include <audacious/ui_preferences.h>
20
 
#include <audacious/auddrct.h>
 
22
#include <audacious/preferences.h>
 
23
#include <libaudcore/hook.h>
 
24
#include <libaudcore/audstrings.h>
 
25
 
21
26
#include "formatter.h"
22
 
#include <audacious/i18n.h>
23
 
#include <audacious/hook.h>
24
 
#include <audacious/preferences.h>
25
27
 
26
28
static PluginPreferences preferences;
27
29
 
97
99
static void
98
100
do_command(char *cmd, const char *current_file, int pos)
99
101
{
100
 
        int length, rate, freq, nch;
 
102
        int length;
101
103
        char *str, *shstring = NULL, *temp, numbuf[32];
102
104
        gboolean playing;
103
105
        Formatter *formatter;
105
107
        if (cmd && strlen(cmd) > 0)
106
108
        {
107
109
                formatter = formatter_new();
108
 
                str = audacious_drct_pl_get_title(pos);
 
110
                str = aud_drct_pl_get_title(pos);
109
111
                if (str)
110
112
                {
111
 
                        temp = aud_escape_shell_chars(str);
 
113
                        temp = escape_shell_chars(str);
112
114
                        formatter_associate(formatter, 's', temp);
113
115
                        formatter_associate(formatter, 'n', temp);
114
116
                        g_free(str);
122
124
 
123
125
                if (current_file)
124
126
                {
125
 
                        temp = aud_escape_shell_chars(current_file);
 
127
                        temp = escape_shell_chars(current_file);
126
128
                        formatter_associate(formatter, 'f', temp);
127
129
                        g_free(temp);
128
130
                }
130
132
                        formatter_associate(formatter, 'f', "");
131
133
                g_snprintf(numbuf, sizeof(numbuf), "%02d", pos + 1);
132
134
                formatter_associate(formatter, 't', numbuf);
133
 
                length = audacious_drct_pl_get_time(pos);
 
135
                length = aud_drct_pl_get_time(pos);
134
136
                if (length != -1)
135
137
                {
136
138
                        g_snprintf(numbuf, sizeof(numbuf), "%d", length);
138
140
                }
139
141
                else
140
142
                        formatter_associate(formatter, 'l', "0");
141
 
                audacious_drct_get_info(&rate, &freq, &nch);
142
 
                g_snprintf(numbuf, sizeof(numbuf), "%d", rate);
143
 
                formatter_associate(formatter, 'r', numbuf);
144
 
                g_snprintf(numbuf, sizeof(numbuf), "%d", freq);
145
 
                formatter_associate(formatter, 'F', numbuf);
146
 
                g_snprintf(numbuf, sizeof(numbuf), "%d", nch);
147
 
                formatter_associate(formatter, 'c', numbuf);
148
 
                playing = audacious_drct_get_playing();
 
143
 
 
144
                playing = aud_drct_get_playing();
149
145
                g_snprintf(numbuf, sizeof(numbuf), "%d", playing);
150
146
                formatter_associate(formatter, 'p', numbuf);
 
147
 
 
148
                if (playing)
 
149
                {
 
150
                        int brate, srate, chans;
 
151
                        aud_drct_get_info (& brate, & srate, & chans);
 
152
                        snprintf (numbuf, sizeof numbuf, "%d", brate);
 
153
                        formatter_associate (formatter, 'r', numbuf);
 
154
                        snprintf (numbuf, sizeof numbuf, "%d", srate);
 
155
                        formatter_associate (formatter, 'F', numbuf);
 
156
                        snprintf (numbuf, sizeof numbuf, "%d", chans);
 
157
                        formatter_associate (formatter, 'c', numbuf);
 
158
                }
 
159
 
151
160
                shstring = formatter_format(formatter, cmd);
152
161
                formatter_destroy(formatter);
153
162
 
178
187
 
179
188
static void cleanup(void)
180
189
{
181
 
        aud_hook_dissociate("playback begin", songchange_playback_begin);
182
 
        aud_hook_dissociate("playback end", songchange_playback_end);
183
 
        aud_hook_dissociate("playlist end reached", songchange_playlist_eof);
184
 
//      aud_hook_dissociate( "playlist set info" , songchange_playback_ttc);
 
190
        hook_dissociate("playback begin", songchange_playback_begin);
 
191
        hook_dissociate("playback end", songchange_playback_end);
 
192
        hook_dissociate("playlist end reached", songchange_playlist_eof);
 
193
//      hook_dissociate( "playlist set info" , songchange_playback_ttc);
185
194
 
186
195
        if ( ttc_prevs != NULL )
187
196
        {
254
263
{
255
264
        read_config();
256
265
 
257
 
        aud_hook_associate("playback begin", songchange_playback_begin, NULL);
258
 
        aud_hook_associate("playback end", songchange_playback_end, NULL);
259
 
        aud_hook_associate("playlist end reached", songchange_playlist_eof, NULL);
 
266
        hook_associate("playback begin", songchange_playback_begin, NULL);
 
267
        hook_associate("playback end", songchange_playback_end, NULL);
 
268
        hook_associate("playlist end reached", songchange_playlist_eof, NULL);
260
269
 
261
270
        ttc_prevs = g_malloc0(sizeof(songchange_playback_ttc_prevs_t));
262
271
        ttc_prevs->title = NULL;
263
272
        ttc_prevs->filename = NULL;
264
 
//      aud_hook_associate( "playlist set info" , songchange_playback_ttc , ttc_prevs );
 
273
//      hook_associate( "playlist set info" , songchange_playback_ttc , ttc_prevs );
265
274
}
266
275
 
267
276
static void
270
279
        int pos;
271
280
        char *current_file;
272
281
 
273
 
        pos = audacious_drct_pl_get_pos();
274
 
        current_file = audacious_drct_pl_get_file(pos);
 
282
        pos = aud_drct_pl_get_pos();
 
283
        current_file = aud_drct_pl_get_file(pos);
275
284
 
276
285
        do_command(cmd_line, current_file, pos);
277
286
 
284
293
        int pos;
285
294
        char *current_file;
286
295
 
287
 
        pos = audacious_drct_pl_get_pos();
288
 
        current_file = audacious_drct_pl_get_file(pos);
 
296
        pos = aud_drct_pl_get_pos();
 
297
        current_file = aud_drct_pl_get_file(pos);
289
298
 
290
299
        do_command(cmd_line_after, current_file, pos);
291
300
 
309
318
      {
310
319
        if ( ( pl_entry->title != NULL ) && ( strcmp(pl_entry->title,prevs->title) ) )
311
320
        {
312
 
          int pos = audacious_drct_pl_get_pos();
313
 
          char *current_file = audacious_drct_pl_get_file(pos);
 
321
          int pos = aud_drct_pl_get_pos();
 
322
          char *current_file = aud_drct_pl_get_file(pos);
314
323
          do_command(cmd_line_ttc, current_file, pos);
315
324
          g_free(current_file);
316
325
          g_free(prevs->title);
346
355
        gint pos;
347
356
        gchar *current_file;
348
357
 
349
 
        pos = audacious_drct_pl_get_pos();
350
 
        current_file = audacious_drct_pl_get_file(pos);
 
358
        pos = aud_drct_pl_get_pos();
 
359
        current_file = aud_drct_pl_get_file(pos);
351
360
 
352
361
        do_command(cmd_line_end, current_file, pos);
353
362
 
366
375
static void configure_ok_cb()
367
376
{
368
377
        char *cmd, *cmd_after, *cmd_end, *cmd_ttc;
369
 
g_message("AAAA");
370
378
        cmd = g_strdup(config.cmd);
371
379
        cmd_after = g_strdup(config.cmd_after);
372
380
        cmd_end = g_strdup(config.cmd_end);
421
429
                      "%p: Currently playing (1 or 0)"), NULL, NULL, NULL, FALSE},
422
430
};
423
431
 
424
 
static GtkWidget *
425
 
custom_warning(void)
 
432
/* static GtkWidget * custom_warning (void) */
 
433
static void * custom_warning (void)
426
434
{
427
435
    GtkWidget *bbox_hbox;
428
436
    gchar * temp;
483
491
    .imgurl = DATA_DIR "/images/plugins.png",
484
492
    .prefs = settings,
485
493
    .n_prefs = G_N_ELEMENTS(settings),
486
 
    .type = PREFERENCES_PAGE,
487
494
    .init = configure_init,
488
 
    /* TODO: .apply = configure_apply, */
489
495
    .cleanup = configure_cleanup,
490
496
};