1 | #ifndef TITHEK_GLOBAL_H |
---|
2 | #define TITHEK_GLOBAL |
---|
3 | |
---|
4 | #include <curl/curl.h> |
---|
5 | |
---|
6 | struct MemoryStruct { |
---|
7 | char *memory; |
---|
8 | size_t size; |
---|
9 | }; |
---|
10 | |
---|
11 | static size_t |
---|
12 | WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) |
---|
13 | { |
---|
14 | size_t realsize = size * nmemb; |
---|
15 | struct MemoryStruct *mem = (struct MemoryStruct *)userp; |
---|
16 | |
---|
17 | mem->memory = realloc(mem->memory, mem->size + realsize + 1); |
---|
18 | if(mem->memory == NULL) { |
---|
19 | /* out of memory! */ |
---|
20 | printf("not enough memory (realloc returned NULL)\n"); |
---|
21 | return 0; |
---|
22 | } |
---|
23 | |
---|
24 | memcpy(&(mem->memory[mem->size]), contents, realsize); |
---|
25 | mem->size += realsize; |
---|
26 | mem->memory[mem->size] = 0; |
---|
27 | |
---|
28 | return realsize; |
---|
29 | } |
---|
30 | |
---|
31 | // flag = 0 (without header in output) |
---|
32 | // flag = 1 (with header in output) |
---|
33 | char* gethttps(char* url, char* localfile, char* data, char* user, char* pass, int flag) |
---|
34 | { |
---|
35 | debug(99, "url: %s", url); |
---|
36 | |
---|
37 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
38 | |
---|
39 | char* tmpstr = NULL; |
---|
40 | FILE *fp; |
---|
41 | |
---|
42 | CURL *curl_handle; |
---|
43 | CURLcode res; |
---|
44 | |
---|
45 | struct MemoryStruct chunk; |
---|
46 | |
---|
47 | chunk.memory = malloc(1); /* will be grown as needed by the realloc above */ |
---|
48 | chunk.size = 0; /* no data at this point */ |
---|
49 | |
---|
50 | curl_global_init(CURL_GLOBAL_ALL); |
---|
51 | |
---|
52 | /* init the curl session */ |
---|
53 | curl_handle = curl_easy_init(); |
---|
54 | if(curl_handle) |
---|
55 | { |
---|
56 | if(localfile != NULL) |
---|
57 | fp = fopen(localfile,"wb"); |
---|
58 | |
---|
59 | /* specify URL to get */ |
---|
60 | curl_easy_setopt(curl_handle, CURLOPT_URL, url); |
---|
61 | |
---|
62 | if(user != NULL && pass != NULL) |
---|
63 | { |
---|
64 | curl_easy_setopt(curl_handle, CURLOPT_USERNAME, user); |
---|
65 | curl_easy_setopt(curl_handle, CURLOPT_PASSWORD, pass); |
---|
66 | curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY); |
---|
67 | } |
---|
68 | if(data == NULL) |
---|
69 | curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1L); |
---|
70 | else |
---|
71 | curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, data); |
---|
72 | if(flag == 1) |
---|
73 | curl_easy_setopt(curl_handle, CURLOPT_HEADER, 1L); |
---|
74 | curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 5); |
---|
75 | curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 20); |
---|
76 | /* send all data to this function */ |
---|
77 | if(localfile == NULL) |
---|
78 | curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); |
---|
79 | else |
---|
80 | curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, NULL); |
---|
81 | |
---|
82 | /* we pass our 'chunk' struct to the callback function */ |
---|
83 | if(localfile == NULL) |
---|
84 | curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); |
---|
85 | else |
---|
86 | curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, fp); |
---|
87 | |
---|
88 | /* some servers don't like requests that are made without a user-agent field, so we provide one */ |
---|
89 | curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); |
---|
90 | |
---|
91 | // This is occassionally required to stop CURL from verifying the peers certificate. |
---|
92 | // CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if |
---|
93 | // CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2 - check the existence of a |
---|
94 | // common name and also verify that it matches the hostname provided) |
---|
95 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); |
---|
96 | |
---|
97 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L); |
---|
98 | if(debuglevel == 99) |
---|
99 | curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1); |
---|
100 | curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, "/mnt/network/cookies"); |
---|
101 | curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, "/mnt/network/cookies"); |
---|
102 | curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); |
---|
103 | curl_easy_setopt(curl_handle, CURLOPT_AUTOREFERER, 1L); |
---|
104 | |
---|
105 | /* get it! */ |
---|
106 | res = curl_easy_perform(curl_handle); |
---|
107 | /* check for errors */ |
---|
108 | if(res != CURLE_OK) |
---|
109 | { |
---|
110 | err("failed: %s", curl_easy_strerror(res)); |
---|
111 | printf("curl error\n"); |
---|
112 | } |
---|
113 | else |
---|
114 | { |
---|
115 | /* |
---|
116 | * Now, our chunk.memory points to a memory block that is chunk.size |
---|
117 | * bytes big and contains the remote file. |
---|
118 | * |
---|
119 | * Do something nice with it! |
---|
120 | */ |
---|
121 | printf("%lu bytes retrieved\n", (long)chunk.size); |
---|
122 | } |
---|
123 | |
---|
124 | /* cleanup curl stuff */ |
---|
125 | curl_easy_cleanup(curl_handle); |
---|
126 | if(localfile != NULL) |
---|
127 | fclose(fp); |
---|
128 | } |
---|
129 | |
---|
130 | tmpstr = ostrcat(chunk.memory, NULL, 0, 0); |
---|
131 | free(chunk.memory); |
---|
132 | /* we're done with libcurl, so clean it up */ |
---|
133 | curl_global_cleanup(); |
---|
134 | |
---|
135 | if(localfile != NULL) |
---|
136 | free(tmpstr), tmpstr = NULL; |
---|
137 | return tmpstr; |
---|
138 | } |
---|
139 | |
---|
140 | char* string_decode3(char* input) |
---|
141 | { |
---|
142 | if(input == NULL) return input; |
---|
143 | |
---|
144 | input = string_replace_all("Ä", "Ae", input, 1); |
---|
145 | input = string_replace_all("É", "E", input, 1); |
---|
146 | input = string_replace_all("é", "e", input, 1); |
---|
147 | input = string_replace_all("Ö", "Oe", input, 1); |
---|
148 | input = string_replace_all("ö", "oe", input, 1); |
---|
149 | input = string_replace_all("Ü", "Ue", input, 1); |
---|
150 | input = string_replace_all("ü", "ue", input, 1); |
---|
151 | input = string_replace_all("ß", "ss", input, 1); |
---|
152 | input = string_replace_all("&", "&", input, 1); |
---|
153 | |
---|
154 | input = string_replace_all("Ä", "Ae", input, 1); |
---|
155 | input = string_replace_all("É", "E", input, 1); |
---|
156 | input = string_replace_all("é", "e", input, 1); |
---|
157 | input = string_replace_all("Ö", "Oe", input, 1); |
---|
158 | input = string_replace_all("ö", "oe", input, 1); |
---|
159 | input = string_replace_all("Ü", "Ue", input, 1); |
---|
160 | input = string_replace_all("ü", "ue", input, 1); |
---|
161 | input = string_replace_all("ß", "ss", input, 1); |
---|
162 | input = string_replace_all("&", "&", input, 1); |
---|
163 | |
---|
164 | return input; |
---|
165 | } |
---|
166 | |
---|
167 | char* getfilekey(char* w, char* i, char* s, char* e) |
---|
168 | { |
---|
169 | char* ret = NULL; |
---|
170 | |
---|
171 | if(w == NULL || i == NULL || s == NULL || e == NULL) |
---|
172 | return NULL; |
---|
173 | |
---|
174 | int a = 0, b = 0, c = 0; |
---|
175 | int a1 = 0, b1 = 0; |
---|
176 | |
---|
177 | int lw = strlen(w); |
---|
178 | int li = strlen(i); |
---|
179 | int ls = strlen(s); |
---|
180 | |
---|
181 | if(lw < 5 || li < 5 || ls < 5) |
---|
182 | return NULL; |
---|
183 | |
---|
184 | char ca[lw + li + ls - 14]; |
---|
185 | char cb[16]; |
---|
186 | |
---|
187 | ca[lw + li + ls - 15] = '\0'; |
---|
188 | cb[15] = '\0'; |
---|
189 | |
---|
190 | while(1) |
---|
191 | { |
---|
192 | if(a < 5) |
---|
193 | { |
---|
194 | cb[b1] = w[a]; |
---|
195 | b1++; |
---|
196 | } |
---|
197 | else if(a < lw) |
---|
198 | { |
---|
199 | ca[a1] = w[a]; |
---|
200 | a1++; |
---|
201 | } |
---|
202 | a++; |
---|
203 | |
---|
204 | if(b < 5) |
---|
205 | { |
---|
206 | cb[b1] = i[b]; |
---|
207 | b1++; |
---|
208 | } |
---|
209 | else if(b < li) |
---|
210 | { |
---|
211 | ca[a1] = i[b]; |
---|
212 | a1++; |
---|
213 | } |
---|
214 | b++; |
---|
215 | |
---|
216 | if(c < 5) |
---|
217 | { |
---|
218 | cb[b1] = s[c]; |
---|
219 | b1++; |
---|
220 | } |
---|
221 | else if(c < ls) |
---|
222 | { |
---|
223 | ca[a1] = s[c]; |
---|
224 | a1++; |
---|
225 | } |
---|
226 | c++; |
---|
227 | |
---|
228 | if(lw + li + ls == a1 + b1) |
---|
229 | break; |
---|
230 | } |
---|
231 | |
---|
232 | b = 0; |
---|
233 | int d = 0; |
---|
234 | char cc[a1 / 2 + 1]; |
---|
235 | char casub[3] = {'\0'}; |
---|
236 | cc[a1 / 2] = '\0'; |
---|
237 | |
---|
238 | for(a = 0; a < a1; a += 2) |
---|
239 | { |
---|
240 | int c = -1; |
---|
241 | |
---|
242 | if(cb[b] % 2) c = 1; |
---|
243 | |
---|
244 | casub[0] = ca[a]; |
---|
245 | casub[1] = ca[a + 1]; |
---|
246 | |
---|
247 | cc[d] = strtol(casub, '\0', 36) - c; |
---|
248 | b++; d++; |
---|
249 | if(b >= b1) b = 0; |
---|
250 | } |
---|
251 | |
---|
252 | char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL; |
---|
253 | char* pos = ostrstr(cc, ");}('"); |
---|
254 | if(pos != NULL) |
---|
255 | { |
---|
256 | r1 = string_resub(");}('", "'", pos, 0); |
---|
257 | pos = ostrstr(pos + 5, ",'"); |
---|
258 | if(pos != NULL) |
---|
259 | { |
---|
260 | r2 = string_resub(",'", "'", pos, 0); |
---|
261 | pos = ostrstr(pos + 2, ",'"); |
---|
262 | if(pos != NULL) |
---|
263 | { |
---|
264 | r3 = string_resub(",'", "'", pos, 0); |
---|
265 | pos = ostrstr(pos + 2, ",'"); |
---|
266 | if(pos != NULL) |
---|
267 | { |
---|
268 | r4 = string_resub(",'", "'", pos, 0); |
---|
269 | ret = getfilekey(r1, r2, r3, r4); |
---|
270 | } |
---|
271 | } |
---|
272 | } |
---|
273 | } |
---|
274 | else |
---|
275 | { |
---|
276 | ret = string_resub("ll=\"", "\"", cc, 0); |
---|
277 | if(ret == NULL) |
---|
278 | ret = string_resub("filekey=\"", "\"", cc, 0); |
---|
279 | } |
---|
280 | |
---|
281 | free(r1); r1 = NULL; |
---|
282 | free(r2); r2 = NULL; |
---|
283 | free(r3); r3 = NULL; |
---|
284 | free(r4); r4 = NULL; |
---|
285 | |
---|
286 | return ret; |
---|
287 | } |
---|
288 | |
---|
289 | char* hoster(char* url) |
---|
290 | { |
---|
291 | debug(99, "url: %s", url); |
---|
292 | char* streamurl = NULL, *tmplink = NULL; |
---|
293 | |
---|
294 | /* |
---|
295 | if re.match(".*?http://www.putlocker.com/(file|embed)/", link, re.S): |
---|
296 | elif re.match(".*?http://www.sockshare.com/(file|embed)/", link, re.S): |
---|
297 | elif re.match(".*?http://www.videoslasher.com/embed/", link, re.S): |
---|
298 | elif re.match('.*?http://faststream.in', link, re.S): |
---|
299 | elif re.match('.*?http:/.*?flashx.tv', link, re.S): |
---|
300 | elif re.match('.*?http://streamcloud.eu', link, re.S): |
---|
301 | elif re.match('.*?http://vidstream.in', link, re.S): |
---|
302 | elif re.match('.*?http://xvidstage.com', link, re.S): |
---|
303 | elif re.match('.*?http://embed.nowvideo.eu', link, re.S): |
---|
304 | elif re.match('.*?.movshare.net', link, re.S): |
---|
305 | elif re.match('.*?(embed.divxstage.eu|divxstage.eu/video)', link, re.S): |
---|
306 | elif re.match('.*?videoweed.es', link, re.S): |
---|
307 | elif re.match('.*?novamov.com', link, re.S): |
---|
308 | elif re.match('.*primeshare', link, re.S): |
---|
309 | elif re.match('.*?videomega.tv', link, re.S): |
---|
310 | elif re.match('.*?bitshare.com', link, re.S): |
---|
311 | elif re.match('.*?http://movreel.com/', link, re.S): |
---|
312 | elif re.match('.*?uploadc.com', link, re.S): |
---|
313 | elif re.match('.*?http://filenuke.com', link, re.S): |
---|
314 | elif re.match('.*?http://www.youtube.com/watch', link, re.S): |
---|
315 | elif re.match('.*?http://www.mightyupload.com/embed', link, re.S): |
---|
316 | elif re.match('.*?180upload', link, re.S): |
---|
317 | elif re.match('.*?ecostream.tv', link, re.S): |
---|
318 | |
---|
319 | tmplink = ostrcat(url, NULL, 0, 0); |
---|
320 | |
---|
321 | if(ostrstr(tmpstr, "/Out/?s=") != NULL) |
---|
322 | { |
---|
323 | tmplink = string_replace("/Out/?s=", "", tmplink, 1); |
---|
324 | debug(99, "remove out string: %s", tmplink); |
---|
325 | } |
---|
326 | |
---|
327 | |
---|
328 | if(ostrcmp(tmphname, "Sockshare") == 0) |
---|
329 | hname = ostrcat("Sockshare.com", NULL, 0, 0); |
---|
330 | else if(ostrcmp(tmphname, "Putlocker") == 0) |
---|
331 | hname = ostrcat("Putlocker.com", NULL, 0, 0); |
---|
332 | else if(ostrcmp(tmphname, "Filenuke") == 0) |
---|
333 | hname = ostrcat("FileNuke.com", NULL, 0, 0); |
---|
334 | else if(ostrcmp(tmphname, "Streamclou") == 0) |
---|
335 | hname = ostrcat("StreamCloud.eu", NULL, 0, 0); |
---|
336 | else if(ostrcmp(tmphname, "Streamcloud") == 0) |
---|
337 | hname = ostrcat("StreamCloud.eu", NULL, 0, 0); |
---|
338 | else if(ostrcmp(tmphname, "VidStream") == 0) |
---|
339 | hname = ostrcat("VidStream.in", NULL, 0, 0); |
---|
340 | else if(ostrcmp(tmphname, "Flashx") == 0) |
---|
341 | hname = ostrcat("FlashX.tv", NULL, 0, 0); |
---|
342 | else if(ostrcmp(tmphname, "PrimeShare") == 0) |
---|
343 | hname = ostrcat("PrimeShare.tv", NULL, 0, 0); |
---|
344 | else if(ostrcmp(tmphname, "Xvidstage") == 0) |
---|
345 | hname = ostrcat("XvidStage.com", NULL, 0, 0); |
---|
346 | else if(ostrcmp(tmphname, "Nowvideo") == 0) |
---|
347 | hname = ostrcat("NowVideo.eu", NULL, 0, 0); |
---|
348 | else if(ostrcmp(tmphname, "Movshare") == 0) |
---|
349 | hname = ostrcat("MovShare.net", NULL, 0, 0); |
---|
350 | else if(ostrcmp(tmphname, "MovReel") == 0) |
---|
351 | hname = ostrcat("MovReel.com", NULL, 0, 0); |
---|
352 | else if(ostrcmp(tmphname, "NovaMov") == 0) |
---|
353 | hname = ostrcat("NovaMov", NULL, 0, 0); |
---|
354 | else if(ostrcmp(tmphname, "DivXStage") == 0) |
---|
355 | hname = ostrcat("DivXStage", NULL, 0, 0); |
---|
356 | else if(ostrcmp(tmphname, "PrimeShare") == 0) |
---|
357 | hname = ostrcat("PrimeShare.tv", NULL, 0, 0); |
---|
358 | else |
---|
359 | { |
---|
360 | hname = ostrcat(tmphname, " (coming soon)", 0, 0); |
---|
361 | type = 66; |
---|
362 | } |
---|
363 | */ |
---|
364 | |
---|
365 | tmplink = ostrcat(url, NULL, 0, 0); |
---|
366 | string_tolower(tmplink); |
---|
367 | |
---|
368 | if(ostrstr(tmplink, "sockshare") != NULL) |
---|
369 | streamurl = putlocker(url); |
---|
370 | else if(ostrstr(tmplink, "putlocker") != NULL) |
---|
371 | streamurl = firedrive(url); |
---|
372 | else if(ostrstr(tmplink, "filenuke") != NULL) |
---|
373 | streamurl = filenuke(url); |
---|
374 | else if(ostrstr(tmplink, "streamcloud") != NULL) |
---|
375 | streamurl = streamcloud(url); |
---|
376 | else if(ostrstr(tmplink, "vidstream") != NULL) |
---|
377 | streamurl = vidstream(url); |
---|
378 | else if(ostrstr(tmplink, "flashx") != NULL) |
---|
379 | streamurl = flashx(url); |
---|
380 | else if(ostrstr(tmplink, "xvidstage") != NULL) |
---|
381 | streamurl = xvidstage(url); |
---|
382 | else if(ostrstr(tmplink, "nowvideo") != NULL) |
---|
383 | streamurl = nowvideo(url); |
---|
384 | else if(ostrstr(tmplink, "movshare") != NULL) |
---|
385 | streamurl = movshare(url); |
---|
386 | else if(ostrstr(tmplink, "movreel") != NULL) |
---|
387 | streamurl = movreel(url); |
---|
388 | else if(ostrstr(tmplink, "novamov") != NULL) |
---|
389 | streamurl = novamov(url); |
---|
390 | else if(ostrstr(tmplink, "divxstage") != NULL || ostrstr(tmplink, "cloudtime") != NULL) |
---|
391 | streamurl = divxstage(url); |
---|
392 | else if(ostrstr(tmplink, "primeshare") != NULL) |
---|
393 | streamurl = primeshare(url); |
---|
394 | else if(ostrstr(tmplink, "faststream") != NULL || ostrstr(tmplink, "fastvideo") != NULL) |
---|
395 | streamurl = faststream(url); |
---|
396 | else if(ostrstr(tmplink, "played") != NULL) |
---|
397 | streamurl = played(url); |
---|
398 | else if(ostrstr(tmplink, "videoweed") != NULL) |
---|
399 | streamurl = videoweed(url); |
---|
400 | else if(ostrstr(tmplink, "firedrive") != NULL) |
---|
401 | streamurl = firedrive(url); |
---|
402 | else if(ostrstr(tmplink, "shared") != NULL) |
---|
403 | streamurl = shared(url); |
---|
404 | else if(ostrstr(tmplink, "thefile") != NULL) |
---|
405 | streamurl = thefile(url); |
---|
406 | else if(ostrstr(tmplink, "youtube") != NULL) |
---|
407 | streamurl = youtube(url); |
---|
408 | else if(ostrstr(tmplink, "myvideo") != NULL) |
---|
409 | streamurl = myvideo(url); |
---|
410 | else if(ostrstr(tmplink, "promptfile") != NULL) |
---|
411 | streamurl = promptfile(url); |
---|
412 | else if(ostrstr(tmplink, "letwatch") != NULL) |
---|
413 | streamurl = letwatch(url); |
---|
414 | else if(ostrstr(tmplink, "vidbull") != NULL) |
---|
415 | streamurl = vidbull(url); |
---|
416 | else if(ostrstr(tmplink, "vodlocker") != NULL) |
---|
417 | streamurl = vodlocker(url); |
---|
418 | else if(ostrstr(tmplink, "vidto") != NULL) |
---|
419 | streamurl = vidto(url); |
---|
420 | else if(ostrstr(tmplink, "amazon") != NULL) |
---|
421 | streamurl = amazon(url); |
---|
422 | else if(ostrstr(tmplink, "thevideo") != NULL) |
---|
423 | streamurl = thevideo(url); |
---|
424 | else |
---|
425 | textbox(_("Message"), _("The hoster is not yet supported !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
426 | |
---|
427 | |
---|
428 | debug(99, "Streamurl1: %s", streamurl); |
---|
429 | |
---|
430 | streamurl = string_replace_all("amp;", "", streamurl, 1); |
---|
431 | debug(99, "Streamurl2: %s", streamurl); |
---|
432 | |
---|
433 | free(tmplink), tmplink = NULL; |
---|
434 | if(ostrncmp("http", streamurl, 4) && ostrncmp("rtmp", streamurl, 4) && ostrncmp("mms", streamurl, 3) && ostrncmp("rtsp", streamurl, 4)) |
---|
435 | { |
---|
436 | printf("Streamurl3: not http*|rtmp*|mms*|rtsp* Streamurl: %s\n", streamurl); |
---|
437 | free(streamurl),streamurl = NULL; |
---|
438 | } |
---|
439 | |
---|
440 | return streamurl; |
---|
441 | } |
---|
442 | |
---|
443 | int screenlistbox(struct skin* grid, struct skin* listbox,struct skin* countlabel, char* title, char* titheklink, int* pagecount, int* tithekexit, int* oaktpage, int* oaktline, int* ogridcol, int flag, int cflag) |
---|
444 | { |
---|
445 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL; |
---|
446 | |
---|
447 | *oaktpage = listbox->aktpage; |
---|
448 | *oaktline = listbox->aktline; |
---|
449 | *ogridcol = listbox->gridcol; |
---|
450 | tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0); |
---|
451 | |
---|
452 | if(title != NULL) |
---|
453 | tmpstr1 = ostrcat(title, " - ", 0, 0); |
---|
454 | else |
---|
455 | tmpstr1 = ostrcat(((struct tithek*)listbox->select->handle)->menutitle, " - ", 0, 0); |
---|
456 | |
---|
457 | tmpstr2 = ostrcat(tmpstr1, ((struct tithek*)listbox->select->handle)->title, 1, 0); |
---|
458 | screentithekplay(tmpstr, tmpstr2, flag); |
---|
459 | free(tmpstr); tmpstr = NULL; |
---|
460 | free(tmpstr2); tmpstr2 = NULL; |
---|
461 | |
---|
462 | *pagecount = createtithekplay(titheklink, grid, listbox, countlabel, cflag); |
---|
463 | // if(pagecount == 0 || tithekexit == 1) break; |
---|
464 | if(*pagecount == 0 || *tithekexit == 1) return 0; |
---|
465 | |
---|
466 | listbox->aktpage = *oaktpage; |
---|
467 | listbox->aktline = *oaktline; |
---|
468 | listbox->gridcol = *ogridcol; |
---|
469 | addscreenrc(grid, listbox); |
---|
470 | |
---|
471 | return 1; |
---|
472 | } |
---|
473 | |
---|
474 | int all_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
475 | { |
---|
476 | char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL; |
---|
477 | int ret = 1, count = 0, i = 0; |
---|
478 | |
---|
479 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
480 | return ret; |
---|
481 | |
---|
482 | if(searchstr == NULL) |
---|
483 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
484 | else |
---|
485 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
486 | |
---|
487 | if(search != NULL) |
---|
488 | { |
---|
489 | drawscreen(load, 0, 0); |
---|
490 | |
---|
491 | strstrip(search); |
---|
492 | string_tolower(search); |
---|
493 | |
---|
494 | tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/all/all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0); |
---|
495 | |
---|
496 | struct splitstr* ret1 = NULL; |
---|
497 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
498 | |
---|
499 | if(ret1 != NULL) |
---|
500 | { |
---|
501 | int max = count; |
---|
502 | for(i = 0; i < max; i++) |
---|
503 | { |
---|
504 | |
---|
505 | tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
506 | tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0'); |
---|
507 | string_tolower(tmpstr1); |
---|
508 | |
---|
509 | if(ostrstr(tmpstr1, search) != NULL) |
---|
510 | { |
---|
511 | printf("found: %s\n", ret1[i].part); |
---|
512 | int rcret = waitrc(NULL, 10, 0); |
---|
513 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
514 | |
---|
515 | line = ostrcat(line, ret1[i].part, 1, 0); |
---|
516 | line = ostrcat(line, "\n", 0, 0); |
---|
517 | } |
---|
518 | free(tmpstr1), tmpstr1 = NULL; |
---|
519 | } |
---|
520 | free(ret1), ret1 = NULL; |
---|
521 | |
---|
522 | if(line != NULL) |
---|
523 | { |
---|
524 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
525 | menu = ostrcat("/tmp/tithek/all.search.list", NULL, 0, 0); |
---|
526 | writesys(menu, line, 0); |
---|
527 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
528 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
529 | ret = 0; |
---|
530 | } |
---|
531 | } |
---|
532 | free(tmpstr), tmpstr = NULL; |
---|
533 | } |
---|
534 | free(search), search = NULL; |
---|
535 | return ret; |
---|
536 | } |
---|
537 | |
---|
538 | #endif |
---|