Changeset 25053 for titan/plugins/imdb
- Timestamp:
- 11/30/13 17:06:12 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/imdb/imdb.h
r20034 r25053 35 35 struct imdb* getimdb(struct imdb** first, char* input, int flag, int flag1, int flag2) 36 36 { 37 char* tmpstr = NULL, *tmps earch = NULL, *savefile = NULL, *pageposter = NULL, *title = NULL;37 char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *tmpsearch = NULL, *savefile = NULL, *pageposter = NULL, *title = NULL; 38 38 39 39 debug(133, "title: %s",input); … … 67 67 68 68 tmpstr = gethttp("www.imdb.de", tmpsearch, 80, NULL, NULL, 5000, NULL, 0); 69 // writesys("/var/usr/local/share/titan/plugins/imdb/tmpstr0", tmpstr, 1); 70 69 71 70 72 debug(133, "tmpsearch: %s", tmpsearch); … … 125 127 126 128 struct menulist* mlist = NULL, *mbox = NULL; 127 char* tmpstr1 = NULL;128 129 129 130 int count = 0; … … 213 214 214 215 tmpstr = gethttp("www.imdb.de", tmpsearch, 80, NULL, NULL, 5000, NULL, 0); 216 // writesys("/var/usr/local/share/titan/plugins/imdb/tmpstrj", tmpstr, 0); 215 217 216 218 debug(133, "tmpsearch: %s", tmpsearch); … … 222 224 { 223 225 if(ostrstr(tmpstr, "<title>") != NULL) 224 { 226 { 225 227 (*first)->title = string_resub("<title>", "</title>", tmpstr, 0); 226 228 (*first)->title = string_decode((*first)->title, 1); … … 229 231 } 230 232 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); 233 if(ostrstr(tmpstr, "\"genre\">") != NULL) 234 { 235 tmpstr1 = string_resub(" - ", "</div>", tmpstr, 0); 236 237 while(ostrstr(tmpstr1, "\"genre\"") != NULL) 238 { 239 tmpstr2 = string_resub("\"genre\">", "</span>", tmpstr1, 0); 240 tmpstr1 = string_replace("\"genre\">", "", tmpstr1, 1); 241 if((*first)->genre != NULL && tmpstr2 != NULL) 242 (*first)->genre = ostrcat((*first)->genre, ",", 1, 0); 243 244 (*first)->genre = ostrcat((*first)->genre, tmpstr2, 1, 0); 245 free(tmpstr2), tmpstr2 = NULL; 246 } 247 free(tmpstr1), tmpstr1 = NULL; 248 235 249 string_striptags((*first)->genre); 236 250 string_strip_whitechars((*first)->genre); 237 251 strstrip((*first)->genre); 238 252 } 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); 253 254 if(ostrstr(tmpstr, ">Writers:</h4>") != NULL) 255 { 256 tmpstr1 = string_resub(">Writers:</h4>", "</div>", tmpstr, 0); 257 258 while(ostrstr(tmpstr1, "\"name\"") != NULL) 259 { 260 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 261 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 262 if((*first)->writer != NULL && tmpstr2 != NULL) 263 (*first)->writer = ostrcat((*first)->writer, ",", 1, 0); 264 265 (*first)->writer = ostrcat((*first)->writer, tmpstr2, 1, 0); 266 free(tmpstr2), tmpstr2 = NULL; 267 } 268 free(tmpstr1), tmpstr1 = NULL; 269 251 270 string_striptags((*first)->writer); 252 271 string_strip_whitechars((*first)->writer); … … 254 273 } 255 274 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); 275 if((*first)->writer == NULL && ostrstr(tmpstr, ">Writer:</h4>") != NULL) 276 { 277 tmpstr1 = string_resub(">Writer:</h4>", "</div>", tmpstr, 0); 278 279 while(ostrstr(tmpstr1, "\"name\"") != NULL) 280 { 281 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 282 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 283 if((*first)->writer != NULL && tmpstr2 != NULL) 284 (*first)->writer = ostrcat((*first)->writer, ",", 1, 0); 285 286 (*first)->writer = ostrcat((*first)->writer, tmpstr2, 1, 0); 287 free(tmpstr2), tmpstr2 = NULL; 288 } 289 free(tmpstr1), tmpstr1 = NULL; 290 291 string_striptags((*first)->writer); 292 string_strip_whitechars((*first)->writer); 293 strstrip((*first)->writer); 294 } 295 296 if(ostrstr(tmpstr, ">Director:</h4>") != NULL) 297 { 298 tmpstr1 = string_resub(">Director:</h4>", "</div>", tmpstr, 0); 299 300 while(ostrstr(tmpstr1, "\"name\"") != NULL) 301 { 302 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 303 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 304 if((*first)->director != NULL && tmpstr2 != NULL) 305 (*first)->director = ostrcat((*first)->director, ",", 1, 0); 306 307 (*first)->director = ostrcat((*first)->director, tmpstr2, 1, 0); 308 free(tmpstr2), tmpstr2 = NULL; 309 } 310 free(tmpstr1), tmpstr1 = NULL; 311 265 312 string_striptags((*first)->director); 266 313 string_strip_whitechars((*first)->director); 267 314 strstrip((*first)->director); 268 315 } 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); 316 317 if((*first)->director == NULL && ostrstr(tmpstr, ">Directors:</h4>") != NULL) 318 { 319 tmpstr1 = string_resub(">Directors:</h4>", "</div>", tmpstr, 0); 320 321 while(ostrstr(tmpstr1, "\"name\"") != NULL) 322 { 323 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 324 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 325 if((*first)->director != NULL && tmpstr2 != NULL) 326 (*first)->director = ostrcat((*first)->director, ",", 1, 0); 327 328 (*first)->director = ostrcat((*first)->director, tmpstr2, 1, 0); 329 free(tmpstr2), tmpstr2 = NULL; 330 } 331 free(tmpstr1), tmpstr1 = NULL; 332 333 string_striptags((*first)->director); 334 string_strip_whitechars((*first)->director); 335 strstrip((*first)->director); 336 } 337 338 if((*first)->director == NULL && ostrstr(tmpstr, "<b>Director:</b>") != NULL) 339 { 340 (*first)->director = string_resub("<b>Director:</b>", "</div>", tmpstr, 0); 341 string_striptags((*first)->director); 342 string_strip_whitechars((*first)->director); 343 strstrip((*first)->director); 344 } 345 346 if((*first)->director == NULL && ostrstr(tmpstr, ">Creator:</h4>") != NULL) 347 { 348 tmpstr1 = string_resub(">Creator:</h4>", "</div>", tmpstr, 0); 349 350 while(ostrstr(tmpstr1, "\"name\"") != NULL) 351 { 352 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 353 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 354 if((*first)->director != NULL && tmpstr2 != NULL) 355 (*first)->director = ostrcat((*first)->director, ",", 1, 0); 356 357 (*first)->director = ostrcat((*first)->director, tmpstr2, 1, 0); 358 free(tmpstr2), tmpstr2 = NULL; 359 } 360 free(tmpstr1), tmpstr1 = NULL; 361 362 string_striptags((*first)->director); 363 string_strip_whitechars((*first)->director); 364 strstrip((*first)->director); 365 } 366 367 if((*first)->director == NULL && ostrstr(tmpstr, ">Creators:</h4>") != NULL) 368 { 369 tmpstr1 = string_resub(">Creators:</h4>", "</div>", tmpstr, 0); 370 371 while(ostrstr(tmpstr1, "\"name\"") != NULL) 372 { 373 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 374 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 375 if((*first)->director != NULL && tmpstr2 != NULL) 376 (*first)->director = ostrcat((*first)->director, ",", 1, 0); 377 378 (*first)->director = ostrcat((*first)->director, tmpstr2, 1, 0); 379 free(tmpstr2), tmpstr2 = NULL; 380 } 381 free(tmpstr1), tmpstr1 = NULL; 382 383 string_striptags((*first)->director); 384 string_strip_whitechars((*first)->director); 385 strstrip((*first)->director); 386 } 387 388 if(ostrstr(tmpstr, ">Release Date:</h4>") != NULL) 389 { 390 (*first)->released = string_resub(">Release Date:</h4>", "<span", tmpstr, 0); 279 391 string_striptags((*first)->released); 280 392 string_strip_whitechars((*first)->released); … … 282 394 } 283 395 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); 396 if(ostrstr(tmpstr, ">Star:</h4>") != NULL) 397 { 398 tmpstr1 = string_resub(">Star:</h4>", "</div>", tmpstr, 0); 399 400 while(ostrstr(tmpstr1, "\"name\"") != NULL) 401 { 402 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 403 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 404 if((*first)->actors != NULL && tmpstr2 != NULL) 405 (*first)->actors = ostrcat((*first)->actors, ",", 1, 0); 406 407 (*first)->actors = ostrcat((*first)->actors, tmpstr2, 1, 0); 408 free(tmpstr2), tmpstr2 = NULL; 409 } 410 free(tmpstr1), tmpstr1 = NULL; 411 294 412 string_striptags((*first)->actors); 295 413 string_strip_whitechars((*first)->actors); … … 297 415 } 298 416 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; 417 if(ostrstr(tmpstr, ">Stars:</h4>") != NULL) 418 { 419 tmpstr1 = string_resub(">Stars:</h4>", "</div>", tmpstr, 0); 420 421 while(ostrstr(tmpstr1, "\"name\"") != NULL) 422 { 423 tmpstr2 = string_resub("\"name\">", "</span>", tmpstr1, 0); 424 tmpstr1 = string_replace("\"name\">", "", tmpstr1, 1); 425 if((*first)->actors != NULL && tmpstr2 != NULL) 426 (*first)->actors = ostrcat((*first)->actors, ",", 1, 0); 427 428 (*first)->actors = ostrcat((*first)->actors, tmpstr2, 1, 0); 429 free(tmpstr2), tmpstr2 = NULL; 430 } 431 free(tmpstr1), tmpstr1 = NULL; 432 433 string_striptags((*first)->actors); 434 string_strip_whitechars((*first)->actors); 435 strstrip((*first)->actors); 436 } 437 438 if(ostrstr(tmpstr, "\"description\">") != NULL) 439 { 440 tmpstr1 = string_resub("\"description\">", "</div>", tmpstr, 0); 441 (*first)->plot = string_resub("<p>", "</p>", tmpstr1, 0); 442 } 443 444 if(ostrstr(tmpstr, "<meta property='og:image' content=\"") != NULL) 445 { 446 (*first)->thumb = string_resub("<meta property='og:image' content=\"", "\"", tmpstr, 0); 307 447 } 308 448 … … 338 478 } 339 479 340 if(*first != NULL && (*first)->id == NULL) 480 // if(*first != NULL && (*first)->id == NULL) 481 if(*first != NULL && (*first)->id != NULL) 341 482 { 342 483 tmpsearch = ostrcat("/title/tt", NULL, 0, 0); … … 345 486 346 487 tmpstr = gethttp("www.imdb.de", tmpsearch, 80, NULL, NULL, 5000, NULL, 0); 488 // writesys("/var/usr/local/share/titan/plugins/imdb/tmpstrplot", tmpstr, 0); 347 489 348 490 debug(133, "tmpsearch: %s", tmpsearch); … … 353 495 if(*first != NULL && tmpstr != NULL) 354 496 { 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); 497 if(ostrstr(tmpstr, "<p class=\"plotSummary\">") != NULL) 498 { 499 tmpstr1 = string_resub("<p class=\"plotSummary\">", "<span", tmpstr, 0); 500 if(tmpstr1 != NULL) 501 { 502 (*first)->plot = ostrcat((*first)->plot, tmpstr1, 1, 0); 503 string_striptags((*first)->plot); 504 string_strip_whitechars((*first)->plot); 505 strstrip((*first)->plot); 506 } 507 free(tmpstr1), tmpstr1 = NULL; 362 508 } 363 509 free(tmpstr), tmpstr = NULL; 364 510 } 365 511 366 512 if(flag2 == 0 && *first != NULL && (*first)->id != NULL) 367 513 {
Note: See TracChangeset
for help on using the changeset viewer.