Skip to content

Instantly share code, notes, and snippets.

@sahib
Created April 27, 2012 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sahib/5ebbde23757bd6bcc3b5 to your computer and use it in GitHub Desktop.
Save sahib/5ebbde23757bd6bcc3b5 to your computer and use it in GitHub Desktop.
#include <glyr/glyr.h>
#include <stdio.h>
// Compile with:
// gcc tracklistprinter.c -o tracklistprinter $(pkg-config --libs --cflags libglyr)
// Produces:
//
// 01. Death on Two Legs (Dedicated to...)
// 02. Lazing on a Sunday Afternoon
// 03. I'm in Love With My Car
// 04. You're My Best Friend
// 05. '39
// 06. Sweet Lady
// 07. Seaside Rendezvous
// 08. The Prophet's Song
// 09. Love of My Life
// 10. Good Company
// 11. Bohemian Rhapsody
// 12. God Save the Queen
int main(int argc, char const *argv[])
{
glyr_init();
atexit(glyr_cleanup);
GlyrQuery q;
int i = 0;
glyr_query_init(&q);
glyr_opt_artist(&q,"Queen");
glyr_opt_album(&q,"Night at the Opera");
glyr_opt_type(&q,GLYR_GET_TRACKLIST);
glyr_opt_number(&q,0); /* Infinite items */
GlyrMemCache * list = glyr_get(&q,NULL,NULL);
GlyrMemCache * iter = list;
while(iter != NULL)
{
printf("%02d. %s\n",++i,iter->data);
iter = iter->next;
}
glyr_free_list(list);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment