From f4c4a9791a90c51b1699d5d178199318a2ca2a85 Mon Sep 17 00:00:00 2001 From: moehm Date: Sun, 14 Sep 2014 21:29:39 +0200 Subject: removed limit for downloads + blocks double audio extracting --- config.php | 3 ++- dl.php | 5 ++++- func.php | 7 ++++++- index.php | 4 +++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/config.php b/config.php index 56b3e2e..db92fc9 100644 --- a/config.php +++ b/config.php @@ -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"); diff --git a/dl.php b/dl.php index a3cdcdd..ba35a1d 100644 --- a/dl.php +++ b/dl.php @@ -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); diff --git a/func.php b/func.php index 6ad7894..3c6adb7 100644 --- a/func.php +++ b/func.php @@ -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); diff --git a/index.php b/index.php index e890577..9cad5db 100644 --- a/index.php +++ b/index.php @@ -27,7 +27,9 @@
Paste a link from youtube, vimeo or other supported video plattforms.
- Stream the video, extract the audio or download it direct to the disk!
(up to 50M for download or 200M for streaming)