annotate src/filewriter/filewriter.c @ 999:d338a8beb3d6 trunk

[svn] - We do not need the internal libflac anymore
author ertzing
date Sat, 05 May 2007 04:20:17 -0700
parents 67cf9a1e3dc5
children d980b7e5bf1d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
1 /* FileWriter-Plugin
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
2 * (C) copyright 2007 merging of Disk Writer and Out-Lame by Michael Färber
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
3 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
4 * Original Out-Lame-Plugin:
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
5 * (C) copyright 2002 Lars Siebold <khandha5@gmx.net>
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
6 * (C) copyright 2006-2007 porting to audacious by Yoshiki Yazawa <yaz@cc.rim.or.jp>
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
7 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
11 * (at your option) any later version.
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
12 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
16 * GNU General Public License for more details.
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
17 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
21 */
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
22
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
23 #include "filewriter.h"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
24 #include "plugins.h"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
25
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
26 static GtkWidget *configure_win = NULL, *configure_vbox;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
27 static GtkWidget *path_hbox, *path_label, *path_dirbrowser;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
28 static GtkWidget *configure_bbox, *configure_ok, *configure_cancel;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
29
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
30 static GtkWidget *fileext_hbox, *fileext_label, *fileext_combo, *plugin_button;
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents: 986
diff changeset
31 enum fileext_t { WAV = 0, MP3, VORBIS, FLAC, FILEEXT_MAX } ;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
32 static gint fileext = WAV;
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents: 986
diff changeset
33 static gchar *fileext_str[] = { "wav", "mp3", "ogg", "flac" } ;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
34 static FileWriter plugin;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
35
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
36 static GtkWidget *saveplace_hbox, *saveplace;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
37 static gboolean save_original = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
38
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
39 static GtkWidget *filenamefrom_hbox, *filenamefrom_label, *filenamefrom_toggle;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
40 static gboolean filenamefromtags = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
41
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
42 static GtkWidget *use_suffix_toggle = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
43 static gboolean use_suffix = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
44
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
45 static GtkWidget *prependnumber_toggle;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
46 static gboolean prependnumber = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
47
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
48 static gchar *file_path = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
49
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
50 gint ctrlsocket_get_session_id(void); /* FIXME */
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
51
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
52 extern TitleInput *input_get_song_tuple(const gchar *filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
53
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
54 static void file_init(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
55 static void file_about(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
56 static gint file_open(AFormat fmt, gint rate, gint nch);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
57 static void file_write(void *ptr, gint length);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
58 static void file_close(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
59 static void file_flush(gint time);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
60 static void file_pause(short p);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
61 static gint file_free(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
62 static gint file_playing(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
63 static gint file_get_written_time(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
64 static gint file_get_output_time(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
65 static void file_configure(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
66
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
67 OutputPlugin file_op =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
68 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
69 NULL,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
70 NULL,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
71 NULL,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
72 file_init,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
73 NULL,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
74 file_about,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
75 file_configure,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
76 NULL,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
77 NULL,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
78 file_open,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
79 file_write,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
80 file_close,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
81 file_flush,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
82 file_pause,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
83 file_free,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
84 file_playing,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
85 file_get_output_time,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
86 file_get_written_time,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
87 NULL
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
88 };
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
89
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
90 OutputPlugin *get_oplugin_info(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
91 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
92 file_op.description = g_strdup_printf("FileWriter %s", VERSION);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
93 return &file_op;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
94 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
95
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
96 static void set_plugin(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
97 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
98 if (fileext < 0 || fileext >= FILEEXT_MAX)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
99 fileext = 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
100
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
101 if (fileext == WAV)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
102 plugin = wav_plugin;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
103 if (fileext == MP3)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
104 plugin = mp3_plugin;
986
5523559a1eac [svn] - add Vorbis output mode
nenolod
parents: 985
diff changeset
105 if (fileext == VORBIS)
5523559a1eac [svn] - add Vorbis output mode
nenolod
parents: 985
diff changeset
106 plugin = vorbis_plugin;
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents: 986
diff changeset
107 if (fileext == FLAC)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents: 986
diff changeset
108 plugin = flac_plugin;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
109 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
110
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
111 static void file_init(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
112 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
113 ConfigDb *db;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
114
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
115 db = bmp_cfg_db_open();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
116 bmp_cfg_db_get_int(db, "filewriter", "fileext", &fileext);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
117 bmp_cfg_db_get_string(db, "filewriter", "file_path", &file_path);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
118 bmp_cfg_db_get_bool(db, "filewriter", "save_original", &save_original);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
119 bmp_cfg_db_get_bool(db, "filewriter", "use_suffix", &use_suffix);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
120 bmp_cfg_db_get_bool(db, "filewriter", "filenamefromtags", &filenamefromtags);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
121 bmp_cfg_db_get_bool(db, "filewriter", "prependnumber", &prependnumber);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
122 bmp_cfg_db_close(db);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
123
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
124 if (!file_path)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
125 file_path = g_strdup(g_get_home_dir());
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
126
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
127 set_plugin();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
128 if (plugin.init)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
129 plugin.init();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
130 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
131
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
132 void file_about(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
133 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
134 static GtkWidget *dialog;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
135
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
136 if (dialog != NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
137 return;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
138
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
139 dialog = xmms_show_message("About FileWriter-Plugin",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
140 "FileWriter-Plugin\n\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
141 "This program is free software; you can redistribute it and/or modify\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
142 "it under the terms of the GNU General Public License as published by\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
143 "the Free Software Foundation; either version 2 of the License, or\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
144 "(at your option) any later version.\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
145 "\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
146 "This program is distributed in the hope that it will be useful,\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
147 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
148 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
149 "GNU General Public License for more details.\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
150 "\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
151 "You should have received a copy of the GNU General Public License\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
152 "along with this program; if not, write to the Free Software\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
153 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
154 "USA.", "Ok", FALSE, NULL, NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
155 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
156 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
157 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
158
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
159 static gint file_open(AFormat fmt, gint rate, gint nch)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
160 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
161 gchar *origfilename = NULL, *filename = NULL, *temp = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
162 gint pos;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
163
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
164 if (xmms_check_realtime_priority())
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
165 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
166 xmms_show_message(_("Error"),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
167 _("You cannot use the FileWriter plugin\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
168 "when you're running in realtime mode."),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
169 _("OK"), FALSE, NULL, NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
170 return 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
171 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
172
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
173 input.format = fmt;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
174 input.frequency = rate;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
175 input.channels = nch;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
176
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
177 pos = xmms_remote_get_playlist_pos(ctrlsocket_get_session_id());
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
178
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
179 origfilename = xmms_remote_get_playlist_file(ctrlsocket_get_session_id(),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
180 pos);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
181
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
182 tuple = input_get_song_tuple(origfilename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
183
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
184 if (filenamefromtags)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
185 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
186 gchar *utf8 =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
187 xmms_remote_get_playlist_title(ctrlsocket_get_session_id(), pos);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
188 g_strchomp(utf8); //chop trailing ^J --yaz
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
189
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
190 filename = g_locale_from_utf8(utf8, -1, NULL, NULL, NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
191 g_free(utf8);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
192 while (filename != NULL && (temp = strchr(filename, '/')) != NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
193 *temp = '-';
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
194 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
195 if (filename == NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
196 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
197 filename = g_path_get_basename(origfilename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
198 if (!use_suffix)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
199 if ((temp = strrchr(filename, '.')) != NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
200 *temp = '\0';
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
201 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
202 if (filename == NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
203 filename = g_strdup_printf("aud-%d", pos);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
204
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
205
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
206 if (prependnumber)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
207 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
208 gint number;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
209 if (tuple && tuple->track_number)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
210 number = tuple->track_number;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
211 else
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
212 number = pos + 1;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
213
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
214 temp = g_strdup_printf("%.02d %s", number, filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
215 g_free(filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
216 filename = temp;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
217 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
218
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
219 gchar *directory;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
220 if (save_original)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
221 directory = g_path_get_dirname(origfilename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
222 else
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
223 directory = g_strdup(file_path);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
224
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
225 g_free(origfilename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
226
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
227 temp = g_strdup_printf("%s/%s.%s",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
228 directory, filename, fileext_str[fileext]);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
229 g_free(directory);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
230 g_free(filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
231 filename = temp;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
232
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
233 output_file = vfs_fopen(filename, "w");
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
234 g_free(filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
235
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
236 if (!output_file)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
237 return 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
238
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
239 return plugin.open();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
240 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
241
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
242 static void convert_buffer(gpointer buffer, gint length)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
243 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
244 gint i;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
245
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
246 if (input.format == FMT_S8)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
247 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
248 guint8 *ptr1 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
249 gint8 *ptr2 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
250
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
251 for (i = 0; i < length; i++)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
252 *(ptr1++) = *(ptr2++) ^ 128;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
253 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
254 if (input.format == FMT_S16_BE)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
255 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
256 gint16 *ptr = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
257
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
258 for (i = 0; i < length >> 1; i++, ptr++)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
259 *ptr = GUINT16_SWAP_LE_BE(*ptr);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
260 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
261 if (input.format == FMT_S16_NE)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
262 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
263 gint16 *ptr = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
264
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
265 for (i = 0; i < length >> 1; i++, ptr++)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
266 *ptr = GINT16_TO_LE(*ptr);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
267 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
268 if (input.format == FMT_U16_BE)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
269 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
270 gint16 *ptr1 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
271 guint16 *ptr2 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
272
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
273 for (i = 0; i < length >> 1; i++, ptr2++)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
274 *(ptr1++) = GINT16_TO_LE(GUINT16_FROM_BE(*ptr2) ^ 32768);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
275 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
276 if (input.format == FMT_U16_LE)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
277 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
278 gint16 *ptr1 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
279 guint16 *ptr2 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
280
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
281 for (i = 0; i < length >> 1; i++, ptr2++)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
282 *(ptr1++) = GINT16_TO_LE(GUINT16_FROM_LE(*ptr2) ^ 32768);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
283 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
284 if (input.format == FMT_U16_NE)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
285 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
286 gint16 *ptr1 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
287 guint16 *ptr2 = buffer;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
288
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
289 for (i = 0; i < length >> 1; i++, ptr2++)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
290 *(ptr1++) = GINT16_TO_LE((*ptr2) ^ 32768);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
291 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
292 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
293
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
294 static void file_write(void *ptr, gint length)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
295 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
296 AFormat new_format;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
297 int new_frequency, new_channels;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
298 EffectPlugin *ep;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
299
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
300 new_format = input.format;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
301 new_frequency = input.frequency;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
302 new_channels = input.channels;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
303
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
304 ep = get_current_effect_plugin();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
305 if ( effects_enabled() && ep && ep->query_format ) {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
306 ep->query_format(&new_format,&new_frequency,&new_channels);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
307 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
308
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
309 if ( effects_enabled() && ep && ep->mod_samples ) {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
310 length = ep->mod_samples(&ptr,length,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
311 input.format,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
312 input.frequency,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
313 input.channels );
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
314 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
315
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
316 if (input.format == FMT_S8 || input.format == FMT_S16_BE ||
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
317 input.format == FMT_U16_LE || input.format == FMT_U16_BE ||
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
318 input.format == FMT_U16_NE)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
319 convert_buffer(ptr, length);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
320 #ifdef WORDS_BIGENDIAN
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
321 if (input.format == FMT_S16_NE)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
322 convert_buffer(ptr, length);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
323 #endif
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
324
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
325 plugin.write(ptr, length);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
326 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
327
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
328 static void file_close(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
329 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
330 plugin.close();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
331
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
332 if (output_file)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
333 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
334 written = 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
335 vfs_fclose(output_file);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
336 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
337 output_file = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
338 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
339
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
340 static void file_flush(gint time)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
341 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
342 if (time < 0)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
343 return;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
344
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
345 file_close();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
346 file_open(input.format, input.frequency, input.channels);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
347
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
348 offset = time;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
349 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
350
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
351 static void file_pause(short p)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
352 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
353 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
354
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
355 static gint file_free(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
356 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
357 return plugin.free();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
358 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
359
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
360 static gint file_playing(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
361 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
362 return plugin.playing();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
363 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
364
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
365 static gint file_get_written_time(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
366 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
367 return plugin.get_written_time();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
368 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
369
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
370 static gint file_get_output_time(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
371 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
372 return file_get_written_time();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
373 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
374
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
375 static void configure_ok_cb(gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
376 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
377 ConfigDb *db;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
378
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
379 fileext = gtk_combo_box_get_active(GTK_COMBO_BOX(fileext_combo));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
380
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
381 g_free(file_path);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
382 file_path = g_strdup(gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(path_dirbrowser)));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
383
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
384 use_suffix =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
385 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(use_suffix_toggle));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
386
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
387 prependnumber =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
388 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prependnumber_toggle));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
389
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
390 db = bmp_cfg_db_open();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
391 bmp_cfg_db_set_int(db, "filewriter", "fileext", fileext);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
392 bmp_cfg_db_set_string(db, "filewriter", "file_path", file_path);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
393 bmp_cfg_db_set_bool(db, "filewriter", "save_original", save_original);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
394 bmp_cfg_db_set_bool(db, "filewriter", "filenamefromtags", filenamefromtags);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
395 bmp_cfg_db_set_bool(db, "filewriter", "use_suffix", use_suffix);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
396 bmp_cfg_db_set_bool(db, "filewriter", "prependnumber", prependnumber);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
397
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
398 bmp_cfg_db_close(db);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
399
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
400 gtk_widget_destroy(configure_win);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
401 if (path_dirbrowser)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
402 gtk_widget_destroy(path_dirbrowser);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
403 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
404
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
405 static void fileext_cb(GtkWidget *combo, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
406 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
407 fileext = gtk_combo_box_get_active(GTK_COMBO_BOX(fileext_combo));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
408 set_plugin();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
409
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
410 gtk_widget_set_sensitive(plugin_button, plugin.configure != NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
411 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
412
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
413 static void plugin_configure_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
414 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
415 if (plugin.configure)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
416 plugin.configure();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
417 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
418
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
419
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
420 static void saveplace_original_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
421 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
422 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
423 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
424 gtk_widget_set_sensitive(path_hbox, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
425 save_original = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
426 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
427 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
428
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
429 static void saveplace_custom_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
430 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
431 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
432 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
433 gtk_widget_set_sensitive(path_hbox, TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
434 save_original = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
435 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
436 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
437
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
438 static void filenamefromtags_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
439 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
440 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
441 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
442 gtk_widget_set_sensitive(use_suffix_toggle, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
443 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_suffix_toggle), FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
444 use_suffix = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
445 filenamefromtags = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
446 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
447 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
448
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
449 static void filenamefromfilename_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
450 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
451 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
452 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
453 gtk_widget_set_sensitive(use_suffix_toggle, TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
454 filenamefromtags = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
455 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
456 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
457
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
458
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
459 static void configure_destroy(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
460 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
461 if (path_dirbrowser)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
462 gtk_widget_destroy(path_dirbrowser);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
463 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
464
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
465 static void file_configure(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
466 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
467 GtkTooltips *use_suffix_tooltips;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
468
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
469 if (!configure_win)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
470 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
471 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
472
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
473 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
474 GTK_SIGNAL_FUNC(configure_destroy), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
475 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
476 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
477 &configure_win);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
478
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
479 gtk_window_set_title(GTK_WINDOW(configure_win),
985
029056fb9f9d [svn] - rename titles of configure windows.
yaz
parents: 984
diff changeset
480 _("File Writer Configuration"));
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
481 gtk_window_set_position(GTK_WINDOW(configure_win), GTK_WIN_POS_MOUSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
482
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
483 gtk_container_set_border_width(GTK_CONTAINER(configure_win), 10);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
484
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
485 configure_vbox = gtk_vbox_new(FALSE, 10);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
486 gtk_container_add(GTK_CONTAINER(configure_win), configure_vbox);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
487
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
488
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
489 fileext_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
490 gtk_box_pack_start(GTK_BOX(configure_vbox), fileext_hbox, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
491
986
5523559a1eac [svn] - add Vorbis output mode
nenolod
parents: 985
diff changeset
492 fileext_label = gtk_label_new(_("Output file format:"));
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
493 gtk_box_pack_start(GTK_BOX(fileext_hbox), fileext_label, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
494
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
495 fileext_combo = gtk_combo_box_new_text();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
496 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "WAV");
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
497 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "MP3");
986
5523559a1eac [svn] - add Vorbis output mode
nenolod
parents: 985
diff changeset
498 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "Vorbis");
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents: 986
diff changeset
499 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "FLAC");
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
500 gtk_box_pack_start(GTK_BOX(fileext_hbox), fileext_combo, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
501 gtk_combo_box_set_active(GTK_COMBO_BOX(fileext_combo), fileext);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
502 g_signal_connect(G_OBJECT(fileext_combo), "changed", G_CALLBACK(fileext_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
503
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
504 plugin_button = gtk_button_new_with_label(_("Configure"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
505 gtk_widget_set_sensitive(plugin_button, plugin.configure != NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
506 g_signal_connect(G_OBJECT(plugin_button), "clicked", G_CALLBACK(plugin_configure_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
507 gtk_box_pack_end(GTK_BOX(fileext_hbox), plugin_button, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
508
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
509
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
510
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
511
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
512 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
513
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
514
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
515
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
516 saveplace_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
517 gtk_container_add(GTK_CONTAINER(configure_vbox), saveplace_hbox);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
518
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
519 saveplace = gtk_radio_button_new_with_label(NULL, _("Save into original directory"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
520 g_signal_connect(G_OBJECT(saveplace), "toggled", G_CALLBACK(saveplace_original_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
521 gtk_box_pack_start(GTK_BOX(saveplace_hbox), saveplace, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
522
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
523 saveplace = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(saveplace),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
524 _("Save into custom directory"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
525 g_signal_connect(G_OBJECT(saveplace), "toggled", G_CALLBACK(saveplace_custom_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
526 gtk_box_pack_start(GTK_BOX(saveplace_hbox), saveplace, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
527
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
528 if (!save_original)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
529 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(saveplace), TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
530
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
531
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
532
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
533 path_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
534 gtk_box_pack_start(GTK_BOX(configure_vbox), path_hbox, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
535
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
536 path_label = gtk_label_new(_("Output file folder:"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
537 gtk_box_pack_start(GTK_BOX(path_hbox), path_label, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
538
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
539 path_dirbrowser =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
540 gtk_file_chooser_button_new ("Pick a folder",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
541 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
542 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(path_dirbrowser),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
543 file_path);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
544 gtk_box_pack_start(GTK_BOX(path_hbox), path_dirbrowser, TRUE, TRUE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
545
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
546 if (save_original)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
547 gtk_widget_set_sensitive(path_hbox, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
548
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
549
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
550
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
551
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
552 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
553
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
554
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
555
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
556
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
557 filenamefrom_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
558 gtk_container_add(GTK_CONTAINER(configure_vbox), filenamefrom_hbox);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
559
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
560 filenamefrom_label = gtk_label_new(_("Get filename from:"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
561 gtk_box_pack_start(GTK_BOX(filenamefrom_hbox), filenamefrom_label, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
562
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
563 filenamefrom_toggle = gtk_radio_button_new_with_label(NULL, _("original file tags"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
564 g_signal_connect(G_OBJECT(filenamefrom_toggle), "toggled", G_CALLBACK(filenamefromtags_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
565 gtk_box_pack_start(GTK_BOX(filenamefrom_hbox), filenamefrom_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
566
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
567 filenamefrom_toggle =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
568 gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(filenamefrom_toggle),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
569 _("original filename"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
570 g_signal_connect(G_OBJECT(filenamefrom_toggle), "toggled", G_CALLBACK(filenamefromfilename_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
571 gtk_box_pack_start(GTK_BOX(filenamefrom_hbox), filenamefrom_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
572
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
573 if (!filenamefromtags)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
574 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filenamefrom_toggle), TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
575
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
576
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
577
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
578
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
579 use_suffix_toggle = gtk_check_button_new_with_label(_("Don't strip file name extension"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
580 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_suffix_toggle), use_suffix);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
581 gtk_box_pack_start(GTK_BOX(configure_vbox), use_suffix_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
582 use_suffix_tooltips = gtk_tooltips_new();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
583 gtk_tooltips_set_tip(use_suffix_tooltips, use_suffix_toggle, "If enabled, the extension from the original filename will not be stripped before adding the .wav extension to the end.", NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
584 gtk_tooltips_enable(use_suffix_tooltips);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
585
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
586 if (filenamefromtags)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
587 gtk_widget_set_sensitive(use_suffix_toggle, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
588
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
589
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
590
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
591
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
592 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
593
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
594
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
595
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
596
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
597 prependnumber_toggle = gtk_check_button_new_with_label(_("Prepend track number to filename"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
598 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prependnumber_toggle), prependnumber);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
599 gtk_box_pack_start(GTK_BOX(configure_vbox), prependnumber_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
600
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
601
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
602
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
603 configure_bbox = gtk_hbutton_box_new();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
604 gtk_button_box_set_layout(GTK_BUTTON_BOX(configure_bbox),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
605 GTK_BUTTONBOX_END);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
606 gtk_button_box_set_spacing(GTK_BUTTON_BOX(configure_bbox), 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
607 gtk_box_pack_start(GTK_BOX(configure_vbox), configure_bbox,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
608 FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
609
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
610 configure_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
611 gtk_signal_connect_object(GTK_OBJECT(configure_cancel), "clicked",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
612 GTK_SIGNAL_FUNC(gtk_widget_destroy),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
613 GTK_OBJECT(configure_win));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
614 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_cancel,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
615 TRUE, TRUE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
616
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
617 configure_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
618 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
619 GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
620 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_ok,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
621 TRUE, TRUE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
622
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
623 gtk_widget_show_all(configure_win);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
624 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
625 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
626
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
627 VFSFile *output_file = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
628 guint64 written = 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
629 guint64 offset = 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
630 TitleInput *tuple = NULL;