View | Details | Raw Unified | Return to bug 25
Collapse All | Expand All

(-)src/callbacks.c (+63 lines)
Lines 120-125 Link Here
120
}
120
}
121
121
122
gboolean
122
gboolean
123
on_disc_number_focus_out_event        (GtkWidget       *widget,
124
                                        GdkEventFocus   *event,
125
                                        gpointer         user_data)
126
{
127
    const gchar * ctext = gtk_entry_get_text(GTK_ENTRY(widget));
128
    gchar * text = malloc(5);
129
    if (text == NULL)
130
        fatalError("malloc(5) failed. Out of memory.");
131
    strncpy(text, ctext, 5);
132
    text[4] = '\0';
133
    
134
    char *str_end = 0;
135
    (void) strtoul(text, &str_end, 10);
136
    if(*str_end != '\0')
137
    {
138
        text[0] = '\0';
139
    }
140
    
141
    gtk_entry_set_text(GTK_ENTRY(widget), text);
142
    
143
    free(text);
144
    return FALSE;
145
}
146
147
gboolean
123
on_year_focus_out_event        (GtkWidget       *widget,
148
on_year_focus_out_event        (GtkWidget       *widget,
124
                                        GdkEventFocus   *event,
149
                                        GdkEventFocus   *event,
125
                                        gpointer         user_data)
150
                                        gpointer         user_data)
Lines 232-237 Link Here
232
}
257
}
233
258
234
void
259
void
260
on_discnum_width_changed_event        (GtkComboBox     *combobox,
261
                                        gpointer         user_data)
262
{
263
    gint selected = gtk_combo_box_get_active(combobox);
264
    int width = selected + 1;
265
266
    if (width >= 1 && width <= 4)
267
    {
268
        global_prefs->disc_num_width = width;
269
    }
270
271
    gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), global_prefs->disc_num_width - 1);
272
}
273
274
gboolean
275
on_discnum_punct_focus_out_event      (GtkWidget       *widget,
276
                                        GdkEventFocus   *event,
277
                                        gpointer         user_data)
278
{
279
    const gchar * ctext = gtk_entry_get_text(GTK_ENTRY(widget));
280
281
    // keep only one character
282
283
    if (*ctext)
284
    {
285
      snprintf(global_prefs->disc_num_punct, 2, "%c", *ctext);
286
    }
287
    else
288
    {
289
      global_prefs->disc_num_punct[0] = '\0';
290
    }
291
292
    gtk_entry_set_text(GTK_ENTRY (widget), global_prefs->disc_num_punct);
293
294
    return FALSE;
295
}
296
297
void
235
on_artist_edited                    (GtkCellRendererText *cell,
298
on_artist_edited                    (GtkCellRendererText *cell,
236
                                     gchar               *path_string,
299
                                     gchar               *path_string,
237
                                     gchar               *new_text,
300
                                     gchar               *new_text,
(-)src/callbacks.h (+13 lines)
Lines 35-40 Link Here
35
                                        gpointer         user_data);
35
                                        gpointer         user_data);
36
36
37
gboolean
37
gboolean
38
on_disc_number_focus_out_event        (GtkWidget       *widget,
39
                                        GdkEventFocus   *event,
40
                                        gpointer         user_data);
41
gboolean
38
on_year_focus_out_event        (GtkWidget       *widget,
42
on_year_focus_out_event        (GtkWidget       *widget,
39
                                        GdkEventFocus   *event,
43
                                        GdkEventFocus   *event,
40
                                        gpointer         user_data);
44
                                        gpointer         user_data);
Lines 60-65 Link Here
60
                                        gpointer         user_data);
64
                                        gpointer         user_data);
61
65
62
void
66
void
67
on_discnum_width_changed_event        (GtkComboBox     *combobox,
68
                                        gpointer         user_data);
69
70
gboolean
71
on_discnum_punct_focus_out_event      (GtkWidget       *widget,
72
                                        GdkEventFocus   *event,
73
                                        gpointer         user_data);
74
75
void
63
on_artist_edited                    (GtkCellRendererText *cell,
76
on_artist_edited                    (GtkCellRendererText *cell,
64
                                     gchar               *path_string,
77
                                     gchar               *path_string,
65
                                     gchar               *new_text,
78
                                     gchar               *new_text,
(-)src/interface.c (-18 / +110 lines)
Lines 54-59 Link Here
54
    GtkWidget *disc;
54
    GtkWidget *disc;
55
    GtkWidget *artist_label;
55
    GtkWidget *artist_label;
56
    GtkWidget *title_label;
56
    GtkWidget *title_label;
57
    GtkWidget *single_artist_label;
57
    GtkWidget *single_artist;
58
    GtkWidget *single_artist;
58
    GtkWidget *scrolledwindow1;
59
    GtkWidget *scrolledwindow1;
59
    GtkWidget *tracklist;
60
    GtkWidget *tracklist;
Lines 67-72 Link Here
67
    GtkWidget* statusLbl;
68
    GtkWidget* statusLbl;
68
    GtkWidget *album_genre;			// lnr
69
    GtkWidget *album_genre;			// lnr
69
    GtkWidget *genre_label;			// lnr
70
    GtkWidget *genre_label;			// lnr
71
    GtkWidget *year_label;
72
    GtkWidget *disc_number_label;
70
    
73
    
71
    main_win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
74
    main_win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
72
    gtk_window_set_title (GTK_WINDOW (main_win), "Asunder");
75
    gtk_window_set_title (GTK_WINDOW (main_win), "Asunder");
Lines 111-117 Link Here
111
    gtk_container_add (GTK_CONTAINER (toolbar1), about);
114
    gtk_container_add (GTK_CONTAINER (toolbar1), about);
112
    gtk_tool_item_set_is_important (GTK_TOOL_ITEM (about), TRUE);
115
    gtk_tool_item_set_is_important (GTK_TOOL_ITEM (about), TRUE);
113
    
116
    
114
    table2 = gtk_table_new (5, 3, FALSE);
117
    table2 = gtk_table_new (5, 4, FALSE);
115
    gtk_widget_show (table2);
118
    gtk_widget_show (table2);
116
    gtk_box_pack_start (GTK_BOX (vbox1), table2, FALSE, TRUE, 3);
119
    gtk_box_pack_start (GTK_BOX (vbox1), table2, FALSE, TRUE, 3);
117
120
Lines 161-186 Link Here
161
                      (GtkAttachOptions) (GTK_FILL),
164
                      (GtkAttachOptions) (GTK_FILL),
162
                      (GtkAttachOptions) (0), 3, 0);
165
                      (GtkAttachOptions) (0), 3, 0);
163
166
164
    single_artist = gtk_check_button_new_with_mnemonic (_("Single Artist"));
167
    single_artist_label = gtk_label_new (_("Single Artist:"));
168
    gtk_misc_set_alignment (GTK_MISC (single_artist_label), 0, 0);
169
    gtk_widget_show (single_artist_label);
170
    gtk_table_attach (GTK_TABLE (table2), single_artist_label, 2, 3, 1, 2,
171
                      (GtkAttachOptions) (GTK_FILL),
172
                      (GtkAttachOptions) (0), 3, 0);
173
174
    single_artist = gtk_check_button_new ();
165
    gtk_widget_show (single_artist);
175
    gtk_widget_show (single_artist);
166
    gtk_table_attach (GTK_TABLE (table2), single_artist, 2, 3, 1, 2,
176
    gtk_table_attach (GTK_TABLE (table2), single_artist, 3, 4, 1, 2,
167
                      (GtkAttachOptions) (GTK_FILL),
177
                      (GtkAttachOptions) (GTK_FILL),
168
                      (GtkAttachOptions) (0), 3, 0);
178
                      (GtkAttachOptions) (0), 3, 0);
169
179
170
    GtkWidget* tn_hbox = gtk_hbox_new(FALSE, 5);
180
    GtkWidget* tdn_hbox = gtk_hbox_new(FALSE, 5);
171
    gtk_widget_hide(tn_hbox);
181
    gtk_widget_hide(tdn_hbox);
172
    gtk_table_attach (GTK_TABLE (table2), tn_hbox, 0, 3, 4, 5,
182
    gtk_table_attach (GTK_TABLE (table2), tdn_hbox, 0, 4, 4, 5,
173
                      (GtkAttachOptions) (GTK_FILL),
183
                      (GtkAttachOptions) (GTK_FILL),
174
                      (GtkAttachOptions) (0), 3, 0);
184
                      (GtkAttachOptions) (0), 3, 0);
175
185
186
    // Track number adjustments
187
176
    GtkWidget *tn_labelo = gtk_label_new (_("First track number:"));
188
    GtkWidget *tn_labelo = gtk_label_new (_("First track number:"));
177
    gtk_misc_set_alignment (GTK_MISC (tn_labelo), 0, 0.5);
189
    gtk_misc_set_alignment (GTK_MISC (tn_labelo), 0, 0.5);
178
    gtk_widget_show (tn_labelo);
190
    gtk_widget_show (tn_labelo);
179
    gtk_box_pack_start(GTK_BOX (tn_hbox), tn_labelo, FALSE, TRUE, 0);
191
    gtk_box_pack_start(GTK_BOX (tdn_hbox), tn_labelo, FALSE, TRUE, 0);
180
192
181
    GtkWidget* tn_first = gtk_entry_new();
193
    GtkWidget* tn_first = gtk_entry_new();
182
    gtk_widget_show(tn_first);
194
    gtk_widget_show(tn_first);
183
    gtk_box_pack_start(GTK_BOX (tn_hbox), tn_first, FALSE, TRUE, 0);
195
    gtk_box_pack_start(GTK_BOX (tdn_hbox), tn_first, FALSE, TRUE, 0);
184
    gtk_entry_set_width_chars(GTK_ENTRY (tn_first), 4);
