Changeset 35395


Ignore:
Timestamp:
09/05/15 16:12:50 (9 years ago)
Author:
obi
Message:

[tithek] amazon add serie search

Location:
titan
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/tithek/amazon.h

    r35361 r35395  
    363363                return ret;
    364364
    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        {
    371371                if(searchstr == NULL)
    372372                        search = textinputhist(_("Search"), " ", "searchhist");
     
    375375        }
    376376
    377         int loginret = 0;
     377        int loginret = 0, type = 0;
    378378        loginret = login();
    379379        printf("loginret=%d\n", loginret);
     
    387387                drawscreen(load, 0, 0);
    388388                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
    390415///////////////////////////
    391416                debug(99, "url: %s", url);
    392417                tmpstr = gethttps(url, NULL);
    393                 titheklog(debuglevel, "/tmp/amazon_search_tmpstr_get", NULL, NULL, NULL, tmpstr);               
     418                titheklog(debuglevel, tmpstr2, NULL, NULL, NULL, tmpstr);               
    394419                free(url), url = NULL;
    395420///////////////////////////
     
    400425//              tmpstr2 = string_resub("\"value\" : \"<div id=\\\"centerMinus\\\"", "\"tagId\" : \"centerMinus\"", curlretbuf, 0);     
    401426//              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);               
    404438
    405439                count1 = 0;
     
    416450                                if(ostrstr(ret1[j].part, "result_") != NULL)
    417451                                {
    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);
    420453                                        streamurl = string_resub("\" href=\\\"", "\\\">", ret1[j].part, 0);
    421454                                        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);
    422457                                        title = string_resub("\" title=\\\"", "\\\"", ret1[j].part, 0);
    423458                                        year = string_resub("<span class=\\\"a-size-small a-color-secondary\\\">", "</span>", ret1[j].part, 0);
    424459                                        runtime = oregex(".*a-size-small a-color-secondary.*>(.*)</span>.*", ret1[j].part);
    425460                                        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);
    428478                                        free(streamurl), streamurl = NULL;
    429479                                        streamurl = ostrcat("http://www.amazon.de/dp/", id, 0, 0);
    430480                                        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, "----------------------");
    438488
    439489                                        if(streamurl != NULL)
     
    447497                                                line = ostrcat(line, "#", 1, 0);
    448498                                                line = ostrcat(line, id, 1, 0);
     499//                                              line = ostrcat(line, streamurl, 1, 0);
    449500                                                line = ostrcat(line, "#", 1, 0);
    450501                                                line = ostrcat(line, pic, 1, 0);
    451502                                                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);
    454507                                        }
    455508                                       
     
    468521                if(line != NULL)
    469522                {
    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);
    471527                        writesys(menu, line, 0);
    472528                        struct tithek* tnode = (struct tithek*)listbox->select->handle;
     
    511567        }
    512568
     569        free(filename), filename = NULL;
    513570        free(menu), menu = NULL;
    514571        free(runtime), runtime = NULL;
     
    518575        free(streamurl), streamurl = NULL;
    519576        free(id), id = NULL;
    520 //      free(tmpstr2), tmpstr2 = NULL;
     577        free(tmpstr2), tmpstr2 = NULL;
     578        free(tmpstr3), tmpstr3 = NULL;
    521579        free(line), line = NULL;
    522580        free(streamurl), streamurl = NULL;
  • titan/plugins/tithek/tithek.h

    r35286 r35395  
    8989//flag 75   - watchmovies local search
    9090//flag 75   - amazon
    91 //flag 76   - amazon search
    92 //flag 77   - amazon local search
     91//flag 76   - amazon movie search
     92//flag 77   - amazon series search
     93//flag 78   - amazon series listed search
     94//flag 80   - amazon local search
    9395//flag 100  - all local search
    9496//flag 1000 - menu pincode
     
    21302132                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
    21312133                                }
     2134                                else if(((struct tithek*)listbox->select->handle)->flag == 77)
     2135                                {
     2136                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 1) == 0)
     2137                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
     2138                                }
     2139                                else if(((struct tithek*)listbox->select->handle)->flag == 78)
     2140                                {
     2141                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 2) == 0)
     2142                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
     2143                                }
    21322144                                else if((((struct tithek*)listbox->select->handle)->flag == 66))
    21332145                                {
  • titan/skins/tithek/tithekmainmenu/mainmenu-amazon.list

    r35258 r35395  
    1 #Category#http://atemio.dyndns.tv/mediathek/amazon/amazon.category.list#http://atemio.dyndns.tv/mediathek/menu/category.jpg#category.jpg#AmazonPrime#0
    2 #Top 100 Single Charts#http://atemio.dyndns.tv/mediathek/amazon/streams/amazon.top.100.single.charts.list#http://atemio.dyndns.tv/mediathek/menu/top.100.single.charts.jpg#top.100.single.charts.jpg#AmazonPrime#44
    3 #A-Z#http://atemio.dyndns.tv/mediathek/amazon/amazon.a-z.list#http://atemio.dyndns.tv/mediathek/menu/a-z.jpg#a-z.jpg#AmazonPrime#0
    4 #All Sorted#http://atemio.dyndns.tv/mediathek/amazon/streams/amazon.all-sorted.list#http://atemio.dyndns.tv/mediathek/menu/all-sorted.jpg#all-sorted.jpg#AmazonPrime#0
    5 Search#http://atemio.dyndns.tv/mediathek/amazon/streams/amazon.all-sorted.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search10.jpg#AmazonPrime#76
    6 #Search (local)#http://atemio.dyndns.tv/mediathek/amazon/streams/mainmenu-amazon.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#AmazonPrime#77
     1#Category#http://atemio.dyndns.tv/mediathek/amazon/amazon.category.list#http://atemio.dyndns.tv/mediathek/menu/category.jpg#category.jpg#Amazon#0
     2#A-Z#http://atemio.dyndns.tv/mediathek/amazon/amazon.a-z.list#http://atemio.dyndns.tv/mediathek/menu/a-z.jpg#a-z.jpg#Amazon#0
     3#All Sorted#http://atemio.dyndns.tv/mediathek/amazon/streams/amazon.all-sorted.list#http://atemio.dyndns.tv/mediathek/menu/all-sorted.jpg#all-sorted.jpg#Amazon#0
     4Search Movie#http://atemio.dyndns.tv/mediathek/amazon/streams/amazon.all-sorted.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search10.jpg#Amazon#76
     5Search Serie#http://atemio.dyndns.tv/mediathek/amazon/streams/amazon.all-sorted.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search10.jpg#Amazon#77
     6#Search (local)#http://atemio.dyndns.tv/mediathek/amazon/streams/mainmenu-amazon.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#77
  • titan/skins/tithek/tithekmainmenu/mainmenu.list

    r35259 r35395  
    2626XXX-XVIDEOS#http://atemio.dyndns.tv/mediathek/mainmenu-xvideos.list#http://atemio.dyndns.tv/mediathek/menu/xvideos.jpg#xvideos.jpg#TiThek#1000
    2727Search (local)#http://atemio.dyndns.tv/mediathek/all/mainmenu-all.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#All#100
    28 Amazon Prime#http://atemio.dyndns.tv/mediathek/mainmenu-amazon.list#http://atemio.dyndns.tv/mediathek/menu/amazon.jpg#amazon.jpg#TiThek#0
     28Amazon#http://atemio.dyndns.tv/mediathek/mainmenu-amazon.list#http://atemio.dyndns.tv/mediathek/menu/amazon.jpg#amazon.jpg#TiThek#0
Note: See TracChangeset for help on using the changeset viewer.