int findInDirectory(FILE * fp, Song * song, void * data) { LocateTagItemArray * array = data; int i; for(i = 0; i < array->numItems; i++) { if(!tagItemFoundAndMatches(song, array->items[i].tagType, array->items[i].needle)) { return 0; } } printSongInfo(fp, song); return 0; }
int searchInDirectory(FILE * fp, Song * song, void * data) { LocateTagItemArray * array = data; int i; for(i = 0; i < array->numItems; i++) { if(!strstrSearchTag(song, array->items[i].tagType, array->items[i].needle)) { return 0; } } printSongInfo(fp, song); return 0; }
int main(){ std::ifstream catalogFile("catalog.json"); Json::Value root; // will contains the root value after parsing. Json::Reader reader; bool parsingSuccessful = reader.parse( catalogFile, root ); if ( !parsingSuccessful ){ // report to the user the failure and their locations in the document. std::cout << "Failed to parse configuration\n" << reader.getFormattedErrorMessages(); return 1; } //parsing songs Json::Value songs = root["songs"]; for ( int index = 0; index < songs.size(); ++index ){ // Iterates over the sequence elements. printSongInfo(songs[index]); } return 0; }
void printPlaylistSongInfo(FILE * fp, int song) { printSongInfo(fp, playlist.songs[song]); myfprintf(fp, "Pos: %i\n", song); myfprintf(fp, "Id: %i\n", playlist.positionToId[song]); }
int directoryPrintSongInfo(FILE * fp, Song * song, void * data) { return printSongInfo(fp,song); }