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