1 | #ifndef BEEG_H |
---|
2 | #define BEEG_H |
---|
3 | |
---|
4 | char* beeg(char* link) |
---|
5 | { |
---|
6 | debug(99, "link %s", link); |
---|
7 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
8 | char* ip = NULL, *pos = NULL, *path = NULL, *streamurl = NULL, *tmpstr = NULL; |
---|
9 | |
---|
10 | ip = string_replace("http://", "", (char*)link, 0); |
---|
11 | |
---|
12 | if(ip != NULL) |
---|
13 | pos = strchr(ip, '/'); |
---|
14 | if(pos != NULL) |
---|
15 | { |
---|
16 | pos[0] = '\0'; |
---|
17 | path = pos + 1; |
---|
18 | } |
---|
19 | |
---|
20 | tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
21 | titheklog(debuglevel, "/tmp/beeg1_tmpstr", NULL, tmpstr); |
---|
22 | |
---|
23 | if(tmpstr != NULL) |
---|
24 | { |
---|
25 | streamurl = string_resub("'file': '","',",tmpstr,0); |
---|
26 | } |
---|
27 | |
---|
28 | free(tmpstr); tmpstr = NULL; |
---|
29 | free(ip), ip = NULL; |
---|
30 | |
---|
31 | titheklog(debuglevel, "/tmp/beeg2_streamurl", NULL, streamurl); |
---|
32 | |
---|
33 | // segfault munmap_chunk(): invalid pointer |
---|
34 | // free(pos), pos = NULL; |
---|
35 | // free(path), path = NULL; |
---|
36 | |
---|
37 | debug(99, "streamurl: %s", streamurl); |
---|
38 | return streamurl; |
---|
39 | } |
---|
40 | |
---|
41 | #endif |
---|