[24396] | 1 | #ifndef TITHEK_GLOBAL_H |
---|
| 2 | #define TITHEK_GLOBAL |
---|
| 3 | |
---|
[35348] | 4 | #include <curl/curl.h> |
---|
| 5 | |
---|
[36122] | 6 | char* hoster(char* url) |
---|
| 7 | { |
---|
| 8 | debug(99, "url: %s", url); |
---|
[40906] | 9 | char* streamurl = NULL, *tmplink = NULL, *tmpstr = NULL; |
---|
[40357] | 10 | struct skin* load = getscreen("loading"); |
---|
[36122] | 11 | |
---|
[40881] | 12 | if(!ostrncmp("//", url, 2)) |
---|
| 13 | tmplink = ostrcat("http:", url, 0, 0); |
---|
| 14 | else |
---|
| 15 | tmplink = ostrcat(url, NULL, 0, 0); |
---|
[40906] | 16 | |
---|
| 17 | tmpstr = ostrcat(tmplink, NULL, 0, 0); |
---|
[36122] | 18 | string_tolower(tmplink); |
---|
| 19 | |
---|
[42619] | 20 | if(!file_exist("/tmp/localhoster")) |
---|
| 21 | localparser_init("http://atemio.dyndns.tv/mediathek/mainmenu.list", "mainmenu.local.list", 1); |
---|
| 22 | |
---|
| 23 | drawscreen(load, 0, 0); |
---|
| 24 | |
---|
[38982] | 25 | char* cmd = NULL; |
---|
[40906] | 26 | cmd = ostrcat("/tmp/localhoster/hoster.sh get \"", tmpstr, 0, 0); |
---|
[40053] | 27 | cmd = ostrcat(cmd, "\"", 1, 0); |
---|
[38982] | 28 | streamurl = command(cmd); |
---|
| 29 | streamurl = string_newline(streamurl); |
---|
[40117] | 30 | debug(99, "Streamurl1: %s", streamurl); |
---|
[40106] | 31 | |
---|
[38982] | 32 | free(cmd), cmd = NULL; |
---|
[40836] | 33 | int skip = 0; |
---|
[40094] | 34 | |
---|
[38982] | 35 | if(streamurl == NULL) |
---|
[37146] | 36 | { |
---|
[40406] | 37 | if(ostrstr(tmplink, "streamcloud") != NULL) |
---|
[40836] | 38 | { |
---|
[40906] | 39 | streamurl = streamcloud(tmpstr); |
---|
[40836] | 40 | skip = 1; |
---|
| 41 | } |
---|
[40406] | 42 | /* |
---|
[38982] | 43 | if(ostrstr(tmplink, "sockshare") != NULL) |
---|
| 44 | streamurl = putlocker(url); |
---|
| 45 | else if(ostrstr(tmplink, "putlocker") != NULL) |
---|
| 46 | streamurl = firedrive(url); |
---|
| 47 | else if(ostrstr(tmplink, "filenuke") != NULL) |
---|
| 48 | streamurl = filenuke(url); |
---|
| 49 | else if(ostrstr(tmplink, "streamcloud") != NULL) |
---|
| 50 | streamurl = streamcloud(url); |
---|
| 51 | else if(ostrstr(tmplink, "vidstream") != NULL) |
---|
| 52 | streamurl = vidstream(url); |
---|
[40117] | 53 | else if(ostrstr(tmplink, "flashx_disable") != NULL) |
---|
[38982] | 54 | streamurl = flashx(url); |
---|
| 55 | else if(ostrstr(tmplink, "xvidstage") != NULL) |
---|
| 56 | streamurl = xvidstage(url); |
---|
| 57 | else if(ostrstr(tmplink, "nowvideo") != NULL) |
---|
| 58 | streamurl = nowvideo(url); |
---|
| 59 | else if(ostrstr(tmplink, "movshare") != NULL || ostrstr(tmplink, "wholecloud") != NULL) |
---|
| 60 | streamurl = movshare(url); |
---|
| 61 | else if(ostrstr(tmplink, "movreel") != NULL) |
---|
| 62 | streamurl = movreel(url); |
---|
| 63 | else if(ostrstr(tmplink, "novamov") != NULL || ostrstr(tmplink, "auroravid") != NULL) |
---|
| 64 | streamurl = novamov(url); |
---|
| 65 | else if(ostrstr(tmplink, "divxstage") != NULL || ostrstr(tmplink, "cloudtime") != NULL) |
---|
| 66 | streamurl = divxstage(url); |
---|
| 67 | else if(ostrstr(tmplink, "primeshare") != NULL) |
---|
| 68 | streamurl = primeshare(url); |
---|
| 69 | else if(ostrstr(tmplink, "faststream") != NULL || ostrstr(tmplink, "fastvideo") != NULL) |
---|
| 70 | streamurl = faststream(url); |
---|
| 71 | else if(ostrstr(tmplink, "played") != NULL) |
---|
| 72 | streamurl = played(url); |
---|
| 73 | else if(ostrstr(tmplink, "videoweed") != NULL) |
---|
| 74 | streamurl = videoweed(url); |
---|
| 75 | else if(ostrstr(tmplink, "firedrive") != NULL) |
---|
| 76 | streamurl = firedrive(url); |
---|
| 77 | else if(ostrstr(tmplink, "shared") != NULL) |
---|
| 78 | streamurl = shared(url); |
---|
| 79 | else if(ostrstr(tmplink, "thefile") != NULL) |
---|
| 80 | streamurl = thefile(url); |
---|
[40150] | 81 | else if(ostrstr(tmplink, "youtu_disable") != NULL) |
---|
[38982] | 82 | streamurl = youtube(url); |
---|
| 83 | else if(ostrstr(tmplink, "myvideo") != NULL) |
---|
| 84 | streamurl = myvideo(url); |
---|
| 85 | else if(ostrstr(tmplink, "promptfile") != NULL) |
---|
| 86 | streamurl = promptfile(url); |
---|
| 87 | else if(ostrstr(tmplink, "letwatch") != NULL || ostrstr(tmplink, "realvid") != NULL) |
---|
| 88 | streamurl = letwatch(url); |
---|
| 89 | else if(ostrstr(tmplink, "vidbull") != NULL) |
---|
| 90 | streamurl = vidbull(url); |
---|
| 91 | else if(ostrstr(tmplink, "vodlocker") != NULL) |
---|
| 92 | streamurl = vodlocker(url); |
---|
| 93 | else if(ostrstr(tmplink, "vidto") != NULL) |
---|
| 94 | streamurl = vidto(url); |
---|
| 95 | else if(ostrstr(tmplink, "amazon") != NULL) |
---|
| 96 | streamurl = amazon(url); |
---|
| 97 | else if(ostrstr(tmplink, "thevideo") != NULL) |
---|
| 98 | streamurl = thevideo(url); |
---|
| 99 | else if(ostrstr(tmplink, "mightyupload") != NULL) |
---|
| 100 | streamurl = mightyupload(url); |
---|
| 101 | else if(ostrstr(tmplink, "cloudzilla") != NULL) |
---|
| 102 | streamurl = cloudzilla(url); |
---|
| 103 | else if(ostrstr(tmplink, "vivo") != NULL) |
---|
| 104 | streamurl = vivo(url); |
---|
| 105 | else if(ostrstr(tmplink, "streamlive") != NULL) |
---|
| 106 | streamurl = streamlive(url, -1); |
---|
| 107 | else if(ostrstr(tmplink, "cricfree") != NULL) |
---|
| 108 | streamurl = cricfree(url, 0); |
---|
| 109 | else if(ostrstr(tmplink, "zerocast") != NULL) |
---|
| 110 | streamurl = zerocast(url, 0); |
---|
| 111 | else if(ostrstr(tmplink, "p2pcast") != NULL) |
---|
| 112 | streamurl = p2pcast(url); |
---|
| 113 | else if(ostrstr(tmplink, "vidzi") != NULL) |
---|
| 114 | streamurl = vidzi(url); |
---|
| 115 | else if(ostrstr(tmplink, "vid.ag") != NULL) |
---|
| 116 | streamurl = vidag(url); |
---|
[40406] | 117 | */ |
---|
[40117] | 118 | debug(99, "Streamurl2: %s", streamurl); |
---|
| 119 | } |
---|
[40836] | 120 | |
---|
| 121 | if(streamurl == NULL && skip == 0) |
---|
[40106] | 122 | { |
---|
[40357] | 123 | if(!file_exist("/tmp/localhoster")) |
---|
| 124 | localparser_init("http://atemio.dyndns.tv/mediathek/mainmenu.list", "mainmenu.local.list", 1); |
---|
| 125 | |
---|
| 126 | drawscreen(load, 0, 0); |
---|
| 127 | |
---|
[40906] | 128 | cmd = ostrcat("/tmp/localhoster/hoster.sh youtube_dl \"", tmpstr, 0, 0); |
---|
[40106] | 129 | cmd = ostrcat(cmd, "\"", 1, 0); |
---|
| 130 | streamurl = command(cmd); |
---|
| 131 | streamurl = string_newline(streamurl); |
---|
[40117] | 132 | debug(99, "Streamurl3: %s", streamurl); |
---|
[40106] | 133 | |
---|
| 134 | free(cmd), cmd = NULL; |
---|
[40117] | 135 | |
---|
[40357] | 136 | clearscreen(load); |
---|
| 137 | |
---|
[40406] | 138 | //////////// |
---|
[40117] | 139 | if(streamurl == NULL) |
---|
[40406] | 140 | { |
---|
| 141 | if(ostrstr(tmplink, "sockshare") != NULL) |
---|
[40906] | 142 | streamurl = putlocker(tmpstr); |
---|
[40406] | 143 | else if(ostrstr(tmplink, "putlocker") != NULL) |
---|
[40906] | 144 | streamurl = firedrive(tmpstr); |
---|
[40406] | 145 | else if(ostrstr(tmplink, "filenuke") != NULL) |
---|
[40906] | 146 | streamurl = filenuke(tmpstr); |
---|
[40406] | 147 | else if(ostrstr(tmplink, "streamcloud") != NULL) |
---|
[40906] | 148 | streamurl = streamcloud(tmpstr); |
---|
[40406] | 149 | else if(ostrstr(tmplink, "vidstream") != NULL) |
---|
[40906] | 150 | streamurl = vidstream(tmpstr); |
---|
[40406] | 151 | else if(ostrstr(tmplink, "flashx_disable") != NULL) |
---|
[40906] | 152 | streamurl = flashx(tmpstr); |
---|
[40406] | 153 | else if(ostrstr(tmplink, "xvidstage") != NULL) |
---|
[40906] | 154 | streamurl = xvidstage(tmpstr); |
---|
[40406] | 155 | else if(ostrstr(tmplink, "nowvideo") != NULL) |
---|
[40906] | 156 | streamurl = nowvideo(tmpstr); |
---|
[40406] | 157 | else if(ostrstr(tmplink, "movshare") != NULL || ostrstr(tmplink, "wholecloud") != NULL) |
---|
[40906] | 158 | streamurl = movshare(tmpstr); |
---|
[40406] | 159 | else if(ostrstr(tmplink, "movreel") != NULL) |
---|
[40906] | 160 | streamurl = movreel(tmpstr); |
---|
[40406] | 161 | else if(ostrstr(tmplink, "novamov") != NULL || ostrstr(tmplink, "auroravid") != NULL) |
---|
[40906] | 162 | streamurl = novamov(tmpstr); |
---|
[40406] | 163 | else if(ostrstr(tmplink, "divxstage") != NULL || ostrstr(tmplink, "cloudtime") != NULL) |
---|
[40906] | 164 | streamurl = divxstage(tmpstr); |
---|
[40406] | 165 | else if(ostrstr(tmplink, "primeshare") != NULL) |
---|
[40906] | 166 | streamurl = primeshare(tmpstr); |
---|
[40406] | 167 | else if(ostrstr(tmplink, "faststream") != NULL || ostrstr(tmplink, "fastvideo") != NULL) |
---|
[40906] | 168 | streamurl = faststream(tmpstr); |
---|
[40406] | 169 | else if(ostrstr(tmplink, "played") != NULL) |
---|
[40906] | 170 | streamurl = played(tmpstr); |
---|
[40406] | 171 | else if(ostrstr(tmplink, "videoweed") != NULL) |
---|
[40906] | 172 | streamurl = videoweed(tmpstr); |
---|
[40406] | 173 | else if(ostrstr(tmplink, "firedrive") != NULL) |
---|
[40906] | 174 | streamurl = firedrive(tmpstr); |
---|
[40406] | 175 | else if(ostrstr(tmplink, "shared") != NULL) |
---|
[40906] | 176 | streamurl = shared(tmpstr); |
---|
[40406] | 177 | else if(ostrstr(tmplink, "thefile") != NULL) |
---|
[40906] | 178 | streamurl = thefile(tmpstr); |
---|
[41465] | 179 | /* |
---|
[40406] | 180 | else if(ostrstr(tmplink, "youtu_disable") != NULL) |
---|
[40906] | 181 | streamurl = youtube(tmpstr); |
---|
[41465] | 182 | */ |
---|
| 183 | /* |
---|
[40406] | 184 | else if(ostrstr(tmplink, "myvideo") != NULL) |
---|
[40906] | 185 | streamurl = myvideo(tmpstr); |
---|
[41465] | 186 | */ |
---|
[40406] | 187 | else if(ostrstr(tmplink, "promptfile") != NULL) |
---|
[40906] | 188 | streamurl = promptfile(tmpstr); |
---|
[40406] | 189 | else if(ostrstr(tmplink, "letwatch") != NULL || ostrstr(tmplink, "realvid") != NULL) |
---|
[40906] | 190 | streamurl = letwatch(tmpstr); |
---|
[40406] | 191 | else if(ostrstr(tmplink, "vidbull") != NULL) |
---|
[40906] | 192 | streamurl = vidbull(tmpstr); |
---|
[40406] | 193 | else if(ostrstr(tmplink, "vodlocker") != NULL) |
---|
[40906] | 194 | streamurl = vodlocker(tmpstr); |
---|
[40406] | 195 | else if(ostrstr(tmplink, "vidto") != NULL) |
---|
[40906] | 196 | streamurl = vidto(tmpstr); |
---|
[41465] | 197 | /* |
---|
[40406] | 198 | else if(ostrstr(tmplink, "amazon") != NULL) |
---|
[40906] | 199 | streamurl = amazon(tmpstr); |
---|
[41465] | 200 | */ |
---|
| 201 | /* |
---|
[40406] | 202 | else if(ostrstr(tmplink, "thevideo") != NULL) |
---|
[40906] | 203 | streamurl = thevideo(tmpstr); |
---|
[41465] | 204 | */ |
---|
[40406] | 205 | else if(ostrstr(tmplink, "mightyupload") != NULL) |
---|
[40906] | 206 | streamurl = mightyupload(tmpstr); |
---|
[40406] | 207 | else if(ostrstr(tmplink, "cloudzilla") != NULL) |
---|
[40906] | 208 | streamurl = cloudzilla(tmpstr); |
---|
[40406] | 209 | else if(ostrstr(tmplink, "vivo") != NULL) |
---|
[40906] | 210 | streamurl = vivo(tmpstr); |
---|
[40406] | 211 | else if(ostrstr(tmplink, "streamlive") != NULL) |
---|
[40906] | 212 | streamurl = streamlive(tmpstr, -1); |
---|
[40406] | 213 | else if(ostrstr(tmplink, "cricfree") != NULL) |
---|
[40906] | 214 | streamurl = cricfree(tmpstr, 0); |
---|
[40406] | 215 | else if(ostrstr(tmplink, "zerocast") != NULL) |
---|
[40906] | 216 | streamurl = zerocast(tmpstr, 0); |
---|
[40406] | 217 | else if(ostrstr(tmplink, "p2pcast") != NULL) |
---|
[40906] | 218 | streamurl = p2pcast(tmpstr); |
---|
[40406] | 219 | else if(ostrstr(tmplink, "vidzi") != NULL) |
---|
[40906] | 220 | streamurl = vidzi(tmpstr); |
---|
[40406] | 221 | else if(ostrstr(tmplink, "vid.ag") != NULL) |
---|
[40906] | 222 | streamurl = vidag(tmpstr); |
---|
[40406] | 223 | debug(99, "Streamurl4: %s", streamurl); |
---|
| 224 | } |
---|
| 225 | //////////// |
---|
| 226 | |
---|
| 227 | if(streamurl == NULL) |
---|
[40117] | 228 | textbox(_("Message"), _("The hoster is not yet supported !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
| 229 | |
---|
[40106] | 230 | } |
---|
| 231 | |
---|
[41291] | 232 | debug(99, "Streamurl1: %s", streamurl); |
---|
[36122] | 233 | |
---|
| 234 | streamurl = string_replace_all("amp;", "", streamurl, 1); |
---|
[41291] | 235 | debug(99, "Streamurl4: %s", streamurl); |
---|
[36122] | 236 | |
---|
| 237 | free(tmplink), tmplink = NULL; |
---|
[40088] | 238 | /* |
---|
[36122] | 239 | if(ostrncmp("http", streamurl, 4) && ostrncmp("rtmp", streamurl, 4) && ostrncmp("mms", streamurl, 3) && ostrncmp("rtsp", streamurl, 4)) |
---|
| 240 | { |
---|
| 241 | printf("Streamurl3: not http*|rtmp*|mms*|rtsp* Streamurl: %s\n", streamurl); |
---|
| 242 | free(streamurl),streamurl = NULL; |
---|
| 243 | } |
---|
[40088] | 244 | */ |
---|
[36122] | 245 | return streamurl; |
---|
| 246 | } |
---|
| 247 | |
---|
[35348] | 248 | struct MemoryStruct { |
---|
| 249 | char *memory; |
---|
| 250 | size_t size; |
---|
| 251 | }; |
---|
| 252 | |
---|
| 253 | static size_t |
---|
| 254 | WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) |
---|
| 255 | { |
---|
| 256 | size_t realsize = size * nmemb; |
---|
| 257 | struct MemoryStruct *mem = (struct MemoryStruct *)userp; |
---|
| 258 | |
---|
| 259 | mem->memory = realloc(mem->memory, mem->size + realsize + 1); |
---|
| 260 | if(mem->memory == NULL) { |
---|
| 261 | /* out of memory! */ |
---|
| 262 | printf("not enough memory (realloc returned NULL)\n"); |
---|
| 263 | return 0; |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | memcpy(&(mem->memory[mem->size]), contents, realsize); |
---|
| 267 | mem->size += realsize; |
---|
| 268 | mem->memory[mem->size] = 0; |
---|
| 269 | |
---|
| 270 | return realsize; |
---|
| 271 | } |
---|
| 272 | |
---|
[36122] | 273 | // flag = 0 (without header in output) |
---|
| 274 | // flag = 1 (with header in output) |
---|
| 275 | char* gethttps(char* url, char* localfile, char* data, char* user, char* pass, char* referer, int flag) |
---|
[35348] | 276 | { |
---|
| 277 | debug(99, "url: %s", url); |
---|
| 278 | |
---|
| 279 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
[36122] | 280 | |
---|
| 281 | char* tmpstr = NULL; |
---|
| 282 | FILE *fp; |
---|
| 283 | |
---|
[35348] | 284 | CURL *curl_handle; |
---|
| 285 | CURLcode res; |
---|
| 286 | |
---|
| 287 | struct MemoryStruct chunk; |
---|
| 288 | |
---|
| 289 | chunk.memory = malloc(1); /* will be grown as needed by the realloc above */ |
---|
| 290 | chunk.size = 0; /* no data at this point */ |
---|
| 291 | |
---|
| 292 | curl_global_init(CURL_GLOBAL_ALL); |
---|
[36122] | 293 | |
---|
[35348] | 294 | /* init the curl session */ |
---|
| 295 | curl_handle = curl_easy_init(); |
---|
| 296 | if(curl_handle) |
---|
| 297 | { |
---|
[36122] | 298 | if(localfile != NULL) |
---|
| 299 | fp = fopen(localfile,"wb"); |
---|
| 300 | |
---|
[35348] | 301 | /* specify URL to get */ |
---|
| 302 | curl_easy_setopt(curl_handle, CURLOPT_URL, url); |
---|
[36122] | 303 | |
---|
| 304 | if(user != NULL && pass != NULL) |
---|
| 305 | { |
---|
| 306 | curl_easy_setopt(curl_handle, CURLOPT_USERNAME, user); |
---|
| 307 | curl_easy_setopt(curl_handle, CURLOPT_PASSWORD, pass); |
---|
| 308 | curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY); |
---|
| 309 | } |
---|
[35348] | 310 | if(data == NULL) |
---|
| 311 | curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1L); |
---|
| 312 | else |
---|
[37468] | 313 | { |
---|
| 314 | curl_easy_setopt(curl_handle, CURLOPT_POST, 1); |
---|
[35348] | 315 | curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, data); |
---|
[38926] | 316 | |
---|
| 317 | /* example.com is redirected, so we tell libcurl to send POST on 301, 302 and |
---|
| 318 | 303 HTTP response codes */ |
---|
| 319 | curl_easy_setopt(curl_handle, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); |
---|
[37468] | 320 | } |
---|
[36122] | 321 | if(flag == 1) |
---|
| 322 | curl_easy_setopt(curl_handle, CURLOPT_HEADER, 1L); |
---|
[35348] | 323 | curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 5); |
---|
[38926] | 324 | curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 3); |
---|
| 325 | // curl_easy_setopt(curl_handle, CURLOPT_RETURNTRANSFER, 1); |
---|
| 326 | |
---|
[35348] | 327 | /* send all data to this function */ |
---|
[36122] | 328 | if(localfile == NULL) |
---|
| 329 | curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); |
---|
| 330 | else |
---|
| 331 | curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, NULL); |
---|
| 332 | |
---|
[35348] | 333 | /* we pass our 'chunk' struct to the callback function */ |
---|
[36122] | 334 | if(localfile == NULL) |
---|
| 335 | curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); |
---|
| 336 | else |
---|
| 337 | curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, fp); |
---|
| 338 | |
---|
[35348] | 339 | /* some servers don't like requests that are made without a user-agent field, so we provide one */ |
---|
[38926] | 340 | // curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); |
---|
| 341 | curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.3000 Chrome/30.0.1599.101 Safari/537.36"); |
---|
[36122] | 342 | |
---|
| 343 | // This is occassionally required to stop CURL from verifying the peers certificate. |
---|
| 344 | // CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if |
---|
| 345 | // CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2 - check the existence of a |
---|
| 346 | // common name and also verify that it matches the hostname provided) |
---|
| 347 | #ifdef MIPSEL |
---|
| 348 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 1L); |
---|
| 349 | #else |
---|
[36052] | 350 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); |
---|
[36122] | 351 | #endif |
---|
| 352 | |
---|
[35348] | 353 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L); |
---|
| 354 | if(debuglevel == 99) |
---|
| 355 | curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1); |
---|
[35352] | 356 | curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, "/mnt/network/cookies"); |
---|
| 357 | curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, "/mnt/network/cookies"); |
---|
[38926] | 358 | /* enable redirect following */ |
---|
[35348] | 359 | curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); |
---|
[38926] | 360 | /* allow three redirects */ |
---|
| 361 | curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); |
---|
| 362 | |
---|
| 363 | /* enable all supported built-in compressions */ |
---|
| 364 | curl_easy_setopt(curl_handle, CURLOPT_ACCEPT_ENCODING, ""); |
---|
| 365 | |
---|
[36122] | 366 | if(referer == NULL) |
---|
| 367 | curl_easy_setopt(curl_handle, CURLOPT_AUTOREFERER, 1L); |
---|
| 368 | else |
---|
| 369 | curl_easy_setopt(curl_handle, CURLOPT_REFERER, referer); |
---|
[35348] | 370 | |
---|
| 371 | /* get it! */ |
---|
| 372 | res = curl_easy_perform(curl_handle); |
---|
| 373 | /* check for errors */ |
---|
| 374 | if(res != CURLE_OK) |
---|
| 375 | { |
---|
| 376 | err("failed: %s", curl_easy_strerror(res)); |
---|
| 377 | printf("curl error\n"); |
---|
| 378 | } |
---|
| 379 | else |
---|
| 380 | { |
---|
| 381 | /* |
---|
| 382 | * Now, our chunk.memory points to a memory block that is chunk.size |
---|
| 383 | * bytes big and contains the remote file. |
---|
| 384 | * |
---|
| 385 | * Do something nice with it! |
---|
| 386 | */ |
---|
| 387 | printf("%lu bytes retrieved\n", (long)chunk.size); |
---|
| 388 | } |
---|
| 389 | |
---|
| 390 | /* cleanup curl stuff */ |
---|
| 391 | curl_easy_cleanup(curl_handle); |
---|
[36122] | 392 | if(localfile != NULL) |
---|
| 393 | fclose(fp); |
---|
[35348] | 394 | } |
---|
[36122] | 395 | |
---|
[35348] | 396 | tmpstr = ostrcat(chunk.memory, NULL, 0, 0); |
---|
| 397 | free(chunk.memory); |
---|
| 398 | /* we're done with libcurl, so clean it up */ |
---|
| 399 | curl_global_cleanup(); |
---|
| 400 | |
---|
[36122] | 401 | if(localfile != NULL) |
---|
| 402 | free(tmpstr), tmpstr = NULL; |
---|
[35348] | 403 | return tmpstr; |
---|
| 404 | } |
---|
| 405 | |
---|
[36122] | 406 | char* string_decode3(char* input) |
---|
| 407 | { |
---|
| 408 | if(input == NULL) return input; |
---|
| 409 | |
---|
| 410 | input = string_replace_all("Ä", "Ä", input, 1); |
---|
| 411 | input = string_replace_all("ä", "ä", input, 1); |
---|
| 412 | input = string_replace_all("É", "É", input, 1); |
---|
| 413 | input = string_replace_all("é", "é", input, 1); |
---|
| 414 | input = string_replace_all("Ö", "Ö", input, 1); |
---|
| 415 | input = string_replace_all("ö", "ö", input, 1); |
---|
| 416 | input = string_replace_all("Ü", "Ü", input, 1); |
---|
| 417 | input = string_replace_all("ü", "ü", input, 1); |
---|
| 418 | input = string_replace_all("ß", "ß", input, 1); |
---|
| 419 | input = string_replace_all("&", "&", input, 1); |
---|
| 420 | |
---|
| 421 | input = string_replace_all("Ä", "Ä", input, 1); |
---|
| 422 | input = string_replace_all("ä", "ä", input, 1); |
---|
| 423 | input = string_replace_all("É", "É", input, 1); |
---|
| 424 | input = string_replace_all("é", "é", input, 1); |
---|
| 425 | input = string_replace_all("Ö", "Ö", input, 1); |
---|
| 426 | input = string_replace_all("ö", "ö", input, 1); |
---|
| 427 | input = string_replace_all("Ü", "Ü", input, 1); |
---|
| 428 | input = string_replace_all("ü", "ü", input, 1); |
---|
| 429 | input = string_replace_all("ß", "ß", input, 1); |
---|
| 430 | input = string_replace_all("&", "&", input, 1); |
---|
| 431 | |
---|
| 432 | return input; |
---|
| 433 | } |
---|
| 434 | |
---|
[24456] | 435 | char* getfilekey(char* w, char* i, char* s, char* e) |
---|
| 436 | { |
---|
| 437 | char* ret = NULL; |
---|
| 438 | |
---|
| 439 | if(w == NULL || i == NULL || s == NULL || e == NULL) |
---|
| 440 | return NULL; |
---|
| 441 | |
---|
| 442 | int a = 0, b = 0, c = 0; |
---|
| 443 | int a1 = 0, b1 = 0; |
---|
| 444 | |
---|
| 445 | int lw = strlen(w); |
---|
| 446 | int li = strlen(i); |
---|
| 447 | int ls = strlen(s); |
---|
| 448 | |
---|
| 449 | if(lw < 5 || li < 5 || ls < 5) |
---|
| 450 | return NULL; |
---|
| 451 | |
---|
| 452 | char ca[lw + li + ls - 14]; |
---|
| 453 | char cb[16]; |
---|
| 454 | |
---|
| 455 | ca[lw + li + ls - 15] = '\0'; |
---|
| 456 | cb[15] = '\0'; |
---|
| 457 | |
---|
| 458 | while(1) |
---|
| 459 | { |
---|
| 460 | if(a < 5) |
---|
| 461 | { |
---|
| 462 | cb[b1] = w[a]; |
---|
| 463 | b1++; |
---|
| 464 | } |
---|
| 465 | else if(a < lw) |
---|
| 466 | { |
---|
| 467 | ca[a1] = w[a]; |
---|
| 468 | a1++; |
---|
| 469 | } |
---|
| 470 | a++; |
---|
| 471 | |
---|
| 472 | if(b < 5) |
---|
| 473 | { |
---|
| 474 | cb[b1] = i[b]; |
---|
| 475 | b1++; |
---|
| 476 | } |
---|
| 477 | else if(b < li) |
---|
| 478 | { |
---|
| 479 | ca[a1] = i[b]; |
---|
| 480 | a1++; |
---|
| 481 | } |
---|
| 482 | b++; |
---|
| 483 | |
---|
| 484 | if(c < 5) |
---|
| 485 | { |
---|
| 486 | cb[b1] = s[c]; |
---|
| 487 | b1++; |
---|
| 488 | } |
---|
| 489 | else if(c < ls) |
---|
| 490 | { |
---|
| 491 | ca[a1] = s[c]; |
---|
| 492 | a1++; |
---|
| 493 | } |
---|
| 494 | c++; |
---|
| 495 | |
---|
| 496 | if(lw + li + ls == a1 + b1) |
---|
| 497 | break; |
---|
| 498 | } |
---|
| 499 | |
---|
| 500 | b = 0; |
---|
| 501 | int d = 0; |
---|
| 502 | char cc[a1 / 2 + 1]; |
---|
| 503 | char casub[3] = {'\0'}; |
---|
| 504 | cc[a1 / 2] = '\0'; |
---|
| 505 | |
---|
| 506 | for(a = 0; a < a1; a += 2) |
---|
| 507 | { |
---|
| 508 | int c = -1; |
---|
| 509 | |
---|
| 510 | if(cb[b] % 2) c = 1; |
---|
| 511 | |
---|
| 512 | casub[0] = ca[a]; |
---|
| 513 | casub[1] = ca[a + 1]; |
---|
| 514 | |
---|
| 515 | cc[d] = strtol(casub, '\0', 36) - c; |
---|
| 516 | b++; d++; |
---|
| 517 | if(b >= b1) b = 0; |
---|
| 518 | } |
---|
| 519 | |
---|
| 520 | char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL; |
---|
| 521 | char* pos = ostrstr(cc, ");}('"); |
---|
| 522 | if(pos != NULL) |
---|
| 523 | { |
---|
| 524 | r1 = string_resub(");}('", "'", pos, 0); |
---|
| 525 | pos = ostrstr(pos + 5, ",'"); |
---|
| 526 | if(pos != NULL) |
---|
| 527 | { |
---|
| 528 | r2 = string_resub(",'", "'", pos, 0); |
---|
| 529 | pos = ostrstr(pos + 2, ",'"); |
---|
| 530 | if(pos != NULL) |
---|
| 531 | { |
---|
| 532 | r3 = string_resub(",'", "'", pos, 0); |
---|
| 533 | pos = ostrstr(pos + 2, ",'"); |
---|
| 534 | if(pos != NULL) |
---|
| 535 | { |
---|
| 536 | r4 = string_resub(",'", "'", pos, 0); |
---|
| 537 | ret = getfilekey(r1, r2, r3, r4); |
---|
| 538 | } |
---|
| 539 | } |
---|
| 540 | } |
---|
| 541 | } |
---|
| 542 | else |
---|
[24461] | 543 | { |
---|
| 544 | ret = string_resub("ll=\"", "\"", cc, 0); |
---|
| 545 | if(ret == NULL) |
---|
| 546 | ret = string_resub("filekey=\"", "\"", cc, 0); |
---|
| 547 | } |
---|
[24456] | 548 | |
---|
| 549 | free(r1); r1 = NULL; |
---|
| 550 | free(r2); r2 = NULL; |
---|
| 551 | free(r3); r3 = NULL; |
---|
| 552 | free(r4); r4 = NULL; |
---|
| 553 | |
---|
| 554 | return ret; |
---|
| 555 | } |
---|
| 556 | |
---|
[30018] | 557 | int screenlistbox(struct skin* grid, struct skin* listbox,struct skin* countlabel, char* title, char* titheklink, int* pagecount, int* tithekexit, int* oaktpage, int* oaktline, int* ogridcol, int flag, int cflag) |
---|
| 558 | { |
---|
| 559 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL; |
---|
| 560 | |
---|
| 561 | *oaktpage = listbox->aktpage; |
---|
| 562 | *oaktline = listbox->aktline; |
---|
| 563 | *ogridcol = listbox->gridcol; |
---|
| 564 | tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0); |
---|
| 565 | |
---|
| 566 | if(title != NULL) |
---|
| 567 | tmpstr1 = ostrcat(title, " - ", 0, 0); |
---|
| 568 | else |
---|
| 569 | tmpstr1 = ostrcat(((struct tithek*)listbox->select->handle)->menutitle, " - ", 0, 0); |
---|
| 570 | |
---|
| 571 | tmpstr2 = ostrcat(tmpstr1, ((struct tithek*)listbox->select->handle)->title, 1, 0); |
---|
| 572 | screentithekplay(tmpstr, tmpstr2, flag); |
---|
| 573 | free(tmpstr); tmpstr = NULL; |
---|
| 574 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 575 | |
---|
[40856] | 576 | *pagecount = createtithekplay(titheklink, grid, listbox, countlabel, tmpstr1, cflag); |
---|
[30018] | 577 | // if(pagecount == 0 || tithekexit == 1) break; |
---|
| 578 | if(*pagecount == 0 || *tithekexit == 1) return 0; |
---|
| 579 | |
---|
| 580 | listbox->aktpage = *oaktpage; |
---|
| 581 | listbox->aktline = *oaktline; |
---|
| 582 | listbox->gridcol = *ogridcol; |
---|
| 583 | addscreenrc(grid, listbox); |
---|
| 584 | |
---|
| 585 | return 1; |
---|
| 586 | } |
---|
| 587 | |
---|
[40893] | 588 | //char* crea(char* title, struct skin* listbox) |
---|
| 589 | char* createfilename1(char* title, char* title2) |
---|
[40856] | 590 | { |
---|
| 591 | char* filename = NULL; |
---|
| 592 | char* tmpstr2 = NULL; |
---|
| 593 | |
---|
| 594 | filename = ostrcat(title, "_", 0, 0); |
---|
| 595 | |
---|
| 596 | tmpstr2 = ostrcat(_("Tithek - Mainmenu - Favoriten"), " - ", 0, 0); |
---|
| 597 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 598 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 599 | |
---|
| 600 | tmpstr2 = ostrcat(_("Tithek - Mainmenu"), " - ", 0, 0); |
---|
| 601 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 602 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 603 | |
---|
| 604 | filename = string_replace_all("Tips und Tricks - ", "", filename, 1); |
---|
| 605 | filename = string_replace_all("Internet TV - ", "", filename, 1); |
---|
| 606 | filename = string_replace_all("Internet Radio - ", "", filename, 1); |
---|
| 607 | filename = string_replace_all("ARD - ", "", filename, 1); |
---|
| 608 | filename = string_replace_all("ZDF - ", "", filename, 1); |
---|
| 609 | filename = string_replace_all("FilmOn - ", "", filename, 1); |
---|
| 610 | filename = string_replace_all("MyVideo - ", "", filename, 1); |
---|
| 611 | filename = string_replace_all("Netzkino - ", "", filename, 1); |
---|
| 612 | filename = string_replace_all("KinoX - ", "", filename, 1); |
---|
| 613 | filename = string_replace_all("Movie4k - ", "", filename, 1); |
---|
| 614 | filename = string_replace_all("Movie2k - ", "", filename, 1); |
---|
| 615 | |
---|
| 616 | filename = string_replace_all("Beeg ", "", filename, 1); |
---|
| 617 | filename = string_replace_all("Burning Series ", "", filename, 1); |
---|
| 618 | filename = string_replace_all("CricFree ", "", filename, 1); |
---|
| 619 | filename = string_replace_all("Giga ", "", filename, 1); |
---|
| 620 | filename = string_replace_all("KKiste ", "", filename, 1); |
---|
| 621 | filename = string_replace_all("NBA-On-Demand ", "", filename, 1); |
---|
| 622 | filename = string_replace_all("StreamLive ", "", filename, 1); |
---|
| 623 | filename = string_replace_all("TheSolarMovie ", "", filename, 1); |
---|
| 624 | filename = string_replace_all("Youtube ", "", filename, 1); |
---|
| 625 | |
---|
| 626 | tmpstr2 = ostrcat(_("Category"), " - ", 0, 0); |
---|
| 627 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 628 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 629 | |
---|
| 630 | tmpstr2 = ostrcat(_("Search (local)"), " - ", 0, 0); |
---|
| 631 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 632 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 633 | |
---|
| 634 | tmpstr2 = ostrcat(_("Search (20)"), " - ", 0, 0); |
---|
| 635 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 636 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 637 | |
---|
| 638 | tmpstr2 = ostrcat(_("Search Cast"), " - ", 0, 0); |
---|
| 639 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 640 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 641 | |
---|
| 642 | tmpstr2 = ostrcat(_("Search"), " - ", 0, 0); |
---|
| 643 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 644 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 645 | |
---|
| 646 | tmpstr2 = ostrcat(_("All Sorted"), " - ", 0, 0); |
---|
| 647 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 648 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 649 | |
---|
| 650 | tmpstr2 = ostrcat(_("A-Z"), " - ", 0, 0); |
---|
| 651 | filename = string_replace_all(tmpstr2, "", filename, 1); |
---|
| 652 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 653 | |
---|
| 654 | filename = string_replace_all("(Flash - Shell script) - ", "", filename, 1); |
---|
| 655 | filename = string_replace_all("Genres - ", "", filename, 1); |
---|
| 656 | filename = string_replace_all("All Series - ", "", filename, 1); |
---|
| 657 | filename = string_replace_all("Channels - ", "", filename, 1); |
---|
| 658 | filename = string_replace_all("Kinofilme - ", "", filename, 1); |
---|
| 659 | filename = string_replace_all("Neue Filme - ", "", filename, 1); |
---|
| 660 | filename = string_replace_all("Movies (Year) - ", "", filename, 1); |
---|
| 661 | filename = string_replace_all("Movies (Genre) - ", "", filename, 1); |
---|
| 662 | filename = string_replace_all("Series - ", "", filename, 1); |
---|
| 663 | |
---|
| 664 | // filename = ostrcat(filename, ((struct tithek*)listbox->select->handle)->title, 1, 0); |
---|
| 665 | filename = ostrcat(filename, title2, 1, 0); |
---|
| 666 | |
---|
| 667 | filename = ostrcat(filename, ".mp4", 1, 0); |
---|
| 668 | filename = string_replace_all(" ", ".", filename, 1); |
---|
| 669 | filename = string_replace_all("-", "_", filename, 1); |
---|
| 670 | filename = string_replace_all("._.", "_", filename, 1); |
---|
| 671 | filename = string_replace_all(".._", "_", filename, 1); |
---|
[43491] | 672 | filename = string_replace_all(":", ".", filename, 1); |
---|
[40856] | 673 | |
---|
| 674 | return filename; |
---|
| 675 | } |
---|
[40893] | 676 | /* |
---|
| 677 | printf("flag=%d\n", titheknode->flag); |
---|
| 678 | printf("title=%s\n", titheknode->title); |
---|
| 679 | printf("menutitle=%s\n", titheknode->menutitle); |
---|
| 680 | printf("skin title=%s\n", title); |
---|
| 681 | printf("titheklink=%s\n", titheklink); |
---|
[40856] | 682 | |
---|
[40893] | 683 | if(title != NULL) |
---|
| 684 | tmpstr1 = ostrcat(title, " - ", 0, 0); |
---|
| 685 | else |
---|
| 686 | tmpstr1 = ostrcat(titheknode->menutitle, " - ", 0, 0); |
---|
| 687 | |
---|
| 688 | tmpstr1 = ostrcat(tmpstr1, titheknode->title, 1, 0); |
---|
| 689 | // tmpstr1 = ostrcat(tmpstr1, ".mp4", 1, 0); |
---|
| 690 | |
---|
| 691 | tmpstr1 = string_replace_all(" - ", "_", tmpstr1, 1); |
---|
| 692 | |
---|
| 693 | tmpstr1 = string_replace_all(") (", ")_(", tmpstr1, 1); |
---|
| 694 | tmpstr1 = string_replace_all(" ", "-", tmpstr1, 1); |
---|
| 695 | printf("tmpstr1=%s\n", tmpstr1); |
---|
| 696 | |
---|
| 697 | tmpstr2 = ostrcat("/mnt/swapextensions/player/", tmpstr1, 0, 0); |
---|
| 698 | free(tmpstr1), tmpstr1 = NULL; |
---|
| 699 | */ |
---|
| 700 | |
---|
| 701 | //char* createfilename(char* title, struct skin* listbox) |
---|
| 702 | char* createfilename(char* title, char* title2, int flag) |
---|
| 703 | { |
---|
| 704 | debug(99, "title: %s title2: %s", title, title2); |
---|
| 705 | char* filename = NULL; |
---|
| 706 | char* tmpstr = NULL; |
---|
[40900] | 707 | char* tmpstr2 = NULL; |
---|
[40893] | 708 | |
---|
| 709 | if(title2 != NULL) |
---|
| 710 | { |
---|
| 711 | tmpstr = ostrcat(title, " - ", 0, 0); |
---|
| 712 | tmpstr = ostrcat(tmpstr, title2, 1, 0); |
---|
| 713 | } |
---|
| 714 | else |
---|
| 715 | tmpstr = ostrcat(title, NULL, 0, 0); |
---|
| 716 | |
---|
[40900] | 717 | if(flag >= 1) |
---|
| 718 | { |
---|
| 719 | tmpstr2 = ostrcat(_("Tithek - Mainmenu - Favoriten"), " - ", 0, 0); |
---|
| 720 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 721 | free(tmpstr2); tmpstr2 = NULL; |
---|
[40893] | 722 | |
---|
[40900] | 723 | tmpstr2 = ostrcat(_("Tithek - Mainmenu"), " - ", 0, 0); |
---|
| 724 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 725 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 726 | |
---|
| 727 | tmpstr = string_replace_all("Tips und Tricks - ", "", tmpstr, 1); |
---|
| 728 | tmpstr = string_replace_all("Internet TV - ", "", tmpstr, 1); |
---|
| 729 | tmpstr = string_replace_all("Internet Radio - ", "", tmpstr, 1); |
---|
| 730 | tmpstr = string_replace_all("ARD - ", "", tmpstr, 1); |
---|
| 731 | tmpstr = string_replace_all("ZDF - ", "", tmpstr, 1); |
---|
| 732 | tmpstr = string_replace_all("FilmOn - ", "", tmpstr, 1); |
---|
| 733 | tmpstr = string_replace_all("MyVideo - ", "", tmpstr, 1); |
---|
| 734 | tmpstr = string_replace_all("Netzkino - ", "", tmpstr, 1); |
---|
| 735 | tmpstr = string_replace_all("KinoX - ", "", tmpstr, 1); |
---|
| 736 | tmpstr = string_replace_all("Movie4k - ", "", tmpstr, 1); |
---|
| 737 | tmpstr = string_replace_all("Movie2k - ", "", tmpstr, 1); |
---|
| 738 | |
---|
| 739 | tmpstr = string_replace_all("Beeg ", "", tmpstr, 1); |
---|
| 740 | tmpstr = string_replace_all("Burning Series ", "", tmpstr, 1); |
---|
| 741 | tmpstr = string_replace_all("CricFree ", "", tmpstr, 1); |
---|
| 742 | tmpstr = string_replace_all("Giga ", "", tmpstr, 1); |
---|
| 743 | tmpstr = string_replace_all("KKiste ", "", tmpstr, 1); |
---|
| 744 | tmpstr = string_replace_all("NBA-On-Demand ", "", tmpstr, 1); |
---|
| 745 | tmpstr = string_replace_all("StreamLive ", "", tmpstr, 1); |
---|
| 746 | tmpstr = string_replace_all("TheSolarMovie ", "", tmpstr, 1); |
---|
| 747 | tmpstr = string_replace_all("Youtube ", "", tmpstr, 1); |
---|
| 748 | |
---|
| 749 | tmpstr2 = ostrcat(_("Category"), " - ", 0, 0); |
---|
| 750 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 751 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 752 | |
---|
| 753 | tmpstr2 = ostrcat(_("Cine Films"), " - ", 0, 0); |
---|
| 754 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 755 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 756 | |
---|
| 757 | tmpstr2 = ostrcat(_("Search (local)"), " - ", 0, 0); |
---|
| 758 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 759 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 760 | |
---|
| 761 | tmpstr2 = ostrcat(_("Search (20)"), " - ", 0, 0); |
---|
| 762 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 763 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 764 | |
---|
| 765 | tmpstr2 = ostrcat(_("Search Cast"), " - ", 0, 0); |
---|
| 766 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 767 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 768 | |
---|
| 769 | tmpstr2 = ostrcat(_("Search"), " - ", 0, 0); |
---|
| 770 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 771 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 772 | |
---|
| 773 | tmpstr2 = ostrcat(_("All Sorted"), " - ", 0, 0); |
---|
| 774 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 775 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 776 | |
---|
| 777 | tmpstr2 = ostrcat(_("A-Z"), " - ", 0, 0); |
---|
| 778 | tmpstr = string_replace_all(tmpstr2, "", tmpstr, 1); |
---|
| 779 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 780 | |
---|
| 781 | tmpstr = string_replace_all("(Flash - Shell script) - ", "", tmpstr, 1); |
---|
| 782 | tmpstr = string_replace_all("Genres - ", "", tmpstr, 1); |
---|
| 783 | tmpstr = string_replace_all("All Series - ", "", tmpstr, 1); |
---|
| 784 | tmpstr = string_replace_all("Channels - ", "", tmpstr, 1); |
---|
| 785 | tmpstr = string_replace_all("Kinofilme - ", "", tmpstr, 1); |
---|
| 786 | tmpstr = string_replace_all("Neue Filme - ", "", tmpstr, 1); |
---|
| 787 | tmpstr = string_replace_all("Movies (Year) - ", "", tmpstr, 1); |
---|
| 788 | tmpstr = string_replace_all("Movies (Genre) - ", "", tmpstr, 1); |
---|
| 789 | tmpstr = string_replace_all("Series - ", "", tmpstr, 1); |
---|
| 790 | |
---|
| 791 | // tmpstr = ostrcat(tmpstr, ((struct tithek*)listbox->select->handle)->title, 1, 0); |
---|
| 792 | // tmpstr = ostrcat(tmpstr, title2, 1, 0); |
---|
| 793 | |
---|
| 794 | tmpstr = ostrcat(tmpstr, ".mp4", 1, 0); |
---|
| 795 | tmpstr = string_replace_all("/", ".", tmpstr, 1); |
---|
| 796 | tmpstr = string_replace_all(" ", ".", tmpstr, 1); |
---|
| 797 | tmpstr = string_replace_all("-", "_", tmpstr, 1); |
---|
| 798 | tmpstr = string_replace_all("._.", "_", tmpstr, 1); |
---|
| 799 | tmpstr = string_replace_all(".._", "_", tmpstr, 1); |
---|
[43491] | 800 | tmpstr = string_replace_all(":", ".", tmpstr, 1); |
---|
[40900] | 801 | tmpstr = string_replace_all("..", ".", tmpstr, 1); |
---|
| 802 | } |
---|
| 803 | else |
---|
| 804 | { |
---|
| 805 | tmpstr = string_replace_all(" - ", "_", tmpstr, 1); |
---|
| 806 | // filename = string_replace_all(") (", ")_(", filename, 1); |
---|
| 807 | tmpstr = string_replace_all(" ", ".", tmpstr, 1); |
---|
| 808 | tmpstr = string_replace_all("(", "", tmpstr, 1); |
---|
| 809 | tmpstr = string_replace_all(")", "", tmpstr, 1); |
---|
| 810 | tmpstr = string_replace_all("/", ".", tmpstr, 1); |
---|
[43491] | 811 | tmpstr = string_replace_all(":", ".", tmpstr, 1); |
---|
[40900] | 812 | } |
---|
| 813 | |
---|
[40893] | 814 | if(flag == 0) |
---|
| 815 | filename = ostrcat("/mnt/swapextensions/player/", tmpstr, 0, 0); |
---|
[40900] | 816 | else if(flag == 1) |
---|
[40893] | 817 | filename = ostrcat("/mnt/swapextensions/player/FAV_", tmpstr, 0, 0); |
---|
[40900] | 818 | else |
---|
| 819 | filename = ostrcat(tmpstr, NULL, 0, 0); |
---|
[40893] | 820 | |
---|
| 821 | free(tmpstr), tmpstr = NULL; |
---|
| 822 | debug(99, "filename: %s", filename); |
---|
| 823 | |
---|
| 824 | return filename; |
---|
| 825 | } |
---|
| 826 | |
---|
| 827 | |
---|
| 828 | |
---|
[34615] | 829 | int all_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
| 830 | { |
---|
| 831 | char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL; |
---|
| 832 | int ret = 1, count = 0, i = 0; |
---|
[36174] | 833 | |
---|
[34615] | 834 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
| 835 | return ret; |
---|
| 836 | |
---|
| 837 | if(searchstr == NULL) |
---|
| 838 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
| 839 | else |
---|
| 840 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
| 841 | |
---|
| 842 | if(search != NULL) |
---|
| 843 | { |
---|
| 844 | drawscreen(load, 0, 0); |
---|
| 845 | |
---|
| 846 | strstrip(search); |
---|
| 847 | string_tolower(search); |
---|
| 848 | |
---|
| 849 | tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/all/all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0); |
---|
| 850 | |
---|
| 851 | struct splitstr* ret1 = NULL; |
---|
| 852 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
| 853 | |
---|
| 854 | if(ret1 != NULL) |
---|
| 855 | { |
---|
| 856 | int max = count; |
---|
| 857 | for(i = 0; i < max; i++) |
---|
| 858 | { |
---|
| 859 | |
---|
| 860 | tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
| 861 | tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0'); |
---|
| 862 | string_tolower(tmpstr1); |
---|
| 863 | |
---|
| 864 | if(ostrstr(tmpstr1, search) != NULL) |
---|
| 865 | { |
---|
| 866 | printf("found: %s\n", ret1[i].part); |
---|
| 867 | int rcret = waitrc(NULL, 10, 0); |
---|
| 868 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
| 869 | |
---|
| 870 | line = ostrcat(line, ret1[i].part, 1, 0); |
---|
| 871 | line = ostrcat(line, "\n", 0, 0); |
---|
| 872 | } |
---|
| 873 | free(tmpstr1), tmpstr1 = NULL; |
---|
| 874 | } |
---|
| 875 | free(ret1), ret1 = NULL; |
---|
| 876 | |
---|
| 877 | if(line != NULL) |
---|
| 878 | { |
---|
| 879 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
| 880 | menu = ostrcat("/tmp/tithek/all.search.list", NULL, 0, 0); |
---|
| 881 | writesys(menu, line, 0); |
---|
| 882 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
[42622] | 883 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->description, tnode->flag); |
---|
[34615] | 884 | ret = 0; |
---|
| 885 | } |
---|
| 886 | } |
---|
| 887 | free(tmpstr), tmpstr = NULL; |
---|
| 888 | } |
---|
| 889 | free(search), search = NULL; |
---|
| 890 | return ret; |
---|
| 891 | } |
---|
| 892 | |
---|
[36122] | 893 | char* jsunpack(char* input) |
---|
| 894 | { |
---|
| 895 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
| 896 | |
---|
| 897 | if(input == NULL) return input; |
---|
| 898 | |
---|
| 899 | char* b36code = NULL, *search = NULL, *charlist = NULL, *base = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *tmpstr = NULL, *packed = NULL; |
---|
| 900 | |
---|
| 901 | unlink("/tmp/jsunpack1_packed"); |
---|
| 902 | unlink("/tmp/jsunpack2_tmpstr"); |
---|
| 903 | unlink("/tmp/jsunpack3_b36code"); |
---|
| 904 | unlink("/tmp/jsunpack4_tmpstr_last"); |
---|
| 905 | |
---|
[38825] | 906 | //eval(function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c]);return p}('1k.1j(\'<c 13="1i"1h="1g:1f-1e-1d-1c-1b"u="t"s="r"1a="3://h.9.g/f/19.18"><2 1="y"0="x"/><2 1="w"0="v"/><2 1="a"0="3://8.7.6.5/i/q/p.o"/><2 1="l"0="4"><2 1="m"0="4"/><2 1="k"0="j"/><2 1="n"0="4"/><2 1="12"0="3://8.7.6.5:11/d/10/b.z"/><e 13="17"16="b/9"12="3://8.7.6.5:11/d/10/b.z"y="x"w="v"u="t"s="r"a="3://8.7.6.5/i/q/p.o"n="4"m="4"a=""l="4"k="j"15="3://h.9.g/f/14/"></e></c>\');',36,57,'value|name|param|http|false|240|30|56|185|divx|previewImage|video|object||embed|plugin|com|go||Play|previewMessage|allowContextMenu|bannerEnabled|autoPlay|jpg|rezh7ogkvg6b|00004|380|height|715|width|transparent|wmode|Stage6|custommode|mkv|s4umuuk7gii5uaadrm5a76s7fd4bjlcti2r3v6bsa5d6yryt4dawmiqg|182|src|id|download|pluginspage|type|np_vid|cab|DivXBrowserPlugin|codebase|CC0F21721616|9C46|41fa|D0AB|67DABFBF|clsid|classid|ie_vid|write|document'.split('|'))) |
---|
| 907 | |
---|
| 908 | //eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3.2(\'<0 4\'.1(\'8="\'+\'/5\'.1(\'/\'+7+\'">\\6/0>\')))',9,9,'script|concat|write|document|s|jwv|x3C|mpri_Key|rc'.split('|'),0,{})) |
---|
| 909 | |
---|
[36122] | 910 | while(ostrstr(input, "eval(function(p,a,c,k,e,d){") != NULL) |
---|
| 911 | { |
---|
[38825] | 912 | packed = string_resub("eval(function(p,a,c,k,e,d){", "}))", input, 0); |
---|
| 913 | if(packed == NULL) |
---|
| 914 | packed = string_resub("eval(function(p,a,c,k,e,d){", "))", input, 0); |
---|
| 915 | |
---|
[36122] | 916 | titheklog(debuglevel, "/tmp/jsunpack1_packed", NULL, NULL, NULL, packed); |
---|
| 917 | |
---|
| 918 | // tmpstr = string_resub(";return p}('", ");'", packed, 0); |
---|
| 919 | // tmpstr = oregex(".*;return p}(.*)',[0-9]{2,2},[0-9]{2,2},'.*'.split.*", packed); |
---|
[38825] | 920 | // tmpstr = oregex(".*;return p}(.*)',[0-9]{1,3},[0-9]{1,3},'.*'.split.*", packed); |
---|
| 921 | tmpstr = oregex(".*return p}(.*)',[0-9]{1,3},[0-9]{1,3},'.*'.split.*", packed); |
---|
| 922 | |
---|
| 923 | debug(99, "tmpstr: %s", tmpstr); |
---|
| 924 | titheklog(debuglevel, "/tmp/jsunpack2_packed_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
| 925 | |
---|
| 926 | // b36code = oregex(".*;',[0-9]{2,2},[0-9]{2,2},'(.*)'.split.*", packed); |
---|
| 927 | b36code = oregex(".*',[0-9]{1,3},[0-9]{1,3},'(.*)'.split.*", packed); |
---|
| 928 | |
---|
| 929 | b36code = string_replace_all("||", "| |", b36code, 1); |
---|
| 930 | debug(99, "b36code: %s", b36code); |
---|
| 931 | titheklog(debuglevel, "/tmp/jsunpack3_packed_b36code", NULL, NULL, NULL, b36code); |
---|
| 932 | |
---|
| 933 | if(!ostrncmp("|", b36code, 1)) |
---|
| 934 | b36code = ostrcat(" ", b36code, 0, 1); |
---|
| 935 | |
---|
| 936 | struct splitstr* ret1 = NULL; |
---|
| 937 | int count = 0; |
---|
| 938 | int i = 0; |
---|
| 939 | ret1 = strsplit(b36code, "|", &count); |
---|
| 940 | |
---|
| 941 | charlist = ostrcat(charlist, "\"", 1, 0); |
---|
| 942 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 943 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 944 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 945 | charlist = ostrcat(charlist, ".", 1, 0); |
---|
| 946 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 947 | charlist = ostrcat(charlist, ";", 1, 0); |
---|
| 948 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 949 | charlist = ostrcat(charlist, ":", 1, 0); |
---|
| 950 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 951 | charlist = ostrcat(charlist, "=", 1, 0); |
---|
| 952 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 953 | charlist = ostrcat(charlist, ",", 1, 0); |
---|
| 954 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 955 | charlist = ostrcat(charlist, " ", 1, 0); |
---|
| 956 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 957 | charlist = ostrcat(charlist, "\\", 1, 0); |
---|
| 958 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 959 | charlist = ostrcat(charlist, "/", 1, 0); |
---|
| 960 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 961 | charlist = ostrcat(charlist, "(", 1, 0); |
---|
| 962 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 963 | charlist = ostrcat(charlist, ")", 1, 0); |
---|
| 964 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 965 | charlist = ostrcat(charlist, "%", 1, 0); |
---|
| 966 | |
---|
| 967 | for(i = 0; i < count; i++) |
---|
| 968 | { |
---|
| 969 | if(ostrstr((&ret1[i])->part, " ") != NULL) |
---|
| 970 | { |
---|
| 971 | printf("continue\n"); |
---|
| 972 | continue; |
---|
| 973 | } |
---|
| 974 | char* x = oltostr(i, 36); |
---|
| 975 | |
---|
| 976 | struct splitstr* ret2 = NULL; |
---|
| 977 | int count2 = 0; |
---|
| 978 | int i2 = 0; |
---|
| 979 | tmpstr2 = ostrcat(charlist, NULL, 0, 0); |
---|
| 980 | ret2 = strsplit(tmpstr2, "|", &count2); |
---|
| 981 | for(i2 = 0; i2 < count2; i2++) |
---|
| 982 | { |
---|
| 983 | struct splitstr* ret3 = NULL; |
---|
| 984 | int count3 = 0; |
---|
| 985 | int i3 = 0; |
---|
| 986 | tmpstr3 = ostrcat(charlist, NULL, 0, 0); |
---|
| 987 | ret3 = strsplit(tmpstr3, "|", &count3); |
---|
| 988 | for(i3 = 0; i3 < count3; i3++) |
---|
| 989 | { |
---|
| 990 | debug(99, "-----------------------------------------------"); |
---|
| 991 | debug(99, "replace %s%s%s <> %s%s%s",(&ret2[i2])->part, x, (&ret3[i3])->part, (&ret2[i2])->part, (&ret1[i])->part, (&ret3[i3])->part); |
---|
| 992 | |
---|
| 993 | base = ostrcat(base, (&ret2[i2])->part, 1, 0); |
---|
| 994 | base = ostrcat(base, x, 1, 0); |
---|
| 995 | base = ostrcat(base, (&ret3[i3])->part, 1, 0); |
---|
| 996 | search = ostrcat(search, (&ret2[i2])->part, 1, 0); |
---|
| 997 | search = ostrcat(search, (&ret1[i])->part, 1, 0); |
---|
| 998 | search = ostrcat(search, (&ret3[i3])->part, 1, 0); |
---|
| 999 | tmpstr = string_replace_all(base, search, tmpstr, 1); |
---|
| 1000 | free(base), base = NULL; |
---|
| 1001 | free(search), search = NULL; |
---|
| 1002 | } |
---|
| 1003 | free(ret3), ret3 = NULL; |
---|
| 1004 | free(tmpstr3), tmpstr3 = NULL; |
---|
| 1005 | } |
---|
| 1006 | free(ret2), ret2 = NULL; |
---|
| 1007 | free(tmpstr2), tmpstr2 = NULL; |
---|
| 1008 | free(x); |
---|
| 1009 | } |
---|
| 1010 | free(ret1), ret1 = NULL; |
---|
| 1011 | |
---|
| 1012 | titheklog(debuglevel, "/tmp/jsunpack4_packed_tmpstr_last", NULL, NULL, NULL, tmpstr); |
---|
| 1013 | |
---|
| 1014 | if(tmpstr == NULL) |
---|
| 1015 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted-error){", input, 1); |
---|
| 1016 | else |
---|
| 1017 | { |
---|
| 1018 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted){", input, 1); |
---|
| 1019 | input = string_replace(packed, tmpstr, input, 1); |
---|
| 1020 | } |
---|
| 1021 | free(tmpstr),tmpstr = NULL; |
---|
| 1022 | free(packed), packed = NULL; |
---|
| 1023 | free(b36code), b36code = NULL; |
---|
| 1024 | free(charlist), charlist = NULL; |
---|
| 1025 | } |
---|
| 1026 | |
---|
| 1027 | //eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[2-9k-t]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('k p(a){5 b="s=1",c="t=l";7(a&&a.8&&a.8.9>0)6(5 d=0;d<a.8.9;d++){5 e=a.8[d],f=["r","m"];6(5 g n f){5 h=f[g];7(e&&e[h])6(5 i=e[h],j=0;j<i.9;j++)i[j]&&i[j].2&&(i[j].2+=(-1==i[j].2.o("?")?"?":"&")+"4=3&"+b+"&"+c)}}q a}',[],30,'||file|false|direct|var|for|if|playlist|length|||||||||||function|g2wppbatyvegydjngpim4hp5rl6ammlhkneq3sdgfqh5woiym753qlis6o6737kceon73boksojlkppwz744cta5i2kpzwwdsh3hrjqq3eiwcysqmy6aerlaeszaptrregtvpdfsdaiy4idwqdlack4abotyacmth2a253x5lrvvul7dxs6kligge5dufn6eofjjxex7vzljmvrrv4dnb4xlbn3hvb67c2pgc7y|httpfallback|in|indexOf|jwConfig|return|sources|ua|vt'.split('|'),0,{})) |
---|
| 1028 | |
---|
| 1029 | while(ostrstr(input, "eval(function(p,a,c,k,e,r){") != NULL) |
---|
| 1030 | { |
---|
| 1031 | packed = string_resub("eval(function(p,a,c,k,e,r){", "))", input, 0); |
---|
| 1032 | titheklog(debuglevel, "/tmp/jsunpack1_packed", NULL, NULL, NULL, packed); |
---|
| 1033 | |
---|
| 1034 | // tmpstr = string_resub(";return p}('", ");'", packed, 0); |
---|
| 1035 | // tmpstr = oregex(".*;return p}(.*)',[0-9]{2,2},[0-9]{2,2},'.*'.split.*", packed); |
---|
[36122] | 1036 | tmpstr = oregex(".*;return p}(.*)',[0-9]{1,3},[0-9]{1,3},'.*'.split.*", packed); |
---|
| 1037 | |
---|
| 1038 | debug(99, "tmpstr: %s", tmpstr); |
---|
[38825] | 1039 | titheklog(debuglevel, "/tmp/jsunpack2_packed_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
[36122] | 1040 | |
---|
| 1041 | // b36code = oregex(".*;',[0-9]{2,2},[0-9]{2,2},'(.*)'.split.*", packed); |
---|
| 1042 | b36code = oregex(".*',[0-9]{1,3},[0-9]{1,3},'(.*)'.split.*", packed); |
---|
| 1043 | |
---|
| 1044 | b36code = string_replace_all("||", "| |", b36code, 1); |
---|
| 1045 | debug(99, "b36code: %s", b36code); |
---|
[38825] | 1046 | titheklog(debuglevel, "/tmp/jsunpack3_packed_b36code", NULL, NULL, NULL, b36code); |
---|
[36122] | 1047 | |
---|
| 1048 | if(!ostrncmp("|", b36code, 1)) |
---|
| 1049 | b36code = ostrcat(" ", b36code, 0, 1); |
---|
| 1050 | |
---|
| 1051 | struct splitstr* ret1 = NULL; |
---|
| 1052 | int count = 0; |
---|
| 1053 | int i = 0; |
---|
| 1054 | ret1 = strsplit(b36code, "|", &count); |
---|
| 1055 | |
---|
| 1056 | charlist = ostrcat(charlist, "\"", 1, 0); |
---|
| 1057 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1058 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 1059 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1060 | charlist = ostrcat(charlist, ".", 1, 0); |
---|
| 1061 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1062 | charlist = ostrcat(charlist, ";", 1, 0); |
---|
| 1063 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1064 | charlist = ostrcat(charlist, ":", 1, 0); |
---|
| 1065 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1066 | charlist = ostrcat(charlist, "=", 1, 0); |
---|
| 1067 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1068 | charlist = ostrcat(charlist, ",", 1, 0); |
---|
| 1069 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1070 | charlist = ostrcat(charlist, " ", 1, 0); |
---|
| 1071 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1072 | charlist = ostrcat(charlist, "\\", 1, 0); |
---|
| 1073 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1074 | charlist = ostrcat(charlist, "/", 1, 0); |
---|
| 1075 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1076 | charlist = ostrcat(charlist, "(", 1, 0); |
---|
| 1077 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 1078 | charlist = ostrcat(charlist, ")", 1, 0); |
---|
| 1079 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 1080 | charlist = ostrcat(charlist, "%", 1, 0); |
---|
| 1081 | |
---|
| 1082 | for(i = 0; i < count; i++) |
---|
| 1083 | { |
---|
| 1084 | if(ostrstr((&ret1[i])->part, " ") != NULL) |
---|
| 1085 | { |
---|
| 1086 | printf("continue\n"); |
---|
| 1087 | continue; |
---|
| 1088 | } |
---|
| 1089 | char* x = oltostr(i, 36); |
---|
| 1090 | |
---|
| 1091 | struct splitstr* ret2 = NULL; |
---|
| 1092 | int count2 = 0; |
---|
| 1093 | int i2 = 0; |
---|
| 1094 | tmpstr2 = ostrcat(charlist, NULL, 0, 0); |
---|
| 1095 | ret2 = strsplit(tmpstr2, "|", &count2); |
---|
| 1096 | for(i2 = 0; i2 < count2; i2++) |
---|
| 1097 | { |
---|
| 1098 | struct splitstr* ret3 = NULL; |
---|
| 1099 | int count3 = 0; |
---|
| 1100 | int i3 = 0; |
---|
| 1101 | tmpstr3 = ostrcat(charlist, NULL, 0, 0); |
---|
| 1102 | ret3 = strsplit(tmpstr3, "|", &count3); |
---|
| 1103 | for(i3 = 0; i3 < count3; i3++) |
---|
| 1104 | { |
---|
| 1105 | debug(99, "-----------------------------------------------"); |
---|
| 1106 | debug(99, "replace %s%s%s <> %s%s%s",(&ret2[i2])->part, x, (&ret3[i3])->part, (&ret2[i2])->part, (&ret1[i])->part, (&ret3[i3])->part); |
---|
| 1107 | |
---|
| 1108 | base = ostrcat(base, (&ret2[i2])->part, 1, 0); |
---|
| 1109 | base = ostrcat(base, x, 1, 0); |
---|
| 1110 | base = ostrcat(base, (&ret3[i3])->part, 1, 0); |
---|
| 1111 | search = ostrcat(search, (&ret2[i2])->part, 1, 0); |
---|
| 1112 | search = ostrcat(search, (&ret1[i])->part, 1, 0); |
---|
| 1113 | search = ostrcat(search, (&ret3[i3])->part, 1, 0); |
---|
| 1114 | tmpstr = string_replace_all(base, search, tmpstr, 1); |
---|
| 1115 | free(base), base = NULL; |
---|
| 1116 | free(search), search = NULL; |
---|
| 1117 | } |
---|
| 1118 | free(ret3), ret3 = NULL; |
---|
| 1119 | free(tmpstr3), tmpstr3 = NULL; |
---|
| 1120 | } |
---|
| 1121 | free(ret2), ret2 = NULL; |
---|
| 1122 | free(tmpstr2), tmpstr2 = NULL; |
---|
| 1123 | free(x); |
---|
| 1124 | } |
---|
| 1125 | free(ret1), ret1 = NULL; |
---|
| 1126 | |
---|
[38825] | 1127 | titheklog(debuglevel, "/tmp/jsunpack4_packed_tmpstr_last", NULL, NULL, NULL, tmpstr); |
---|
[36122] | 1128 | |
---|
| 1129 | if(tmpstr == NULL) |
---|
| 1130 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted-error){", input, 1); |
---|
| 1131 | else |
---|
| 1132 | { |
---|
| 1133 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted){", input, 1); |
---|
| 1134 | input = string_replace(packed, tmpstr, input, 1); |
---|
| 1135 | } |
---|
| 1136 | free(tmpstr),tmpstr = NULL; |
---|
| 1137 | free(packed), packed = NULL; |
---|
| 1138 | free(b36code), b36code = NULL; |
---|
| 1139 | free(charlist), charlist = NULL; |
---|
| 1140 | } |
---|
| 1141 | |
---|
| 1142 | return input; |
---|
| 1143 | } |
---|
| 1144 | |
---|
[39020] | 1145 | void localparser_init(char* titheklink, char* tithekfile, int flag) |
---|
[36211] | 1146 | { |
---|
| 1147 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *cmd = NULL, *line = NULL, *path = NULL; |
---|
[39035] | 1148 | struct skin* load = getscreen("loading"); |
---|
[36211] | 1149 | |
---|
| 1150 | if(ostrcmp("http://atemio.dyndns.tv/mediathek/mainmenu.list", titheklink) == 0) |
---|
| 1151 | { |
---|
[37150] | 1152 | path = ostrcat("/tmp/localparser", NULL, 0, 0); |
---|
[39035] | 1153 | drawscreen(load, 0, 0); |
---|
[36211] | 1154 | |
---|
[39581] | 1155 | char* titheklocalfile = ostrcat("/tmp/tithek/mainmenu.local.list", NULL, 0, 0); |
---|
| 1156 | |
---|
[39020] | 1157 | if(flag == 1) |
---|
[36949] | 1158 | { |
---|
[39020] | 1159 | if(!file_exist("/tmp/localhoster")) |
---|
| 1160 | mkdir("/tmp/localhoster", 0777); |
---|
| 1161 | if(!file_exist("/mnt/parser")) |
---|
| 1162 | mkdir("/mnt/parser", 0777); |
---|
| 1163 | if(!file_exist(path)) |
---|
| 1164 | mkdir(path, 0777); |
---|
| 1165 | |
---|
| 1166 | gethttp("atemio.dyndns.tv", "/mediathek/parser_free.tar", 80, "/tmp/parser.tar", HTTPAUTH, 5000, NULL, 0); |
---|
| 1167 | |
---|
[40191] | 1168 | cmd = ostrcat("tar -xf /tmp/parser.tar -C ", path, 0, 0); |
---|
[40195] | 1169 | printf("[tithek] start cmd: %s\n", cmd); |
---|
[36949] | 1170 | system(cmd); |
---|
[40195] | 1171 | printf("[tithek] ende cmd: %s\n", cmd); |
---|
[36949] | 1172 | free(cmd), cmd = NULL; |
---|
[39033] | 1173 | unlink("/tmp/parser.tar"); |
---|
[40195] | 1174 | printf("[tithek] remove: /tmp/parser.tar\n"); |
---|
[39020] | 1175 | |
---|
| 1176 | if(file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack")) |
---|
| 1177 | { |
---|
| 1178 | gethttp("atemio.dyndns.tv", "/mediathek/parser_secret.tar", 80, "/tmp/parser.tar", HTTPAUTH, 5000, NULL, 0); |
---|
[40191] | 1179 | cmd = ostrcat("tar -xf /tmp/parser.tar -C ", path, 0, 0); |
---|
[40195] | 1180 | printf("[tithek] start cmd: %s\n", cmd); |
---|
[39020] | 1181 | system(cmd); |
---|
[40195] | 1182 | printf("[tithek] ende cmd: %s\n", cmd); |
---|
[39020] | 1183 | free(cmd), cmd = NULL; |
---|
[40195] | 1184 | printf("[tithek] remove: /tmp/parser.tar\n"); |
---|
[39034] | 1185 | unlink("/tmp/parser.tar"); |
---|
[39020] | 1186 | } |
---|
| 1187 | |
---|
| 1188 | gethttp("atemio.dyndns.tv", "/mediathek/hoster.tar", 80, "/tmp/hoster.tar", HTTPAUTH, 5000, NULL, 0); |
---|
[40191] | 1189 | cmd = ostrcat("tar -xf /tmp/hoster.tar -C ", "/tmp/localhoster", 0, 0); |
---|
[40195] | 1190 | printf("[tithek] start cmd: %s\n", cmd); |
---|
[39020] | 1191 | system(cmd); |
---|
[40195] | 1192 | printf("[tithek] ende cmd: %s\n", cmd); |
---|
[39020] | 1193 | free(cmd), cmd = NULL; |
---|
[40195] | 1194 | printf("[tithek] remove: /tmp/hoster.tar\n"); |
---|
[39033] | 1195 | unlink("/tmp/hoster.tar"); |
---|
[39031] | 1196 | |
---|
[40119] | 1197 | //dnode is freed in thread |
---|
| 1198 | struct download* dnode = calloc(1, sizeof(struct download)); |
---|
| 1199 | if(dnode != NULL) |
---|
| 1200 | { |
---|
| 1201 | dnode->host = ostrcat("atemio.dyndns.tv", NULL, 0, 0); |
---|
[40180] | 1202 | dnode->page = ostrcat("/mediathek/python.tar", NULL, 0, 0); |
---|
[40119] | 1203 | dnode->port = 80; |
---|
[40176] | 1204 | dnode->filename = ostrcat("/tmp/python.tar", NULL, 0, 0); |
---|
[40191] | 1205 | |
---|
| 1206 | printf("[tithek] getfreespace start\n"); |
---|
| 1207 | |
---|
[40174] | 1208 | if(getfreespace("/mnt") / 1024 > 102400) //100mb |
---|
[40160] | 1209 | { |
---|
[40153] | 1210 | mkdir("/mnt/.tithek", 0777); |
---|
[40159] | 1211 | if(file_exist("/mnt/.tithek")) |
---|
[40153] | 1212 | dnode->filename = ostrcat("/mnt/.tithek/python.tar", NULL, 0, 0); |
---|
[40195] | 1213 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
| 1214 | symlink("/mnt/.tithek/lib", "/tmp/localhoster/lib"); |
---|
[40174] | 1215 | } |
---|
| 1216 | else if(file_exist("/media/hdd") && getfreespace("/media/hdd") / 1024 > 102400) |
---|
[40153] | 1217 | { |
---|
| 1218 | mkdir("/media/hdd/.tithek", 0777); |
---|
[40159] | 1219 | if(file_exist("/media/hdd/.tithek")) |
---|
[40153] | 1220 | dnode->filename = ostrcat("/media/hdd/.tithek/python.tar", NULL, 0, 0); |
---|
[40195] | 1221 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
| 1222 | symlink("/media/hdd/.tithek/lib", "/tmp/localhoster/lib"); |
---|
[40153] | 1223 | } |
---|
[40174] | 1224 | else if(file_exist("/var/swap") && getfreespace("/var/swap") / 1024 > 102400) |
---|
[40153] | 1225 | { |
---|
| 1226 | mkdir("/var/swap/.tithek", 0777); |
---|
[40159] | 1227 | if(file_exist("/var/swap/.tithek")) |
---|
[40153] | 1228 | dnode->filename = ostrcat("/var/swap/.tithek/python.tar", NULL, 0, 0); |
---|
[40195] | 1229 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
| 1230 | symlink("/var/swap/.tithek/lib", "/tmp/localhoster/lib"); |
---|
[40153] | 1231 | } |
---|
[40174] | 1232 | else if(getfreespace("/tmp") / 1024 > 102400) |
---|
| 1233 | { |
---|
| 1234 | dnode->filename = ostrcat("/tmp/python.tar", NULL, 0, 0); |
---|
[40176] | 1235 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
[40174] | 1236 | } |
---|
[40191] | 1237 | printf("[tithek] getfreespace end\n"); |
---|
[40174] | 1238 | |
---|
[40279] | 1239 | // if(ostrcmp(dnode->page, "/tmp/python.tar") == 0 || getconfigint("tithek_autoupdate", NULL) == 1) |
---|
| 1240 | if(getconfigint("tithek_autoupdate", NULL) == 1) |
---|
[40195] | 1241 | { |
---|
[40313] | 1242 | if(file_exist(dnode->filename)) |
---|
[40195] | 1243 | { |
---|
| 1244 | printf("[tithek] remove before download: %s\n", dnode->page); |
---|
[40313] | 1245 | unlink(dnode->filename); |
---|
[40195] | 1246 | } |
---|
| 1247 | } |
---|
| 1248 | |
---|
[40119] | 1249 | dnode->auth = ostrcat(HTTPAUTH, NULL, 0, 0); |
---|
| 1250 | dnode->connfd = -1; |
---|
| 1251 | dnode->ret = -1; |
---|
[40121] | 1252 | dnode->timeout = 10000; |
---|
[40119] | 1253 | addtimer(&tithekdownloadthread, START, 100, 1, (void*)dnode, NULL, NULL); |
---|
| 1254 | } |
---|
| 1255 | |
---|
[39031] | 1256 | cmd = ostrcat("chmod -R 755 ", path, 0, 0); |
---|
| 1257 | system(cmd); |
---|
| 1258 | free(cmd), cmd = NULL; |
---|
| 1259 | |
---|
| 1260 | cmd = ostrcat("chmod -R 755 /mnt/parser", NULL, 0, 0); |
---|
| 1261 | system(cmd); |
---|
| 1262 | free(cmd), cmd = NULL; |
---|
| 1263 | |
---|
| 1264 | cmd = ostrcat("chmod -R 755 /tmp/localhoster", NULL, 0, 0); |
---|
| 1265 | system(cmd); |
---|
| 1266 | free(cmd), cmd = NULL; |
---|
[39581] | 1267 | // } |
---|
[36211] | 1268 | |
---|
[39581] | 1269 | cmd = ostrcat("ls -1 ", path, 0, 0); |
---|
| 1270 | cmd = ostrcat(cmd, "/*.sh", 1, 0); |
---|
| 1271 | |
---|
| 1272 | free(path), path = NULL; |
---|
| 1273 | tmpstr1 = command("ls -1 /mnt/parser/*.sh"); |
---|
| 1274 | tmpstr2 = command(cmd); |
---|
| 1275 | free(cmd), cmd = NULL; |
---|
| 1276 | tmpstr = ostrcat(tmpstr1, "\n", 0, 0); |
---|
| 1277 | tmpstr = ostrcat(tmpstr, tmpstr2, 1, 0); |
---|
| 1278 | |
---|
| 1279 | int count = 0, i = 0; |
---|
| 1280 | struct splitstr* ret1 = NULL; |
---|
| 1281 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
| 1282 | |
---|
| 1283 | int max = count; |
---|
| 1284 | for(i = 0; i < max; i++) |
---|
[36211] | 1285 | { |
---|
[39581] | 1286 | if(file_exist(ret1[i].part) && cmpfilenameext(ret1[i].part, ".sh") == 0) |
---|
| 1287 | { |
---|
| 1288 | cmd = ostrcat(ret1[i].part, " ", 0, 0); |
---|
| 1289 | cmd = ostrcat(cmd, ret1[i].part, 1, 0); |
---|
| 1290 | cmd = ostrcat(cmd, " init", 1, 0); |
---|
| 1291 | line = command(cmd); |
---|
[40191] | 1292 | line = string_newline(line); |
---|
[40195] | 1293 | printf("[tithek] cmd: %s\n", cmd); |
---|
[39581] | 1294 | debug(99, "add main menuentry: %s", line); |
---|
| 1295 | writesys(titheklocalfile, line, 3); |
---|
| 1296 | free(cmd), cmd = NULL; |
---|
| 1297 | free(line), line = NULL; |
---|
| 1298 | } |
---|
[36211] | 1299 | } |
---|
[39581] | 1300 | free(ret1), ret1 = NULL; |
---|
| 1301 | free(tmpstr), tmpstr = NULL; |
---|
| 1302 | free(tmpstr1), tmpstr1 = NULL; |
---|
| 1303 | free(tmpstr2), tmpstr2 = NULL; |
---|
[36211] | 1304 | } |
---|
[39581] | 1305 | |
---|
| 1306 | line = readfiletomem(titheklocalfile, 1); |
---|
| 1307 | free(titheklocalfile), titheklocalfile = NULL; |
---|
| 1308 | writesys(tithekfile, line, 3); |
---|
| 1309 | |
---|
[39035] | 1310 | clearscreen(load); |
---|
[36211] | 1311 | } |
---|
[39581] | 1312 | |
---|
[36211] | 1313 | } |
---|
| 1314 | |
---|
[41291] | 1315 | char* list_hoster_streams(char* input) |
---|
[41274] | 1316 | { |
---|
[41291] | 1317 | char* streamurl = NULL, *tmpstr = NULL, *nummer = NULL, *title = NULL, *pic = NULL, *filename = NULL; |
---|
[41274] | 1318 | |
---|
[41291] | 1319 | int count = 0, i = 0; |
---|
| 1320 | |
---|
| 1321 | filename = ostrcat(input, NULL, 0, 0); |
---|
| 1322 | |
---|
[41274] | 1323 | if(ostrncmp("/tmp/", filename, 5) && ostrncmp("/mnt/", filename, 5)) |
---|
| 1324 | return filename; |
---|
[41291] | 1325 | else |
---|
| 1326 | { |
---|
| 1327 | debug(10, "Streamfile found: %s", input); |
---|
| 1328 | debug(99, "Streamfile found: %s", input); |
---|
| 1329 | } |
---|
[41274] | 1330 | |
---|
| 1331 | // tmpstr = ostrcat(link, NULL, 0, 0); |
---|
| 1332 | tmpstr = readfiletomem(filename, 1); |
---|
| 1333 | |
---|
| 1334 | struct splitstr* ret1 = NULL; |
---|
| 1335 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
| 1336 | // ret1 = strsplit(string_decode(tmpstr2, 0), "\n", &count); |
---|
| 1337 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
| 1338 | for(i = 0; i < count; i++) |
---|
| 1339 | { |
---|
| 1340 | // if(ret1[i].part != NULL && ostrstr(ret1[i].part, "_quality") != NULL) |
---|
| 1341 | if(ret1[i].part != NULL) |
---|
| 1342 | { |
---|
| 1343 | |
---|
| 1344 | if(ostrstr(ret1[i].part, "f4m") != NULL) |
---|
| 1345 | pic = ostrcat("f4m.png", NULL, 0, 0); |
---|
| 1346 | else if(ostrstr(ret1[i].part, "mp4") != NULL) |
---|
| 1347 | pic = ostrcat("mp4.png", NULL, 0, 0); |
---|
| 1348 | else if(ostrstr(ret1[i].part, "3gp") != NULL) |
---|
| 1349 | pic = ostrcat("3gp.png", NULL, 0, 0); |
---|
| 1350 | else if(ostrstr(ret1[i].part, "flv") != NULL) |
---|
| 1351 | pic = ostrcat("flv.png", NULL, 0, 0); |
---|
| 1352 | else if(ostrstr(ret1[i].part, "hls") != NULL) |
---|
| 1353 | pic = ostrcat("hls.png", NULL, 0, 0); |
---|
| 1354 | else if(ostrstr(ret1[i].part, "mkv") != NULL) |
---|
| 1355 | pic = ostrcat("mkv.png", NULL, 0, 0); |
---|
| 1356 | |
---|
| 1357 | if(ostrstr(ret1[i].part, "1080p") != NULL) |
---|
| 1358 | nummer = ostrcat("1080p", NULL, 0, 0); |
---|
| 1359 | else if(ostrstr(ret1[i].part, "1080i") != NULL) |
---|
| 1360 | nummer = ostrcat("1080i", NULL, 0, 0); |
---|
| 1361 | else if(ostrstr(ret1[i].part, "1080") != NULL) |
---|
| 1362 | nummer = ostrcat("1080", NULL, 0, 0); |
---|
| 1363 | else if(ostrstr(ret1[i].part, "720p") != NULL) |
---|
| 1364 | nummer = ostrcat("720p", NULL, 0, 0); |
---|
| 1365 | else if(ostrstr(ret1[i].part, "720") != NULL) |
---|
| 1366 | nummer = ostrcat("720", NULL, 0, 0); |
---|
| 1367 | else if(ostrstr(ret1[i].part, "360p") != NULL) |
---|
| 1368 | nummer = ostrcat("360p", NULL, 0, 0); |
---|
| 1369 | else if(ostrstr(ret1[i].part, "360") != NULL) |
---|
| 1370 | nummer = ostrcat("360", NULL, 0, 0); |
---|
| 1371 | else if(ostrstr(ret1[i].part, "hls") != NULL) |
---|
| 1372 | nummer = ostrcat("hls", NULL, 0, 0); |
---|
| 1373 | else if(ostrstr(ret1[i].part, "auto") != NULL) |
---|
| 1374 | nummer = ostrcat("auto", NULL, 0, 0); |
---|
| 1375 | |
---|
[41279] | 1376 | title = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
| 1377 | title = stringreplacecharonce(title, ':', '\0'); |
---|
| 1378 | string_toupper(title); |
---|
| 1379 | title = ostrcat(title, " Stream", 1, 0); |
---|
[41274] | 1380 | |
---|
| 1381 | streamurl = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
| 1382 | if(nummer != NULL) |
---|
| 1383 | { |
---|
| 1384 | title = ostrcat(title, " (", 1, 0); |
---|
| 1385 | title = ostrcat(title, nummer, 1, 0); |
---|
| 1386 | title = ostrcat(title, ")", 1, 0); |
---|
| 1387 | } |
---|
| 1388 | debug(99, "(%d) title: %s streamurl: %s\n", i, title, streamurl); |
---|
| 1389 | addmenulist(&mlist, title, streamurl, pic, 0, 0); |
---|
| 1390 | |
---|
| 1391 | free(title), title = NULL; |
---|
| 1392 | free(pic), pic = NULL; |
---|
| 1393 | free(nummer), nummer = NULL; |
---|
| 1394 | free(streamurl), streamurl = NULL; |
---|
| 1395 | } |
---|
| 1396 | } |
---|
| 1397 | free(ret1), ret1 = NULL; |
---|
| 1398 | |
---|
| 1399 | if(mlist != NULL) |
---|
| 1400 | { |
---|
| 1401 | mbox = menulistbox(mlist, NULL, _("Stream Menu"), _("Choose your Streaming Format from the following list"), NULL, NULL, 1, 0); |
---|
| 1402 | if(mbox != NULL) |
---|
| 1403 | { |
---|
| 1404 | free(streamurl), streamurl = NULL; |
---|
| 1405 | |
---|
| 1406 | debug(99, "mbox->name %s", mbox->name); |
---|
| 1407 | debug(99, "mbox->text %s", mbox->text); |
---|
| 1408 | streamurl = ostrcat(mbox->text, NULL, 0, 0); |
---|
| 1409 | } |
---|
| 1410 | } |
---|
| 1411 | free(tmpstr); tmpstr = NULL; |
---|
[41291] | 1412 | |
---|
[41274] | 1413 | if(streamurl == NULL) |
---|
[41291] | 1414 | { |
---|
| 1415 | debug(10, "Streamfile choice canceld by USER set Streamurl to skip"); |
---|
| 1416 | debug(99, "Streamfile choice canceld by USER set Streamurl to skip"); |
---|
| 1417 | |
---|
[41274] | 1418 | streamurl = ostrcat("skip", NULL, 0, 0); |
---|
[41291] | 1419 | } |
---|
[41274] | 1420 | |
---|
| 1421 | return streamurl; |
---|
| 1422 | } |
---|
| 1423 | |
---|
[36966] | 1424 | char* localparser_hoster(char* link) |
---|
| 1425 | { |
---|
[37026] | 1426 | debug(99, "link: %s", link); |
---|
[42622] | 1427 | // int ret = 1; |
---|
[36966] | 1428 | char* tmpstr = NULL, *streamurl = NULL; |
---|
| 1429 | |
---|
| 1430 | tmpstr = command(link); |
---|
| 1431 | tmpstr = string_newline(tmpstr); |
---|
[40006] | 1432 | debug(99, "tmpstr: %s", tmpstr); |
---|
[36970] | 1433 | |
---|
[39993] | 1434 | if(ostrstr(tmpstr, "gethoster2") != NULL) |
---|
| 1435 | { |
---|
| 1436 | tmpstr = string_replace_all("gethoster2 ", "", tmpstr, 1); |
---|
| 1437 | streamurl = hoster(tmpstr); |
---|
| 1438 | } |
---|
| 1439 | else if(ostrstr(link, ".sh play ") != NULL) |
---|
[36970] | 1440 | streamurl = ostrcat(tmpstr, NULL, 0, 0); |
---|
[36973] | 1441 | else if(ostrstr(link, ".sh hoster ") != NULL) |
---|
[36972] | 1442 | streamurl = hoster(tmpstr); |
---|
[41291] | 1443 | |
---|
[36966] | 1444 | free(tmpstr), tmpstr = NULL; |
---|
| 1445 | return streamurl; |
---|
| 1446 | } |
---|
| 1447 | |
---|
| 1448 | int localparser_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
| 1449 | { |
---|
[37534] | 1450 | char* tmpstr = NULL, *menu = NULL, *search = NULL, *cmd = NULL; |
---|
[37443] | 1451 | int ret = 1; |
---|
[36966] | 1452 | |
---|
| 1453 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
| 1454 | return ret; |
---|
| 1455 | |
---|
| 1456 | if(searchstr == NULL) |
---|
| 1457 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
| 1458 | else |
---|
| 1459 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
| 1460 | |
---|
| 1461 | if(search != NULL) |
---|
| 1462 | { |
---|
| 1463 | drawscreen(load, 0, 0); |
---|
| 1464 | |
---|
| 1465 | strstrip(search); |
---|
| 1466 | string_tolower(search); |
---|
[37534] | 1467 | search = stringreplacechar(search, ' ', '+'); |
---|
[36966] | 1468 | |
---|
[37534] | 1469 | cmd = ostrcat(link, NULL, 0, 0); |
---|
| 1470 | |
---|
[37532] | 1471 | if(ostrstr(cmd, "%search%") != NULL) |
---|
[37534] | 1472 | cmd = string_replace_all("%search%", search, cmd, 1); |
---|
[37532] | 1473 | else |
---|
| 1474 | cmd = ostrcat(link, search, 0, 0); |
---|
| 1475 | |
---|
[37533] | 1476 | debug(99, "cmd: %s", cmd); |
---|
[36970] | 1477 | char* filename = command(cmd); |
---|
| 1478 | filename = string_newline(filename); |
---|
| 1479 | tmpstr = readfiletomem(filename, 1); |
---|
| 1480 | free(cmd), cmd = NULL; |
---|
[36966] | 1481 | |
---|
[36970] | 1482 | if(tmpstr != NULL) |
---|
[36966] | 1483 | { |
---|
[36970] | 1484 | tmpstr = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", tmpstr, 1); |
---|
| 1485 | menu = ostrcat(filename, NULL, 0, 0); |
---|
| 1486 | // writesys(menu, tmpstr, 0); |
---|
| 1487 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
[42622] | 1488 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->description, tnode->flag); |
---|
[36970] | 1489 | ret = 0; |
---|
| 1490 | } |
---|
[36966] | 1491 | |
---|
[36970] | 1492 | free(filename), filename = NULL; |
---|
[36966] | 1493 | free(tmpstr), tmpstr = NULL; |
---|
| 1494 | } |
---|
| 1495 | free(search), search = NULL; |
---|
| 1496 | return ret; |
---|
| 1497 | } |
---|
| 1498 | |
---|
[36122] | 1499 | #endif |
---|