Mercurial > audlegacy-plugins
annotate src/song_change/song_change.c @ 1162:29519d604e8c trunk
[svn] - revise bitrate calculation with xing header. if number of bytes and number of frames are available in xing header, fast play time calculation yields almost appropriate duration upon a vbr file.
- now fileinfo dialog shows duration in MM:SS format.
author | yaz |
---|---|
date | Mon, 04 Jun 2007 07:46:52 -0700 |
parents | 751a95e21a08 |
children | 36cc5e56246e |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 * Audacious: A cross-platform multimedia player. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * Copyright (c) 2005 Audacious Team |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 #include "config.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 #include <glib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 #include <gtk/gtk.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 #include <sys/types.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 #include <sys/wait.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 #include <signal.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 #include <unistd.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 #include <stdio.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 #include "audacious/plugin.h" |
402
1d50eb0b5a0a
[svn] - chase prefswin -> ui_preferences in audacious core
nenolod
parents:
12
diff
changeset
|
19 #include "audacious/ui_preferences.h" |
3
088092a52fea
[svn] - move from (internal) libaudacious/ include path to audacious/ include path
nenolod
parents:
0
diff
changeset
|
20 #include "audacious/configdb.h" |
1024 | 21 #include "audacious/auddrct.h" |
3
088092a52fea
[svn] - move from (internal) libaudacious/ include path to audacious/ include path
nenolod
parents:
0
diff
changeset
|
22 #include "audacious/formatter.h" |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
406
diff
changeset
|
23 #include <audacious/i18n.h> |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
24 #include <audacious/hook.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 static void init(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 static void cleanup(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 static GtkWidget *configure(void); |
594
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
29 static void songchange_playback_begin(gpointer unused, gpointer unused2); |
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
30 static void songchange_playback_end(gpointer unused, gpointer unused2); |
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
31 static void songchange_playlist_eof(gpointer unused, gpointer unused2); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 static char *cmd_line = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 static char *cmd_line_after = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 static char *cmd_line_end = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 static GtkWidget *configure_vbox = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 static GtkWidget *cmd_entry, *cmd_after_entry, *cmd_end_entry; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 static GtkWidget *cmd_warn_label, *cmd_warn_img; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 GeneralPlugin sc_gp = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 NULL, /* handle */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 NULL, /* filename */ |
1119 | 45 "Song Change " PACKAGE_VERSION, /* Description */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 init, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 cleanup, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 |
1119 | 52 GeneralPlugin *songchange_gplist[] = { &sc_gp, NULL }; |
53 DECLARE_PLUGIN(songchange, NULL, NULL, NULL, NULL, NULL, songchange_gplist, NULL); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
55 static void bury_child(int signal) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
56 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
57 waitpid(-1, NULL, WNOHANG); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
58 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
59 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
60 static void execute_command(char *cmd) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
61 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
62 char *argv[4] = {"/bin/sh", "-c", NULL, NULL}; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
63 int i; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
64 argv[2] = cmd; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
65 signal(SIGCHLD, bury_child); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
66 if (fork() == 0) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
67 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
68 /* We don't want this process to hog the audio device etc */ |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
69 for (i = 3; i < 255; i++) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
70 close(i); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
71 execv("/bin/sh", argv); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
72 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
73 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
74 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
75 /* |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
76 * escape_shell_chars() |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
77 * |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
78 * Escapes characters that are special to the shell inside double quotes. |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
79 */ |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
80 static char* escape_shell_chars(const char *string) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
81 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
82 const char *special = "$`\"\\"; /* Characters to escape */ |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
83 const char *in = string; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
84 char *out; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
85 char *escaped; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
86 int num = 0; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
87 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
88 while (*in != '\0') |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
89 if (strchr(special, *in++)) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
90 num++; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
91 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
92 escaped = g_malloc(strlen(string) + num + 1); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
93 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
94 in = string; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
95 out = escaped; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
96 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
97 while (*in != '\0') |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
98 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
99 if (strchr(special, *in)) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
100 *out++ = '\\'; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
101 *out++ = *in++; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
102 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
103 *out = '\0'; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
104 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
105 return escaped; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
106 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
107 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
108 /* Format codes: |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
109 * |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
110 * F - frequency (in hertz) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
111 * c - number of channels |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
112 * f - filename (full path) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
113 * l - length (in milliseconds) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
114 * n - name |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
115 * r - rate (in bits per second) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
116 * s - name (since everyone's used to it) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
117 * t - playlist position (%02d) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
118 * p - currently playing (1 or 0) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
119 */ |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
120 /* do_command(): do @cmd after replacing the format codes |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
121 @cmd: command to run |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
122 @current_file: file name of current song |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
123 @pos: playlist_pos */ |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
124 static void |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
125 do_command(char *cmd, const char *current_file, int pos) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
126 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
127 int length, rate, freq, nch; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
128 char *str, *shstring = NULL, *temp, numbuf[16]; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
129 gboolean playing; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
130 Formatter *formatter; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
131 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
132 if (cmd && strlen(cmd) > 0) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
133 { |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
134 formatter = formatter_new(); |
1024 | 135 str = audacious_drct_pl_get_title(pos); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
136 if (str) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
137 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
138 temp = escape_shell_chars(str); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
139 formatter_associate(formatter, 's', temp); |
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
140 formatter_associate(formatter, 'n', temp); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
141 g_free(str); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
142 g_free(temp); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
143 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
144 else |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
145 { |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
146 formatter_associate(formatter, 's', ""); |
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
147 formatter_associate(formatter, 'n', ""); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
148 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
149 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
150 if (current_file) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
151 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
152 temp = escape_shell_chars(current_file); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
153 formatter_associate(formatter, 'f', temp); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
154 g_free(temp); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
155 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
156 else |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
157 formatter_associate(formatter, 'f', ""); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
158 sprintf(numbuf, "%02d", pos + 1); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
159 formatter_associate(formatter, 't', numbuf); |
1024 | 160 length = audacious_drct_pl_get_time(pos); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
161 if (length != -1) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
162 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
163 sprintf(numbuf, "%d", length); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
164 formatter_associate(formatter, 'l', numbuf); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
165 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
166 else |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
167 formatter_associate(formatter, 'l', "0"); |
1024 | 168 audacious_drct_get_info(&rate, &freq, &nch); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
169 sprintf(numbuf, "%d", rate); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
170 formatter_associate(formatter, 'r', numbuf); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
171 sprintf(numbuf, "%d", freq); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
172 formatter_associate(formatter, 'F', numbuf); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
173 sprintf(numbuf, "%d", nch); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
174 formatter_associate(formatter, 'c', numbuf); |
1024 | 175 playing = audacious_drct_get_playing(); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
176 sprintf(numbuf, "%d", playing); |
552
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
177 formatter_associate(formatter, 'p', numbuf); |
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
178 shstring = formatter_format(formatter, cmd); |
91bc67e7800b
[svn] - adapted plugin to use new formatter (without xmms_ prefix)
mf0102
parents:
549
diff
changeset
|
179 formatter_destroy(formatter); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
180 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
181 if (shstring) |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
182 { |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
183 execute_command(shstring); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
184 /* FIXME: This can possibly be freed too early */ |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
185 g_free(shstring); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
186 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
187 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
188 } |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
189 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 static void read_config(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 cmd_line = g_strdup(""); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 cmd_line_after = g_strdup(""); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 cmd_line_end = g_strdup(""); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 db = bmp_cfg_db_open(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 bmp_cfg_db_get_string(db, "song_change", "cmd_line", &cmd_line); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 bmp_cfg_db_get_string(db, "song_change", "cmd_line_after", &cmd_line_after); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 bmp_cfg_db_get_string(db, "song_change", "cmd_line_end", &cmd_line_end); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 bmp_cfg_db_close(db); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 static void cleanup(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 { |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
207 hook_dissociate("playback begin", songchange_playback_begin); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
208 hook_dissociate("playback end", songchange_playback_end); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
209 hook_dissociate("playlist end reached", songchange_playlist_eof); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 g_free(cmd_line); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 g_free(cmd_line_after); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 g_free(cmd_line_end); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 cmd_line = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 cmd_line_after = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 cmd_line_end = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 signal(SIGCHLD, SIG_DFL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 prefswin_page_destroy(configure_vbox); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 static void save_and_close(GtkWidget *w, gpointer data) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 ConfigDb *db; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 char *cmd, *cmd_after, *cmd_end; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_entry))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 cmd_after = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_after_entry))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 cmd_end = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_end_entry))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 db = bmp_cfg_db_open(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 bmp_cfg_db_set_string(db, "song_change", "cmd_line", cmd); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 bmp_cfg_db_set_string(db, "song_change", "cmd_line_after", cmd_after); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 bmp_cfg_db_set_string(db, "song_change", "cmd_line_end", cmd_end); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 bmp_cfg_db_close(db); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
237 if (cmd_line != NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 g_free(cmd_line); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
239 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
240 cmd_line = g_strdup(cmd); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
241 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
242 if (cmd_line_after != NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 g_free(cmd_line_after); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
244 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
245 cmd_line_after = g_strdup(cmd_after); |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
246 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
247 if (cmd_line_end != NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 g_free(cmd_line_end); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
249 |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
250 cmd_line_end = g_strdup(cmd_end); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 g_free(cmd); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 g_free(cmd_after); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 g_free(cmd_end); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 static int check_command(char *command) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 const char *dangerous = "fns"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 char *c; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 int qu = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 for (c = command; *c != '\0'; c++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 if (*c == '"' && (c == command || *(c - 1) != '\\')) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 qu = !qu; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 else if (*c == '%' && !qu && strchr(dangerous, *(c + 1))) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 static void configure_ok_cb(GtkWidget *w, gpointer data) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 char *cmd, *cmd_after, *cmd_end; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_entry))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 cmd_after = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_after_entry))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 cmd_end = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_end_entry))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 if (check_command(cmd) < 0 || check_command(cmd_after) < 0 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 || check_command(cmd_end) < 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 gtk_widget_show(cmd_warn_img); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 gtk_widget_show(cmd_warn_label); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 gtk_widget_hide(cmd_warn_img); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 gtk_widget_hide(cmd_warn_label); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 save_and_close(NULL, NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 g_free(cmd); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 g_free(cmd_after); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 g_free(cmd_end); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 static GtkWidget *configure(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 GtkWidget *sep1, *sep2, *sep3; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 GtkWidget *cmd_hbox, *cmd_label; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 GtkWidget *cmd_after_hbox, *cmd_after_label; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 GtkWidget *cmd_end_hbox, *cmd_end_label; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 GtkWidget *cmd_desc, *cmd_after_desc, *cmd_end_desc, *f_desc; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 GtkWidget *song_frame, *song_vbox; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 GtkWidget *bbox_hbox; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 char *temp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 read_config(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 configure_vbox = gtk_vbox_new(FALSE, 12); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 song_frame = gtk_frame_new(_("Commands")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 gtk_box_pack_start(GTK_BOX(configure_vbox), song_frame, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 song_vbox = gtk_vbox_new(FALSE, 12); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 gtk_container_set_border_width(GTK_CONTAINER(song_vbox), 6); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 gtk_container_add(GTK_CONTAINER(song_frame), song_vbox); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 cmd_desc = gtk_label_new(_( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 "Command to run when Audacious starts a new song.")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 gtk_label_set_justify(GTK_LABEL(cmd_desc), GTK_JUSTIFY_LEFT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 gtk_misc_set_alignment(GTK_MISC(cmd_desc), 0, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_desc, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 gtk_label_set_line_wrap(GTK_LABEL(cmd_desc), TRUE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 cmd_hbox = gtk_hbox_new(FALSE, 6); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_hbox, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 cmd_label = gtk_label_new(_("Command:")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 gtk_box_pack_start(GTK_BOX(cmd_hbox), cmd_label, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 cmd_entry = gtk_entry_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 if (cmd_line) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 gtk_entry_set_text(GTK_ENTRY(cmd_entry), cmd_line); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 gtk_widget_set_usize(cmd_entry, 200, -1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 gtk_box_pack_start(GTK_BOX(cmd_hbox), cmd_entry, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 sep1 = gtk_hseparator_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 gtk_box_pack_start(GTK_BOX(song_vbox), sep1, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 cmd_after_desc = gtk_label_new(_( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 "Command to run toward the end of a song.")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 gtk_label_set_justify(GTK_LABEL(cmd_after_desc), GTK_JUSTIFY_LEFT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 gtk_misc_set_alignment(GTK_MISC(cmd_after_desc), 0, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_after_desc, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 cmd_after_hbox = gtk_hbox_new(FALSE, 6); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
351 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_after_hbox, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 cmd_after_label = gtk_label_new(_("Command:")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 gtk_box_pack_start(GTK_BOX(cmd_after_hbox), cmd_after_label, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 cmd_after_entry = gtk_entry_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 if (cmd_line_after) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
358 gtk_entry_set_text(GTK_ENTRY(cmd_after_entry), cmd_line_after); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 gtk_widget_set_usize(cmd_after_entry, 200, -1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 gtk_box_pack_start(GTK_BOX(cmd_after_hbox), cmd_after_entry, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 sep2 = gtk_hseparator_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 gtk_box_pack_start(GTK_BOX(song_vbox), sep2, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 cmd_end_desc = gtk_label_new(_( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 "Command to run when Audacious reaches the end " |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 "of the playlist.")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 gtk_label_set_justify(GTK_LABEL(cmd_end_desc), GTK_JUSTIFY_LEFT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 gtk_misc_set_alignment(GTK_MISC(cmd_end_desc), 0, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_end_desc, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 cmd_end_hbox = gtk_hbox_new(FALSE, 6); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 gtk_box_pack_start(GTK_BOX(song_vbox), cmd_end_hbox, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 cmd_end_label = gtk_label_new(_("Command:")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 gtk_box_pack_start(GTK_BOX(cmd_end_hbox), cmd_end_label, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 cmd_end_entry = gtk_entry_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 if (cmd_line_end) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 gtk_entry_set_text(GTK_ENTRY(cmd_end_entry), cmd_line_end); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 gtk_widget_set_usize(cmd_end_entry, 200, -1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 gtk_box_pack_start(GTK_BOX(cmd_end_hbox), cmd_end_entry, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 sep3 = gtk_hseparator_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 gtk_box_pack_start(GTK_BOX(song_vbox), sep3, TRUE, TRUE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 temp = g_strdup_printf( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 _("You can use the following format strings which\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 "will be substituted before calling the command\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 "(not all are useful for the end-of-playlist command).\n\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 "%%F: Frequency (in hertz)\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 "%%c: Number of channels\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 "%%f: filename (full path)\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 "%%l: length (in milliseconds)\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 "%%n or %%s: Song name\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 "%%r: Rate (in bits per second)\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 "%%t: Playlist position (%%02d)\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 "%%p: Currently playing (1 or 0)")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 f_desc = gtk_label_new(temp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 g_free(temp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 gtk_label_set_justify(GTK_LABEL(f_desc), GTK_JUSTIFY_LEFT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 gtk_misc_set_alignment(GTK_MISC(f_desc), 0, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 gtk_box_pack_start(GTK_BOX(song_vbox), f_desc, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 bbox_hbox = gtk_hbox_new(FALSE, 6); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 gtk_box_pack_start(GTK_BOX(configure_vbox), bbox_hbox, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 cmd_warn_img = gtk_image_new_from_stock("gtk-dialog-warning", GTK_ICON_SIZE_MENU); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 gtk_box_pack_start(GTK_BOX(bbox_hbox), cmd_warn_img, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 temp = g_strdup_printf( |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 _("<span size='small'>Parameters passed to the shell should be encapsulated in quotes. Doing otherwise is a security risk.</span>")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 cmd_warn_label = gtk_label_new(temp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 gtk_label_set_markup(GTK_LABEL(cmd_warn_label), temp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 gtk_box_pack_start(GTK_BOX(bbox_hbox), cmd_warn_label, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 g_signal_connect(GTK_OBJECT(cmd_entry), "changed", GTK_SIGNAL_FUNC(configure_ok_cb), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 g_signal_connect(GTK_OBJECT(cmd_after_entry), "changed", GTK_SIGNAL_FUNC(configure_ok_cb), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 g_signal_connect(GTK_OBJECT(cmd_end_entry), "changed", GTK_SIGNAL_FUNC(configure_ok_cb), NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 gtk_widget_show_all(configure_vbox); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 return configure_vbox; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 static void init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 read_config(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
429 configure_vbox = configure(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 prefswin_page_new(configure_vbox, "Song Change", DATA_DIR "/images/plugins.png"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 |
594
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
432 hook_associate("playback begin", songchange_playback_begin, NULL); |
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
433 hook_associate("playback end", songchange_playback_end, NULL); |
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
434 hook_associate("playlist end reached", songchange_playlist_eof, NULL); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
435 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 configure_ok_cb(NULL, NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
439 static void |
594
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
440 songchange_playback_begin(gpointer unused, gpointer unused2) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 { |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
442 int pos; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
443 char *current_file; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 |
1024 | 445 pos = audacious_drct_pl_get_pos(); |
446 current_file = audacious_drct_pl_get_file(pos); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
448 do_command(cmd_line, current_file, pos); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
450 g_free(current_file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
453 static void |
594
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
454 songchange_playback_end(gpointer unused, gpointer unused2) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 { |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
456 int pos; |
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
457 char *current_file; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 |
1024 | 459 pos = audacious_drct_pl_get_pos(); |
460 current_file = audacious_drct_pl_get_file(pos); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
462 do_command(cmd_line_after, current_file, pos); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
464 g_free(current_file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
467 static void |
594
424d51558e0a
[svn] - Adapted song_change plugin to new hook functions
mf0102
parents:
552
diff
changeset
|
468 songchange_playlist_eof(gpointer unused, gpointer unused2) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 int pos; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 char *current_file; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 |
1024 | 473 pos = audacious_drct_pl_get_pos(); |
474 current_file = audacious_drct_pl_get_file(pos); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
476 do_command(cmd_line_end, current_file, pos); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 g_free(current_file); |
549
f4b8032d08f1
[svn] - songchange: use asynchronous hooks instead of a polling event
nenolod
parents:
527
diff
changeset
|
479 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 |