Merge branch 'develop' into feature/stream
Conflicts: composer.json composer.lock
This commit is contained in:
commit
14116168af
7 changed files with 84 additions and 55 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,7 +6,7 @@ vendor/
|
|||
templates_c/
|
||||
ffmpeg.tar.xz
|
||||
ffmpeg-*/
|
||||
alltube-release.zip
|
||||
alltube-*.zip
|
||||
coverage/
|
||||
bower_components/
|
||||
config.yml
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM php:apache
|
||||
FROM php:5.6-apache
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y libicu-dev xz-utils git zlib1g-dev python npm nodejs-legacy
|
||||
RUN docker-php-ext-install mbstring
|
||||
|
|
10
Gruntfile.js
10
Gruntfile.js
|
@ -3,6 +3,11 @@ module.exports = function (grunt) {
|
|||
'use strict';
|
||||
grunt.initConfig(
|
||||
{
|
||||
githash: {
|
||||
main: {
|
||||
options: {}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
combine: {
|
||||
files: {
|
||||
|
@ -52,7 +57,7 @@ module.exports = function (grunt) {
|
|||
compress: {
|
||||
release: {
|
||||
options: {
|
||||
archive: 'alltube-release.zip'
|
||||
archive: 'alltube-<%= githash.main.tag %>.zip'
|
||||
},
|
||||
src: ['*.php', '!config.yml', 'dist/**', 'fonts/**', '.htaccess', 'img/**', 'js/**', 'LICENSE', 'README.md', 'robots.txt', 'sitemap.xml', 'templates/**', 'templates_c/', 'vendor/**', 'classes/**', 'controllers/**', 'bower_components/**', '!vendor/ffmpeg/**', '!vendor/bin/ffmpeg']
|
||||
}
|
||||
|
@ -60,6 +65,7 @@ module.exports = function (grunt) {
|
|||
}
|
||||
);
|
||||
|
||||
grunt.loadNpmTasks('grunt-githash');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
|
@ -70,5 +76,5 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('default', ['uglify', 'cssmin']);
|
||||
grunt.registerTask('lint', ['phpcs']);
|
||||
grunt.registerTask('test', ['phpunit']);
|
||||
grunt.registerTask('release', ['default', 'compress']);
|
||||
grunt.registerTask('release', ['default', 'githash', 'compress']);
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"type": "project",
|
||||
"require": {
|
||||
"smarty/smarty": "~3.1.29",
|
||||
"rg3/youtube-dl": "2016.04.06",
|
||||
"rg3/youtube-dl": "2016.04.13",
|
||||
"slim/slim": "3.x-dev",
|
||||
"mathmarques/smarty-view": "~1.1.0",
|
||||
"symfony/yaml": "~3.0.0",
|
||||
|
@ -15,7 +15,8 @@
|
|||
"ffmpeg/ffmpeg": "dev-release",
|
||||
"rudloff/smarty-plugin-noscheme": "~0.1.0",
|
||||
"guzzlehttp/guzzle": "~6.2.0",
|
||||
"rudloff/rtmpdump-bin": "~2.3"
|
||||
"rudloff/rtmpdump-bin": "~2.3",
|
||||
"rudloff/psr7-process-stream": "~0.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "~3.0.0"
|
||||
|
@ -31,11 +32,11 @@
|
|||
"type": "package",
|
||||
"package": {
|
||||
"name": "rg3/youtube-dl",
|
||||
"version": "2016.04.06",
|
||||
"version": "2016.04.13",
|
||||
"source": {
|
||||
"url": "https://github.com/rg3/youtube-dl.git",
|
||||
"type": "git",
|
||||
"reference": "2016.04.06"
|
||||
"reference": "9e285387260a019d7471c3bdbd52cc764c0e8700"
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
|
59
composer.lock
generated
59
composer.lock
generated
|
@ -4,8 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "411e020d026dab32ecc2bb6c2c059f22",
|
||||
"content-hash": "1442dea55dfe2b876dd29d0af142ec28",
|
||||
"hash": "962f54d3ada96f7d3289479b13812c1a",
|
||||
"content-hash": "2dea64564c520577cb275f73d046ed75",
|
||||
"packages": [
|
||||
{
|
||||
"name": "container-interop/container-interop",
|
||||
|
@ -163,16 +163,16 @@
|
|||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.2.3",
|
||||
"version": "1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b"
|
||||
"reference": "31382fef2889136415751badebbd1cb022a4ed72"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b",
|
||||
"reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72",
|
||||
"reference": "31382fef2889136415751badebbd1cb022a4ed72",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -217,7 +217,7 @@
|
|||
"stream",
|
||||
"uri"
|
||||
],
|
||||
"time": "2016-02-18 21:54:00"
|
||||
"time": "2016-04-13 19:56:01"
|
||||
},
|
||||
{
|
||||
"name": "jeremykendall/php-domain-parser",
|
||||
|
@ -571,14 +571,47 @@
|
|||
},
|
||||
{
|
||||
"name": "rg3/youtube-dl",
|
||||
"version": "2016.04.06",
|
||||
"version": "2016.04.13",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rg3/youtube-dl.git",
|
||||
"reference": "2016.04.06"
|
||||
"reference": "9e285387260a019d7471c3bdbd52cc764c0e8700"
|
||||
},
|
||||
"type": "library"
|
||||
},
|
||||
{
|
||||
"name": "rudloff/psr7-process-stream",
|
||||
"version": "0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Rudloff/psr7-process-stream.git",
|
||||
"reference": "055ecbdadee9b43904aed75d5a548c277cac10a8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Rudloff/psr7-process-stream/zipball/055ecbdadee9b43904aed75d5a548c277cac10a8",
|
||||
"reference": "055ecbdadee9b43904aed75d5a548c277cac10a8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/psr7": "~1.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "~3.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ProcessStream\\": "classes/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-3.0"
|
||||
],
|
||||
"description": "PSR-7 stream implementation that can be used to manage processes",
|
||||
"time": "2016-04-14 10:36:10"
|
||||
},
|
||||
{
|
||||
"name": "rudloff/rtmpdump-bin",
|
||||
"version": "2.3",
|
||||
|
@ -654,12 +687,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slimphp/Slim.git",
|
||||
"reference": "a810d837adc0e5cf7fba72815a6213fe50e15cc8"
|
||||
"reference": "b2e82a75467c12d94f038d433363e4aa7e8bf603"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/a810d837adc0e5cf7fba72815a6213fe50e15cc8",
|
||||
"reference": "a810d837adc0e5cf7fba72815a6213fe50e15cc8",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/b2e82a75467c12d94f038d433363e4aa7e8bf603",
|
||||
"reference": "b2e82a75467c12d94f038d433363e4aa7e8bf603",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -713,7 +746,7 @@
|
|||
"micro",
|
||||
"router"
|
||||
],
|
||||
"time": "2016-04-13 08:33:19"
|
||||
"time": "2016-04-14 09:05:11"
|
||||
},
|
||||
{
|
||||
"name": "smarty/smarty",
|
||||
|
|
|
@ -16,6 +16,7 @@ use Alltube\VideoDownload;
|
|||
use Alltube\Config;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
use Chain\Chain;
|
||||
use ProcessStream\PopenStream;
|
||||
|
||||
/**
|
||||
* Main controller
|
||||
|
@ -135,6 +136,21 @@ class FrontController
|
|||
'user_agent',
|
||||
$video->http_headers->{'User-Agent'}
|
||||
);
|
||||
|
||||
$response = $response->withHeader(
|
||||
'Content-Disposition',
|
||||
'attachment; filename="'.
|
||||
html_entity_decode(
|
||||
pathinfo(
|
||||
$video->_filename,
|
||||
PATHINFO_FILENAME
|
||||
).'.mp3',
|
||||
ENT_COMPAT,
|
||||
'ISO-8859-1'
|
||||
).'"'
|
||||
);
|
||||
$response = $response->withHeader('Content-Type', 'audio/mpeg');
|
||||
|
||||
if (parse_url($video->url, PHP_URL_SCHEME) == 'rtmp') {
|
||||
$builder = new ProcessBuilder(
|
||||
array(
|
||||
|
@ -163,51 +179,23 @@ class FrontController
|
|||
}
|
||||
$chain = new Chain($builder->getProcess());
|
||||
$chain->add('|', $avconvProc);
|
||||
ob_end_flush();
|
||||
header(
|
||||
'Content-Disposition: attachment; filename="'.
|
||||
html_entity_decode(
|
||||
pathinfo(
|
||||
$video->_filename,
|
||||
PATHINFO_FILENAME
|
||||
).'.mp3',
|
||||
ENT_COMPAT,
|
||||
'ISO-8859-1'
|
||||
).'"'
|
||||
);
|
||||
header("Content-Type: audio/mpeg");
|
||||
passthru($chain->getProcess()->getCommandLine());
|
||||
exit;
|
||||
} else {
|
||||
$chain = new Chain(
|
||||
ProcessBuilder::create(
|
||||
array_merge(
|
||||
array('curl'),
|
||||
$this->config->curl_params,
|
||||
array(
|
||||
'curl',
|
||||
'--silent',
|
||||
'--user-agent', $video->http_headers->{'User-Agent'},
|
||||
$video->url
|
||||
)
|
||||
),
|
||||
$this->config->curl_params
|
||||
)
|
||||
)
|
||||
);
|
||||
$chain->add('|', $avconvProc);
|
||||
ob_end_flush();
|
||||
header(
|
||||
'Content-Disposition: attachment; filename="'.
|
||||
html_entity_decode(
|
||||
pathinfo(
|
||||
$video->_filename,
|
||||
PATHINFO_FILENAME
|
||||
).'.mp3',
|
||||
ENT_COMPAT,
|
||||
'ISO-8859-1'
|
||||
).'"'
|
||||
);
|
||||
header("Content-Type: audio/mpeg");
|
||||
passthru($chain->getProcess()->getCommandLine());
|
||||
exit;
|
||||
}
|
||||
return $response->withBody(new PopenStream($chain->getProcess()->getCommandLine()));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
"grunt-phpcs": "~0.4.0",
|
||||
"grunt-phpunit": "~0.3.6",
|
||||
"grunt-contrib-compress": "~1.2.0",
|
||||
"bower": "~1.7.1"
|
||||
"bower": "~1.7.1",
|
||||
"grunt-githash": "~0.1.3"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Loading…
Reference in a new issue