196
    gtk_entry_set_width_chars(GTK_ENTRY (tn_first), 4);
185
    char txt[16];
197
    char txt[16];
186
    snprintf(txt, 16, "%d", global_prefs->first_track_num_offset + 1);
198
    snprintf(txt, 16, "%d", global_prefs->first_track_num_offset + 1);
Lines 189-199 Link Here
189
    GtkWidget* tn_labelw = gtk_label_new (_("Track number width in filename:"));
201
    GtkWidget* tn_labelw = gtk_label_new (_("Track number width in filename:"));
190
    gtk_misc_set_alignment (GTK_MISC (tn_labelw), 0, 0.5);
202
    gtk_misc_set_alignment (GTK_MISC (tn_labelw), 0, 0.5);
191
    gtk_widget_show (tn_labelw);
203
    gtk_widget_show (tn_labelw);
192
    gtk_box_pack_start(GTK_BOX (tn_hbox), tn_labelw, FALSE, TRUE, 0);
204
    gtk_box_pack_start(GTK_BOX (tdn_hbox), tn_labelw, FALSE, TRUE, 0);
193
205
194
    GtkWidget* tn_width = gtk_combo_box_new();
206
    GtkWidget* tn_width = gtk_combo_box_new();
195
    gtk_widget_show(tn_width);
207
    gtk_widget_show(tn_width);
196
    gtk_box_pack_start(GTK_BOX (tn_hbox), tn_width, FALSE, TRUE, 0);
208
    gtk_box_pack_start(GTK_BOX (tdn_hbox), tn_width, FALSE, TRUE, 0);
197
	
209
	
198
    GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
210
    GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
199
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(tn_width), renderer, TRUE);
211
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(tn_width), renderer, TRUE);
Lines 211-218 Link Here
211
    gtk_combo_box_set_model(GTK_COMBO_BOX(tn_width), GTK_TREE_MODEL(store));
223
    gtk_combo_box_set_model(GTK_COMBO_BOX(tn_width), GTK_TREE_MODEL(store));
212
    g_object_unref(store);
224
    g_object_unref(store);
213
    gtk_combo_box_set_active(GTK_COMBO_BOX(tn_width), global_prefs->track_num_width - 1);
225
    gtk_combo_box_set_active(GTK_COMBO_BOX(tn_width), global_prefs->track_num_width - 1);
226
    
227
    // Disc number adjustments
228
229
    GtkWidget* dn_labelw = gtk_label_new (_("Disc number width in filename:"));
230
    gtk_misc_set_alignment (GTK_MISC (dn_labelw), 0, 0.5);
231
    gtk_widget_show (dn_labelw);
232
    gtk_box_pack_start(GTK_BOX (tdn_hbox), dn_labelw, FALSE, TRUE, 0);
233
234
    GtkWidget* dn_width = gtk_combo_box_new();
235
    gtk_widget_show(dn_width);
236
    gtk_box_pack_start(GTK_BOX (tdn_hbox), dn_width, FALSE, TRUE, 0);
214
	
237
	
215
    genre_label	= gtk_label_new (_("Genre / Year:"));								// lnr
238
    GtkCellRenderer *dn_renderer = gtk_cell_renderer_text_new();
239
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dn_width), dn_renderer, TRUE);
240
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dn_width), dn_renderer,
241
                                                    "text", 0,
242
                                                    NULL);
243
    GtkListStore * dn_store = gtk_list_store_new(1, G_TYPE_STRING);
244
    GtkTreeIter dn_iter;
245
    for (int i = 1; i <= 4; ++i) {
246
        char buff[2];
247
        snprintf(buff, 2, "%d", i);
248
        gtk_list_store_append(dn_store, &dn_iter);
249
        gtk_list_store_set(dn_store, &dn_iter, 0, buff, -1);
250
    }
251
    gtk_combo_box_set_model(GTK_COMBO_BOX(dn_width), GTK_TREE_MODEL(dn_store));
252
    g_object_unref(dn_store);
253
    gtk_combo_box_set_active(GTK_COMBO_BOX(dn_width), global_prefs->disc_num_width - 1);
254
255
    GtkWidget *dp_labelo = gtk_label_new (_("Disc number punctuation:"));
256
    gtk_misc_set_alignment (GTK_MISC (dp_labelo), 0, 0.5);
257
    gtk_widget_show (dp_labelo);
258
    gtk_box_pack_start(GTK_BOX (tdn_hbox), dp_labelo, FALSE, TRUE, 0);
259
260
    GtkWidget* dn_punct = gtk_entry_new();
261
    gtk_entry_set_width_chars(GTK_ENTRY (dn_punct), 1);
262
    gtk_widget_show(dn_punct);
263
    gtk_box_pack_start(GTK_BOX (tdn_hbox), dn_punct, FALSE, TRUE, 0);
264
    gtk_entry_set_text(GTK_ENTRY (dn_punct), global_prefs->disc_num_punct);
265
	
266
    genre_label	= gtk_label_new (_("Genre:"));								// lnr
216
    gtk_misc_set_alignment (GTK_MISC ( genre_label ), 0, 0);
267
    gtk_misc_set_alignment (GTK_MISC ( genre_label ), 0, 0);
217
    gtk_widget_show (genre_label);
268
    gtk_widget_show (genre_label);
218
    gtk_table_attach (GTK_TABLE (table2), genre_label, 0, 1, 3, 4,
269
    gtk_table_attach (GTK_TABLE (table2), genre_label, 0, 1, 3, 4,
Lines 219-227 Link Here
219
                      (GtkAttachOptions) (GTK_FILL),
270
                      (GtkAttachOptions) (GTK_FILL),
220
                      (GtkAttachOptions) (0), 3, 0);
271
                      (GtkAttachOptions) (0), 3, 0);
221
272
273
    disc_number_label	= gtk_label_new (_("Disc #:"));								// lnr
274
    gtk_misc_set_alignment (GTK_MISC ( disc_number_label ), 0, 0);
275
    gtk_widget_show (disc_number_label);
276
    gtk_table_attach (GTK_TABLE (table2), disc_number_label, 2, 3, 2, 3,
277
                      (GtkAttachOptions) (GTK_FILL),
278
                      (GtkAttachOptions) (0), 3, 0);
279
280
    GtkWidget* disc_number = gtk_entry_new();
281
    gtk_widget_show(disc_number);
282
    gtk_table_attach( GTK_TABLE( table2 ), disc_number, 3, 4, 2, 3,
283
                      (GtkAttachOptions) ( GTK_FILL ),
284
                      (GtkAttachOptions) (0), 3, 0);
285
286
    year_label	= gtk_label_new (_("Year:"));								// lnr
287
    gtk_misc_set_alignment (GTK_MISC ( year_label ), 0, 0);
288
    gtk_widget_show (year_label);
289
    gtk_table_attach (GTK_TABLE (table2), year_label, 2, 3, 3, 4,
290
                      (GtkAttachOptions) (GTK_FILL),
291
                      (GtkAttachOptions) (0), 3, 0);
292
222
    GtkWidget* album_year = gtk_entry_new();
293
    GtkWidget* album_year = gtk_entry_new();
223
    gtk_widget_show(album_year);
294
    gtk_widget_show(album_year);
224
    gtk_table_attach( GTK_TABLE( table2 ), album_year, 2, 3, 3, 4,
295
    gtk_table_attach( GTK_TABLE( table2 ), album_year, 3, 4, 3, 4,
225
                      (GtkAttachOptions) ( GTK_FILL ),
296
                      (GtkAttachOptions) ( GTK_FILL ),
226
                      (GtkAttachOptions) (0), 3, 0);
297
                      (GtkAttachOptions) (0), 3, 0);
227
298
Lines 302-307 Link Here
302
    g_signal_connect ((gpointer) rip_button, "clicked",
373
    g_signal_connect ((gpointer) rip_button, "clicked",
303
                                        G_CALLBACK (on_rip_button_clicked),
374
                                        G_CALLBACK (on_rip_button_clicked),
304
                                        NULL);
375
                                        NULL);
376
    g_signal_connect ((gpointer) disc_number, "focus_out_event",
377
                                        G_CALLBACK (on_disc_number_focus_out_event),
378
                                        NULL);
305
    g_signal_connect ((gpointer) album_genre, "focus_out_event",					// lnr
379
    g_signal_connect ((gpointer) album_genre, "focus_out_event",					// lnr
306
                                        G_CALLBACK (on_album_genre_focus_out_event),
380
                                        G_CALLBACK (on_album_genre_focus_out_event),
307
                                        NULL);
381
                                        NULL);
Lines 314-319 Link Here
314
    g_signal_connect ((gpointer) tn_width, "changed",
388
    g_signal_connect ((gpointer) tn_width, "changed",
315
                                        G_CALLBACK (on_tracknum_width_changed_event),
389
                                        G_CALLBACK (on_tracknum_width_changed_event),
316
                                        NULL);
390
                                        NULL);
391
    g_signal_connect ((gpointer) dn_width, "changed",
392
                                        G_CALLBACK (on_discnum_width_changed_event),
393
                                        NULL);
394
    g_signal_connect ((gpointer) dn_punct, "focus_out_event",
395
                                        G_CALLBACK (on_discnum_punct_focus_out_event),
396
                                        NULL);
317
    
397
    
318
    /* KEYBOARD accelerators */
398
    /* KEYBOARD accelerators */
319
    GtkAccelGroup* accelGroup;
399
    GtkAccelGroup* accelGroup;
Lines 363-372 Link Here
363
    GLADE_HOOKUP_OBJECT (main_win, statusLbl, "statusLbl");
443
    GLADE_HOOKUP_OBJECT (main_win, statusLbl, "statusLbl");
364
    GLADE_HOOKUP_OBJECT (main_win, album_genre, "album_genre");			// lnr
