#ifndef ZDF_H
#define ZDF_H
char* zdf(char* link)
{
debug(99, "link %s", link);
int debuglevel = getconfigint("debuglevel", NULL);
char* ip = NULL, *pos = NULL, *path = NULL, *streamurl = NULL, *tmpstr = NULL, *tmpstr2 = NULL, *pic = NULL, *title = NULL, *tmpstr3 = NULL, *quali = NULL;
ip = string_replace("http://", "", (char*)link, 0);
if(ip != NULL)
pos = strchr(ip, '/');
if(pos != NULL)
{
pos[0] = '\0';
path = pos + 1;
}
tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
titheklog(debuglevel, "/tmp/zdf1_tmpstr", NULL, tmpstr);
if(tmpstr != NULL)
{
if(ostrstr(tmpstr, "
") != NULL)
{
tmpstr2 = string_resub("
", "
", tmpstr, 0);
tmpstr2 = string_replace(".", ".\n", tmpstr2, 1),
textbox(_("Message"), tmpstr2, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
free(tmpstr2), tmpstr2 = NULL;
}
tmpstr2 = string_resub("
", "", tmpstr, 0);
stringreplacechar(tmpstr2, '\n', ' ');
stringreplacechar(tmpstr2, '\t', ' ');
string_strip_whitechars(tmpstr2);
tmpstr2 = string_replace_all("
1)
{
debug(99, "\nRound %d started, processing = %s",i,ret1[i].part);
streamurl = string_resub("", "", ret1[i].part,0);
if(ostrstr(ret1[i].part, "rtmp") != NULL)
{
char* ip1 = NULL, *pos1 = NULL, *path1 = NULL;
ip1 = string_replace("http://", "", streamurl, 0);
if(ip != NULL)
pos1 = strchr(ip1, '/');
if(pos1 != NULL)
{
pos1[0] = '\0';
path1 = pos1 + 1;
}
free(streamurl), streamurl = NULL;
tmpstr3 = gethttp(ip1, path1, 80, NULL, NULL, 10000, NULL, 0);
streamurl = string_resub("", "", tmpstr3, 0);
free(tmpstr3), tmpstr3 = NULL;
free(ip1), ip1 = NULL;
}
title = string_resub("", "",ret1[i].part,0);
if(title == NULL)
{
title = ostrcat(_("unknown"), NULL, 0, 0);
title = ostrcat(title, " (", 1, 0);
title = ostrcat(title, quali, 1, 0);
title = ostrcat(title, ")", 1, 0);
debug(99, "(%d) title: %s streamurl: %s\n", i, title, streamurl);
debug(99, "(%d) ret1 %s\n",i, (ret1[i]).part);
}
else
{
title = ostrcat(title, " (", 1, 0);
title = ostrcat(title, quali, 1, 0);
title = ostrcat(title, ")", 1, 0);
debug(99, "(%d) title: %s streamurl: %s\n", i, title, streamurl);
addmenulist(&mlist, title, streamurl, pic, 0, 0);
}
free(quali), quali = NULL;
free(title), title = NULL;
free(pic), pic = NULL;
free(streamurl), streamurl = NULL;
}
}
free(ret1), ret1 = NULL;
if(mlist != NULL)
{
mbox = menulistbox(mlist, NULL, NULL, NULL, NULL, 1, 0);
if(mbox != NULL)
{
free(streamurl), streamurl = NULL;
debug(99, "mbox->name %s", mbox->name);
debug(99, "mbox->text %s", mbox->text);
streamurl = ostrcat(mbox->text, NULL, 0, 0);
}
}
}
free(tmpstr); tmpstr = NULL;
free(ip), ip = NULL;
titheklog(debuglevel, "/tmp/zdf2_streamurl", NULL, streamurl);
// segfault munmap_chunk(): invalid pointer
// free(pos), pos = NULL;
// free(path), path = NULL;
debug(99, "streamurl: %s", streamurl);
return streamurl;
}
#endif