Merge branch 'develop' into feature/stream

Conflicts:
	composer.json
	composer.lock
	controllers/FrontController.php
This commit is contained in:
Pierre Rudloff 2016-07-27 02:31:47 +02:00
commit aba3d0c9f5
17 changed files with 283 additions and 255 deletions

View File

@ -41,7 +41,9 @@ module.exports = function (grunt) {
},
tests: {
src: ['tests/*.php']
},
}
},
jslint: {
js: {
src: ['js/*.js']
},
@ -72,9 +74,10 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-phpcs');
grunt.loadNpmTasks('grunt-phpunit');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-jslint');
grunt.registerTask('default', ['uglify', 'cssmin']);
grunt.registerTask('lint', ['phpcs']);
grunt.registerTask('lint', ['phpcs', 'jslint']);
grunt.registerTask('test', ['phpunit']);
grunt.registerTask('release', ['default', 'githash', 'compress']);
};

View File

@ -6,6 +6,13 @@ HTML GUI for youtube-dl (http://alltubedownload.net/)
![Screenshot](img/screenshot.png "Alltube GUI screenshot")
##Setup
### From a release package
You can download the latest release package [here](https://github.com/Rudloff/alltube/releases).
You just have to unzip it on your server and it should be ready to use.
### From Git
In order to get AllTube working, you need to use [npm](https://www.npmjs.com/) and [Composer](https://getcomposer.org/):
npm install
@ -89,11 +96,11 @@ This software is available under the [GNU General Public License](http://www.gnu
__Please use a different name and logo if you run it on a public server.__
##Other dependencies
You need [avconv](https://libav.org/avconv.html) and [rtmpdump](http://rtmpdump.mplayerhq.hu/) in order to enable conversions.
You need [avconv](https://libav.org/avconv.html), [rtmpdump](http://rtmpdump.mplayerhq.hu/) and [curl](https://curl.haxx.se/) in order to enable conversions.
If you don't want to enable conversions, you can disable it in *config.yml*.
On Debian-based systems:
sudo apt-get install libav-tools rtmpdump
sudo apt-get install libav-tools rtmpdump curl
You also probably need to edit the *avconv* variable in *config.yml* so that it points to your ffmpeg/avconv binary (*/usr/bin/avconv* on Debian/Ubuntu).

View File

@ -6,11 +6,11 @@
"type": "project",
"require": {
"smarty/smarty": "~3.1.29",
"rg3/youtube-dl": "2016.04.13",
"slim/slim": "3.x-dev",
"rg3/youtube-dl": "~2016.07.26",
"slim/slim": "~3.5.0",
"mathmarques/smarty-view": "~1.1.0",
"symfony/yaml": "~3.0.0",
"symfony/process": "~3.0.0",
"symfony/yaml": "~3.1.0",
"symfony/process": "~3.1.0",
"ptachoire/process-builder-chain": "~1.2.0",
"ffmpeg/ffmpeg": "dev-release",
"rudloff/smarty-plugin-noscheme": "~0.1.0",
@ -19,7 +19,7 @@
"rudloff/psr7-process-stream": "~0.1.0"
},
"require-dev": {
"symfony/var-dumper": "~3.0.0"
"symfony/var-dumper": "~3.1.0"
},
"extra": {
"paas": {
@ -32,11 +32,11 @@
"type": "package",
"package": {
"name": "rg3/youtube-dl",
"version": "2016.04.13",
"version": "2016.07.26",
"source": {
"url": "https://github.com/rg3/youtube-dl.git",
"type": "git",
"reference": "9e285387260a019d7471c3bdbd52cc764c0e8700"
"reference": "2016.07.26"
}
}
}, {

124
composer.lock generated
View File

@ -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": "962f54d3ada96f7d3289479b13812c1a",
"content-hash": "2dea64564c520577cb275f73d046ed75",
"hash": "19bf8d61960475e79792cb0718198f21",
"content-hash": "de1c44fd5ca25ea1b71d0252d3b68cd7",
"packages": [
{
"name": "container-interop/container-interop",
@ -50,27 +50,27 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "6.2.0",
"version": "6.2.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "d094e337976dff9d8e2424e8485872194e768662"
"reference": "3f808fba627f2c5b69e2501217bf31af349c1427"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662",
"reference": "d094e337976dff9d8e2424e8485872194e768662",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427",
"reference": "3f808fba627f2c5b69e2501217bf31af349c1427",
"shasum": ""
},
"require": {
"guzzlehttp/promises": "~1.0",
"guzzlehttp/psr7": "~1.1",
"php": ">=5.5.0"
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.3.1",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
"phpunit/phpunit": "^4.0",
"psr/log": "^1.0"
},
"type": "library",
"extra": {
@ -108,20 +108,20 @@
"rest",
"web service"
],
"time": "2016-03-21 20:02:09"
"time": "2016-07-15 17:22:37"
},
{
"name": "guzzlehttp/promises",
"version": "1.1.0",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8"
"reference": "c10d860e2a9595f8883527fa0021c7da9e65f579"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/bb9024c526b22f3fe6ae55a561fd70653d470aa8",
"reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8",
"url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579",
"reference": "c10d860e2a9595f8883527fa0021c7da9e65f579",
"shasum": ""
},
"require": {
@ -159,20 +159,20 @@
"keywords": [
"promise"
],
"time": "2016-03-08 01:15:46"
"time": "2016-05-18 16:56:05"
},
{
"name": "guzzlehttp/psr7",
"version": "1.3.0",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "31382fef2889136415751badebbd1cb022a4ed72"
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72",
"reference": "31382fef2889136415751badebbd1cb022a4ed72",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
"reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
"shasum": ""
},
"require": {
@ -188,7 +188,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.4-dev"
}
},
"autoload": {
@ -217,7 +217,7 @@
"stream",
"uri"
],
"time": "2016-04-13 19:56:01"
"time": "2016-06-24 23:00:38"
},
{
"name": "jeremykendall/php-domain-parser",
@ -397,16 +397,16 @@
},
{
"name": "nikic/fast-route",
"version": "v0.6.0",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/FastRoute.git",
"reference": "31fa86924556b80735f98b294a7ffdfb26789f22"
"reference": "8ea928195fa9b907f0d6e48312d323c1a13cc2af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/31fa86924556b80735f98b294a7ffdfb26789f22",
"reference": "31fa86924556b80735f98b294a7ffdfb26789f22",
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/8ea928195fa9b907f0d6e48312d323c1a13cc2af",
"reference": "8ea928195fa9b907f0d6e48312d323c1a13cc2af",
"shasum": ""
},
"require": {
@ -436,7 +436,7 @@
"router",
"routing"
],
"time": "2015-06-18 19:15:47"
"time": "2016-06-12 19:08:51"
},
{
"name": "pimple/pimple",
@ -571,11 +571,11 @@
},
{
"name": "rg3/youtube-dl",
"version": "2016.04.13",
"version": "2016.07.26",
"source": {
"type": "git",
"url": "https://github.com/rg3/youtube-dl.git",
"reference": "9e285387260a019d7471c3bdbd52cc764c0e8700"
"reference": "2016.07.26"
},
"type": "library"
},
@ -683,25 +683,28 @@
},
{
"name": "slim/slim",
"version": "3.x-dev",
"version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim.git",
"reference": "b2e82a75467c12d94f038d433363e4aa7e8bf603"
"reference": "184352bc1913d7ba552ab4131d62f4730ddb0893"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/b2e82a75467c12d94f038d433363e4aa7e8bf603",
"reference": "b2e82a75467c12d94f038d433363e4aa7e8bf603",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/184352bc1913d7ba552ab4131d62f4730ddb0893",
"reference": "184352bc1913d7ba552ab4131d62f4730ddb0893",
"shasum": ""
},
"require": {
"container-interop/container-interop": "^1.1",
"nikic/fast-route": "^0.6",
"nikic/fast-route": "^1.0",
"php": ">=5.5.0",
"pimple/pimple": "^3.0",
"psr/http-message": "^1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0",
"squizlabs/php_codesniffer": "^2.5"
@ -746,7 +749,7 @@
"micro",
"router"
],
"time": "2016-04-14 09:05:11"
"time": "2016-07-26 15:12:13"
},
{
"name": "smarty/smarty",
@ -805,16 +808,16 @@
},
{
"name": "symfony/process",
"version": "v3.0.4",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "e6f1f98bbd355d209a992bfff45e7edfbd4a0776"
"reference": "5c11a1a4d4016662eeaf0f8757958c7de069f9a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/e6f1f98bbd355d209a992bfff45e7edfbd4a0776",
"reference": "e6f1f98bbd355d209a992bfff45e7edfbd4a0776",
"url": "https://api.github.com/repos/symfony/process/zipball/5c11a1a4d4016662eeaf0f8757958c7de069f9a0",
"reference": "5c11a1a4d4016662eeaf0f8757958c7de069f9a0",
"shasum": ""
},
"require": {
@ -823,7 +826,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "3.1-dev"
}
},
"autoload": {
@ -850,20 +853,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2016-03-30 10:41:14"
"time": "2016-06-29 05:42:25"
},
{
"name": "symfony/yaml",
"version": "v3.0.4",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "0047c8366744a16de7516622c5b7355336afae96"
"reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/0047c8366744a16de7516622c5b7355336afae96",
"reference": "0047c8366744a16de7516622c5b7355336afae96",
"url": "https://api.github.com/repos/symfony/yaml/zipball/2884c26ce4c1d61aebf423a8b912950fe7c764de",
"reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de",
"shasum": ""
},
"require": {
@ -872,7 +875,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "3.1-dev"
}
},
"autoload": {
@ -899,22 +902,22 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2016-03-04 07:55:57"
"time": "2016-06-29 05:41:56"
}
],
"packages-dev": [
{
"name": "symfony/polyfill-mbstring",
"version": "v1.1.1",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "1289d16209491b584839022f29257ad859b8532d"
"reference": "dff51f72b0706335131b00a7f49606168c582594"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d",
"reference": "1289d16209491b584839022f29257ad859b8532d",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594",
"reference": "dff51f72b0706335131b00a7f49606168c582594",
"shasum": ""
},
"require": {
@ -926,7 +929,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
"dev-master": "1.2-dev"
}
},
"autoload": {
@ -960,20 +963,20 @@
"portable",
"shim"
],
"time": "2016-01-20 09:13:37"
"time": "2016-05-18 14:26:46"
},
{
"name": "symfony/var-dumper",
"version": "v3.0.4",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "3841ed86527d18ee2c35fe4afb1b2fc60f8fae79"
"reference": "39492b8b8fe514163e677bf154fd80f6cc995759"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/3841ed86527d18ee2c35fe4afb1b2fc60f8fae79",
"reference": "3841ed86527d18ee2c35fe4afb1b2fc60f8fae79",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/39492b8b8fe514163e677bf154fd80f6cc995759",
"reference": "39492b8b8fe514163e677bf154fd80f6cc995759",
"shasum": ""
},
"require": {
@ -989,7 +992,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "3.1-dev"
}
},
"autoload": {
@ -1023,13 +1026,12 @@
"debug",
"dump"
],
"time": "2016-03-10 10:34:12"
"time": "2016-06-29 05:41:56"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"slim/slim": 20,
"ffmpeg/ffmpeg": 20
},
"prefer-stable": false,

