Changeset 35395 for titan/plugins/tithek/amazon.h
- Timestamp:
- 09/05/15 16:12:50 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tithek/amazon.h
r35361 r35395 363 363 return ret; 364 364 365 unlink("/tmp/amazon_search_tmpstr_get");366 367 char* tmpstr = NULL, *search = NULL, *line = NULL, *url = NULL, *tmpstr2 = NULL, *id = NULL, *streamurl = NULL, *pic = NULL, *year = NULL, *runtime = NULL, *menu = NULL;368 369 if(flag == 0 )370 { 365 char* tmpstr2 = NULL, *tmpstr3 = NULL, *filename = NULL, *tmpstr = NULL, *search = NULL, *line = NULL, *url = NULL, *id = NULL, *streamurl = NULL, *pic = NULL, *year = NULL, *runtime = NULL, *menu = NULL; 366 367 tmpstr2 = ostrcat(tmpstr2, "_get", 1, 0); 368 369 if(flag == 0 || flag == 1) 370 { 371 371 if(searchstr == NULL) 372 372 search = textinputhist(_("Search"), " ", "searchhist"); … … 375 375 } 376 376 377 int loginret = 0 ;377 int loginret = 0, type = 0; 378 378 loginret = login(); 379 379 printf("loginret=%d\n", loginret); … … 387 387 drawscreen(load, 0, 0); 388 388 search = stringreplacechar(search, ' ', '+'); 389 url = ostrcat("http://www.amazon.de/mn/search/ajax/?_encoding=UTF8&url=node%3D3356018031&field-keywords=", search, 0, 0); 389 if(flag == 0) 390 { 391 filename = ostrcat("movie", NULL, 0, 0); 392 type = 75; 393 url = ostrcat("http://www.amazon.de/mn/search/ajax/?_encoding=UTF8&url=node%3D3356018031&field-keywords=", search, 0, 0); 394 } 395 else if(flag == 1) 396 { 397 filename = ostrcat("season", NULL, 0, 0); 398 type = 78; 399 url = ostrcat("http://www.amazon.de/mn/search/ajax/?_encoding=UTF8&url=node%3D3356019031&field-keywords=", search, 0, 0); 400 } 401 else if(flag == 2) 402 { 403 filename = ostrcat("episode", NULL, 0, 0); 404 type = 75; 405 url = ostrcat("http://www.amazon.de/dp/", link, 0, 0); 406 url = ostrcat(url, "/?_encoding=UTF8", 1, 0); 407 } 408 409 tmpstr2 = ostrcat("/tmp/amazon_search_tmpstr_get", filename, 0, 0); 410 unlink(tmpstr2); 411 412 tmpstr3 = ostrcat(tmpstr3, "_replace", 1, 0); 413 unlink(tmpstr3); 414 390 415 /////////////////////////// 391 416 debug(99, "url: %s", url); 392 417 tmpstr = gethttps(url, NULL); 393 titheklog(debuglevel, "/tmp/amazon_search_tmpstr_get", NULL, NULL, NULL, tmpstr);418 titheklog(debuglevel, tmpstr2, NULL, NULL, NULL, tmpstr); 394 419 free(url), url = NULL; 395 420 /////////////////////////// … … 400 425 // tmpstr2 = string_resub("\"value\" : \"<div id=\\\"centerMinus\\\"", "\"tagId\" : \"centerMinus\"", curlretbuf, 0); 401 426 // tmpstr2 = string_resub("\"value\" : \"<div id=\\\"centerBelowPlus\\\"", "\"tagId\" : \"centerBelowPlus\"", curlretbuf, 0); 402 // tmpstr2 = ostrcat(curlretbuf, NULL, 0, 0); 403 tmpstr = string_replace_all("<li id=\\\"result_", "\n<li id=\\\"result_", tmpstr, 1); 427 428 if(flag == 0 || flag == 1) 429 tmpstr = string_replace_all("<li id=\\\"result_", "\n<li id=\\\"result_", tmpstr, 1); 430 else 431 { 432 tmpstr = string_replace_all("\n", " ", tmpstr, 1); 433 tmpstr = string_replace_all("<li class=\"selected-episode", "\n<li class=\"\">", tmpstr, 1); 434 tmpstr = string_replace_all("<li class=\"\">", "\n<li class=\"\">", tmpstr, 1); 435 tmpstr = string_replace_all("<li class=\"last-episode", "\n<li class=\"last-episode", tmpstr, 1); 436 } 437 titheklog(debuglevel, tmpstr3, NULL, NULL, NULL, tmpstr); 404 438 405 439 count1 = 0; … … 416 450 if(ostrstr(ret1[j].part, "result_") != NULL) 417 451 { 418 // printf("(%d) ret1[j].part: %s\n", j, ret1[j].part); 419 452 printf("(%d) ret1[j].part: %s\n", j, ret1[j].part); 420 453 streamurl = string_resub("\" href=\\\"", "\\\">", ret1[j].part, 0); 421 454 pic = string_resub("\" src=\\\"", "\\\"", ret1[j].part, 0); 455 if(pic == NULL) 456 pic = ostrcat(pic, "http://atemio.dyndns.tv/mediathek/menu/default.jpg", 1, 0); 422 457 title = string_resub("\" title=\\\"", "\\\"", ret1[j].part, 0); 423 458 year = string_resub("<span class=\\\"a-size-small a-color-secondary\\\">", "</span>", ret1[j].part, 0); 424 459 runtime = oregex(".*a-size-small a-color-secondary.*>(.*)</span>.*", ret1[j].part); 425 460 id = oregex("http.*//.*/.*/(.*)/ref.*", streamurl); 426 427 // printf("(%d) streamurl: %s\n", j, streamurl); 461 } 462 else if(ostrstr(ret1[j].part, "<li class=\"\">") != NULL) 463 { 464 printf("(%d) ret1[j].part: %s\n", j, ret1[j].part); 465 streamurl = string_resub("href=\"", "\"", ret1[j].part, 0); 466 pic = string_resub("src=\"", "\"", ret1[j].part, 0); 467 if(pic == NULL) 468 pic = ostrcat(pic, "http://atemio.dyndns.tv/mediathek/menu/default.jpg", 1, 0); 469 title = string_resub("<span class=\"episode-title\">", "</span>", ret1[j].part, 0); 470 year = string_resub("<span class=\"dv-badge release-date\">", "</span>", ret1[j].part, 0); 471 runtime = string_resub("<span class=\"dv-badge runtime\">", "</span>", ret1[j].part, 0); 472 id = oregex("http.*//.*/.*/(.*)/ref.*", streamurl); 473 } 474 475 if(ostrstr(ret1[j].part, "result_") != NULL || ostrstr(ret1[j].part, "<li class=\"\">") != NULL) 476 { 477 debug(99, "(%d) streamurl: %s", j, streamurl); 428 478 free(streamurl), streamurl = NULL; 429 479 streamurl = ostrcat("http://www.amazon.de/dp/", id, 0, 0); 430 480 streamurl = ostrcat(streamurl, "/?_encoding=UTF8", 1, 0); 431 // printf("(%d) streamurl changed: %s\n", j, streamurl);432 // printf("(%d) id: %s\n", j, id);433 // printf("(%d) pic: %s\n", j, pic);434 // printf("(%d) title: %s\n", j, title);435 // printf("(%d) year: %s\n", j, year);436 // printf("(%d) runtime: %s\n", j, runtime);437 // printf("----------------------\n");481 debug(99, "(%d) streamurl changed: %s", j, streamurl); 482 debug(99, "(%d) id: %s", j, id); 483 debug(99, "(%d) pic: %s", j, pic); 484 debug(99, "(%d) title: %s", j, title); 485 debug(99, "(%d) year: %s", j, year); 486 debug(99, "(%d) runtime: %s", j, runtime); 487 debug(99, "----------------------"); 438 488 439 489 if(streamurl != NULL) … … 447 497 line = ostrcat(line, "#", 1, 0); 448 498 line = ostrcat(line, id, 1, 0); 499 // line = ostrcat(line, streamurl, 1, 0); 449 500 line = ostrcat(line, "#", 1, 0); 450 501 line = ostrcat(line, pic, 1, 0); 451 502 line = ostrcat(line, "#amazon_search_", 1, 0); 452 line = ostrcat(line, oitoa(incount + time(NULL)), 1, 0); 453 line = ostrcat(line, ".jpg#Amazon - Search#75\n", 1, 0); 503 line = ostrcat(line, oitoa(incount + time(NULL)), 1, 1); 504 line = ostrcat(line, ".jpg#Amazon - Search#", 1, 0); 505 line = ostrcat(line, oitoa(type), 1, 1); 506 line = ostrcat(line, "\n", 1, 0); 454 507 } 455 508 … … 468 521 if(line != NULL) 469 522 { 470 menu = ostrcat("/tmp/tithek/amazon.search.list", NULL, 0, 0); 523 printf("line: %s\n", line); 524 menu = ostrcat("/tmp/tithek/amazon.", NULL, 0, 0); 525 menu = ostrcat(menu, filename, 1, 0); 526 menu = ostrcat(menu, ".list", 1, 0); 471 527 writesys(menu, line, 0); 472 528 struct tithek* tnode = (struct tithek*)listbox->select->handle; … … 511 567 } 512 568 569 free(filename), filename = NULL; 513 570 free(menu), menu = NULL; 514 571 free(runtime), runtime = NULL; … … 518 575 free(streamurl), streamurl = NULL; 519 576 free(id), id = NULL; 520 // free(tmpstr2), tmpstr2 = NULL; 577 free(tmpstr2), tmpstr2 = NULL; 578 free(tmpstr3), tmpstr3 = NULL; 521 579 free(line), line = NULL; 522 580 free(streamurl), streamurl = NULL;
Note: See TracChangeset
for help on using the changeset viewer.