1 | #ifndef INTERNETTV_H |
---|
2 | #define INTERNETTV_H |
---|
3 | |
---|
4 | int internettv_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
5 | { |
---|
6 | char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL; |
---|
7 | int ret = 1, count = 0, i = 0; |
---|
8 | |
---|
9 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
10 | return ret; |
---|
11 | |
---|
12 | if(searchstr == NULL) |
---|
13 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
14 | else |
---|
15 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
16 | |
---|
17 | if(search != NULL) |
---|
18 | { |
---|
19 | drawscreen(load, 0, 0); |
---|
20 | |
---|
21 | strstrip(search); |
---|
22 | string_tolower(search); |
---|
23 | |
---|
24 | tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/internettv/streams/internettv.all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0); |
---|
25 | |
---|
26 | struct splitstr* ret1 = NULL; |
---|
27 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
28 | |
---|
29 | if(ret1 != NULL) |
---|
30 | { |
---|
31 | int max = count; |
---|
32 | for(i = 0; i < max; i++) |
---|
33 | { |
---|
34 | |
---|
35 | tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
36 | tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0'); |
---|
37 | string_tolower(tmpstr1); |
---|
38 | |
---|
39 | if(ostrstr(tmpstr1, search) != NULL) |
---|
40 | { |
---|
41 | printf("found: %s\n", ret1[i].part); |
---|
42 | int rcret = waitrc(NULL, 10, 0); |
---|
43 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
44 | |
---|
45 | line = ostrcat(line, ret1[i].part, 1, 0); |
---|
46 | line = ostrcat(line, "\n", 0, 0); |
---|
47 | } |
---|
48 | free(tmpstr1), tmpstr1 = NULL; |
---|
49 | } |
---|
50 | free(ret1), ret1 = NULL; |
---|
51 | |
---|
52 | if(line != NULL) |
---|
53 | { |
---|
54 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
55 | menu = ostrcat("/tmp/tithek/internettv.search.list", NULL, 0, 0); |
---|
56 | writesys(menu, line, 0); |
---|
57 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
58 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->description, tnode->flag); |
---|
59 | ret = 0; |
---|
60 | } |
---|
61 | } |
---|
62 | free(tmpstr), tmpstr = NULL; |
---|
63 | } |
---|
64 | free(search), search = NULL; |
---|
65 | return ret; |
---|
66 | } |
---|
67 | |
---|
68 | #endif |
---|