Forums: 

Hi,

I have some difficulties to understand how to fetch the composer tag based on gnsdk documentation. Is there any example C-code for this?

Thanks

hi,

First off, be sure to enable classical data on your initial query like this:

error = gnsdk_musicid_query_option_set(query_handle, GNSDK_MUSICID_OPTION_ENABLE_CLASSICAL_DATA, GNSDK_VALUE_TRUE);

then, when you get back your album, you can find composers in work or track GDOs with the below code.

hope this helps!

-john

void
_display_composer(gnsdk_gdo_handle_t object_gdo)
{
gnsdk_uint32_t count = 0;
gnsdk_uint32_t ord = 0;
gnsdk_error_t error = GNSDK_SUCCESS;
gnsdk_gdo_handle_t credit_gdo = GNSDK_NULL;
gnsdk_cstr_t role_id = GNSDK_NULL;

error = gnsdk_manager_gdo_child_count(object_gdo, GNSDK_GDO_CHILD_CREDIT, &count);
for (ord = 1; ord <= count; ord++)
{
error = gnsdk_manager_gdo_child_get(object_gdo, GNSDK_GDO_CHILD_CREDIT, ord, &credit_gdo);
if (!error)
{
error = gnsdk_manager_gdo_value_get(credit_gdo, GNSDK_GDO_VALUE_ROLE_ID, 1, &role_id);
if (!error && !strcmp(role_id, GNSDK_LIST_MUSIC_ROLE_COMPOSER))
{
printf("Composer found!\n");
}
gnsdk_manager_gdo_release(credit_gdo);
}
}
}

(trying again with syntax highlighting)

void
_display_composer(gnsdk_gdo_handle_t object_gdo)
{
gnsdk_uint32_t count = 0;
gnsdk_uint32_t ord = 0;
gnsdk_error_t error = GNSDK_SUCCESS;
gnsdk_gdo_handle_t credit_gdo = GNSDK_NULL;
gnsdk_cstr_t role_id = GNSDK_NULL;

error = gnsdk_manager_gdo_child_count(object_gdo, GNSDK_GDO_CHILD_CREDIT, &count);
for (ord = 1; ord <= count; ord++)
{
error = gnsdk_manager_gdo_child_get(object_gdo, GNSDK_GDO_CHILD_CREDIT, ord, &credit_gdo);
if (!error)
{
error = gnsdk_manager_gdo_value_get(credit_gdo, GNSDK_GDO_VALUE_ROLE_ID, 1, &role_id);
if (!error && !strcmp(role_id, GNSDK_LIST_MUSIC_ROLE_COMPOSER))
{
printf("Composer found!\n");
}
gnsdk_manager_gdo_release(credit_gdo);
}
}
}

Thanks for the reply. I finally had some time to try the example but it was not so straight forward. I finally managed to find composer info from the track's audio work gdo. Is it really available only for classical music? I just wonder because I once ripped one pop CD with iTunes and it populated the composer tags for it also (I thought it's using Gracenote).

hi,
sorry I didn't see this earlier. you are correct, composer credits exist for pop music too - sorry to imply otherwise.
for example, John Lennon has a composer credit for track 1 ("Come Together") on The Beatles' Abbey Road.
Perhaps you can use that as a test album?
best,
john

hi,
I don't manage to find Composer info at all for Beatles's Abbey Road album. My software is making queries with the CD TOCs and I tried here two different:
150 19725 33450 49050 64500 77325 112350 126300 138750 156902 167852 172802 178277 187052 193952 201175 211725 213525
150 19650 33380 48917 64425 77260 112297 126220 138617 156802 167772 172742 178197 187040 193892 201122 211660 213540

I also tried the slightly modified version of gdo2xml (gnsdk examples) for the serialized album gdo
WEcxA0GWdKgoOPjaN8Rcs8OUzpDRDPBx4cFqE4OnAW8D3r9wNfj2R5VX4sRPkoRKkuz9FGKPSQfQIxkmQMDBjGE9hYRbJ+5oY1tX6389V4YT70+ISyreKJOzfj08Esc8Rv+s5zcLDYrX3cTL32i639oVaGrF+rBbCAo78d1fqTmQAQwMPeJk0JSbtn/YXgRoCZrKcsfcaVqKFhjCUf7iJgVopA==

but there were no Composer info. gdo2xml helped me to find Composer tag for some classical albums.

Cheers
Kimmo

Forum Discussions