444
    GLADE_HOOKUP_OBJECT (main_win, album_genre, "album_genre");			// lnr
365
    GLADE_HOOKUP_OBJECT (main_win, genre_label, "genre_label" );		// lnr
445
    GLADE_HOOKUP_OBJECT (main_win, genre_label, "genre_label" );		// lnr
446
    GLADE_HOOKUP_OBJECT (main_win, disc_number, "disc_number");
366
    GLADE_HOOKUP_OBJECT (main_win, album_year, "album_year");
447
    GLADE_HOOKUP_OBJECT (main_win, album_year, "album_year");
367
    GLADE_HOOKUP_OBJECT (main_win, tn_hbox, "tn_hbox");
448
    GLADE_HOOKUP_OBJECT (main_win, tdn_hbox, "tdn_hbox");
368
    GLADE_HOOKUP_OBJECT (main_win, tn_first, "tn_first");
449
    GLADE_HOOKUP_OBJECT (main_win, tn_first, "tn_first");
369
    GLADE_HOOKUP_OBJECT (main_win, tn_width, "tn_width");
450
    GLADE_HOOKUP_OBJECT (main_win, tn_width, "tn_width");
451
    GLADE_HOOKUP_OBJECT (main_win, dn_width, "dn_width");
452
    GLADE_HOOKUP_OBJECT (main_win, dn_punct, "dn_punct");
370
    
453
    
371
    return main_win;
454
    return main_win;
372
}
455
}
Lines 491-497 Link Here
491
    gtk_widget_show (vbox);
574
    gtk_widget_show (vbox);
492
    gtk_container_add (GTK_CONTAINER (frame2), vbox);
575
    gtk_container_add (GTK_CONTAINER (frame2), vbox);
493
    
576
    
494
    label = gtk_label_new (_("%A - Artist\n%L - Album\n%N - Track number (2-digit)\n%Y - Year (4-digit or \"0\")\n%T - Song title"));
577
    label = gtk_label_new (_("%A - Artist\n%L - Album\n%D - Disc number (with optional punctuation)\n%N - Track number (2-digit)\n%Y - Year (4-digit or \"0\")\n%T - Song title"));
495
    gtk_widget_show (label);
578
    gtk_widget_show (label);
496
    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
579
    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
497
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
580
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
Lines 572-578 Link Here
572
    gtk_frame_set_label_widget (GTK_FRAME (frame2), label);
655
    gtk_frame_set_label_widget (GTK_FRAME (frame2), label);
573
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
656
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
574
657
575
    GtkWidget * allow_tracknum = gtk_check_button_new_with_label (_("Allow changing first track number"));
658
    GtkWidget * allow_tracknum = gtk_check_button_new_with_label (_("Allow changing first track number and disc number format"));
576
    gtk_widget_show (allow_tracknum);
659
    gtk_widget_show (allow_tracknum);
577
    gtk_box_pack_start (GTK_BOX (vbox2), allow_tracknum, FALSE, FALSE, 5);
660
    gtk_box_pack_start (GTK_BOX (vbox2), allow_tracknum, FALSE, FALSE, 5);
578
    GLADE_HOOKUP_OBJECT (prefs, allow_tracknum, "allow_tracknum");
661
    GLADE_HOOKUP_OBJECT (prefs, allow_tracknum, "allow_tracknum");
Lines 1358-1363 Link Here
1358
    gtk_widget_set_sensitive(lookup_widget(win_main, "rip_button"), FALSE);
1441
    gtk_widget_set_sensitive(lookup_widget(win_main, "rip_button"), FALSE);
1359
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_genre"), FALSE);	// lnr
1442
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_genre"), FALSE);	// lnr
1360
    gtk_widget_set_sensitive(lookup_widget(win_main, "genre_label"), FALSE);	// lnr
1443
    gtk_widget_set_sensitive(lookup_widget(win_main, "genre_label"), FALSE);	// lnr
1444
    gtk_widget_set_sensitive(lookup_widget(win_main, "disc_number"), FALSE);
1361
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_year"), FALSE);
1445
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_year"), FALSE);
1362
}
1446
}
1363
1447
Lines 1376-1381 Link Here
1376
    gtk_widget_set_sensitive(lookup_widget(win_main, "rip_button"), TRUE);
1460
    gtk_widget_set_sensitive(lookup_widget(win_main, "rip_button"), TRUE);
1377
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_genre"), TRUE);		// lnr
1461
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_genre"), TRUE);		// lnr
1378
    gtk_widget_set_sensitive(lookup_widget(win_main, "genre_label"), TRUE);		// lnr
1462
    gtk_widget_set_sensitive(lookup_widget(win_main, "genre_label"), TRUE);		// lnr
1463
    gtk_widget_set_sensitive(lookup_widget(win_main, "disc_number"), TRUE);
1379
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_year"), TRUE);
1464
    gtk_widget_set_sensitive(lookup_widget(win_main, "album_year"), TRUE);
1380
}
1465
}
1381
1466
Lines 1501-1509 Link Here
1501
toggle_allow_tracknum(void)
1586
toggle_allow_tracknum(void)
1502
{
1587
{
1503
    // "Toggle Track Offset/Width control"
1588
    // "Toggle Track Offset/Width control"
1504
    GtkWidget* tn_hbox = lookup_widget(win_main, "tn_hbox");
1589
    GtkWidget* tdn_hbox = lookup_widget(win_main, "tdn_hbox");
1505
    GtkWidget* tn_first = lookup_widget(win_main, "tn_first");
1590
    GtkWidget* tn_first = lookup_widget(win_main, "tn_first");
1506
    GtkWidget* tn_width = lookup_widget(win_main, "tn_width");
1591
    GtkWidget* tn_width = lookup_widget(win_main, "tn_width");
1592
    GtkWidget* dn_width = lookup_widget(win_main, "dn_width");
1593
    GtkWidget* dn_punct = lookup_widget(win_main, "dn_punct");
1507
    gboolean active = global_prefs->allow_first_track_num_change;
1594
    gboolean active = global_prefs->allow_first_track_num_change;
1508
1595
1509
    if (!active)
1596
    if (!active)
Lines 1510-1516 Link Here
1510
    {
1597
    {
1511
        global_prefs->first_track_num_offset = 0;
1598
        global_prefs->first_track_num_offset = 0;
1512
        global_prefs->track_num_width = 2;
1599
        global_prefs->track_num_width = 2;
1513
        gtk_widget_hide(tn_hbox);
1600
        global_prefs->disc_num_width = 1;
1601
        global_prefs->disc_num_punct[0] = '-';
1602
        global_prefs->disc_num_punct[1] = '\0';
1603
        gtk_widget_hide(tdn_hbox);
1514
    }
1604
    }
1515
    else
1605
    else
1516
    {
1606
    {
Lines 1518-1524 Link Here
1518
        snprintf(txt, 16, "%d", global_prefs->first_track_num_offset + 1);
1608
        snprintf(txt, 16, "%d", global_prefs->first_track_num_offset + 1);
1519
        gtk_entry_set_text(GTK_ENTRY (tn_first), txt);
1609
        gtk_entry_set_text(GTK_ENTRY (tn_first), txt);
1520
        gtk_combo_box_set_active(GTK_COMBO_BOX(tn_width), global_prefs->track_num_width - 1);
1610
        gtk_combo_box_set_active(GTK_COMBO_BOX(tn_width), global_prefs->track_num_width - 1);
1521
        gtk_widget_show(tn_hbox);
1611
        gtk_combo_box_set_active(GTK_COMBO_BOX(dn_width), global_prefs->disc_num_width - 1);
1612
        gtk_entry_set_text(GTK_ENTRY (dn_punct), global_prefs->disc_num_punct);
1613
        gtk_widget_show(tdn_hbox);
1522
    }
1614
    }
1523
    update_track_offsets();
1615
    update_track_offsets();
1524
}
1616
}
(-)src/main.c (+3 lines)
Lines 57-62 Link Here
57
GtkWidget * album_artist;
57
GtkWidget * album_artist;
58
GtkWidget * album_title;
58
GtkWidget * album_title;
59
GtkWidget * album_genre;					// lnr
59
GtkWidget * album_genre;					// lnr
60
GtkWidget * disc_number;
60
GtkWidget * album_year;
61
GtkWidget * album_year;
61
62
62
GtkWidget * tracklist;
63
GtkWidget * tracklist;
Lines 122-127 Link Here
122
    album_artist = lookup_widget(win_main, "album_artist");
123
    album_artist = lookup_widget(win_main, "album_artist");
123
    album_title = lookup_widget(win_main, "album_title");
124
    album_title = lookup_widget(win_main, "album_title");
124
    album_genre	= lookup_widget(win_main, "album_genre");				// lnr
125
    album_genre	= lookup_widget(win_main, "album_genre");				// lnr
126
    disc_number = lookup_widget(win_main, "disc_number");
125
    album_year = lookup_widget(win_main, "album_year");
127
    album_year = lookup_widget(win_main, "album_year");
126
    tracklist = lookup_widget(win_main, "tracklist");
128
    tracklist = lookup_widget(win_main, "tracklist");
127
    pick_disc = lookup_widget(win_main, "pick_disc");
129
    pick_disc = lookup_widget(win_main, "pick_disc");
Lines 348-353 Link Here
348
    gtk_entry_set_text(GTK_ENTRY(album_artist), "");
350
    gtk_entry_set_text(GTK_ENTRY(album_artist), "");
349
    gtk_entry_set_text(GTK_ENTRY(album_title), "");
351
    gtk_entry_set_text(GTK_ENTRY(album_title), "");
350
    gtk_entry_set_text(GTK_ENTRY(album_genre), "");				// lnr
352
    gtk_entry_set_text(GTK_ENTRY(album_genre), "");				// lnr
