1 | #ifndef TITHEK_H |
---|
2 | #define TITHEK_H |
---|
3 | |
---|
4 | #define TITHEKPATH "/tmp/tithek" |
---|
5 | |
---|
6 | //flag 0 - menu |
---|
7 | //flag 1 - menu pay hidden tithek_pay=0/1 0=hidden |
---|
8 | //flag 2 - http (default streamurl) |
---|
9 | //flag 4 - youtube |
---|
10 | //flag 5 - rtl2now |
---|
11 | //flag 6 - superrtlnow |
---|
12 | //flag 7 - rtlnow |
---|
13 | //flag 8 - voxnow |
---|
14 | //flag 9 - youtube suche 10 |
---|
15 | //flag 10 - youtube suche 25 |
---|
16 | //flag 11 - youtube suche 50 |
---|
17 | //flag 12 - myvideo |
---|
18 | //flag 13 - myvideo search 50 |
---|
19 | //flag 14 - kinox putlocker/sockshare |
---|
20 | //flag 15 - kinox filenuke |
---|
21 | //flag 16 - superrtlnow pay |
---|
22 | //flag 17 - rtlnow pay |
---|
23 | //flag 18 - voxnow pay |
---|
24 | //flag 19 - rtl2now pay |
---|
25 | //flag 20 - kinox StreamCloud |
---|
26 | //flag 21 - kinox search |
---|
27 | //flag 22 - kinox hoster |
---|
28 | //flag 23 - kinox hoster serie |
---|
29 | //flag 66 - coming soon dummy |
---|
30 | //flag 1000 - menu pincode |
---|
31 | //flag 9999 - menu hidden codecpack |
---|
32 | |
---|
33 | struct tithek |
---|
34 | { |
---|
35 | char* title; |
---|
36 | char* link; |
---|
37 | char* pic; |
---|
38 | char* localname; |
---|
39 | char* menutitle; |
---|
40 | int flag; |
---|
41 | struct tithek* prev; |
---|
42 | struct tithek* next; |
---|
43 | }; |
---|
44 | struct tithek *tithek = NULL; |
---|
45 | |
---|
46 | struct tithek* addtithek(char *line, int count, struct tithek* last) |
---|
47 | { |
---|
48 | //debug(1000, "in"); |
---|
49 | struct tithek *newnode = NULL, *prev = NULL, *node = tithek; |
---|
50 | char *link = NULL, *pic = NULL, *title = NULL, *localname = NULL, *menutitle = NULL, *cmd = NULL; |
---|
51 | int ret = 0, skip = 0; |
---|
52 | |
---|
53 | if(line == NULL) return NULL; |
---|
54 | |
---|
55 | newnode = (struct tithek*)malloc(sizeof(struct tithek)); |
---|
56 | if(newnode == NULL) |
---|
57 | { |
---|
58 | err("no memory"); |
---|
59 | return NULL; |
---|
60 | } |
---|
61 | |
---|
62 | link = malloc(MINMALLOC); |
---|
63 | if(link == NULL) |
---|
64 | { |
---|
65 | err("no memory"); |
---|
66 | free(newnode); |
---|
67 | return NULL; |
---|
68 | } |
---|
69 | |
---|
70 | pic = malloc(MINMALLOC); |
---|
71 | if(pic == NULL) |
---|
72 | { |
---|
73 | err("no memory"); |
---|
74 | free(newnode); |
---|
75 | free(link); |
---|
76 | return NULL; |
---|
77 | } |
---|
78 | |
---|
79 | title = malloc(MINMALLOC); |
---|
80 | if(title == NULL) |
---|
81 | { |
---|
82 | err("no memory"); |
---|
83 | free(newnode); |
---|
84 | free(link); |
---|
85 | free(pic); |
---|
86 | return NULL; |
---|
87 | } |
---|
88 | |
---|
89 | localname = malloc(MINMALLOC); |
---|
90 | if(localname == NULL) |
---|
91 | { |
---|
92 | err("no memory"); |
---|
93 | free(newnode); |
---|
94 | free(link); |
---|
95 | free(pic); |
---|
96 | free(title); |
---|
97 | return NULL; |
---|
98 | } |
---|
99 | |
---|
100 | menutitle = malloc(MINMALLOC); |
---|
101 | if(menutitle == NULL) |
---|
102 | { |
---|
103 | err("no memory"); |
---|
104 | free(newnode); |
---|
105 | free(link); |
---|
106 | free(pic); |
---|
107 | free(title); |
---|
108 | free(localname); |
---|
109 | return NULL; |
---|
110 | } |
---|
111 | |
---|
112 | int pay = getconfigint("tithek_pay", NULL); |
---|
113 | |
---|
114 | memset(newnode, 0, sizeof(struct tithek)); |
---|
115 | |
---|
116 | ret = sscanf(line, "%[^#]#%[^#]#%[^#]#%[^#]#%[^#]#%d", title, link, pic, localname, menutitle, &newnode->flag); |
---|
117 | |
---|
118 | if(newnode->flag == 9999 && !file_exist("/var/swap/etc/.codecpack")) |
---|
119 | { |
---|
120 | skip = 1; |
---|
121 | } |
---|
122 | else if(newnode->flag == 16 && pay == 0) |
---|
123 | { |
---|
124 | skip = 1; |
---|
125 | } |
---|
126 | else if(newnode->flag == 17 && pay == 0) |
---|
127 | { |
---|
128 | skip = 1; |
---|
129 | } |
---|
130 | else if(newnode->flag == 18 && pay == 0) |
---|
131 | { |
---|
132 | skip = 1; |
---|
133 | } |
---|
134 | else if(newnode->flag == 19 && pay == 0) |
---|
135 | { |
---|
136 | skip = 1; |
---|
137 | } |
---|
138 | else if(newnode->flag == 1 && pay == 0) |
---|
139 | { |
---|
140 | skip = 1; |
---|
141 | } |
---|
142 | else if(newnode->flag == 9999) |
---|
143 | { |
---|
144 | cmd = ostrcat(cmd, "wget -s http://", 1, 0); |
---|
145 | cmd = ostrcat(cmd, "kin", 1, 0); |
---|
146 | cmd = ostrcat(cmd, "ox", 1, 0); |
---|
147 | cmd = ostrcat(cmd, ".", 1, 0); |
---|
148 | cmd = ostrcat(cmd, "to", 1, 0); |
---|
149 | |
---|
150 | if(system(cmd) != 0) |
---|
151 | skip = 1; |
---|
152 | |
---|
153 | free(cmd), cmd = NULL; |
---|
154 | } |
---|
155 | |
---|
156 | if(skip == 1) |
---|
157 | { |
---|
158 | free(link); |
---|
159 | free(pic); |
---|
160 | free(title); |
---|
161 | free(localname); |
---|
162 | free(menutitle); |
---|
163 | free(newnode); |
---|
164 | return NULL; |
---|
165 | } |
---|
166 | |
---|
167 | if(ret != 6) |
---|
168 | { |
---|
169 | if(count > 0) |
---|
170 | { |
---|
171 | err("tithek line %d not ok or double", count); |
---|
172 | } |
---|
173 | else |
---|
174 | { |
---|
175 | err("add tithek"); |
---|
176 | } |
---|
177 | free(link); |
---|
178 | free(pic); |
---|
179 | free(title); |
---|
180 | free(localname); |
---|
181 | free(menutitle); |
---|
182 | free(newnode); |
---|
183 | return NULL; |
---|
184 | } |
---|
185 | |
---|
186 | newnode->link = ostrcat(link, "", 1, 0); |
---|
187 | newnode->pic = ostrcat(pic, "", 1, 0); |
---|
188 | newnode->title = ostrcat(title, "", 1, 0); |
---|
189 | newnode->localname = ostrcat(localname, "", 1, 0); |
---|
190 | newnode->menutitle = ostrcat(menutitle, "", 1, 0); |
---|
191 | |
---|
192 | if(last == NULL) |
---|
193 | { |
---|
194 | while(node != NULL) |
---|
195 | { |
---|
196 | prev = node; |
---|
197 | node = node->next; |
---|
198 | } |
---|
199 | } |
---|
200 | else |
---|
201 | { |
---|
202 | prev = last; |
---|
203 | node = last->next; |
---|
204 | } |
---|
205 | |
---|
206 | if(prev == NULL) |
---|
207 | tithek = newnode; |
---|
208 | else |
---|
209 | { |
---|
210 | prev->next = newnode; |
---|
211 | newnode->prev = prev; |
---|
212 | } |
---|
213 | newnode->next = node; |
---|
214 | if(node != NULL) node->prev = newnode; |
---|
215 | |
---|
216 | //debug(1000, "out"); |
---|
217 | return newnode; |
---|
218 | } |
---|
219 | |
---|
220 | int readtithek(const char* filename) |
---|
221 | { |
---|
222 | debug(1000, "in"); |
---|
223 | FILE *fd = NULL; |
---|
224 | char *fileline = NULL; |
---|
225 | int linecount = 0; |
---|
226 | struct tithek* last = NULL, *tmplast = NULL; |
---|
227 | |
---|
228 | fileline = malloc(MINMALLOC); |
---|
229 | if(fileline == NULL) |
---|
230 | { |
---|
231 | err("no memory"); |
---|
232 | return 0; |
---|
233 | } |
---|
234 | |
---|
235 | fd = fopen(filename, "r"); |
---|
236 | if(fd == NULL) |
---|
237 | { |
---|
238 | perr("can't open %s", filename); |
---|
239 | free(fileline); |
---|
240 | return 0; |
---|
241 | } |
---|
242 | |
---|
243 | while(fgets(fileline, MINMALLOC, fd) != NULL) |
---|
244 | { |
---|
245 | if(fileline[0] == '#' || fileline[0] == '\n') |
---|
246 | continue; |
---|
247 | if(fileline[strlen(fileline) - 1] == '\n') |
---|
248 | fileline[strlen(fileline) - 1] = '\0'; |
---|
249 | if(fileline[strlen(fileline) - 1] == '\r') |
---|
250 | fileline[strlen(fileline) - 1] = '\0'; |
---|
251 | |
---|
252 | linecount++; |
---|
253 | |
---|
254 | if(last == NULL) last = tmplast; |
---|
255 | last = addtithek(fileline, linecount, last); |
---|
256 | if(last != NULL) tmplast = last; |
---|
257 | } |
---|
258 | |
---|
259 | free(fileline); |
---|
260 | fclose(fd); |
---|
261 | return linecount; |
---|
262 | } |
---|
263 | |
---|
264 | int deltithek(char* link) |
---|
265 | { |
---|
266 | debug(1000, "in"); |
---|
267 | int ret = 1; |
---|
268 | struct tithek *node = tithek, *prev = tithek; |
---|
269 | |
---|
270 | while(node != NULL) |
---|
271 | { |
---|
272 | if(ostrcmp(link, node->link) == 0) |
---|
273 | { |
---|
274 | ret = 0; |
---|
275 | if(node == tithek) |
---|
276 | { |
---|
277 | tithek = node->next; |
---|
278 | if(tithek != NULL) |
---|
279 | tithek->prev = NULL; |
---|
280 | } |
---|
281 | else |
---|
282 | { |
---|
283 | prev->next = node->next; |
---|
284 | if(node->next != NULL) |
---|
285 | node->next->prev = prev; |
---|
286 | } |
---|
287 | |
---|
288 | free(node->link); |
---|
289 | node->link = NULL; |
---|
290 | |
---|
291 | free(node->pic); |
---|
292 | node->pic = NULL; |
---|
293 | |
---|
294 | free(node->title); |
---|
295 | node->title = NULL; |
---|
296 | |
---|
297 | free(node->localname); |
---|
298 | node->localname = NULL; |
---|
299 | |
---|
300 | free(node->menutitle); |
---|
301 | node->menutitle = NULL; |
---|
302 | |
---|
303 | free(node); |
---|
304 | node = NULL; |
---|
305 | |
---|
306 | break; |
---|
307 | } |
---|
308 | |
---|
309 | prev = node; |
---|
310 | node = node->next; |
---|
311 | } |
---|
312 | |
---|
313 | debug(1000, "out"); |
---|
314 | return ret; |
---|
315 | } |
---|
316 | |
---|
317 | void freetithek() |
---|
318 | { |
---|
319 | debug(1000, "in"); |
---|
320 | struct tithek *node = tithek, *prev = tithek; |
---|
321 | |
---|
322 | while(node != NULL) |
---|
323 | { |
---|
324 | prev = node; |
---|
325 | node = node->next; |
---|
326 | if(prev != NULL) |
---|
327 | deltithek(prev->link); |
---|
328 | } |
---|
329 | debug(1000, "out"); |
---|
330 | } |
---|
331 | |
---|
332 | char* tithekdownload(char* link, char* localname, char* pw, int pic, int flag) |
---|
333 | { |
---|
334 | int ret = 1; |
---|
335 | char* ip = NULL, *pos = NULL, *path = NULL; |
---|
336 | char* tmpstr = NULL, *localfile = NULL; |
---|
337 | |
---|
338 | if(link == NULL) return NULL; |
---|
339 | |
---|
340 | ip = string_replace("http://", "", (char*)link, 0); |
---|
341 | |
---|
342 | if(ip != NULL) |
---|
343 | pos = strchr(ip, '/'); |
---|
344 | if(pos != NULL) |
---|
345 | { |
---|
346 | pos[0] = '\0'; |
---|
347 | path = pos + 1; |
---|
348 | } |
---|
349 | |
---|
350 | tmpstr = ostrcat(path, NULL, 0, 0); |
---|
351 | |
---|
352 | if(flag == 0) |
---|
353 | { |
---|
354 | localfile = ostrcat(TITHEKPATH, "/", 0, 0); |
---|
355 | if(localname == NULL) |
---|
356 | localfile = ostrcat(localfile, basename(tmpstr), 1, 0); |
---|
357 | else |
---|
358 | localfile = ostrcat(localfile, localname, 1, 0); |
---|
359 | } |
---|
360 | else |
---|
361 | { |
---|
362 | localfile = ostrcat(getconfig("rec_path", NULL), "/", 0, 0); |
---|
363 | if(localname == NULL) |
---|
364 | localfile = ostrcat(localfile, basename(tmpstr), 1, 0); |
---|
365 | else |
---|
366 | localfile = ostrcat(localfile, localname, 1, 0); |
---|
367 | } |
---|
368 | |
---|
369 | if(flag == 0) |
---|
370 | { |
---|
371 | if(!file_exist(localfile)) |
---|
372 | { |
---|
373 | if(pic == 1) |
---|
374 | gethttp(ip, path, 80, localfile, pw, NULL, 0); |
---|
375 | else |
---|
376 | gethttp(ip, path, 80, localfile, pw, NULL, 0); |
---|
377 | } |
---|
378 | } |
---|
379 | else |
---|
380 | { |
---|
381 | if(file_exist(localfile)) |
---|
382 | ret = textbox(_("Message"), _("File exist, overwrite?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
383 | |
---|
384 | if(ret == 1) |
---|
385 | screendownload("Download", ip, path, 80, localfile, pw, 0); |
---|
386 | } |
---|
387 | |
---|
388 | free(ip); ip = NULL; |
---|
389 | free(tmpstr); tmpstr = NULL; |
---|
390 | |
---|
391 | return localfile; |
---|
392 | } |
---|
393 | |
---|
394 | int createtithekplay(char* titheklink, struct skin* grid, struct skin* listbox, struct skin* countlabel) |
---|
395 | { |
---|
396 | int gridbr = 0, posx = 0, count = 0, sumcount = 0, count1 = 0, pagecount = 0, skip = 0; |
---|
397 | struct skin* tmp = NULL; |
---|
398 | char* tithekfile = NULL; |
---|
399 | char* tmpstr = NULL; |
---|
400 | |
---|
401 | if(ostrstr(titheklink, "http://") != NULL) |
---|
402 | tithekfile = tithekdownload(titheklink, NULL, HTTPAUTH, 0, 0); |
---|
403 | else |
---|
404 | tithekfile = ostrcat(titheklink, NULL, 0, 0); |
---|
405 | |
---|
406 | delmarkedscreennodes(grid, 1); |
---|
407 | freetithek(); |
---|
408 | // if(readtithek(tithekfile) != 0) return 1; |
---|
409 | int linecount = readtithek(tithekfile); |
---|
410 | if(linecount == 0) return 1; |
---|
411 | |
---|
412 | struct tithek* titheknode = tithek; |
---|
413 | |
---|
414 | int height = 280; |
---|
415 | int width = 390; |
---|
416 | int picheight = 230; |
---|
417 | int picwidth = 370; |
---|
418 | int zcount = 3; |
---|
419 | int fontsize = 20; |
---|
420 | int pcount = 6; |
---|
421 | |
---|
422 | if(linecount > 8 && getconfigint("tithek_view", NULL) == 1) |
---|
423 | { |
---|
424 | height = 180; |
---|
425 | width = 295; |
---|
426 | picheight = 130; |
---|
427 | picwidth = 270; |
---|
428 | zcount = 4; |
---|
429 | fontsize = 18; |
---|
430 | pcount = 12; |
---|
431 | } |
---|
432 | |
---|
433 | while(titheknode != NULL) |
---|
434 | { |
---|
435 | tmp = addlistbox(grid, listbox, tmp, 1); |
---|
436 | if(tmp != NULL) |
---|
437 | { |
---|
438 | skip = 0; |
---|
439 | sumcount++; |
---|
440 | count++; |
---|
441 | count1++; |
---|
442 | if(gridbr == 0) |
---|
443 | tmp->type = GRIDBR; |
---|
444 | gridbr = 1; |
---|
445 | tmp->wrap = YES; |
---|
446 | |
---|
447 | tmp->picheight = picheight; |
---|
448 | tmp->picwidth = picwidth; |
---|
449 | |
---|
450 | tmp->fontsize = fontsize; |
---|
451 | tmp->height = height; |
---|
452 | tmp->width = width; |
---|
453 | tmp->prozwidth = 0; |
---|
454 | //tmp->bgcol = 0xffffff; |
---|
455 | tmp->bgspace = 1; |
---|
456 | tmp->vspace = 10; |
---|
457 | tmp->hspace = 10; |
---|
458 | tmp->posx = posx; |
---|
459 | //tmp->fontcol = 0x0000ff; |
---|
460 | tmp->halign = CENTER; |
---|
461 | tmp->valign = TEXTBOTTOM; |
---|
462 | changetext(tmp, titheknode->title); |
---|
463 | tmp->handle = (char*)titheknode; |
---|
464 | posx += tmp->width; |
---|
465 | if(count >= zcount) |
---|
466 | { |
---|
467 | count = 0; |
---|
468 | posx = 0; |
---|
469 | gridbr = 0; |
---|
470 | } |
---|
471 | |
---|
472 | if(count1 >= pcount) |
---|
473 | { |
---|
474 | count1 = 0; |
---|
475 | pagecount++; |
---|
476 | skip = 1; |
---|
477 | } |
---|
478 | } |
---|
479 | titheknode = titheknode->next; |
---|
480 | } |
---|
481 | |
---|
482 | if(skip == 0) |
---|
483 | pagecount++; |
---|
484 | |
---|
485 | tmpstr = oitoa(sumcount); |
---|
486 | |
---|
487 | char* tmpstr1 = ostrcat(_("found"), NULL, 0, 0); |
---|
488 | tmpstr1 = ostrcat(tmpstr1, " ", 1, 0); |
---|
489 | tmpstr1 = ostrcat(tmpstr1, tmpstr, 1, 0); |
---|
490 | free(tmpstr); tmpstr = NULL; |
---|
491 | tmpstr1 = ostrcat(tmpstr1, " ", 1, 0); |
---|
492 | tmpstr1 = ostrcat(tmpstr1, _("Results"), 1, 0); |
---|
493 | changetext(countlabel, tmpstr1); |
---|
494 | free(tmpstr1); tmpstr1 = NULL; |
---|
495 | |
---|
496 | free(tithekfile); tithekfile = NULL; |
---|
497 | return pagecount; |
---|
498 | } |
---|
499 | |
---|
500 | void removefav(char* title, char* link, char* pic, char* localname, char* menutitle, int flag) |
---|
501 | { |
---|
502 | int count = 0, i = 0; |
---|
503 | char* tmpstr = NULL, *tmpstr1 = NULL, *input = NULL; |
---|
504 | struct splitstr* ret = NULL; |
---|
505 | |
---|
506 | input = ostrcat(input, title, 1, 0); |
---|
507 | input = ostrcat(input, "#", 1, 0); |
---|
508 | input = ostrcat(input, link, 1, 0); |
---|
509 | input = ostrcat(input, "#", 1, 0); |
---|
510 | input = ostrcat(input, pic, 1, 0); |
---|
511 | input = ostrcat(input, "#", 1, 0); |
---|
512 | input = ostrcat(input, localname, 1, 0); |
---|
513 | input = ostrcat(input, "#", 1, 0); |
---|
514 | input = ostrcat(input, menutitle, 1, 0); |
---|
515 | input = ostrcat(input, "#", 1, 0); |
---|
516 | input = ostrcat(input, oitoa(flag), 1, 0); |
---|
517 | |
---|
518 | tmpstr = readfiletomem(getconfig("tithek_fav", NULL), 0); |
---|
519 | |
---|
520 | ret = strsplit(tmpstr, "\n", &count); |
---|
521 | |
---|
522 | if(ret != NULL) |
---|
523 | { |
---|
524 | for(i = 0; i < count; i++) |
---|
525 | { |
---|
526 | if(ostrcmp((ret[i]).part, input) != 0) |
---|
527 | { |
---|
528 | tmpstr1 = ostrcat(tmpstr1, ret[i].part, 1, 0); |
---|
529 | tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0); |
---|
530 | } |
---|
531 | else |
---|
532 | printf("remove: %s\n", ret[i].part); |
---|
533 | } |
---|
534 | } |
---|
535 | |
---|
536 | if(tmpstr1 != NULL && strlen(tmpstr1) > 0) |
---|
537 | tmpstr1[strlen(tmpstr1) - 1] = '\0'; |
---|
538 | |
---|
539 | writesys(getconfig("tithek_fav", NULL), tmpstr1, 0); |
---|
540 | |
---|
541 | free(ret); ret = NULL; |
---|
542 | free(tmpstr); tmpstr = NULL; |
---|
543 | free(tmpstr1); tmpstr1 = NULL; |
---|
544 | free(input); input = NULL; |
---|
545 | } |
---|
546 | |
---|
547 | void addfav(char* title, char* link, char* pic, char* localname, char* menutitle, int flag) |
---|
548 | { |
---|
549 | int count = 0, i = 0; |
---|
550 | char* tmpstr = NULL, *tmpstr1 = NULL, *input = NULL; |
---|
551 | struct splitstr* ret = NULL; |
---|
552 | |
---|
553 | input = ostrcat(input, title, 1, 0); |
---|
554 | input = ostrcat(input, "#", 1, 0); |
---|
555 | input = ostrcat(input, link, 1, 0); |
---|
556 | input = ostrcat(input, "#", 1, 0); |
---|
557 | input = ostrcat(input, pic, 1, 0); |
---|
558 | input = ostrcat(input, "#", 1, 0); |
---|
559 | input = ostrcat(input, localname, 1, 0); |
---|
560 | input = ostrcat(input, "#", 1, 0); |
---|
561 | input = ostrcat(input, menutitle, 1, 0); |
---|
562 | input = ostrcat(input, "#", 1, 0); |
---|
563 | input = ostrcat(input, oitoa(flag), 1, 0); |
---|
564 | |
---|
565 | tmpstr1 = ostrcat(tmpstr1, input, 1, 0); |
---|
566 | tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0); |
---|
567 | |
---|
568 | tmpstr = readfiletomem(getconfig("tithek_fav", NULL), 0); |
---|
569 | |
---|
570 | ret = strsplit(tmpstr, "\n", &count); |
---|
571 | |
---|
572 | if(ret != NULL) |
---|
573 | { |
---|
574 | for(i = 0; i < count; i++) |
---|
575 | { |
---|
576 | if(ostrcmp((ret[i]).part, input) != 0) |
---|
577 | { |
---|
578 | tmpstr1 = ostrcat(tmpstr1, ret[i].part, 1, 0); |
---|
579 | tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0); |
---|
580 | } |
---|
581 | } |
---|
582 | } |
---|
583 | |
---|
584 | if(tmpstr1 != NULL && strlen(tmpstr1) > 0) |
---|
585 | tmpstr1[strlen(tmpstr1) - 1] = '\0'; |
---|
586 | |
---|
587 | writesys(getconfig("tithek_fav", NULL), tmpstr1, 0); |
---|
588 | |
---|
589 | free(ret); ret = NULL; |
---|
590 | free(tmpstr); tmpstr = NULL; |
---|
591 | free(tmpstr1); tmpstr1 = NULL; |
---|
592 | free(input); input = NULL; |
---|
593 | } |
---|
594 | |
---|
595 | void submenu(struct skin* listbox, struct skin* load) |
---|
596 | { |
---|
597 | if(status.security == 1) |
---|
598 | { |
---|
599 | drawscreen(load, 0, 0); |
---|
600 | char* tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0); |
---|
601 | char* tmpstr1 = NULL; |
---|
602 | |
---|
603 | if(((struct tithek*)listbox->select->handle)->flag == 4) |
---|
604 | { |
---|
605 | if(tmpstr != NULL) tmpstr1 = youtube(tmpstr, NULL, NULL, 1); |
---|
606 | } |
---|
607 | else if(((struct tithek*)listbox->select->handle)->flag == 5) |
---|
608 | { |
---|
609 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl2now.rtl2.de", "rtl2now", 1); |
---|
610 | } |
---|
611 | else if(((struct tithek*)listbox->select->handle)->flag == 6) |
---|
612 | { |
---|
613 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.superrtlnow.de", "superrtlnow", 1); |
---|
614 | } |
---|
615 | else if(((struct tithek*)listbox->select->handle)->flag == 7) |
---|
616 | { |
---|
617 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl-now.rtl.de", "rtlnow", 1); |
---|
618 | } |
---|
619 | else if(((struct tithek*)listbox->select->handle)->flag == 8) |
---|
620 | { |
---|
621 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.voxnow.de", "voxnow", 1); |
---|
622 | } |
---|
623 | else if(((struct tithek*)listbox->select->handle)->flag == 12) |
---|
624 | { |
---|
625 | if(tmpstr != NULL) tmpstr1 = myvideo(tmpstr, NULL, NULL, 1); |
---|
626 | } |
---|
627 | else if(((struct tithek*)listbox->select->handle)->flag == 14) |
---|
628 | { |
---|
629 | if(tmpstr != NULL) tmpstr1 = kinox(tmpstr, NULL, NULL, 1); |
---|
630 | } |
---|
631 | else if(((struct tithek*)listbox->select->handle)->flag == 15) |
---|
632 | { |
---|
633 | if(tmpstr != NULL) tmpstr1 = kinox(tmpstr, NULL, NULL, 2); |
---|
634 | } |
---|
635 | else if(((struct tithek*)listbox->select->handle)->flag == 16) |
---|
636 | { |
---|
637 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.superrtlnow.de", "superrtlnow", 1); |
---|
638 | } |
---|
639 | else if(((struct tithek*)listbox->select->handle)->flag == 17) |
---|
640 | { |
---|
641 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl-now.rtl.de", "rtlnow", 1); |
---|
642 | } |
---|
643 | else if(((struct tithek*)listbox->select->handle)->flag == 18) |
---|
644 | { |
---|
645 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.voxnow.de", "voxnow", 1); |
---|
646 | } |
---|
647 | else if(((struct tithek*)listbox->select->handle)->flag == 19) |
---|
648 | { |
---|
649 | if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl2now.rtl2.de", "rtl2now", 1); |
---|
650 | } |
---|
651 | else if(((struct tithek*)listbox->select->handle)->flag == 20) |
---|
652 | { |
---|
653 | if(tmpstr != NULL) tmpstr1 = kinox(tmpstr, NULL, NULL, 3); |
---|
654 | } |
---|
655 | |
---|
656 | free(tmpstr); tmpstr = NULL; |
---|
657 | |
---|
658 | if(tmpstr1 != NULL) |
---|
659 | { |
---|
660 | if(textbox(_("Message"), _("Start playback"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1) |
---|
661 | screenplay(tmpstr1, 2, 0); |
---|
662 | } |
---|
663 | else |
---|
664 | textbox(_("Message"), _("Can't get Streamurl !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
665 | |
---|
666 | free(tmpstr1); tmpstr1 = NULL; |
---|
667 | } |
---|
668 | else |
---|
669 | textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
670 | } |
---|
671 | |
---|
672 | void screentithekplay(char* titheklink, char* title, int first) |
---|
673 | { |
---|
674 | int rcret = -1, oaktline = 1, oaktpage = -1, ogridcol = 0; |
---|
675 | |
---|
676 | if(file_exist("/var/bin/audio.elf") || file_exist("/var/swap/bin/audio.elf")) |
---|
677 | textbox(_("Message"), _("Alternativ Audio Firmware not working korrekt with all videos (DTSDOWNMIX)!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
678 | |
---|
679 | if(!file_exist("/mnt/player")) |
---|
680 | mkdir("/mnt/player", 0777); |
---|
681 | |
---|
682 | if(first == 1) |
---|
683 | { |
---|
684 | delallfiles("/tmp/tithek", NULL); |
---|
685 | mkdir("/tmp/tithek", 777); |
---|
686 | rcret = servicestop(status.aktservice, 1, 1); |
---|
687 | if(rcret == 1) return; |
---|
688 | } |
---|
689 | status.hangtime = 99999; |
---|
690 | |
---|
691 | struct skin* grid = getscreen("titheklist"); |
---|
692 | struct skin* listbox = getscreennode(grid, "listbox"); |
---|
693 | struct skin* countlabel = getscreennode(grid, "countlabel"); |
---|
694 | struct skin* countpage = getscreennode(grid, "countpage"); |
---|
695 | struct skin* load = getscreen("loading"); |
---|
696 | struct skin* tmp = NULL; |
---|
697 | char* tithekpic = NULL; |
---|
698 | |
---|
699 | if(titheklink == NULL) return; |
---|
700 | |
---|
701 | listbox->aktpage = -1; |
---|
702 | listbox->aktline = 1; |
---|
703 | listbox->gridcol = 0; |
---|
704 | listbox->select = NULL; |
---|
705 | |
---|
706 | // if(createtithekplay(titheklink, grid, listbox, countlabel) != 0) return; |
---|
707 | int pagecount = createtithekplay(titheklink, grid, listbox, countlabel); |
---|
708 | if(pagecount == 0) return; |
---|
709 | |
---|
710 | drawscreen(grid, 0, 0); |
---|
711 | addscreenrc(grid, listbox); |
---|
712 | |
---|
713 | while(1) |
---|
714 | { |
---|
715 | changetitle(grid, _(title)); |
---|
716 | if(listbox->select != NULL && listbox->select->handle != NULL) |
---|
717 | { |
---|
718 | tmp = listbox->select; |
---|
719 | while(tmp != NULL) |
---|
720 | { |
---|
721 | |
---|
722 | if(tmp->pagecount != listbox->aktpage) break; |
---|
723 | |
---|
724 | char* tmpstr = ostrcat(_("Page"), NULL, 0, 0); |
---|
725 | tmpstr = ostrcat(tmpstr, " ( ", 1, 0); |
---|
726 | tmpstr = ostrcat(tmpstr, oitoa(tmp->pagecount), 1, 0); |
---|
727 | tmpstr = ostrcat(tmpstr, " / ", 1, 0); |
---|
728 | tmpstr = ostrcat(tmpstr, oitoa(pagecount), 1, 0); |
---|
729 | tmpstr = ostrcat(tmpstr, _(" )"), 1, 0); |
---|
730 | changetext(countpage, tmpstr); |
---|
731 | free(tmpstr); tmpstr = NULL; |
---|
732 | |
---|
733 | if(tmp->handle != NULL) |
---|
734 | { |
---|
735 | tithekpic = tithekdownload(((struct tithek*)tmp->handle)->pic, ((struct tithek*)tmp->handle)->localname, "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=", 1, 0); |
---|
736 | |
---|
737 | off64_t checkpic = getfilesize(tithekpic); |
---|
738 | |
---|
739 | if(checkpic < 1000) |
---|
740 | { |
---|
741 | free(tithekpic); tithekpic = NULL; |
---|
742 | tithekpic = ostrcat("/var/usr/local/share/titan/plugins/tithek/default.jpg", NULL, 0, 0); |
---|
743 | } |
---|
744 | |
---|
745 | changepic(tmp, tithekpic); |
---|
746 | free(tithekpic); tithekpic = NULL; |
---|
747 | } |
---|
748 | tmp = tmp->prev; |
---|
749 | } |
---|
750 | tmp = listbox->select; |
---|
751 | while(tmp != NULL) |
---|
752 | { |
---|
753 | if(tmp->pagecount != listbox->aktpage) break; |
---|
754 | if(tmp->handle != NULL) |
---|
755 | { |
---|
756 | tithekpic = tithekdownload(((struct tithek*)tmp->handle)->pic, ((struct tithek*)tmp->handle)->localname, "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=", 1, 0); |
---|
757 | |
---|
758 | off64_t checkpic = getfilesize(tithekpic); |
---|
759 | |
---|
760 | if(checkpic < 1000) |
---|
761 | { |
---|
762 | free(tithekpic); tithekpic = NULL; |
---|
763 | tithekpic = ostrcat("/var/usr/local/share/titan/plugins/tithek/default.jpg", NULL, 0, 0); |
---|
764 | } |
---|
765 | |
---|
766 | changepic(tmp, tithekpic); |
---|
767 | free(tithekpic); tithekpic = NULL; |
---|
768 | } |
---|
769 | tmp = tmp->next; |
---|
770 | } |
---|
771 | |
---|
772 | drawscreen(grid, 0, 0); |
---|
773 | } |
---|
774 | |
---|
775 | int count = getfilecount(TITHEKPATH); |
---|
776 | if(count > 500) |
---|
777 | delallfiles(TITHEKPATH, ".jpg"); |
---|
778 | |
---|
779 | rcret = waitrc(grid, 0, 0); |
---|
780 | |
---|
781 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
782 | if(rcret == getrcconfigint("rcmenu", NULL)) |
---|
783 | { |
---|
784 | screentithek_settings(); |
---|
785 | } |
---|
786 | |
---|
787 | if(rcret == getrcconfigint("rcred", NULL)) |
---|
788 | { |
---|
789 | if(listbox->select != NULL && listbox->select->handle != NULL) |
---|
790 | { |
---|
791 | if(((struct tithek*)listbox->select->handle)->flag == 2) |
---|
792 | { |
---|
793 | if(status.security == 1) |
---|
794 | { |
---|
795 | char* tmpstr = tithekdownload((((struct tithek*)listbox->select->handle)->link), NULL, NULL, 0, 1); |
---|
796 | free(tmpstr); tmpstr = NULL; |
---|
797 | drawscreen(grid, 0, 0); |
---|
798 | } |
---|
799 | else |
---|
800 | textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
801 | } |
---|
802 | else if(((struct tithek*)listbox->select->handle)->flag == 4) |
---|
803 | { |
---|
804 | if(status.security == 1) |
---|
805 | { |
---|
806 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL; |
---|
807 | tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0); |
---|
808 | if(tmpstr != NULL) tmpstr1 = youtube(tmpstr, NULL, NULL, 1); |
---|
809 | tmpstr2 = changefilenameext(((struct tithek*)tmp->handle)->localname, ".mp4"); |
---|
810 | free(tmpstr); tmpstr = NULL; |
---|
811 | |
---|
812 | if(tmpstr1 != NULL) |
---|
813 | { |
---|
814 | char* tmpstr = tithekdownload(tmpstr1, tmpstr2, NULL, 0, 1); |
---|
815 | free(tmpstr); tmpstr = NULL; |
---|
816 | drawscreen(grid, 0, 0); |
---|
817 | } |
---|
818 | else |
---|
819 | textbox(_("Message"), _("Can't get Streamurl !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
820 | free(tmpstr1); tmpstr1 = NULL; |
---|
821 | free(tmpstr2); tmpstr2 = NULL; |
---|
822 | } |
---|
823 | else |
---|
824 | textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
825 | } |
---|
826 | } |
---|
827 | } |
---|
828 | else if(rcret == getrcconfigint("rcok", NULL)) |
---|
829 | { |
---|
830 | if(listbox->select != NULL && listbox->select->handle != NULL) |
---|
831 | { |
---|
832 | clearscreen(grid); |
---|
833 | |
---|
834 | if(((struct tithek*)listbox->select->handle)->flag == 2) |
---|
835 | { |
---|
836 | if(status.security == 1) |
---|
837 | { |
---|
838 | if(textbox(_("Message"), _("Start playback"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1) |
---|
839 | { |
---|
840 | if(ostrcmp(title, "TiThek - Internet Radio") == 0) |
---|
841 | { |
---|
842 | screenplay((((struct tithek*)listbox->select->handle)->link), 2, 4); |
---|
843 | } |
---|
844 | else |
---|
845 | screenplay((((struct tithek*)listbox->select->handle)->link), 2, 0); |
---|
846 | } |
---|
847 | } |
---|
848 | else |
---|
849 | textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0); |
---|
850 | } |
---|
851 | else if((((struct tithek*)listbox->select->handle)->flag == 4) || (((struct tithek*)listbox->select->handle)->flag == 5) || (((struct tithek*)listbox->select->handle)->flag == 6) || (((struct tithek*)listbox->select->handle)->flag == 7) || (((struct tithek*)listbox->select->handle)->flag == 8) || (((struct tithek*)listbox->select->handle)->flag == 12) || (((struct tithek*)listbox->select->handle)->flag == 14) || (((struct tithek*)listbox->select->handle)->flag == 15) || (((struct tithek*)listbox->select->handle)->flag == 16) || (((struct tithek*)listbox->select->handle)->flag == 17) || (((struct tithek*)listbox->select->handle)->flag == 18) || (((struct tithek*)listbox->select->handle)->flag == 19) || (((struct tithek*)listbox->select->handle)->flag == 20)) |
---|
852 | { |
---|
853 | submenu(listbox, load); |
---|
854 | drawscreen(grid, 0, 0); |
---|
855 | } |
---|
856 | else if((((struct tithek*)listbox->select->handle)->flag == 9) || (((struct tithek*)listbox->select->handle)->flag == 10) || (((struct tithek*)listbox->select->handle)->flag == 11)) |
---|
857 | { |
---|
858 | youtube_search(grid, listbox, countlabel, load); |
---|
859 | drawscreen(grid, 0, 0); |
---|
860 | continue; |
---|
861 | } |
---|
862 | else if((((struct tithek*)listbox->select->handle)->flag == 13)) |
---|
863 | { |
---|
864 | myvideo_search(grid, listbox, countlabel, load); |
---|
865 | drawscreen(grid, 0, 0); |
---|
866 | continue; |
---|
867 | } |
---|
868 | else if((((struct tithek*)listbox->select->handle)->flag == 21)) |
---|
869 | { |
---|
870 | kinox_search(grid, listbox, countlabel, load); |
---|
871 | drawscreen(grid, 0, 0); |
---|
872 | continue; |
---|
873 | } |
---|
874 | else if((((struct tithek*)listbox->select->handle)->flag == 22)) |
---|
875 | { |
---|
876 | kinox_hoster(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title); |
---|
877 | drawscreen(grid, 0, 0); |
---|
878 | continue; |
---|
879 | } |
---|
880 | else if((((struct tithek*)listbox->select->handle)->flag == 23)) |
---|
881 | { |
---|
882 | kinox_hoster_series(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title); |
---|
883 | drawscreen(grid, 0, 0); |
---|
884 | continue; |
---|
885 | } |
---|
886 | else if((((struct tithek*)listbox->select->handle)->flag == 66)) |
---|
887 | { |
---|
888 | textbox(_("Message"), _("The hoster is not yet supported for the time !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) |
---|
889 | continue; |
---|
890 | } |
---|
891 | else |
---|
892 | { |
---|
893 | int pincheck = 0; |
---|
894 | if(((struct tithek*)listbox->select->handle)->flag == 1000) |
---|
895 | pincheck = screenpincheck(0, NULL); |
---|
896 | if(pincheck == 0) |
---|
897 | { |
---|
898 | oaktpage = listbox->aktpage; |
---|
899 | oaktline = listbox->aktline; |
---|
900 | ogridcol = listbox->gridcol; |
---|
901 | char* tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0); |
---|
902 | char* tmpstr1 = ostrcat(((struct tithek*)listbox->select->handle)->menutitle, " - ", 0, 0); |
---|
903 | char* tmpstr2 = ostrcat(tmpstr1, ((struct tithek*)listbox->select->handle)->title, 1, 0); |
---|
904 | screentithekplay(tmpstr, tmpstr2, 0); |
---|
905 | free(tmpstr); tmpstr = NULL; |
---|
906 | free(tmpstr2); tmpstr2 = NULL; |
---|
907 | // if(createtithekplay(titheklink, grid, listbox, countlabel) != 0) break; |
---|
908 | int pagecount = createtithekplay(titheklink, grid, listbox, countlabel); |
---|
909 | if(pagecount == 0) break; |
---|
910 | |
---|
911 | listbox->aktpage = oaktpage; |
---|
912 | listbox->aktline = oaktline; |
---|
913 | listbox->gridcol = ogridcol; |
---|
914 | addscreenrc(grid, listbox); |
---|
915 | } |
---|
916 | } |
---|
917 | drawscreen(grid, 0, 0); |
---|
918 | sleep(1); |
---|
919 | } |
---|
920 | } |
---|
921 | else if(rcret == getrcconfigint("rcyellow", NULL) && ostrcmp(title, "TiThek - Favoriten") == 0) |
---|
922 | { |
---|
923 | if(textbox(_("Message"), _("Remove this Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) == 1) |
---|
924 | { |
---|
925 | removefav(((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag); |
---|
926 | int pagecount = createtithekplay(getconfig("tithek_fav", NULL), grid, listbox, countlabel); |
---|
927 | if(pagecount == 0) return; |
---|
928 | |
---|
929 | drawscreen(grid, 0, 0); |
---|
930 | } |
---|
931 | } |
---|
932 | else if(rcret == getrcconfigint("rcgreen", NULL) && ostrcmp(title, "TiThek - Favoriten") != 0) |
---|
933 | { |
---|
934 | if(textbox(_("Message"), _("Add this link as Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) == 1) |
---|
935 | { |
---|
936 | addfav(((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag); |
---|
937 | } |
---|
938 | } |
---|
939 | } |
---|
940 | |
---|
941 | freetithek(); |
---|
942 | delmarkedscreennodes(grid, 1); |
---|
943 | delownerrc(grid); |
---|
944 | clearscreen(grid); |
---|
945 | |
---|
946 | if(first == 1) |
---|
947 | { |
---|
948 | delallfiles("/tmp/tithek", ".list"); |
---|
949 | servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); |
---|
950 | } |
---|
951 | status.hangtime = getconfigint("hangtime", NULL); |
---|
952 | } |
---|
953 | |
---|
954 | #endif |
---|