source: titan/plugins/tithek/nowvideo.h @ 20021

Last change on this file since 20021 was 20021, checked in by obi, 10 years ago

[titan] tithek add solarmovie first step

File size: 2.6 KB
Line 
1#ifndef NOWVIDEO_H
2#define NOWVIDEO_H
3
4char* nowvideo(char* host, char* file)
5{
6        debug(99, "in host: %s file: %s", host, file);
7        char* tmphost = NULL;
8        char* tmpfile = NULL;
9        char* tmpstr = NULL;
10        char* send = NULL;
11        char* ip = NULL;
12        char* streamlink = NULL;
13        char* filekey = NULL;
14       
15        if(host == NULL || file == NULL) return NULL;
16
17        tmphost = ostrcat(tmphost, host, 1, 0);
18        tmpfile = ostrcat("/video/", file, 0, 0);
19       
20        debug(99, "tmphost: %s", tmphost);
21        ip = get_ip(tmphost);
22        debug(99, "ip: %s", ip);
23        debug(99, "tmpfile: %s", tmpfile);
24
25        send = ostrcat(send, "GET /video/", 1, 0);
26        send = ostrcat(send, file, 1, 0);
27        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
28        send = ostrcat(send, host, 1, 0);
29        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);
30        debug(99, "send: %s", send);
31
32        tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
33
34        if(getconfigint("debuglevel", NULL) == 99)
35                writesys("/tmp/nowvideo1", tmpstr, 0);
36
37        if(ostrstr(tmpstr, "The file is being transfered to our other servers. This may take few minutes.") != NULL)
38        {
39                textbox(_("Message"), _("The file is being transfered to our other servers. This may take few minutes.") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
40                goto end;
41        }
42
43        file = string_resub("flashvars.file=\"", "\";", tmpstr, 0);
44        filekey = string_resub("flashvars.filekey=\"", "\";", tmpstr, 0);
45
46        free(tmpfile), tmpfile = NULL;
47        tmpfile = ostrcat("/api/player.api.php?file=", file, 0, 0);
48        tmpfile = ostrcat(tmpfile, "&key=", 1, 0);
49        tmpfile = ostrcat(tmpfile, filekey, 1, 0);
50
51        free(send), send = NULL;
52        send = ostrcat(send, "GET ", 1, 0);
53        send = ostrcat(send, tmpfile, 1, 0);
54        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
55        send = ostrcat(send, host, 1, 0);
56        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);
57        debug(99, "send: %s", send);
58        free(tmpstr), tmpstr = NULL;
59        tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
60
61        if(getconfigint("debuglevel", NULL) == 99)
62                writesys("/tmp/nowvideo2", tmpstr, 0);
63
64        sleep(1);
65        streamlink = string_resub("url=", "&", tmpstr, 0);
66end:
67        free(tmphost); tmphost = NULL;
68        free(tmpfile); tmpfile = NULL;
69        free(tmpstr); tmpstr = NULL;
70        free(send); send = NULL;
71        free(filekey); filekey = NULL;
72        free(ip); ip = NULL;
73
74        return streamlink;
75}
76
77#endif
Note: See TracBrowser for help on using the repository browser.