Mercurial > audlegacy-plugins
annotate src/madplug/tuple.c @ 2202:f76e846d53d9
updating TLEN frame returned
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Mon, 03 Dec 2007 01:26:57 +0300 |
parents | src/madplug/tuples.c@df520f828dcf |
children | 13b8ab116b69 |
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" |
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
25 #include "tuple.h" |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
26 #include "input.h" |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
27 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
28 #include <math.h> |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
29 #include <string.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
30 |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
31 #include <glib.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
32 #include <glib/gprintf.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
33 |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
34 #include <audacious/util.h> |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
35 #include <audacious/plugin.h> |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
36 #include <audacious/id3tag.h> |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
37 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
38 /* yaz */ |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
39 #include <langinfo.h> |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
40 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
41 #define DEBUG |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
42 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
43 static void |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
44 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
|
45 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
46 int res; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
47 struct id3_frame *frame; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
48 union id3_field *field; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
49 id3_ucs4_t *ucs4; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
50 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
51 if (data == NULL) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
52 return; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
53 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
54 // printf ("updating id3: %s: %s\n", frame_name, data); |
611 | 55 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
56 // |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
57 // 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
|
58 // |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
59 if (strlen(data) == 0) { |
629 | 60 while ((frame = id3_tag_findframe(tag, frame_name, 0))) { |
61 #ifdef DEBUG | |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
62 fprintf(stderr, "madplug: detachframe\n"); |
629 | 63 #endif |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
64 id3_tag_detachframe(tag, frame); |
629 | 65 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
66 return; |
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 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
69 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
|
70 if (!frame) { |
629 | 71 #ifdef DEBUG |
72 printf("frame_new\n"); | |
73 #endif | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
74 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
|
75 id3_tag_attachframe(tag, frame); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
76 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
77 |
611 | 78 // setup ucs4 string |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
79 if(sjis) { |
611 | 80 ucs4 = id3_latin1_ucs4duplicate((id3_latin1_t *) data); |
81 } | |
82 else { | |
83 ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) data); | |
84 } | |
85 | |
86 // set encoding | |
87 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
|
88 id3_field_settextencoding(field, sjis ? ID3_FIELD_TEXTENCODING_ISO_8859_1 : |
611 | 89 ID3_FIELD_TEXTENCODING_UTF_8); |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
90 |
611 | 91 // setup genre code |
92 if (!strcmp(frame_name, ID3_FRAME_GENRE)) { | |
93 char *tmp; | |
94 int index = id3_genre_number(ucs4); | |
95 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
|
96 |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
97 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
|
98 #ifdef DEBUG |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
99 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
|
100 #endif |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
101 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
|
102 } |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
103 else { // meaningful genre |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
104 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
|
105 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
|
106 } |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
107 |
611 | 108 } |
109 | |
110 // write string | |
111 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
|
112 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
|
113 field->type = ID3_FIELD_TYPE_STRINGFULL; |
611 | 114 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
|
115 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
116 else { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
121 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
122 if (res != 0) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
123 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
|
124 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
125 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
126 static void |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
127 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
|
128 { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
129 int val; |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
130 char *text, *text2; |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
131 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
|
132 |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
133 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
|
134 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
|
135 if(val > 0) { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
136 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
|
137 #ifdef DEBUG |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
138 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
|
139 #endif |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
140 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
|
141 g_free(text2); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
142 } else { |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
143 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
|
144 } |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
145 |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
146 } 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
|
147 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
|
148 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
|
149 #ifdef DEBUG |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
150 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
|
151 #endif |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
152 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
|
153 g_free(text2); |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
154 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
155 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
156 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
157 gboolean |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
158 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
|
159 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
160 struct id3_file *id3file; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
161 struct id3_tag *id3tag; |
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
162 gchar *text; |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
163 struct mad_info_t songinfo; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
164 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
165 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
|
166 |
629 | 167 id3tag = id3_file_tag(id3file); |
168 if (!id3tag) { | |
169 #ifdef DEBUG | |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
170 fprintf(stderr, "no id3tag\n. append new tag.\n"); |
629 | 171 #endif |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
172 id3tag = id3_tag_new(); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
173 id3_tag_clearframes(id3tag); |
629 | 174 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
|
175 } |
629 | 176 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
177 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
|
178 |
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_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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 |
2202
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
187 if(!id3_tag_findframe(id3tag, "TLEN", 0) && input_init(&songinfo, fd->uri, fd) && !songinfo.remote) { |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
188 #ifdef DEBUG |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
189 fprintf(stderr, "update TLEN frame\n"); |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
190 #endif |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
191 songinfo.fileinfo_request = FALSE; /* we don't need to read tuple again */ |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
192 input_get_info(&songinfo, FALSE); |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
193 text = g_strdup_printf("%ld", mad_timer_count(songinfo.duration, MAD_UNITS_MILLISECONDS)); |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
194 #ifdef DEBUG |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
195 fprintf(stderr, "TLEN: \"%s\"\n", text); |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
196 #endif |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
197 update_id3_frame(id3tag, "TLEN", text, 0); |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
198 g_free(text); |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
199 input_term(&songinfo); |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
200 } |
f76e846d53d9
updating TLEN frame returned
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2201
diff
changeset
|
201 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
202 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
|
203 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
204 id3_file_close(id3file); |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
205 return TRUE; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
206 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
207 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
208 /*#endif // !NOGUI |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
209 |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
210 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
|
211 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
212 #ifndef NOGUI |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
213 gchar *title; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
214 gchar message[128]; |
611 | 215 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
|
216 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
|
217 ("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
|
218 }; |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
219 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
|
220 gchar *realfn = NULL; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
221 #ifdef DEBUG |
799 | 222 { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
223 tmp = aud_str_to_utf8(fileurl); |
799 | 224 g_message("f: audmad_get_file_info: %s", tmp); |
225 g_free(tmp); | |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
226 tmp = NULL; |
799 | 227 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
228 #endif |
1160
98a760301a4e
[svn] - add a check for file existence to fileinfo dialog. closes #941.
yaz
parents:
997
diff
changeset
|
229 |
1978 | 230 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
|
231 return; |
98a760301a4e
[svn] - add a check for file existence to fileinfo dialog. closes #941.
yaz
parents:
997
diff
changeset
|
232 } |
98a760301a4e
[svn] - add a check for file existence to fileinfo dialog. closes #941.
yaz
parents:
997
diff
changeset
|
233 |
1328
38fb3bb3e21e
- make probing for tuple completely reuse fd.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1319
diff
changeset
|
234 input_init(&info, fileurl, NULL); |
611 | 235 |
1222
aeea3e7b0060
make fileinfo work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1162
diff
changeset
|
236 if(audmad_is_remote(fileurl)) { |
611 | 237 info.remote = TRUE; |
1978 | 238 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
|
239 return; //file info dialog for remote streaming doesn't make sense. |
611 | 240 } |
241 | |
1329
4b07404814ca
- reduce the number of file open in loading.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1328
diff
changeset
|
242 realfn = g_filename_from_uri(fileurl, NULL, NULL); |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
243 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
|
244 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
|
245 create_window(); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
246 |
997
e46b98155d5d
[svn] - fix a bug which counts number of frames twice in handling xing header.
yaz
parents:
980
diff
changeset
|
247 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
|
248 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
|
249 |
1328
38fb3bb3e21e
- make probing for tuple completely reuse fd.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1319
diff
changeset
|
250 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
|
251 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
|
252 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
|
253 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
|
254 g_free(title); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
255 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
256 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
|
257 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
|
258 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
259 free(utf_filename); |
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 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
|
262 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
|
263 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
|
264 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
265 // year |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
266 // 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
|
267 // 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
|
268 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
|
269 if (info.tag) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
270 gchar *text = NULL; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
271 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
|
272 if (!text) |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
273 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
|
274 if (text) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
275 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
|
276 g_free(text); |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
277 } |
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 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
280 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
|
281 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
|
282 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
|
283 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
|
284 if (info.vbr) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
285 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
|
286 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
287 else { |
611 | 288 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
|
289 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
290 gtk_label_set_text(GTK_LABEL(mpeg_bitrate), message); |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
291 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
|
292 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
|
293 if (info.frames != -1) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
294 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
|
295 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
|
296 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
297 else { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
298 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
|
299 } |
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_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
|
301 { |
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
|
302 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
|
303 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
|
304 } |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
305 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
|
306 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
307 if (info.replaygain_album_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
308 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
|
309 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
|
310 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
|
311 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
312 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
313 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
|
314 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
315 if (info.replaygain_track_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
316 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
|
317 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
|
318 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
|
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_replaygain2), ""); |
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.replaygain_album_peak_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
324 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
|
325 info.replaygain_album_peak_str, |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
326 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
|
327 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
|
328 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
329 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
330 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
|
331 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
332 if (info.replaygain_track_peak_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
333 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
|
334 info.replaygain_track_peak_str, |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
335 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
|
336 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
|
337 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
338 else |
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_replaygain3), ""); |
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 if (info.mp3gain_undo_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
342 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
|
343 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
|
344 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
|
345 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
346 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
347 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
|
348 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
349 if (info.mp3gain_minmax_str != NULL) { |
1302
1d3b02d1842b
Guess... Yes, "i18n" stuff.
Stany HENRY <StrassBoy@gmail.com>
parents:
1264
diff
changeset
|
350 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
|
351 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
|
352 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
|
353 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
354 else |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
355 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
|
356 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
357 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
|
358 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
359 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
360 // 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
|
361 { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
362 const id3_ucs4_t *string; |
645 | 363 id3_ucs4_t *genre; |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
364 struct id3_frame *frame; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
365 union id3_field *field; |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
366 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
|
367 if (frame) { |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
368 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
|
369 string = id3_field_getstrings(field, 0); |
645 | 370 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
|
371 #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
|
372 if (genre) { |
730
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 g_free(utf); |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
377 } |
74a46ac77c97
[svn] - now fileinfo dialog shows "Unknown" instead of "Blues" if genre name isn't specified.
yaz
parents:
645
diff
changeset
|
378 #endif |
645 | 379 if (genre) { |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
380 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
|
381 (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
|
382 id3_genre_number(genre)+1); //shift one for "Unknown". |
645 | 383 g_free((void *)genre); |
384 } | |
610
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
385 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
386 } |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
387 |
862190d39e00
[svn] - add madplug. It is not yet hooked up, I'll do that later.
nenolod
parents:
diff
changeset
|
388 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
|
389 |
2201
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
390 #endif // !NOGUI |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
391 }*/ |
df520f828dcf
Say goodbye to custom fileinfo dialog in madplug
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2050
diff
changeset
|
392 |