diff options
| author | moehm | 2014-09-14 21:29:39 +0200 |
|---|---|---|
| committer | moehm | 2014-09-14 21:29:39 +0200 |
| commit | f4c4a9791a90c51b1699d5d178199318a2ca2a85 (patch) | |
| tree | ab0b0de6ec10cc9baa4cd31875a7fba1e1b24610 | |
| parent | 1eba482c5172a92432c13e04480cb1604bef6df0 (diff) | |
| download | video-dl-f4c4a9791a90c51b1699d5d178199318a2ca2a85.tar.gz | |
removed limit for downloads + blocks double audio extracting
| -rw-r--r-- | config.php | 3 | ||||
| -rw-r--r-- | dl.php | 5 | ||||
| -rw-r--r-- | func.php | 7 | ||||
| -rw-r--r-- | index.php | 4 |
4 files changed, 15 insertions, 4 deletions
@@ -7,7 +7,8 @@ $ABSCACHEDIR = $ABSPATH . "/" . $CACHEDIR; $REDIS_DBNAME=0; $REDIS_CONNECT="/var/run/redis/redis.sock"; -$MAXSIZE = 500000000000; +//$MAXSIZE = 500000000000; +$MAXSIZE= 2000000000000; $STREAM_MAXSIZE = 200000000; //$db = new SQLite3($ABSPATH . "/db/sqlite.db"); @@ -81,6 +81,7 @@ switch($_GET["task"]){ break; case("xtau"): /* extracting audio */ + ignore_user_abort(true); # get file information exec("youtube-dl -x --get-filename --output ".escapeshellarg($CACHEDIR."/".$info[2].".%(ext)s") . " ".escapeshellarg($info[0]), $output, $ret); if($ret != 0) @@ -89,10 +90,12 @@ switch($_GET["task"]){ # file name with correct extension, but cache dir at first $file = $output[0]; - if(!file_exists($file)){ + if(!file_exists($file) || !file_exists($CACHEDIR."/".$info[2].".audio.txt")){ $ret = video_xt_audio($info[0], $CACHEDIR, $info[2]); if(!$ret) failure("Fetching the video failed.", true); + else + unlink($CACHEDIR."/".$info[2].".audio.txt"); } $finfo = new finfo(FILEINFO_MIME_TYPE); @@ -39,7 +39,7 @@ function vid_info($url){ function video_dl($VIDEO, $CACHEDIR, $FILENAME){ $fp=fopen($CACHEDIR."/".$FILENAME.".txt", "w"); - $content="downloading ".$FILENAME."\n"; + $content="downloading: ".$FILENAME."\n"; fputs($fp, $content); fclose($fp); exec("youtube-dl --no-part --output '".$CACHEDIR."/".$FILENAME."' '$VIDEO'", $pid, $ret); @@ -52,6 +52,11 @@ function video_dl($VIDEO, $CACHEDIR, $FILENAME){ function video_xt_audio($VIDEO, $CACHEDIR, $FILENAME){ + $fp=fopen($CACHEDIR."/".$FILENAME.".audio.txt", "w"); + $content="extracting audio: ".$FILENAME."\n"; + fputs($fp, $content); + fclose($fp); + //exec("youtube-dl --no-part -x --output '".escapeshellarg($CACHEDIR."/".$FILENAME.".%(ext)s' " .escapeshellarg($VIDEO), $pid, $ret); exec("youtube-dl --no-part -x --output ".escapeshellarg($CACHEDIR."/".$FILENAME.".%(ext)s")." " .escapeshellarg($VIDEO), $pid, $ret); // echo "youtube-dl --no-part -x --output ".escapeshellarg($CACHEDIR."/".$FILENAME.".%(ext)s")." " .escapeshellarg($VIDEO); //, $pid, $ret); @@ -27,7 +27,9 @@ </div> <div class="row"> <p>Paste a link from youtube, vimeo or other <a href="/faq#supported_plattforms" title="FAQ: Supported plattforms">supported</a> video plattforms.<br> - Stream the video, extract the audio or download it direct to the disk! <br><i>(up to <strong>50M</strong> for download or <strong>200M</strong> for streaming)</i></p> + Stream the video, extract the audio or download it direct to the disk! <br> + <?php //<br> <i>(up to <strong>50M</strong> for download or <strong>200M</strong> for streaming)</i></p> ?> + <i>(up to <strong>200M</strong>)</i></p> <form method='POST' action='/video'> <input type='text' name='vid' placeholder='https://www.youtube.com/watch?v=sTSA_sWGM44' style="color:#5b5b5b;" onclick="this.value=''"> <br><br> |
