Changeset 41291
- Timestamp:
- 11/25/17 22:29:13 (6 years ago)
- Location:
- titan
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/mediathek/localhoster/hoster.sh
r41279 r41291 9 9 10 10 #FILENAME="`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'` $INPUT $PAGE $NEXT" 11 FILENAME="`echo $INPUT | sed -e 's/\&\+/./g' -e 's#\/\+#.#g' -e 's/\?\+/./g' -e 's/ ;\+/./g' -e 's/=\+/./g' -e 's/ \+/./g' -e 's/\.\+/./g'`"11 FILENAME="`echo $INPUT | sed -e 's/\&\+/./g' -e 's#\/\+#.#g' -e 's/\?\+/./g' -e 's/:\+/./g' -e 's/;\+/./g' -e 's/=\+/./g' -e 's/ \+/./g' -e 's/\.\+/./g'`" 12 12 PICNAME=`echo $FILENAME` 13 13 … … 15 15 FILENAME=none 16 16 fi 17 17 18 18 19 ARCH=`cat /etc/.arch` … … 20 21 TMP=/tmp/localcache 21 22 CMD=/tmp/localhoster 23 BIN="$CMD"/bin/python."$ARCH" 24 HLSBIN="$CMD"/bin/hlsdl."$ARCH" 22 25 #USERAGENT='Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0' 23 26 USERAGENT='Mozilla%2F5.0+%28Windows+NT+6.3%3B+rv%3A36.0%29+Gecko%2F20100101+Firefox%2F36.0' … … 27 30 youtubebin="$CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent $USERAGENT --format mp4 --restrict-filenames --ignore-errors -g" 28 31 youtubebinbg="$CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent $USERAGENT --format mp4 --restrict-filenames --ignore-errors --output" 32 hlsdlbg="$HLSBIN -u $USERAGENT -o" 33 29 34 export PYTHONHOME=/tmp/localhoster 30 35 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/localhoster/lib … … 36 41 37 42 wgetbin="wget -q -T2" 38 39 BIN="$CMD"/bin/python."$ARCH"40 43 41 44 if [ ! -e "/tmp/localhoster/lib/python2.7/lib-dynload" ] && [ -e /tmp/localhoster/lib/python2.7/lib-dynload."$ARCH" ];then … … 321 324 # $BIN $CMD/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent "$USERAGENT" --format mp4 --restrict-filenames --ignore-errors -g "$INPUT" > /tmp/youtube_dl.streamlink.log 2>&1 322 325 # cat /tmp/youtube_dl.streamlink.log | tail -n1 323 $BIN $youtubebin "$INPUT" 326 mkdir $TMP > /dev/null 2>&1 327 328 echo "$BIN $youtubebin $INPUT" > /tmp/.last_hoster_youtube_dl.log 329 330 $BIN $youtubebin "$INPUT" > $TMP/$TYPE.$hoster.$FILENAME.streamlist 331 echo $TMP/$TYPE.$hoster.$FILENAME.streamlist 324 332 } 325 333 … … 330 338 # echo "$URL" >> /tmp/.last_hoster_youtube_dlbg.log 331 339 # echo $URL 332 $BIN $youtubebinbg $DEST $INPUT 333 } 340 mkdir $TMP > /dev/null 2>&1 341 342 echo "$BIN $youtubebinbg $DEST $INPUT" > /tmp/.last_hoster_$TYPE.log 343 $BIN $youtubebinbg "$DEST" "$INPUT" >> /tmp/.last_hoster_$TYPE.log 344 # echo $TMP/$TYPE.$hoster.$FILENAME.streamlist 345 } 346 347 hlsdl() 348 { 349 mkdir $TMP > /dev/null 2>&1 350 351 echo "$HLSBIN $hlsdlbg $DEST $INPUT" > /tmp/.last_hoster_$TYPE.log 352 353 REFERER=$(echo "$INPUT" | sed -nr 's/.*Referer=([^=]+)&.*/\1/p') 354 if [ -z "$REFERER" ];then 355 REFERER=$(echo "$INPUT" | sed -nr 's/.*Referer=([^=]+).*/\1/p') 356 fi 357 358 if [ ! -z "$REFERER" ];then 359 REFERER="Referer: $REFERER" 360 fi 361 362 TMPUSERAGENT=$(echo "$INPUT" | sed -nr 's/.*User-Agent=([^=]+)&.*/\1/p') 363 if [ -z "$TMPUSERAGENT" ];then 364 TMPUSERAGENT=$(echo "$INPUT" | sed -nr 's/.*User-Agent=([^=]+).*/\1/p') 365 fi 366 if [ ! -z "$TMPUSERAGENT" ];then 367 USERAGENT=$TMPUSERAGENT 368 fi 369 370 URL=$(echo "$INPUT" | tr '|' '\n' | head -n1) 371 372 echo $HLSBIN "$URL" -v -f -u "$USERAGENT" -h "$REFERER" -o "$DEST" >> /tmp/.last_hoster_$TYPE.log 373 $HLSBIN "$URL" -v -f -u "$USERAGENT" -h "$REFERER" -o "$DEST" >> /tmp/.last_hoster_$TYPE.log 374 # $HLSBIN "$URL" -v -u "$USERA" -h "$REFERER" -o "$DEST" >> /tmp/.last_hoster_$TYPE.log 375 376 } 377 334 378 335 379 if [ "$TYPE" == "get" ];then … … 381 425 fi 382 426 427 if [ "$TYPE" == "hlsdl" ];then 428 echo "$INPUT" > /tmp/.last_hoster_$TYPE_$hoster.log 429 case $hoster in 430 *) hlsdl $INPUT;; 431 esac 432 fi -
titan/plugins/tithek/tithek.c
r40900 r41291 117 117 python = 0; 118 118 ytbgdownload = 0; 119 hlsbgdownload = 0; 119 120 120 121 //change markcolor -
titan/plugins/tithek/tithek.h
r41274 r41291 15 15 int python = 0; 16 16 int ytbgdownload = 0; 17 int hlsbgdownload = 0; 17 18 18 19 //flag 0 - menu … … 1463 1464 } 1464 1465 1466 void backgroundhlsdl(char* link, char* filename) 1467 { 1468 int ret = 0; 1469 char *file = NULL, *cmd = NULL; 1470 1471 file = ostrcat(getconfig("rec_streampath", NULL), "/", 0, 0); 1472 file = ostrcat(file, filename, 1, 0); 1473 1474 cmd = ostrcat("/tmp/localhoster/hoster.sh hlsdl \"", link, 0, 0); 1475 cmd = ostrcat(cmd, "\" \"", 1, 0); 1476 cmd = ostrcat(cmd, file, 1, 0); 1477 cmd = ostrcat(cmd, "\" &", 1, 0); 1478 1479 printf("cmd: %s\n", cmd); 1480 ret = system(cmd); 1481 free(cmd), cmd = NULL; 1482 if(ret == 1) 1483 textbox(_("Message"), _("Can't start download.\nPlease try later."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); 1484 else 1485 hlsbgdownload = 1; 1486 } 1487 1465 1488 void backgrounddl(char* link, char* filename) 1466 1489 { … … 1525 1548 { 1526 1549 int flag = 0; 1550 int debuglevel = getconfigint("debuglevel", NULL); 1527 1551 char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL; 1528 1552 drawscreen(load, 0, 0); … … 1630 1654 free(tmpstr); tmpstr = NULL; 1631 1655 free(tmpstr2); tmpstr2 = NULL; 1656 1657 debug(10, "Streamurl check: %s", tmpstr1); 1658 debug(99, "Streamurl check: %s", tmpstr1); 1659 tmpstr = ostrcat(tmpstr1, NULL, 0, 0); 1660 tmpstr1 = list_hoster_streams(tmpstr); 1661 if(ostrcmp(tmpstr, tmpstr1) != 0) 1662 { 1663 debug(10, "Streamurl changed to: %s", tmpstr1); 1664 debug(99, "Streamurl changed to: %s", tmpstr1); 1665 } 1666 else 1667 { 1668 debug(10, "Streamurl check ok: %s", tmpstr1); 1669 debug(99, "Streamurl check ok: %s", tmpstr1); 1670 } 1671 1672 free(tmpstr), tmpstr = NULL; 1632 1673 1633 1674 if(ostrstr(title, "Internet Radio") != NULL) … … 1751 1792 } 1752 1793 1794 if(python == 1 && ostrstr(tmpstr1, "hls") != NULL && file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))) 1795 addmenulist(&mlist, "Download Full File (hlsdl)", _("Download Full File (hlsdl)"), NULL, 0, 0); 1796 1753 1797 if(python == 1 && file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))) 1754 addmenulist(&mlist, "Download via Youtube_DL (background)", _("Download Full File (youtube_dl)"), NULL, 0, 0); 1798 addmenulist(&mlist, "Download Full File (youtube_dl)", _("Download Full File (youtube_dl)"), NULL, 0, 0); 1799 1755 1800 } 1756 1801 } … … 1850 1895 free(search), search = NULL; 1851 1896 } 1852 else if(ostrcmp(keyconf, "Download via Youtube_DL (background)") == 0)1897 else if(ostrcmp(keyconf, "Download Full File (youtube_dl)") == 0) 1853 1898 { 1854 1899 char* search = textinput(_("Filename"), filename); 1855 1900 if(search != NULL) 1856 1901 backgroundytdl(tmpstr1, search); 1902 free(search), search = NULL; 1903 } 1904 else if(ostrcmp(keyconf, "Download Full File (hlsdl)") == 0) 1905 { 1906 char* search = textinput(_("Filename"), filename); 1907 if(search != NULL) 1908 backgroundhlsdl(tmpstr1, search); 1857 1909 free(search), search = NULL; 1858 1910 } … … 2675 2727 freetithek(); 2676 2728 delallfiles("/tmp/tithek", NULL); 2677 if(ytbgdownload == 0 )2729 if(ytbgdownload == 0 && hlsbgdownload == 0) 2678 2730 system("rm -rf /tmp/localhoster"); 2679 2731 system("rm -rf /tmp/localparser"); -
titan/plugins/tithek/tithek_global.h
r41288 r41291 7 7 { 8 8 debug(99, "url: %s", url); 9 int debuglevel = getconfigint("debuglevel", NULL);10 9 char* streamurl = NULL, *tmplink = NULL, *tmpstr = NULL; 11 10 struct skin* load = getscreen("loading"); … … 218 217 } 219 218 220 debug(99, "Streamurl 5: %s", streamurl);219 debug(99, "Streamurl1: %s", streamurl); 221 220 222 221 streamurl = string_replace_all("amp;", "", streamurl, 1); 223 debug(99, "Streamurl 6: %s", streamurl);222 debug(99, "Streamurl4: %s", streamurl); 224 223 225 224 free(tmplink), tmplink = NULL; 226 free(tmpstr), tmpstr = NULL;227 228 // printf("streamurl1: %s\n", streamurl);229 if(debuglevel != 99)230 printf("Streamurl1: %s\n", streamurl);231 tmpstr = ostrcat(streamurl, NULL, 0, 0);232 streamurl = list_hoster_streams(tmpstr);233 if(debuglevel != 99)234 printf("Streamurl2: %s\n", streamurl);235 debug(99, "Streamurl7: %s", streamurl);236 237 free(tmpstr), tmpstr = NULL;238 239 225 /* 240 226 if(ostrncmp("http", streamurl, 4) && ostrncmp("rtmp", streamurl, 4) && ostrncmp("mms", streamurl, 3) && ostrncmp("rtsp", streamurl, 4)) … … 1312 1298 } 1313 1299 1314 char* list_hoster_streams(char* filename)1300 char* list_hoster_streams(char* input) 1315 1301 { 1302 char* streamurl = NULL, *tmpstr = NULL, *nummer = NULL, *title = NULL, *pic = NULL, *filename = NULL; 1303 1304 int count = 0, i = 0; 1305 1306 filename = ostrcat(input, NULL, 0, 0); 1316 1307 1317 1308 if(ostrncmp("/tmp/", filename, 5) && ostrncmp("/mnt/", filename, 5)) 1318 1309 return filename; 1319 1320 // int debuglevel = getconfigint("debuglevel", NULL); 1321 char* streamurl = NULL, *tmpstr = NULL, *nummer = NULL, *title = NULL, *pic = NULL;1322 1323 int count = 0, i = 0;1310 else 1311 { 1312 debug(10, "Streamfile found: %s", input); 1313 debug(99, "Streamfile found: %s", input); 1314 } 1324 1315 1325 1316 // tmpstr = ostrcat(link, NULL, 0, 0); … … 1404 1395 } 1405 1396 free(tmpstr); tmpstr = NULL; 1406 debug(99, "streamurl3 %s", streamurl); 1397 1407 1398 if(streamurl == NULL) 1399 { 1400 debug(10, "Streamfile choice canceld by USER set Streamurl to skip"); 1401 debug(99, "Streamfile choice canceld by USER set Streamurl to skip"); 1402 1408 1403 streamurl = ostrcat("skip", NULL, 0, 0); 1409 debug(99, "streamurl4 %s", streamurl); 1404 } 1410 1405 1411 1406 return streamurl; … … 1415 1410 { 1416 1411 debug(99, "link: %s", link); 1417 int debuglevel = getconfigint("debuglevel", NULL); 1418 int ret = 1, skip = 0; 1412 int ret = 1; 1419 1413 char* tmpstr = NULL, *streamurl = NULL; 1420 1414 … … 1427 1421 tmpstr = string_replace_all("gethoster2 ", "", tmpstr, 1); 1428 1422 streamurl = hoster(tmpstr); 1429 skip = 1;1430 1423 } 1431 1424 else if(ostrstr(link, ".sh play ") != NULL) 1432 1425 streamurl = ostrcat(tmpstr, NULL, 0, 0); 1433 1426 else if(ostrstr(link, ".sh hoster ") != NULL) 1434 {1435 1427 streamurl = hoster(tmpstr); 1436 skip = 1; 1437 } 1428 1438 1429 free(tmpstr), tmpstr = NULL; 1439 1440 if(skip == 0)1441 {1442 if(debuglevel != 99)1443 printf("Streamurl1: %s\n", streamurl);1444 tmpstr = ostrcat(streamurl, NULL, 0, 0);1445 streamurl = list_hoster_streams(tmpstr);1446 if(debuglevel != 99)1447 printf("Streamurl2: %s\n", streamurl);1448 free(tmpstr), tmpstr = NULL;1449 }1450 debug(99, "streamurl2: %s", streamurl);1451 1452 1430 return streamurl; 1453 1431 } -
titan/plugins/tithek/tithek_header.h
r41274 r41291 13 13 char* localparser_hoster(char* link); 14 14 int localparser_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag); 15 char* list_hoster_streams(char* link);15 char* list_hoster_streams(char* input); 16 16 17 17 void titheklog(int debuglevel, char* name1, char* name2, char* name3, char* name4, char* content)
Note: See TracChangeset
for help on using the changeset viewer.