Changeset 35474 for titan/plugins
- Timestamp:
- 09/09/15 17:05:27 (9 years ago)
- Location:
- titan/plugins/tithek
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tithek/amazon.h
r35398 r35474 2 2 #define AMAZON_H 3 3 4 char* amazon_hoster(char* link) 4 void amazon_init(char* titheklink, char* tithekfile) 5 { 6 int ret = 0; 7 char* tmpstr = NULL; 8 9 if(ostrcmp("http://atemio.dyndns.tv/mediathek/mainmenu.list", titheklink) == 0) 10 writesys(tithekfile, "Amazon#/tmp/tithek/amazon.mainmenu.list#http://atemio.dyndns.tv/mediathek/menu/amazon.jpg#amazon.jpg#TiThek#81", 3); 11 12 if(ostrcmp("/tmp/tithek/amazon.mainmenu.list", titheklink) == 0) 13 { 14 if(amazonlogin == 0) 15 { 16 ret = amazon_login(); 17 if(ret == 0) 18 textbox(_("Message"), _("Amazon login not successful! Please check Amazon Prime User/Pass in Tithek settings and try again."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 200, 0, 0); 19 else 20 { 21 textbox(_("Message"), _("Amazon Prime login successful!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0); 22 amazonlogin = 1; 23 } 24 } 25 unlink(tithekfile); 26 printf("add amazon mainmenu entrys\n"); 27 writesys(tithekfile, "Watchlist (Movie)#/tmp/tithek/amazon.watchlist.movie.list#http://atemio.dyndns.tv/mediathek/menu/amazon.watchlist.movie.jpg#amazon.watchlist.movie.jpg#Amazon#79", 3); 28 writesys(tithekfile, "Watchlist (Tv)#/tmp/tithek/amazon.watchlist.tv.list#http://atemio.dyndns.tv/mediathek/menu/amazon.watchlist.tv.jpg#amazon.watchlist.tv.jpg#Amazon#80", 3); 29 30 // writesys(tithekfile, "Search (Movie)#/tmp/tithek/amazon.search.movie.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#76", 3); 31 tmpstr = ostrcat(_("Search"), " (Movie)#/tmp/tithek/amazon.search.movie.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#76", 0, 0); 32 writesys(tithekfile, tmpstr, 3); 33 free(tmpstr), tmpstr = NULL; 34 35 // writesys(tithekfile, "Search (Tv)#/tmp/tithek/amazon.search.tv.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#77", 3); 36 tmpstr = ostrcat(_("Search"), " (Tv)#/tmp/tithek/amazon.search.tv.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#77", 0, 0); 37 writesys(tithekfile, tmpstr, 3); 38 } 39 free(tmpstr), tmpstr = NULL; 40 } 41 42 void amazon_deinit() 5 43 { 6 44 int debuglevel = getconfigint("debuglevel", NULL); 7 45 8 printf("amazon hoster...\n"); 9 debug(99, "link: %s", link); 10 char* streamurl = NULL; 11 12 streamurl = hoster(link); 13 debug(99, "streamurl1: %s", streamurl); 14 15 streamurl = string_replace_all("amp;", "", streamurl, 1); 16 debug(99, "streamurl2: %s", streamurl); 17 18 return streamurl; 46 // logout 47 // curlretbuf = gethttps_get("https://www.amazon.de/ap/signin?_encoding=UTF8&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26action%3Dsign-out%26path%3D%252Fgp%252Fyourstore%252Fhome%26ref_%3Dnav__gno_signout%26signIn%3D1%26useRedirectOnSuccess%3D1", NULL, debuglevel); 48 // 49 char* tmpstr = NULL; 50 tmpstr = gethttps("https://www.amazon.de/ap/signin?_encoding=UTF8&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26action%3Dsign-out%26path%3D%252Fgp%252Fyourstore%252Fhome%26ref_%3Dnav__gno_signout%26signIn%3D1%26useRedirectOnSuccess%3D1", NULL, NULL, 1); 51 titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/amazon_tmpstr_get0_logout", NULL, NULL, NULL, tmpstr); 52 free(tmpstr), tmpstr = NULL; 19 53 } 20 54 … … 34 68 35 69 ////////////////////////////////////////////////// 36 tmpstr = gethttps(url, NULL );70 tmpstr = gethttps(url, NULL, NULL, 1); 37 71 titheklog(debuglevel, "/tmp/amazon_streamurl_get1", NULL, NULL, NULL, tmpstr); 38 72 free(url), url = NULL; … … 64 98 65 99 ////////////////////////////////////////////////// 66 tmpstr = gethttps(url, NULL );100 tmpstr = gethttps(url, NULL, NULL, 1); 67 101 titheklog(debuglevel, "/tmp/amazon_streamurl_get2", NULL, NULL, NULL, tmpstr); 68 102 free(url), url = NULL; … … 81 115 82 116 ////////////////////////////////////////////////// 83 tmpstr = gethttps(url, NULL );117 tmpstr = gethttps(url, NULL, NULL, 1); 84 118 titheklog(debuglevel, "/tmp/amazon_streamurl_get3", NULL, NULL, NULL, tmpstr); 85 119 free(url), url = NULL; … … 92 126 93 127 url = ostrcat("https://", apimain, 0, 0); 94 url = ostrcat(url, ".amazon.com/cdp/catalog/GetStreamingUrlSets?version=1&format=json&firmware=WIN%2011,7,700,224%20PlugIn&marketplaceID=", 1, 0); 95 // trailer 96 // url = ostrcat(url, ".amazon.com/cdp/catalog/GetStreamingTrailerUrls?version=1&format=json&firmware=WIN%2011,7,700,224%20PlugIn&marketplaceID=", 1, 0); 128 if(amazonlogin == 1) 129 url = ostrcat(url, ".amazon.com/cdp/catalog/GetStreamingUrlSets?version=1&format=json&firmware=WIN%2011,7,700,224%20PlugIn&marketplaceID=", 1, 0); 130 else // trailer 131 url = ostrcat(url, ".amazon.com/cdp/catalog/GetStreamingTrailerUrls?version=1&format=json&firmware=WIN%2011,7,700,224%20PlugIn&marketplaceID=", 1, 0); 97 132 url = ostrcat(url, marketplaceid, 1, 0); 98 133 url = ostrcat(url, "&token=", 1, 0); … … 112 147 113 148 ////////////////////////////////////////////////// 114 tmpstr = gethttps(url, NULL );149 tmpstr = gethttps(url, NULL, NULL, 1); 115 150 titheklog(debuglevel, "/tmp/amazon_streamurl_get4", NULL, NULL, NULL, tmpstr); 116 151 free(url), url = NULL; … … 193 228 } 194 229 195 int login() 230 231 int amazon_login() 196 232 { 197 233 int ret = 0; … … 213 249 // titheklog(debuglevel, "/tmp/amazon_tmpstr_get0_logout", NULL, NULL, NULL, curlretbuf); 214 250 215 tmpstr = gethttps("https://www.amazon.de/", NULL );251 tmpstr = gethttps("https://www.amazon.de/", NULL, NULL, 1); 216 252 // debug(99, "tmpstr: %s", curlretbuf); 217 253 titheklog(debuglevel, "/tmp/amazon_tmpstr_get1_blank", NULL, NULL, NULL, tmpstr); … … 219 255 login = string_resub("'config.signOutText',", ");", tmpstr, 0); 220 256 free(tmpstr), tmpstr = NULL; 221 //debug(99, "login: %s", login);257 debug(99, "login: %s", login); 222 258 strstrip(login); 223 //debug(99, "login: %s", login);259 debug(99, "login: %s", login); 224 260 225 261 if(login == NULL || ostrcmp("null", login) == 0) … … 237 273 if(ret == 0) 238 274 { 239 tmpstr = gethttps("https://www.amazon.de/gp/sign-in.html", NULL );275 tmpstr = gethttps("https://www.amazon.de/gp/sign-in.html", NULL, NULL, 1); 240 276 titheklog(debuglevel, "/tmp/amazon_tmpstr_get2_sign-in", NULL, NULL, NULL, tmpstr); 241 277 … … 319 355 hash = ostrcat(hash, pass, 1, 1); 320 356 321 tmpstr = gethttps("https://www.amazon.de/ap/signin", hash);357 tmpstr = gethttps("https://www.amazon.de/ap/signin", NULL, hash, 1); 322 358 // debug(99, "ret=%s", tmpstr); 323 359 titheklog(debuglevel, "/tmp/amazon_tmpstr_post1", NULL, NULL, NULL, tmpstr); 324 360 free(tmpstr), tmpstr = NULL; 325 361 326 tmpstr = gethttps("https://www.amazon.de/", NULL );362 tmpstr = gethttps("https://www.amazon.de/", NULL, NULL, 1); 327 363 // debug(99, "tmpstr: %s", tmpstr); 328 364 titheklog(debuglevel, "/tmp/amazon_tmpstr_get3_blank", NULL, NULL, NULL, tmpstr); 329 365 free(tmpstr), tmpstr = NULL; 330 366 331 tmpstr = gethttps("https://www.amazon.de/", NULL );367 tmpstr = gethttps("https://www.amazon.de/", NULL, NULL, 1); 332 368 // debug(99, "tmpstr: %s", curlretbuf); 333 369 titheklog(debuglevel, "/tmp/amazon_tmpstr_get4_blank", NULL, NULL, NULL, tmpstr); … … 335 371 336 372 login = string_resub("'config.signOutText',", ");", tmpstr, 0); 337 //debug(99, "login: %s", login);373 debug(99, "login: %s", login); 338 374 strstrip(login); 339 //debug(99, "login: %s", login);375 debug(99, "login: %s", login); 340 376 free(tmpstr), tmpstr = NULL; 341 377 … … 357 393 int amazon_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) 358 394 { 359 int ret = 1 ;395 int ret = 1, type = 0; 360 396 int debuglevel = getconfigint("debuglevel", NULL); 361 397 … … 363 399 return ret; 364 400 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;401 char* remove = NULL, *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 402 367 403 tmpstr2 = ostrcat(tmpstr2, "_get", 1, 0); … … 375 411 } 376 412 413 /* 377 414 int loginret = 0, type = 0; 378 415 loginret = login(); … … 382 419 else 383 420 textbox(_("Message"), _("Amazon Prime login successful!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0); 384 421 */ 385 422 if(search != NULL || flag > 0) 386 423 { … … 406 443 url = ostrcat(url, "/?_encoding=UTF8", 1, 0); 407 444 } 408 409 tmpstr2 = ostrcat("/tmp/amazon_search_tmpstr_get", filename, 0, 0); 445 else if(flag == 3) 446 { 447 filename = ostrcat("watchlist.movie", NULL, 0, 0); 448 type = 75; 449 url = ostrcat("http://www.amazon.de/gp/video/watchlist/movie?ie=UTF8&show=all&sort=DATE_ADDED_DESC", NULL, 0, 0); 450 } 451 else if(flag == 4) 452 { 453 filename = ostrcat("watchlist.tv", NULL, 0, 0); 454 type = 78; 455 url = ostrcat("http://www.amazon.de/gp/video/watchlist/tv?ie=UTF8&show=all&sort=DATE_ADDED_DESC", NULL, 0, 0); 456 } 457 458 // tmpstr2 = ostrcat("/tmp/amazon_search_tmpstr_get", filename, 0, 0); 459 tmpstr2 = ostrcat("/var/usr/local/share/titan/plugins/tithek/amazon_search_tmpstr_get", filename, 0, 0); 410 460 unlink(tmpstr2); 411 461 … … 415 465 /////////////////////////// 416 466 debug(99, "url: %s", url); 417 tmpstr = gethttps(url, NULL );467 tmpstr = gethttps(url, NULL, NULL, 1); 418 468 titheklog(debuglevel, tmpstr2, NULL, NULL, NULL, tmpstr); 419 469 free(url), url = NULL; … … 428 478 if(flag == 0 || flag == 1) 429 479 tmpstr = string_replace_all("<li id=\\\"result_", "\n<li id=\\\"result_", tmpstr, 1); 430 else 480 else if(flag == 2) 431 481 { 432 482 tmpstr = string_replace_all("\n", " ", tmpstr, 1); … … 435 485 tmpstr = string_replace_all("<li class=\"last-episode", "\n<li class=\"last-episode", tmpstr, 1); 436 486 } 487 else if(flag == 3 || flag == 4) 488 { 489 tmpstr = string_replace_all("\n", " ", tmpstr, 1); 490 tmpstr = string_replace_all("<div class=\"grid-list-item downloadable_", "\n<div class=\"grid-list-item downloadable_", tmpstr, 1); 491 tmpstr = string_replace_all("<script type=\"text/javascript\">", "\n<script type=\"text/javascript\">", tmpstr, 1); 492 } 493 437 494 titheklog(debuglevel, tmpstr3, NULL, NULL, NULL, tmpstr); 438 495 … … 472 529 id = oregex("http.*//.*/.*/(.*)/ref.*", streamurl); 473 530 } 474 475 if(ostrstr(ret1[j].part, "result_") != NULL || ostrstr(ret1[j].part, "<li class=\"\">") != NULL) 531 else if(ostrstr(ret1[j].part, "<div class=\"grid-list-item downloadable_") != NULL) 532 { 533 printf("(%d) ret1[j].part: %s\n", j, ret1[j].part); 534 streamurl = string_resub("href=\"", "\"", ret1[j].part, 0); 535 pic = string_resub("src=\"", "\"", ret1[j].part, 0); 536 if(pic == NULL) 537 pic = ostrcat(pic, "http://atemio.dyndns.tv/mediathek/menu/default.jpg", 1, 0); 538 title = string_resub("data-title=\"", "\"", ret1[j].part, 0); 539 year = string_resub("<span class=\"dv-badge release-date\">", "</span>", ret1[j].part, 0); 540 runtime = string_resub("<span class=\"dv-badge runtime\">", "</span>", ret1[j].part, 0); 541 id = string_resub("id=\"", "\"", ret1[j].part, 0); 542 remove = string_resub("data-action=\"remove\" href=\"", "\"", ret1[j].part, 0); 543 debug(99, "(%d) remove: %s", j, remove); 544 } 545 546 if(ostrstr(ret1[j].part, "result_") != NULL || ostrstr(ret1[j].part, "<li class=\"\">") != NULL || ostrstr(ret1[j].part, "<div class=\"grid-list-item downloadable_") != NULL) 476 547 { 477 548 debug(99, "(%d) streamurl: %s", j, streamurl); … … 487 558 debug(99, "----------------------"); 488 559 489 if( streamurl!= NULL)560 if(id != NULL) 490 561 { 491 562 incount += 1; … … 513 584 free(year), year = NULL; 514 585 free(runtime), runtime = NULL; 586 free(remove), remove = NULL; 515 587 } 516 588 } -
titan/plugins/tithek/tithek.c
r35293 r35474 102 102 titheksolarmovie = 1; 103 103 tithekmlehd = 1; 104 104 amazonlogin = 0; 105 105 106 //change markcolor 106 107 long tmplistboxselectcol = status.listboxselectcol; -
titan/plugins/tithek/tithek.h
r35395 r35474 11 11 int titheksolarmovie = 0; 12 12 int tithekmlehd = 0; 13 int amazonlogin = 0; 13 14 14 15 //flag 0 - menu … … 92 93 //flag 77 - amazon series search 93 94 //flag 78 - amazon series listed search 94 //flag 80 - amazon local search 95 //flag 79 - amazon watchlist movie 96 //flag 80 - amazon watchlist tv 95 97 //flag 100 - all local search 96 98 //flag 1000 - menu pincode … … 575 577 char* tithekdownload(char* link, char* localname, char* pw, int pic, int flag) 576 578 { 577 int ret = 1, port = 80, timeout = 10000 ;579 int ret = 1, port = 80, timeout = 10000, ssl = 0; 578 580 char* ip = NULL, *pos = NULL, *path = NULL; 579 581 char* tmpstr = NULL, *localfile = NULL; 580 582 581 583 if(link == NULL) return NULL; 582 if(ostrncmp("http://", link, 7)) return NULL; 583 584 ip = string_replace("http://", "", (char*)link, 0); 585 // tithek security 586 ip = string_replace_all("imageshack.us/md/up/grd/", "atemio.dyndns.tv/", ip, 1); 587 588 ip = string_replace_all("kinox.to", "kinox.me", ip, 1); 589 //ip = string_replace_all("movie4k.to", "movie4k.me", ip, 1); 590 591 if(ip != NULL) 592 pos = strchr(ip, '/'); 593 if(pos != NULL) 594 { 595 pos[0] = '\0'; 596 path = pos + 1; 597 } 598 599 if(ostrstr(ip, ":") != NULL) 600 { 601 ip = oregex("http://(.*):.*", link); 602 port = atoi(oregex("http://.*:(.*)/.*", link)); 584 if(ostrncmp("http://", link, 7) && ostrncmp("https://", link, 8)) return NULL; 585 586 if(!ostrncmp("https://", link, 8)) 587 ssl = 1; 588 else 589 { 590 ip = string_replace("http://", "", (char*)link, 0); 591 592 // tithek security 593 ip = string_replace_all("imageshack.us/md/up/grd/", "atemio.dyndns.tv/", ip, 1); 594 595 ip = string_replace_all("kinox.to", "kinox.me", ip, 1); 596 //ip = string_replace_all("movie4k.to", "movie4k.me", ip, 1); 597 598 if(ip != NULL) 599 pos = strchr(ip, '/'); 600 if(pos != NULL) 601 { 602 pos[0] = '\0'; 603 path = pos + 1; 604 } 605 606 if(ostrstr(ip, ":") != NULL) 607 { 608 ip = oregex("http://(.*):.*", link); 609 port = atoi(oregex("http://.*:(.*)/.*", link)); 610 } 603 611 } 604 612 … … 621 629 localfile = ostrcat(localfile, localname, 1, 0); 622 630 } 631 free(tmpstr); tmpstr = NULL; 623 632 624 633 /* … … 631 640 debug(99, "path: %s", path); 632 641 debug(99, "localfile: %s", localfile); 633 //debug(99, "pw: %s", pw);642 debug(99, "pw: %s", pw); 634 643 debug(99, "---------------------------------------"); 635 644 */ … … 640 649 if(pic == 1) 641 650 { 642 if(tithekdownloadcount >= 24) //start max 24 threads 651 if(ssl == 1) 652 gethttps(link, localfile, NULL, 0); 653 else if(tithekdownloadcount >= 24) //start max 24 threads 643 654 gethttp(ip, path, port, localfile, pw, timeout, NULL, 0); 644 655 else … … 695 706 localfile = 1; 696 707 } 708 709 amazon_init(titheklink, tithekfile); 697 710 698 711 delmarkedscreennodes(grid, 1); … … 2142 2155 if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break; 2143 2156 } 2157 else if(((struct tithek*)listbox->select->handle)->flag == 79) 2158 { 2159 if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 3) == 0) 2160 if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break; 2161 } 2162 else if(((struct tithek*)listbox->select->handle)->flag == 80) 2163 { 2164 if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 4) == 0) 2165 if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break; 2166 } 2144 2167 else if((((struct tithek*)listbox->select->handle)->flag == 66)) 2145 2168 { … … 2228 2251 } 2229 2252 2253 amazon_deinit(); 2254 2230 2255 delmarkedscreennodes(grid, 1); 2231 2256 delownerrc(grid); -
titan/plugins/tithek/tithek_global.h
r35352 r35474 29 29 } 30 30 31 char* gethttps(char* url, char* data) 31 // flag = 0 (without header in output) 32 // flag = 1 (with header in output) 33 char* gethttps(char* url, char* localfile, char* data, int flag) 32 34 { 33 35 debug(99, "url: %s", url); 34 36 35 37 int debuglevel = getconfigint("debuglevel", NULL); 36 38 39 char* tmpstr = NULL; 40 FILE *fp; 41 37 42 CURL *curl_handle; 38 43 CURLcode res; … … 44 49 45 50 curl_global_init(CURL_GLOBAL_ALL); 46 51 47 52 /* init the curl session */ 48 53 curl_handle = curl_easy_init(); 49 54 if(curl_handle) 50 55 { 56 if(localfile != NULL) 57 fp = fopen(localfile,"wb"); 58 51 59 /* specify URL to get */ 52 60 curl_easy_setopt(curl_handle, CURLOPT_URL, url); … … 55 63 else 56 64 curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, data); 57 curl_easy_setopt(curl_handle, CURLOPT_HEADER, 1L); 65 if(flag == 1) 66 curl_easy_setopt(curl_handle, CURLOPT_HEADER, 1L); 58 67 curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 5); 59 68 curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 20); 60 69 /* send all data to this function */ 61 curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); 70 if(localfile == NULL) 71 curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); 72 else 73 curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, NULL); 74 62 75 /* we pass our 'chunk' struct to the callback function */ 63 curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); 76 if(localfile == NULL) 77 curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); 78 else 79 curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, fp); 80 64 81 /* some servers don't like requests that are made without a user-agent field, so we provide one */ 65 82 curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); … … 94 111 /* cleanup curl stuff */ 95 112 curl_easy_cleanup(curl_handle); 96 } 97 char* tmpstr = NULL; 113 if(localfile != NULL) 114 fclose(fp); 115 } 116 98 117 tmpstr = ostrcat(chunk.memory, NULL, 0, 0); 99 118 free(chunk.memory); … … 101 120 curl_global_cleanup(); 102 121 122 if(localfile != NULL) 123 free(tmpstr), tmpstr = NULL; 103 124 return tmpstr; 104 125 } -
titan/plugins/tithek/tithek_header.h
r35286 r35474 1 1 #ifndef TITHEK_HEADER_H 2 2 #define TITHEK_HEADER_H 3 4 char* gethttps(char* url, char* localfile, char* data, int flag); 5 void amazon_init(char* titheklink, char* tithekfile); 6 void amazon_deinit(); 3 7 4 8 void titheklog(int debuglevel, char* name1, char* name2, char* name3, char* name4, char* content)
Note: See TracChangeset
for help on using the changeset viewer.