#include // For gtk related stuff #include // The engine for retriving http data #include // Generic string manipulation functions (str*) #include // For malloc and some other useful functions #include // For the regexp to get the song names from the http data #include // for getenv (get environmental variable) #include char *recData = NULL; // The storage of http data xosd *osd = NULL; char *font = "-adobe-helvetica-bold-r-normal-*-*-320-*-*-p-*-iso8859-1"; char *curSong = NULL; typedef struct _config { int channel; // The current channel of interest char update; // Whether we pop up a splash telling updates }config; typedef struct _channelWin { GtkWidget *window; GtkWidget *channelSpin; GtkWidget *ok; }channelWin; channelWin chWin; config mainConfig; // Curl launches this function when data is available static int writer(char *data, size_t size, size_t nmemb, char *buffer) { strcat(recData,data); return size*nmemb; // Return size read } void updateShow() { xosd_display (osd, 0, XOSD_string, "Song:"); xosd_display (osd, 1, XOSD_string, curSong); xosd_set_timeout(osd, 3); } void findSongNames() { int offset; const char *error = malloc(128); pcre *reg = pcre_compile("Array\\(([0-9]+),\"(.+?)\",\"(.+?)\"",0,&error,&offset,NULL); char currSong[255]; int ovector[30]; ovector[2] = 0; while(pcre_exec(reg, NULL, recData, strlen(recData), ovector[2],0, ovector, 30)>1) { char *chan = strdup(recData+ovector[2]); chan[ovector[3]-ovector[2]]='\0'; int chann = atoi(chan); if(chann==mainConfig.channel) { int i = 4; for(;i<8;i+=2) { int k; for(k=ovector[i];k