View File

@ -16,7 +16,9 @@ use Alltube\VideoDownload;
use Alltube\Config;
use Symfony\Component\Process\ProcessBuilder;
use Chain\Chain;
use ProcessStream\PopenStream;
use Slim\Http\Stream;
use Slim\Http\Request;
use Slim\Http\Response;
/**
* Main controller
@ -31,10 +33,11 @@ use ProcessStream\PopenStream;
* */
class FrontController
{
public function __construct()
public function __construct($container)
{
$this->config = Config::getInstance();
$this->download = new VideoDownload();
$this->container = $container;
}
/**
@ -45,28 +48,28 @@ class FrontController
*
* @return void
*/
public function index($request, $response)
public function index(Request $request, Response $response)
{
global $container;
$container->view->render(
$this->container->view->render(
$response,
'head.tpl',
array(
'class'=>'index'
'class'=>'index',
'description'=>'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.'
)
);
$container->view->render(
$this->container->view->render(
$response,
'header.tpl'
);
$container->view->render(
$this->container->view->render(
$response,
'index.tpl',
array(
'convert'=>$this->config->convert
)
);
$container->view->render($response, 'footer.tpl');
$this->container->view->render($response, 'footer.tpl');
}
/**
@ -77,26 +80,28 @@ class FrontController
*
* @return void
*/
public function extractors($request, $response)
public function extractors(Request $request, Response $response)
{
global $container;
$container->view->render(
$this->container->view->render(
$response,
'head.tpl',
array(
'class'=>'extractors'
'class'=>'extractors',
'title'=>'Supported websites',
'description'
=>'List of all supported websites from which Alltube Download can extract video or audio files'
)
);
$container->view->render($response, 'header.tpl');
$container->view->render($response, 'logo.tpl');
$container->view->render(
$this->container->view->render($response, 'header.tpl');
$this->container->view->render($response, 'logo.tpl');
$this->container->view->render(
$response,
'extractors.tpl',
array(
'extractors'=>$this->download->listExtractors()
)
);
$container->view->render($response, 'footer.tpl');
$this->container->view->render($response, 'footer.tpl');
}
/**
@ -107,17 +112,20 @@ class FrontController
*
* @return void
*/
public function video($request, $response)
public function video(Request $request, Response $response)
{
global $container;
$params = $request->getQueryParams();
$this->config = Config::getInstance();
if (isset($params["url"])) {
if (isset($params['audio'])) {
try {
return $this->getStream($params["url"], 'bestaudio[protocol^=http]', $response, $request);
return $this->getStream($params["url"], 'mp3[protocol^=http]', $response, $request);
} catch (\Exception $e) {
$video = $this->download->getJSON($params["url"], 'best');
$video = $this->download->getJSON($params["url"], 'bestaudio/best');
if (!shell_exec('which '.$this->config->avconv)) {
throw(new \Exception('Can\'t find avconv or ffmpeg'));
}
$avconvProc = ProcessBuilder::create(
array(
@ -151,6 +159,9 @@ class FrontController
$response = $response->withHeader('Content-Type', 'audio/mpeg');
if (parse_url($video->url, PHP_URL_SCHEME) == 'rtmp') {
if (!shell_exec('which '.$this->config->rtmpdump)) {
throw(new \Exception('Can\'t find rtmpdump'));
}
$builder = new ProcessBuilder(
array(
$this->config->rtmpdump,
@ -179,6 +190,9 @@ class FrontController
$chain = new Chain($builder->getProcess());
$chain->add('|', $avconvProc);
} else {
if (!shell_exec('which curl')) {
throw(new \Exception('Can\'t find curl'));
}
$chain = new Chain(
ProcessBuilder::create(
array_merge(
@ -195,50 +209,54 @@ class FrontController
$chain->add('|', $avconvProc);
}
if ($request->isGet()) {
$response = $response->withBody(new PopenStream($chain->getProcess()->getCommandLine()));
$response = $response->withBody(new Stream(popen($chain->getProcess()->getCommandLine(), 'r')));
}
return $response;
}
} else {
$video = $this->download->getJSON($params["url"]);
$container->view->render(
$this->container->view->render(
$response,
'head.tpl',
array(
'class'=>'video'
'class'=>'video',
'title'=>$video->title,
'description'=>'Download "'.$video->title.'" from '.$video->extractor_key
)
);
$container->view->render(
$this->container->view->render(
$response,
'video.tpl',
array(
'video'=>$video
)
);
$container->view->render($response, 'footer.tpl');
$this->container->view->render($response, 'footer.tpl');
}
} else {
return $response->withRedirect($this->container->get('router')->pathFor('index'));
}
}
public function error($request, $response, $exception)
public function error(Request $request, Response $response, \Exception $exception)
{
global $container;
$container->view->render(
$this->container->view->render(
$response,
'head.tpl',
array(
'class'=>'video'
'class'=>'video',
'title'=>'Error'
)
);
$container->view->render(
$this->container->view->render(
$response,
'error.tpl',
array(
'errors'=>$exception->getMessage()
)
);
$container->view->render($response, 'footer.tpl');
return $response;
$this->container->view->render($response, 'footer.tpl');
return $response->withStatus(500);
}
private function getStream($url, $format, $response, $request)
@ -266,9 +284,8 @@ class FrontController
*
* @return void
*/
public function redirect($request, $response)
public function redirect(Request $request, Response $response)
{
global $app;
$params = $request->getQueryParams();
if (isset($params["url"])) {
try {
@ -288,9 +305,8 @@ class FrontController
*
* @return void
*/
public function json($request, $response)
public function json(Request $request, Response $response)
{
global $app;
$params = $request->getQueryParams();
if (isset($params["url"])) {
try {

View File

@ -570,6 +570,7 @@ h1 {
}
@media (max-width: 640px) {
.formats,
.thumb {
width:90%;
}
@ -657,3 +658,9 @@ h1 {
}
}
@media all and (display-mode: standalone) {
.bookmarklet_wrapper {
display: none;
}
}

View File

@ -1,5 +1,5 @@
<!Doctype HTML>
<html lang="en" itemscope itemtype="http://schema.org/WebApplication">
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@ -9,7 +9,7 @@
<body>
<div class="wrapper">
<div class="main">
<h1><img itemprop="image" class="logo" src="img/logo.png"
<h1><img class="logo" src="img/logo.png"
alt="AllTube Download" width="328" height="284"></h1>
<div>An error occurred in the application and your page could not be served. Please try again in a few moments.</div>
</div>

View File

@ -16,6 +16,11 @@ require_once __DIR__.'/vendor/autoload.php';
use Alltube\VideoDownload;
use Alltube\Controller\FrontController;
if (strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) {
header('Location: '.str_ireplace('/index.php', '/', $_SERVER['REQUEST_URI']));
die;
}
$app = new \Slim\App();
$container = $app->getContainer();
$container['view'] = function ($c) {
@ -28,14 +33,14 @@ $container['view'] = function ($c) {
return $view;
};
$controller = new FrontController();
$controller = new FrontController($container);
$container['errorHandler'] = array($controller, 'error');
$app->get(
'/',
array($controller, 'index')
);
)->setName('index');
$app->get(
'/extractors',
array($controller, 'extractors')

View File

@ -1,110 +1,106 @@
/*global chrome*/
/*jslint devel: true, browser: true */
var launchBtn, disabledBtn, stopBtn;
var session, currentMedia;
function receiverListener(e)
{
/*jslint browser: true, nomen: true */
var castModule = (function () {
'use strict';
console.log('receiverListener', e);
}
var launchBtn, disabledBtn, stopBtn, session;
function onMediaDiscovered(how, media)
{
'use strict';
console.log('onMediaDiscovered', how);
currentMedia = media;
if (launchBtn) {
stopBtn.classList.remove('cast_hidden');
launchBtn.classList.add('cast_hidden');
function receiverListener(e) {
return (e === chrome.cast.ReceiverAvailability.AVAILABLE);
}
}
function sessionListener(e)
{
'use strict';
session = e;
session.addMediaListener(onMediaDiscovered.bind(this, 'addMediaListener'));
if (session.media.length !== 0) {
onMediaDiscovered('onRequestSessionSuccess', session.media[0]);
function onMediaDiscovered() {
if (launchBtn) {
stopBtn.classList.remove('cast_hidden');
launchBtn.classList.add('cast_hidden');
}
}
}
function onStopCast()
{
'use strict';
stopBtn.classList.add('cast_hidden');
launchBtn.classList.remove('cast_hidden');
}
function stopCast()
{
'use strict';
session.stop(onStopCast);
}
function onMediaError()
{
'use strict';
console.log('onMediaError');
stopCast();
}
function onRequestSessionSuccess(e)
{
'use strict';
session = e;
var videoLink = document.getElementById('video_link'), videoURL = videoLink.dataset.video, mediaInfo = new chrome.cast.media.MediaInfo(videoURL, 'video/' + videoLink.dataset.ext), request = new chrome.cast.media.LoadRequest(mediaInfo);
session.loadMedia(request, onMediaDiscovered.bind(this, 'loadMedia'), onMediaError);
}
function onLaunchError(e)
{
'use strict';
console.log('onLaunchError', e.description);
}
function launchCast()
{
'use strict';
chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError);
}
function onInitSuccess()
{
'use strict';
launchBtn = document.getElementById('cast_btn_launch');
disabledBtn = document.getElementById('cast_disabled');
stopBtn = document.getElementById('cast_btn_stop');
if (launchBtn) {
disabledBtn.classList.add('cast_hidden');
function onStopCast() {
stopBtn.classList.add('cast_hidden');
launchBtn.classList.remove('cast_hidden');
launchBtn.addEventListener('click', launchCast, false);
stopBtn.addEventListener('click', stopCast, false);
}
}
function onError()
{
'use strict';
console.log('onError');
}
function initializeCastApi()
{
'use strict';
var sessionRequest = new chrome.cast.SessionRequest(chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID), apiConfig = new chrome.cast.ApiConfig(sessionRequest, sessionListener, receiverListener, chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED);
chrome.cast.initialize(apiConfig, onInitSuccess, onError);
}
function loadCastApi(loaded, errorInfo)
{
'use strict';
if (loaded) {
initializeCastApi();
} else {
console.log(errorInfo);
function onStopCastError(e) {
onStopCast();
throw e.description;
}
}
window['__onGCastApiAvailable'] = loadCastApi;
function updateListener() {
if (session.status !== chrome.cast.SessionStatus.CONNECTED) {
onStopCast();
}
}
function sessionListener(e) {
session = e;
session.addMediaListener(onMediaDiscovered.bind(this, 'addMediaListener'));
session.addUpdateListener(updateListener.bind(this));
if (session.media.length !== 0) {
onMediaDiscovered('onRequestSessionSuccess', session.media[0]);
}
}
function stopCast() {
session.stop(onStopCast, onStopCastError);
}
function onMediaError(e) {
stopCast();
throw e.description;
}
function onRequestSessionSuccess(e) {
session = e;
var videoLink = document.getElementById('video_link'), videoURL = videoLink.dataset.video, mediaInfo = new chrome.cast.media.MediaInfo(videoURL, 'video/' + videoLink.dataset.ext), request = new chrome.cast.media.LoadRequest(mediaInfo);
session.loadMedia(request, onMediaDiscovered.bind(this, 'loadMedia'), onMediaError);
}
function onLaunchError(e) {
throw e.description;
}
function launchCast() {
chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError);
}
function onInitSuccess() {
launchBtn = document.getElementById('cast_btn_launch');
disabledBtn = document.getElementById('cast_disabled');
stopBtn = document.getElementById('cast_btn_stop');
if (launchBtn) {
disabledBtn.classList.add('cast_hidden');
launchBtn.classList.remove('cast_hidden');
launchBtn.addEventListener('click', launchCast, false);
stopBtn.addEventListener('click', stopCast, false);
}
}
function onError(e) {
throw e.code;
}
function initializeCastApi() {
var sessionRequest = new chrome.cast.SessionRequest(chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID), apiConfig = new chrome.cast.ApiConfig(sessionRequest, sessionListener, receiverListener, chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED);
chrome.cast.initialize(apiConfig, onInitSuccess, onError);
}
function loadCastApi(loaded, errorInfo) {
if (loaded) {
initializeCastApi();
} else {
throw errorInfo;
}
}
return {
init: function () {
var intro = document.getElementById('download_intro');
if (intro) {
intro.insertAdjacentHTML('beforeend', '<img class="cast_icon" id="cast_disabled" src="img/ic_media_route_disabled_holo_light.png" alt="" title="Google Cast is not supported on this browser." /> <img class="cast_btn cast_hidden cast_icon" id="cast_btn_launch" src="img/ic_media_route_off_holo_light.png" title="Cast to ChromeCast" alt="Google Cast™" /> <img src="img/ic_media_route_on_holo_light.png" alt="Casting to ChromeCast…" title="Stop casting" id="cast_btn_stop" class="cast_btn cast_hidden cast_icon" />');
window.__onGCastApiAvailable = loadCastApi;
}
}
};
}());
window.addEventListener('load', castModule.init, false);

View File

@ -1,5 +1,5 @@
<!Doctype HTML>
<html lang="en" itemscope itemtype="http://schema.org/WebApplication">
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@ -9,7 +9,7 @@
<body>
<div class="wrapper">
<div class="main">
<h1><img itemprop="image" class="logo" src="img/logo.png"
<h1><img class="logo" src="img/logo.png"
alt="AllTube Download" width="328" height="284"></h1>
<div>This application is undergoing maintenance right now. Please check back later.</div>
</div>

View File

@ -1,7 +1,8 @@
{
"short_name": "AllTube",
"name": "AllTube Download",
"display": "minimal-ui",
"description": "Easily download videos from Youtube, Dailymotion, Vimeo and other websites",
"display": "standalone",
"icons": [{
"src": "img/favicon.png",
"sizes": "32x32",
@ -24,6 +25,7 @@
"type": "image/png"
}],
"lang": "en",
"start_url": "./index.php",
"theme_color": "#4F4F4F"
"start_url": "./",
"theme_color": "#4F4F4F",
"orientation": "portrait"
}

View File

@ -1,6 +1,6 @@
{
"name": "alltube",
"version": "0.4.5",
"version": "0.5.0",
"license": "GPL-3.0",
"dependencies": {
"grunt": "~1.0.1",
@ -10,9 +10,10 @@
"grunt-contrib-watch": "~1.0.0",
"grunt-phpcs": "~0.4.0",
"grunt-phpunit": "~0.3.6",
"grunt-contrib-compress": "~1.2.0",
"grunt-contrib-compress": "~1.3.0",
"bower": "~1.7.1",
"grunt-githash": "~0.1.3"
"grunt-githash": "~0.1.3",
"grunt-jslint": "~1.1.14"
},
"repository": {
"type": "git",

View File

@ -10,4 +10,3 @@
{/foreach}
</i></p>
</div>
</div>

View File

@ -1,10 +1,10 @@
</div>
<footer>
<div class="footer_wrapper">
Code by <a rel="author" target="blank" itemprop="author"
Code by <a rel="author" target="blank"
href="http://rudloff.pro/">Pierre Rudloff</a>
&middot; Design by
<a rel="author" itemprop="author" target="blank"
<a rel="author" target="blank"
href="http://olivierhaquette.fr">Olivier Haquette</a>
&middot;
<a target="_blank"

View File

@ -1,30 +1,24 @@
<!Doctype HTML>
<html lang="en" itemscope itemtype="http://schema.org/WebApplication">
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name="description" content="Easily download videos from Youtube, Dailymotion, Vimeo and other websites." />
{if isset($description)}
<meta name="description" content="{$description|escape}" />
<meta name="twitter:description" content="{$description|escape}" />
<meta property="og:description" content="{$description|escape}" />
{/if}
<link rel="stylesheet" href="{base_url|noscheme}/dist/main.css" />
<link rel="author" href="https://plus.google.com/110403274854419000481?rel=author" />
<link rel="author" href="https://plus.google.com/103696815796116179392?rel=author" />
<link href="https://plus.google.com/108799967445657477255" rel="publisher" />
<title itemprop="name">AllTube Download</title>
<meta itemprop="url" content="{base_url|noscheme}" />
<title>AllTube Download{if isset($title)} - {$title|escape}{/if}</title>
<link rel="canonical" href="//{$smarty.server.HTTP_HOST|cat:$smarty.server.REQUEST_URI|replace:{base_url|noscheme}:'http://www.alltubedownload.net'}" />
<link rel="icon" href="{base_url|noscheme}/img/favicon.png" />
<meta property="og:url" content="{base_url|noscheme}" />
<meta property="og:title" content="AllTube Download" />
<meta property="og:description" content="Easily download videos from Youtube, Dailymotion, Vimeo and other websites." />
<meta property="og:image" content="{base_url|noscheme}/img/logo.png" />
<meta property="og:title" content="AllTube Download{if isset($title)} - {$title|escape}{/if}" />
<meta property="og:image" content="{base_url}/img/logo.png" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="AllTube Download" />
<meta name="twitter:image" content="{base_url|noscheme}/img/logo.png" />
<meta name="twitter:title" content="AllTube Download{if isset($title)} - {$title|escape}{/if}" />
<meta name="twitter:image" content="{base_url}/img/logo.png" />
<meta name="twitter:creator" content="@Tael67" />
<meta name="twitter:description" content="Easily download videos from Youtube, Dailymotion, Vimeo and other websites." />
<script type="text/javascript" src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>
<meta itemprop="applicationCategory" content="Download" />
<meta itemprop="operatingSystem" content="Linux" />
<meta itemprop="operatingSystem" content="Mac OS X" />
<meta name="theme-color" content="#4F4F4F">
<link rel="manifest" href="manifest.json" />
</head>

View File

@ -1,5 +1,5 @@
<div class="main">
<div><img itemprop="image" class="logo" src="{base_url|noscheme}/img/logo.png"
<div><img class="logo" src="{base_url|noscheme}/img/logo.png"
alt="AllTube Download" width="328" height="284"></div>
<form action="{path_for name="video"}">
<label class="labelurl" for="url">
@ -21,7 +21,7 @@
</div>
</form>
<a class="combatiblelink" href="{path_for name="extractors"}">See all supported websites</a>
<div id="bookmarklet">
<div id="bookmarklet" class="bookmarklet_wrapper">
<p> Drag this to your bookmarks bar: </p>
<a class="bookmarklet" href="javascript:window.location='{base_url|noscheme}{path_for name='video'}?url='+encodeURIComponent(location.href);">Bookmarklet</a>
</div>

View File

@ -2,31 +2,28 @@
<div itemscope itemtype="http://schema.org/VideoObject">
<div class="main">
{include file="logo.tpl"}
<p>You are going to download<i itemprop="name">
<p id="download_intro">You are going to download<i itemprop="name">
<a itemprop="url" id="video_link"
data-ext="{$video->ext}"
data-video="{$video->url|escape}"
href="{$video->webpage_url}">
{$video->title}</a></i>.
<img class="cast_icon" id="cast_disabled"
src="{base_url|noscheme}/img/ic_media_route_disabled_holo_light.png"
alt="Google Cast™ is disabled"
title="Google Cast is not supported on this browser." />
<img class="cast_btn cast_hidden cast_icon" id="cast_btn_launch"
src="{base_url|noscheme}/img/ic_media_route_off_holo_light.png"
title="Cast to ChromeCast" alt="Google Cast™" />
<img src="{base_url|noscheme}/img/ic_media_route_on_holo_light.png"
alt="Casting to ChromeCast…" title="Stop casting"
id="cast_btn_stop" class="cast_btn cast_hidden cast_icon" /></p>
</p>
{if isset($video->thumbnail)}
<img itemprop="image" class="thumb" src="{$video->thumbnail}" alt="" />
<img itemprop="thumbnailUrl" class="thumb" src="{$video->thumbnail}" alt="" />
{/if}
{if isset($video->description)}
<meta itemprop="description" content="{$video->description|escape}" />
{/if}
{if isset($video->upload_date)}
<meta itemprop="uploadDate" content="{$video->upload_date}" />
{/if}
<br/>
{if isset($video->formats)}
<h3><label for="format">Available formats:</label></h3>
<form action="{path_for name="redirect"}">
<input type="hidden" name="url" value="{$video->webpage_url}" />
<select name="format" id="format" class="monospace">
<select name="format" id="format" class="formats monospace">
<optgroup label="Generic formats">
<option value="best[protocol^=http]">
{strip}
@ -43,7 +40,6 @@
</optgroup>
<optgroup label="Detailed formats" class="monospace">
{foreach $video->formats as $format}
{$format->protocol}
{if $format->protocol|in_array:array('http', 'https')}
{strip}
<option value="{$format->format_id}">