Mercurial > audlegacy-plugins
changeset 730:74a46ac77c97 trunk
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
- when "Unknown" is specified in fileinfo dialog, the dialog removes TCON frame.
author | yaz |
---|---|
date | Sun, 25 Feb 2007 23:22:16 -0800 |
parents | 1959cac04fb8 |
children | 645849c1e725 |
files | ChangeLog src/madplug/fileinfo.c |
diffstat | 2 files changed, 39 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Feb 25 17:41:03 2007 -0800 +++ b/ChangeLog Sun Feb 25 23:22:16 2007 -0800 @@ -1,3 +1,11 @@ +2007-02-26 01:41:03 +0000 William Pitcock <nenolod@sacredspiral.co.uk> + revision [1556] + - properly report if madplug will not be built. + + trunk/configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2007-02-25 14:01:46 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [1554] - no vorbis? disallow flac too.
--- a/src/madplug/fileinfo.c Sun Feb 25 17:41:03 2007 -0800 +++ b/src/madplug/fileinfo.c Sun Feb 25 23:22:16 2007 -0800 @@ -105,8 +105,18 @@ char *tmp; int index = id3_genre_number(ucs4); g_free(ucs4); - tmp = g_strdup_printf("%d", index); - ucs4 = id3_latin1_ucs4duplicate((unsigned char *) tmp); + + if(index == -1) { // unknown genre. remove TCON frame. +#ifdef DEBUG + printf("remove genre frame\n"); +#endif + id3_tag_detachframe(tag, frame); + } + else { // meaningful genre + tmp = g_strdup_printf("%d", index); + ucs4 = id3_latin1_ucs4duplicate((unsigned char *) tmp); + } + } // write string @@ -207,12 +217,15 @@ text = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(genre_combo)->entry), 0, -1); - text2 = g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); - update_id3_frame(id3tag, ID3_FRAME_GENRE, text2); +#ifdef DEBUG + g_print("genre entry = %s\n", text); +#endif + update_id3_frame(id3tag, ID3_FRAME_GENRE, text); free(text); - free(text2); +#ifdef DEBUG printf("about to write id3tag\n"); +#endif if (id3_file_update(id3file) != 0) { xmms_show_message("File Info", "Couldn't write tag!", "Ok", FALSE, NULL, NULL); @@ -459,6 +472,10 @@ if (!genre_list) { int i = 0; const id3_ucs4_t *ucs4 = id3_genre_index(i); + + //add "Unknown" to the first. we must shift index. + genre_list = g_list_append(genre_list, "Unknown"); + while (ucs4) { genre_list = g_list_append(genre_list, id3_ucs4_utf8duplicate(ucs4)); @@ -679,10 +696,18 @@ field = id3_frame_field(frame, 1); string = id3_field_getstrings(field, 0); genre = mad_parse_genre(string); +#ifdef DEBUG + { + gchar *utf = (gchar *)id3_ucs4_utf8duplicate(genre); + g_print("genre = %s\n", utf); + g_print("genre num = %d\n", id3_genre_number(genre)); + g_free(utf); + } +#endif if (genre) { gtk_list_select_item(GTK_LIST (GTK_COMBO(genre_combo)->list), - id3_genre_number(genre)); + id3_genre_number(genre)+1); //shift one for "Unknown". g_free((void *)genre); } }