comparison src/flacng/tools.c @ 1687:d158ce84fda7

Modified for Tuplez/plugin API changes.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 05 Sep 2007 09:29:26 +0300
parents 3a252050736c
children 5fa26178eaef
comparison
equal deleted inserted replaced
1600:49fe2225d236 1687:d158ce84fda7
239 239
240 _DEBUG("Using callback_info %s", info->name); 240 _DEBUG("Using callback_info %s", info->name);
241 241
242 out = tuple_new_from_filename(filename); 242 out = tuple_new_from_filename(filename);
243 243
244 tuple_associate_string(out, "codec", "Free Lossless Audio Codec (FLAC)"); 244 tuple_associate_string(out, FIELD_CODEC, NULL, "Free Lossless Audio Codec (FLAC)");
245 tuple_associate_string(out, "quality", "lossless"); 245 tuple_associate_string(out, FIELD_CODEC, NULL, "lossless");
246 246
247 tuple_associate_string(out, "artist", info->comment.artist); 247 tuple_associate_string(out, FIELD_ARTIST, NULL, info->comment.artist);
248 tuple_associate_string(out, "title", info->comment.title); 248 tuple_associate_string(out, FIELD_TITLE, NULL, info->comment.title);
249 tuple_associate_string(out, "album", info->comment.album); 249 tuple_associate_string(out, FIELD_ALBUM, NULL, info->comment.album);
250 tuple_associate_string(out, "genre", info->comment.genre); 250 tuple_associate_string(out, FIELD_GENRE, NULL, info->comment.genre);
251 251
252 if (info->comment.tracknumber != NULL) 252 if (info->comment.tracknumber != NULL)
253 tuple_associate_int(out, "track-number", atoi(info->comment.tracknumber)); 253 tuple_associate_int(out, FIELD_TRACK_NUMBER, NULL, atoi(info->comment.tracknumber));
254 254
255 if (info->comment.date != NULL) 255 if (info->comment.date != NULL)
256 tuple_associate_int(out, "year", atoi(info->comment.date)); 256 tuple_associate_int(out, FIELD_YEAR, NULL, atoi(info->comment.date));
257 257
258 /* 258 /*
259 * Calculate the stream length (milliseconds) 259 * Calculate the stream length (milliseconds)
260 */ 260 */
261 if (0 == info->stream.samplerate) { 261 if (0 == info->stream.samplerate) {
262 _ERROR("Invalid sample rate for stream!"); 262 _ERROR("Invalid sample rate for stream!");
263 tuple_associate_int(out, "length", -1); 263 tuple_associate_int(out, FIELD_LENGTH, NULL, -1);
264 } else { 264 } else {
265 tuple_associate_int(out, "length", (info->stream.samples / info->stream.samplerate) * 1000); 265 tuple_associate_int(out, FIELD_LENGTH, NULL, (info->stream.samples / info->stream.samplerate) * 1000);
266 _DEBUG("Stream length: %d seconds", tuple_get_int(out, "length")); 266 _DEBUG("Stream length: %d seconds", tuple_get_int(out, FIELD_LENGTH, NULL));
267 } 267 }
268 268
269 _DEBUG("Tuple created: [%p]", out); 269 _DEBUG("Tuple created: [%p]", out);
270 270
271 _LEAVE out; 271 _LEAVE out;