mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Add VideoThumbnail command
This commit is contained in:
parent
a86a7d2769
commit
7f437d4714
1 changed files with 52 additions and 0 deletions
52
app/Console/Commands/VideoThumbnail.php
Normal file
52
app/Console/Commands/VideoThumbnail.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Media;
|
||||
use App\Jobs\VideoPipeline\VideoThumbnail as Pipeline;
|
||||
|
||||
class VideoThumbnail extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'video:thumbnail';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generate missing video thumbnails';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$limit = 10;
|
||||
$videos = Media::whereMime('video/mp4')
|
||||
->whereNull('thumbnail_path')
|
||||
->take($limit)
|
||||
->get();
|
||||
foreach($videos as $video) {
|
||||
Pipeline::dispatchNow($video);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue