1 | #ifndef IMDB_H |
---|
2 | #define IMDB_H |
---|
3 | |
---|
4 | #define TMPIMDBPIC1 "/tmp/tmpimdb1.jpg" |
---|
5 | #define TMPIMDBPIC2 "/tmp/tmpimdb2.jpg" |
---|
6 | |
---|
7 | void freeimdb(struct imdb** node, int flag) |
---|
8 | { |
---|
9 | if(node == NULL || *node == NULL) return; |
---|
10 | |
---|
11 | free((*node)->title); (*node)->title = NULL; |
---|
12 | free((*node)->year); (*node)->year = NULL; |
---|
13 | free((*node)->rated); (*node)->rated = NULL; |
---|
14 | free((*node)->released); (*node)->released = NULL; |
---|
15 | free((*node)->genre); (*node)->genre = NULL; |
---|
16 | free((*node)->director); (*node)->director = NULL; |
---|
17 | free((*node)->writer); (*node)->writer = NULL; |
---|
18 | free((*node)->actors); (*node)->actors = NULL; |
---|
19 | free((*node)->plot); (*node)->plot = NULL; |
---|
20 | free((*node)->poster); (*node)->poster = NULL; |
---|
21 | free((*node)->runtime); (*node)->runtime = NULL; |
---|
22 | free((*node)->rating); (*node)->rating = NULL; |
---|
23 | free((*node)->votes); (*node)->votes = NULL; |
---|
24 | free((*node)->id); (*node)->id = NULL; |
---|
25 | |
---|
26 | unlink(TMPIMDBPIC1); |
---|
27 | unlink(TMPIMDBPIC2); |
---|
28 | |
---|
29 | free(*node); *node = NULL; |
---|
30 | } |
---|
31 | |
---|
32 | // flag 0 = title search |
---|
33 | // flag 1 = iimdbid search |
---|
34 | // flag 2 = iimdbid search and save |
---|
35 | struct imdb* getimdb(struct imdb** first, char* input, int flag, int flag1, int flag2) |
---|
36 | { |
---|
37 | char* tmpstr = NULL, *tmpsearch = NULL, *savefile = NULL, *pageposter = NULL, *title = NULL; |
---|
38 | |
---|
39 | debug(133, "title: %s",input); |
---|
40 | debug(133, "flag: %d",flag); |
---|
41 | debug(133, "flag1: %d",flag1); |
---|
42 | debug(133, "flag2: %d",flag2); |
---|
43 | |
---|
44 | title = ostrcat(title, input, 1, 0); |
---|
45 | |
---|
46 | start: |
---|
47 | debug(133, "title: %s",title); |
---|
48 | // tmpsearch = ostrcat("find?s=tt;q=", NULL, 0, 0); |
---|
49 | tmpsearch = ostrcat("find?q=", NULL, 0, 0); |
---|
50 | |
---|
51 | if(checkinternet() == 1) |
---|
52 | { |
---|
53 | debug(133, "Error, Internet Connection not found"); |
---|
54 | return NULL; |
---|
55 | } |
---|
56 | |
---|
57 | if(flag == 0) |
---|
58 | { |
---|
59 | tmpsearch = ostrcat(tmpsearch, title, 1, 0); |
---|
60 | tmpsearch = ostrcat(tmpsearch, "&s=all", 1, 0); |
---|
61 | } |
---|
62 | else |
---|
63 | tmpsearch = ostrcat("/title/tt", title, 0, 0); |
---|
64 | tmpsearch = stringreplacechar(tmpsearch, ' ', '+'); |
---|
65 | |
---|
66 | debug(133, "search: http://www.imdb.de/%s", tmpsearch); |
---|
67 | |
---|
68 | tmpstr = gethttp("www.imdb.de", tmpsearch, 80, NULL, NULL, 5000, NULL, 0); |
---|
69 | |
---|
70 | debug(133, "tmpsearch: %s", tmpsearch); |
---|
71 | free(tmpsearch); tmpsearch = NULL; |
---|
72 | |
---|
73 | if(tmpstr != NULL) |
---|
74 | { |
---|
75 | if(ostrstr(tmpstr, "<b>Keine Treffer.</b>") != NULL) |
---|
76 | { |
---|
77 | debug(133, "<b>Keine Treffer.</b>"); |
---|
78 | free(tmpstr); tmpstr = NULL; |
---|
79 | return NULL; |
---|
80 | } |
---|
81 | |
---|
82 | *first = (struct imdb*)calloc(1, sizeof(struct imdb)); |
---|
83 | if(*first == NULL) |
---|
84 | { |
---|
85 | err("no mem"); |
---|
86 | free(tmpstr); tmpstr = NULL; |
---|
87 | return NULL; |
---|
88 | } |
---|
89 | |
---|
90 | if(flag == 0) |
---|
91 | (*first)->id = string_resub("<a href=\"/title/tt", "/", tmpstr, 0); |
---|
92 | else |
---|
93 | (*first)->id = ostrcat(title, NULL, 0, 0); |
---|
94 | |
---|
95 | if(flag1 == 1) |
---|
96 | { |
---|
97 | if((*first)->id != NULL) |
---|
98 | (*first)->id = ostrcat("tt", (*first)->id, 0, 1); |
---|
99 | |
---|
100 | debug(133, "----------------------imdb start----------------------"); |
---|
101 | debug(133, "id: %s", (*first)->id); |
---|
102 | debug(133, "----------------------imdb end----------------------"); |
---|
103 | |
---|
104 | free(tmpstr); tmpstr = NULL; |
---|
105 | return *first; |
---|
106 | } |
---|
107 | |
---|
108 | // todo - use Meistgesuchte Titel (default) |
---|
109 | // Meistgesuchte Titel |
---|
110 | // Titel (näherungsweise Übereinstimmung) |
---|
111 | // Titel (genaue Übereinstimmung) |
---|
112 | |
---|
113 | if(flag1 == 0 && ostrstr(tmpstr, "<title>IMDb Titelsuche</title>") != NULL && ostrstr(tmpstr, "<p><b>Meistgesuchte Titel</b>") == NULL) |
---|
114 | { |
---|
115 | char* tmp = tmpstr; |
---|
116 | tmpstr = string_resub("<p><b>Titel", "</td></tr></table> </p>", tmpstr, 0); |
---|
117 | free(tmp); tmp = NULL; |
---|
118 | // writesys("/var/usr/local/share/titan/plugins/imdb/tmpstr", tmpstr, 0); |
---|
119 | |
---|
120 | while(ostrstr(tmpstr, "</td><td valign=\"top\"><a href=\"/title/") != NULL) |
---|
121 | { |
---|
122 | tmpstr = string_replace("</td><td valign=\"top\"><a href=\"/title/", "\n\n", tmpstr, 1); |
---|
123 | } |
---|
124 | // writesys("/var/usr/local/share/titan/plugins/imdb/tmpstr1", tmpstr, 0); |
---|
125 | |
---|
126 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
127 | char* tmpstr1 = NULL; |
---|
128 | |
---|
129 | int count = 0; |
---|
130 | struct splitstr* ret = NULL; |
---|
131 | ret = strsplit(tmpstr, "\n", &count); |
---|
132 | |
---|
133 | int max = count; |
---|
134 | int i = 0; |
---|
135 | for(i = 0; i < max; i++) |
---|
136 | { |
---|
137 | // tmpstr1 = string_resub("link=/title", "</a>", (&ret[i])->part, 0); |
---|
138 | tmpstr1 = string_resub("link=/title", "</td>", (&ret[i])->part, 0); |
---|
139 | debug(133, "tmpstr1(%d): %s\n", i, tmpstr1); |
---|
140 | tmpstr1 = string_replace("</a>", "", tmpstr1, 1); |
---|
141 | debug(133, "tmpstr1(%d): %s\n", i, tmpstr1); |
---|
142 | |
---|
143 | char* x = oregex("/tt([0-9]{7})", tmpstr1); |
---|
144 | char* y = oregex(";\">(.*)", tmpstr1); |
---|
145 | if(ostrstr(y, "<img src") == NULL && x != NULL && y != NULL) |
---|
146 | { |
---|
147 | debug(133, "x(%d): %s\n", i, x); |
---|
148 | debug(133, "y(%d): %s\n", i, y); |
---|
149 | string_striptags(x); |
---|
150 | string_striptags(y); |
---|
151 | string_strip_whitechars(x); |
---|
152 | string_strip_whitechars(y); |
---|
153 | debug(133, "x(%d): %s\n", i, x); |
---|
154 | debug(133, "y(%d): %s\n", i, y); |
---|
155 | y = string_decode(y, 1); |
---|
156 | x = string_decode(x, 1); |
---|
157 | debug(133, "x(%d): %s\n", i, x); |
---|
158 | debug(133, "y(%d): %s\n", i, y); |
---|
159 | |
---|
160 | addmenulist(&mlist, y, x, NULL, 0, 0); |
---|
161 | } |
---|
162 | free(x), x = NULL; |
---|
163 | free(y), y = NULL; |
---|
164 | /* |
---|
165 | current not working |
---|
166 | struct regex* x = regexstruct("/tt([0-9]{7})", tmpstr1); |
---|
167 | struct regex* y = regexstruct(";\">(.*)", tmpstr1); |
---|
168 | if(x != NULL && y != NULL) |
---|
169 | { |
---|
170 | debug(133, "x->match2(%d): %s\n", i, x->match2); |
---|
171 | debug(133, "y->match2(%d): %s\n", i, y->match2); |
---|
172 | x->match2 = string_decode(x->match2, 1); |
---|
173 | y->match2 = string_decode(y->match2, 1); |
---|
174 | addmenulist(&mlist, y->match2, x->match2, NULL, 0, 0); |
---|
175 | debug(133, "x->match2(%d): %s\n", i, x->match2); |
---|
176 | debug(133, "y->match2(%d): %s\n", i, y->match2); |
---|
177 | } |
---|
178 | freeregexstruct(x); x = NULL; |
---|
179 | freeregexstruct(y); y = NULL; |
---|
180 | */ |
---|
181 | free(tmpstr1),tmpstr1 = NULL; |
---|
182 | } |
---|
183 | free(ret); ret = NULL; |
---|
184 | |
---|
185 | mbox = menulistbox(mlist, NULL, NULL, NULL, NULL, 1, 0); |
---|
186 | if(mbox != NULL) |
---|
187 | { |
---|
188 | free(title), title = NULL; |
---|
189 | free(tmpstr), tmpstr = NULL; |
---|
190 | |
---|
191 | debug(133, "mbox->name %s", mbox->name); |
---|
192 | debug(133, "mbox->text %s", mbox->text); |
---|
193 | |
---|
194 | title = ostrcat(mbox->text, NULL, 0, 0); |
---|
195 | flag = 1; |
---|
196 | goto start; |
---|
197 | } |
---|
198 | } |
---|
199 | if(flag != 2) |
---|
200 | free(tmpstr), tmpstr = NULL; |
---|
201 | } |
---|
202 | |
---|
203 | if(*first != NULL && flag != 2) |
---|
204 | { |
---|
205 | if((*first)->id == NULL) |
---|
206 | free(tmpstr), tmpstr = NULL; |
---|
207 | else |
---|
208 | { |
---|
209 | debug(133, "imdb->id: %s", (*first)->id); |
---|
210 | |
---|
211 | tmpsearch = ostrcat("/title/tt", NULL, 0, 0); |
---|
212 | tmpsearch = ostrcat(tmpsearch, (*first)->id, 1, 0); |
---|
213 | |
---|
214 | tmpstr = gethttp("www.imdb.de", tmpsearch, 80, NULL, NULL, 5000, NULL, 0); |
---|
215 | |
---|
216 | debug(133, "tmpsearch: %s", tmpsearch); |
---|
217 | free(tmpsearch); tmpsearch = NULL; |
---|
218 | } |
---|
219 | } |
---|
220 | |
---|
221 | if(*first != NULL && tmpstr != NULL) |
---|
222 | { |
---|
223 | if(ostrstr(tmpstr, "<title>") != NULL) |
---|
224 | { |
---|
225 | (*first)->title = string_resub("<title>", "</title>", tmpstr, 0); |
---|
226 | (*first)->title = string_decode((*first)->title, 1); |
---|
227 | string_strip_whitechars((*first)->title); |
---|
228 | strstrip((*first)->title); |
---|
229 | } |
---|
230 | |
---|
231 | if(ostrstr(tmpstr, "<h5>Genre:</h5>") != NULL) |
---|
232 | { |
---|
233 | (*first)->genre = string_resub("<h5>Genre:</h5>", "</div>", tmpstr, 0); |
---|
234 | (*first)->genre = string_decode((*first)->genre, 1); |
---|
235 | string_striptags((*first)->genre); |
---|
236 | string_strip_whitechars((*first)->genre); |
---|
237 | strstrip((*first)->genre); |
---|
238 | } |
---|
239 | |
---|
240 | if(ostrstr(tmpstr, "<h5>Drehbuchautor") != NULL) |
---|
241 | { |
---|
242 | char* tmp = NULL; |
---|
243 | |
---|
244 | (*first)->writer = string_resub("<h5>Drehbuchautor", "</div>", tmpstr, 0); |
---|
245 | tmp = (*first)->writer; |
---|
246 | (*first)->writer = string_resub("<div class=\"info-content\">", "</div>", (*first)->writer, 0); |
---|
247 | free(tmp); tmp = (*first)->writer; |
---|
248 | (*first)->writer = string_resub(";\">", "</a>", (*first)->writer, 0); |
---|
249 | free(tmp); tmp = NULL; |
---|
250 | (*first)->writer = string_decode((*first)->writer, 1); |
---|
251 | string_striptags((*first)->writer); |
---|
252 | string_strip_whitechars((*first)->writer); |
---|
253 | strstrip((*first)->writer); |
---|
254 | } |
---|
255 | |
---|
256 | if(ostrstr(tmpstr, "Regisseur:") != NULL) |
---|
257 | { |
---|
258 | char* tmp = NULL; |
---|
259 | |
---|
260 | (*first)->director = string_resub("Regisseur:", "</div>", tmpstr, 0); |
---|
261 | tmp = (*first)->director; |
---|
262 | (*first)->director = string_resub(";\">", "</a><br/>", (*first)->director, 0); |
---|
263 | free(tmp); tmp = NULL; |
---|
264 | (*first)->director = string_decode((*first)->director, 1); |
---|
265 | string_striptags((*first)->director); |
---|
266 | string_strip_whitechars((*first)->director); |
---|
267 | strstrip((*first)->director); |
---|
268 | } |
---|
269 | |
---|
270 | if(ostrstr(tmpstr, "<h5>Premierendatum:</h5>") != NULL) |
---|
271 | { |
---|
272 | char* tmp = NULL; |
---|
273 | |
---|
274 | (*first)->released = string_resub("<h5>Premierendatum:</h5>", "<a class=", tmpstr, 0); |
---|
275 | tmp = (*first)->released; |
---|
276 | (*first)->released = string_resub("<div class=\"info-content\">", "<a class=", (*first)->released, 0); |
---|
277 | free(tmp); tmp = NULL; |
---|
278 | (*first)->released = string_decode((*first)->released, 1); |
---|
279 | string_striptags((*first)->released); |
---|
280 | string_strip_whitechars((*first)->released); |
---|
281 | strstrip((*first)->released); |
---|
282 | } |
---|
283 | |
---|
284 | if(ostrstr(tmpstr, "<h3>Besetzung</h3>") != NULL) |
---|
285 | { |
---|
286 | char* tmp = NULL; |
---|
287 | |
---|
288 | (*first)->actors = string_resub("<h3>Besetzung</h3> ", "</td></tr></table>", tmpstr, 0); |
---|
289 | tmp = (*first)->actors; |
---|
290 | (*first)->actors = string_resub("<div class=\"info-content block\"><table class=\"cast\">", "</a></td></tr>", (*first)->actors, 0); |
---|
291 | free(tmp); tmp = NULL; |
---|
292 | (*first)->actors = string_replace("...", "als", (*first)->actors, 1); |
---|
293 | (*first)->actors = string_decode((*first)->actors,1); |
---|
294 | string_striptags((*first)->actors); |
---|
295 | string_strip_whitechars((*first)->actors); |
---|
296 | strstrip((*first)->actors); |
---|
297 | } |
---|
298 | |
---|
299 | if(ostrstr(tmpstr, "<a name=\"poster\" href=\"") != NULL) |
---|
300 | { |
---|
301 | char* tmp = NULL; |
---|
302 | |
---|
303 | (*first)->thumb = string_resub("<a name=\"poster\" href=\"", "\" /></a>", tmpstr, 0); |
---|
304 | tmp = (*first)->thumb; |
---|
305 | (*first)->thumb = string_resub("src=\"", "\" /></a>", (*first)->thumb, 0); |
---|
306 | free(tmp); tmp = NULL; |
---|
307 | } |
---|
308 | |
---|
309 | if(ostrstr(tmpstr, "/media/rm") != NULL) |
---|
310 | { |
---|
311 | pageposter = string_resub("/media/rm", "/", tmpstr, 0); |
---|
312 | strstrip(pageposter); |
---|
313 | } |
---|
314 | free(tmpstr), tmpstr = NULL; |
---|
315 | } |
---|
316 | |
---|
317 | if(*first != NULL && pageposter != NULL) |
---|
318 | { |
---|
319 | tmpsearch = ostrcat("/media/rm", pageposter, 0, 0); |
---|
320 | tmpsearch = ostrcat(tmpsearch, "/tt", 1, 0); |
---|
321 | tmpsearch = ostrcat(tmpsearch, (*first)->id, 1, 0); |
---|
322 | tmpsearch = ostrcat(tmpsearch, "/", 1, 0); |
---|
323 | |
---|
324 | tmpstr = gethttp("www.imdb.de", tmpsearch, 80, NULL, NULL, 5000, NULL, 0); |
---|
325 | |
---|
326 | debug(133, "tmpsearch: %s", tmpsearch); |
---|
327 | free(tmpsearch); tmpsearch = NULL; |
---|
328 | |
---|
329 | if(tmpstr != NULL) |
---|
330 | { |
---|
331 | if(ostrstr(tmpstr, "image_src") != NULL) |
---|
332 | { |
---|
333 | (*first)->poster = string_resub("<link rel=\"image_src\" href=\"", "\"", tmpstr, 0); |
---|
334 | strstrip((*first)->poster); |
---|
335 | } |
---|
336 | free(tmpstr), tmpstr = NULL; |
---|
337 | } |
---|
338 | } |
---|
339 | |
---|
340 | if(*first != NULL && (*first)->id == NULL) |
---|
341 | { |
---|
342 | tmpsearch = ostrcat("/title/tt", NULL, 0, 0); |
---|
343 | tmpsearch = ostrcat(tmpsearch, (*first)->id, 1, 0); |
---|
344 | tmpsearch = ostrcat(tmpsearch, "/plotsummary", 1, 0); |
---|
345 | |
---|
346 | tmpstr = gethttp("www.imdb.de", tmpsearch, 80, NULL, NULL, 5000, NULL, 0); |
---|
347 | |
---|
348 | debug(133, "tmpsearch: %s", tmpsearch); |
---|
349 | |
---|
350 | free(tmpsearch); tmpsearch = NULL; |
---|
351 | } |
---|
352 | |
---|
353 | if(*first != NULL && tmpstr != NULL) |
---|
354 | { |
---|
355 | if(ostrstr(tmpstr, "swiki.2.1") != NULL) |
---|
356 | { |
---|
357 | (*first)->plot = string_resub("<div id=\"swiki.2.1\">", "</div>", tmpstr, 0); |
---|
358 | (*first)->plot = string_decode((*first)->plot, 1); |
---|
359 | string_striptags((*first)->plot); |
---|
360 | string_strip_whitechars((*first)->plot); |
---|
361 | strstrip((*first)->plot); |
---|
362 | } |
---|
363 | free(tmpstr), tmpstr = NULL; |
---|
364 | } |
---|
365 | |
---|
366 | if(flag2 == 0 && *first != NULL && (*first)->id != NULL) |
---|
367 | { |
---|
368 | if((*first)->poster != NULL) |
---|
369 | { |
---|
370 | char* ip = NULL, *pos = NULL, *path = NULL; |
---|
371 | ip = string_replace("http://", "", (*first)->poster, 0); |
---|
372 | |
---|
373 | if(ip != NULL) |
---|
374 | pos = strchr(ip, '/'); |
---|
375 | if(pos != NULL) |
---|
376 | { |
---|
377 | pos[0] = '\0'; |
---|
378 | path = pos + 1; |
---|
379 | } |
---|
380 | |
---|
381 | if(flag1 == 1) |
---|
382 | { |
---|
383 | savefile = ostrcat(getconfig("mediadbpath", NULL), "/tt", 0, 0); |
---|
384 | savefile = ostrcat(savefile, (*first)->id, 1, 0); |
---|
385 | savefile = ostrcat(savefile, "_poster.jpg", 1, 0); |
---|
386 | gethttp(ip, path, 80, savefile, NULL, 5000, NULL, 0); |
---|
387 | free((*first)->poster); |
---|
388 | (*first)->poster = savefile; |
---|
389 | } |
---|
390 | else |
---|
391 | { |
---|
392 | gethttp(ip, path, 80, TMPIMDBPIC1, NULL, 5000, NULL, 0); |
---|
393 | free((*first)->poster); |
---|
394 | (*first)->poster = ostrcat(TMPIMDBPIC1, NULL, 0, 0); |
---|
395 | } |
---|
396 | |
---|
397 | free(ip); ip = NULL; |
---|
398 | } |
---|
399 | |
---|
400 | if((*first)->thumb != NULL) |
---|
401 | { |
---|
402 | char* ip = NULL, *pos = NULL, *path = NULL; |
---|
403 | ip = string_replace("http://", "", (*first)->thumb, 0); |
---|
404 | |
---|
405 | if(ip != NULL) |
---|
406 | pos = strchr(ip, '/'); |
---|
407 | if(pos != NULL) |
---|
408 | { |
---|
409 | pos[0] = '\0'; |
---|
410 | path = pos + 1; |
---|
411 | } |
---|
412 | |
---|
413 | if(flag1 == 1) |
---|
414 | { |
---|
415 | savefile = ostrcat(getconfig("mediadbpath", NULL), "/tt", 0, 0); |
---|
416 | savefile = ostrcat(savefile, (*first)->id, 1, 0); |
---|
417 | savefile = ostrcat(savefile, "_thumb.jpg", 1, 0); |
---|
418 | gethttp(ip, path, 80, savefile, NULL, 5000, NULL, 0); |
---|
419 | free((*first)->thumb); |
---|
420 | (*first)->thumb = savefile; |
---|
421 | } |
---|
422 | else |
---|
423 | { |
---|
424 | gethttp(ip, path, 80, TMPIMDBPIC2, NULL, 5000, NULL, 0); |
---|
425 | free((*first)->thumb); |
---|
426 | (*first)->thumb = ostrcat(TMPIMDBPIC2, NULL, 0, 0); |
---|
427 | } |
---|
428 | |
---|
429 | free(ip); ip = NULL; |
---|
430 | } |
---|
431 | } |
---|
432 | else if(*first != NULL) |
---|
433 | { |
---|
434 | if((*first)->thumb != NULL) |
---|
435 | { |
---|
436 | free((*first)->thumb); |
---|
437 | (*first)->thumb = NULL; |
---|
438 | } |
---|
439 | if((*first)->poster != NULL) |
---|
440 | { |
---|
441 | free((*first)->poster); |
---|
442 | (*first)->poster = NULL; |
---|
443 | } |
---|
444 | } |
---|
445 | |
---|
446 | if(*first != NULL && (*first)->id != NULL) |
---|
447 | (*first)->id = ostrcat("tt", (*first)->id, 0, 1); |
---|
448 | |
---|
449 | free(tmpstr); tmpstr = NULL; |
---|
450 | |
---|
451 | if(*first != NULL) |
---|
452 | { |
---|
453 | debug(133, "----------------------imdb start----------------------"); |
---|
454 | debug(133, "id: %s", (*first)->id); |
---|
455 | debug(133, "title: %s", (*first)->title); |
---|
456 | debug(133, "genre: %s", (*first)->genre); |
---|
457 | debug(133, "writer: %s", (*first)->writer); |
---|
458 | debug(133, "director: %s", (*first)->director); |
---|
459 | debug(133, "released: %s", (*first)->released); |
---|
460 | debug(133, "actors: %s", (*first)->actors); |
---|
461 | debug(133, "plot: %s", (*first)->plot); |
---|
462 | debug(133, "poster: %s", (*first)->poster); |
---|
463 | debug(133, "thumb: %s", (*first)->thumb); |
---|
464 | debug(133, "----------------------imdb end----------------------"); |
---|
465 | } |
---|
466 | |
---|
467 | return *first; |
---|
468 | } |
---|
469 | |
---|
470 | void screenimdb(char* title, char* dummy1, char* dummy2, char* path, char* file) |
---|
471 | { |
---|
472 | debug(133, "title: %s",title); |
---|
473 | debug(133, "path: %s",path); |
---|
474 | debug(133, "file: %s",file); |
---|
475 | char* searchstr = NULL, *tmpstr = NULL; |
---|
476 | int rcret = 0; |
---|
477 | |
---|
478 | if(checkinternet() == 1) |
---|
479 | { |
---|
480 | textbox(_("Message"), _("Error, Internet Connection not found"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 500, 10, 0); |
---|
481 | return; |
---|
482 | } |
---|
483 | |
---|
484 | struct skin* imdbskin = getscreen("imdb"); |
---|
485 | struct skin* skin_plot = getscreennode(imdbskin, "plot"); |
---|
486 | struct skin* skin_title = getscreennode(imdbskin, "title"); |
---|
487 | struct skin* skin_director = getscreennode(imdbskin, "director"); |
---|
488 | struct skin* skin_writers = getscreennode(imdbskin, "writers"); |
---|
489 | struct skin* skin_genre = getscreennode(imdbskin, "genre"); |
---|
490 | struct skin* skin_releasetime = getscreennode(imdbskin, "releasetime"); |
---|
491 | struct skin* skin_cover = getscreennode(imdbskin, "cover"); |
---|
492 | struct skin* skin_actors = getscreennode(imdbskin, "actors"); |
---|
493 | struct skin* skin_b2 = getscreennode(imdbskin, "b2"); |
---|
494 | struct skin* load = getscreen("loading"); |
---|
495 | struct skin* blackscreen = getscreen("blackscreen"); |
---|
496 | |
---|
497 | struct imdb* node = NULL; |
---|
498 | char* search = NULL; |
---|
499 | |
---|
500 | if(path == NULL || file == NULL) |
---|
501 | skin_b2->hidden = YES; |
---|
502 | else |
---|
503 | skin_b2->hidden = NO; |
---|
504 | |
---|
505 | // setfbtransparent(255); |
---|
506 | status.hangtime = 99999; |
---|
507 | |
---|
508 | if(title == NULL) |
---|
509 | searchstr = getepgakttitle(NULL); |
---|
510 | else |
---|
511 | { |
---|
512 | int isrec = 0, iscam = 0; |
---|
513 | tmpstr = createshortname(file, &isrec, &iscam, 1); |
---|
514 | if(tmpstr != NULL) |
---|
515 | searchstr = ostrcat(searchstr, tmpstr, 1, 0); |
---|
516 | else |
---|
517 | searchstr = ostrcat(searchstr, title, 1, 0); |
---|
518 | } |
---|
519 | |
---|
520 | debug(133, "searchstr: %s",searchstr); |
---|
521 | |
---|
522 | drawscreen(blackscreen, 0, 0); |
---|
523 | drawscreen(load, 0, 0); |
---|
524 | |
---|
525 | node = getimdb(&node, searchstr, 0, 0, 0); |
---|
526 | |
---|
527 | clearscreen(load); |
---|
528 | clearscreen(blackscreen); |
---|
529 | |
---|
530 | start: |
---|
531 | if(node != NULL) |
---|
532 | { |
---|
533 | changetext(skin_plot, node->plot); |
---|
534 | changetext(skin_title, node->title); |
---|
535 | changetext(skin_director, node->director); |
---|
536 | changetext(skin_writers, node->writer); |
---|
537 | changetext(skin_genre, node->genre); |
---|
538 | changetext(skin_releasetime, node->released); |
---|
539 | changetext(skin_actors, node->actors); |
---|
540 | changepic(skin_cover, node->poster); |
---|
541 | skin_cover->hidden = NO; |
---|
542 | } |
---|
543 | else |
---|
544 | { |
---|
545 | changetext(skin_plot, "--plot--"); |
---|
546 | changetext(skin_title, "--title--"); |
---|
547 | changetext(skin_director, "--director--"); |
---|
548 | changetext(skin_writers, "--writers--"); |
---|
549 | changetext(skin_genre, "--genre--"); |
---|
550 | changetext(skin_releasetime, "--releasetime--"); |
---|
551 | changetext(skin_actors, "--actors--"); |
---|
552 | skin_cover->hidden = YES; |
---|
553 | } |
---|
554 | |
---|
555 | drawscreen(imdbskin, 0, 0); |
---|
556 | |
---|
557 | while(1) |
---|
558 | { |
---|
559 | rcret = waitrc(imdbskin, 0, 0); |
---|
560 | |
---|
561 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
562 | if(rcret == getrcconfigint("rcok", NULL)) break; |
---|
563 | |
---|
564 | if(rcret == getrcconfigint("rcred", NULL)) |
---|
565 | { |
---|
566 | search = textinput("Search", searchstr); |
---|
567 | if(search != NULL) |
---|
568 | { |
---|
569 | freeimdb(&node, 0); node = NULL; |
---|
570 | drawscreen(blackscreen, 0, 0); |
---|
571 | drawscreen(load, 0, 0); |
---|
572 | node = getimdb(&node, search, 0, 0, 0); |
---|
573 | clearscreen(load); |
---|
574 | clearscreen(blackscreen); |
---|
575 | free(search), search = NULL; |
---|
576 | goto start; |
---|
577 | } |
---|
578 | drawscreen(imdbskin, 0, 0); |
---|
579 | continue; |
---|
580 | } |
---|
581 | |
---|
582 | if(path != NULL && file != NULL && node != NULL && node->id != NULL && rcret == getrcconfigint("rcgreen", NULL)) |
---|
583 | { |
---|
584 | drawscreen(blackscreen, 0, 0); |
---|
585 | drawscreen(load, 0, 0); |
---|
586 | debug(133, "path: %s",path); |
---|
587 | debug(133, "file: %s",file); |
---|
588 | debug(133, "type: 2"); |
---|
589 | debug(133, "imdbid: %s",node->id); |
---|
590 | addconfigtmp("mediadbscantimeout", "0"); |
---|
591 | mediadbfindfilecb(path, file, 0, node->id, 1); |
---|
592 | delconfigtmp("mediadbscantimeout"); |
---|
593 | clearscreen(load); |
---|
594 | clearscreen(blackscreen); |
---|
595 | break; |
---|
596 | } |
---|
597 | } |
---|
598 | |
---|
599 | free(searchstr), searchstr = NULL; |
---|
600 | freeimdb(&node, 0); node = NULL; |
---|
601 | // setosdtransparent(getskinconfigint("osdtransparent", NULL)); |
---|
602 | status.hangtime = getconfigint("hangtime", NULL); |
---|
603 | clearscreen(imdbskin); |
---|
604 | } |
---|
605 | |
---|
606 | #endif |
---|