Help me help him help me
February 12, 2007 8:58 AM Subscribe
Help me help my friend help me. He's working on a database project using MusicBrainz (the one here) and has run into a programming issue--he's unable to retrieve tracks. He's using C++ and XML. Details are inside.
Here is his question:
=========
i guess the question would be partially concerning this block of code:
for (ReleaseList::iterator i = releases.begin(); i != releases.end(); i++) {
Release *release = *i;
ReleaseEventList relList = release->getReleaseEvents();
tList = release->getTracks();
cout < endl; cout id : release->getId() < endl; cout title : release->getTitle() < endl; cout year : release->getReleaseEvent(0)->getDate().substr(0,3) < endl; cout tracks : release->getTrack(0)->getTitle() < endl; cout tracks follow --- endl; for (j=0; j =release->getNumTracks() - 1; j++) {
cout < track j release->getTrack(j) < endl; } } which seems to segfault (crash) at the strong>release->getReleaseEvent(0)->getDate().substr(0,3) < endl;/strong> line.
The getReleaseEvent() seems to be causing the problem, more than anything.
Then when I try to get tracks...
cout < tracks : release->getTrack(0)->getTitle() < endl;/strong> also seems to crap out.
Finally,
for (j = 0; j < release->getNumTracks() - 1; j++) {
cout < track j release->getTrack(j) < endl; }/strong>
just doesn't work, because getNumTracks() ALWAYS returns 0.
=========
Thank you very much!>>>>>>>>>>>>>
Here is his question:
=========
i guess the question would be partially concerning this block of code:
for (ReleaseList::iterator i = releases.begin(); i != releases.end(); i++) {
Release *release = *i;
ReleaseEventList relList = release->getReleaseEvents();
tList = release->getTracks();
cout < endl; cout id : release->getId() < endl; cout title : release->getTitle() < endl; cout year : release->getReleaseEvent(0)->getDate().substr(0,3) < endl; cout tracks : release->getTrack(0)->getTitle() < endl; cout tracks follow --- endl; for (j=0; j =release->getNumTracks() - 1; j++) {
cout < track j release->getTrack(j) < endl; } } which seems to segfault (crash) at the strong>release->getReleaseEvent(0)->getDate().substr(0,3) < endl;/strong> line.
The getReleaseEvent() seems to be causing the problem, more than anything.
Then when I try to get tracks...
cout < tracks : release->getTrack(0)->getTitle() < endl;/strong> also seems to crap out.
Finally,
for (j = 0; j < release->getNumTracks() - 1; j++) {
cout < track j release->getTrack(j) < endl; }/strong>
just doesn't work, because getNumTracks() ALWAYS returns 0.
=========
Thank you very much!>>>>>>>>>>>>>
yeah, use something like dpaste to paste the code so we can see it a bit more legibly.
If the getReleaseEvent() call seems to be causing the problem, then it would be nice to know what that function does, it's requirements, etc. I'd guess that you're referring to this function but i'm not sure. I'd also want to see the code that created your ReleaseList in the first place.
posted by escher at 10:28 AM on February 12, 2007
If the getReleaseEvent() call seems to be causing the problem, then it would be nice to know what that function does, it's requirements, etc. I'd guess that you're referring to this function but i'm not sure. I'd also want to see the code that created your ReleaseList in the first place.
posted by escher at 10:28 AM on February 12, 2007
Response by poster: Sweet Christmas, that came out a lot uglier on posting. And the strong tags are all messed up. Jesus. Sorry! Here is the dpaste link (thanks for the tip).
posted by Anonymous at 11:14 AM on February 12, 2007
posted by Anonymous at 11:14 AM on February 12, 2007
« Older Why is my TV picture flickering when I don't use a... | What do you love/hate about being an elementary... Newer »
This thread is closed to new comments.
In addition to the formatting, I can't really see enough of the implementation to get much of an idea of what's going on, so seeing some more source would help with that as well.
posted by benign at 9:35 AM on February 12, 2007