353
    gtk_entry_set_text(GTK_ENTRY(disc_number), "");
351
    gtk_entry_set_text(GTK_ENTRY(album_year), "");
354
    gtk_entry_set_text(GTK_ENTRY(album_year), "");
352
    
355
    
353
    // clear the tracklist
356
    // clear the tracklist
(-)src/prefs.c (+17 lines)
Lines 335-340 Link Here
335
    p->allow_first_track_num_change = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "allow_tracknum")));
335
    p->allow_first_track_num_change = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(win_prefs, "allow_tracknum")));
336
    p->first_track_num_offset = atoi(gtk_entry_get_text(GTK_ENTRY (lookup_widget(win_main, "tn_first")))) - 1;
336
    p->first_track_num_offset = atoi(gtk_entry_get_text(GTK_ENTRY (lookup_widget(win_main, "tn_first")))) - 1;
337
    p->track_num_width = gtk_combo_box_get_active(GTK_COMBO_BOX(lookup_widget(win_main, "tn_width"))) + 1;
337
    p->track_num_width = gtk_combo_box_get_active(GTK_COMBO_BOX(lookup_widget(win_main, "tn_width"))) + 1;
338
    p->disc_num_width = gtk_combo_box_get_active(GTK_COMBO_BOX(lookup_widget(win_main, "dn_width"))) + 1;
339
    strncpy(p->disc_num_punct, gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "dn_punct"))), 2);
340
    p->disc_num_punct[1] = '\0';
338
}
341
}
339
342
340
// get a config file path to load from, using XDG_CONFIG_HOME if available
343
// get a config file path to load from, using XDG_CONFIG_HOME if available
Lines 466-471 Link Here
466
        fprintf(config, "%d\n", p->track_num_width);
469
        fprintf(config, "%d\n", p->track_num_width);
467
        fprintf(config, "%d\n", p->rip_fdkaac);
470
        fprintf(config, "%d\n", p->rip_fdkaac);
468
        fprintf(config, "%d\n", p->fdkaac_bitrate);
471
        fprintf(config, "%d\n", p->fdkaac_bitrate);
472
        fprintf(config, "%d\n", p->disc_num_width);
473
        fprintf(config, "%s\n", p->disc_num_punct);
469
        
474
        
470
        fclose(config);
475
        fclose(config);
471
    } else {
476
    } else {
Lines 678-684 Link Here
678
        
683
        
679
        // this one can be 0
684
        // this one can be 0
680
        p->fdkaac_bitrate = read_line_num(fd);
685
        p->fdkaac_bitrate = read_line_num(fd);
686
687
        p->disc_num_width = read_line_num(fd);
688
        if (p->disc_num_width < 1 || p->disc_num_width > 4)
689
            p->disc_num_width = 1;
681
        
690
        
691
        aCharPtr = read_line(fd);
692
        if (aCharPtr != NULL)
693
        {
694
            p->disc_num_punct[0] = '-';
695
            p->disc_num_punct[1] = '\0';
696
            free(aCharPtr);
697
        }
698
        
682
        close(fd);
699
        close(fd);
683
    } else {
700
    } else {
684
        fprintf(stderr, "Warning: could not load config file: %s\n", strerror(errno));
701
        fprintf(stderr, "Warning: could not load config file: %s\n", strerror(errno));
(-)src/prefs.h (+2 lines)
Lines 46-51 Link Here
46
    int allow_first_track_num_change;
46
    int allow_first_track_num_change;
47
    int first_track_num_offset;
47
    int first_track_num_offset;
48
    int track_num_width;
48
    int track_num_width;
49
    int disc_num_width;
50
    char disc_num_punct[2];
49
    int rip_fdkaac;
51
    int rip_fdkaac;
50
    int fdkaac_bitrate;
52
    int fdkaac_bitrate;
51
    
53
    
(-)src/threads.c (-12 / +31 lines)
Lines 158-163 Link Here
158
    const char * albumtitle = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_title")));
158
    const char * albumtitle = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_title")));
159
    const char * albumyear = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_year")));
159
    const char * albumyear = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_year")));
160
    const char * albumgenre = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_genre")));
160
    const char * albumgenre = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_genre")));
161
    const char * discnumber = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "disc_number")));
161
    
162
    
162
    //Trimmed for use in filenames	//mrpl
163
    //Trimmed for use in filenames	//mrpl
163
    char * albumartist_trimmed = strdup(albumartist);
164
    char * albumartist_trimmed = strdup(albumartist);
Lines 169-176 Link Here
169
170
170
    //char * albumdir = parse_format(global_prefs->format_albumdir, 0, albumyear, albumartist, albumtitle, albumgenre, NULL);
171
    //char * albumdir = parse_format(global_prefs->format_albumdir, 0, albumyear, albumartist, albumtitle, albumgenre, NULL);
171
    //char * playlist = parse_format(global_prefs->format_playlist, 0, albumyear, albumartist, albumtitle, albumgenre, NULL);
172
    //char * playlist = parse_format(global_prefs->format_playlist, 0, albumyear, albumartist, albumtitle, albumgenre, NULL);
172
    char * albumdir = parse_format(global_prefs->format_albumdir, 0, albumyear, albumartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, NULL);
173
    char * albumdir = parse_format(global_prefs->format_albumdir, discnumber, 0, albumyear, albumartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, NULL);
173
    char * playlist = parse_format(global_prefs->format_playlist, 0, albumyear, albumartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, NULL);
174
    char * playlist = parse_format(global_prefs->format_playlist, discnumber, 0, albumyear, albumartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, NULL);
174
    
175
    
175
    overwriteAll = false;
176
    overwriteAll = false;
176
    overwriteNone = false;
177
    overwriteNone = false;
Lines 383-388 Link Here
383
        const char * albumtitle = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_title")));
384
        const char * albumtitle = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_title")));
384
        const char * albumyear = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_year")));
385
        const char * albumyear = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_year")));
385
        const char * albumgenre = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_genre")));
386
        const char * albumgenre = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_genre")));
387
        const char * discnumber = gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "disc_number")));
386
        
388
        
387
        gboolean rowsleft = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
389
        gboolean rowsleft = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
388
    gdk_threads_leave();
390
    gdk_threads_leave();
Lines 436-443 Link Here
436
            //~albumdir = parse_format(global_prefs->format_albumdir, 0, albumyear, albumartist, albumtitle, albumgenre, NULL);
438
            //~albumdir = parse_format(global_prefs->format_albumdir, 0, albumyear, albumartist, albumtitle, albumgenre, NULL);
437
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, trackyear, trackartist, albumtitle, tracktitle);
439
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, trackyear, trackartist, albumtitle, tracktitle);
438
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, albumyear, trackartist, albumtitle, albumgenre, tracktitle);            
440
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, albumyear, trackartist, albumtitle, albumgenre, tracktitle);            
439
            albumdir = parse_format(global_prefs->format_albumdir, 0, albumyear, albumartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, NULL);
441
            albumdir = parse_format(global_prefs->format_albumdir, discnumber, 0, albumyear, albumartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, NULL);
440
            musicfilename = parse_format(global_prefs->format_music, tracknum_vis, albumyear, trackartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, tracktitle_trimmed);
442
            musicfilename = parse_format(global_prefs->format_music, discnumber, tracknum_vis, albumyear, trackartist_trimmed, albumtitle_trimmed, albumgenre_trimmed, tracktitle_trimmed);
441
            wavfilename = make_filename(prefs_get_music_dir(global_prefs), albumdir, musicfilename, "wav");
443
            wavfilename = make_filename(prefs_get_music_dir(global_prefs), albumdir, musicfilename, "wav");
442
            
444
            
443
            snprintf(logStr, 1024, "Ripping track %d to \"%s\"\n", tracknum, wavfilename);
445
            snprintf(logStr, 1024, "Ripping track %d to \"%s\"\n", tracknum, wavfilename);
Lines 563-572 Link Here
563
    char* album_title = NULL;
565
    char* album_title = NULL;
564
    char* album_genre = NULL;		// lnr
566
    char* album_genre = NULL;		// lnr
565
    char* album_year = NULL;
567
    char* album_year = NULL;
568
    char* disc_number = NULL;
566
    
569
    
567
    char* album_artist_trimmed = NULL;
570
    char* album_artist_trimmed = NULL;
568
    char* album_title_trimmed = NULL;
571
    char* album_title_trimmed = NULL;
569
    char* album_genre_trimmed = NULL;
572
    char* album_genre_trimmed = NULL;
573
    int discnum;
570
    
574
    
571
    struct stat statStruct;
575
    struct stat statStruct;
572
    bool doEncode;
576
    bool doEncode;
Lines 581-586 Link Here
581
        save_completion(album_artist_widget);
585
        save_completion(album_artist_widget);
582
        
586
        
583
        album_year = strdup(gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_year"))));
587
        album_year = strdup(gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "album_year"))));
588
        disc_number = strdup(gtk_entry_get_text(GTK_ENTRY(lookup_widget(win_main, "disc_number"))));
584
        
589
        
585
        GtkWidget * album_title_widget = lookup_widget(win_main, "album_title");
590
        GtkWidget * album_title_widget = lookup_widget(win_main, "album_title");
586
        album_title = strdup(gtk_entry_get_text(GTK_ENTRY(album_title_widget)));
591
        album_title = strdup(gtk_entry_get_text(GTK_ENTRY(album_title_widget)));
Lines 602-607 Link Here
602
    trim_chars(album_title_trimmed, BADCHARS);
607
    trim_chars(album_title_trimmed, BADCHARS);
603
    album_genre_trimmed = strdup(album_genre);
608
    album_genre_trimmed = strdup(album_genre);
604
    trim_chars(album_genre_trimmed, BADCHARS);
609
    trim_chars(album_genre_trimmed, BADCHARS);
