Skip to content
Permalink
Browse files

Apply fixes from StyleCI

  • Loading branch information...
Insax authored and StyleCIBot committed Aug 5, 2017
1 parent fe2aa78 commit 8b2e418714bc3695a0272425318116b62600fc43
@@ -2,10 +2,10 @@
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
@@ -26,11 +26,10 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function() {
$schedule->call(function () {
$data = DB::table('data')->where('created_at', '<', '(NOW() - INTERVAL 1 DAY)')->value('guid');
if($data)
{
if ($data) {
foreach ($data as $e) {
Storage::delete($e);
Storage::delete('public/'.$e.'.mp4');
@@ -2,12 +2,12 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\View;
use Illuminate\Http\Request;
class Controller extends BaseController
{
@@ -16,7 +16,8 @@ class Controller extends BaseController
public function __construct(Request $request)
{
$cookies = $request->cookie('projects');
if($cookies)
if ($cookies) {
View::share('cookies', $cookies);
}
}
}
@@ -2,8 +2,8 @@
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
class StaticsController extends Controller
{
@@ -14,13 +14,13 @@ public function index()
public function error(Request $request)
{
if($request->input('type') === 'vid')
if ($request->input('type') === 'vid') {
return view('error.errorVid');
else if($request->input('type') === 'yt')
} elseif ($request->input('type') === 'yt') {
return view('error.errorYT');
else
} else {
Redirect::route('index');
}
}
public function converter()
@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SubtitleController extends Controller
{
public function index()
@@ -44,16 +44,16 @@ public function rules()
public function withValidator($validator)
{
$validator->after(function ($validator) {
$data = (object)$validator->getData();
$data = (object) $validator->getData();
if ($data->url) {
if (!$this->validateRemoteFile($data->url)) {
if (! $this->validateRemoteFile($data->url)) {
$validator->errors()->add('url', 'Bitte eine richtige URL angeben!');
}
}
if ($data->youtube) {
if (preg_match('/(http\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+/', $data->youtube) != false) {
if (!Youtube::getVideoInfo(Youtube::parseVidFromURL($data->youtube))) {
if (! Youtube::getVideoInfo(Youtube::parseVidFromURL($data->youtube))) {
$validator->errors()->add('youtube', 'Diese Youtube Adresse ist nicht gültig');
} elseif (strtotime(Youtube::getVideoInfo(Youtube::parseVidFromURL($data->youtube))->contentDetails->duration) > (40 * 60)) {
$validator->errors()->add('youtube', 'Dieses Youtube Video ist zu lang!');
@@ -67,14 +67,13 @@ public function withValidator($validator)
$validator->errors()->add('cutstart', 'Der Start des Videos kann nicht nach dem Ende sein!');
}
if (!$data->limit) {
if (! $data->limit) {
$validator->errors()->add('limitnull', 'Gib mindestens 1Mb an!');
}
});
}
private
function YTDurationToSeconds($time)
private function YTDurationToSeconds($time)
{
$duration = new DateInterval($time);
@@ -87,18 +86,17 @@ function YTDurationToSeconds($time)
* @param $url
* @return bool
*/
private
function validateRemoteFile($url)
private function validateRemoteFile($url)
{
$data = Curl::to($url)->allowRedirect()->withOption('NOBODY', true)->withOption('HEADER', true)->get();
if ($data) {
if (preg_match('/^HTTP\/1\.[01] (\d\d\d)/', $data, $matches)) {
$status = (int)$matches[1];
$status = (int) $matches[1];
}
if (preg_match('/Content-Length: (\d+)/', $data, $matches)) {
$contentLength = (int)$matches[1];
$contentLength = (int) $matches[1];
}
if (preg_match('/Content-Type: (\w+\/\w+)/', $data, $matches)) {
@@ -131,6 +129,5 @@ function validateRemoteFile($url)
}
return false;
}
}
@@ -310,7 +310,9 @@ private function isGif()
return false;
}
}
public function failed(){
public function failed()
{
DB::table('data')->where('guid', $this->name)->update(['progress' => 420]);
}
}
@@ -62,7 +62,9 @@ public function handle()
File::move($video->getFile()->getPathname(), $this->loc.'/'.$this->name);
dispatch((new ConvertVideo($this->loc, $this->name, $this->sound, $this->res, $this->limit, $this->start, $this->end))->onQueue('convert'));
}
public function failed(){
public function failed()
{
DB::table('data')->where('guid', $this->name)->update(['progress' => 421]);
}
}
@@ -23,7 +23,6 @@
Route::get('error', 'StaticsController@error')->name('error');
});
/*
* Dynamic content
*/

0 comments on commit 8b2e418

Please sign in to comment.
You can’t perform that action at this time.