comparison src/libaudacious/beepctrl.c @ 2585:c2b49ba4be45 trunk

[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
author nhjm449
date Mon, 26 Feb 2007 19:06:45 -0800
parents 5fea66ad690c
children
comparison
equal deleted inserted replaced
2584:ea937605a48a 2585:c2b49ba4be45
431 *keybuf++ = '\0'; 431 *keybuf++ = '\0';
432 432
433 *key = g_strdup(keybuf); 433 *key = g_strdup(keybuf);
434 434
435 g_free(tmp); 435 g_free(tmp);
436 }
437
438 /**
439 * audacious_get_tuple_field_data:
440 * @session: Legacy XMMS-style session identifier.
441 * @field: The name of the tuple field to retrieve.
442 * @pos: The playlist position to query for.
443 *
444 * Queries Audacious about a playlist entry's tuple information.
445 *
446 * Return value: The requested field's data for the entry in the playlist at %pos position.
447 **/
448 gchar *
449 audacious_get_tuple_field_data(gint session, gchar * field, gint pos)
450 {
451 gint fd, size;
452 gchar *packet;
453 gpointer data;
454
455 if (field == NULL)
456 return NULL;
457
458 size = strlen(field) + 1 + sizeof(gint);
459
460 if ((fd = xmms_connect_to_session(session)) == -1)
461 return NULL;
462
463 packet = g_malloc0(size);
464 *((gint *) packet) = pos;
465 strcpy(packet + sizeof(gint), field);
466 remote_send_packet(fd, CMD_PLAYLIST_GET_TUPLE_DATA, packet, size);
467 data = remote_read_packet(fd);
468 remote_read_ack(fd);
469 close(fd);
470 g_free(packet);
471 return data;
436 } 472 }
437 473
438 /** 474 /**
439 * xmms_connect_to_session: 475 * xmms_connect_to_session:
440 * @session: Legacy XMMS-style session identifier. 476 * @session: Legacy XMMS-style session identifier.