Mercurial > audlegacy-plugins
annotate src/madplug/tuples.c @ 2201:df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Sat, 01 Dec 2007 05:15:43 +0300 |
parents | src/madplug/fileinfo.c@2ffc6a69fcd1 |
children |
rev | line source |
---|---|
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
1 /* |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
2 * mad plugin for audacious |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
3 * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa, Eugene Zagidullin |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
4 * |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
5 * Portions derived from xmms-mad: |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
6 * Copyright (C) 2001-2002 Sam Clegg - See COPYING |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
7 * |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
10 * the Free Software Foundation; under version 2 of the License. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
11 * |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
15 * GNU General Public License for more details. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
16 * |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
18 * along with this program; if not, write to the Free Software |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
20 */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
21 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
22 #include "config.h" |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
23 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
24 #include "plugin.h" |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
25 #include "tuples.h" |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
26 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
27 #include <math.h> |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
28 #include <string.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
29 |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
30 #include <glib.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
31 #include <glib/gprintf.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
32 |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
33 #include <audacious/util.h> |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
34 #include <audacious/plugin.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
35 #include <audacious/id3tag.h> |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
36 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
37 /* yaz */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
38 #include <langinfo.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
39 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
40 #define DEBUG |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
41 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
42 static void |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
43 update_id3_frame(struct id3_tag *tag, const char *frame_name, const char *data, int sjis) |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
44 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
45 int res; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
46 struct id3_frame *frame; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
47 union id3_field *field; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
48 id3_ucs4_t *ucs4; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
49 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
50 if (data == NULL) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
51 return; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
52 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
53 // printf ("updating id3: %s: %s\n", frame_name, data); |
611 | 54 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
55 // |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
56 // An empty string removes the frame altogether. |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
57 // |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
58 if (strlen(data) == 0) { |
629 | 59 while ((frame = id3_tag_findframe(tag, frame_name, 0))) { |
60 #ifdef DEBUG | |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
61 fprintf(stderr, "madplug: detachframe\n"); |
629 | 62 #endif |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
63 id3_tag_detachframe(tag, frame); |
629 | 64 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
65 return; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
66 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
67 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
68 frame = id3_tag_findframe(tag, frame_name, 0); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
69 if (!frame) { |
629 | 70 #ifdef DEBUG |
71 printf("frame_new\n"); | |
72 #endif | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
73 frame = id3_frame_new(frame_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
74 id3_tag_attachframe(tag, frame); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
75 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
76 |
611 | 77 // setup ucs4 string |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
78 if(sjis) { |
611 | 79 ucs4 = id3_latin1_ucs4duplicate((id3_latin1_t *) data); |
80 } | |
81 else { | |
82 ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) data); | |
83 } | |
84 | |
85 // set encoding | |
86 field = id3_frame_field(frame, 0); | |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
87 id3_field_settextencoding(field, sjis ? ID3_FIELD_TEXTENCODING_ISO_8859_1 : |
611 | 88 ID3_FIELD_TEXTENCODING_UTF_8); |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
89 |
611 | 90 // setup genre code |
91 if (!strcmp(frame_name, ID3_FRAME_GENRE)) { | |
92 char *tmp; | |
93 int index = id3_genre_number(ucs4); | |
94 g_free(ucs4); | |
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
95 |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
96 if(index == -1) { // unknown genre. remove TCON frame. |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
97 #ifdef DEBUG |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
98 fprintf(stderr, "madplug: remove genre frame\n"); |
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
99 #endif |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
100 id3_tag_detachframe(tag, frame); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
101 } |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
102 else { // meaningful genre |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
103 tmp = g_strdup_printf("%d", index); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
104 ucs4 = id3_latin1_ucs4duplicate((unsigned char *) tmp); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
105 } |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
106 |
611 | 107 } |
108 | |
109 // write string | |
110 if (!strcmp(frame_name, ID3_FRAME_COMMENT)) { | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
111 field = id3_frame_field(frame, 3); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
112 field->type = ID3_FIELD_TYPE_STRINGFULL; |
611 | 113 res = id3_field_setfullstring(field, ucs4); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
114 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
115 else { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
116 field = id3_frame_field(frame, 1); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
117 field->type = ID3_FIELD_TYPE_STRINGLIST; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
118 res = id3_field_setstrings(field, 1, &ucs4); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
119 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
120 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
121 if (res != 0) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
122 g_print("error setting id3 field: %s\n", frame_name); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
123 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
124 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
125 static void |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
126 update_id3_frame_from_tuple(struct id3_tag *id3tag, const char *field, Tuple *tuple, int fieldn, int sjis) |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
127 { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
128 int val; |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
129 char *text, *text2; |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
130 const char *encoding = sjis ? "SJIS" : "UTF-8"; |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
131 |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
132 if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_INT) { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
133 val = aud_tuple_get_int(tuple, fieldn, NULL); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
134 if(val > 0) { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
135 text2 = g_strdup_printf("%d", val); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
136 #ifdef DEBUG |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
137 fprintf(stderr, "madplug: updating field:\"%s\"=\"%s\", enc %s\n", field, text2, encoding); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
138 #endif |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
139 update_id3_frame(id3tag, field, text2, 0); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
140 g_free(text2); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
141 } else { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
142 update_id3_frame(id3tag, field, "", 0); /* will be detached */ |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
143 } |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
144 |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
145 } else if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_STRING) { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
146 text = (char*)aud_tuple_get_string(tuple, fieldn, NULL); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
147 text2 = g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
148 #ifdef DEBUG |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
149 fprintf(stderr, "madplug: updating field:\"%s\"=\"%s\", enc %s\n", field, text2, encoding); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
150 #endif |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
151 update_id3_frame(id3tag, field, text2, sjis); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
152 g_free(text2); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
153 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
154 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
155 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
156 gboolean |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
157 audmad_update_song_tuple(Tuple *tuple, VFSFile *fd) |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
158 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
159 struct id3_file *id3file; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
160 struct id3_tag *id3tag; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
161 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
162 if ((id3file = id3_file_vfsopen(fd, ID3_FILE_MODE_READWRITE)) == NULL) return FALSE; |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
163 |
629 | 164 id3tag = id3_file_tag(id3file); |
165 if (!id3tag) { | |
166 #ifdef DEBUG | |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
167 fprintf(stderr, "no id3tag\n. append new tag.\n"); |
629 | 168 #endif |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
169 id3tag = id3_tag_new(); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
170 id3_tag_clearframes(id3tag); |
629 | 171 id3tag->options |= ID3_TAG_OPTION_APPENDEDTAG | ID3_TAG_OPTION_ID3V1; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
172 } |
629 | 173 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
174 id3_tag_options(id3tag, ID3_TAG_OPTION_ID3V1, ~0); /* enables id3v1. TODO: make id3v1 optional */ |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
175 |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
176 update_id3_frame_from_tuple(id3tag, ID3_FRAME_TITLE, tuple, FIELD_TITLE, audmad_config.sjis); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
177 update_id3_frame_from_tuple(id3tag, ID3_FRAME_ARTIST, tuple, FIELD_ARTIST, audmad_config.sjis); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
178 update_id3_frame_from_tuple(id3tag, ID3_FRAME_ALBUM, tuple, FIELD_ALBUM, audmad_config.sjis); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
179 update_id3_frame_from_tuple(id3tag, ID3_FRAME_YEAR, tuple, FIELD_YEAR, audmad_config.sjis); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
180 update_id3_frame_from_tuple(id3tag, ID3_FRAME_COMMENT, tuple, FIELD_COMMENT, audmad_config.sjis); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
181 update_id3_frame_from_tuple(id3tag, ID3_FRAME_TRACK, tuple, FIELD_TRACK_NUMBER, audmad_config.sjis); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
182 update_id3_frame_from_tuple(id3tag, ID3_FRAME_GENRE, tuple, FIELD_GENRE, audmad_config.sjis); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
183 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
184 if (id3_file_update(id3file) != 0) return FALSE; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
185 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
186 id3_file_close(id3file); |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
187 return TRUE; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
188 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
189 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
190 /*#endif // !NOGUI |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
191 |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
192 void audmad_get_file_info(char *fileurl) |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
193 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
194 #ifndef NOGUI |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
195 gchar *title; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
196 gchar message[128]; |
611 | 197 static char const *const layer_str[3] = { "I", "II", "III" }; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
198 static char const *const mode_str[4] = { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
199 ("single channel"), ("dual channel"), "joint stereo", "stereo" |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
200 }; |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
201 gchar *tmp, *utf_filename; |
1329
4b07404814ca
- reduce the number of file open in loading.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1328
diff
changeset
|
202 gchar *realfn = NULL; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
203 #ifdef DEBUG |
799 | 204 { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
205 tmp = aud_str_to_utf8(fileurl); |
799 | 206 g_message("f: audmad_get_file_info: %s", tmp); |
207 g_free(tmp); | |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
208 tmp = NULL; |
799 | 209 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
210 #endif |
1160
98a760301a4e
[svn] - add a check for file existence to fileinfo dialog. closes #941.
yaz
parents:
997
diff
changeset
|
211 |
1978 | 212 if(!aud_vfs_is_remote(fileurl) && !aud_vfs_file_test(fileurl, G_FILE_TEST_EXISTS)) { |
1160
98a760301a4e
[svn] - add a check for file existence to fileinfo dialog. closes #941.
yaz
parents:
997
diff
changeset
|
213 return; |
98a760301a4e
[svn] - add a check for file existence to fileinfo dialog. closes #941.
yaz
parents:
997
diff
changeset
|
214 } |
98a760301a4e
[svn] - add a check for file existence to fileinfo dialog. closes #941.
yaz
parents:
997
diff
changeset
|
215 |
1328
38fb3bb3e21e
- make probing for tuple completely reuse fd.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1319
diff
changeset
|
216 input_init(&info, fileurl, NULL); |
611 | 217 |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
218 if(audmad_is_remote(fileurl)) { |
611 | 219 info.remote = TRUE; |
1978 | 220 if(aud_vfs_is_streaming(info.infile)) |
1329
4b07404814ca
- reduce the number of file open in loading.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1328
diff
changeset
|
221 return; //file info dialog for remote streaming doesn't make sense. |
611 | 222 } |
223 | |
1329
4b07404814ca
- reduce the number of file open in loading.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1328
diff
changeset
|
224 realfn = g_filename_from_uri(fileurl, NULL, NULL); |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
225 utf_filename = aud_str_to_utf8(realfn ? realfn : fileurl); |
1329
4b07404814ca
- reduce the number of file open in loading.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1328
diff
changeset
|
226 g_free(realfn); realfn = NULL; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
227 create_window(); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
228 |
997
e46b98155d5d
[svn] - fix a bug which counts number of frames twice in handling xing header.
yaz
parents:
980
diff
changeset
|
229 info.fileinfo_request = TRUE; |
980
6ba4a4bfd127
[svn] - fix overflow when calculates bitrate with non-fast scan on a huge sized file.
yaz
parents:
898
diff
changeset
|
230 input_get_info(&info, info.remote ? TRUE : FALSE); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
231 |
1328
38fb3bb3e21e
- make probing for tuple completely reuse fd.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1319
diff
changeset
|
232 tmp = g_path_get_basename(utf_filename); |
38fb3bb3e21e
- make probing for tuple completely reuse fd.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1319
diff
changeset
|
233 title = g_strdup_printf(_("File Info - %s"), tmp); |
38fb3bb3e21e
- make probing for tuple completely reuse fd.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1319
diff
changeset
|
234 g_free(tmp); tmp = NULL; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
235 gtk_window_set_title(GTK_WINDOW(window), title); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
236 g_free(title); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
237 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
238 gtk_entry_set_text(GTK_ENTRY(filename_entry), utf_filename); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
239 gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
240 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
241 free(utf_filename); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
242 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
243 id3_frame_to_entry(ID3_FRAME_ARTIST, GTK_ENTRY(artist_entry)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
244 id3_frame_to_entry(ID3_FRAME_TITLE, GTK_ENTRY(title_entry)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
245 id3_frame_to_entry(ID3_FRAME_ALBUM, GTK_ENTRY(album_entry)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
246 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
247 // year |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
248 // id3_frame_to_entry (ID3_FRAME_YEAR, GTK_ENTRY (year_entry)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
249 // to set year entry, we have to do manually because TYER is still used equally to TDRC. |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
250 gtk_entry_set_text(GTK_ENTRY(year_entry), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
251 if (info.tag) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
252 gchar *text = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
253 text = input_id3_get_string(info.tag, "TDRC"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
254 if (!text) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
255 text = input_id3_get_string(info.tag, "TYER"); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
256 if (text) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
257 gtk_entry_set_text(GTK_ENTRY(year_entry), text); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
258 g_free(text); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
259 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
260 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
261 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
262 id3_frame_to_entry(ID3_FRAME_TRACK, GTK_ENTRY(tracknum_entry)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
263 id3_frame_to_entry(ID3_FRAME_COMMENT, GTK_ENTRY(comment_entry)); |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
264 snprintf(message, 127, _("Layer %s"), layer_str[info.mpeg_layer - 1]); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
265 gtk_label_set_text(GTK_LABEL(mpeg_level), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
266 if (info.vbr) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
267 snprintf(message, 127, _("VBR (avg. %d kbps)"), info.bitrate / 1000); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
268 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
269 else { |
611 | 270 snprintf(message, 127, "%d kbps", info.bitrate / 1000); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
271 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
272 gtk_label_set_text(GTK_LABEL(mpeg_bitrate), message); |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
273 snprintf(message, 127, _("%d Hz"), info.freq); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
274 gtk_label_set_text(GTK_LABEL(mpeg_samplerate), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
275 if (info.frames != -1) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
276 snprintf(message, 127, _("%d frames"), info.frames); |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
277 gtk_label_set_text(GTK_LABEL(mpeg_frames), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
278 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
279 else { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
280 gtk_label_set_text(GTK_LABEL(mpeg_frames), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
281 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
282 gtk_label_set_text(GTK_LABEL(mpeg_flags), mode_str[info.mode]); |
1162
29519d604e8c
[svn] - revise bitrate calculation with xing header. if number of bytes and number of frames are available in xing header, fast play time calculation yields almost appropriate duration upon a vbr file.
yaz
parents:
1160
diff
changeset
|
283 { |
29519d604e8c
[svn] - revise bitrate calculation with xing header. if number of bytes and number of frames are available in xing header, fast play time calculation yields almost appropriate duration upon a vbr file.
yaz
parents:
1160
diff
changeset
|
284 guint sec = mad_timer_count(info.duration, MAD_UNITS_SECONDS); |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
285 snprintf(message, 127, _("%d:%02d (%d seconds)"), sec /60 ,sec % 60, sec); |
1162
29519d604e8c
[svn] - revise bitrate calculation with xing header. if number of bytes and number of frames are available in xing header, fast play time calculation yields almost appropriate duration upon a vbr file.
yaz
parents:
1160
diff
changeset
|
286 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
287 gtk_label_set_text(GTK_LABEL(mpeg_duration), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
288 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
289 if (info.replaygain_album_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
290 snprintf(message, 127, _("RG_album=%4s (x%4.2f)"), |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
291 info.replaygain_album_str, info.replaygain_album_scale); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
292 gtk_label_set_text(GTK_LABEL(mpeg_replaygain), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
293 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
294 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
295 gtk_label_set_text(GTK_LABEL(mpeg_replaygain), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
296 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
297 if (info.replaygain_track_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
298 snprintf(message, 127, _("RG_track=%4s (x%4.2f)"), |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
299 info.replaygain_track_str, info.replaygain_track_scale); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
300 gtk_label_set_text(GTK_LABEL(mpeg_replaygain2), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
301 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
302 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
303 gtk_label_set_text(GTK_LABEL(mpeg_replaygain2), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
304 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
305 if (info.replaygain_album_peak_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
306 snprintf(message, 127, _("Peak album=%4s (%+5.3fdBFS)"), |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
307 info.replaygain_album_peak_str, |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
308 20 * log10(info.replaygain_album_peak)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
309 gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
310 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
311 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
312 gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
313 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
314 if (info.replaygain_track_peak_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
315 snprintf(message, 127, _("Peak track=%4s (%+5.3fdBFS)"), |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
316 info.replaygain_track_peak_str, |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
317 20 * log10(info.replaygain_track_peak)); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
318 gtk_label_set_text(GTK_LABEL(mpeg_replaygain4), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
319 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
320 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
321 gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
322 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
323 if (info.mp3gain_undo_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
324 snprintf(message, 127, _("mp3gain undo=%4s (%+5.3fdB)"), |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
325 info.mp3gain_undo_str, info.mp3gain_undo); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
326 gtk_label_set_text(GTK_LABEL(mp3gain1), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
327 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
328 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
329 gtk_label_set_text(GTK_LABEL(mp3gain1), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
330 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
331 if (info.mp3gain_minmax_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
332 snprintf(message, 127, _("mp3gain minmax=%4s (max-min=%+6.3fdB)"), |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
333 info.mp3gain_minmax_str, info.mp3gain_minmax); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
334 gtk_label_set_text(GTK_LABEL(mp3gain2), message); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
335 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
336 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
337 gtk_label_set_text(GTK_LABEL(mp3gain2), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
338 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
339 gtk_label_set_text(GTK_LABEL(mpeg_fileinfo), ""); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
340 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
341 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
342 // work out the index of the genre in the list |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
343 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
344 const id3_ucs4_t *string; |
645 | 345 id3_ucs4_t *genre; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
346 struct id3_frame *frame; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
347 union id3_field *field; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
348 frame = id3_tag_findframe(info.tag, ID3_FRAME_GENRE, 0); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
349 if (frame) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
350 field = id3_frame_field(frame, 1); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
351 string = id3_field_getstrings(field, 0); |
645 | 352 genre = mad_parse_genre(string); |
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
353 #ifdef DEBUG |
898
06ecbb1e3dbb
[svn] - non-utf string had been used for file name in window title of File Info window. patch by M.H.
yaz
parents:
799
diff
changeset
|
354 if (genre) { |
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
355 gchar *utf = (gchar *)id3_ucs4_utf8duplicate(genre); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
356 g_print("genre = %s\n", utf); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
357 g_print("genre num = %d\n", id3_genre_number(genre)); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
358 g_free(utf); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
359 } |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
360 #endif |
645 | 361 if (genre) { |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
362 gtk_list_select_item(GTK_LIST |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
363 (GTK_COMBO(genre_combo)->list), |
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
364 id3_genre_number(genre)+1); //shift one for "Unknown". |
645 | 365 g_free((void *)genre); |
366 } | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
367 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
368 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
369 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
370 gtk_widget_set_sensitive(id3_frame, TRUE); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
371 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
372 #endif // !NOGUI |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
373 }*/ |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
374 |