#ifndef AMAZON_H #define AMAZON_H // imdb //http://api-doc.imdbws.com/static-content/documents/v1/de-DE/video/lovefilm_de/amzn1.dv.vcid.183d4cd2-d2f0-4d5d-8712-771b05cb0feb/events:imdb.api.video.events/data.json?Expires=1442152236&Signature=ay5qtA6EvuUQ253Ch2-MIGLt~GgrFl1gFNxhvgME9nyd5BP9vmX9nnusTJYgnqXlbDxa0XlDkPxm0zEOOlaQaRhTbxT5VOV75KZuOlJXb9PQou75KbT8fbWfhY5LJpKrHeLkqU5xSuV8TQ0L2OK997GL5N7147vf2gs3eya8PyA_&Key-Pair-Id=APKAJHKHQ2OMFVLH6TKA void amazon_init(char* titheklink, char* tithekfile) { int ret = 0; char* tmpstr = NULL; if(ostrcmp("http://atemio.dyndns.tv/mediathek/mainmenu.list", titheklink) == 0) writesys(tithekfile, "Amazon#/tmp/tithek/amazon.mainmenu.list#http://atemio.dyndns.tv/mediathek/menu/amazon.jpg#amazon.jpg#TiThek#0", 3); if(ostrcmp("/tmp/tithek/amazon.mainmenu.list", titheklink) == 0) { if(amazonlogin == 0) { ret = amazon_login(); if(ret == 0) textbox(_("Message"), _("Amazon login not successful! Please check Amazon Prime User/Pass in Tithek settings and try again."), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 1100, 200, 0, 0); else { textbox(_("Message"), _("Amazon Prime login successful!"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 10, 0); amazonlogin = 1; } } unlink(tithekfile); printf("add amazon mainmenu entrys\n"); // writesys(tithekfile, "Currently (Movie)#/tmp/tithek/amazon.currently.movie.list#http://atemio.dyndns.tv/mediathek/menu/currently.movie.jpg#currently.movie.jpg#Amazon#86", 3); tmpstr = ostrcat(_("Currently"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Movies"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.currently.movie.list#http://atemio.dyndns.tv/mediathek/menu/currently.movie.jpg#currently.movie.jpg#Amazon#86", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Popularity Kids (Movie)#/tmp/tithek/amazon.popularity.kids.movie.list#http://atemio.dyndns.tv/mediathek/menu/popularity.kids.movie.jpg#popularity.kids.movie.jpg#Amazon#84", 3); tmpstr = ostrcat(_("Popularity Kids"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Movies"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.popularity.kids.movie.list#http://atemio.dyndns.tv/mediathek/menu/popularity.kids.movie.jpg#popularity.kids.movie.jpg#Amazon#84", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Popularity Kids (Series)#/tmp/tithek/amazon.popularity.kids.tv.list#http://atemio.dyndns.tv/mediathek/menu/popularity.kids.tv.jpg#popularity.kids.tv.jpg#Amazon#85", 3); tmpstr = ostrcat(_("Popularity Kids"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Series"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.popularity.kids.tv.list#http://atemio.dyndns.tv/mediathek/menu/popularity.kids.tv.jpg#popularity.kids.tv.jpg#Amazon#85", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Popularity (Movie)#/tmp/tithek/amazon.popularity.rank.movie.list#http://atemio.dyndns.tv/mediathek/menu/popularity.rank.movie.jpg#popularity.rank.movie.jpg#Amazon#81", 3); tmpstr = ostrcat(_("Popularity Rank"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Movies"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.popularity.rank.movie.list#http://atemio.dyndns.tv/mediathek/menu/popularity.rank.movie.jpg#popularity.rank.movie.jpg#Amazon#81", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Popularity (Series)#/tmp/tithek/amazon.popularity.rank.tv.list#http://atemio.dyndns.tv/mediathek/menu/popularity.rank.tv.jpg#popularity.rank.tv.jpg#Amazon#83", 3); tmpstr = ostrcat(_("Popularity Rank"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Series"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.popularity.rank.tv.list#http://atemio.dyndns.tv/mediathek/menu/popularity.rank.tv.jpg#popularity.rank.tv.jpg#Amazon#83", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Genre (Movie)#/tmp/tithek/amazon.genre.movie.list#http://atemio.dyndns.tv/mediathek/menu/genre.movie.jpg#watchlist.movie.jpg#Amazon#87", 3); tmpstr = ostrcat(_("Genre"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Movies"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.genre.movie.list#http://atemio.dyndns.tv/mediathek/menu/genre.movie.jpg#watchlist.movie.jpg#Amazon#87", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Genre (Series)#/tmp/tithek/amazon.genre.tv.list#http://atemio.dyndns.tv/mediathek/menu/genre.tv.jpg#watchlist.movie.jpg#Amazon#89", 3); tmpstr = ostrcat(_("Genre"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Series"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.genre.tv.list#http://atemio.dyndns.tv/mediathek/menu/genre.tv.jpg#watchlist.movie.jpg#Amazon#89", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Watchlist (Movie)#/tmp/tithek/amazon.watchlist.movie.list#http://atemio.dyndns.tv/mediathek/menu/watchlist.movie.jpg#watchlist.movie.jpg#Amazon#79", 3); tmpstr = ostrcat(_("Watchlist"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Movies"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.watchlist.movie.list#http://atemio.dyndns.tv/mediathek/menu/watchlist.movie.jpg#watchlist.movie.jpg#Amazon#79", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Watchlist (Series)#/tmp/tithek/amazon.watchlist.tv.list#http://atemio.dyndns.tv/mediathek/menu/watchlist.tv.jpg#watchlist.tv.jpg#Amazon#80", 3); tmpstr = ostrcat(_("Watchlist"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Series"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.watchlist.tv.list#http://atemio.dyndns.tv/mediathek/menu/watchlist.tv.jpg#watchlist.tv.jpg#Amazon#80", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Search (Movie)#/tmp/tithek/amazon.search.movie.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#76", 3); tmpstr = ostrcat(_("Search"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Movies"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.search.movie.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#76", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; // writesys(tithekfile, "Search (Tv)#/tmp/tithek/amazon.search.tv.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#77", 3); tmpstr = ostrcat(_("Search"), " (", 0, 0); tmpstr = ostrcat(tmpstr, _("Series"), 0, 0); tmpstr = ostrcat(tmpstr, ")#/tmp/tithek/amazon.search.tv.list#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#Amazon#77", 0, 0); writesys(tithekfile, tmpstr, 3); free(tmpstr), tmpstr = NULL; } free(tmpstr), tmpstr = NULL; } int amazon_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) { printf("amazon_search start flag: %d\n", flag); int ret = 1, type = 0; int debuglevel = getconfigint("debuglevel", NULL); if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) return ret; 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; char* page = NULL, *pages = NULL, *nextpage = NULL, *tmpstr4 = NULL, *atitle = NULL; if(flag == 0 || flag == 1) { if(searchstr == NULL) search = textinputhist(_("Search"), " ", "searchhist"); else search = textinputhist(_("Search"), searchstr, "searchhist"); } if(search != NULL || flag > 0) { drawscreen(load, 0, 0); search = stringreplacechar(search, ' ', '+'); if(flag == 0) { filename = ostrcat("movie", NULL, 0, 0); type = 75; url = ostrcat("http://www.amazon.de/mn/search/ajax/?_encoding=UTF8&url=node%3D3356018031&field-keywords=", search, 0, 0); } else if(flag == 1) { filename = ostrcat("season", NULL, 0, 0); type = 78; url = ostrcat("http://www.amazon.de/mn/search/ajax/?_encoding=UTF8&url=node%3D3356019031&field-keywords=", search, 0, 0); } else if(flag == 2) { filename = ostrcat("episode", NULL, 0, 0); type = 75; url = ostrcat("http://www.amazon.de/dp/", link, 0, 0); url = ostrcat(url, "/?_encoding=UTF8", 1, 0); } else if(flag == 3) { filename = ostrcat("watchlist.movie", NULL, 0, 0); type = 75; url = ostrcat("http://www.amazon.de/gp/video/watchlist/movie?ie=UTF8&show=all&sort=DATE_ADDED_DESC", NULL, 0, 0); } else if(flag == 4) { filename = ostrcat("watchlist.tv", NULL, 0, 0); type = 78; url = ostrcat("http://www.amazon.de/gp/video/watchlist/tv?ie=UTF8&show=all&sort=DATE_ADDED_DESC", NULL, 0, 0); } else if(flag == 5) { filename = ostrcat("popularity.rank.movie", NULL, 0, 0); type = 75; url = ostrcat("http://www.amazon.de/gp/search/ajax/?_encoding=UTF8&rh=n%3A3010075031%2Cn%3A3356018031&sort=popularity-rank", NULL, 0, 0); } else if(flag == 6) { filename = ostrcat("popularity.rank.tv.nextpage", NULL, 0, 0); type = 75; url = ostrcat(link, NULL, 0, 0); } else if(flag == 7) { filename = ostrcat("popularity.rank.tv", NULL, 0, 0); type = 78; url = ostrcat("http://www.amazon.de/gp/search/ajax/?_encoding=UTF8&rh=n%3A3010075031%2Cn%3A3356019031&sort=popularity-rank", NULL, 0, 0); } else if(flag == 8) { filename = ostrcat("popularity.kids.movie", NULL, 0, 0); type = 75; url = ostrcat("http://www.amazon.de/gp/search/ajax/?rh=n%3A3010075031%2Cn%3A!3010076031%2Cn%3A3015915031%2Cp_n_theme_browse-bin%3A3015972031%2Cp_85%3A3282148031&ie=UTF8", NULL, 0, 0); } else if(flag == 9) { filename = ostrcat("popularity.kids.tv", NULL, 0, 0); type = 78; url = ostrcat("http://www.amazon.de/gp/search/ajax/?rh=n%3A3010075031%2Cn%3A!3010076031%2Cn%3A3015916031%2Cp_n_theme_browse-bin%3A3015972031%2Cp_85%3A3282148031&ie=UTF8", NULL, 0, 0); } else if(flag == 10) { filename = ostrcat("currently.movie", NULL, 0, 0); type = 75; url = ostrcat("http://www.amazon.de/s/?n=4963842031&_encoding=UTF", NULL, 0, 0); } else if(flag == 11) { filename = ostrcat("genre.movie", NULL, 0, 0); type = 88; url = ostrcat("http://www.amazon.de/gp/search/other/?rh=n%3A3279204031%2Cn%3A!3010076031%2Cn%3A3356018031&pickerToList=theme_browse-bin&ie=UTF8", NULL, 0, 0); } else if(flag == 12) { filename = ostrcat("genre.movie.listed", NULL, 0, 0); type = 75; url = ostrcat(link, NULL, 0, 0); } else if(flag == 13) { filename = ostrcat("genre.tv", NULL, 0, 0); type = 90; url = ostrcat("http://www.amazon.de/gp/search/other/?rh=n%3A3279204031%2Cn%3A!3010076031%2Cn%3A3356019031&pickerToList=theme_browse-bin&ie=UTF8", NULL, 0, 0); } else if(flag == 14) { filename = ostrcat("genre.tv.listed", NULL, 0, 0); type = 78; url = ostrcat(link, NULL, 0, 0); } /////////////////////////// debug(99, "url: %s", url); tmpstr = gethttps(url, NULL, NULL, NULL, NULL, NULL, 1); /////////////// pages = string_resub("", "", tmpstr, 0); nextpage = string_resub("", "", tmpstr, 0); if(nextpage == NULL) { tmpstr4 = string_resub("class=\"pagnNext\"", ">", tmpstr, 0); nextpage = string_resub("href=\"", "\"", tmpstr4, 0); free(tmpstr4), tmpstr4 = NULL; } page = oregex(".*/ref=.*([0-9]{2,2})\\?rh=.*", nextpage); if(page == NULL) page = oregex(".*/ref=.*([0-9]{1,2})\\?rh=.*", nextpage); if(pages == NULL) { tmpstr4 = string_resub("pagnCur", "pagnRA", tmpstr, 0); pages = oregex(".*ref=sr_pg_([0-9]{1,2})\\?rh=.*", tmpstr4); free(tmpstr4), tmpstr4 = NULL; } nextpage = string_replace_all("&", "&", nextpage, 1); ////////////////////// tmpstr2 = ostrcat("/tmp/amazon_search_tmpstr_get", filename, 0, 0); tmpstr2 = ostrcat(tmpstr2, "_page_", 1, 0); tmpstr2 = ostrcat(tmpstr2, page, 1, 0); tmpstr2 = ostrcat(tmpstr2, "_pages_", 1, 0); tmpstr2 = ostrcat(tmpstr2, pages, 1, 0); unlink(tmpstr2); tmpstr3 = ostrcat(tmpstr2, "_replace", 0, 0); unlink(tmpstr3); /////////////////////////// titheklog(debuglevel, tmpstr2, NULL, NULL, NULL, tmpstr); free(url), url = NULL; /////////////////////////// int count1 = 0; int j = 0; if(flag == 10) tmpstr = stringreplacechar(tmpstr, '\n', ' '); // tmpstr = string_replace_all("\n", " ", tmpstr, 1); if(flag == 0 || flag == 1 || flag == 5 || flag == 7 || flag == 8 || flag == 9 || flag == 12 || flag == 14) tmpstr = string_replace_all("