610
611
    discnum = (int) strtol(disc_number, 0, 10);
605
    
612
    
606
    while(rowsleft)
613
    while(rowsleft)
607
    {
614
    {
Lines 632-637 Link Here
632
            free(album_title);
639
            free(album_title);
633
            free(album_genre);
640
            free(album_genre);
634
            free(album_year);
641
            free(album_year);
642
            free(disc_number);
635
            free(album_artist_trimmed);
643
            free(album_artist_trimmed);
636
            free(album_title_trimmed);
644
            free(album_title_trimmed);
637
            free(album_genre_trimmed);
645
            free(album_genre_trimmed);
Lines 675-682 Link Here
675
            //~albumdir = parse_format(global_prefs->format_albumdir, 0, album_year, album_artist, album_title, genre, NULL);
683
            //~albumdir = parse_format(global_prefs->format_albumdir, 0, album_year, album_artist, album_title, genre, NULL);
676
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, trackyear, trackartist, album_title, tracktitle);
684
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, trackyear, trackartist, album_title, tracktitle);
677
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, album_year, trackartist, album_title, genre, tracktitle);
685
            //~musicfilename = parse_format(global_prefs->format_music, tracknum, album_year, trackartist, album_title, genre, tracktitle);
678
            albumdir = parse_format(global_prefs->format_albumdir, 0, album_year, album_artist_trimmed, album_title_trimmed, album_genre_trimmed, NULL);
686
            albumdir = parse_format(global_prefs->format_albumdir, disc_number, 0, album_year, album_artist_trimmed, album_title_trimmed, album_genre_trimmed, NULL);
679
            musicfilename = parse_format(global_prefs->format_music, tracknum_vis, album_year, trackartist_trimmed, album_title_trimmed, album_genre_trimmed, tracktitle_trimmed);
687
            musicfilename = parse_format(global_prefs->format_music, disc_number, tracknum_vis, album_year, trackartist_trimmed, album_title_trimmed, album_genre_trimmed, tracktitle_trimmed);
680
            
688
            
681
            wavfilename = make_filename(prefs_get_music_dir(global_prefs), albumdir, musicfilename, "wav");
689
            wavfilename = make_filename(prefs_get_music_dir(global_prefs), albumdir, musicfilename, "wav");
682
690
Lines 698-703 Link Here
698
                    free(album_title);
706
                    free(album_title);
699
                    free(album_genre);
707
                    free(album_genre);
700
                    free(album_year);
708
                    free(album_year);
709
                    free(disc_number);
701
                    free(album_artist_trimmed);
710
                    free(album_artist_trimmed);
702
                    free(album_title_trimmed);
711
                    free(album_title_trimmed);
703
                    free(album_genre_trimmed);
712
                    free(album_genre_trimmed);
Lines 726-732 Link Here
726
                if(doEncode)
735
                if(doEncode)
727
                    //~ lame(tracknum, trackartist, album_title, tracktitle, genre, trackyear, wavfilename, mp3filename, 
736
                    //~ lame(tracknum, trackartist, album_title, tracktitle, genre, trackyear, wavfilename, mp3filename, 
728
                         //~ global_prefs->mp3_vbr, global_prefs->mp3_bitrate, &mp3_percent);
737
                         //~ global_prefs->mp3_vbr, global_prefs->mp3_bitrate, &mp3_percent);
729
                    lame(tracknum_vis, trackartist, album_title, tracktitle, album_genre, album_year, wavfilename, mp3filename,
738
                    lame(tracknum_vis, discnum, trackartist, album_title, tracktitle,
739
                         album_genre, album_year, wavfilename, mp3filename,
730
                         global_prefs->mp3_vbr, global_prefs->mp3_bitrate, &mp3_percent);
740
                         global_prefs->mp3_vbr, global_prefs->mp3_bitrate, &mp3_percent);
731
741
732
                if (playlist_mp3)
742
                if (playlist_mp3)
Lines 755-760 Link Here
755
                    free(album_title);
765
                    free(album_title);
756
                    free(album_genre);
766
                    free(album_genre);
757
                    free(album_year);
767
                    free(album_year);
768
                    free(disc_number);
758
                    free(album_artist_trimmed);
769
                    free(album_artist_trimmed);
759
                    free(album_title_trimmed);
770
                    free(album_title_trimmed);
760
                    free(album_genre_trimmed);
771
                    free(album_genre_trimmed);
Lines 782-788 Link Here
782
                
793
                
783
                if(doEncode)
794
                if(doEncode)
784
                {
795
                {
785
                    oggenc(tracknum_vis, trackartist, album_title, tracktitle, album_year, album_genre, wavfilename,
796
                    oggenc(tracknum_vis, discnum, trackartist, album_title, tracktitle, album_year, album_genre, wavfilename,
786
                           oggfilename, global_prefs->ogg_quality, &ogg_percent);
797
                           oggfilename, global_prefs->ogg_quality, &ogg_percent);
787
                }
798
                }
788
799
Lines 812-817 Link Here
812
                    free(album_title);
823
                    free(album_title);
813
                    free(album_genre);
824
                    free(album_genre);
814
                    free(album_year);
825
                    free(album_year);
826
                    free(disc_number);
815
                    free(album_artist_trimmed);
827
                    free(album_artist_trimmed);
816
                    free(album_title_trimmed);
828
                    free(album_title_trimmed);
817
                    free(album_genre_trimmed);
829
                    free(album_genre_trimmed);
Lines 838-844 Link Here
838
                    doEncode = true;
850
                    doEncode = true;
839
851
840
                if(doEncode)
852
                if(doEncode)
841
                    opusenc(tracknum_vis, trackartist, album_title, tracktitle, album_year, album_genre, wavfilename,
853
                    opusenc(tracknum_vis, discnum, trackartist, album_title, tracktitle, album_year, album_genre, wavfilename,
842
                           opusfilename, global_prefs->opus_bitrate, &opus_percent);
854
                           opusfilename, global_prefs->opus_bitrate, &opus_percent);
843
855
844
                if (playlist_opus)
856
                if (playlist_opus)
Lines 867-872 Link Here
867
                    free(album_title);
879
                    free(album_title);
868
                    free(album_genre);
880
                    free(album_genre);
869
                    free(album_year);
881
                    free(album_year);
882
                    free(disc_number);
870
                    free(album_artist_trimmed);
883
                    free(album_artist_trimmed);
871
                    free(album_title_trimmed);
884
                    free(album_title_trimmed);
872
                    free(album_genre_trimmed);
885
                    free(album_genre_trimmed);
Lines 895-901 Link Here
895
                if(doEncode)
908
                if(doEncode)
896
                    //~ flac(tracknum, trackartist, album_title, tracktitle, genre, trackyear, wavfilename, 
909
                    //~ flac(tracknum, trackartist, album_title, tracktitle, genre, trackyear, wavfilename, 
897
                         //~ flacfilename, global_prefs->flac_compression, &flac_percent);
910
                         //~ flacfilename, global_prefs->flac_compression, &flac_percent);
898
                    flac(tracknum_vis, trackartist, album_artist, single_artist, album_title, tracktitle, album_genre, album_year, wavfilename,
911
                    flac(tracknum_vis, discnum, trackartist, album_artist, single_artist, album_title, tracktitle, album_genre, album_year, wavfilename,
899
                         flacfilename, global_prefs->flac_compression, &flac_percent); //mw
912
                         flacfilename, global_prefs->flac_compression, &flac_percent); //mw
900
913
901
                
914
                
Lines 925-930 Link Here
925
                    free(album_title);
938
                    free(album_title);
926
                    free(album_genre);
939
                    free(album_genre);
927
                    free(album_year);
940
                    free(album_year);
941
                    free(disc_number);
928
                    free(album_artist_trimmed);
942
                    free(album_artist_trimmed);
929
                    free(album_title_trimmed);
943
                    free(album_title_trimmed);
930
                    free(album_genre_trimmed);
944
                    free(album_genre_trimmed);
Lines 960-966 Link Here
960
                
974
                
961
                if(doEncode)
975
                if(doEncode)
962
                {
976
                {
963
                    wavpack(tracknum_vis, trackartist, album_title, tracktitle, album_year, album_genre,
977
                    wavpack(tracknum_vis, discnum, trackartist, album_title, tracktitle, album_year, album_genre,
964
                            wavfilename, wavpackfilename, wavpackfilename2,
978
                            wavfilename, wavpackfilename, wavpackfilename2,
965
                            global_prefs->wavpack_compression, global_prefs->wavpack_hybrid, 
979
                            global_prefs->wavpack_compression, global_prefs->wavpack_hybrid, 
966
                            int_to_wavpack_bitrate(global_prefs->wavpack_bitrate), &wavpack_percent);
980
                            int_to_wavpack_bitrate(global_prefs->wavpack_bitrate), &wavpack_percent);
Lines 993-998 Link Here
993
                    free(album_title);
1007
                    free(album_title);
994
                    free(album_genre);
1008
                    free(album_genre);
995
                    free(album_year);
1009
                    free(album_year);
1010
                    free(disc_number);
996
                    free(album_artist_trimmed);
1011
                    free(album_artist_trimmed);
997
                    free(album_title_trimmed);
1012
                    free(album_title_trimmed);
998
                    free(album_genre_trimmed);
1013
                    free(album_genre_trimmed);
Lines 1051-1056 Link Here
1051
                    free(album_title);
1066
                    free(album_title);
1052
                    free(album_genre);
1067
                    free(album_genre);
1053
                    free(album_year);
1068
                    free(album_year);
1069
                    free(disc_number);
1054
                    free(album_artist_trimmed);
1070
                    free(album_artist_trimmed);
1055
                    free(album_title_trimmed);
1071
                    free(album_title_trimmed);
1056
                    free(album_genre_trimmed);
1072
                    free(album_genre_trimmed);
Lines 1078-1084 Link Here
1078
                
1094
                
1079
                if(doEncode)
1095
                if(doEncode)
1080
                {
1096
                {
1081
                    musepack(tracknum_vis, trackartist, album_title, tracktitle, album_year, album_genre,
1097
                    musepack(tracknum_vis, discnum, trackartist, album_title, tracktitle, album_year, album_genre,
1082
                             wavfilename, musepackfilename,
1098
                             wavfilename, musepackfilename,
1083
                             int_to_musepack_int(global_prefs->musepack_bitrate), 
1099
                             int_to_musepack_int(global_prefs->musepack_bitrate), 
1084
                             &musepack_percent);
1100
                             &musepack_percent);
Lines 1110-1115 Link Here
1110
                    free(album_title);
1126
                    free(album_title);
1111
                    free(album_genre);
1127
                    free(album_genre);
1112
                    free(album_year);
1128
                    free(album_year);
1129
                    free(disc_number);
1113
                    free(album_artist_trimmed);
1130
                    free(album_artist_trimmed);
1114
                    free(album_title_trimmed);
1131
                    free(album_title_trimmed);
1115
                    free(album_genre_trimmed);
1132
                    free(album_genre_trimmed);
Lines 1197-1202 Link Here
1197
            free(album_title);
1214
            free(album_title);
1198
            free(album_genre);
1215
            free(album_genre);
1199
            free(album_year);
1216
            free(album_year);
1217
            free(disc_number);
1200
            free(album_artist_trimmed);
1218
            free(album_artist_trimmed);
1201
            free(album_title_trimmed);
1219
            free(album_title_trimmed);
1202
            free(album_genre_trimmed);
1220
            free(album_genre_trimmed);
Lines 1214-1219 Link Here
1214
    free(album_title);
1232
    free(album_title);
1215
    free(album_genre);
1233
    free(album_genre);
1216
    free(album_year);
1234
    free(album_year);
1235
    free(disc_number);
1217
    free(album_artist_trimmed);
1236
    free(album_artist_trimmed);
1218
    free(album_title_trimmed);
1237
    free(album_title_trimmed);
1219
    free(album_genre_trimmed);
1238
    free(album_genre_trimmed);
(-)src/util.c (-1 / +18 lines)
Lines 438-443 Link Here
438
// substitute various items into a formatted string (similar to printf)
438
// substitute various items into a formatted string (similar to printf)
439
//
439
//
440
// format - the format of the filename
440
// format - the format of the filename
441
// discnumber - gets substituted for %D in format
441
// tracknum - gets substituted for %N in format
442
// tracknum - gets substituted for %N in format
442
// year - gets substituted for %Y in format
443
// year - gets substituted for %Y in format
443
// artist - gets substituted for %A in format
444
// artist - gets substituted for %A in format
Lines 445-451 Link Here
445
// title - gets substituted for %T in format
446
// title - gets substituted for %T in format
446
//
447
//
447
// NOTE: caller must free the returned string!
448
// NOTE: caller must free the returned string!
448
char * parse_format(const char* format, int tracknum, const char* year, const char* artist, 
449
char * parse_format(const char* format, const char* discnumber, int tracknum, const char* year, const char* artist, 
449
                    const char* album, const char* genre, const char* title)
450
                    const char* album, const char* genre, const char* title)
450
{
451
{
451
    unsigned i = 0;
452
    unsigned i = 0;
Lines 453-458 Link Here
453
    char * ret = NULL;
454
    char * ret = NULL;
454
    int pos = 0;
455
    int pos = 0;
455
    int tnsize = 0;
456
    int tnsize = 0;
457
    unsigned long discnum = strtoul(discnumber, (char **) 0, 10);
456
    
458
    
457
    for (i=0; i<strlen(format); i++)
459
    for (i=0; i<strlen(format); i++)
458
    {
460
    {
Lines 466-471 Link Here
466
                case 'L':
468
                case 'L':
467
                    if (album) len += strlen(album);
469
                    if (album) len += strlen(album);
468
                    break;
470
                    break;
471
                case 'D':
472
                    if (discnum > 0)
473
                    {
474
                        tnsize = snprintf(NULL, 0, "%0*lu%s",
475
                            global_prefs->disc_num_width, discnum, global_prefs->disc_num_punct);
476
                        len += tnsize;
477
                    }
478
                    break;
469
                case 'N':
479
                case 'N':
470
                    if (tracknum > 0)
480
                    if (tracknum > 0)
471
                    {
481
                    {
Lines 517-522 Link Here
517
                        pos += strlen(album);
527
                        pos += strlen(album);
518
                    }
528
                    }
519
                    break;
529
                    break;
530
                case 'D':
531
                    if (discnum > 0)
532
                    {
533
                        pos += snprintf(&ret[pos], tnsize + 1, "%0*lu%s",
534
                            global_prefs->disc_num_width, discnum, global_prefs->disc_num_punct);
535
                    }
536
                    break;
520
                case 'N':
537
                case 'N':
521
                    if (tracknum > 0)
538
                    if (tracknum > 0)
522
                    {
539
                    {
(-)src/util.h (-1 / +2 lines)
Lines 14-19 Link Here
14
// substitute various items into a formatted string (similar to printf)
14
// substitute various items into a formatted string (similar to printf)
15
//
15
//
16
// format - the format of the filename
16
// format - the format of the filename
17
// discnumber - gets substituted for %D in format
17
// tracknum - gets substituted for %N in format
18
// tracknum - gets substituted for %N in format
18
// year - gets substituted for %Y in format
19
// year - gets substituted for %Y in format
19
// artist - gets substituted for %A in format
20
// artist - gets substituted for %A in format
Lines 21-27 Link Here
21
// title - gets substituted for %T in format
22
// title - gets substituted for %T in format
22
//
23
//
23
// NOTE: caller must free the returned string!
24
// NOTE: caller must free the returned string!
24
char * parse_format(const char* format, int tracknum, const char* year, const char* artist, 
25
char * parse_format(const char* format, const char* discnumber, int tracknum, const char* year, const char* artist, 
25
                    const char* album, const char* genre, const char* title);
26
                    const char* album, const char* genre, const char* title);
26
27
27
// construct a filename from various parts
28
// construct a filename from various parts
(-)src/wrappers.c (-7 / +61 lines)
Lines 398-403 Link Here
398
// uses LAME to encode a WAV file into a MP3 and tag it
398
// uses LAME to encode a WAV file into a MP3 and tag it
399
//
399
//
400
// tracknum - the track number
400
// tracknum - the track number
401
// discnum - the disc number
401
// artist - the artist's name
402
// artist - the artist's name
402
// album - the album the song came from
403
// album - the album the song came from
403
// title - the name of the song
404
// title - the name of the song
Lines 407-412 Link Here
407
// bitrate - the bitrate to encode at (or maximum bitrate if using VBR)
408
// bitrate - the bitrate to encode at (or maximum bitrate if using VBR)
408
// progress - the percent done
409
// progress - the percent done
409
void lame(int tracknum,
410
void lame(int tracknum,
411
          int discnum,
410
          const char * artist,
412
          const char * artist,
411
          const char * album,
413
          const char * album,
412
          const char * title,
414
          const char * title,
Lines 428-435 Link Here
428
    int end;
430
    int end;
429
    
431
    
430
    char * tracknum_text = NULL;
432
    char * tracknum_text = NULL;
433
    char * discnum_text = NULL;
431
    char bitrate_text[4];
434
    char bitrate_text[4];
432
    const char * args[19];
435
    const char * args[21];
433
436
434
//    fprintf( stderr, " lame()   Genre: %s Artist: %s Title: %s\n", genre, artist, title );	// lnr
437
//    fprintf( stderr, " lame()   Genre: %s Artist: %s Title: %s\n", genre, artist, title );	// lnr
435
438
Lines 450-455 Link Here
450
        args[pos++] = "--tn";
453
        args[pos++] = "--tn";
451
        args[pos++] = tracknum_text;
454
        args[pos++] = tracknum_text;
452
    }
455
    }
456
    if (discnum > 0 && asprintf(&discnum_text, "TPOS=%d", discnum) > 0)
457
    {
458
        args[pos++] = "--tv";
459
        args[pos++] = discnum_text;
460
    }
453
    if ((artist != NULL) && (strlen(artist) > 0))
461
    if ((artist != NULL) && (strlen(artist) > 0))
454
    {
462
    {
455
        args[pos++] = "--ta";
463
        args[pos++] = "--ta";
Lines 530-535 Link Here
530
// uses oggenc to encode a WAV file into a OGG and tag it
538
// uses oggenc to encode a WAV file into a OGG and tag it
531
//
539
//
532
// tracknum - the track number
540
// tracknum - the track number
541
// discnum - the disc number
533
// artist - the artist's name
542
// artist - the artist's name
534
// album - the album the song came from
543
// album - the album the song came from
535
// title - the name of the song
544
// title - the name of the song
Lines 538-543 Link Here
538
// quality_level - how hard to compress the file (0-10)
547
// quality_level - how hard to compress the file (0-10)
539
// progress - the percent done
548
// progress - the percent done
540
void oggenc(int tracknum,
549
void oggenc(int tracknum,
550
            int discnum,
541
            const char * artist,
551
            const char * artist,
542
            const char * album,
552
            const char * album,
543
            const char * title,
553
            const char * title,
Lines 558-565 Link Here
558
    int end;
568
    int end;
559
569
560
    char * tracknum_text = NULL;
570
    char * tracknum_text = NULL;
571
    char * discnum_text = NULL;
561
    char quality_level_text[3];
572
    char quality_level_text[3];
562
    const char * args[19];
573
    const char * args[21];
563
574
564
    snprintf(quality_level_text, 3, "%d", quality_level);
575
    snprintf(quality_level_text, 3, "%d", quality_level);
565
    
576
    
Lines 573-578 Link Here
573
        args[pos++] = "-N";
584
        args[pos++] = "-N";
574
        args[pos++] = tracknum_text;
585
        args[pos++] = tracknum_text;
575
    }
586
    }
587
    if (discnum > 0 && asprintf(&discnum_text, "DISCNUMBER=%d", discnum) > 0)
588
    {
589
        args[pos++] = "-c";
590
        args[pos++] = discnum_text;
591
    }
576
    if ((artist != NULL) && (strlen(artist) > 0))
592
    if ((artist != NULL) && (strlen(artist) > 0))
577
    {
593
    {
578
        args[pos++] = "-a";
594
        args[pos++] = "-a";
Lines 605-610 Link Here
605
    
621
    
606
    fd = exec_with_output(args, STDERR_FILENO, &oggenc_pid, NULL);
622
    fd = exec_with_output(args, STDERR_FILENO, &oggenc_pid, NULL);
607
    free(tracknum_text);
623
    free(tracknum_text);
624
    free(discnum_text);
608
    
625
    
609
    do
626
    do
610
    {
627
    {
Lines 651-656 Link Here
651
// uses opusenc to encode a WAV file into a OGG and tag it
668
// uses opusenc to encode a WAV file into a OGG and tag it
652
//
669
//
653
// tracknum - the track number
670
// tracknum - the track number
671
// discnum - the disc number
654
// artist - the artist's name
672
// artist - the artist's name
655
// album - the album the song came from
673
// album - the album the song came from
656
// title - the name of the song
674
// title - the name of the song
Lines 659-664 Link Here
659
// bitrate - the bitrate to encode at
677
// bitrate - the bitrate to encode at
660
// progress - the percent done
678
// progress - the percent done
661
void opusenc(int tracknum,
679
void opusenc(int tracknum,
680
            int discnum,
662
            const char * artist,
681
            const char * artist,
663
            const char * album,
682
            const char * album,
664
            const char * title,
683
            const char * title,
Lines 674-683 Link Here
674
    int pos;
693
    int pos;
675
    char bitrate_text[4];
694
    char bitrate_text[4];
676
    char * tracknum_text = NULL;
695
    char * tracknum_text = NULL;
696
    char * discnum_text = NULL;
677
    char album_text[128];
697
    char album_text[128];
678
    char year_text[32];
698
    char year_text[32];
679
    char genre_text[64];
699
    char genre_text[64];
680
    const char * args[19];
700
    const char * args[21];
681
701
682
    snprintf(bitrate_text, 4, "%d", int_to_bitrate(bitrate,FALSE));
702
    snprintf(bitrate_text, 4, "%d", int_to_bitrate(bitrate,FALSE));
683
703
Lines 691-696 Link Here
691
        args[pos++] = "--comment";
711
        args[pos++] = "--comment";
692
        args[pos++] = tracknum_text;
712
        args[pos++] = tracknum_text;
693
    }
713
    }
714
    if (discnum > 0 && asprintf(&discnum_text, "DISCNUMBER=%d", discnum) > 0)
715
    {
716
        args[pos++] = "--comment";
717
        args[pos++] = discnum_text;
718
    }
694
    if ((artist != NULL) && (strlen(artist) > 0))
719
    if ((artist != NULL) && (strlen(artist) > 0))
695
    {
720
    {
696
        args[pos++] = "--artist";
721
        args[pos++] = "--artist";
Lines 725-730 Link Here
725
750
726
    fd = exec_with_output(args, STDERR_FILENO, &oggenc_pid, NULL);
751
    fd = exec_with_output(args, STDERR_FILENO, &oggenc_pid, NULL);
727
    free(tracknum_text);
752
    free(tracknum_text);
753
    free(discnum_text);
728
754
729
    int opussize;
755
    int opussize;
730
    char opusbuf[256];
756
    char opusbuf[256];
Lines 754-759 Link Here
754
// uses the FLAC reference encoder to encode a WAV file into a FLAC and tag it
780
// uses the FLAC reference encoder to encode a WAV file into a FLAC and tag it
755
//
781
//
756
// tracknum - the track number
782
// tracknum - the track number
783
// discnum - the disc number (if from a multi-disc set)
757
// artist - the artist's name
784
// artist - the artist's name
758
// albumartist - we want to tag this if it is a compilation
785
// albumartist - we want to tag this if it is a compilation
759
// album - the album the song came from
786
// album - the album the song came from
Lines 763-768 Link Here
763
// compression_level - how hard to compress the file (0-8) see flac man page
790
// compression_level - how hard to compress the file (0-8) see flac man page
764
// progress - the percent done
791
// progress - the percent done
765
void flac(int tracknum,
792
void flac(int tracknum,
793
          int discnum,
766
          const char * artist,
794
          const char * artist,
767
          const char * albumartist, //mw
795
          const char * albumartist, //mw
768
          gboolean single_artist, //mw
796
          gboolean single_artist, //mw
Lines 784-789 Link Here
784
    int sector;
812
    int sector;
785
    
813
    
786
    char * tracknum_text = NULL;
814
    char * tracknum_text = NULL;
815
    char * discnum_text = NULL;
787
    char * artist_text = NULL;
816
    char * artist_text = NULL;
788
    char * albumartist_text = NULL; //mw
817
    char * albumartist_text = NULL; //mw
789
    char * album_text = NULL;
818
    char * album_text = NULL;
Lines 791-797 Link Here
791
    char * genre_text = NULL;
820
    char * genre_text = NULL;
792
    char * year_text = NULL;
821
    char * year_text = NULL;
793
    char compression_level_text[3];
822
    char compression_level_text[3];
794
    const char * args[21];
823
    const char * args[23];
795
    
824
    
796
    if(artist != NULL)
825
    if(artist != NULL)
797
    {
826
    {
Lines 854-859 Link Here
854
        args[pos++] = "-T";
883
        args[pos++] = "-T";
855
        args[pos++] = tracknum_text;
884
        args[pos++] = tracknum_text;
856
    }
885
    }
886
    if (discnum > 0 && asprintf(&discnum_text, "DISCNUMBER=%d", discnum) > 0)
887
    {
888
        args[pos++] = "-T";
889
        args[pos++] = discnum_text;
890
    }
857
    if ((artist != NULL) && (strlen(artist) > 0))
891
    if ((artist != NULL) && (strlen(artist) > 0))
858
    {
892
    {
859
        args[pos++] = "-T";
893
        args[pos++] = "-T";
Lines 896-901 Link Here
896
    fd = exec_with_output(args, STDERR_FILENO, &flac_pid, NULL);
930
    fd = exec_with_output(args, STDERR_FILENO, &flac_pid, NULL);
897
    
931
    
898
    free(tracknum_text);
932
    free(tracknum_text);
933
    free(discnum_text);
899
    free(artist_text);
934
    free(artist_text);
900
    free(album_text);
935
    free(album_text);
901
    free(albumartist_text);
936
    free(albumartist_text);
Lines 945-950 Link Here
945
// uses wavpack to encode a WAV file into a .wv/.wvc and tag it
980
// uses wavpack to encode a WAV file into a .wv/.wvc and tag it
946
//
981
//
947
// tracknum - the track number
982
// tracknum - the track number
983
// discnum - the disc number
948
// artist - the artist's name
984
// artist - the artist's name
949
// album - the album the song came from
985
// album - the album the song came from
950
// title - the name of the song
986
// title - the name of the song
Lines 955-960 Link Here
955
// bitrate - the bitrate to encode at
991
// bitrate - the bitrate to encode at
956
// progress - the percent done
992
// progress - the percent done
957
void wavpack(int tracknum,
993
void wavpack(int tracknum,
994
             int discnum,
958
             const char * artist,
995
             const char * artist,
959
             const char * album,
996
             const char * album,
960
             const char * title,
997
             const char * title,
Lines 969-975 Link Here
969
             double* progress)
1006
             double* progress)
970
{
1007
{
971
    char logStr[1024];
1008
    char logStr[1024];
972
    const char* args[22];
1009
    const char* args[24];
973
    int fd;
1010
    int fd;
974
    int pos;
1011
    int pos;
975
    int size;
1012
    int size;
Lines 1018-1023 Link Here
1018
    // Tags
1055
    // Tags
1019
1056
1020
    int tracknum_len = snprintf(NULL, 0, "TRACK=%d", tracknum) + 1;   // sizeof includes terminating '\0', snprintf does not.
1057
    int tracknum_len = snprintf(NULL, 0, "TRACK=%d", tracknum) + 1;   // sizeof includes terminating '\0', snprintf does not.
1058
    int discnum_len = snprintf(NULL, 0, "DISCNUMBER=%d", discnum) + 1;   // sizeof includes terminating '\0', snprintf does not.
1021
    int artist_len   = sizeof("ARTIST=") + (artist ? strlen(artist) : 0);
1059
    int artist_len   = sizeof("ARTIST=") + (artist ? strlen(artist) : 0);
1022
    int album_len    = sizeof("ALBUM=")  + (album  ? strlen(album)  : 0);
1060
    int album_len    = sizeof("ALBUM=")  + (album  ? strlen(album)  : 0);
1023
    int title_len    = sizeof("TITLE=")  + (title  ? strlen(title)  : 0);
1061
    int title_len    = sizeof("TITLE=")  + (title  ? strlen(title)  : 0);
Lines 1025-1036 Link Here
1025
    int genre_len    = sizeof("GENRE=")  + (genre  ? strlen(genre)  : 0);
1063
    int genre_len    = sizeof("GENRE=")  + (genre  ? strlen(genre)  : 0);
1026
1064
1027
    char *tracknum_buf = malloc(tracknum_len);
1065
    char *tracknum_buf = malloc(tracknum_len);
1066
    char *discnum_buf = malloc(discnum_len);
1028
    char *artist_buf   = malloc(artist_len);
1067
    char *artist_buf   = malloc(artist_len);
1029
    char *album_buf    = malloc(album_len);
1068
    char *album_buf    = malloc(album_len);
1030
    char *title_buf    = malloc(title_len);
1069
    char *title_buf    = malloc(title_len);
1031
    char *year_buf     = malloc(year_len);
1070
    char *year_buf     = malloc(year_len);
1032
    char *genre_buf    = malloc(genre_len);
1071
    char *genre_buf    = malloc(genre_len);
1033
    if (!tracknum_buf || !artist_buf || !album_buf || !title_buf || !year_buf || !genre_buf)
1072
    if (!tracknum_buf || !discnum_buf || !artist_buf || !album_buf || !title_buf || !year_buf || !genre_buf)
1034
        fatalError("wavpack: malloc failed. Out of memory.");
1073
        fatalError("wavpack: malloc failed. Out of memory.");
1035
1074
1036
    if (tracknum > 0)
1075
    if (tracknum > 0)
Lines 1039-1044 Link Here
1039
        args[pos++] = "-w";
1078
        args[pos++] = "-w";
1040
        args[pos++] = tracknum_buf;
1079
        args[pos++] = tracknum_buf;
1041
    }
1080
    }
1081
    if (discnum > 0)
1082
    {
1083
        snprintf(discnum_buf, discnum_len, "DISCNUMBER=%d", discnum);
1084
        args[pos++] = "-w";
1085
        args[pos++] = discnum_buf;
1086
    }
1042
    if (artist && *artist)
1087
    if (artist && *artist)
1043
    {
1088
    {
1044
        snprintf(artist_buf, artist_len, "ARTIST=%s", artist);
1089
        snprintf(artist_buf, artist_len, "ARTIST=%s", artist);
Lines 1150-1155 Link Here
1150
    g_free(xwavpackfilename_wvc);
1195
    g_free(xwavpackfilename_wvc);
1151
    g_free(dir);
1196
    g_free(dir);
1152
    free(tracknum_buf);
1197
    free(tracknum_buf);
1198
    free(discnum_buf);
1153
    free(artist_buf);
1199
    free(artist_buf);
1154
    free(album_buf);
1200
    free(album_buf);
1155
    free(title_buf);
1201
    free(title_buf);
Lines 1230-1235 Link Here
1230
// quality - encode value
1276
// quality - encode value
1231
// progress - the percent done
1277
// progress - the percent done
1232
void musepack(int tracknum,
1278
void musepack(int tracknum,
1279
              int discnum,
1233
              const char * artist,
1280
              const char * artist,
1234
              const char * album,
1281
              const char * album,
1235
              const char * title,
1282
              const char * title,
Lines 1240-1246 Link Here
1240
              int quality,
1287
              int quality,
1241
              double* progress)
1288
              double* progress)
1242
{
1289
{
1243
    const char* args[19];
1290
    const char* args[21];
1244
    int fd;
1291
    int fd;
1245
    int pos;
1292
    int pos;
1246
    
1293
    
Lines 1260-1265 Link Here
1260
        args[pos++] = "--track";
1307
        args[pos++] = "--track";
1261
        args[pos++] = track;
1308
        args[pos++] = track;
1262
    }
1309
    }
1310
    char * disc = NULL;
1311
    if (discnum > 0 && asprintf(&disc, "DISCNUMBER=%d", discnum) > 0)
1312
    {
1313
        args[pos++] = "--tag";
1314
        args[pos++] = disc;
1315
    }
1263
    if (artist && *artist)
1316
    if (artist && *artist)
1264
    {
1317
    {
1265
        args[pos++] = "--artist";
1318
        args[pos++] = "--artist";
Lines 1291-1296 Link Here
1291
    args[pos++] = NULL;
1344
    args[pos++] = NULL;
1292
    
1345
    
1293
    fd = exec_with_output(args, STDERR_FILENO, &musepack_pid, NULL);
1346
    fd = exec_with_output(args, STDERR_FILENO, &musepack_pid, NULL);
1347
    free(disc);
1294
    free(track);
1348
    free(track);
1295
    
1349
    
1296
    int size;
1350
    int size;
(-)src/wrappers.h (+12 lines)
Lines 58-63 Link Here
58
// uses LAME to encode a WAV file into a MP# and tag it
58
// uses LAME to encode a WAV file into a MP# and tag it
59
//
59
//
60
// tracknum - the track number
60
// tracknum - the track number
61
// discnum - the disc number out of a set
61
// artist - the artist's name
62
// artist - the artist's name
62
// album - the album the song came from
63
// album - the album the song came from
63
// title - the name of the song
64
// title - the name of the song
Lines 67-72 Link Here
67
// bitrate - the bitrate to encode at (or maximum bitrate if using VBR)
68
// bitrate - the bitrate to encode at (or maximum bitrate if using VBR)
68
// progress - the percent done
69
// progress - the percent done
69
void lame(int tracknum,
70
void lame(int tracknum,
71
          int discnum,
70
          const char * artist,
72
          const char * artist,
71
          const char * album,
73
          const char * album,
72
          const char * title,
74
          const char * title,
Lines 81-86 Link Here
81
// uses oggenc to encode a WAV file into a OGG and tag it
83
// uses oggenc to encode a WAV file into a OGG and tag it
82
//
84
//
83
// tracknum - the track number
85
// tracknum - the track number
86
// discnum - the disc number out of a set
84
// artist - the artist's name
87
// artist - the artist's name
85
// album - the album the song came from
88
// album - the album the song came from
86
// title - the name of the song
89
// title - the name of the song
Lines 89-94 Link Here
89
// quality_level - how hard to compress the file (0-10)
92
// quality_level - how hard to compress the file (0-10)
90
// progress - the percent done
93
// progress - the percent done
91
void oggenc(int tracknum,
94
void oggenc(int tracknum,
95
            int discnum,
92
            const char * artist,
96
            const char * artist,
93
            const char * album,
97
            const char * album,
94
            const char * title,
98
            const char * title,
Lines 102-107 Link Here
102
// uses opusenc to encode a WAV file into a OGG and tag it
106
// uses opusenc to encode a WAV file into a OGG and tag it
103
//
107
//
104
// tracknum - the track number
108
// tracknum - the track number
109
// discnum - the disc number out of a set
105
// artist - the artist's name
110
// artist - the artist's name
106
// album - the album the song came from
111
// album - the album the song came from
107
// title - the name of the song
112
// title - the name of the song
Lines 110-115 Link Here
110
// bitrate - the bitrate to encode at
115
// bitrate - the bitrate to encode at
111
// progress - the percent done
116
// progress - the percent done
112
void opusenc(int tracknum,
117
void opusenc(int tracknum,
118
            int discnum,
113
            const char * artist,
119
            const char * artist,
114
            const char * album,
120
            const char * album,
115
            const char * title,
121
            const char * title,
Lines 123-128 Link Here
123
// uses the FLAC reference encoder to encode a WAV file into a FLAC and tag it
129
// uses the FLAC reference encoder to encode a WAV file into a FLAC and tag it
124
//
130
//
125
// tracknum - the track number
131
// tracknum - the track number
132
// discnum - the disc number out of a set
126
// artist - the artist's name
133
// artist - the artist's name
127
// albumartist - we want to tag this if it is a compilation
134
// albumartist - we want to tag this if it is a compilation
128
// album - the album the song came from
135
// album - the album the song came from
Lines 132-137 Link Here
132
// compression_level - how hard to compress the file (0-8) see flac man page
139
// compression_level - how hard to compress the file (0-8) see flac man page
133
// progress - the percent done
140
// progress - the percent done
134
void flac(int tracknum,
141
void flac(int tracknum,
142
          int discnum,
135
          const char * artist,
143
          const char * artist,
136
          const char * albumartist, //mw
144
          const char * albumartist, //mw
137
          gboolean single_artist, //mw
145
          gboolean single_artist, //mw
Lines 147-152 Link Here
147
// uses wavpack to encode a WAV file into a .wv/.wvc and tag it
155
// uses wavpack to encode a WAV file into a .wv/.wvc and tag it
148
//
156
//
149
// tracknum - the track number
157
// tracknum - the track number
158
// discnum - the disc number out of a set
150
// artist - the artist's name
159
// artist - the artist's name
151
// album - the album the song came from
160
// album - the album the song came from
152
// title - the name of the song
161
// title - the name of the song
Lines 157-162 Link Here
157
// bitrate - the bitrate to encode at
166
// bitrate - the bitrate to encode at
158
// progress - the percent done
167
// progress - the percent done
159
void wavpack(int tracknum,
168
void wavpack(int tracknum,
169
             int discnum,
160
             const char * artist,
170
             const char * artist,
161
             const char * album,
171
             const char * album,
162
             const char * title,
172
             const char * title,
Lines 178-183 Link Here
178
// uses mpcenc to encode a WAV file into a .mpc and tag it
188
// uses mpcenc to encode a WAV file into a .mpc and tag it
179
//
189
//
180
// tracknum - the track number
190
// tracknum - the track number
191
// discnum - the disc number out of a set
181
// artist - the artist's name
192
// artist - the artist's name
182
// album - the album the song came from
193
// album - the album the song came from
183
// title - the name of the song
194
// title - the name of the song
Lines 186-191 Link Here
186
// quality - encode value
197
// quality - encode value
187
// progress - the percent done
198
// progress - the percent done
188
void musepack(int tracknum,
199
void musepack(int tracknum,
200
              int discnum,
189
              const char * artist,
201
              const char * artist,
190
              const char * album,
202
              const char * album,
191
              const char * title,
203
              const char * title,

Return to bug 25